From 690e35300ef3a9dd0288406e2c30f09bad36cb10 Mon Sep 17 00:00:00 2001 From: Magic Cat Date: Thu, 24 Jun 2021 22:31:26 +0800 Subject: [PATCH 01/17] Initial queryTotalNumberOfAccounts --- imports/ui/accounts/TotalAccounts.jsx | 59 ++++ package-lock.json | 473 ++++++++++++++++++++++++++ package.json | 5 + 3 files changed, 537 insertions(+) create mode 100644 imports/ui/accounts/TotalAccounts.jsx diff --git a/imports/ui/accounts/TotalAccounts.jsx b/imports/ui/accounts/TotalAccounts.jsx new file mode 100644 index 000000000..9a391ea6e --- /dev/null +++ b/imports/ui/accounts/TotalAccounts.jsx @@ -0,0 +1,59 @@ +import { getNewWalletFromSeed } from "@lunie/cosmos-keys" +import { signWithPrivateKey } from "@lunie/cosmos-keys" +import Cosmos from "@lunie/cosmos-js" + + +function getFromAddress(){ + const seed = "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone"; + const bech32prefix = 'cosmos'; + let hdpath = `m/44'/${COINTYPE}'/0'/0/0` + const { cosmosAddress, privateKey, publicKey } = getNewWalletFromSeed(seed, bech32prefix, hdpath) + return { cosmosAddress, privateKey, publicKey } +} +function getToAddress() { + const seed = "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone"; + const bech32prefix = 'cosmos'; + let hdpath = `m/44'/${COINTYPE}'/1'/0/0` + const { cosmosAddress, privateKey, publicKey } = getNewWalletFromSeed(seed, bech32prefix, hdpath) + return { cosmosAddress, privateKey, publicKey } +} +export async function queryTotalNumberOfAccounts(transportBLE, accountIndex) { + // let signMessage = { "account_number": "51442", + // "chain_id": "cosmoshub-4", + // "fee": { "amount": [{ "amount": "1879", "denom": "uatom" }], "gas": "93931" }, + // "memo": "Sent via Big Dipper", + // "msgs": [{ + // "type": "cosmos-sdk/MsgSend", + // "value": { "amount": [{ "amount": "100000", "denom": "uatom" }], + // "from_address": "cosmos1uulfsj45fvvkr98s859nxkzy08dzejs35ruy3l", + // "to_address": "cosmos1uulfsj45fvvkr98s859nxkzy08dzejs35ruy3l" } }], + // "sequence": "3" } + + let getFromAddress = getFromAddress(); + let getToAddress = getToAddress(); + + console.log(getFromAddress, getToAddress); + + const cosmos = Cosmos("http://139.162.187.197:1317", getFromAddress.cosmosAddress) + // create message + const msg = cosmos + .MsgSend({ toAddress: getToAddress, amounts: [{ denom: 'uatom', amount: 100 }] }) + console.log(msg) + // create a signer from this local js signer library + const localSigner = (signMessage) => { + const signature = signWithPrivateKey(signMessage, privateKey) + + return { + signature, + publicKey + } + } + + // send the transaction + const { included } = await msg.send({ gas: 200000 }, localSigner) + console.log(included) + // await tx to be included in a block + await included() + + return '' +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 81fa8afcd..b39d3688a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -173,6 +173,146 @@ "to-fast-properties": "^2.0.0" } }, + "@confio/ics23": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/@confio/ics23/-/ics23-0.6.5.tgz", + "integrity": "sha512-1GdPMsaP/l8JSF4P4HWFLBhdcxHcJT8lS0nknBYNSZ1XrJOsJKUy6EkOwd9Pa1qJkXzY2gyNv7MdHR+AIwSTAg==", + "requires": { + "js-sha512": "^0.8.0", + "protobufjs": "^6.8.8", + "ripemd160": "^2.0.2", + "sha.js": "^2.4.11" + } + }, + "@cosmjs/amino": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@cosmjs/amino/-/amino-0.25.5.tgz", + "integrity": "sha512-q9tU2b9hJ3S/KxYCLSyiZCfkaidbSPBr2sJ5HPLxz48y5O4k9sYM7bPa0zioeePaIBnby3AOgyjucVxlbzUlYg==", + "requires": { + "@cosmjs/crypto": "^0.25.5", + "@cosmjs/encoding": "^0.25.5", + "@cosmjs/math": "^0.25.5", + "@cosmjs/utils": "^0.25.5" + } + }, + "@cosmjs/crypto": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@cosmjs/crypto/-/crypto-0.25.5.tgz", + "integrity": "sha512-i0Nfbk4JXAwyKNGPFu0o1xV6IJUbYmmveySytbU/yweybcZppxoczjSQ1sGrUaLVLvgfcpfwZte3jKqDR67+dg==", + "requires": { + "@cosmjs/encoding": "^0.25.5", + "@cosmjs/math": "^0.25.5", + "@cosmjs/utils": "^0.25.5", + "bip39": "^3.0.2", + "bn.js": "^4.11.8", + "elliptic": "^6.5.3", + "js-sha3": "^0.8.0", + "libsodium-wrappers": "^0.7.6", + "ripemd160": "^2.0.2", + "sha.js": "^2.4.11" + } + }, + "@cosmjs/encoding": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@cosmjs/encoding/-/encoding-0.25.5.tgz", + "integrity": "sha512-QT7MaPBiMeCaMJ6VZZKeOqDQlAxMEzTFjBFhbkdyx5DVRc4dPOVO4HbTggmIN5/eizIv4/CNJSVTR//tO53J0A==", + "requires": { + "base64-js": "^1.3.0", + "bech32": "^1.1.4", + "readonly-date": "^1.0.0" + } + }, + "@cosmjs/json-rpc": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@cosmjs/json-rpc/-/json-rpc-0.25.5.tgz", + "integrity": "sha512-WFDallAolxBqB8V/mYxU0riF/OBoc6Fc2DDsZhds5xOZxeN9sTX0qWhu1UiFyURw4Z9D+SjB9QngqSDBTMTdjw==", + "requires": { + "@cosmjs/stream": "^0.25.5", + "xstream": "^11.14.0" + } + }, + "@cosmjs/math": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@cosmjs/math/-/math-0.25.5.tgz", + "integrity": "sha512-LWovT1uTHlr+VEce27/14Wrgc4INJYOYk1+ncyvbZertixNFH6OMnc9Xkk0DIV4RYmW+/fvB9kCXVnNtQGSuHg==", + "requires": { + "bn.js": "^4.11.8" + } + }, + "@cosmjs/proto-signing": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@cosmjs/proto-signing/-/proto-signing-0.25.5.tgz", + "integrity": "sha512-YWVp+dGHt7v6ZKjOs8CI9xkpOV49eweHbYMv/vCVYF4cEh0kWwy2WzbWIkUH9zwwUqCxigVOTBYUCfbsjEbfug==", + "requires": { + "@cosmjs/amino": "^0.25.5", + "long": "^4.0.0", + "protobufjs": "~6.10.2" + } + }, + "@cosmjs/socket": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@cosmjs/socket/-/socket-0.25.5.tgz", + "integrity": "sha512-wcJVbD4xlF4+5hMum4tOmAy5ppX+E9qrB9Pvt3T7BK+6T5uobxiBQCLEiDwHP3n42RBj+xQWJrScPf5IEWmZKg==", + "requires": { + "@cosmjs/stream": "^0.25.5", + "isomorphic-ws": "^4.0.1", + "ws": "^7", + "xstream": "^11.14.0" + }, + "dependencies": { + "ws": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.0.tgz", + "integrity": "sha512-6ezXvzOZupqKj4jUqbQ9tXuJNo+BR2gU8fFRk3XCP3e0G6WT414u5ELe6Y0vtp7kmSJ3F7YWObSNr1ESsgi4vw==" + } + } + }, + "@cosmjs/stargate": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@cosmjs/stargate/-/stargate-0.25.5.tgz", + "integrity": "sha512-cOZ+fOC16YT7W2vjBnnk9oJfuIlB02KdK6dn6aigMd4mx+7DS2jvNslpQrfKmtrwB9AVsgc6tklBkYwG5qAuKQ==", + "requires": { + "@confio/ics23": "^0.6.3", + "@cosmjs/amino": "^0.25.5", + "@cosmjs/encoding": "^0.25.5", + "@cosmjs/math": "^0.25.5", + "@cosmjs/proto-signing": "^0.25.5", + "@cosmjs/stream": "^0.25.5", + "@cosmjs/tendermint-rpc": "^0.25.5", + "@cosmjs/utils": "^0.25.5", + "long": "^4.0.0", + "protobufjs": "~6.10.2" + } + }, + "@cosmjs/stream": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@cosmjs/stream/-/stream-0.25.5.tgz", + "integrity": "sha512-a+0sDNKZTxw9p4j5tl7SI0siMTii7AQot1+5vkH5BkQoAv3C3D8jagPouUz3RUFuh13qftPxPLiHzDFLNSjTnQ==", + "requires": { + "xstream": "^11.14.0" + } + }, + "@cosmjs/tendermint-rpc": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@cosmjs/tendermint-rpc/-/tendermint-rpc-0.25.5.tgz", + "integrity": "sha512-WlUCFVdhbwA3IDA1C858S8WOtLseZLXKTdj5fz1sTKSBmtrig4l1ZMKHHlZRprvmjSpkpbjgSQU+RjjvBd75BA==", + "requires": { + "@cosmjs/crypto": "^0.25.5", + "@cosmjs/encoding": "^0.25.5", + "@cosmjs/json-rpc": "^0.25.5", + "@cosmjs/math": "^0.25.5", + "@cosmjs/socket": "^0.25.5", + "@cosmjs/stream": "^0.25.5", + "axios": "^0.21.1", + "readonly-date": "^1.0.0", + "xstream": "^11.14.0" + } + }, + "@cosmjs/utils": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@cosmjs/utils/-/utils-0.25.5.tgz", + "integrity": "sha512-U4YdgJadFgXWblthgyXqP28Yw5rsw2IX/cOES0pa6fiB81hoYl2LXqXiuKp2yVPoAgk8JpkFh3i5KchcD9muJg==" + }, "@emotion/is-prop-valid": { "version": "0.7.3", "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-0.7.3.tgz", @@ -264,6 +404,59 @@ "resolved": "https://registry.npmjs.org/@ledgerhq/logs/-/logs-5.50.0.tgz", "integrity": "sha512-swKHYCOZUGyVt4ge0u8a7AwNcA//h4nx5wIi0sruGye1IJ5Cva0GyK9L2/WdX+kWVTKp92ZiEo1df31lrWGPgA==" }, + "@lunie/cosmos-js": { + "version": "0.0.22", + "resolved": "https://registry.npmjs.org/@lunie/cosmos-js/-/cosmos-js-0.0.22.tgz", + "integrity": "sha512-u4ma8cnHGE60B4afmAnQnHDcjtqpPkEygOp21oO0eZBN0gn+KNDXtcTJzeZ307/3gfe0t4ZEKPh7mV6DDCafxg==", + "requires": { + "axios": "^0.19.0" + }, + "dependencies": { + "axios": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz", + "integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==", + "requires": { + "follow-redirects": "1.5.10" + } + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + }, + "follow-redirects": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", + "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", + "requires": { + "debug": "=3.1.0" + } + } + } + }, + "@lunie/cosmos-keys": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@lunie/cosmos-keys/-/cosmos-keys-0.3.2.tgz", + "integrity": "sha512-QXEA0xY+hb5IeUIduQKzIqlqbl1zd2phKc/KVQnrAGH8QdepvdI0M6w0rXMq1wqJNN+m/MuwIf+UAT5q1eRj0A==", + "requires": { + "bcrypto": "^5.1.0", + "bech32": "^1.1.3", + "bip32": "^2.0.4", + "bip39": "^3.0.2", + "crypto-js": "^4.0.0" + }, + "dependencies": { + "crypto-js": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.0.0.tgz", + "integrity": "sha512-bzHZN8Pn+gS7DQA6n+iUmBfl0hO5DJq++QP3U6uTucDtk/0iGpXd/Gg7CGR0p8tJhofJyaKoWBuJI4eAO00BBg==" + } + } + }, "@meteorjs/eslint-config-meteor": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/@meteorjs/eslint-config-meteor/-/eslint-config-meteor-1.0.5.tgz", @@ -294,6 +487,60 @@ } } }, + "@protobufjs/aspromise": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", + "integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78=" + }, + "@protobufjs/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" + }, + "@protobufjs/codegen": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" + }, + "@protobufjs/eventemitter": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", + "integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A=" + }, + "@protobufjs/fetch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", + "integrity": "sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=", + "requires": { + "@protobufjs/aspromise": "^1.1.1", + "@protobufjs/inquire": "^1.1.0" + } + }, + "@protobufjs/float": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", + "integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E=" + }, + "@protobufjs/inquire": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", + "integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik=" + }, + "@protobufjs/path": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", + "integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=" + }, + "@protobufjs/pool": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", + "integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=" + }, + "@protobufjs/utf8": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", + "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=" + }, "@types/d3": { "version": "4.13.12", "resolved": "https://registry.npmjs.org/@types/d3/-/d3-4.13.12.tgz", @@ -538,6 +785,11 @@ "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.163.tgz", "integrity": "sha512-BeZM/FZaV53emqyHxn9L39Oz6XbHMBRLA1b1quROku48J/1kYYxPmVOJ/qSQheb81on4BI7H6QDo6bkUuRaDNQ==" }, + "@types/long": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz", + "integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w==" + }, "@types/meteor-universe-i18n": { "version": "1.14.5", "resolved": "https://registry.npmjs.org/@types/meteor-universe-i18n/-/meteor-universe-i18n-1.14.5.tgz", @@ -1328,11 +1580,33 @@ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, + "base-x": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.8.tgz", + "integrity": "sha512-Rl/1AWP4J/zRrk54hhlxH4drNxPJXYUaKffODVI53/dAsV4t9fBxyxYKAVPU1XBHxYwOWP9h9H0hM2MVw4YfJA==", + "requires": { + "safe-buffer": "^5.0.1" + } + }, "base16": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/base16/-/base16-1.0.0.tgz", "integrity": "sha1-4pf2DX7BAUp6lxo568ipjAtoHnA=" }, + "base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" + }, + "bcrypto": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/bcrypto/-/bcrypto-5.4.0.tgz", + "integrity": "sha512-KDX2CR29o6ZoqpQndcCxFZAtYA1jDMnXU3jmCfzP44g++Cu7AHHtZN/JbrN/MXAg9SLvtQ8XISG+eVD9zH1+Jg==", + "requires": { + "bufio": "~1.0.7", + "loady": "~0.0.5" + } + }, "bech32": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", @@ -1351,6 +1625,45 @@ "file-uri-to-path": "1.0.0" } }, + "bip32": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/bip32/-/bip32-2.0.6.tgz", + "integrity": "sha512-HpV5OMLLGTjSVblmrtYRfFFKuQB+GArM0+XP8HGWfJ5vxYBqo+DesvJwOdC2WJ3bCkZShGf0QIfoIpeomVzVdA==", + "requires": { + "@types/node": "10.12.18", + "bs58check": "^2.1.1", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "tiny-secp256k1": "^1.1.3", + "typeforce": "^1.11.5", + "wif": "^2.0.6" + }, + "dependencies": { + "@types/node": { + "version": "10.12.18", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.18.tgz", + "integrity": "sha512-fh+pAqt4xRzPfqA6eh3Z2y6fyZavRIumvjhaCL753+TVkGKGhpPeyrJG2JftD0T9q4GF00KjefsQ+PQNDdWQaQ==" + } + } + }, + "bip39": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/bip39/-/bip39-3.0.4.tgz", + "integrity": "sha512-YZKQlb752TrUWqHWj7XAwCSjYEgGAk+/Aas3V7NyjQeZYsztO8JnQUaCWhcnL4T+jL8nvB8typ2jRPzTlgugNw==", + "requires": { + "@types/node": "11.11.6", + "create-hash": "^1.1.0", + "pbkdf2": "^3.0.9", + "randombytes": "^2.0.1" + }, + "dependencies": { + "@types/node": { + "version": "11.11.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-11.11.6.tgz", + "integrity": "sha512-Exw4yUWMBXM3X+8oqzJNRqZSwUAaS4+7NdvHqQuFi/d+synz++xmX3QIf+BFqneW8N31R8Ky+sikfZUXq07ggQ==" + } + } + }, "bip66": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/bip66/-/bip66-1.1.5.tgz", @@ -1407,11 +1720,34 @@ "safe-buffer": "^5.0.1" } }, + "bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha1-vhYedsNU9veIrkBx9j806MTwpCo=", + "requires": { + "base-x": "^3.0.2" + } + }, + "bs58check": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz", + "integrity": "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==", + "requires": { + "bs58": "^4.0.0", + "create-hash": "^1.1.0", + "safe-buffer": "^5.1.2" + } + }, "buffer-xor": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=" }, + "bufio": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/bufio/-/bufio-1.0.7.tgz", + "integrity": "sha512-bd1dDQhiC+bEbEfg56IdBv7faWa6OipMs/AFFFvtFnB3wAYjlwQpQRZ0pm6ZkgtfL0pILRXhKxOiQj6UzoMR7A==" + }, "call-bind": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.0.tgz", @@ -3373,6 +3709,14 @@ "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==" }, + "globalthis": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.2.tgz", + "integrity": "sha512-ZQnSFO1la8P7auIOQECnm0sSuoMeaSq0EEdXMBFF2QJO4uNcwbyhSgG3MruWNbFTqCLmxVwGOl7LZ9kASvHdeQ==", + "requires": { + "define-properties": "^1.1.3" + } + }, "graceful-fs": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", @@ -3763,6 +4107,11 @@ "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" }, + "isomorphic-ws": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz", + "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==" + }, "jquery": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz", @@ -3773,6 +4122,16 @@ "resolved": "https://registry.npmjs.org/js-sha256/-/js-sha256-0.9.0.tgz", "integrity": "sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA==" }, + "js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + }, + "js-sha512": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha512/-/js-sha512-0.8.0.tgz", + "integrity": "sha512-PWsmefG6Jkodqt+ePTvBZCSMFgN7Clckjd0O7su3I0+BW2QWUTJNzjktHsztGLhncP2h8mcF9V9Y2Ha59pAViQ==" + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -3962,6 +4321,19 @@ "type-check": "~0.3.2" } }, + "libsodium": { + "version": "0.7.9", + "resolved": "https://registry.npmjs.org/libsodium/-/libsodium-0.7.9.tgz", + "integrity": "sha512-gfeADtR4D/CM0oRUviKBViMGXZDgnFdMKMzHsvBdqLBHd9ySi6EtYnmuhHVDDYgYpAO8eU8hEY+F8vIUAPh08A==" + }, + "libsodium-wrappers": { + "version": "0.7.9", + "resolved": "https://registry.npmjs.org/libsodium-wrappers/-/libsodium-wrappers-0.7.9.tgz", + "integrity": "sha512-9HaAeBGk1nKTRFRHkt7nzxqCvnkWTjn1pdjKgcUnZxj0FyOP4CnhgFhMdrFfgNsukijBGyBLpP2m2uKT1vuWhQ==", + "requires": { + "libsodium": "^0.7.0" + } + }, "load-json-file": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", @@ -3974,6 +4346,11 @@ "strip-bom": "^3.0.0" } }, + "loady": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/loady/-/loady-0.0.5.tgz", + "integrity": "sha512-uxKD2HIj042/HBx77NBcmEPsD+hxCgAtjEWlYNScuUjIsh/62Uyu39GOR68TBR68v+jqDL9zfftCWoUo4y03sQ==" + }, "locate-path": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", @@ -3999,6 +4376,11 @@ "resolved": "https://registry.npmjs.org/lodash.flow/-/lodash.flow-3.5.0.tgz", "integrity": "sha1-h79AKSuM+D5OjOGjrkIJ4gBxZ1o=" }, + "long": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", + "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" + }, "loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", @@ -5273,6 +5655,18 @@ "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", "dev": true }, + "pbkdf2": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", + "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", + "requires": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, "pify": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", @@ -5670,6 +6064,33 @@ "react-is": "^16.8.1" } }, + "protobufjs": { + "version": "6.10.2", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.10.2.tgz", + "integrity": "sha512-27yj+04uF6ya9l+qfpH187aqEzfCF4+Uit0I9ZBQVqK09hk/SQzKa2MUqUpXaVa7LOFRg1TSSr3lVxGOk6c0SQ==", + "requires": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.4", + "@protobufjs/eventemitter": "^1.1.0", + "@protobufjs/fetch": "^1.1.0", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.0", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.0", + "@types/long": "^4.0.1", + "@types/node": "^13.7.0", + "long": "^4.0.0" + }, + "dependencies": { + "@types/node": { + "version": "13.13.52", + "resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.52.tgz", + "integrity": "sha512-s3nugnZumCC//n4moGGe6tkNMyYEdaDBitVjwPxXmR5lnMG5dHePinH2EdxkG3Rh1ghFHHixAG4NJhpJW1rthQ==" + } + } + }, "pump": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", @@ -5700,6 +6121,14 @@ "resolved": "https://registry.npmjs.org/pure-color/-/pure-color-1.3.0.tgz", "integrity": "sha1-H+Bk+wrIUfDeYTIKi/eWg2Qi8z4=" }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "requires": { + "safe-buffer": "^5.1.0" + } + }, "react": { "version": "16.14.0", "resolved": "https://registry.npmjs.org/react/-/react-16.14.0.tgz", @@ -5962,6 +6391,11 @@ "util-deprecate": "^1.0.1" } }, + "readonly-date": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/readonly-date/-/readonly-date-1.0.0.tgz", + "integrity": "sha512-tMKIV7hlk0h4mO3JTmmVuIlJVXjKk3Sep9Bf5OH0O+758ruuVkUy2J9SttDLm91IEX/WHlXPSpxMGjPj4beMIQ==" + }, "regenerator-runtime": { "version": "0.13.7", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz", @@ -6774,6 +7208,11 @@ "has-flag": "^3.0.0" } }, + "symbol-observable": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-2.0.3.tgz", + "integrity": "sha512-sQV7phh2WCYAn81oAkakC5qjq2Ml0g8ozqz03wOGnx9dDlG1de6yrF+0RAzSJD8fPUow3PTSMf2SAbOGxb93BA==" + }, "table": { "version": "5.4.1", "resolved": "https://registry.npmjs.org/table/-/table-5.4.1.tgz", @@ -6916,6 +7355,18 @@ "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.0.6.tgz", "integrity": "sha512-FOyLWWVjG+aC0UqG76V53yAWdXfH8bO6FNmyZOuUrzDzK8DI3/JRY25UD7+g49JWM1LXwymsKERB+DzI0dTEQA==" }, + "tiny-secp256k1": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/tiny-secp256k1/-/tiny-secp256k1-1.1.6.tgz", + "integrity": "sha512-FmqJZGduTyvsr2cF3375fqGHUovSwDi/QytexX1Se4BPuPZpTE5Ftp5fg+EFSuEf3lhZqgCRjEG3ydUQ/aNiwA==", + "requires": { + "bindings": "^1.3.0", + "bn.js": "^4.11.8", + "create-hmac": "^1.1.7", + "elliptic": "^6.4.0", + "nan": "^2.13.2" + } + }, "tiny-warning": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz", @@ -6990,6 +7441,11 @@ "resolved": "https://registry.npmjs.org/typed-styles/-/typed-styles-0.0.7.tgz", "integrity": "sha512-pzP0PWoZUhsECYjABgCGQlRGL1n7tOHsgwYv3oIiEpJwGhFTuty/YNeduxQYzXXa3Ge5BdT6sHYIQYpl4uJ+5Q==" }, + "typeforce": { + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/typeforce/-/typeforce-1.18.0.tgz", + "integrity": "sha512-7uc1O8h1M1g0rArakJdf0uLRSSgFcYexrVoKo+bzJd32gd4gDy2L/Z+8/FjPnU9ydY3pEnVPtr9FyscYY60K1g==" + }, "typescript": { "version": "3.7.4", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.4.tgz", @@ -7195,6 +7651,14 @@ "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" }, + "wif": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/wif/-/wif-2.0.6.tgz", + "integrity": "sha1-CNP1IFbGZnkplyb63g1DKudLRwQ=", + "requires": { + "bs58check": "<3.0.0" + } + }, "wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", @@ -7240,6 +7704,15 @@ "resolved": "https://registry.npmjs.org/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz", "integrity": "sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw=" }, + "xstream": { + "version": "11.14.0", + "resolved": "https://registry.npmjs.org/xstream/-/xstream-11.14.0.tgz", + "integrity": "sha512-1bLb+kKKtKPbgTK6i/BaoAn03g47PpFstlbe1BA+y3pNS/LfvcaghS5BFf9+EE1J+KwSQsEpfJvFN5GqFtiNmw==", + "requires": { + "globalthis": "^1.0.1", + "symbol-observable": "^2.0.3" + } + }, "xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", diff --git a/package.json b/package.json index 66660a810..c2c9d7e5d 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,13 @@ }, "dependencies": { "@babel/runtime": "^7.13.17", + "@cosmjs/amino": "^0.25.5", + "@cosmjs/proto-signing": "^0.25.5", + "@cosmjs/stargate": "^0.25.5", "@ledgerhq/hw-transport-web-ble": "^5.50.0", "@ledgerhq/hw-transport-webusb": "^5.53.0", + "@lunie/cosmos-js": "0.0.22", + "@lunie/cosmos-keys": "^0.3.2", "@types/meteor-universe-i18n": "^1.14.5", "axios": "^0.21.1", "babel-polyfill": "^6.26.0", From c7e1631b879302d2ded7d0e5e34209ef726ff09d Mon Sep 17 00:00:00 2001 From: Magic Cat Date: Fri, 25 Jun 2021 19:21:37 +0800 Subject: [PATCH 02/17] Add proto --- both/utils/proto/google/protobuf/any.proto | 158 + both/utils/proto/google/protobuf/any_pb.js | 223 + both/utils/proto/messages/.npmignore | 1 + .../proto/messages/.openapi-generator-ignore | 23 + .../proto/messages/.openapi-generator/FILES | 8 + .../proto/messages/.openapi-generator/VERSION | 1 + both/utils/proto/messages/proto.js | 142272 +++++++++++++++ package-lock.json | 413 +- package.json | 3 + 9 files changed, 143095 insertions(+), 7 deletions(-) create mode 100644 both/utils/proto/google/protobuf/any.proto create mode 100644 both/utils/proto/google/protobuf/any_pb.js create mode 100644 both/utils/proto/messages/.npmignore create mode 100644 both/utils/proto/messages/.openapi-generator-ignore create mode 100644 both/utils/proto/messages/.openapi-generator/FILES create mode 100644 both/utils/proto/messages/.openapi-generator/VERSION create mode 100644 both/utils/proto/messages/proto.js diff --git a/both/utils/proto/google/protobuf/any.proto b/both/utils/proto/google/protobuf/any.proto new file mode 100644 index 000000000..1c6a465c7 --- /dev/null +++ b/both/utils/proto/google/protobuf/any.proto @@ -0,0 +1,158 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// 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. + +syntax = "proto3"; + +package google.protobuf; + +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option go_package = "google.golang.org/protobuf/types/known/anypb"; +option java_package = "com.google.protobuf"; +option java_outer_classname = "AnyProto"; +option java_multiple_files = true; +option objc_class_prefix = "GPB"; + +// `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 := anypb.New(foo) +// if err != nil { +// ... +// } +// ... +// foo := &pb.Foo{} +// if err := any.UnmarshalTo(foo); err != nil { +// ... +// } +// +// The pack methods provided by protobuf library will by default use +// 'type.googleapis.com/full.type.name' as the type URL and the unpack +// methods only use the fully qualified type name after the last '/' +// in the type URL, for example "foo.bar.com/x/y.z" will yield type +// name "y.z". +// +// +// JSON +// ==== +// The JSON representation of an `Any` value uses the regular +// representation of the deserialized, embedded message, with an +// additional field `@type` which contains the type URL. Example: +// +// package google.profile; +// message Person { +// string first_name = 1; +// string last_name = 2; +// } +// +// { +// "@type": "type.googleapis.com/google.profile.Person", +// "firstName": , +// "lastName": +// } +// +// If the embedded message type is well-known and has a custom JSON +// representation, that representation will be embedded adding a field +// `value` which holds the custom JSON in addition to the `@type` +// field. Example (for message [google.protobuf.Duration][]): +// +// { +// "@type": "type.googleapis.com/google.protobuf.Duration", +// "value": "1.212s" +// } +// +message Any { + // A URL/resource name that uniquely identifies the type of the serialized + // protocol buffer message. This string must contain at least + // one "/" character. The last segment of the URL's path must represent + // the fully qualified name of the type (as in + // `path/google.protobuf.Duration`). The name should be in a canonical form + // (e.g., leading "." is not accepted). + // + // In practice, teams usually precompile into the binary all types that they + // expect it to use in the context of Any. However, for URLs which use the + // scheme `http`, `https`, or no scheme, one can optionally set up a type + // server that maps type URLs to message definitions as follows: + // + // * If no scheme is provided, `https` is assumed. + // * An HTTP GET on the URL must yield a [google.protobuf.Type][] + // value in binary format, or produce an error. + // * Applications are allowed to cache lookup results based on the + // URL, or have them precompiled into a binary to avoid any + // lookup. Therefore, binary compatibility needs to be preserved + // on changes to types. (Use versioned type names to manage + // breaking changes.) + // + // Note: this functionality is not currently available in the official + // protobuf release, and it is not used for type URLs beginning with + // type.googleapis.com. + // + // Schemes other than `http`, `https` (or the empty scheme) might be + // used with implementation specific semantics. + // + string type_url = 1; + + // Must be a valid serialized protocol buffer of the above specified type. + bytes value = 2; +} \ No newline at end of file diff --git a/both/utils/proto/google/protobuf/any_pb.js b/both/utils/proto/google/protobuf/any_pb.js new file mode 100644 index 000000000..e20bf1e6a --- /dev/null +++ b/both/utils/proto/google/protobuf/any_pb.js @@ -0,0 +1,223 @@ +// source: any.proto +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.google.protobuf.Any', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.google.protobuf.Any = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.google.protobuf.Any, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.google.protobuf.Any.displayName = 'proto.google.protobuf.Any'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.google.protobuf.Any.prototype.toObject = function(opt_includeInstance) { + return proto.google.protobuf.Any.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.google.protobuf.Any} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.Any.toObject = function(includeInstance, msg) { + var f, obj = { + typeUrl: jspb.Message.getFieldWithDefault(msg, 1, ""), + value: msg.getValue_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.google.protobuf.Any} + */ +proto.google.protobuf.Any.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.google.protobuf.Any; + return proto.google.protobuf.Any.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.google.protobuf.Any} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.google.protobuf.Any} + */ +proto.google.protobuf.Any.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setTypeUrl(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setValue(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.google.protobuf.Any.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.google.protobuf.Any.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.google.protobuf.Any} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.google.protobuf.Any.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getTypeUrl(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getValue_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } +}; + + +/** + * optional string type_url = 1; + * @return {string} + */ +proto.google.protobuf.Any.prototype.getTypeUrl = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.google.protobuf.Any} returns this + */ +proto.google.protobuf.Any.prototype.setTypeUrl = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional bytes value = 2; + * @return {!(string|Uint8Array)} + */ +proto.google.protobuf.Any.prototype.getValue = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes value = 2; + * This is a type-conversion wrapper around `getValue()` + * @return {string} + */ +proto.google.protobuf.Any.prototype.getValue_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getValue())); +}; + + +/** + * optional bytes value = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getValue()` + * @return {!Uint8Array} + */ +proto.google.protobuf.Any.prototype.getValue_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getValue())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.google.protobuf.Any} returns this + */ +proto.google.protobuf.Any.prototype.setValue = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + +goog.object.extend(exports, proto.google.protobuf); diff --git a/both/utils/proto/messages/.npmignore b/both/utils/proto/messages/.npmignore new file mode 100644 index 000000000..999d88df6 --- /dev/null +++ b/both/utils/proto/messages/.npmignore @@ -0,0 +1 @@ +# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm \ No newline at end of file diff --git a/both/utils/proto/messages/.openapi-generator-ignore b/both/utils/proto/messages/.openapi-generator-ignore new file mode 100644 index 000000000..7484ee590 --- /dev/null +++ b/both/utils/proto/messages/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/both/utils/proto/messages/.openapi-generator/FILES b/both/utils/proto/messages/.openapi-generator/FILES new file mode 100644 index 000000000..467f05421 --- /dev/null +++ b/both/utils/proto/messages/.openapi-generator/FILES @@ -0,0 +1,8 @@ +.gitignore +.npmignore +.openapi-generator-ignore +api.ts +base.ts +configuration.ts +git_push.sh +index.ts diff --git a/both/utils/proto/messages/.openapi-generator/VERSION b/both/utils/proto/messages/.openapi-generator/VERSION new file mode 100644 index 000000000..3fa3b389a --- /dev/null +++ b/both/utils/proto/messages/.openapi-generator/VERSION @@ -0,0 +1 @@ +5.0.1-SNAPSHOT \ No newline at end of file diff --git a/both/utils/proto/messages/proto.js b/both/utils/proto/messages/proto.js new file mode 100644 index 000000000..bfc2b19de --- /dev/null +++ b/both/utils/proto/messages/proto.js @@ -0,0 +1,142272 @@ +/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/ +// import * as $protobuf from "protobufjs/minimal"; +import $protobuf from "protobufjs/minimal"; + +// Common aliases +const $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; + +// Exported root namespace +const $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); + +export const ics23 = $root.ics23 = (() => { + + /** + * Namespace ics23. + * @exports ics23 + * @namespace + */ + const ics23 = {}; + + /** + * HashOp enum. + * @name ics23.HashOp + * @enum {number} + * @property {number} NO_HASH=0 NO_HASH value + * @property {number} SHA256=1 SHA256 value + * @property {number} SHA512=2 SHA512 value + * @property {number} KECCAK=3 KECCAK value + * @property {number} RIPEMD160=4 RIPEMD160 value + * @property {number} BITCOIN=5 BITCOIN value + */ + ics23.HashOp = (function() { + const valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NO_HASH"] = 0; + values[valuesById[1] = "SHA256"] = 1; + values[valuesById[2] = "SHA512"] = 2; + values[valuesById[3] = "KECCAK"] = 3; + values[valuesById[4] = "RIPEMD160"] = 4; + values[valuesById[5] = "BITCOIN"] = 5; + return values; + })(); + + /** + * 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) + * @name ics23.LengthOp + * @enum {number} + * @property {number} NO_PREFIX=0 NO_PREFIX value + * @property {number} VAR_PROTO=1 VAR_PROTO value + * @property {number} VAR_RLP=2 VAR_RLP value + * @property {number} FIXED32_BIG=3 FIXED32_BIG value + * @property {number} FIXED32_LITTLE=4 FIXED32_LITTLE value + * @property {number} FIXED64_BIG=5 FIXED64_BIG value + * @property {number} FIXED64_LITTLE=6 FIXED64_LITTLE value + * @property {number} REQUIRE_32_BYTES=7 REQUIRE_32_BYTES value + * @property {number} REQUIRE_64_BYTES=8 REQUIRE_64_BYTES value + */ + ics23.LengthOp = (function() { + const valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NO_PREFIX"] = 0; + values[valuesById[1] = "VAR_PROTO"] = 1; + values[valuesById[2] = "VAR_RLP"] = 2; + values[valuesById[3] = "FIXED32_BIG"] = 3; + values[valuesById[4] = "FIXED32_LITTLE"] = 4; + values[valuesById[5] = "FIXED64_BIG"] = 5; + values[valuesById[6] = "FIXED64_LITTLE"] = 6; + values[valuesById[7] = "REQUIRE_32_BYTES"] = 7; + values[valuesById[8] = "REQUIRE_64_BYTES"] = 8; + return values; + })(); + + ics23.ExistenceProof = (function() { + + /** + * Properties of an ExistenceProof. + * @memberof ics23 + * @interface IExistenceProof + * @property {Uint8Array|null} [key] ExistenceProof key + * @property {Uint8Array|null} [value] ExistenceProof value + * @property {ics23.ILeafOp|null} [leaf] ExistenceProof leaf + * @property {Array.|null} [path] ExistenceProof path + */ + + /** + * Constructs a new ExistenceProof. + * @memberof ics23 + * @classdesc 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. + * @implements IExistenceProof + * @constructor + * @param {ics23.IExistenceProof=} [properties] Properties to set + */ + function ExistenceProof(properties) { + this.path = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExistenceProof key. + * @member {Uint8Array} key + * @memberof ics23.ExistenceProof + * @instance + */ + ExistenceProof.prototype.key = $util.newBuffer([]); + + /** + * ExistenceProof value. + * @member {Uint8Array} value + * @memberof ics23.ExistenceProof + * @instance + */ + ExistenceProof.prototype.value = $util.newBuffer([]); + + /** + * ExistenceProof leaf. + * @member {ics23.ILeafOp|null|undefined} leaf + * @memberof ics23.ExistenceProof + * @instance + */ + ExistenceProof.prototype.leaf = null; + + /** + * ExistenceProof path. + * @member {Array.} path + * @memberof ics23.ExistenceProof + * @instance + */ + ExistenceProof.prototype.path = $util.emptyArray; + + /** + * Encodes the specified ExistenceProof message. Does not implicitly {@link ics23.ExistenceProof.verify|verify} messages. + * @function encode + * @memberof ics23.ExistenceProof + * @static + * @param {ics23.IExistenceProof} message ExistenceProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExistenceProof.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value); + if (message.leaf != null && Object.hasOwnProperty.call(message, "leaf")) + $root.ics23.LeafOp.encode(message.leaf, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.path != null && message.path.length) + for (let i = 0; i < message.path.length; ++i) + $root.ics23.InnerOp.encode(message.path[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExistenceProof message, length delimited. Does not implicitly {@link ics23.ExistenceProof.verify|verify} messages. + * @function encodeDelimited + * @memberof ics23.ExistenceProof + * @static + * @param {ics23.IExistenceProof} message ExistenceProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExistenceProof.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExistenceProof message from the specified reader or buffer. + * @function decode + * @memberof ics23.ExistenceProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ics23.ExistenceProof} ExistenceProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExistenceProof.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.ExistenceProof(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.value = reader.bytes(); + break; + case 3: + message.leaf = $root.ics23.LeafOp.decode(reader, reader.uint32()); + break; + case 4: + if (!(message.path && message.path.length)) + message.path = []; + message.path.push($root.ics23.InnerOp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExistenceProof message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ics23.ExistenceProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ics23.ExistenceProof} ExistenceProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExistenceProof.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExistenceProof message. + * @function verify + * @memberof ics23.ExistenceProof + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExistenceProof.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) + return "key: buffer expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) + return "value: buffer expected"; + if (message.leaf != null && message.hasOwnProperty("leaf")) { + let error = $root.ics23.LeafOp.verify(message.leaf); + if (error) + return "leaf." + error; + } + if (message.path != null && message.hasOwnProperty("path")) { + if (!Array.isArray(message.path)) + return "path: array expected"; + for (let i = 0; i < message.path.length; ++i) { + let error = $root.ics23.InnerOp.verify(message.path[i]); + if (error) + return "path." + error; + } + } + return null; + }; + + /** + * Creates an ExistenceProof message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ics23.ExistenceProof + * @static + * @param {Object.} object Plain object + * @returns {ics23.ExistenceProof} ExistenceProof + */ + ExistenceProof.fromObject = function fromObject(object) { + if (object instanceof $root.ics23.ExistenceProof) + return object; + let message = new $root.ics23.ExistenceProof(); + if (object.key != null) + if (typeof object.key === "string") + $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); + else if (object.key.length) + message.key = object.key; + if (object.value != null) + if (typeof object.value === "string") + $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); + else if (object.value.length) + message.value = object.value; + if (object.leaf != null) { + if (typeof object.leaf !== "object") + throw TypeError(".ics23.ExistenceProof.leaf: object expected"); + message.leaf = $root.ics23.LeafOp.fromObject(object.leaf); + } + if (object.path) { + if (!Array.isArray(object.path)) + throw TypeError(".ics23.ExistenceProof.path: array expected"); + message.path = []; + for (let i = 0; i < object.path.length; ++i) { + if (typeof object.path[i] !== "object") + throw TypeError(".ics23.ExistenceProof.path: object expected"); + message.path[i] = $root.ics23.InnerOp.fromObject(object.path[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an ExistenceProof message. Also converts values to other types if specified. + * @function toObject + * @memberof ics23.ExistenceProof + * @static + * @param {ics23.ExistenceProof} message ExistenceProof + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExistenceProof.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.path = []; + if (options.defaults) { + if (options.bytes === String) + object.key = ""; + else { + object.key = []; + if (options.bytes !== Array) + object.key = $util.newBuffer(object.key); + } + if (options.bytes === String) + object.value = ""; + else { + object.value = []; + if (options.bytes !== Array) + object.value = $util.newBuffer(object.value); + } + object.leaf = null; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; + if (message.leaf != null && message.hasOwnProperty("leaf")) + object.leaf = $root.ics23.LeafOp.toObject(message.leaf, options); + if (message.path && message.path.length) { + object.path = []; + for (let j = 0; j < message.path.length; ++j) + object.path[j] = $root.ics23.InnerOp.toObject(message.path[j], options); + } + return object; + }; + + /** + * Converts this ExistenceProof to JSON. + * @function toJSON + * @memberof ics23.ExistenceProof + * @instance + * @returns {Object.} JSON object + */ + ExistenceProof.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExistenceProof; + })(); + + ics23.NonExistenceProof = (function() { + + /** + * Properties of a NonExistenceProof. + * @memberof ics23 + * @interface INonExistenceProof + * @property {Uint8Array|null} [key] NonExistenceProof key + * @property {ics23.IExistenceProof|null} [left] NonExistenceProof left + * @property {ics23.IExistenceProof|null} [right] NonExistenceProof right + */ + + /** + * Constructs a new NonExistenceProof. + * @memberof ics23 + * @classdesc Represents a NonExistenceProof. + * @implements INonExistenceProof + * @constructor + * @param {ics23.INonExistenceProof=} [properties] Properties to set + */ + function NonExistenceProof(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NonExistenceProof key. + * @member {Uint8Array} key + * @memberof ics23.NonExistenceProof + * @instance + */ + NonExistenceProof.prototype.key = $util.newBuffer([]); + + /** + * NonExistenceProof left. + * @member {ics23.IExistenceProof|null|undefined} left + * @memberof ics23.NonExistenceProof + * @instance + */ + NonExistenceProof.prototype.left = null; + + /** + * NonExistenceProof right. + * @member {ics23.IExistenceProof|null|undefined} right + * @memberof ics23.NonExistenceProof + * @instance + */ + NonExistenceProof.prototype.right = null; + + /** + * Encodes the specified NonExistenceProof message. Does not implicitly {@link ics23.NonExistenceProof.verify|verify} messages. + * @function encode + * @memberof ics23.NonExistenceProof + * @static + * @param {ics23.INonExistenceProof} message NonExistenceProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NonExistenceProof.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); + if (message.left != null && Object.hasOwnProperty.call(message, "left")) + $root.ics23.ExistenceProof.encode(message.left, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.right != null && Object.hasOwnProperty.call(message, "right")) + $root.ics23.ExistenceProof.encode(message.right, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified NonExistenceProof message, length delimited. Does not implicitly {@link ics23.NonExistenceProof.verify|verify} messages. + * @function encodeDelimited + * @memberof ics23.NonExistenceProof + * @static + * @param {ics23.INonExistenceProof} message NonExistenceProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NonExistenceProof.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NonExistenceProof message from the specified reader or buffer. + * @function decode + * @memberof ics23.NonExistenceProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ics23.NonExistenceProof} NonExistenceProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NonExistenceProof.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.NonExistenceProof(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.left = $root.ics23.ExistenceProof.decode(reader, reader.uint32()); + break; + case 3: + message.right = $root.ics23.ExistenceProof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NonExistenceProof message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ics23.NonExistenceProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ics23.NonExistenceProof} NonExistenceProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NonExistenceProof.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NonExistenceProof message. + * @function verify + * @memberof ics23.NonExistenceProof + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NonExistenceProof.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) + return "key: buffer expected"; + if (message.left != null && message.hasOwnProperty("left")) { + let error = $root.ics23.ExistenceProof.verify(message.left); + if (error) + return "left." + error; + } + if (message.right != null && message.hasOwnProperty("right")) { + let error = $root.ics23.ExistenceProof.verify(message.right); + if (error) + return "right." + error; + } + return null; + }; + + /** + * Creates a NonExistenceProof message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ics23.NonExistenceProof + * @static + * @param {Object.} object Plain object + * @returns {ics23.NonExistenceProof} NonExistenceProof + */ + NonExistenceProof.fromObject = function fromObject(object) { + if (object instanceof $root.ics23.NonExistenceProof) + return object; + let message = new $root.ics23.NonExistenceProof(); + if (object.key != null) + if (typeof object.key === "string") + $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); + else if (object.key.length) + message.key = object.key; + if (object.left != null) { + if (typeof object.left !== "object") + throw TypeError(".ics23.NonExistenceProof.left: object expected"); + message.left = $root.ics23.ExistenceProof.fromObject(object.left); + } + if (object.right != null) { + if (typeof object.right !== "object") + throw TypeError(".ics23.NonExistenceProof.right: object expected"); + message.right = $root.ics23.ExistenceProof.fromObject(object.right); + } + return message; + }; + + /** + * Creates a plain object from a NonExistenceProof message. Also converts values to other types if specified. + * @function toObject + * @memberof ics23.NonExistenceProof + * @static + * @param {ics23.NonExistenceProof} message NonExistenceProof + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NonExistenceProof.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if (options.bytes === String) + object.key = ""; + else { + object.key = []; + if (options.bytes !== Array) + object.key = $util.newBuffer(object.key); + } + object.left = null; + object.right = null; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; + if (message.left != null && message.hasOwnProperty("left")) + object.left = $root.ics23.ExistenceProof.toObject(message.left, options); + if (message.right != null && message.hasOwnProperty("right")) + object.right = $root.ics23.ExistenceProof.toObject(message.right, options); + return object; + }; + + /** + * Converts this NonExistenceProof to JSON. + * @function toJSON + * @memberof ics23.NonExistenceProof + * @instance + * @returns {Object.} JSON object + */ + NonExistenceProof.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return NonExistenceProof; + })(); + + ics23.CommitmentProof = (function() { + + /** + * Properties of a CommitmentProof. + * @memberof ics23 + * @interface ICommitmentProof + * @property {ics23.IExistenceProof|null} [exist] CommitmentProof exist + * @property {ics23.INonExistenceProof|null} [nonexist] CommitmentProof nonexist + * @property {ics23.IBatchProof|null} [batch] CommitmentProof batch + * @property {ics23.ICompressedBatchProof|null} [compressed] CommitmentProof compressed + */ + + /** + * Constructs a new CommitmentProof. + * @memberof ics23 + * @classdesc Represents a CommitmentProof. + * @implements ICommitmentProof + * @constructor + * @param {ics23.ICommitmentProof=} [properties] Properties to set + */ + function CommitmentProof(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CommitmentProof exist. + * @member {ics23.IExistenceProof|null|undefined} exist + * @memberof ics23.CommitmentProof + * @instance + */ + CommitmentProof.prototype.exist = null; + + /** + * CommitmentProof nonexist. + * @member {ics23.INonExistenceProof|null|undefined} nonexist + * @memberof ics23.CommitmentProof + * @instance + */ + CommitmentProof.prototype.nonexist = null; + + /** + * CommitmentProof batch. + * @member {ics23.IBatchProof|null|undefined} batch + * @memberof ics23.CommitmentProof + * @instance + */ + CommitmentProof.prototype.batch = null; + + /** + * CommitmentProof compressed. + * @member {ics23.ICompressedBatchProof|null|undefined} compressed + * @memberof ics23.CommitmentProof + * @instance + */ + CommitmentProof.prototype.compressed = null; + + // OneOf field names bound to virtual getters and setters + let $oneOfFields; + + /** + * CommitmentProof proof. + * @member {"exist"|"nonexist"|"batch"|"compressed"|undefined} proof + * @memberof ics23.CommitmentProof + * @instance + */ + Object.defineProperty(CommitmentProof.prototype, "proof", { + get: $util.oneOfGetter($oneOfFields = ["exist", "nonexist", "batch", "compressed"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Encodes the specified CommitmentProof message. Does not implicitly {@link ics23.CommitmentProof.verify|verify} messages. + * @function encode + * @memberof ics23.CommitmentProof + * @static + * @param {ics23.ICommitmentProof} message CommitmentProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommitmentProof.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.exist != null && Object.hasOwnProperty.call(message, "exist")) + $root.ics23.ExistenceProof.encode(message.exist, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nonexist != null && Object.hasOwnProperty.call(message, "nonexist")) + $root.ics23.NonExistenceProof.encode(message.nonexist, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.batch != null && Object.hasOwnProperty.call(message, "batch")) + $root.ics23.BatchProof.encode(message.batch, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.compressed != null && Object.hasOwnProperty.call(message, "compressed")) + $root.ics23.CompressedBatchProof.encode(message.compressed, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CommitmentProof message, length delimited. Does not implicitly {@link ics23.CommitmentProof.verify|verify} messages. + * @function encodeDelimited + * @memberof ics23.CommitmentProof + * @static + * @param {ics23.ICommitmentProof} message CommitmentProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommitmentProof.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CommitmentProof message from the specified reader or buffer. + * @function decode + * @memberof ics23.CommitmentProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ics23.CommitmentProof} CommitmentProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommitmentProof.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.CommitmentProof(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.exist = $root.ics23.ExistenceProof.decode(reader, reader.uint32()); + break; + case 2: + message.nonexist = $root.ics23.NonExistenceProof.decode(reader, reader.uint32()); + break; + case 3: + message.batch = $root.ics23.BatchProof.decode(reader, reader.uint32()); + break; + case 4: + message.compressed = $root.ics23.CompressedBatchProof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CommitmentProof message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ics23.CommitmentProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ics23.CommitmentProof} CommitmentProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommitmentProof.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CommitmentProof message. + * @function verify + * @memberof ics23.CommitmentProof + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CommitmentProof.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + let properties = {}; + if (message.exist != null && message.hasOwnProperty("exist")) { + properties.proof = 1; + { + let error = $root.ics23.ExistenceProof.verify(message.exist); + if (error) + return "exist." + error; + } + } + if (message.nonexist != null && message.hasOwnProperty("nonexist")) { + if (properties.proof === 1) + return "proof: multiple values"; + properties.proof = 1; + { + let error = $root.ics23.NonExistenceProof.verify(message.nonexist); + if (error) + return "nonexist." + error; + } + } + if (message.batch != null && message.hasOwnProperty("batch")) { + if (properties.proof === 1) + return "proof: multiple values"; + properties.proof = 1; + { + let error = $root.ics23.BatchProof.verify(message.batch); + if (error) + return "batch." + error; + } + } + if (message.compressed != null && message.hasOwnProperty("compressed")) { + if (properties.proof === 1) + return "proof: multiple values"; + properties.proof = 1; + { + let error = $root.ics23.CompressedBatchProof.verify(message.compressed); + if (error) + return "compressed." + error; + } + } + return null; + }; + + /** + * Creates a CommitmentProof message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ics23.CommitmentProof + * @static + * @param {Object.} object Plain object + * @returns {ics23.CommitmentProof} CommitmentProof + */ + CommitmentProof.fromObject = function fromObject(object) { + if (object instanceof $root.ics23.CommitmentProof) + return object; + let message = new $root.ics23.CommitmentProof(); + if (object.exist != null) { + if (typeof object.exist !== "object") + throw TypeError(".ics23.CommitmentProof.exist: object expected"); + message.exist = $root.ics23.ExistenceProof.fromObject(object.exist); + } + if (object.nonexist != null) { + if (typeof object.nonexist !== "object") + throw TypeError(".ics23.CommitmentProof.nonexist: object expected"); + message.nonexist = $root.ics23.NonExistenceProof.fromObject(object.nonexist); + } + if (object.batch != null) { + if (typeof object.batch !== "object") + throw TypeError(".ics23.CommitmentProof.batch: object expected"); + message.batch = $root.ics23.BatchProof.fromObject(object.batch); + } + if (object.compressed != null) { + if (typeof object.compressed !== "object") + throw TypeError(".ics23.CommitmentProof.compressed: object expected"); + message.compressed = $root.ics23.CompressedBatchProof.fromObject(object.compressed); + } + return message; + }; + + /** + * Creates a plain object from a CommitmentProof message. Also converts values to other types if specified. + * @function toObject + * @memberof ics23.CommitmentProof + * @static + * @param {ics23.CommitmentProof} message CommitmentProof + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CommitmentProof.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (message.exist != null && message.hasOwnProperty("exist")) { + object.exist = $root.ics23.ExistenceProof.toObject(message.exist, options); + if (options.oneofs) + object.proof = "exist"; + } + if (message.nonexist != null && message.hasOwnProperty("nonexist")) { + object.nonexist = $root.ics23.NonExistenceProof.toObject(message.nonexist, options); + if (options.oneofs) + object.proof = "nonexist"; + } + if (message.batch != null && message.hasOwnProperty("batch")) { + object.batch = $root.ics23.BatchProof.toObject(message.batch, options); + if (options.oneofs) + object.proof = "batch"; + } + if (message.compressed != null && message.hasOwnProperty("compressed")) { + object.compressed = $root.ics23.CompressedBatchProof.toObject(message.compressed, options); + if (options.oneofs) + object.proof = "compressed"; + } + return object; + }; + + /** + * Converts this CommitmentProof to JSON. + * @function toJSON + * @memberof ics23.CommitmentProof + * @instance + * @returns {Object.} JSON object + */ + CommitmentProof.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CommitmentProof; + })(); + + ics23.LeafOp = (function() { + + /** + * Properties of a LeafOp. + * @memberof ics23 + * @interface ILeafOp + * @property {ics23.HashOp|null} [hash] LeafOp hash + * @property {ics23.HashOp|null} [prehash_key] LeafOp prehash_key + * @property {ics23.HashOp|null} [prehash_value] LeafOp prehash_value + * @property {ics23.LengthOp|null} [length] LeafOp length + * @property {Uint8Array|null} [prefix] LeafOp prefix + */ + + /** + * Constructs a new LeafOp. + * @memberof ics23 + * @classdesc 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) + * @implements ILeafOp + * @constructor + * @param {ics23.ILeafOp=} [properties] Properties to set + */ + function LeafOp(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LeafOp hash. + * @member {ics23.HashOp} hash + * @memberof ics23.LeafOp + * @instance + */ + LeafOp.prototype.hash = 0; + + /** + * LeafOp prehash_key. + * @member {ics23.HashOp} prehash_key + * @memberof ics23.LeafOp + * @instance + */ + LeafOp.prototype.prehash_key = 0; + + /** + * LeafOp prehash_value. + * @member {ics23.HashOp} prehash_value + * @memberof ics23.LeafOp + * @instance + */ + LeafOp.prototype.prehash_value = 0; + + /** + * LeafOp length. + * @member {ics23.LengthOp} length + * @memberof ics23.LeafOp + * @instance + */ + LeafOp.prototype.length = 0; + + /** + * LeafOp prefix. + * @member {Uint8Array} prefix + * @memberof ics23.LeafOp + * @instance + */ + LeafOp.prototype.prefix = $util.newBuffer([]); + + /** + * Encodes the specified LeafOp message. Does not implicitly {@link ics23.LeafOp.verify|verify} messages. + * @function encode + * @memberof ics23.LeafOp + * @static + * @param {ics23.ILeafOp} message LeafOp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LeafOp.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.hash != null && Object.hasOwnProperty.call(message, "hash")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.hash); + if (message.prehash_key != null && Object.hasOwnProperty.call(message, "prehash_key")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.prehash_key); + if (message.prehash_value != null && Object.hasOwnProperty.call(message, "prehash_value")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.prehash_value); + if (message.length != null && Object.hasOwnProperty.call(message, "length")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.length); + if (message.prefix != null && Object.hasOwnProperty.call(message, "prefix")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.prefix); + return writer; + }; + + /** + * Encodes the specified LeafOp message, length delimited. Does not implicitly {@link ics23.LeafOp.verify|verify} messages. + * @function encodeDelimited + * @memberof ics23.LeafOp + * @static + * @param {ics23.ILeafOp} message LeafOp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LeafOp.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LeafOp message from the specified reader or buffer. + * @function decode + * @memberof ics23.LeafOp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ics23.LeafOp} LeafOp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LeafOp.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.LeafOp(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.int32(); + break; + case 2: + message.prehash_key = reader.int32(); + break; + case 3: + message.prehash_value = reader.int32(); + break; + case 4: + message.length = reader.int32(); + break; + case 5: + message.prefix = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LeafOp message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ics23.LeafOp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ics23.LeafOp} LeafOp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LeafOp.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LeafOp message. + * @function verify + * @memberof ics23.LeafOp + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LeafOp.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.hash != null && message.hasOwnProperty("hash")) + switch (message.hash) { + default: + return "hash: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.prehash_key != null && message.hasOwnProperty("prehash_key")) + switch (message.prehash_key) { + default: + return "prehash_key: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.prehash_value != null && message.hasOwnProperty("prehash_value")) + switch (message.prehash_value) { + default: + return "prehash_value: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.length != null && message.hasOwnProperty("length")) + switch (message.length) { + default: + return "length: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + break; + } + if (message.prefix != null && message.hasOwnProperty("prefix")) + if (!(message.prefix && typeof message.prefix.length === "number" || $util.isString(message.prefix))) + return "prefix: buffer expected"; + return null; + }; + + /** + * Creates a LeafOp message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ics23.LeafOp + * @static + * @param {Object.} object Plain object + * @returns {ics23.LeafOp} LeafOp + */ + LeafOp.fromObject = function fromObject(object) { + if (object instanceof $root.ics23.LeafOp) + return object; + let message = new $root.ics23.LeafOp(); + switch (object.hash) { + case "NO_HASH": + case 0: + message.hash = 0; + break; + case "SHA256": + case 1: + message.hash = 1; + break; + case "SHA512": + case 2: + message.hash = 2; + break; + case "KECCAK": + case 3: + message.hash = 3; + break; + case "RIPEMD160": + case 4: + message.hash = 4; + break; + case "BITCOIN": + case 5: + message.hash = 5; + break; + } + switch (object.prehash_key) { + case "NO_HASH": + case 0: + message.prehash_key = 0; + break; + case "SHA256": + case 1: + message.prehash_key = 1; + break; + case "SHA512": + case 2: + message.prehash_key = 2; + break; + case "KECCAK": + case 3: + message.prehash_key = 3; + break; + case "RIPEMD160": + case 4: + message.prehash_key = 4; + break; + case "BITCOIN": + case 5: + message.prehash_key = 5; + break; + } + switch (object.prehash_value) { + case "NO_HASH": + case 0: + message.prehash_value = 0; + break; + case "SHA256": + case 1: + message.prehash_value = 1; + break; + case "SHA512": + case 2: + message.prehash_value = 2; + break; + case "KECCAK": + case 3: + message.prehash_value = 3; + break; + case "RIPEMD160": + case 4: + message.prehash_value = 4; + break; + case "BITCOIN": + case 5: + message.prehash_value = 5; + break; + } + switch (object.length) { + case "NO_PREFIX": + case 0: + message.length = 0; + break; + case "VAR_PROTO": + case 1: + message.length = 1; + break; + case "VAR_RLP": + case 2: + message.length = 2; + break; + case "FIXED32_BIG": + case 3: + message.length = 3; + break; + case "FIXED32_LITTLE": + case 4: + message.length = 4; + break; + case "FIXED64_BIG": + case 5: + message.length = 5; + break; + case "FIXED64_LITTLE": + case 6: + message.length = 6; + break; + case "REQUIRE_32_BYTES": + case 7: + message.length = 7; + break; + case "REQUIRE_64_BYTES": + case 8: + message.length = 8; + break; + } + if (object.prefix != null) + if (typeof object.prefix === "string") + $util.base64.decode(object.prefix, message.prefix = $util.newBuffer($util.base64.length(object.prefix)), 0); + else if (object.prefix.length) + message.prefix = object.prefix; + return message; + }; + + /** + * Creates a plain object from a LeafOp message. Also converts values to other types if specified. + * @function toObject + * @memberof ics23.LeafOp + * @static + * @param {ics23.LeafOp} message LeafOp + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LeafOp.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.hash = options.enums === String ? "NO_HASH" : 0; + object.prehash_key = options.enums === String ? "NO_HASH" : 0; + object.prehash_value = options.enums === String ? "NO_HASH" : 0; + object.length = options.enums === String ? "NO_PREFIX" : 0; + if (options.bytes === String) + object.prefix = ""; + else { + object.prefix = []; + if (options.bytes !== Array) + object.prefix = $util.newBuffer(object.prefix); + } + } + if (message.hash != null && message.hasOwnProperty("hash")) + object.hash = options.enums === String ? $root.ics23.HashOp[message.hash] : message.hash; + if (message.prehash_key != null && message.hasOwnProperty("prehash_key")) + object.prehash_key = options.enums === String ? $root.ics23.HashOp[message.prehash_key] : message.prehash_key; + if (message.prehash_value != null && message.hasOwnProperty("prehash_value")) + object.prehash_value = options.enums === String ? $root.ics23.HashOp[message.prehash_value] : message.prehash_value; + if (message.length != null && message.hasOwnProperty("length")) + object.length = options.enums === String ? $root.ics23.LengthOp[message.length] : message.length; + if (message.prefix != null && message.hasOwnProperty("prefix")) + object.prefix = options.bytes === String ? $util.base64.encode(message.prefix, 0, message.prefix.length) : options.bytes === Array ? Array.prototype.slice.call(message.prefix) : message.prefix; + return object; + }; + + /** + * Converts this LeafOp to JSON. + * @function toJSON + * @memberof ics23.LeafOp + * @instance + * @returns {Object.} JSON object + */ + LeafOp.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return LeafOp; + })(); + + ics23.InnerOp = (function() { + + /** + * Properties of an InnerOp. + * @memberof ics23 + * @interface IInnerOp + * @property {ics23.HashOp|null} [hash] InnerOp hash + * @property {Uint8Array|null} [prefix] InnerOp prefix + * @property {Uint8Array|null} [suffix] InnerOp suffix + */ + + /** + * Constructs a new InnerOp. + * @memberof ics23 + * @classdesc 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 + * @implements IInnerOp + * @constructor + * @param {ics23.IInnerOp=} [properties] Properties to set + */ + function InnerOp(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InnerOp hash. + * @member {ics23.HashOp} hash + * @memberof ics23.InnerOp + * @instance + */ + InnerOp.prototype.hash = 0; + + /** + * InnerOp prefix. + * @member {Uint8Array} prefix + * @memberof ics23.InnerOp + * @instance + */ + InnerOp.prototype.prefix = $util.newBuffer([]); + + /** + * InnerOp suffix. + * @member {Uint8Array} suffix + * @memberof ics23.InnerOp + * @instance + */ + InnerOp.prototype.suffix = $util.newBuffer([]); + + /** + * Encodes the specified InnerOp message. Does not implicitly {@link ics23.InnerOp.verify|verify} messages. + * @function encode + * @memberof ics23.InnerOp + * @static + * @param {ics23.IInnerOp} message InnerOp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InnerOp.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.hash != null && Object.hasOwnProperty.call(message, "hash")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.hash); + if (message.prefix != null && Object.hasOwnProperty.call(message, "prefix")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.prefix); + if (message.suffix != null && Object.hasOwnProperty.call(message, "suffix")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.suffix); + return writer; + }; + + /** + * Encodes the specified InnerOp message, length delimited. Does not implicitly {@link ics23.InnerOp.verify|verify} messages. + * @function encodeDelimited + * @memberof ics23.InnerOp + * @static + * @param {ics23.IInnerOp} message InnerOp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InnerOp.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InnerOp message from the specified reader or buffer. + * @function decode + * @memberof ics23.InnerOp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ics23.InnerOp} InnerOp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InnerOp.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.InnerOp(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.int32(); + break; + case 2: + message.prefix = reader.bytes(); + break; + case 3: + message.suffix = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InnerOp message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ics23.InnerOp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ics23.InnerOp} InnerOp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InnerOp.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InnerOp message. + * @function verify + * @memberof ics23.InnerOp + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InnerOp.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.hash != null && message.hasOwnProperty("hash")) + switch (message.hash) { + default: + return "hash: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.prefix != null && message.hasOwnProperty("prefix")) + if (!(message.prefix && typeof message.prefix.length === "number" || $util.isString(message.prefix))) + return "prefix: buffer expected"; + if (message.suffix != null && message.hasOwnProperty("suffix")) + if (!(message.suffix && typeof message.suffix.length === "number" || $util.isString(message.suffix))) + return "suffix: buffer expected"; + return null; + }; + + /** + * Creates an InnerOp message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ics23.InnerOp + * @static + * @param {Object.} object Plain object + * @returns {ics23.InnerOp} InnerOp + */ + InnerOp.fromObject = function fromObject(object) { + if (object instanceof $root.ics23.InnerOp) + return object; + let message = new $root.ics23.InnerOp(); + switch (object.hash) { + case "NO_HASH": + case 0: + message.hash = 0; + break; + case "SHA256": + case 1: + message.hash = 1; + break; + case "SHA512": + case 2: + message.hash = 2; + break; + case "KECCAK": + case 3: + message.hash = 3; + break; + case "RIPEMD160": + case 4: + message.hash = 4; + break; + case "BITCOIN": + case 5: + message.hash = 5; + break; + } + if (object.prefix != null) + if (typeof object.prefix === "string") + $util.base64.decode(object.prefix, message.prefix = $util.newBuffer($util.base64.length(object.prefix)), 0); + else if (object.prefix.length) + message.prefix = object.prefix; + if (object.suffix != null) + if (typeof object.suffix === "string") + $util.base64.decode(object.suffix, message.suffix = $util.newBuffer($util.base64.length(object.suffix)), 0); + else if (object.suffix.length) + message.suffix = object.suffix; + return message; + }; + + /** + * Creates a plain object from an InnerOp message. Also converts values to other types if specified. + * @function toObject + * @memberof ics23.InnerOp + * @static + * @param {ics23.InnerOp} message InnerOp + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InnerOp.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.hash = options.enums === String ? "NO_HASH" : 0; + if (options.bytes === String) + object.prefix = ""; + else { + object.prefix = []; + if (options.bytes !== Array) + object.prefix = $util.newBuffer(object.prefix); + } + if (options.bytes === String) + object.suffix = ""; + else { + object.suffix = []; + if (options.bytes !== Array) + object.suffix = $util.newBuffer(object.suffix); + } + } + if (message.hash != null && message.hasOwnProperty("hash")) + object.hash = options.enums === String ? $root.ics23.HashOp[message.hash] : message.hash; + if (message.prefix != null && message.hasOwnProperty("prefix")) + object.prefix = options.bytes === String ? $util.base64.encode(message.prefix, 0, message.prefix.length) : options.bytes === Array ? Array.prototype.slice.call(message.prefix) : message.prefix; + if (message.suffix != null && message.hasOwnProperty("suffix")) + object.suffix = options.bytes === String ? $util.base64.encode(message.suffix, 0, message.suffix.length) : options.bytes === Array ? Array.prototype.slice.call(message.suffix) : message.suffix; + return object; + }; + + /** + * Converts this InnerOp to JSON. + * @function toJSON + * @memberof ics23.InnerOp + * @instance + * @returns {Object.} JSON object + */ + InnerOp.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return InnerOp; + })(); + + ics23.ProofSpec = (function() { + + /** + * Properties of a ProofSpec. + * @memberof ics23 + * @interface IProofSpec + * @property {ics23.ILeafOp|null} [leaf_spec] ProofSpec leaf_spec + * @property {ics23.IInnerSpec|null} [inner_spec] ProofSpec inner_spec + * @property {number|null} [max_depth] ProofSpec max_depth + * @property {number|null} [min_depth] ProofSpec min_depth + */ + + /** + * Constructs a new ProofSpec. + * @memberof ics23 + * @classdesc 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. + * @implements IProofSpec + * @constructor + * @param {ics23.IProofSpec=} [properties] Properties to set + */ + function ProofSpec(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProofSpec leaf_spec. + * @member {ics23.ILeafOp|null|undefined} leaf_spec + * @memberof ics23.ProofSpec + * @instance + */ + ProofSpec.prototype.leaf_spec = null; + + /** + * ProofSpec inner_spec. + * @member {ics23.IInnerSpec|null|undefined} inner_spec + * @memberof ics23.ProofSpec + * @instance + */ + ProofSpec.prototype.inner_spec = null; + + /** + * ProofSpec max_depth. + * @member {number} max_depth + * @memberof ics23.ProofSpec + * @instance + */ + ProofSpec.prototype.max_depth = 0; + + /** + * ProofSpec min_depth. + * @member {number} min_depth + * @memberof ics23.ProofSpec + * @instance + */ + ProofSpec.prototype.min_depth = 0; + + /** + * Encodes the specified ProofSpec message. Does not implicitly {@link ics23.ProofSpec.verify|verify} messages. + * @function encode + * @memberof ics23.ProofSpec + * @static + * @param {ics23.IProofSpec} message ProofSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProofSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.leaf_spec != null && Object.hasOwnProperty.call(message, "leaf_spec")) + $root.ics23.LeafOp.encode(message.leaf_spec, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.inner_spec != null && Object.hasOwnProperty.call(message, "inner_spec")) + $root.ics23.InnerSpec.encode(message.inner_spec, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.max_depth != null && Object.hasOwnProperty.call(message, "max_depth")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.max_depth); + if (message.min_depth != null && Object.hasOwnProperty.call(message, "min_depth")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.min_depth); + return writer; + }; + + /** + * Encodes the specified ProofSpec message, length delimited. Does not implicitly {@link ics23.ProofSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof ics23.ProofSpec + * @static + * @param {ics23.IProofSpec} message ProofSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProofSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProofSpec message from the specified reader or buffer. + * @function decode + * @memberof ics23.ProofSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ics23.ProofSpec} ProofSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProofSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.ProofSpec(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.leaf_spec = $root.ics23.LeafOp.decode(reader, reader.uint32()); + break; + case 2: + message.inner_spec = $root.ics23.InnerSpec.decode(reader, reader.uint32()); + break; + case 3: + message.max_depth = reader.int32(); + break; + case 4: + message.min_depth = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProofSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ics23.ProofSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ics23.ProofSpec} ProofSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProofSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProofSpec message. + * @function verify + * @memberof ics23.ProofSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProofSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.leaf_spec != null && message.hasOwnProperty("leaf_spec")) { + let error = $root.ics23.LeafOp.verify(message.leaf_spec); + if (error) + return "leaf_spec." + error; + } + if (message.inner_spec != null && message.hasOwnProperty("inner_spec")) { + let error = $root.ics23.InnerSpec.verify(message.inner_spec); + if (error) + return "inner_spec." + error; + } + if (message.max_depth != null && message.hasOwnProperty("max_depth")) + if (!$util.isInteger(message.max_depth)) + return "max_depth: integer expected"; + if (message.min_depth != null && message.hasOwnProperty("min_depth")) + if (!$util.isInteger(message.min_depth)) + return "min_depth: integer expected"; + return null; + }; + + /** + * Creates a ProofSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ics23.ProofSpec + * @static + * @param {Object.} object Plain object + * @returns {ics23.ProofSpec} ProofSpec + */ + ProofSpec.fromObject = function fromObject(object) { + if (object instanceof $root.ics23.ProofSpec) + return object; + let message = new $root.ics23.ProofSpec(); + if (object.leaf_spec != null) { + if (typeof object.leaf_spec !== "object") + throw TypeError(".ics23.ProofSpec.leaf_spec: object expected"); + message.leaf_spec = $root.ics23.LeafOp.fromObject(object.leaf_spec); + } + if (object.inner_spec != null) { + if (typeof object.inner_spec !== "object") + throw TypeError(".ics23.ProofSpec.inner_spec: object expected"); + message.inner_spec = $root.ics23.InnerSpec.fromObject(object.inner_spec); + } + if (object.max_depth != null) + message.max_depth = object.max_depth | 0; + if (object.min_depth != null) + message.min_depth = object.min_depth | 0; + return message; + }; + + /** + * Creates a plain object from a ProofSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof ics23.ProofSpec + * @static + * @param {ics23.ProofSpec} message ProofSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProofSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.leaf_spec = null; + object.inner_spec = null; + object.max_depth = 0; + object.min_depth = 0; + } + if (message.leaf_spec != null && message.hasOwnProperty("leaf_spec")) + object.leaf_spec = $root.ics23.LeafOp.toObject(message.leaf_spec, options); + if (message.inner_spec != null && message.hasOwnProperty("inner_spec")) + object.inner_spec = $root.ics23.InnerSpec.toObject(message.inner_spec, options); + if (message.max_depth != null && message.hasOwnProperty("max_depth")) + object.max_depth = message.max_depth; + if (message.min_depth != null && message.hasOwnProperty("min_depth")) + object.min_depth = message.min_depth; + return object; + }; + + /** + * Converts this ProofSpec to JSON. + * @function toJSON + * @memberof ics23.ProofSpec + * @instance + * @returns {Object.} JSON object + */ + ProofSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProofSpec; + })(); + + ics23.InnerSpec = (function() { + + /** + * Properties of an InnerSpec. + * @memberof ics23 + * @interface IInnerSpec + * @property {Array.|null} [child_order] InnerSpec child_order + * @property {number|null} [child_size] InnerSpec child_size + * @property {number|null} [min_prefix_length] InnerSpec min_prefix_length + * @property {number|null} [max_prefix_length] InnerSpec max_prefix_length + * @property {Uint8Array|null} [empty_child] InnerSpec empty_child + * @property {ics23.HashOp|null} [hash] InnerSpec hash + */ + + /** + * Constructs a new InnerSpec. + * @memberof ics23 + * @classdesc Represents an InnerSpec. + * @implements IInnerSpec + * @constructor + * @param {ics23.IInnerSpec=} [properties] Properties to set + */ + function InnerSpec(properties) { + this.child_order = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InnerSpec child_order. + * @member {Array.} child_order + * @memberof ics23.InnerSpec + * @instance + */ + InnerSpec.prototype.child_order = $util.emptyArray; + + /** + * InnerSpec child_size. + * @member {number} child_size + * @memberof ics23.InnerSpec + * @instance + */ + InnerSpec.prototype.child_size = 0; + + /** + * InnerSpec min_prefix_length. + * @member {number} min_prefix_length + * @memberof ics23.InnerSpec + * @instance + */ + InnerSpec.prototype.min_prefix_length = 0; + + /** + * InnerSpec max_prefix_length. + * @member {number} max_prefix_length + * @memberof ics23.InnerSpec + * @instance + */ + InnerSpec.prototype.max_prefix_length = 0; + + /** + * InnerSpec empty_child. + * @member {Uint8Array} empty_child + * @memberof ics23.InnerSpec + * @instance + */ + InnerSpec.prototype.empty_child = $util.newBuffer([]); + + /** + * InnerSpec hash. + * @member {ics23.HashOp} hash + * @memberof ics23.InnerSpec + * @instance + */ + InnerSpec.prototype.hash = 0; + + /** + * Encodes the specified InnerSpec message. Does not implicitly {@link ics23.InnerSpec.verify|verify} messages. + * @function encode + * @memberof ics23.InnerSpec + * @static + * @param {ics23.IInnerSpec} message InnerSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InnerSpec.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.child_order != null && message.child_order.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (let i = 0; i < message.child_order.length; ++i) + writer.int32(message.child_order[i]); + writer.ldelim(); + } + if (message.child_size != null && Object.hasOwnProperty.call(message, "child_size")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.child_size); + if (message.min_prefix_length != null && Object.hasOwnProperty.call(message, "min_prefix_length")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.min_prefix_length); + if (message.max_prefix_length != null && Object.hasOwnProperty.call(message, "max_prefix_length")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.max_prefix_length); + if (message.empty_child != null && Object.hasOwnProperty.call(message, "empty_child")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.empty_child); + if (message.hash != null && Object.hasOwnProperty.call(message, "hash")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.hash); + return writer; + }; + + /** + * Encodes the specified InnerSpec message, length delimited. Does not implicitly {@link ics23.InnerSpec.verify|verify} messages. + * @function encodeDelimited + * @memberof ics23.InnerSpec + * @static + * @param {ics23.IInnerSpec} message InnerSpec message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InnerSpec.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InnerSpec message from the specified reader or buffer. + * @function decode + * @memberof ics23.InnerSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ics23.InnerSpec} InnerSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InnerSpec.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.InnerSpec(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.child_order && message.child_order.length)) + message.child_order = []; + if ((tag & 7) === 2) { + let end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.child_order.push(reader.int32()); + } else + message.child_order.push(reader.int32()); + break; + case 2: + message.child_size = reader.int32(); + break; + case 3: + message.min_prefix_length = reader.int32(); + break; + case 4: + message.max_prefix_length = reader.int32(); + break; + case 5: + message.empty_child = reader.bytes(); + break; + case 6: + message.hash = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InnerSpec message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ics23.InnerSpec + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ics23.InnerSpec} InnerSpec + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InnerSpec.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InnerSpec message. + * @function verify + * @memberof ics23.InnerSpec + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InnerSpec.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.child_order != null && message.hasOwnProperty("child_order")) { + if (!Array.isArray(message.child_order)) + return "child_order: array expected"; + for (let i = 0; i < message.child_order.length; ++i) + if (!$util.isInteger(message.child_order[i])) + return "child_order: integer[] expected"; + } + if (message.child_size != null && message.hasOwnProperty("child_size")) + if (!$util.isInteger(message.child_size)) + return "child_size: integer expected"; + if (message.min_prefix_length != null && message.hasOwnProperty("min_prefix_length")) + if (!$util.isInteger(message.min_prefix_length)) + return "min_prefix_length: integer expected"; + if (message.max_prefix_length != null && message.hasOwnProperty("max_prefix_length")) + if (!$util.isInteger(message.max_prefix_length)) + return "max_prefix_length: integer expected"; + if (message.empty_child != null && message.hasOwnProperty("empty_child")) + if (!(message.empty_child && typeof message.empty_child.length === "number" || $util.isString(message.empty_child))) + return "empty_child: buffer expected"; + if (message.hash != null && message.hasOwnProperty("hash")) + switch (message.hash) { + default: + return "hash: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + return null; + }; + + /** + * Creates an InnerSpec message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ics23.InnerSpec + * @static + * @param {Object.} object Plain object + * @returns {ics23.InnerSpec} InnerSpec + */ + InnerSpec.fromObject = function fromObject(object) { + if (object instanceof $root.ics23.InnerSpec) + return object; + let message = new $root.ics23.InnerSpec(); + if (object.child_order) { + if (!Array.isArray(object.child_order)) + throw TypeError(".ics23.InnerSpec.child_order: array expected"); + message.child_order = []; + for (let i = 0; i < object.child_order.length; ++i) + message.child_order[i] = object.child_order[i] | 0; + } + if (object.child_size != null) + message.child_size = object.child_size | 0; + if (object.min_prefix_length != null) + message.min_prefix_length = object.min_prefix_length | 0; + if (object.max_prefix_length != null) + message.max_prefix_length = object.max_prefix_length | 0; + if (object.empty_child != null) + if (typeof object.empty_child === "string") + $util.base64.decode(object.empty_child, message.empty_child = $util.newBuffer($util.base64.length(object.empty_child)), 0); + else if (object.empty_child.length) + message.empty_child = object.empty_child; + switch (object.hash) { + case "NO_HASH": + case 0: + message.hash = 0; + break; + case "SHA256": + case 1: + message.hash = 1; + break; + case "SHA512": + case 2: + message.hash = 2; + break; + case "KECCAK": + case 3: + message.hash = 3; + break; + case "RIPEMD160": + case 4: + message.hash = 4; + break; + case "BITCOIN": + case 5: + message.hash = 5; + break; + } + return message; + }; + + /** + * Creates a plain object from an InnerSpec message. Also converts values to other types if specified. + * @function toObject + * @memberof ics23.InnerSpec + * @static + * @param {ics23.InnerSpec} message InnerSpec + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InnerSpec.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.child_order = []; + if (options.defaults) { + object.child_size = 0; + object.min_prefix_length = 0; + object.max_prefix_length = 0; + if (options.bytes === String) + object.empty_child = ""; + else { + object.empty_child = []; + if (options.bytes !== Array) + object.empty_child = $util.newBuffer(object.empty_child); + } + object.hash = options.enums === String ? "NO_HASH" : 0; + } + if (message.child_order && message.child_order.length) { + object.child_order = []; + for (let j = 0; j < message.child_order.length; ++j) + object.child_order[j] = message.child_order[j]; + } + if (message.child_size != null && message.hasOwnProperty("child_size")) + object.child_size = message.child_size; + if (message.min_prefix_length != null && message.hasOwnProperty("min_prefix_length")) + object.min_prefix_length = message.min_prefix_length; + if (message.max_prefix_length != null && message.hasOwnProperty("max_prefix_length")) + object.max_prefix_length = message.max_prefix_length; + if (message.empty_child != null && message.hasOwnProperty("empty_child")) + object.empty_child = options.bytes === String ? $util.base64.encode(message.empty_child, 0, message.empty_child.length) : options.bytes === Array ? Array.prototype.slice.call(message.empty_child) : message.empty_child; + if (message.hash != null && message.hasOwnProperty("hash")) + object.hash = options.enums === String ? $root.ics23.HashOp[message.hash] : message.hash; + return object; + }; + + /** + * Converts this InnerSpec to JSON. + * @function toJSON + * @memberof ics23.InnerSpec + * @instance + * @returns {Object.} JSON object + */ + InnerSpec.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return InnerSpec; + })(); + + ics23.BatchProof = (function() { + + /** + * Properties of a BatchProof. + * @memberof ics23 + * @interface IBatchProof + * @property {Array.|null} [entries] BatchProof entries + */ + + /** + * Constructs a new BatchProof. + * @memberof ics23 + * @classdesc Represents a BatchProof. + * @implements IBatchProof + * @constructor + * @param {ics23.IBatchProof=} [properties] Properties to set + */ + function BatchProof(properties) { + this.entries = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchProof entries. + * @member {Array.} entries + * @memberof ics23.BatchProof + * @instance + */ + BatchProof.prototype.entries = $util.emptyArray; + + /** + * Encodes the specified BatchProof message. Does not implicitly {@link ics23.BatchProof.verify|verify} messages. + * @function encode + * @memberof ics23.BatchProof + * @static + * @param {ics23.IBatchProof} message BatchProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchProof.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.entries != null && message.entries.length) + for (let i = 0; i < message.entries.length; ++i) + $root.ics23.BatchEntry.encode(message.entries[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchProof message, length delimited. Does not implicitly {@link ics23.BatchProof.verify|verify} messages. + * @function encodeDelimited + * @memberof ics23.BatchProof + * @static + * @param {ics23.IBatchProof} message BatchProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchProof.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchProof message from the specified reader or buffer. + * @function decode + * @memberof ics23.BatchProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ics23.BatchProof} BatchProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchProof.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.BatchProof(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.entries && message.entries.length)) + message.entries = []; + message.entries.push($root.ics23.BatchEntry.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchProof message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ics23.BatchProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ics23.BatchProof} BatchProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchProof.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchProof message. + * @function verify + * @memberof ics23.BatchProof + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchProof.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.entries != null && message.hasOwnProperty("entries")) { + if (!Array.isArray(message.entries)) + return "entries: array expected"; + for (let i = 0; i < message.entries.length; ++i) { + let error = $root.ics23.BatchEntry.verify(message.entries[i]); + if (error) + return "entries." + error; + } + } + return null; + }; + + /** + * Creates a BatchProof message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ics23.BatchProof + * @static + * @param {Object.} object Plain object + * @returns {ics23.BatchProof} BatchProof + */ + BatchProof.fromObject = function fromObject(object) { + if (object instanceof $root.ics23.BatchProof) + return object; + let message = new $root.ics23.BatchProof(); + if (object.entries) { + if (!Array.isArray(object.entries)) + throw TypeError(".ics23.BatchProof.entries: array expected"); + message.entries = []; + for (let i = 0; i < object.entries.length; ++i) { + if (typeof object.entries[i] !== "object") + throw TypeError(".ics23.BatchProof.entries: object expected"); + message.entries[i] = $root.ics23.BatchEntry.fromObject(object.entries[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a BatchProof message. Also converts values to other types if specified. + * @function toObject + * @memberof ics23.BatchProof + * @static + * @param {ics23.BatchProof} message BatchProof + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchProof.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.entries = []; + if (message.entries && message.entries.length) { + object.entries = []; + for (let j = 0; j < message.entries.length; ++j) + object.entries[j] = $root.ics23.BatchEntry.toObject(message.entries[j], options); + } + return object; + }; + + /** + * Converts this BatchProof to JSON. + * @function toJSON + * @memberof ics23.BatchProof + * @instance + * @returns {Object.} JSON object + */ + BatchProof.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BatchProof; + })(); + + ics23.BatchEntry = (function() { + + /** + * Properties of a BatchEntry. + * @memberof ics23 + * @interface IBatchEntry + * @property {ics23.IExistenceProof|null} [exist] BatchEntry exist + * @property {ics23.INonExistenceProof|null} [nonexist] BatchEntry nonexist + */ + + /** + * Constructs a new BatchEntry. + * @memberof ics23 + * @classdesc Represents a BatchEntry. + * @implements IBatchEntry + * @constructor + * @param {ics23.IBatchEntry=} [properties] Properties to set + */ + function BatchEntry(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchEntry exist. + * @member {ics23.IExistenceProof|null|undefined} exist + * @memberof ics23.BatchEntry + * @instance + */ + BatchEntry.prototype.exist = null; + + /** + * BatchEntry nonexist. + * @member {ics23.INonExistenceProof|null|undefined} nonexist + * @memberof ics23.BatchEntry + * @instance + */ + BatchEntry.prototype.nonexist = null; + + // OneOf field names bound to virtual getters and setters + let $oneOfFields; + + /** + * BatchEntry proof. + * @member {"exist"|"nonexist"|undefined} proof + * @memberof ics23.BatchEntry + * @instance + */ + Object.defineProperty(BatchEntry.prototype, "proof", { + get: $util.oneOfGetter($oneOfFields = ["exist", "nonexist"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Encodes the specified BatchEntry message. Does not implicitly {@link ics23.BatchEntry.verify|verify} messages. + * @function encode + * @memberof ics23.BatchEntry + * @static + * @param {ics23.IBatchEntry} message BatchEntry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchEntry.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.exist != null && Object.hasOwnProperty.call(message, "exist")) + $root.ics23.ExistenceProof.encode(message.exist, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nonexist != null && Object.hasOwnProperty.call(message, "nonexist")) + $root.ics23.NonExistenceProof.encode(message.nonexist, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchEntry message, length delimited. Does not implicitly {@link ics23.BatchEntry.verify|verify} messages. + * @function encodeDelimited + * @memberof ics23.BatchEntry + * @static + * @param {ics23.IBatchEntry} message BatchEntry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchEntry.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchEntry message from the specified reader or buffer. + * @function decode + * @memberof ics23.BatchEntry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ics23.BatchEntry} BatchEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchEntry.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.BatchEntry(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.exist = $root.ics23.ExistenceProof.decode(reader, reader.uint32()); + break; + case 2: + message.nonexist = $root.ics23.NonExistenceProof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchEntry message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ics23.BatchEntry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ics23.BatchEntry} BatchEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchEntry.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchEntry message. + * @function verify + * @memberof ics23.BatchEntry + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchEntry.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + let properties = {}; + if (message.exist != null && message.hasOwnProperty("exist")) { + properties.proof = 1; + { + let error = $root.ics23.ExistenceProof.verify(message.exist); + if (error) + return "exist." + error; + } + } + if (message.nonexist != null && message.hasOwnProperty("nonexist")) { + if (properties.proof === 1) + return "proof: multiple values"; + properties.proof = 1; + { + let error = $root.ics23.NonExistenceProof.verify(message.nonexist); + if (error) + return "nonexist." + error; + } + } + return null; + }; + + /** + * Creates a BatchEntry message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ics23.BatchEntry + * @static + * @param {Object.} object Plain object + * @returns {ics23.BatchEntry} BatchEntry + */ + BatchEntry.fromObject = function fromObject(object) { + if (object instanceof $root.ics23.BatchEntry) + return object; + let message = new $root.ics23.BatchEntry(); + if (object.exist != null) { + if (typeof object.exist !== "object") + throw TypeError(".ics23.BatchEntry.exist: object expected"); + message.exist = $root.ics23.ExistenceProof.fromObject(object.exist); + } + if (object.nonexist != null) { + if (typeof object.nonexist !== "object") + throw TypeError(".ics23.BatchEntry.nonexist: object expected"); + message.nonexist = $root.ics23.NonExistenceProof.fromObject(object.nonexist); + } + return message; + }; + + /** + * Creates a plain object from a BatchEntry message. Also converts values to other types if specified. + * @function toObject + * @memberof ics23.BatchEntry + * @static + * @param {ics23.BatchEntry} message BatchEntry + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchEntry.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (message.exist != null && message.hasOwnProperty("exist")) { + object.exist = $root.ics23.ExistenceProof.toObject(message.exist, options); + if (options.oneofs) + object.proof = "exist"; + } + if (message.nonexist != null && message.hasOwnProperty("nonexist")) { + object.nonexist = $root.ics23.NonExistenceProof.toObject(message.nonexist, options); + if (options.oneofs) + object.proof = "nonexist"; + } + return object; + }; + + /** + * Converts this BatchEntry to JSON. + * @function toJSON + * @memberof ics23.BatchEntry + * @instance + * @returns {Object.} JSON object + */ + BatchEntry.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BatchEntry; + })(); + + ics23.CompressedBatchProof = (function() { + + /** + * Properties of a CompressedBatchProof. + * @memberof ics23 + * @interface ICompressedBatchProof + * @property {Array.|null} [entries] CompressedBatchProof entries + * @property {Array.|null} [lookup_inners] CompressedBatchProof lookup_inners + */ + + /** + * Constructs a new CompressedBatchProof. + * @memberof ics23 + * @classdesc Represents a CompressedBatchProof. + * @implements ICompressedBatchProof + * @constructor + * @param {ics23.ICompressedBatchProof=} [properties] Properties to set + */ + function CompressedBatchProof(properties) { + this.entries = []; + this.lookup_inners = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompressedBatchProof entries. + * @member {Array.} entries + * @memberof ics23.CompressedBatchProof + * @instance + */ + CompressedBatchProof.prototype.entries = $util.emptyArray; + + /** + * CompressedBatchProof lookup_inners. + * @member {Array.} lookup_inners + * @memberof ics23.CompressedBatchProof + * @instance + */ + CompressedBatchProof.prototype.lookup_inners = $util.emptyArray; + + /** + * Encodes the specified CompressedBatchProof message. Does not implicitly {@link ics23.CompressedBatchProof.verify|verify} messages. + * @function encode + * @memberof ics23.CompressedBatchProof + * @static + * @param {ics23.ICompressedBatchProof} message CompressedBatchProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompressedBatchProof.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.entries != null && message.entries.length) + for (let i = 0; i < message.entries.length; ++i) + $root.ics23.CompressedBatchEntry.encode(message.entries[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.lookup_inners != null && message.lookup_inners.length) + for (let i = 0; i < message.lookup_inners.length; ++i) + $root.ics23.InnerOp.encode(message.lookup_inners[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CompressedBatchProof message, length delimited. Does not implicitly {@link ics23.CompressedBatchProof.verify|verify} messages. + * @function encodeDelimited + * @memberof ics23.CompressedBatchProof + * @static + * @param {ics23.ICompressedBatchProof} message CompressedBatchProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompressedBatchProof.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CompressedBatchProof message from the specified reader or buffer. + * @function decode + * @memberof ics23.CompressedBatchProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ics23.CompressedBatchProof} CompressedBatchProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompressedBatchProof.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.CompressedBatchProof(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.entries && message.entries.length)) + message.entries = []; + message.entries.push($root.ics23.CompressedBatchEntry.decode(reader, reader.uint32())); + break; + case 2: + if (!(message.lookup_inners && message.lookup_inners.length)) + message.lookup_inners = []; + message.lookup_inners.push($root.ics23.InnerOp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CompressedBatchProof message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ics23.CompressedBatchProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ics23.CompressedBatchProof} CompressedBatchProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompressedBatchProof.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompressedBatchProof message. + * @function verify + * @memberof ics23.CompressedBatchProof + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompressedBatchProof.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.entries != null && message.hasOwnProperty("entries")) { + if (!Array.isArray(message.entries)) + return "entries: array expected"; + for (let i = 0; i < message.entries.length; ++i) { + let error = $root.ics23.CompressedBatchEntry.verify(message.entries[i]); + if (error) + return "entries." + error; + } + } + if (message.lookup_inners != null && message.hasOwnProperty("lookup_inners")) { + if (!Array.isArray(message.lookup_inners)) + return "lookup_inners: array expected"; + for (let i = 0; i < message.lookup_inners.length; ++i) { + let error = $root.ics23.InnerOp.verify(message.lookup_inners[i]); + if (error) + return "lookup_inners." + error; + } + } + return null; + }; + + /** + * Creates a CompressedBatchProof message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ics23.CompressedBatchProof + * @static + * @param {Object.} object Plain object + * @returns {ics23.CompressedBatchProof} CompressedBatchProof + */ + CompressedBatchProof.fromObject = function fromObject(object) { + if (object instanceof $root.ics23.CompressedBatchProof) + return object; + let message = new $root.ics23.CompressedBatchProof(); + if (object.entries) { + if (!Array.isArray(object.entries)) + throw TypeError(".ics23.CompressedBatchProof.entries: array expected"); + message.entries = []; + for (let i = 0; i < object.entries.length; ++i) { + if (typeof object.entries[i] !== "object") + throw TypeError(".ics23.CompressedBatchProof.entries: object expected"); + message.entries[i] = $root.ics23.CompressedBatchEntry.fromObject(object.entries[i]); + } + } + if (object.lookup_inners) { + if (!Array.isArray(object.lookup_inners)) + throw TypeError(".ics23.CompressedBatchProof.lookup_inners: array expected"); + message.lookup_inners = []; + for (let i = 0; i < object.lookup_inners.length; ++i) { + if (typeof object.lookup_inners[i] !== "object") + throw TypeError(".ics23.CompressedBatchProof.lookup_inners: object expected"); + message.lookup_inners[i] = $root.ics23.InnerOp.fromObject(object.lookup_inners[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a CompressedBatchProof message. Also converts values to other types if specified. + * @function toObject + * @memberof ics23.CompressedBatchProof + * @static + * @param {ics23.CompressedBatchProof} message CompressedBatchProof + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompressedBatchProof.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) { + object.entries = []; + object.lookup_inners = []; + } + if (message.entries && message.entries.length) { + object.entries = []; + for (let j = 0; j < message.entries.length; ++j) + object.entries[j] = $root.ics23.CompressedBatchEntry.toObject(message.entries[j], options); + } + if (message.lookup_inners && message.lookup_inners.length) { + object.lookup_inners = []; + for (let j = 0; j < message.lookup_inners.length; ++j) + object.lookup_inners[j] = $root.ics23.InnerOp.toObject(message.lookup_inners[j], options); + } + return object; + }; + + /** + * Converts this CompressedBatchProof to JSON. + * @function toJSON + * @memberof ics23.CompressedBatchProof + * @instance + * @returns {Object.} JSON object + */ + CompressedBatchProof.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CompressedBatchProof; + })(); + + ics23.CompressedBatchEntry = (function() { + + /** + * Properties of a CompressedBatchEntry. + * @memberof ics23 + * @interface ICompressedBatchEntry + * @property {ics23.ICompressedExistenceProof|null} [exist] CompressedBatchEntry exist + * @property {ics23.ICompressedNonExistenceProof|null} [nonexist] CompressedBatchEntry nonexist + */ + + /** + * Constructs a new CompressedBatchEntry. + * @memberof ics23 + * @classdesc Represents a CompressedBatchEntry. + * @implements ICompressedBatchEntry + * @constructor + * @param {ics23.ICompressedBatchEntry=} [properties] Properties to set + */ + function CompressedBatchEntry(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompressedBatchEntry exist. + * @member {ics23.ICompressedExistenceProof|null|undefined} exist + * @memberof ics23.CompressedBatchEntry + * @instance + */ + CompressedBatchEntry.prototype.exist = null; + + /** + * CompressedBatchEntry nonexist. + * @member {ics23.ICompressedNonExistenceProof|null|undefined} nonexist + * @memberof ics23.CompressedBatchEntry + * @instance + */ + CompressedBatchEntry.prototype.nonexist = null; + + // OneOf field names bound to virtual getters and setters + let $oneOfFields; + + /** + * CompressedBatchEntry proof. + * @member {"exist"|"nonexist"|undefined} proof + * @memberof ics23.CompressedBatchEntry + * @instance + */ + Object.defineProperty(CompressedBatchEntry.prototype, "proof", { + get: $util.oneOfGetter($oneOfFields = ["exist", "nonexist"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Encodes the specified CompressedBatchEntry message. Does not implicitly {@link ics23.CompressedBatchEntry.verify|verify} messages. + * @function encode + * @memberof ics23.CompressedBatchEntry + * @static + * @param {ics23.ICompressedBatchEntry} message CompressedBatchEntry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompressedBatchEntry.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.exist != null && Object.hasOwnProperty.call(message, "exist")) + $root.ics23.CompressedExistenceProof.encode(message.exist, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nonexist != null && Object.hasOwnProperty.call(message, "nonexist")) + $root.ics23.CompressedNonExistenceProof.encode(message.nonexist, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CompressedBatchEntry message, length delimited. Does not implicitly {@link ics23.CompressedBatchEntry.verify|verify} messages. + * @function encodeDelimited + * @memberof ics23.CompressedBatchEntry + * @static + * @param {ics23.ICompressedBatchEntry} message CompressedBatchEntry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompressedBatchEntry.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CompressedBatchEntry message from the specified reader or buffer. + * @function decode + * @memberof ics23.CompressedBatchEntry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ics23.CompressedBatchEntry} CompressedBatchEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompressedBatchEntry.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.CompressedBatchEntry(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.exist = $root.ics23.CompressedExistenceProof.decode(reader, reader.uint32()); + break; + case 2: + message.nonexist = $root.ics23.CompressedNonExistenceProof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CompressedBatchEntry message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ics23.CompressedBatchEntry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ics23.CompressedBatchEntry} CompressedBatchEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompressedBatchEntry.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompressedBatchEntry message. + * @function verify + * @memberof ics23.CompressedBatchEntry + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompressedBatchEntry.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + let properties = {}; + if (message.exist != null && message.hasOwnProperty("exist")) { + properties.proof = 1; + { + let error = $root.ics23.CompressedExistenceProof.verify(message.exist); + if (error) + return "exist." + error; + } + } + if (message.nonexist != null && message.hasOwnProperty("nonexist")) { + if (properties.proof === 1) + return "proof: multiple values"; + properties.proof = 1; + { + let error = $root.ics23.CompressedNonExistenceProof.verify(message.nonexist); + if (error) + return "nonexist." + error; + } + } + return null; + }; + + /** + * Creates a CompressedBatchEntry message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ics23.CompressedBatchEntry + * @static + * @param {Object.} object Plain object + * @returns {ics23.CompressedBatchEntry} CompressedBatchEntry + */ + CompressedBatchEntry.fromObject = function fromObject(object) { + if (object instanceof $root.ics23.CompressedBatchEntry) + return object; + let message = new $root.ics23.CompressedBatchEntry(); + if (object.exist != null) { + if (typeof object.exist !== "object") + throw TypeError(".ics23.CompressedBatchEntry.exist: object expected"); + message.exist = $root.ics23.CompressedExistenceProof.fromObject(object.exist); + } + if (object.nonexist != null) { + if (typeof object.nonexist !== "object") + throw TypeError(".ics23.CompressedBatchEntry.nonexist: object expected"); + message.nonexist = $root.ics23.CompressedNonExistenceProof.fromObject(object.nonexist); + } + return message; + }; + + /** + * Creates a plain object from a CompressedBatchEntry message. Also converts values to other types if specified. + * @function toObject + * @memberof ics23.CompressedBatchEntry + * @static + * @param {ics23.CompressedBatchEntry} message CompressedBatchEntry + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompressedBatchEntry.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (message.exist != null && message.hasOwnProperty("exist")) { + object.exist = $root.ics23.CompressedExistenceProof.toObject(message.exist, options); + if (options.oneofs) + object.proof = "exist"; + } + if (message.nonexist != null && message.hasOwnProperty("nonexist")) { + object.nonexist = $root.ics23.CompressedNonExistenceProof.toObject(message.nonexist, options); + if (options.oneofs) + object.proof = "nonexist"; + } + return object; + }; + + /** + * Converts this CompressedBatchEntry to JSON. + * @function toJSON + * @memberof ics23.CompressedBatchEntry + * @instance + * @returns {Object.} JSON object + */ + CompressedBatchEntry.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CompressedBatchEntry; + })(); + + ics23.CompressedExistenceProof = (function() { + + /** + * Properties of a CompressedExistenceProof. + * @memberof ics23 + * @interface ICompressedExistenceProof + * @property {Uint8Array|null} [key] CompressedExistenceProof key + * @property {Uint8Array|null} [value] CompressedExistenceProof value + * @property {ics23.ILeafOp|null} [leaf] CompressedExistenceProof leaf + * @property {Array.|null} [path] CompressedExistenceProof path + */ + + /** + * Constructs a new CompressedExistenceProof. + * @memberof ics23 + * @classdesc Represents a CompressedExistenceProof. + * @implements ICompressedExistenceProof + * @constructor + * @param {ics23.ICompressedExistenceProof=} [properties] Properties to set + */ + function CompressedExistenceProof(properties) { + this.path = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompressedExistenceProof key. + * @member {Uint8Array} key + * @memberof ics23.CompressedExistenceProof + * @instance + */ + CompressedExistenceProof.prototype.key = $util.newBuffer([]); + + /** + * CompressedExistenceProof value. + * @member {Uint8Array} value + * @memberof ics23.CompressedExistenceProof + * @instance + */ + CompressedExistenceProof.prototype.value = $util.newBuffer([]); + + /** + * CompressedExistenceProof leaf. + * @member {ics23.ILeafOp|null|undefined} leaf + * @memberof ics23.CompressedExistenceProof + * @instance + */ + CompressedExistenceProof.prototype.leaf = null; + + /** + * CompressedExistenceProof path. + * @member {Array.} path + * @memberof ics23.CompressedExistenceProof + * @instance + */ + CompressedExistenceProof.prototype.path = $util.emptyArray; + + /** + * Encodes the specified CompressedExistenceProof message. Does not implicitly {@link ics23.CompressedExistenceProof.verify|verify} messages. + * @function encode + * @memberof ics23.CompressedExistenceProof + * @static + * @param {ics23.ICompressedExistenceProof} message CompressedExistenceProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompressedExistenceProof.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value); + if (message.leaf != null && Object.hasOwnProperty.call(message, "leaf")) + $root.ics23.LeafOp.encode(message.leaf, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.path != null && message.path.length) { + writer.uint32(/* id 4, wireType 2 =*/34).fork(); + for (let i = 0; i < message.path.length; ++i) + writer.int32(message.path[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified CompressedExistenceProof message, length delimited. Does not implicitly {@link ics23.CompressedExistenceProof.verify|verify} messages. + * @function encodeDelimited + * @memberof ics23.CompressedExistenceProof + * @static + * @param {ics23.ICompressedExistenceProof} message CompressedExistenceProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompressedExistenceProof.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CompressedExistenceProof message from the specified reader or buffer. + * @function decode + * @memberof ics23.CompressedExistenceProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ics23.CompressedExistenceProof} CompressedExistenceProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompressedExistenceProof.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.CompressedExistenceProof(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.value = reader.bytes(); + break; + case 3: + message.leaf = $root.ics23.LeafOp.decode(reader, reader.uint32()); + break; + case 4: + if (!(message.path && message.path.length)) + message.path = []; + if ((tag & 7) === 2) { + let 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; + }; + + /** + * Decodes a CompressedExistenceProof message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ics23.CompressedExistenceProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ics23.CompressedExistenceProof} CompressedExistenceProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompressedExistenceProof.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompressedExistenceProof message. + * @function verify + * @memberof ics23.CompressedExistenceProof + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompressedExistenceProof.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) + return "key: buffer expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) + return "value: buffer expected"; + if (message.leaf != null && message.hasOwnProperty("leaf")) { + let error = $root.ics23.LeafOp.verify(message.leaf); + if (error) + return "leaf." + error; + } + if (message.path != null && message.hasOwnProperty("path")) { + if (!Array.isArray(message.path)) + return "path: array expected"; + for (let i = 0; i < message.path.length; ++i) + if (!$util.isInteger(message.path[i])) + return "path: integer[] expected"; + } + return null; + }; + + /** + * Creates a CompressedExistenceProof message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ics23.CompressedExistenceProof + * @static + * @param {Object.} object Plain object + * @returns {ics23.CompressedExistenceProof} CompressedExistenceProof + */ + CompressedExistenceProof.fromObject = function fromObject(object) { + if (object instanceof $root.ics23.CompressedExistenceProof) + return object; + let message = new $root.ics23.CompressedExistenceProof(); + if (object.key != null) + if (typeof object.key === "string") + $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); + else if (object.key.length) + message.key = object.key; + if (object.value != null) + if (typeof object.value === "string") + $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); + else if (object.value.length) + message.value = object.value; + if (object.leaf != null) { + if (typeof object.leaf !== "object") + throw TypeError(".ics23.CompressedExistenceProof.leaf: object expected"); + message.leaf = $root.ics23.LeafOp.fromObject(object.leaf); + } + if (object.path) { + if (!Array.isArray(object.path)) + throw TypeError(".ics23.CompressedExistenceProof.path: array expected"); + message.path = []; + for (let i = 0; i < object.path.length; ++i) + message.path[i] = object.path[i] | 0; + } + return message; + }; + + /** + * Creates a plain object from a CompressedExistenceProof message. Also converts values to other types if specified. + * @function toObject + * @memberof ics23.CompressedExistenceProof + * @static + * @param {ics23.CompressedExistenceProof} message CompressedExistenceProof + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompressedExistenceProof.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.path = []; + if (options.defaults) { + if (options.bytes === String) + object.key = ""; + else { + object.key = []; + if (options.bytes !== Array) + object.key = $util.newBuffer(object.key); + } + if (options.bytes === String) + object.value = ""; + else { + object.value = []; + if (options.bytes !== Array) + object.value = $util.newBuffer(object.value); + } + object.leaf = null; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; + if (message.leaf != null && message.hasOwnProperty("leaf")) + object.leaf = $root.ics23.LeafOp.toObject(message.leaf, options); + if (message.path && message.path.length) { + object.path = []; + for (let j = 0; j < message.path.length; ++j) + object.path[j] = message.path[j]; + } + return object; + }; + + /** + * Converts this CompressedExistenceProof to JSON. + * @function toJSON + * @memberof ics23.CompressedExistenceProof + * @instance + * @returns {Object.} JSON object + */ + CompressedExistenceProof.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CompressedExistenceProof; + })(); + + ics23.CompressedNonExistenceProof = (function() { + + /** + * Properties of a CompressedNonExistenceProof. + * @memberof ics23 + * @interface ICompressedNonExistenceProof + * @property {Uint8Array|null} [key] CompressedNonExistenceProof key + * @property {ics23.ICompressedExistenceProof|null} [left] CompressedNonExistenceProof left + * @property {ics23.ICompressedExistenceProof|null} [right] CompressedNonExistenceProof right + */ + + /** + * Constructs a new CompressedNonExistenceProof. + * @memberof ics23 + * @classdesc Represents a CompressedNonExistenceProof. + * @implements ICompressedNonExistenceProof + * @constructor + * @param {ics23.ICompressedNonExistenceProof=} [properties] Properties to set + */ + function CompressedNonExistenceProof(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompressedNonExistenceProof key. + * @member {Uint8Array} key + * @memberof ics23.CompressedNonExistenceProof + * @instance + */ + CompressedNonExistenceProof.prototype.key = $util.newBuffer([]); + + /** + * CompressedNonExistenceProof left. + * @member {ics23.ICompressedExistenceProof|null|undefined} left + * @memberof ics23.CompressedNonExistenceProof + * @instance + */ + CompressedNonExistenceProof.prototype.left = null; + + /** + * CompressedNonExistenceProof right. + * @member {ics23.ICompressedExistenceProof|null|undefined} right + * @memberof ics23.CompressedNonExistenceProof + * @instance + */ + CompressedNonExistenceProof.prototype.right = null; + + /** + * Encodes the specified CompressedNonExistenceProof message. Does not implicitly {@link ics23.CompressedNonExistenceProof.verify|verify} messages. + * @function encode + * @memberof ics23.CompressedNonExistenceProof + * @static + * @param {ics23.ICompressedNonExistenceProof} message CompressedNonExistenceProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompressedNonExistenceProof.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); + if (message.left != null && Object.hasOwnProperty.call(message, "left")) + $root.ics23.CompressedExistenceProof.encode(message.left, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.right != null && Object.hasOwnProperty.call(message, "right")) + $root.ics23.CompressedExistenceProof.encode(message.right, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CompressedNonExistenceProof message, length delimited. Does not implicitly {@link ics23.CompressedNonExistenceProof.verify|verify} messages. + * @function encodeDelimited + * @memberof ics23.CompressedNonExistenceProof + * @static + * @param {ics23.ICompressedNonExistenceProof} message CompressedNonExistenceProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompressedNonExistenceProof.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CompressedNonExistenceProof message from the specified reader or buffer. + * @function decode + * @memberof ics23.CompressedNonExistenceProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ics23.CompressedNonExistenceProof} CompressedNonExistenceProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompressedNonExistenceProof.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.CompressedNonExistenceProof(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.left = $root.ics23.CompressedExistenceProof.decode(reader, reader.uint32()); + break; + case 3: + message.right = $root.ics23.CompressedExistenceProof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CompressedNonExistenceProof message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ics23.CompressedNonExistenceProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ics23.CompressedNonExistenceProof} CompressedNonExistenceProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompressedNonExistenceProof.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompressedNonExistenceProof message. + * @function verify + * @memberof ics23.CompressedNonExistenceProof + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompressedNonExistenceProof.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) + return "key: buffer expected"; + if (message.left != null && message.hasOwnProperty("left")) { + let error = $root.ics23.CompressedExistenceProof.verify(message.left); + if (error) + return "left." + error; + } + if (message.right != null && message.hasOwnProperty("right")) { + let error = $root.ics23.CompressedExistenceProof.verify(message.right); + if (error) + return "right." + error; + } + return null; + }; + + /** + * Creates a CompressedNonExistenceProof message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ics23.CompressedNonExistenceProof + * @static + * @param {Object.} object Plain object + * @returns {ics23.CompressedNonExistenceProof} CompressedNonExistenceProof + */ + CompressedNonExistenceProof.fromObject = function fromObject(object) { + if (object instanceof $root.ics23.CompressedNonExistenceProof) + return object; + let message = new $root.ics23.CompressedNonExistenceProof(); + if (object.key != null) + if (typeof object.key === "string") + $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); + else if (object.key.length) + message.key = object.key; + if (object.left != null) { + if (typeof object.left !== "object") + throw TypeError(".ics23.CompressedNonExistenceProof.left: object expected"); + message.left = $root.ics23.CompressedExistenceProof.fromObject(object.left); + } + if (object.right != null) { + if (typeof object.right !== "object") + throw TypeError(".ics23.CompressedNonExistenceProof.right: object expected"); + message.right = $root.ics23.CompressedExistenceProof.fromObject(object.right); + } + return message; + }; + + /** + * Creates a plain object from a CompressedNonExistenceProof message. Also converts values to other types if specified. + * @function toObject + * @memberof ics23.CompressedNonExistenceProof + * @static + * @param {ics23.CompressedNonExistenceProof} message CompressedNonExistenceProof + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompressedNonExistenceProof.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if (options.bytes === String) + object.key = ""; + else { + object.key = []; + if (options.bytes !== Array) + object.key = $util.newBuffer(object.key); + } + object.left = null; + object.right = null; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; + if (message.left != null && message.hasOwnProperty("left")) + object.left = $root.ics23.CompressedExistenceProof.toObject(message.left, options); + if (message.right != null && message.hasOwnProperty("right")) + object.right = $root.ics23.CompressedExistenceProof.toObject(message.right, options); + return object; + }; + + /** + * Converts this CompressedNonExistenceProof to JSON. + * @function toJSON + * @memberof ics23.CompressedNonExistenceProof + * @instance + * @returns {Object.} JSON object + */ + CompressedNonExistenceProof.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CompressedNonExistenceProof; + })(); + + return ics23; +})(); + +export const cosmos = $root.cosmos = (() => { + + /** + * Namespace cosmos. + * @exports cosmos + * @namespace + */ + const cosmos = {}; + + cosmos.auth = (function() { + + /** + * Namespace auth. + * @memberof cosmos + * @namespace + */ + const auth = {}; + + auth.v1beta1 = (function() { + + /** + * Namespace v1beta1. + * @memberof cosmos.auth + * @namespace + */ + const v1beta1 = {}; + + v1beta1.Query = (function() { + + /** + * Constructs a new Query service. + * @memberof cosmos.auth.v1beta1 + * @classdesc Represents a Query + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Query(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Query.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Query; + + /** + * Callback as used by {@link cosmos.auth.v1beta1.Query#account}. + * @memberof cosmos.auth.v1beta1.Query + * @typedef AccountCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.auth.v1beta1.QueryAccountResponse} [response] QueryAccountResponse + */ + + /** + * Calls Account. + * @function account + * @memberof cosmos.auth.v1beta1.Query + * @instance + * @param {cosmos.auth.v1beta1.IQueryAccountRequest} request QueryAccountRequest message or plain object + * @param {cosmos.auth.v1beta1.Query.AccountCallback} callback Node-style callback called with the error, if any, and QueryAccountResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.account = function account(request, callback) { + return this.rpcCall(account, $root.cosmos.auth.v1beta1.QueryAccountRequest, $root.cosmos.auth.v1beta1.QueryAccountResponse, request, callback); + }, "name", { value: "Account" }); + + /** + * Calls Account. + * @function account + * @memberof cosmos.auth.v1beta1.Query + * @instance + * @param {cosmos.auth.v1beta1.IQueryAccountRequest} request QueryAccountRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.auth.v1beta1.Query#params}. + * @memberof cosmos.auth.v1beta1.Query + * @typedef ParamsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.auth.v1beta1.QueryParamsResponse} [response] QueryParamsResponse + */ + + /** + * Calls Params. + * @function params + * @memberof cosmos.auth.v1beta1.Query + * @instance + * @param {cosmos.auth.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object + * @param {cosmos.auth.v1beta1.Query.ParamsCallback} callback Node-style callback called with the error, if any, and QueryParamsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.params = function params(request, callback) { + return this.rpcCall(params, $root.cosmos.auth.v1beta1.QueryParamsRequest, $root.cosmos.auth.v1beta1.QueryParamsResponse, request, callback); + }, "name", { value: "Params" }); + + /** + * Calls Params. + * @function params + * @memberof cosmos.auth.v1beta1.Query + * @instance + * @param {cosmos.auth.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Query; + })(); + + v1beta1.QueryAccountRequest = (function() { + + /** + * Properties of a QueryAccountRequest. + * @memberof cosmos.auth.v1beta1 + * @interface IQueryAccountRequest + * @property {string|null} [address] QueryAccountRequest address + */ + + /** + * Constructs a new QueryAccountRequest. + * @memberof cosmos.auth.v1beta1 + * @classdesc Represents a QueryAccountRequest. + * @implements IQueryAccountRequest + * @constructor + * @param {cosmos.auth.v1beta1.IQueryAccountRequest=} [properties] Properties to set + */ + function QueryAccountRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryAccountRequest address. + * @member {string} address + * @memberof cosmos.auth.v1beta1.QueryAccountRequest + * @instance + */ + QueryAccountRequest.prototype.address = ""; + + /** + * Encodes the specified QueryAccountRequest message. Does not implicitly {@link cosmos.auth.v1beta1.QueryAccountRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.auth.v1beta1.QueryAccountRequest + * @static + * @param {cosmos.auth.v1beta1.IQueryAccountRequest} message QueryAccountRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryAccountRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.address != null && Object.hasOwnProperty.call(message, "address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.address); + return writer; + }; + + /** + * Encodes the specified QueryAccountRequest message, length delimited. Does not implicitly {@link cosmos.auth.v1beta1.QueryAccountRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.auth.v1beta1.QueryAccountRequest + * @static + * @param {cosmos.auth.v1beta1.IQueryAccountRequest} message QueryAccountRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryAccountRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryAccountRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.auth.v1beta1.QueryAccountRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.auth.v1beta1.QueryAccountRequest} QueryAccountRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryAccountRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.auth.v1beta1.QueryAccountRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryAccountRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.auth.v1beta1.QueryAccountRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.auth.v1beta1.QueryAccountRequest} QueryAccountRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryAccountRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryAccountRequest message. + * @function verify + * @memberof cosmos.auth.v1beta1.QueryAccountRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryAccountRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.address != null && message.hasOwnProperty("address")) + if (!$util.isString(message.address)) + return "address: string expected"; + return null; + }; + + /** + * Creates a QueryAccountRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.auth.v1beta1.QueryAccountRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.auth.v1beta1.QueryAccountRequest} QueryAccountRequest + */ + QueryAccountRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.auth.v1beta1.QueryAccountRequest) + return object; + let message = new $root.cosmos.auth.v1beta1.QueryAccountRequest(); + if (object.address != null) + message.address = String(object.address); + return message; + }; + + /** + * Creates a plain object from a QueryAccountRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.auth.v1beta1.QueryAccountRequest + * @static + * @param {cosmos.auth.v1beta1.QueryAccountRequest} message QueryAccountRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryAccountRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.address = ""; + if (message.address != null && message.hasOwnProperty("address")) + object.address = message.address; + return object; + }; + + /** + * Converts this QueryAccountRequest to JSON. + * @function toJSON + * @memberof cosmos.auth.v1beta1.QueryAccountRequest + * @instance + * @returns {Object.} JSON object + */ + QueryAccountRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryAccountRequest; + })(); + + v1beta1.QueryAccountResponse = (function() { + + /** + * Properties of a QueryAccountResponse. + * @memberof cosmos.auth.v1beta1 + * @interface IQueryAccountResponse + * @property {google.protobuf.IAny|null} [account] QueryAccountResponse account + */ + + /** + * Constructs a new QueryAccountResponse. + * @memberof cosmos.auth.v1beta1 + * @classdesc Represents a QueryAccountResponse. + * @implements IQueryAccountResponse + * @constructor + * @param {cosmos.auth.v1beta1.IQueryAccountResponse=} [properties] Properties to set + */ + function QueryAccountResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryAccountResponse account. + * @member {google.protobuf.IAny|null|undefined} account + * @memberof cosmos.auth.v1beta1.QueryAccountResponse + * @instance + */ + QueryAccountResponse.prototype.account = null; + + /** + * Encodes the specified QueryAccountResponse message. Does not implicitly {@link cosmos.auth.v1beta1.QueryAccountResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.auth.v1beta1.QueryAccountResponse + * @static + * @param {cosmos.auth.v1beta1.IQueryAccountResponse} message QueryAccountResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryAccountResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.account != null && Object.hasOwnProperty.call(message, "account")) + $root.google.protobuf.Any.encode(message.account, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryAccountResponse message, length delimited. Does not implicitly {@link cosmos.auth.v1beta1.QueryAccountResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.auth.v1beta1.QueryAccountResponse + * @static + * @param {cosmos.auth.v1beta1.IQueryAccountResponse} message QueryAccountResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryAccountResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryAccountResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.auth.v1beta1.QueryAccountResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.auth.v1beta1.QueryAccountResponse} QueryAccountResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryAccountResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.auth.v1beta1.QueryAccountResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.account = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryAccountResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.auth.v1beta1.QueryAccountResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.auth.v1beta1.QueryAccountResponse} QueryAccountResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryAccountResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryAccountResponse message. + * @function verify + * @memberof cosmos.auth.v1beta1.QueryAccountResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryAccountResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.account != null && message.hasOwnProperty("account")) { + let error = $root.google.protobuf.Any.verify(message.account); + if (error) + return "account." + error; + } + return null; + }; + + /** + * Creates a QueryAccountResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.auth.v1beta1.QueryAccountResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.auth.v1beta1.QueryAccountResponse} QueryAccountResponse + */ + QueryAccountResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.auth.v1beta1.QueryAccountResponse) + return object; + let message = new $root.cosmos.auth.v1beta1.QueryAccountResponse(); + if (object.account != null) { + if (typeof object.account !== "object") + throw TypeError(".cosmos.auth.v1beta1.QueryAccountResponse.account: object expected"); + message.account = $root.google.protobuf.Any.fromObject(object.account); + } + return message; + }; + + /** + * Creates a plain object from a QueryAccountResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.auth.v1beta1.QueryAccountResponse + * @static + * @param {cosmos.auth.v1beta1.QueryAccountResponse} message QueryAccountResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryAccountResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.account = null; + if (message.account != null && message.hasOwnProperty("account")) + object.account = $root.google.protobuf.Any.toObject(message.account, options); + return object; + }; + + /** + * Converts this QueryAccountResponse to JSON. + * @function toJSON + * @memberof cosmos.auth.v1beta1.QueryAccountResponse + * @instance + * @returns {Object.} JSON object + */ + QueryAccountResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryAccountResponse; + })(); + + v1beta1.QueryParamsRequest = (function() { + + /** + * Properties of a QueryParamsRequest. + * @memberof cosmos.auth.v1beta1 + * @interface IQueryParamsRequest + */ + + /** + * Constructs a new QueryParamsRequest. + * @memberof cosmos.auth.v1beta1 + * @classdesc Represents a QueryParamsRequest. + * @implements IQueryParamsRequest + * @constructor + * @param {cosmos.auth.v1beta1.IQueryParamsRequest=} [properties] Properties to set + */ + function QueryParamsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified QueryParamsRequest message. Does not implicitly {@link cosmos.auth.v1beta1.QueryParamsRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.auth.v1beta1.QueryParamsRequest + * @static + * @param {cosmos.auth.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified QueryParamsRequest message, length delimited. Does not implicitly {@link cosmos.auth.v1beta1.QueryParamsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.auth.v1beta1.QueryParamsRequest + * @static + * @param {cosmos.auth.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryParamsRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.auth.v1beta1.QueryParamsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.auth.v1beta1.QueryParamsRequest} QueryParamsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.auth.v1beta1.QueryParamsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryParamsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.auth.v1beta1.QueryParamsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.auth.v1beta1.QueryParamsRequest} QueryParamsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryParamsRequest message. + * @function verify + * @memberof cosmos.auth.v1beta1.QueryParamsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryParamsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a QueryParamsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.auth.v1beta1.QueryParamsRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.auth.v1beta1.QueryParamsRequest} QueryParamsRequest + */ + QueryParamsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.auth.v1beta1.QueryParamsRequest) + return object; + return new $root.cosmos.auth.v1beta1.QueryParamsRequest(); + }; + + /** + * Creates a plain object from a QueryParamsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.auth.v1beta1.QueryParamsRequest + * @static + * @param {cosmos.auth.v1beta1.QueryParamsRequest} message QueryParamsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryParamsRequest.toObject = function toObject() { + return {}; + }; + + /** + * Converts this QueryParamsRequest to JSON. + * @function toJSON + * @memberof cosmos.auth.v1beta1.QueryParamsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryParamsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryParamsRequest; + })(); + + v1beta1.QueryParamsResponse = (function() { + + /** + * Properties of a QueryParamsResponse. + * @memberof cosmos.auth.v1beta1 + * @interface IQueryParamsResponse + * @property {cosmos.auth.v1beta1.IParams|null} [params] QueryParamsResponse params + */ + + /** + * Constructs a new QueryParamsResponse. + * @memberof cosmos.auth.v1beta1 + * @classdesc Represents a QueryParamsResponse. + * @implements IQueryParamsResponse + * @constructor + * @param {cosmos.auth.v1beta1.IQueryParamsResponse=} [properties] Properties to set + */ + function QueryParamsResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryParamsResponse params. + * @member {cosmos.auth.v1beta1.IParams|null|undefined} params + * @memberof cosmos.auth.v1beta1.QueryParamsResponse + * @instance + */ + QueryParamsResponse.prototype.params = null; + + /** + * Encodes the specified QueryParamsResponse message. Does not implicitly {@link cosmos.auth.v1beta1.QueryParamsResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.auth.v1beta1.QueryParamsResponse + * @static + * @param {cosmos.auth.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.params != null && Object.hasOwnProperty.call(message, "params")) + $root.cosmos.auth.v1beta1.Params.encode(message.params, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryParamsResponse message, length delimited. Does not implicitly {@link cosmos.auth.v1beta1.QueryParamsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.auth.v1beta1.QueryParamsResponse + * @static + * @param {cosmos.auth.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryParamsResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.auth.v1beta1.QueryParamsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.auth.v1beta1.QueryParamsResponse} QueryParamsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.auth.v1beta1.QueryParamsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = $root.cosmos.auth.v1beta1.Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryParamsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.auth.v1beta1.QueryParamsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.auth.v1beta1.QueryParamsResponse} QueryParamsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryParamsResponse message. + * @function verify + * @memberof cosmos.auth.v1beta1.QueryParamsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryParamsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.params != null && message.hasOwnProperty("params")) { + let error = $root.cosmos.auth.v1beta1.Params.verify(message.params); + if (error) + return "params." + error; + } + return null; + }; + + /** + * Creates a QueryParamsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.auth.v1beta1.QueryParamsResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.auth.v1beta1.QueryParamsResponse} QueryParamsResponse + */ + QueryParamsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.auth.v1beta1.QueryParamsResponse) + return object; + let message = new $root.cosmos.auth.v1beta1.QueryParamsResponse(); + if (object.params != null) { + if (typeof object.params !== "object") + throw TypeError(".cosmos.auth.v1beta1.QueryParamsResponse.params: object expected"); + message.params = $root.cosmos.auth.v1beta1.Params.fromObject(object.params); + } + return message; + }; + + /** + * Creates a plain object from a QueryParamsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.auth.v1beta1.QueryParamsResponse + * @static + * @param {cosmos.auth.v1beta1.QueryParamsResponse} message QueryParamsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryParamsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.params = null; + if (message.params != null && message.hasOwnProperty("params")) + object.params = $root.cosmos.auth.v1beta1.Params.toObject(message.params, options); + return object; + }; + + /** + * Converts this QueryParamsResponse to JSON. + * @function toJSON + * @memberof cosmos.auth.v1beta1.QueryParamsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryParamsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryParamsResponse; + })(); + + v1beta1.GenesisState = (function() { + + /** + * Properties of a GenesisState. + * @memberof cosmos.auth.v1beta1 + * @interface IGenesisState + * @property {cosmos.auth.v1beta1.IParams|null} [params] GenesisState params + * @property {Array.|null} [accounts] GenesisState accounts + */ + + /** + * Constructs a new GenesisState. + * @memberof cosmos.auth.v1beta1 + * @classdesc Represents a GenesisState. + * @implements IGenesisState + * @constructor + * @param {cosmos.auth.v1beta1.IGenesisState=} [properties] Properties to set + */ + function GenesisState(properties) { + this.accounts = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenesisState params. + * @member {cosmos.auth.v1beta1.IParams|null|undefined} params + * @memberof cosmos.auth.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.params = null; + + /** + * GenesisState accounts. + * @member {Array.} accounts + * @memberof cosmos.auth.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.accounts = $util.emptyArray; + + /** + * Encodes the specified GenesisState message. Does not implicitly {@link cosmos.auth.v1beta1.GenesisState.verify|verify} messages. + * @function encode + * @memberof cosmos.auth.v1beta1.GenesisState + * @static + * @param {cosmos.auth.v1beta1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.params != null && Object.hasOwnProperty.call(message, "params")) + $root.cosmos.auth.v1beta1.Params.encode(message.params, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.accounts != null && message.accounts.length) + for (let i = 0; i < message.accounts.length; ++i) + $root.google.protobuf.Any.encode(message.accounts[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link cosmos.auth.v1beta1.GenesisState.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.auth.v1beta1.GenesisState + * @static + * @param {cosmos.auth.v1beta1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer. + * @function decode + * @memberof cosmos.auth.v1beta1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.auth.v1beta1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.auth.v1beta1.GenesisState(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = $root.cosmos.auth.v1beta1.Params.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.accounts && message.accounts.length)) + message.accounts = []; + message.accounts.push($root.google.protobuf.Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.auth.v1beta1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.auth.v1beta1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenesisState message. + * @function verify + * @memberof cosmos.auth.v1beta1.GenesisState + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenesisState.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.params != null && message.hasOwnProperty("params")) { + let error = $root.cosmos.auth.v1beta1.Params.verify(message.params); + if (error) + return "params." + error; + } + if (message.accounts != null && message.hasOwnProperty("accounts")) { + if (!Array.isArray(message.accounts)) + return "accounts: array expected"; + for (let i = 0; i < message.accounts.length; ++i) { + let error = $root.google.protobuf.Any.verify(message.accounts[i]); + if (error) + return "accounts." + error; + } + } + return null; + }; + + /** + * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.auth.v1beta1.GenesisState + * @static + * @param {Object.} object Plain object + * @returns {cosmos.auth.v1beta1.GenesisState} GenesisState + */ + GenesisState.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.auth.v1beta1.GenesisState) + return object; + let message = new $root.cosmos.auth.v1beta1.GenesisState(); + if (object.params != null) { + if (typeof object.params !== "object") + throw TypeError(".cosmos.auth.v1beta1.GenesisState.params: object expected"); + message.params = $root.cosmos.auth.v1beta1.Params.fromObject(object.params); + } + if (object.accounts) { + if (!Array.isArray(object.accounts)) + throw TypeError(".cosmos.auth.v1beta1.GenesisState.accounts: array expected"); + message.accounts = []; + for (let i = 0; i < object.accounts.length; ++i) { + if (typeof object.accounts[i] !== "object") + throw TypeError(".cosmos.auth.v1beta1.GenesisState.accounts: object expected"); + message.accounts[i] = $root.google.protobuf.Any.fromObject(object.accounts[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a GenesisState message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.auth.v1beta1.GenesisState + * @static + * @param {cosmos.auth.v1beta1.GenesisState} message GenesisState + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenesisState.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.accounts = []; + if (options.defaults) + object.params = null; + if (message.params != null && message.hasOwnProperty("params")) + object.params = $root.cosmos.auth.v1beta1.Params.toObject(message.params, options); + if (message.accounts && message.accounts.length) { + object.accounts = []; + for (let j = 0; j < message.accounts.length; ++j) + object.accounts[j] = $root.google.protobuf.Any.toObject(message.accounts[j], options); + } + return object; + }; + + /** + * Converts this GenesisState to JSON. + * @function toJSON + * @memberof cosmos.auth.v1beta1.GenesisState + * @instance + * @returns {Object.} JSON object + */ + GenesisState.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenesisState; + })(); + + v1beta1.BaseAccount = (function() { + + /** + * Properties of a BaseAccount. + * @memberof cosmos.auth.v1beta1 + * @interface IBaseAccount + * @property {string|null} [address] BaseAccount address + * @property {google.protobuf.IAny|null} [pub_key] BaseAccount pub_key + * @property {Long|null} [account_number] BaseAccount account_number + * @property {Long|null} [sequence] BaseAccount sequence + */ + + /** + * Constructs a new BaseAccount. + * @memberof cosmos.auth.v1beta1 + * @classdesc Represents a BaseAccount. + * @implements IBaseAccount + * @constructor + * @param {cosmos.auth.v1beta1.IBaseAccount=} [properties] Properties to set + */ + function BaseAccount(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BaseAccount address. + * @member {string} address + * @memberof cosmos.auth.v1beta1.BaseAccount + * @instance + */ + BaseAccount.prototype.address = ""; + + /** + * BaseAccount pub_key. + * @member {google.protobuf.IAny|null|undefined} pub_key + * @memberof cosmos.auth.v1beta1.BaseAccount + * @instance + */ + BaseAccount.prototype.pub_key = null; + + /** + * BaseAccount account_number. + * @member {Long} account_number + * @memberof cosmos.auth.v1beta1.BaseAccount + * @instance + */ + BaseAccount.prototype.account_number = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * BaseAccount sequence. + * @member {Long} sequence + * @memberof cosmos.auth.v1beta1.BaseAccount + * @instance + */ + BaseAccount.prototype.sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified BaseAccount message. Does not implicitly {@link cosmos.auth.v1beta1.BaseAccount.verify|verify} messages. + * @function encode + * @memberof cosmos.auth.v1beta1.BaseAccount + * @static + * @param {cosmos.auth.v1beta1.IBaseAccount} message BaseAccount message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BaseAccount.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.address != null && Object.hasOwnProperty.call(message, "address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.address); + if (message.pub_key != null && Object.hasOwnProperty.call(message, "pub_key")) + $root.google.protobuf.Any.encode(message.pub_key, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.account_number != null && Object.hasOwnProperty.call(message, "account_number")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.account_number); + if (message.sequence != null && Object.hasOwnProperty.call(message, "sequence")) + writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.sequence); + return writer; + }; + + /** + * Encodes the specified BaseAccount message, length delimited. Does not implicitly {@link cosmos.auth.v1beta1.BaseAccount.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.auth.v1beta1.BaseAccount + * @static + * @param {cosmos.auth.v1beta1.IBaseAccount} message BaseAccount message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BaseAccount.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BaseAccount message from the specified reader or buffer. + * @function decode + * @memberof cosmos.auth.v1beta1.BaseAccount + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.auth.v1beta1.BaseAccount} BaseAccount + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BaseAccount.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.auth.v1beta1.BaseAccount(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.pub_key = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 3: + message.account_number = reader.uint64(); + break; + case 4: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BaseAccount message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.auth.v1beta1.BaseAccount + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.auth.v1beta1.BaseAccount} BaseAccount + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BaseAccount.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BaseAccount message. + * @function verify + * @memberof cosmos.auth.v1beta1.BaseAccount + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BaseAccount.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.address != null && message.hasOwnProperty("address")) + if (!$util.isString(message.address)) + return "address: string expected"; + if (message.pub_key != null && message.hasOwnProperty("pub_key")) { + let error = $root.google.protobuf.Any.verify(message.pub_key); + if (error) + return "pub_key." + error; + } + if (message.account_number != null && message.hasOwnProperty("account_number")) + if (!$util.isInteger(message.account_number) && !(message.account_number && $util.isInteger(message.account_number.low) && $util.isInteger(message.account_number.high))) + return "account_number: integer|Long expected"; + if (message.sequence != null && message.hasOwnProperty("sequence")) + if (!$util.isInteger(message.sequence) && !(message.sequence && $util.isInteger(message.sequence.low) && $util.isInteger(message.sequence.high))) + return "sequence: integer|Long expected"; + return null; + }; + + /** + * Creates a BaseAccount message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.auth.v1beta1.BaseAccount + * @static + * @param {Object.} object Plain object + * @returns {cosmos.auth.v1beta1.BaseAccount} BaseAccount + */ + BaseAccount.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.auth.v1beta1.BaseAccount) + return object; + let message = new $root.cosmos.auth.v1beta1.BaseAccount(); + if (object.address != null) + message.address = String(object.address); + if (object.pub_key != null) { + if (typeof object.pub_key !== "object") + throw TypeError(".cosmos.auth.v1beta1.BaseAccount.pub_key: object expected"); + message.pub_key = $root.google.protobuf.Any.fromObject(object.pub_key); + } + if (object.account_number != null) + if ($util.Long) + (message.account_number = $util.Long.fromValue(object.account_number)).unsigned = true; + else if (typeof object.account_number === "string") + message.account_number = parseInt(object.account_number, 10); + else if (typeof object.account_number === "number") + message.account_number = object.account_number; + else if (typeof object.account_number === "object") + message.account_number = new $util.LongBits(object.account_number.low >>> 0, object.account_number.high >>> 0).toNumber(true); + if (object.sequence != null) + if ($util.Long) + (message.sequence = $util.Long.fromValue(object.sequence)).unsigned = true; + else if (typeof object.sequence === "string") + message.sequence = parseInt(object.sequence, 10); + else if (typeof object.sequence === "number") + message.sequence = object.sequence; + else if (typeof object.sequence === "object") + message.sequence = new $util.LongBits(object.sequence.low >>> 0, object.sequence.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a BaseAccount message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.auth.v1beta1.BaseAccount + * @static + * @param {cosmos.auth.v1beta1.BaseAccount} message BaseAccount + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BaseAccount.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.address = ""; + object.pub_key = null; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.account_number = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.account_number = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.sequence = options.longs === String ? "0" : 0; + } + if (message.address != null && message.hasOwnProperty("address")) + object.address = message.address; + if (message.pub_key != null && message.hasOwnProperty("pub_key")) + object.pub_key = $root.google.protobuf.Any.toObject(message.pub_key, options); + if (message.account_number != null && message.hasOwnProperty("account_number")) + if (typeof message.account_number === "number") + object.account_number = options.longs === String ? String(message.account_number) : message.account_number; + else + object.account_number = options.longs === String ? $util.Long.prototype.toString.call(message.account_number) : options.longs === Number ? new $util.LongBits(message.account_number.low >>> 0, message.account_number.high >>> 0).toNumber(true) : message.account_number; + if (message.sequence != null && message.hasOwnProperty("sequence")) + if (typeof message.sequence === "number") + object.sequence = options.longs === String ? String(message.sequence) : message.sequence; + else + object.sequence = options.longs === String ? $util.Long.prototype.toString.call(message.sequence) : options.longs === Number ? new $util.LongBits(message.sequence.low >>> 0, message.sequence.high >>> 0).toNumber(true) : message.sequence; + return object; + }; + + /** + * Converts this BaseAccount to JSON. + * @function toJSON + * @memberof cosmos.auth.v1beta1.BaseAccount + * @instance + * @returns {Object.} JSON object + */ + BaseAccount.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BaseAccount; + })(); + + v1beta1.ModuleAccount = (function() { + + /** + * Properties of a ModuleAccount. + * @memberof cosmos.auth.v1beta1 + * @interface IModuleAccount + * @property {cosmos.auth.v1beta1.IBaseAccount|null} [base_account] ModuleAccount base_account + * @property {string|null} [name] ModuleAccount name + * @property {Array.|null} [permissions] ModuleAccount permissions + */ + + /** + * Constructs a new ModuleAccount. + * @memberof cosmos.auth.v1beta1 + * @classdesc Represents a ModuleAccount. + * @implements IModuleAccount + * @constructor + * @param {cosmos.auth.v1beta1.IModuleAccount=} [properties] Properties to set + */ + function ModuleAccount(properties) { + this.permissions = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ModuleAccount base_account. + * @member {cosmos.auth.v1beta1.IBaseAccount|null|undefined} base_account + * @memberof cosmos.auth.v1beta1.ModuleAccount + * @instance + */ + ModuleAccount.prototype.base_account = null; + + /** + * ModuleAccount name. + * @member {string} name + * @memberof cosmos.auth.v1beta1.ModuleAccount + * @instance + */ + ModuleAccount.prototype.name = ""; + + /** + * ModuleAccount permissions. + * @member {Array.} permissions + * @memberof cosmos.auth.v1beta1.ModuleAccount + * @instance + */ + ModuleAccount.prototype.permissions = $util.emptyArray; + + /** + * Encodes the specified ModuleAccount message. Does not implicitly {@link cosmos.auth.v1beta1.ModuleAccount.verify|verify} messages. + * @function encode + * @memberof cosmos.auth.v1beta1.ModuleAccount + * @static + * @param {cosmos.auth.v1beta1.IModuleAccount} message ModuleAccount message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ModuleAccount.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.base_account != null && Object.hasOwnProperty.call(message, "base_account")) + $root.cosmos.auth.v1beta1.BaseAccount.encode(message.base_account, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.name); + if (message.permissions != null && message.permissions.length) + for (let i = 0; i < message.permissions.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.permissions[i]); + return writer; + }; + + /** + * Encodes the specified ModuleAccount message, length delimited. Does not implicitly {@link cosmos.auth.v1beta1.ModuleAccount.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.auth.v1beta1.ModuleAccount + * @static + * @param {cosmos.auth.v1beta1.IModuleAccount} message ModuleAccount message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ModuleAccount.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ModuleAccount message from the specified reader or buffer. + * @function decode + * @memberof cosmos.auth.v1beta1.ModuleAccount + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.auth.v1beta1.ModuleAccount} ModuleAccount + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ModuleAccount.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.auth.v1beta1.ModuleAccount(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.base_account = $root.cosmos.auth.v1beta1.BaseAccount.decode(reader, reader.uint32()); + break; + case 2: + message.name = reader.string(); + break; + case 3: + if (!(message.permissions && message.permissions.length)) + message.permissions = []; + message.permissions.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ModuleAccount message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.auth.v1beta1.ModuleAccount + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.auth.v1beta1.ModuleAccount} ModuleAccount + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ModuleAccount.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ModuleAccount message. + * @function verify + * @memberof cosmos.auth.v1beta1.ModuleAccount + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ModuleAccount.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.base_account != null && message.hasOwnProperty("base_account")) { + let error = $root.cosmos.auth.v1beta1.BaseAccount.verify(message.base_account); + if (error) + return "base_account." + error; + } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.permissions != null && message.hasOwnProperty("permissions")) { + if (!Array.isArray(message.permissions)) + return "permissions: array expected"; + for (let i = 0; i < message.permissions.length; ++i) + if (!$util.isString(message.permissions[i])) + return "permissions: string[] expected"; + } + return null; + }; + + /** + * Creates a ModuleAccount message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.auth.v1beta1.ModuleAccount + * @static + * @param {Object.} object Plain object + * @returns {cosmos.auth.v1beta1.ModuleAccount} ModuleAccount + */ + ModuleAccount.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.auth.v1beta1.ModuleAccount) + return object; + let message = new $root.cosmos.auth.v1beta1.ModuleAccount(); + if (object.base_account != null) { + if (typeof object.base_account !== "object") + throw TypeError(".cosmos.auth.v1beta1.ModuleAccount.base_account: object expected"); + message.base_account = $root.cosmos.auth.v1beta1.BaseAccount.fromObject(object.base_account); + } + if (object.name != null) + message.name = String(object.name); + if (object.permissions) { + if (!Array.isArray(object.permissions)) + throw TypeError(".cosmos.auth.v1beta1.ModuleAccount.permissions: array expected"); + message.permissions = []; + for (let i = 0; i < object.permissions.length; ++i) + message.permissions[i] = String(object.permissions[i]); + } + return message; + }; + + /** + * Creates a plain object from a ModuleAccount message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.auth.v1beta1.ModuleAccount + * @static + * @param {cosmos.auth.v1beta1.ModuleAccount} message ModuleAccount + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ModuleAccount.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.permissions = []; + if (options.defaults) { + object.base_account = null; + object.name = ""; + } + if (message.base_account != null && message.hasOwnProperty("base_account")) + object.base_account = $root.cosmos.auth.v1beta1.BaseAccount.toObject(message.base_account, options); + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.permissions && message.permissions.length) { + object.permissions = []; + for (let j = 0; j < message.permissions.length; ++j) + object.permissions[j] = message.permissions[j]; + } + return object; + }; + + /** + * Converts this ModuleAccount to JSON. + * @function toJSON + * @memberof cosmos.auth.v1beta1.ModuleAccount + * @instance + * @returns {Object.} JSON object + */ + ModuleAccount.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ModuleAccount; + })(); + + v1beta1.Params = (function() { + + /** + * Properties of a Params. + * @memberof cosmos.auth.v1beta1 + * @interface IParams + * @property {Long|null} [max_memo_characters] Params max_memo_characters + * @property {Long|null} [tx_sig_limit] Params tx_sig_limit + * @property {Long|null} [tx_size_cost_per_byte] Params tx_size_cost_per_byte + * @property {Long|null} [sig_verify_cost_ed25519] Params sig_verify_cost_ed25519 + * @property {Long|null} [sig_verify_cost_secp256k1] Params sig_verify_cost_secp256k1 + */ + + /** + * Constructs a new Params. + * @memberof cosmos.auth.v1beta1 + * @classdesc Represents a Params. + * @implements IParams + * @constructor + * @param {cosmos.auth.v1beta1.IParams=} [properties] Properties to set + */ + function Params(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Params max_memo_characters. + * @member {Long} max_memo_characters + * @memberof cosmos.auth.v1beta1.Params + * @instance + */ + Params.prototype.max_memo_characters = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Params tx_sig_limit. + * @member {Long} tx_sig_limit + * @memberof cosmos.auth.v1beta1.Params + * @instance + */ + Params.prototype.tx_sig_limit = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Params tx_size_cost_per_byte. + * @member {Long} tx_size_cost_per_byte + * @memberof cosmos.auth.v1beta1.Params + * @instance + */ + Params.prototype.tx_size_cost_per_byte = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Params sig_verify_cost_ed25519. + * @member {Long} sig_verify_cost_ed25519 + * @memberof cosmos.auth.v1beta1.Params + * @instance + */ + Params.prototype.sig_verify_cost_ed25519 = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Params sig_verify_cost_secp256k1. + * @member {Long} sig_verify_cost_secp256k1 + * @memberof cosmos.auth.v1beta1.Params + * @instance + */ + Params.prototype.sig_verify_cost_secp256k1 = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified Params message. Does not implicitly {@link cosmos.auth.v1beta1.Params.verify|verify} messages. + * @function encode + * @memberof cosmos.auth.v1beta1.Params + * @static + * @param {cosmos.auth.v1beta1.IParams} message Params message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Params.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.max_memo_characters != null && Object.hasOwnProperty.call(message, "max_memo_characters")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.max_memo_characters); + if (message.tx_sig_limit != null && Object.hasOwnProperty.call(message, "tx_sig_limit")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.tx_sig_limit); + if (message.tx_size_cost_per_byte != null && Object.hasOwnProperty.call(message, "tx_size_cost_per_byte")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.tx_size_cost_per_byte); + if (message.sig_verify_cost_ed25519 != null && Object.hasOwnProperty.call(message, "sig_verify_cost_ed25519")) + writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.sig_verify_cost_ed25519); + if (message.sig_verify_cost_secp256k1 != null && Object.hasOwnProperty.call(message, "sig_verify_cost_secp256k1")) + writer.uint32(/* id 5, wireType 0 =*/40).uint64(message.sig_verify_cost_secp256k1); + return writer; + }; + + /** + * Encodes the specified Params message, length delimited. Does not implicitly {@link cosmos.auth.v1beta1.Params.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.auth.v1beta1.Params + * @static + * @param {cosmos.auth.v1beta1.IParams} message Params message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Params.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Params message from the specified reader or buffer. + * @function decode + * @memberof cosmos.auth.v1beta1.Params + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.auth.v1beta1.Params} Params + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Params.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.auth.v1beta1.Params(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.max_memo_characters = reader.uint64(); + break; + case 2: + message.tx_sig_limit = reader.uint64(); + break; + case 3: + message.tx_size_cost_per_byte = reader.uint64(); + break; + case 4: + message.sig_verify_cost_ed25519 = reader.uint64(); + break; + case 5: + message.sig_verify_cost_secp256k1 = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Params message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.auth.v1beta1.Params + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.auth.v1beta1.Params} Params + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Params.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Params message. + * @function verify + * @memberof cosmos.auth.v1beta1.Params + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Params.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.max_memo_characters != null && message.hasOwnProperty("max_memo_characters")) + if (!$util.isInteger(message.max_memo_characters) && !(message.max_memo_characters && $util.isInteger(message.max_memo_characters.low) && $util.isInteger(message.max_memo_characters.high))) + return "max_memo_characters: integer|Long expected"; + if (message.tx_sig_limit != null && message.hasOwnProperty("tx_sig_limit")) + if (!$util.isInteger(message.tx_sig_limit) && !(message.tx_sig_limit && $util.isInteger(message.tx_sig_limit.low) && $util.isInteger(message.tx_sig_limit.high))) + return "tx_sig_limit: integer|Long expected"; + if (message.tx_size_cost_per_byte != null && message.hasOwnProperty("tx_size_cost_per_byte")) + if (!$util.isInteger(message.tx_size_cost_per_byte) && !(message.tx_size_cost_per_byte && $util.isInteger(message.tx_size_cost_per_byte.low) && $util.isInteger(message.tx_size_cost_per_byte.high))) + return "tx_size_cost_per_byte: integer|Long expected"; + if (message.sig_verify_cost_ed25519 != null && message.hasOwnProperty("sig_verify_cost_ed25519")) + if (!$util.isInteger(message.sig_verify_cost_ed25519) && !(message.sig_verify_cost_ed25519 && $util.isInteger(message.sig_verify_cost_ed25519.low) && $util.isInteger(message.sig_verify_cost_ed25519.high))) + return "sig_verify_cost_ed25519: integer|Long expected"; + if (message.sig_verify_cost_secp256k1 != null && message.hasOwnProperty("sig_verify_cost_secp256k1")) + if (!$util.isInteger(message.sig_verify_cost_secp256k1) && !(message.sig_verify_cost_secp256k1 && $util.isInteger(message.sig_verify_cost_secp256k1.low) && $util.isInteger(message.sig_verify_cost_secp256k1.high))) + return "sig_verify_cost_secp256k1: integer|Long expected"; + return null; + }; + + /** + * Creates a Params message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.auth.v1beta1.Params + * @static + * @param {Object.} object Plain object + * @returns {cosmos.auth.v1beta1.Params} Params + */ + Params.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.auth.v1beta1.Params) + return object; + let message = new $root.cosmos.auth.v1beta1.Params(); + if (object.max_memo_characters != null) + if ($util.Long) + (message.max_memo_characters = $util.Long.fromValue(object.max_memo_characters)).unsigned = true; + else if (typeof object.max_memo_characters === "string") + message.max_memo_characters = parseInt(object.max_memo_characters, 10); + else if (typeof object.max_memo_characters === "number") + message.max_memo_characters = object.max_memo_characters; + else if (typeof object.max_memo_characters === "object") + message.max_memo_characters = new $util.LongBits(object.max_memo_characters.low >>> 0, object.max_memo_characters.high >>> 0).toNumber(true); + if (object.tx_sig_limit != null) + if ($util.Long) + (message.tx_sig_limit = $util.Long.fromValue(object.tx_sig_limit)).unsigned = true; + else if (typeof object.tx_sig_limit === "string") + message.tx_sig_limit = parseInt(object.tx_sig_limit, 10); + else if (typeof object.tx_sig_limit === "number") + message.tx_sig_limit = object.tx_sig_limit; + else if (typeof object.tx_sig_limit === "object") + message.tx_sig_limit = new $util.LongBits(object.tx_sig_limit.low >>> 0, object.tx_sig_limit.high >>> 0).toNumber(true); + if (object.tx_size_cost_per_byte != null) + if ($util.Long) + (message.tx_size_cost_per_byte = $util.Long.fromValue(object.tx_size_cost_per_byte)).unsigned = true; + else if (typeof object.tx_size_cost_per_byte === "string") + message.tx_size_cost_per_byte = parseInt(object.tx_size_cost_per_byte, 10); + else if (typeof object.tx_size_cost_per_byte === "number") + message.tx_size_cost_per_byte = object.tx_size_cost_per_byte; + else if (typeof object.tx_size_cost_per_byte === "object") + message.tx_size_cost_per_byte = new $util.LongBits(object.tx_size_cost_per_byte.low >>> 0, object.tx_size_cost_per_byte.high >>> 0).toNumber(true); + if (object.sig_verify_cost_ed25519 != null) + if ($util.Long) + (message.sig_verify_cost_ed25519 = $util.Long.fromValue(object.sig_verify_cost_ed25519)).unsigned = true; + else if (typeof object.sig_verify_cost_ed25519 === "string") + message.sig_verify_cost_ed25519 = parseInt(object.sig_verify_cost_ed25519, 10); + else if (typeof object.sig_verify_cost_ed25519 === "number") + message.sig_verify_cost_ed25519 = object.sig_verify_cost_ed25519; + else if (typeof object.sig_verify_cost_ed25519 === "object") + message.sig_verify_cost_ed25519 = new $util.LongBits(object.sig_verify_cost_ed25519.low >>> 0, object.sig_verify_cost_ed25519.high >>> 0).toNumber(true); + if (object.sig_verify_cost_secp256k1 != null) + if ($util.Long) + (message.sig_verify_cost_secp256k1 = $util.Long.fromValue(object.sig_verify_cost_secp256k1)).unsigned = true; + else if (typeof object.sig_verify_cost_secp256k1 === "string") + message.sig_verify_cost_secp256k1 = parseInt(object.sig_verify_cost_secp256k1, 10); + else if (typeof object.sig_verify_cost_secp256k1 === "number") + message.sig_verify_cost_secp256k1 = object.sig_verify_cost_secp256k1; + else if (typeof object.sig_verify_cost_secp256k1 === "object") + message.sig_verify_cost_secp256k1 = new $util.LongBits(object.sig_verify_cost_secp256k1.low >>> 0, object.sig_verify_cost_secp256k1.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a Params message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.auth.v1beta1.Params + * @static + * @param {cosmos.auth.v1beta1.Params} message Params + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Params.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.max_memo_characters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.max_memo_characters = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.tx_sig_limit = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.tx_sig_limit = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.tx_size_cost_per_byte = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.tx_size_cost_per_byte = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.sig_verify_cost_ed25519 = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.sig_verify_cost_ed25519 = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.sig_verify_cost_secp256k1 = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.sig_verify_cost_secp256k1 = options.longs === String ? "0" : 0; + } + if (message.max_memo_characters != null && message.hasOwnProperty("max_memo_characters")) + if (typeof message.max_memo_characters === "number") + object.max_memo_characters = options.longs === String ? String(message.max_memo_characters) : message.max_memo_characters; + else + object.max_memo_characters = options.longs === String ? $util.Long.prototype.toString.call(message.max_memo_characters) : options.longs === Number ? new $util.LongBits(message.max_memo_characters.low >>> 0, message.max_memo_characters.high >>> 0).toNumber(true) : message.max_memo_characters; + if (message.tx_sig_limit != null && message.hasOwnProperty("tx_sig_limit")) + if (typeof message.tx_sig_limit === "number") + object.tx_sig_limit = options.longs === String ? String(message.tx_sig_limit) : message.tx_sig_limit; + else + object.tx_sig_limit = options.longs === String ? $util.Long.prototype.toString.call(message.tx_sig_limit) : options.longs === Number ? new $util.LongBits(message.tx_sig_limit.low >>> 0, message.tx_sig_limit.high >>> 0).toNumber(true) : message.tx_sig_limit; + if (message.tx_size_cost_per_byte != null && message.hasOwnProperty("tx_size_cost_per_byte")) + if (typeof message.tx_size_cost_per_byte === "number") + object.tx_size_cost_per_byte = options.longs === String ? String(message.tx_size_cost_per_byte) : message.tx_size_cost_per_byte; + else + object.tx_size_cost_per_byte = options.longs === String ? $util.Long.prototype.toString.call(message.tx_size_cost_per_byte) : options.longs === Number ? new $util.LongBits(message.tx_size_cost_per_byte.low >>> 0, message.tx_size_cost_per_byte.high >>> 0).toNumber(true) : message.tx_size_cost_per_byte; + if (message.sig_verify_cost_ed25519 != null && message.hasOwnProperty("sig_verify_cost_ed25519")) + if (typeof message.sig_verify_cost_ed25519 === "number") + object.sig_verify_cost_ed25519 = options.longs === String ? String(message.sig_verify_cost_ed25519) : message.sig_verify_cost_ed25519; + else + object.sig_verify_cost_ed25519 = options.longs === String ? $util.Long.prototype.toString.call(message.sig_verify_cost_ed25519) : options.longs === Number ? new $util.LongBits(message.sig_verify_cost_ed25519.low >>> 0, message.sig_verify_cost_ed25519.high >>> 0).toNumber(true) : message.sig_verify_cost_ed25519; + if (message.sig_verify_cost_secp256k1 != null && message.hasOwnProperty("sig_verify_cost_secp256k1")) + if (typeof message.sig_verify_cost_secp256k1 === "number") + object.sig_verify_cost_secp256k1 = options.longs === String ? String(message.sig_verify_cost_secp256k1) : message.sig_verify_cost_secp256k1; + else + object.sig_verify_cost_secp256k1 = options.longs === String ? $util.Long.prototype.toString.call(message.sig_verify_cost_secp256k1) : options.longs === Number ? new $util.LongBits(message.sig_verify_cost_secp256k1.low >>> 0, message.sig_verify_cost_secp256k1.high >>> 0).toNumber(true) : message.sig_verify_cost_secp256k1; + return object; + }; + + /** + * Converts this Params to JSON. + * @function toJSON + * @memberof cosmos.auth.v1beta1.Params + * @instance + * @returns {Object.} JSON object + */ + Params.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Params; + })(); + + return v1beta1; + })(); + + return auth; + })(); + + cosmos.bank = (function() { + + /** + * Namespace bank. + * @memberof cosmos + * @namespace + */ + const bank = {}; + + bank.v1beta1 = (function() { + + /** + * Namespace v1beta1. + * @memberof cosmos.bank + * @namespace + */ + const v1beta1 = {}; + + v1beta1.Msg = (function() { + + /** + * Constructs a new Msg service. + * @memberof cosmos.bank.v1beta1 + * @classdesc Represents a Msg + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Msg(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Msg.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Msg; + + /** + * Callback as used by {@link cosmos.bank.v1beta1.Msg#send}. + * @memberof cosmos.bank.v1beta1.Msg + * @typedef SendCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.bank.v1beta1.MsgSendResponse} [response] MsgSendResponse + */ + + /** + * Calls Send. + * @function send + * @memberof cosmos.bank.v1beta1.Msg + * @instance + * @param {cosmos.bank.v1beta1.IMsgSend} request MsgSend message or plain object + * @param {cosmos.bank.v1beta1.Msg.SendCallback} callback Node-style callback called with the error, if any, and MsgSendResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.send = function send(request, callback) { + return this.rpcCall(send, $root.cosmos.bank.v1beta1.MsgSend, $root.cosmos.bank.v1beta1.MsgSendResponse, request, callback); + }, "name", { value: "Send" }); + + /** + * Calls Send. + * @function send + * @memberof cosmos.bank.v1beta1.Msg + * @instance + * @param {cosmos.bank.v1beta1.IMsgSend} request MsgSend message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.bank.v1beta1.Msg#multiSend}. + * @memberof cosmos.bank.v1beta1.Msg + * @typedef MultiSendCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.bank.v1beta1.MsgMultiSendResponse} [response] MsgMultiSendResponse + */ + + /** + * Calls MultiSend. + * @function multiSend + * @memberof cosmos.bank.v1beta1.Msg + * @instance + * @param {cosmos.bank.v1beta1.IMsgMultiSend} request MsgMultiSend message or plain object + * @param {cosmos.bank.v1beta1.Msg.MultiSendCallback} callback Node-style callback called with the error, if any, and MsgMultiSendResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.multiSend = function multiSend(request, callback) { + return this.rpcCall(multiSend, $root.cosmos.bank.v1beta1.MsgMultiSend, $root.cosmos.bank.v1beta1.MsgMultiSendResponse, request, callback); + }, "name", { value: "MultiSend" }); + + /** + * Calls MultiSend. + * @function multiSend + * @memberof cosmos.bank.v1beta1.Msg + * @instance + * @param {cosmos.bank.v1beta1.IMsgMultiSend} request MsgMultiSend message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Msg; + })(); + + v1beta1.MsgSend = (function() { + + /** + * Properties of a MsgSend. + * @memberof cosmos.bank.v1beta1 + * @interface IMsgSend + * @property {string|null} [from_address] MsgSend from_address + * @property {string|null} [to_address] MsgSend to_address + * @property {Array.|null} [amount] MsgSend amount + */ + + /** + * Constructs a new MsgSend. + * @memberof cosmos.bank.v1beta1 + * @classdesc Represents a MsgSend. + * @implements IMsgSend + * @constructor + * @param {cosmos.bank.v1beta1.IMsgSend=} [properties] Properties to set + */ + function MsgSend(properties) { + this.amount = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgSend from_address. + * @member {string} from_address + * @memberof cosmos.bank.v1beta1.MsgSend + * @instance + */ + MsgSend.prototype.from_address = ""; + + /** + * MsgSend to_address. + * @member {string} to_address + * @memberof cosmos.bank.v1beta1.MsgSend + * @instance + */ + MsgSend.prototype.to_address = ""; + + /** + * MsgSend amount. + * @member {Array.} amount + * @memberof cosmos.bank.v1beta1.MsgSend + * @instance + */ + MsgSend.prototype.amount = $util.emptyArray; + + /** + * Encodes the specified MsgSend message. Does not implicitly {@link cosmos.bank.v1beta1.MsgSend.verify|verify} messages. + * @function encode + * @memberof cosmos.bank.v1beta1.MsgSend + * @static + * @param {cosmos.bank.v1beta1.IMsgSend} message MsgSend message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgSend.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.from_address != null && Object.hasOwnProperty.call(message, "from_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.from_address); + if (message.to_address != null && Object.hasOwnProperty.call(message, "to_address")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.to_address); + if (message.amount != null && message.amount.length) + for (let i = 0; i < message.amount.length; ++i) + $root.cosmos.base.v1beta1.Coin.encode(message.amount[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MsgSend message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.MsgSend.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.bank.v1beta1.MsgSend + * @static + * @param {cosmos.bank.v1beta1.IMsgSend} message MsgSend message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgSend.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgSend message from the specified reader or buffer. + * @function decode + * @memberof cosmos.bank.v1beta1.MsgSend + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.bank.v1beta1.MsgSend} MsgSend + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgSend.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.MsgSend(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.from_address = reader.string(); + break; + case 2: + message.to_address = reader.string(); + break; + case 3: + if (!(message.amount && message.amount.length)) + message.amount = []; + message.amount.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgSend message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.bank.v1beta1.MsgSend + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.bank.v1beta1.MsgSend} MsgSend + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgSend.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgSend message. + * @function verify + * @memberof cosmos.bank.v1beta1.MsgSend + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgSend.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.from_address != null && message.hasOwnProperty("from_address")) + if (!$util.isString(message.from_address)) + return "from_address: string expected"; + if (message.to_address != null && message.hasOwnProperty("to_address")) + if (!$util.isString(message.to_address)) + return "to_address: string expected"; + if (message.amount != null && message.hasOwnProperty("amount")) { + if (!Array.isArray(message.amount)) + return "amount: array expected"; + for (let i = 0; i < message.amount.length; ++i) { + let error = $root.cosmos.base.v1beta1.Coin.verify(message.amount[i]); + if (error) + return "amount." + error; + } + } + return null; + }; + + /** + * Creates a MsgSend message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.bank.v1beta1.MsgSend + * @static + * @param {Object.} object Plain object + * @returns {cosmos.bank.v1beta1.MsgSend} MsgSend + */ + MsgSend.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.bank.v1beta1.MsgSend) + return object; + let message = new $root.cosmos.bank.v1beta1.MsgSend(); + if (object.from_address != null) + message.from_address = String(object.from_address); + if (object.to_address != null) + message.to_address = String(object.to_address); + if (object.amount) { + if (!Array.isArray(object.amount)) + throw TypeError(".cosmos.bank.v1beta1.MsgSend.amount: array expected"); + message.amount = []; + for (let i = 0; i < object.amount.length; ++i) { + if (typeof object.amount[i] !== "object") + throw TypeError(".cosmos.bank.v1beta1.MsgSend.amount: object expected"); + message.amount[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.amount[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a MsgSend message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.bank.v1beta1.MsgSend + * @static + * @param {cosmos.bank.v1beta1.MsgSend} message MsgSend + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgSend.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.amount = []; + if (options.defaults) { + object.from_address = ""; + object.to_address = ""; + } + if (message.from_address != null && message.hasOwnProperty("from_address")) + object.from_address = message.from_address; + if (message.to_address != null && message.hasOwnProperty("to_address")) + object.to_address = message.to_address; + if (message.amount && message.amount.length) { + object.amount = []; + for (let j = 0; j < message.amount.length; ++j) + object.amount[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.amount[j], options); + } + return object; + }; + + /** + * Converts this MsgSend to JSON. + * @function toJSON + * @memberof cosmos.bank.v1beta1.MsgSend + * @instance + * @returns {Object.} JSON object + */ + MsgSend.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgSend; + })(); + + v1beta1.MsgSendResponse = (function() { + + /** + * Properties of a MsgSendResponse. + * @memberof cosmos.bank.v1beta1 + * @interface IMsgSendResponse + */ + + /** + * Constructs a new MsgSendResponse. + * @memberof cosmos.bank.v1beta1 + * @classdesc Represents a MsgSendResponse. + * @implements IMsgSendResponse + * @constructor + * @param {cosmos.bank.v1beta1.IMsgSendResponse=} [properties] Properties to set + */ + function MsgSendResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgSendResponse message. Does not implicitly {@link cosmos.bank.v1beta1.MsgSendResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.bank.v1beta1.MsgSendResponse + * @static + * @param {cosmos.bank.v1beta1.IMsgSendResponse} message MsgSendResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgSendResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgSendResponse message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.MsgSendResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.bank.v1beta1.MsgSendResponse + * @static + * @param {cosmos.bank.v1beta1.IMsgSendResponse} message MsgSendResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgSendResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgSendResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.bank.v1beta1.MsgSendResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.bank.v1beta1.MsgSendResponse} MsgSendResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgSendResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.MsgSendResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgSendResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.bank.v1beta1.MsgSendResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.bank.v1beta1.MsgSendResponse} MsgSendResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgSendResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgSendResponse message. + * @function verify + * @memberof cosmos.bank.v1beta1.MsgSendResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgSendResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgSendResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.bank.v1beta1.MsgSendResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.bank.v1beta1.MsgSendResponse} MsgSendResponse + */ + MsgSendResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.bank.v1beta1.MsgSendResponse) + return object; + return new $root.cosmos.bank.v1beta1.MsgSendResponse(); + }; + + /** + * Creates a plain object from a MsgSendResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.bank.v1beta1.MsgSendResponse + * @static + * @param {cosmos.bank.v1beta1.MsgSendResponse} message MsgSendResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgSendResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgSendResponse to JSON. + * @function toJSON + * @memberof cosmos.bank.v1beta1.MsgSendResponse + * @instance + * @returns {Object.} JSON object + */ + MsgSendResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgSendResponse; + })(); + + v1beta1.MsgMultiSend = (function() { + + /** + * Properties of a MsgMultiSend. + * @memberof cosmos.bank.v1beta1 + * @interface IMsgMultiSend + * @property {Array.|null} [inputs] MsgMultiSend inputs + * @property {Array.|null} [outputs] MsgMultiSend outputs + */ + + /** + * Constructs a new MsgMultiSend. + * @memberof cosmos.bank.v1beta1 + * @classdesc Represents a MsgMultiSend. + * @implements IMsgMultiSend + * @constructor + * @param {cosmos.bank.v1beta1.IMsgMultiSend=} [properties] Properties to set + */ + function MsgMultiSend(properties) { + this.inputs = []; + this.outputs = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgMultiSend inputs. + * @member {Array.} inputs + * @memberof cosmos.bank.v1beta1.MsgMultiSend + * @instance + */ + MsgMultiSend.prototype.inputs = $util.emptyArray; + + /** + * MsgMultiSend outputs. + * @member {Array.} outputs + * @memberof cosmos.bank.v1beta1.MsgMultiSend + * @instance + */ + MsgMultiSend.prototype.outputs = $util.emptyArray; + + /** + * Encodes the specified MsgMultiSend message. Does not implicitly {@link cosmos.bank.v1beta1.MsgMultiSend.verify|verify} messages. + * @function encode + * @memberof cosmos.bank.v1beta1.MsgMultiSend + * @static + * @param {cosmos.bank.v1beta1.IMsgMultiSend} message MsgMultiSend message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgMultiSend.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.inputs != null && message.inputs.length) + for (let i = 0; i < message.inputs.length; ++i) + $root.cosmos.bank.v1beta1.Input.encode(message.inputs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.outputs != null && message.outputs.length) + for (let i = 0; i < message.outputs.length; ++i) + $root.cosmos.bank.v1beta1.Output.encode(message.outputs[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MsgMultiSend message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.MsgMultiSend.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.bank.v1beta1.MsgMultiSend + * @static + * @param {cosmos.bank.v1beta1.IMsgMultiSend} message MsgMultiSend message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgMultiSend.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgMultiSend message from the specified reader or buffer. + * @function decode + * @memberof cosmos.bank.v1beta1.MsgMultiSend + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.bank.v1beta1.MsgMultiSend} MsgMultiSend + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgMultiSend.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.MsgMultiSend(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.inputs && message.inputs.length)) + message.inputs = []; + message.inputs.push($root.cosmos.bank.v1beta1.Input.decode(reader, reader.uint32())); + break; + case 2: + if (!(message.outputs && message.outputs.length)) + message.outputs = []; + message.outputs.push($root.cosmos.bank.v1beta1.Output.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgMultiSend message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.bank.v1beta1.MsgMultiSend + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.bank.v1beta1.MsgMultiSend} MsgMultiSend + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgMultiSend.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgMultiSend message. + * @function verify + * @memberof cosmos.bank.v1beta1.MsgMultiSend + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgMultiSend.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.inputs != null && message.hasOwnProperty("inputs")) { + if (!Array.isArray(message.inputs)) + return "inputs: array expected"; + for (let i = 0; i < message.inputs.length; ++i) { + let error = $root.cosmos.bank.v1beta1.Input.verify(message.inputs[i]); + if (error) + return "inputs." + error; + } + } + if (message.outputs != null && message.hasOwnProperty("outputs")) { + if (!Array.isArray(message.outputs)) + return "outputs: array expected"; + for (let i = 0; i < message.outputs.length; ++i) { + let error = $root.cosmos.bank.v1beta1.Output.verify(message.outputs[i]); + if (error) + return "outputs." + error; + } + } + return null; + }; + + /** + * Creates a MsgMultiSend message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.bank.v1beta1.MsgMultiSend + * @static + * @param {Object.} object Plain object + * @returns {cosmos.bank.v1beta1.MsgMultiSend} MsgMultiSend + */ + MsgMultiSend.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.bank.v1beta1.MsgMultiSend) + return object; + let message = new $root.cosmos.bank.v1beta1.MsgMultiSend(); + if (object.inputs) { + if (!Array.isArray(object.inputs)) + throw TypeError(".cosmos.bank.v1beta1.MsgMultiSend.inputs: array expected"); + message.inputs = []; + for (let i = 0; i < object.inputs.length; ++i) { + if (typeof object.inputs[i] !== "object") + throw TypeError(".cosmos.bank.v1beta1.MsgMultiSend.inputs: object expected"); + message.inputs[i] = $root.cosmos.bank.v1beta1.Input.fromObject(object.inputs[i]); + } + } + if (object.outputs) { + if (!Array.isArray(object.outputs)) + throw TypeError(".cosmos.bank.v1beta1.MsgMultiSend.outputs: array expected"); + message.outputs = []; + for (let i = 0; i < object.outputs.length; ++i) { + if (typeof object.outputs[i] !== "object") + throw TypeError(".cosmos.bank.v1beta1.MsgMultiSend.outputs: object expected"); + message.outputs[i] = $root.cosmos.bank.v1beta1.Output.fromObject(object.outputs[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a MsgMultiSend message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.bank.v1beta1.MsgMultiSend + * @static + * @param {cosmos.bank.v1beta1.MsgMultiSend} message MsgMultiSend + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgMultiSend.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) { + object.inputs = []; + object.outputs = []; + } + if (message.inputs && message.inputs.length) { + object.inputs = []; + for (let j = 0; j < message.inputs.length; ++j) + object.inputs[j] = $root.cosmos.bank.v1beta1.Input.toObject(message.inputs[j], options); + } + if (message.outputs && message.outputs.length) { + object.outputs = []; + for (let j = 0; j < message.outputs.length; ++j) + object.outputs[j] = $root.cosmos.bank.v1beta1.Output.toObject(message.outputs[j], options); + } + return object; + }; + + /** + * Converts this MsgMultiSend to JSON. + * @function toJSON + * @memberof cosmos.bank.v1beta1.MsgMultiSend + * @instance + * @returns {Object.} JSON object + */ + MsgMultiSend.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgMultiSend; + })(); + + v1beta1.MsgMultiSendResponse = (function() { + + /** + * Properties of a MsgMultiSendResponse. + * @memberof cosmos.bank.v1beta1 + * @interface IMsgMultiSendResponse + */ + + /** + * Constructs a new MsgMultiSendResponse. + * @memberof cosmos.bank.v1beta1 + * @classdesc Represents a MsgMultiSendResponse. + * @implements IMsgMultiSendResponse + * @constructor + * @param {cosmos.bank.v1beta1.IMsgMultiSendResponse=} [properties] Properties to set + */ + function MsgMultiSendResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgMultiSendResponse message. Does not implicitly {@link cosmos.bank.v1beta1.MsgMultiSendResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.bank.v1beta1.MsgMultiSendResponse + * @static + * @param {cosmos.bank.v1beta1.IMsgMultiSendResponse} message MsgMultiSendResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgMultiSendResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgMultiSendResponse message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.MsgMultiSendResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.bank.v1beta1.MsgMultiSendResponse + * @static + * @param {cosmos.bank.v1beta1.IMsgMultiSendResponse} message MsgMultiSendResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgMultiSendResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgMultiSendResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.bank.v1beta1.MsgMultiSendResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.bank.v1beta1.MsgMultiSendResponse} MsgMultiSendResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgMultiSendResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.MsgMultiSendResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgMultiSendResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.bank.v1beta1.MsgMultiSendResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.bank.v1beta1.MsgMultiSendResponse} MsgMultiSendResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgMultiSendResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgMultiSendResponse message. + * @function verify + * @memberof cosmos.bank.v1beta1.MsgMultiSendResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgMultiSendResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgMultiSendResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.bank.v1beta1.MsgMultiSendResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.bank.v1beta1.MsgMultiSendResponse} MsgMultiSendResponse + */ + MsgMultiSendResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.bank.v1beta1.MsgMultiSendResponse) + return object; + return new $root.cosmos.bank.v1beta1.MsgMultiSendResponse(); + }; + + /** + * Creates a plain object from a MsgMultiSendResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.bank.v1beta1.MsgMultiSendResponse + * @static + * @param {cosmos.bank.v1beta1.MsgMultiSendResponse} message MsgMultiSendResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgMultiSendResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgMultiSendResponse to JSON. + * @function toJSON + * @memberof cosmos.bank.v1beta1.MsgMultiSendResponse + * @instance + * @returns {Object.} JSON object + */ + MsgMultiSendResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgMultiSendResponse; + })(); + + v1beta1.Params = (function() { + + /** + * Properties of a Params. + * @memberof cosmos.bank.v1beta1 + * @interface IParams + * @property {Array.|null} [send_enabled] Params send_enabled + * @property {boolean|null} [default_send_enabled] Params default_send_enabled + */ + + /** + * Constructs a new Params. + * @memberof cosmos.bank.v1beta1 + * @classdesc Represents a Params. + * @implements IParams + * @constructor + * @param {cosmos.bank.v1beta1.IParams=} [properties] Properties to set + */ + function Params(properties) { + this.send_enabled = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Params send_enabled. + * @member {Array.} send_enabled + * @memberof cosmos.bank.v1beta1.Params + * @instance + */ + Params.prototype.send_enabled = $util.emptyArray; + + /** + * Params default_send_enabled. + * @member {boolean} default_send_enabled + * @memberof cosmos.bank.v1beta1.Params + * @instance + */ + Params.prototype.default_send_enabled = false; + + /** + * Encodes the specified Params message. Does not implicitly {@link cosmos.bank.v1beta1.Params.verify|verify} messages. + * @function encode + * @memberof cosmos.bank.v1beta1.Params + * @static + * @param {cosmos.bank.v1beta1.IParams} message Params message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Params.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.send_enabled != null && message.send_enabled.length) + for (let i = 0; i < message.send_enabled.length; ++i) + $root.cosmos.bank.v1beta1.SendEnabled.encode(message.send_enabled[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.default_send_enabled != null && Object.hasOwnProperty.call(message, "default_send_enabled")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.default_send_enabled); + return writer; + }; + + /** + * Encodes the specified Params message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.Params.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.bank.v1beta1.Params + * @static + * @param {cosmos.bank.v1beta1.IParams} message Params message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Params.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Params message from the specified reader or buffer. + * @function decode + * @memberof cosmos.bank.v1beta1.Params + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.bank.v1beta1.Params} Params + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Params.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.Params(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.send_enabled && message.send_enabled.length)) + message.send_enabled = []; + message.send_enabled.push($root.cosmos.bank.v1beta1.SendEnabled.decode(reader, reader.uint32())); + break; + case 2: + message.default_send_enabled = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Params message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.bank.v1beta1.Params + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.bank.v1beta1.Params} Params + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Params.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Params message. + * @function verify + * @memberof cosmos.bank.v1beta1.Params + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Params.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.send_enabled != null && message.hasOwnProperty("send_enabled")) { + if (!Array.isArray(message.send_enabled)) + return "send_enabled: array expected"; + for (let i = 0; i < message.send_enabled.length; ++i) { + let error = $root.cosmos.bank.v1beta1.SendEnabled.verify(message.send_enabled[i]); + if (error) + return "send_enabled." + error; + } + } + if (message.default_send_enabled != null && message.hasOwnProperty("default_send_enabled")) + if (typeof message.default_send_enabled !== "boolean") + return "default_send_enabled: boolean expected"; + return null; + }; + + /** + * Creates a Params message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.bank.v1beta1.Params + * @static + * @param {Object.} object Plain object + * @returns {cosmos.bank.v1beta1.Params} Params + */ + Params.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.bank.v1beta1.Params) + return object; + let message = new $root.cosmos.bank.v1beta1.Params(); + if (object.send_enabled) { + if (!Array.isArray(object.send_enabled)) + throw TypeError(".cosmos.bank.v1beta1.Params.send_enabled: array expected"); + message.send_enabled = []; + for (let i = 0; i < object.send_enabled.length; ++i) { + if (typeof object.send_enabled[i] !== "object") + throw TypeError(".cosmos.bank.v1beta1.Params.send_enabled: object expected"); + message.send_enabled[i] = $root.cosmos.bank.v1beta1.SendEnabled.fromObject(object.send_enabled[i]); + } + } + if (object.default_send_enabled != null) + message.default_send_enabled = Boolean(object.default_send_enabled); + return message; + }; + + /** + * Creates a plain object from a Params message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.bank.v1beta1.Params + * @static + * @param {cosmos.bank.v1beta1.Params} message Params + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Params.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.send_enabled = []; + if (options.defaults) + object.default_send_enabled = false; + if (message.send_enabled && message.send_enabled.length) { + object.send_enabled = []; + for (let j = 0; j < message.send_enabled.length; ++j) + object.send_enabled[j] = $root.cosmos.bank.v1beta1.SendEnabled.toObject(message.send_enabled[j], options); + } + if (message.default_send_enabled != null && message.hasOwnProperty("default_send_enabled")) + object.default_send_enabled = message.default_send_enabled; + return object; + }; + + /** + * Converts this Params to JSON. + * @function toJSON + * @memberof cosmos.bank.v1beta1.Params + * @instance + * @returns {Object.} JSON object + */ + Params.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Params; + })(); + + v1beta1.SendEnabled = (function() { + + /** + * Properties of a SendEnabled. + * @memberof cosmos.bank.v1beta1 + * @interface ISendEnabled + * @property {string|null} [denom] SendEnabled denom + * @property {boolean|null} [enabled] SendEnabled enabled + */ + + /** + * Constructs a new SendEnabled. + * @memberof cosmos.bank.v1beta1 + * @classdesc Represents a SendEnabled. + * @implements ISendEnabled + * @constructor + * @param {cosmos.bank.v1beta1.ISendEnabled=} [properties] Properties to set + */ + function SendEnabled(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SendEnabled denom. + * @member {string} denom + * @memberof cosmos.bank.v1beta1.SendEnabled + * @instance + */ + SendEnabled.prototype.denom = ""; + + /** + * SendEnabled enabled. + * @member {boolean} enabled + * @memberof cosmos.bank.v1beta1.SendEnabled + * @instance + */ + SendEnabled.prototype.enabled = false; + + /** + * Encodes the specified SendEnabled message. Does not implicitly {@link cosmos.bank.v1beta1.SendEnabled.verify|verify} messages. + * @function encode + * @memberof cosmos.bank.v1beta1.SendEnabled + * @static + * @param {cosmos.bank.v1beta1.ISendEnabled} message SendEnabled message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SendEnabled.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.denom != null && Object.hasOwnProperty.call(message, "denom")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.denom); + if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.enabled); + return writer; + }; + + /** + * Encodes the specified SendEnabled message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.SendEnabled.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.bank.v1beta1.SendEnabled + * @static + * @param {cosmos.bank.v1beta1.ISendEnabled} message SendEnabled message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SendEnabled.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SendEnabled message from the specified reader or buffer. + * @function decode + * @memberof cosmos.bank.v1beta1.SendEnabled + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.bank.v1beta1.SendEnabled} SendEnabled + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SendEnabled.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.SendEnabled(); + while (reader.pos < end) { + let 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; + }; + + /** + * Decodes a SendEnabled message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.bank.v1beta1.SendEnabled + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.bank.v1beta1.SendEnabled} SendEnabled + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SendEnabled.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SendEnabled message. + * @function verify + * @memberof cosmos.bank.v1beta1.SendEnabled + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SendEnabled.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.denom != null && message.hasOwnProperty("denom")) + if (!$util.isString(message.denom)) + return "denom: string expected"; + if (message.enabled != null && message.hasOwnProperty("enabled")) + if (typeof message.enabled !== "boolean") + return "enabled: boolean expected"; + return null; + }; + + /** + * Creates a SendEnabled message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.bank.v1beta1.SendEnabled + * @static + * @param {Object.} object Plain object + * @returns {cosmos.bank.v1beta1.SendEnabled} SendEnabled + */ + SendEnabled.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.bank.v1beta1.SendEnabled) + return object; + let message = new $root.cosmos.bank.v1beta1.SendEnabled(); + if (object.denom != null) + message.denom = String(object.denom); + if (object.enabled != null) + message.enabled = Boolean(object.enabled); + return message; + }; + + /** + * Creates a plain object from a SendEnabled message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.bank.v1beta1.SendEnabled + * @static + * @param {cosmos.bank.v1beta1.SendEnabled} message SendEnabled + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SendEnabled.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.denom = ""; + object.enabled = false; + } + if (message.denom != null && message.hasOwnProperty("denom")) + object.denom = message.denom; + if (message.enabled != null && message.hasOwnProperty("enabled")) + object.enabled = message.enabled; + return object; + }; + + /** + * Converts this SendEnabled to JSON. + * @function toJSON + * @memberof cosmos.bank.v1beta1.SendEnabled + * @instance + * @returns {Object.} JSON object + */ + SendEnabled.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SendEnabled; + })(); + + v1beta1.Input = (function() { + + /** + * Properties of an Input. + * @memberof cosmos.bank.v1beta1 + * @interface IInput + * @property {string|null} [address] Input address + * @property {Array.|null} [coins] Input coins + */ + + /** + * Constructs a new Input. + * @memberof cosmos.bank.v1beta1 + * @classdesc Represents an Input. + * @implements IInput + * @constructor + * @param {cosmos.bank.v1beta1.IInput=} [properties] Properties to set + */ + function Input(properties) { + this.coins = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Input address. + * @member {string} address + * @memberof cosmos.bank.v1beta1.Input + * @instance + */ + Input.prototype.address = ""; + + /** + * Input coins. + * @member {Array.} coins + * @memberof cosmos.bank.v1beta1.Input + * @instance + */ + Input.prototype.coins = $util.emptyArray; + + /** + * Encodes the specified Input message. Does not implicitly {@link cosmos.bank.v1beta1.Input.verify|verify} messages. + * @function encode + * @memberof cosmos.bank.v1beta1.Input + * @static + * @param {cosmos.bank.v1beta1.IInput} message Input message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Input.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.address != null && Object.hasOwnProperty.call(message, "address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.address); + if (message.coins != null && message.coins.length) + for (let i = 0; i < message.coins.length; ++i) + $root.cosmos.base.v1beta1.Coin.encode(message.coins[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Input message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.Input.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.bank.v1beta1.Input + * @static + * @param {cosmos.bank.v1beta1.IInput} message Input message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Input.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Input message from the specified reader or buffer. + * @function decode + * @memberof cosmos.bank.v1beta1.Input + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.bank.v1beta1.Input} Input + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Input.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.Input(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + if (!(message.coins && message.coins.length)) + message.coins = []; + message.coins.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Input message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.bank.v1beta1.Input + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.bank.v1beta1.Input} Input + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Input.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Input message. + * @function verify + * @memberof cosmos.bank.v1beta1.Input + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Input.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.address != null && message.hasOwnProperty("address")) + if (!$util.isString(message.address)) + return "address: string expected"; + if (message.coins != null && message.hasOwnProperty("coins")) { + if (!Array.isArray(message.coins)) + return "coins: array expected"; + for (let i = 0; i < message.coins.length; ++i) { + let error = $root.cosmos.base.v1beta1.Coin.verify(message.coins[i]); + if (error) + return "coins." + error; + } + } + return null; + }; + + /** + * Creates an Input message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.bank.v1beta1.Input + * @static + * @param {Object.} object Plain object + * @returns {cosmos.bank.v1beta1.Input} Input + */ + Input.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.bank.v1beta1.Input) + return object; + let message = new $root.cosmos.bank.v1beta1.Input(); + if (object.address != null) + message.address = String(object.address); + if (object.coins) { + if (!Array.isArray(object.coins)) + throw TypeError(".cosmos.bank.v1beta1.Input.coins: array expected"); + message.coins = []; + for (let i = 0; i < object.coins.length; ++i) { + if (typeof object.coins[i] !== "object") + throw TypeError(".cosmos.bank.v1beta1.Input.coins: object expected"); + message.coins[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.coins[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an Input message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.bank.v1beta1.Input + * @static + * @param {cosmos.bank.v1beta1.Input} message Input + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Input.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.coins = []; + if (options.defaults) + object.address = ""; + if (message.address != null && message.hasOwnProperty("address")) + object.address = message.address; + if (message.coins && message.coins.length) { + object.coins = []; + for (let j = 0; j < message.coins.length; ++j) + object.coins[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.coins[j], options); + } + return object; + }; + + /** + * Converts this Input to JSON. + * @function toJSON + * @memberof cosmos.bank.v1beta1.Input + * @instance + * @returns {Object.} JSON object + */ + Input.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Input; + })(); + + v1beta1.Output = (function() { + + /** + * Properties of an Output. + * @memberof cosmos.bank.v1beta1 + * @interface IOutput + * @property {string|null} [address] Output address + * @property {Array.|null} [coins] Output coins + */ + + /** + * Constructs a new Output. + * @memberof cosmos.bank.v1beta1 + * @classdesc Represents an Output. + * @implements IOutput + * @constructor + * @param {cosmos.bank.v1beta1.IOutput=} [properties] Properties to set + */ + function Output(properties) { + this.coins = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Output address. + * @member {string} address + * @memberof cosmos.bank.v1beta1.Output + * @instance + */ + Output.prototype.address = ""; + + /** + * Output coins. + * @member {Array.} coins + * @memberof cosmos.bank.v1beta1.Output + * @instance + */ + Output.prototype.coins = $util.emptyArray; + + /** + * Encodes the specified Output message. Does not implicitly {@link cosmos.bank.v1beta1.Output.verify|verify} messages. + * @function encode + * @memberof cosmos.bank.v1beta1.Output + * @static + * @param {cosmos.bank.v1beta1.IOutput} message Output message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Output.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.address != null && Object.hasOwnProperty.call(message, "address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.address); + if (message.coins != null && message.coins.length) + for (let i = 0; i < message.coins.length; ++i) + $root.cosmos.base.v1beta1.Coin.encode(message.coins[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Output message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.Output.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.bank.v1beta1.Output + * @static + * @param {cosmos.bank.v1beta1.IOutput} message Output message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Output.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Output message from the specified reader or buffer. + * @function decode + * @memberof cosmos.bank.v1beta1.Output + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.bank.v1beta1.Output} Output + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Output.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.Output(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + if (!(message.coins && message.coins.length)) + message.coins = []; + message.coins.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Output message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.bank.v1beta1.Output + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.bank.v1beta1.Output} Output + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Output.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Output message. + * @function verify + * @memberof cosmos.bank.v1beta1.Output + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Output.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.address != null && message.hasOwnProperty("address")) + if (!$util.isString(message.address)) + return "address: string expected"; + if (message.coins != null && message.hasOwnProperty("coins")) { + if (!Array.isArray(message.coins)) + return "coins: array expected"; + for (let i = 0; i < message.coins.length; ++i) { + let error = $root.cosmos.base.v1beta1.Coin.verify(message.coins[i]); + if (error) + return "coins." + error; + } + } + return null; + }; + + /** + * Creates an Output message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.bank.v1beta1.Output + * @static + * @param {Object.} object Plain object + * @returns {cosmos.bank.v1beta1.Output} Output + */ + Output.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.bank.v1beta1.Output) + return object; + let message = new $root.cosmos.bank.v1beta1.Output(); + if (object.address != null) + message.address = String(object.address); + if (object.coins) { + if (!Array.isArray(object.coins)) + throw TypeError(".cosmos.bank.v1beta1.Output.coins: array expected"); + message.coins = []; + for (let i = 0; i < object.coins.length; ++i) { + if (typeof object.coins[i] !== "object") + throw TypeError(".cosmos.bank.v1beta1.Output.coins: object expected"); + message.coins[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.coins[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an Output message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.bank.v1beta1.Output + * @static + * @param {cosmos.bank.v1beta1.Output} message Output + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Output.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.coins = []; + if (options.defaults) + object.address = ""; + if (message.address != null && message.hasOwnProperty("address")) + object.address = message.address; + if (message.coins && message.coins.length) { + object.coins = []; + for (let j = 0; j < message.coins.length; ++j) + object.coins[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.coins[j], options); + } + return object; + }; + + /** + * Converts this Output to JSON. + * @function toJSON + * @memberof cosmos.bank.v1beta1.Output + * @instance + * @returns {Object.} JSON object + */ + Output.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Output; + })(); + + v1beta1.Supply = (function() { + + /** + * Properties of a Supply. + * @memberof cosmos.bank.v1beta1 + * @interface ISupply + * @property {Array.|null} [total] Supply total + */ + + /** + * Constructs a new Supply. + * @memberof cosmos.bank.v1beta1 + * @classdesc Represents a Supply. + * @implements ISupply + * @constructor + * @param {cosmos.bank.v1beta1.ISupply=} [properties] Properties to set + */ + function Supply(properties) { + this.total = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Supply total. + * @member {Array.} total + * @memberof cosmos.bank.v1beta1.Supply + * @instance + */ + Supply.prototype.total = $util.emptyArray; + + /** + * Encodes the specified Supply message. Does not implicitly {@link cosmos.bank.v1beta1.Supply.verify|verify} messages. + * @function encode + * @memberof cosmos.bank.v1beta1.Supply + * @static + * @param {cosmos.bank.v1beta1.ISupply} message Supply message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Supply.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.total != null && message.total.length) + for (let i = 0; i < message.total.length; ++i) + $root.cosmos.base.v1beta1.Coin.encode(message.total[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Supply message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.Supply.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.bank.v1beta1.Supply + * @static + * @param {cosmos.bank.v1beta1.ISupply} message Supply message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Supply.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Supply message from the specified reader or buffer. + * @function decode + * @memberof cosmos.bank.v1beta1.Supply + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.bank.v1beta1.Supply} Supply + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Supply.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.Supply(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.total && message.total.length)) + message.total = []; + message.total.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Supply message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.bank.v1beta1.Supply + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.bank.v1beta1.Supply} Supply + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Supply.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Supply message. + * @function verify + * @memberof cosmos.bank.v1beta1.Supply + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Supply.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.total != null && message.hasOwnProperty("total")) { + if (!Array.isArray(message.total)) + return "total: array expected"; + for (let i = 0; i < message.total.length; ++i) { + let error = $root.cosmos.base.v1beta1.Coin.verify(message.total[i]); + if (error) + return "total." + error; + } + } + return null; + }; + + /** + * Creates a Supply message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.bank.v1beta1.Supply + * @static + * @param {Object.} object Plain object + * @returns {cosmos.bank.v1beta1.Supply} Supply + */ + Supply.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.bank.v1beta1.Supply) + return object; + let message = new $root.cosmos.bank.v1beta1.Supply(); + if (object.total) { + if (!Array.isArray(object.total)) + throw TypeError(".cosmos.bank.v1beta1.Supply.total: array expected"); + message.total = []; + for (let i = 0; i < object.total.length; ++i) { + if (typeof object.total[i] !== "object") + throw TypeError(".cosmos.bank.v1beta1.Supply.total: object expected"); + message.total[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.total[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Supply message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.bank.v1beta1.Supply + * @static + * @param {cosmos.bank.v1beta1.Supply} message Supply + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Supply.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.total = []; + if (message.total && message.total.length) { + object.total = []; + for (let j = 0; j < message.total.length; ++j) + object.total[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.total[j], options); + } + return object; + }; + + /** + * Converts this Supply to JSON. + * @function toJSON + * @memberof cosmos.bank.v1beta1.Supply + * @instance + * @returns {Object.} JSON object + */ + Supply.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Supply; + })(); + + v1beta1.DenomUnit = (function() { + + /** + * Properties of a DenomUnit. + * @memberof cosmos.bank.v1beta1 + * @interface IDenomUnit + * @property {string|null} [denom] DenomUnit denom + * @property {number|null} [exponent] DenomUnit exponent + * @property {Array.|null} [aliases] DenomUnit aliases + */ + + /** + * Constructs a new DenomUnit. + * @memberof cosmos.bank.v1beta1 + * @classdesc Represents a DenomUnit. + * @implements IDenomUnit + * @constructor + * @param {cosmos.bank.v1beta1.IDenomUnit=} [properties] Properties to set + */ + function DenomUnit(properties) { + this.aliases = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DenomUnit denom. + * @member {string} denom + * @memberof cosmos.bank.v1beta1.DenomUnit + * @instance + */ + DenomUnit.prototype.denom = ""; + + /** + * DenomUnit exponent. + * @member {number} exponent + * @memberof cosmos.bank.v1beta1.DenomUnit + * @instance + */ + DenomUnit.prototype.exponent = 0; + + /** + * DenomUnit aliases. + * @member {Array.} aliases + * @memberof cosmos.bank.v1beta1.DenomUnit + * @instance + */ + DenomUnit.prototype.aliases = $util.emptyArray; + + /** + * Encodes the specified DenomUnit message. Does not implicitly {@link cosmos.bank.v1beta1.DenomUnit.verify|verify} messages. + * @function encode + * @memberof cosmos.bank.v1beta1.DenomUnit + * @static + * @param {cosmos.bank.v1beta1.IDenomUnit} message DenomUnit message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DenomUnit.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.denom != null && Object.hasOwnProperty.call(message, "denom")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.denom); + if (message.exponent != null && Object.hasOwnProperty.call(message, "exponent")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.exponent); + if (message.aliases != null && message.aliases.length) + for (let i = 0; i < message.aliases.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.aliases[i]); + return writer; + }; + + /** + * Encodes the specified DenomUnit message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.DenomUnit.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.bank.v1beta1.DenomUnit + * @static + * @param {cosmos.bank.v1beta1.IDenomUnit} message DenomUnit message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DenomUnit.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DenomUnit message from the specified reader or buffer. + * @function decode + * @memberof cosmos.bank.v1beta1.DenomUnit + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.bank.v1beta1.DenomUnit} DenomUnit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DenomUnit.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.DenomUnit(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + case 2: + message.exponent = reader.uint32(); + break; + case 3: + if (!(message.aliases && message.aliases.length)) + message.aliases = []; + message.aliases.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DenomUnit message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.bank.v1beta1.DenomUnit + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.bank.v1beta1.DenomUnit} DenomUnit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DenomUnit.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DenomUnit message. + * @function verify + * @memberof cosmos.bank.v1beta1.DenomUnit + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DenomUnit.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.denom != null && message.hasOwnProperty("denom")) + if (!$util.isString(message.denom)) + return "denom: string expected"; + if (message.exponent != null && message.hasOwnProperty("exponent")) + if (!$util.isInteger(message.exponent)) + return "exponent: integer expected"; + if (message.aliases != null && message.hasOwnProperty("aliases")) { + if (!Array.isArray(message.aliases)) + return "aliases: array expected"; + for (let i = 0; i < message.aliases.length; ++i) + if (!$util.isString(message.aliases[i])) + return "aliases: string[] expected"; + } + return null; + }; + + /** + * Creates a DenomUnit message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.bank.v1beta1.DenomUnit + * @static + * @param {Object.} object Plain object + * @returns {cosmos.bank.v1beta1.DenomUnit} DenomUnit + */ + DenomUnit.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.bank.v1beta1.DenomUnit) + return object; + let message = new $root.cosmos.bank.v1beta1.DenomUnit(); + if (object.denom != null) + message.denom = String(object.denom); + if (object.exponent != null) + message.exponent = object.exponent >>> 0; + if (object.aliases) { + if (!Array.isArray(object.aliases)) + throw TypeError(".cosmos.bank.v1beta1.DenomUnit.aliases: array expected"); + message.aliases = []; + for (let i = 0; i < object.aliases.length; ++i) + message.aliases[i] = String(object.aliases[i]); + } + return message; + }; + + /** + * Creates a plain object from a DenomUnit message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.bank.v1beta1.DenomUnit + * @static + * @param {cosmos.bank.v1beta1.DenomUnit} message DenomUnit + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DenomUnit.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.aliases = []; + if (options.defaults) { + object.denom = ""; + object.exponent = 0; + } + if (message.denom != null && message.hasOwnProperty("denom")) + object.denom = message.denom; + if (message.exponent != null && message.hasOwnProperty("exponent")) + object.exponent = message.exponent; + if (message.aliases && message.aliases.length) { + object.aliases = []; + for (let j = 0; j < message.aliases.length; ++j) + object.aliases[j] = message.aliases[j]; + } + return object; + }; + + /** + * Converts this DenomUnit to JSON. + * @function toJSON + * @memberof cosmos.bank.v1beta1.DenomUnit + * @instance + * @returns {Object.} JSON object + */ + DenomUnit.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DenomUnit; + })(); + + v1beta1.Metadata = (function() { + + /** + * Properties of a Metadata. + * @memberof cosmos.bank.v1beta1 + * @interface IMetadata + * @property {string|null} [description] Metadata description + * @property {Array.|null} [denom_units] Metadata denom_units + * @property {string|null} [base] Metadata base + * @property {string|null} [display] Metadata display + */ + + /** + * Constructs a new Metadata. + * @memberof cosmos.bank.v1beta1 + * @classdesc Represents a Metadata. + * @implements IMetadata + * @constructor + * @param {cosmos.bank.v1beta1.IMetadata=} [properties] Properties to set + */ + function Metadata(properties) { + this.denom_units = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Metadata description. + * @member {string} description + * @memberof cosmos.bank.v1beta1.Metadata + * @instance + */ + Metadata.prototype.description = ""; + + /** + * Metadata denom_units. + * @member {Array.} denom_units + * @memberof cosmos.bank.v1beta1.Metadata + * @instance + */ + Metadata.prototype.denom_units = $util.emptyArray; + + /** + * Metadata base. + * @member {string} base + * @memberof cosmos.bank.v1beta1.Metadata + * @instance + */ + Metadata.prototype.base = ""; + + /** + * Metadata display. + * @member {string} display + * @memberof cosmos.bank.v1beta1.Metadata + * @instance + */ + Metadata.prototype.display = ""; + + /** + * Encodes the specified Metadata message. Does not implicitly {@link cosmos.bank.v1beta1.Metadata.verify|verify} messages. + * @function encode + * @memberof cosmos.bank.v1beta1.Metadata + * @static + * @param {cosmos.bank.v1beta1.IMetadata} message Metadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Metadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.description); + if (message.denom_units != null && message.denom_units.length) + for (let i = 0; i < message.denom_units.length; ++i) + $root.cosmos.bank.v1beta1.DenomUnit.encode(message.denom_units[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.base != null && Object.hasOwnProperty.call(message, "base")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.base); + if (message.display != null && Object.hasOwnProperty.call(message, "display")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.display); + return writer; + }; + + /** + * Encodes the specified Metadata message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.Metadata.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.bank.v1beta1.Metadata + * @static + * @param {cosmos.bank.v1beta1.IMetadata} message Metadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Metadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Metadata message from the specified reader or buffer. + * @function decode + * @memberof cosmos.bank.v1beta1.Metadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.bank.v1beta1.Metadata} Metadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Metadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.Metadata(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.description = reader.string(); + break; + case 2: + if (!(message.denom_units && message.denom_units.length)) + message.denom_units = []; + message.denom_units.push($root.cosmos.bank.v1beta1.DenomUnit.decode(reader, reader.uint32())); + break; + case 3: + message.base = reader.string(); + break; + case 4: + message.display = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Metadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.bank.v1beta1.Metadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.bank.v1beta1.Metadata} Metadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Metadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Metadata message. + * @function verify + * @memberof cosmos.bank.v1beta1.Metadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Metadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.denom_units != null && message.hasOwnProperty("denom_units")) { + if (!Array.isArray(message.denom_units)) + return "denom_units: array expected"; + for (let i = 0; i < message.denom_units.length; ++i) { + let error = $root.cosmos.bank.v1beta1.DenomUnit.verify(message.denom_units[i]); + if (error) + return "denom_units." + error; + } + } + if (message.base != null && message.hasOwnProperty("base")) + if (!$util.isString(message.base)) + return "base: string expected"; + if (message.display != null && message.hasOwnProperty("display")) + if (!$util.isString(message.display)) + return "display: string expected"; + return null; + }; + + /** + * Creates a Metadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.bank.v1beta1.Metadata + * @static + * @param {Object.} object Plain object + * @returns {cosmos.bank.v1beta1.Metadata} Metadata + */ + Metadata.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.bank.v1beta1.Metadata) + return object; + let message = new $root.cosmos.bank.v1beta1.Metadata(); + if (object.description != null) + message.description = String(object.description); + if (object.denom_units) { + if (!Array.isArray(object.denom_units)) + throw TypeError(".cosmos.bank.v1beta1.Metadata.denom_units: array expected"); + message.denom_units = []; + for (let i = 0; i < object.denom_units.length; ++i) { + if (typeof object.denom_units[i] !== "object") + throw TypeError(".cosmos.bank.v1beta1.Metadata.denom_units: object expected"); + message.denom_units[i] = $root.cosmos.bank.v1beta1.DenomUnit.fromObject(object.denom_units[i]); + } + } + if (object.base != null) + message.base = String(object.base); + if (object.display != null) + message.display = String(object.display); + return message; + }; + + /** + * Creates a plain object from a Metadata message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.bank.v1beta1.Metadata + * @static + * @param {cosmos.bank.v1beta1.Metadata} message Metadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Metadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.denom_units = []; + if (options.defaults) { + object.description = ""; + object.base = ""; + object.display = ""; + } + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.denom_units && message.denom_units.length) { + object.denom_units = []; + for (let j = 0; j < message.denom_units.length; ++j) + object.denom_units[j] = $root.cosmos.bank.v1beta1.DenomUnit.toObject(message.denom_units[j], options); + } + if (message.base != null && message.hasOwnProperty("base")) + object.base = message.base; + if (message.display != null && message.hasOwnProperty("display")) + object.display = message.display; + return object; + }; + + /** + * Converts this Metadata to JSON. + * @function toJSON + * @memberof cosmos.bank.v1beta1.Metadata + * @instance + * @returns {Object.} JSON object + */ + Metadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Metadata; + })(); + + v1beta1.Query = (function() { + + /** + * Constructs a new Query service. + * @memberof cosmos.bank.v1beta1 + * @classdesc Represents a Query + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Query(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Query.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Query; + + /** + * Callback as used by {@link cosmos.bank.v1beta1.Query#balance}. + * @memberof cosmos.bank.v1beta1.Query + * @typedef BalanceCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.bank.v1beta1.QueryBalanceResponse} [response] QueryBalanceResponse + */ + + /** + * Calls Balance. + * @function balance + * @memberof cosmos.bank.v1beta1.Query + * @instance + * @param {cosmos.bank.v1beta1.IQueryBalanceRequest} request QueryBalanceRequest message or plain object + * @param {cosmos.bank.v1beta1.Query.BalanceCallback} callback Node-style callback called with the error, if any, and QueryBalanceResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.balance = function balance(request, callback) { + return this.rpcCall(balance, $root.cosmos.bank.v1beta1.QueryBalanceRequest, $root.cosmos.bank.v1beta1.QueryBalanceResponse, request, callback); + }, "name", { value: "Balance" }); + + /** + * Calls Balance. + * @function balance + * @memberof cosmos.bank.v1beta1.Query + * @instance + * @param {cosmos.bank.v1beta1.IQueryBalanceRequest} request QueryBalanceRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.bank.v1beta1.Query#allBalances}. + * @memberof cosmos.bank.v1beta1.Query + * @typedef AllBalancesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.bank.v1beta1.QueryAllBalancesResponse} [response] QueryAllBalancesResponse + */ + + /** + * Calls AllBalances. + * @function allBalances + * @memberof cosmos.bank.v1beta1.Query + * @instance + * @param {cosmos.bank.v1beta1.IQueryAllBalancesRequest} request QueryAllBalancesRequest message or plain object + * @param {cosmos.bank.v1beta1.Query.AllBalancesCallback} callback Node-style callback called with the error, if any, and QueryAllBalancesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.allBalances = function allBalances(request, callback) { + return this.rpcCall(allBalances, $root.cosmos.bank.v1beta1.QueryAllBalancesRequest, $root.cosmos.bank.v1beta1.QueryAllBalancesResponse, request, callback); + }, "name", { value: "AllBalances" }); + + /** + * Calls AllBalances. + * @function allBalances + * @memberof cosmos.bank.v1beta1.Query + * @instance + * @param {cosmos.bank.v1beta1.IQueryAllBalancesRequest} request QueryAllBalancesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.bank.v1beta1.Query#totalSupply}. + * @memberof cosmos.bank.v1beta1.Query + * @typedef TotalSupplyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.bank.v1beta1.QueryTotalSupplyResponse} [response] QueryTotalSupplyResponse + */ + + /** + * Calls TotalSupply. + * @function totalSupply + * @memberof cosmos.bank.v1beta1.Query + * @instance + * @param {cosmos.bank.v1beta1.IQueryTotalSupplyRequest} request QueryTotalSupplyRequest message or plain object + * @param {cosmos.bank.v1beta1.Query.TotalSupplyCallback} callback Node-style callback called with the error, if any, and QueryTotalSupplyResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.totalSupply = function totalSupply(request, callback) { + return this.rpcCall(totalSupply, $root.cosmos.bank.v1beta1.QueryTotalSupplyRequest, $root.cosmos.bank.v1beta1.QueryTotalSupplyResponse, request, callback); + }, "name", { value: "TotalSupply" }); + + /** + * Calls TotalSupply. + * @function totalSupply + * @memberof cosmos.bank.v1beta1.Query + * @instance + * @param {cosmos.bank.v1beta1.IQueryTotalSupplyRequest} request QueryTotalSupplyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.bank.v1beta1.Query#supplyOf}. + * @memberof cosmos.bank.v1beta1.Query + * @typedef SupplyOfCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.bank.v1beta1.QuerySupplyOfResponse} [response] QuerySupplyOfResponse + */ + + /** + * Calls SupplyOf. + * @function supplyOf + * @memberof cosmos.bank.v1beta1.Query + * @instance + * @param {cosmos.bank.v1beta1.IQuerySupplyOfRequest} request QuerySupplyOfRequest message or plain object + * @param {cosmos.bank.v1beta1.Query.SupplyOfCallback} callback Node-style callback called with the error, if any, and QuerySupplyOfResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.supplyOf = function supplyOf(request, callback) { + return this.rpcCall(supplyOf, $root.cosmos.bank.v1beta1.QuerySupplyOfRequest, $root.cosmos.bank.v1beta1.QuerySupplyOfResponse, request, callback); + }, "name", { value: "SupplyOf" }); + + /** + * Calls SupplyOf. + * @function supplyOf + * @memberof cosmos.bank.v1beta1.Query + * @instance + * @param {cosmos.bank.v1beta1.IQuerySupplyOfRequest} request QuerySupplyOfRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.bank.v1beta1.Query#params}. + * @memberof cosmos.bank.v1beta1.Query + * @typedef ParamsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.bank.v1beta1.QueryParamsResponse} [response] QueryParamsResponse + */ + + /** + * Calls Params. + * @function params + * @memberof cosmos.bank.v1beta1.Query + * @instance + * @param {cosmos.bank.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object + * @param {cosmos.bank.v1beta1.Query.ParamsCallback} callback Node-style callback called with the error, if any, and QueryParamsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.params = function params(request, callback) { + return this.rpcCall(params, $root.cosmos.bank.v1beta1.QueryParamsRequest, $root.cosmos.bank.v1beta1.QueryParamsResponse, request, callback); + }, "name", { value: "Params" }); + + /** + * Calls Params. + * @function params + * @memberof cosmos.bank.v1beta1.Query + * @instance + * @param {cosmos.bank.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.bank.v1beta1.Query#denomMetadata}. + * @memberof cosmos.bank.v1beta1.Query + * @typedef DenomMetadataCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.bank.v1beta1.QueryDenomMetadataResponse} [response] QueryDenomMetadataResponse + */ + + /** + * Calls DenomMetadata. + * @function denomMetadata + * @memberof cosmos.bank.v1beta1.Query + * @instance + * @param {cosmos.bank.v1beta1.IQueryDenomMetadataRequest} request QueryDenomMetadataRequest message or plain object + * @param {cosmos.bank.v1beta1.Query.DenomMetadataCallback} callback Node-style callback called with the error, if any, and QueryDenomMetadataResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.denomMetadata = function denomMetadata(request, callback) { + return this.rpcCall(denomMetadata, $root.cosmos.bank.v1beta1.QueryDenomMetadataRequest, $root.cosmos.bank.v1beta1.QueryDenomMetadataResponse, request, callback); + }, "name", { value: "DenomMetadata" }); + + /** + * Calls DenomMetadata. + * @function denomMetadata + * @memberof cosmos.bank.v1beta1.Query + * @instance + * @param {cosmos.bank.v1beta1.IQueryDenomMetadataRequest} request QueryDenomMetadataRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.bank.v1beta1.Query#denomsMetadata}. + * @memberof cosmos.bank.v1beta1.Query + * @typedef DenomsMetadataCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.bank.v1beta1.QueryDenomsMetadataResponse} [response] QueryDenomsMetadataResponse + */ + + /** + * Calls DenomsMetadata. + * @function denomsMetadata + * @memberof cosmos.bank.v1beta1.Query + * @instance + * @param {cosmos.bank.v1beta1.IQueryDenomsMetadataRequest} request QueryDenomsMetadataRequest message or plain object + * @param {cosmos.bank.v1beta1.Query.DenomsMetadataCallback} callback Node-style callback called with the error, if any, and QueryDenomsMetadataResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.denomsMetadata = function denomsMetadata(request, callback) { + return this.rpcCall(denomsMetadata, $root.cosmos.bank.v1beta1.QueryDenomsMetadataRequest, $root.cosmos.bank.v1beta1.QueryDenomsMetadataResponse, request, callback); + }, "name", { value: "DenomsMetadata" }); + + /** + * Calls DenomsMetadata. + * @function denomsMetadata + * @memberof cosmos.bank.v1beta1.Query + * @instance + * @param {cosmos.bank.v1beta1.IQueryDenomsMetadataRequest} request QueryDenomsMetadataRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Query; + })(); + + v1beta1.QueryBalanceRequest = (function() { + + /** + * Properties of a QueryBalanceRequest. + * @memberof cosmos.bank.v1beta1 + * @interface IQueryBalanceRequest + * @property {string|null} [address] QueryBalanceRequest address + * @property {string|null} [denom] QueryBalanceRequest denom + */ + + /** + * Constructs a new QueryBalanceRequest. + * @memberof cosmos.bank.v1beta1 + * @classdesc Represents a QueryBalanceRequest. + * @implements IQueryBalanceRequest + * @constructor + * @param {cosmos.bank.v1beta1.IQueryBalanceRequest=} [properties] Properties to set + */ + function QueryBalanceRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryBalanceRequest address. + * @member {string} address + * @memberof cosmos.bank.v1beta1.QueryBalanceRequest + * @instance + */ + QueryBalanceRequest.prototype.address = ""; + + /** + * QueryBalanceRequest denom. + * @member {string} denom + * @memberof cosmos.bank.v1beta1.QueryBalanceRequest + * @instance + */ + QueryBalanceRequest.prototype.denom = ""; + + /** + * Encodes the specified QueryBalanceRequest message. Does not implicitly {@link cosmos.bank.v1beta1.QueryBalanceRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.bank.v1beta1.QueryBalanceRequest + * @static + * @param {cosmos.bank.v1beta1.IQueryBalanceRequest} message QueryBalanceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryBalanceRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.address != null && Object.hasOwnProperty.call(message, "address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.address); + if (message.denom != null && Object.hasOwnProperty.call(message, "denom")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.denom); + return writer; + }; + + /** + * Encodes the specified QueryBalanceRequest message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.QueryBalanceRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.bank.v1beta1.QueryBalanceRequest + * @static + * @param {cosmos.bank.v1beta1.IQueryBalanceRequest} message QueryBalanceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryBalanceRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryBalanceRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.bank.v1beta1.QueryBalanceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.bank.v1beta1.QueryBalanceRequest} QueryBalanceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryBalanceRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.QueryBalanceRequest(); + while (reader.pos < end) { + let 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; + }; + + /** + * Decodes a QueryBalanceRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.bank.v1beta1.QueryBalanceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.bank.v1beta1.QueryBalanceRequest} QueryBalanceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryBalanceRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryBalanceRequest message. + * @function verify + * @memberof cosmos.bank.v1beta1.QueryBalanceRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryBalanceRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.address != null && message.hasOwnProperty("address")) + if (!$util.isString(message.address)) + return "address: string expected"; + if (message.denom != null && message.hasOwnProperty("denom")) + if (!$util.isString(message.denom)) + return "denom: string expected"; + return null; + }; + + /** + * Creates a QueryBalanceRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.bank.v1beta1.QueryBalanceRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.bank.v1beta1.QueryBalanceRequest} QueryBalanceRequest + */ + QueryBalanceRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.bank.v1beta1.QueryBalanceRequest) + return object; + let message = new $root.cosmos.bank.v1beta1.QueryBalanceRequest(); + if (object.address != null) + message.address = String(object.address); + if (object.denom != null) + message.denom = String(object.denom); + return message; + }; + + /** + * Creates a plain object from a QueryBalanceRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.bank.v1beta1.QueryBalanceRequest + * @static + * @param {cosmos.bank.v1beta1.QueryBalanceRequest} message QueryBalanceRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryBalanceRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.address = ""; + object.denom = ""; + } + if (message.address != null && message.hasOwnProperty("address")) + object.address = message.address; + if (message.denom != null && message.hasOwnProperty("denom")) + object.denom = message.denom; + return object; + }; + + /** + * Converts this QueryBalanceRequest to JSON. + * @function toJSON + * @memberof cosmos.bank.v1beta1.QueryBalanceRequest + * @instance + * @returns {Object.} JSON object + */ + QueryBalanceRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryBalanceRequest; + })(); + + v1beta1.QueryBalanceResponse = (function() { + + /** + * Properties of a QueryBalanceResponse. + * @memberof cosmos.bank.v1beta1 + * @interface IQueryBalanceResponse + * @property {cosmos.base.v1beta1.ICoin|null} [balance] QueryBalanceResponse balance + */ + + /** + * Constructs a new QueryBalanceResponse. + * @memberof cosmos.bank.v1beta1 + * @classdesc Represents a QueryBalanceResponse. + * @implements IQueryBalanceResponse + * @constructor + * @param {cosmos.bank.v1beta1.IQueryBalanceResponse=} [properties] Properties to set + */ + function QueryBalanceResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryBalanceResponse balance. + * @member {cosmos.base.v1beta1.ICoin|null|undefined} balance + * @memberof cosmos.bank.v1beta1.QueryBalanceResponse + * @instance + */ + QueryBalanceResponse.prototype.balance = null; + + /** + * Encodes the specified QueryBalanceResponse message. Does not implicitly {@link cosmos.bank.v1beta1.QueryBalanceResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.bank.v1beta1.QueryBalanceResponse + * @static + * @param {cosmos.bank.v1beta1.IQueryBalanceResponse} message QueryBalanceResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryBalanceResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.balance != null && Object.hasOwnProperty.call(message, "balance")) + $root.cosmos.base.v1beta1.Coin.encode(message.balance, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryBalanceResponse message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.QueryBalanceResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.bank.v1beta1.QueryBalanceResponse + * @static + * @param {cosmos.bank.v1beta1.IQueryBalanceResponse} message QueryBalanceResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryBalanceResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryBalanceResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.bank.v1beta1.QueryBalanceResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.bank.v1beta1.QueryBalanceResponse} QueryBalanceResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryBalanceResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.QueryBalanceResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.balance = $root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryBalanceResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.bank.v1beta1.QueryBalanceResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.bank.v1beta1.QueryBalanceResponse} QueryBalanceResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryBalanceResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryBalanceResponse message. + * @function verify + * @memberof cosmos.bank.v1beta1.QueryBalanceResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryBalanceResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.balance != null && message.hasOwnProperty("balance")) { + let error = $root.cosmos.base.v1beta1.Coin.verify(message.balance); + if (error) + return "balance." + error; + } + return null; + }; + + /** + * Creates a QueryBalanceResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.bank.v1beta1.QueryBalanceResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.bank.v1beta1.QueryBalanceResponse} QueryBalanceResponse + */ + QueryBalanceResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.bank.v1beta1.QueryBalanceResponse) + return object; + let message = new $root.cosmos.bank.v1beta1.QueryBalanceResponse(); + if (object.balance != null) { + if (typeof object.balance !== "object") + throw TypeError(".cosmos.bank.v1beta1.QueryBalanceResponse.balance: object expected"); + message.balance = $root.cosmos.base.v1beta1.Coin.fromObject(object.balance); + } + return message; + }; + + /** + * Creates a plain object from a QueryBalanceResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.bank.v1beta1.QueryBalanceResponse + * @static + * @param {cosmos.bank.v1beta1.QueryBalanceResponse} message QueryBalanceResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryBalanceResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.balance = null; + if (message.balance != null && message.hasOwnProperty("balance")) + object.balance = $root.cosmos.base.v1beta1.Coin.toObject(message.balance, options); + return object; + }; + + /** + * Converts this QueryBalanceResponse to JSON. + * @function toJSON + * @memberof cosmos.bank.v1beta1.QueryBalanceResponse + * @instance + * @returns {Object.} JSON object + */ + QueryBalanceResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryBalanceResponse; + })(); + + v1beta1.QueryAllBalancesRequest = (function() { + + /** + * Properties of a QueryAllBalancesRequest. + * @memberof cosmos.bank.v1beta1 + * @interface IQueryAllBalancesRequest + * @property {string|null} [address] QueryAllBalancesRequest address + * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryAllBalancesRequest pagination + */ + + /** + * Constructs a new QueryAllBalancesRequest. + * @memberof cosmos.bank.v1beta1 + * @classdesc Represents a QueryAllBalancesRequest. + * @implements IQueryAllBalancesRequest + * @constructor + * @param {cosmos.bank.v1beta1.IQueryAllBalancesRequest=} [properties] Properties to set + */ + function QueryAllBalancesRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryAllBalancesRequest address. + * @member {string} address + * @memberof cosmos.bank.v1beta1.QueryAllBalancesRequest + * @instance + */ + QueryAllBalancesRequest.prototype.address = ""; + + /** + * QueryAllBalancesRequest pagination. + * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination + * @memberof cosmos.bank.v1beta1.QueryAllBalancesRequest + * @instance + */ + QueryAllBalancesRequest.prototype.pagination = null; + + /** + * Encodes the specified QueryAllBalancesRequest message. Does not implicitly {@link cosmos.bank.v1beta1.QueryAllBalancesRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.bank.v1beta1.QueryAllBalancesRequest + * @static + * @param {cosmos.bank.v1beta1.IQueryAllBalancesRequest} message QueryAllBalancesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryAllBalancesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.address != null && Object.hasOwnProperty.call(message, "address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.address); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryAllBalancesRequest message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.QueryAllBalancesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.bank.v1beta1.QueryAllBalancesRequest + * @static + * @param {cosmos.bank.v1beta1.IQueryAllBalancesRequest} message QueryAllBalancesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryAllBalancesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryAllBalancesRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.bank.v1beta1.QueryAllBalancesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.bank.v1beta1.QueryAllBalancesRequest} QueryAllBalancesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryAllBalancesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.QueryAllBalancesRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryAllBalancesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.bank.v1beta1.QueryAllBalancesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.bank.v1beta1.QueryAllBalancesRequest} QueryAllBalancesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryAllBalancesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryAllBalancesRequest message. + * @function verify + * @memberof cosmos.bank.v1beta1.QueryAllBalancesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryAllBalancesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.address != null && message.hasOwnProperty("address")) + if (!$util.isString(message.address)) + return "address: string expected"; + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryAllBalancesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.bank.v1beta1.QueryAllBalancesRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.bank.v1beta1.QueryAllBalancesRequest} QueryAllBalancesRequest + */ + QueryAllBalancesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.bank.v1beta1.QueryAllBalancesRequest) + return object; + let message = new $root.cosmos.bank.v1beta1.QueryAllBalancesRequest(); + if (object.address != null) + message.address = String(object.address); + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.bank.v1beta1.QueryAllBalancesRequest.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryAllBalancesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.bank.v1beta1.QueryAllBalancesRequest + * @static + * @param {cosmos.bank.v1beta1.QueryAllBalancesRequest} message QueryAllBalancesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryAllBalancesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.address = ""; + object.pagination = null; + } + if (message.address != null && message.hasOwnProperty("address")) + object.address = message.address; + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryAllBalancesRequest to JSON. + * @function toJSON + * @memberof cosmos.bank.v1beta1.QueryAllBalancesRequest + * @instance + * @returns {Object.} JSON object + */ + QueryAllBalancesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryAllBalancesRequest; + })(); + + v1beta1.QueryAllBalancesResponse = (function() { + + /** + * Properties of a QueryAllBalancesResponse. + * @memberof cosmos.bank.v1beta1 + * @interface IQueryAllBalancesResponse + * @property {Array.|null} [balances] QueryAllBalancesResponse balances + * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryAllBalancesResponse pagination + */ + + /** + * Constructs a new QueryAllBalancesResponse. + * @memberof cosmos.bank.v1beta1 + * @classdesc Represents a QueryAllBalancesResponse. + * @implements IQueryAllBalancesResponse + * @constructor + * @param {cosmos.bank.v1beta1.IQueryAllBalancesResponse=} [properties] Properties to set + */ + function QueryAllBalancesResponse(properties) { + this.balances = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryAllBalancesResponse balances. + * @member {Array.} balances + * @memberof cosmos.bank.v1beta1.QueryAllBalancesResponse + * @instance + */ + QueryAllBalancesResponse.prototype.balances = $util.emptyArray; + + /** + * QueryAllBalancesResponse pagination. + * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination + * @memberof cosmos.bank.v1beta1.QueryAllBalancesResponse + * @instance + */ + QueryAllBalancesResponse.prototype.pagination = null; + + /** + * Encodes the specified QueryAllBalancesResponse message. Does not implicitly {@link cosmos.bank.v1beta1.QueryAllBalancesResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.bank.v1beta1.QueryAllBalancesResponse + * @static + * @param {cosmos.bank.v1beta1.IQueryAllBalancesResponse} message QueryAllBalancesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryAllBalancesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.balances != null && message.balances.length) + for (let i = 0; i < message.balances.length; ++i) + $root.cosmos.base.v1beta1.Coin.encode(message.balances[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryAllBalancesResponse message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.QueryAllBalancesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.bank.v1beta1.QueryAllBalancesResponse + * @static + * @param {cosmos.bank.v1beta1.IQueryAllBalancesResponse} message QueryAllBalancesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryAllBalancesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryAllBalancesResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.bank.v1beta1.QueryAllBalancesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.bank.v1beta1.QueryAllBalancesResponse} QueryAllBalancesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryAllBalancesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.QueryAllBalancesResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.balances && message.balances.length)) + message.balances = []; + message.balances.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryAllBalancesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.bank.v1beta1.QueryAllBalancesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.bank.v1beta1.QueryAllBalancesResponse} QueryAllBalancesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryAllBalancesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryAllBalancesResponse message. + * @function verify + * @memberof cosmos.bank.v1beta1.QueryAllBalancesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryAllBalancesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.balances != null && message.hasOwnProperty("balances")) { + if (!Array.isArray(message.balances)) + return "balances: array expected"; + for (let i = 0; i < message.balances.length; ++i) { + let error = $root.cosmos.base.v1beta1.Coin.verify(message.balances[i]); + if (error) + return "balances." + error; + } + } + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryAllBalancesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.bank.v1beta1.QueryAllBalancesResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.bank.v1beta1.QueryAllBalancesResponse} QueryAllBalancesResponse + */ + QueryAllBalancesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.bank.v1beta1.QueryAllBalancesResponse) + return object; + let message = new $root.cosmos.bank.v1beta1.QueryAllBalancesResponse(); + if (object.balances) { + if (!Array.isArray(object.balances)) + throw TypeError(".cosmos.bank.v1beta1.QueryAllBalancesResponse.balances: array expected"); + message.balances = []; + for (let i = 0; i < object.balances.length; ++i) { + if (typeof object.balances[i] !== "object") + throw TypeError(".cosmos.bank.v1beta1.QueryAllBalancesResponse.balances: object expected"); + message.balances[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.balances[i]); + } + } + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.bank.v1beta1.QueryAllBalancesResponse.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryAllBalancesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.bank.v1beta1.QueryAllBalancesResponse + * @static + * @param {cosmos.bank.v1beta1.QueryAllBalancesResponse} message QueryAllBalancesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryAllBalancesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.balances = []; + if (options.defaults) + object.pagination = null; + if (message.balances && message.balances.length) { + object.balances = []; + for (let j = 0; j < message.balances.length; ++j) + object.balances[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.balances[j], options); + } + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryAllBalancesResponse to JSON. + * @function toJSON + * @memberof cosmos.bank.v1beta1.QueryAllBalancesResponse + * @instance + * @returns {Object.} JSON object + */ + QueryAllBalancesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryAllBalancesResponse; + })(); + + v1beta1.QueryTotalSupplyRequest = (function() { + + /** + * Properties of a QueryTotalSupplyRequest. + * @memberof cosmos.bank.v1beta1 + * @interface IQueryTotalSupplyRequest + */ + + /** + * Constructs a new QueryTotalSupplyRequest. + * @memberof cosmos.bank.v1beta1 + * @classdesc Represents a QueryTotalSupplyRequest. + * @implements IQueryTotalSupplyRequest + * @constructor + * @param {cosmos.bank.v1beta1.IQueryTotalSupplyRequest=} [properties] Properties to set + */ + function QueryTotalSupplyRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified QueryTotalSupplyRequest message. Does not implicitly {@link cosmos.bank.v1beta1.QueryTotalSupplyRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.bank.v1beta1.QueryTotalSupplyRequest + * @static + * @param {cosmos.bank.v1beta1.IQueryTotalSupplyRequest} message QueryTotalSupplyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryTotalSupplyRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified QueryTotalSupplyRequest message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.QueryTotalSupplyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.bank.v1beta1.QueryTotalSupplyRequest + * @static + * @param {cosmos.bank.v1beta1.IQueryTotalSupplyRequest} message QueryTotalSupplyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryTotalSupplyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryTotalSupplyRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.bank.v1beta1.QueryTotalSupplyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.bank.v1beta1.QueryTotalSupplyRequest} QueryTotalSupplyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryTotalSupplyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.QueryTotalSupplyRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryTotalSupplyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.bank.v1beta1.QueryTotalSupplyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.bank.v1beta1.QueryTotalSupplyRequest} QueryTotalSupplyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryTotalSupplyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryTotalSupplyRequest message. + * @function verify + * @memberof cosmos.bank.v1beta1.QueryTotalSupplyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryTotalSupplyRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a QueryTotalSupplyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.bank.v1beta1.QueryTotalSupplyRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.bank.v1beta1.QueryTotalSupplyRequest} QueryTotalSupplyRequest + */ + QueryTotalSupplyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.bank.v1beta1.QueryTotalSupplyRequest) + return object; + return new $root.cosmos.bank.v1beta1.QueryTotalSupplyRequest(); + }; + + /** + * Creates a plain object from a QueryTotalSupplyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.bank.v1beta1.QueryTotalSupplyRequest + * @static + * @param {cosmos.bank.v1beta1.QueryTotalSupplyRequest} message QueryTotalSupplyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryTotalSupplyRequest.toObject = function toObject() { + return {}; + }; + + /** + * Converts this QueryTotalSupplyRequest to JSON. + * @function toJSON + * @memberof cosmos.bank.v1beta1.QueryTotalSupplyRequest + * @instance + * @returns {Object.} JSON object + */ + QueryTotalSupplyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryTotalSupplyRequest; + })(); + + v1beta1.QueryTotalSupplyResponse = (function() { + + /** + * Properties of a QueryTotalSupplyResponse. + * @memberof cosmos.bank.v1beta1 + * @interface IQueryTotalSupplyResponse + * @property {Array.|null} [supply] QueryTotalSupplyResponse supply + */ + + /** + * Constructs a new QueryTotalSupplyResponse. + * @memberof cosmos.bank.v1beta1 + * @classdesc Represents a QueryTotalSupplyResponse. + * @implements IQueryTotalSupplyResponse + * @constructor + * @param {cosmos.bank.v1beta1.IQueryTotalSupplyResponse=} [properties] Properties to set + */ + function QueryTotalSupplyResponse(properties) { + this.supply = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryTotalSupplyResponse supply. + * @member {Array.} supply + * @memberof cosmos.bank.v1beta1.QueryTotalSupplyResponse + * @instance + */ + QueryTotalSupplyResponse.prototype.supply = $util.emptyArray; + + /** + * Encodes the specified QueryTotalSupplyResponse message. Does not implicitly {@link cosmos.bank.v1beta1.QueryTotalSupplyResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.bank.v1beta1.QueryTotalSupplyResponse + * @static + * @param {cosmos.bank.v1beta1.IQueryTotalSupplyResponse} message QueryTotalSupplyResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryTotalSupplyResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.supply != null && message.supply.length) + for (let i = 0; i < message.supply.length; ++i) + $root.cosmos.base.v1beta1.Coin.encode(message.supply[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryTotalSupplyResponse message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.QueryTotalSupplyResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.bank.v1beta1.QueryTotalSupplyResponse + * @static + * @param {cosmos.bank.v1beta1.IQueryTotalSupplyResponse} message QueryTotalSupplyResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryTotalSupplyResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryTotalSupplyResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.bank.v1beta1.QueryTotalSupplyResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.bank.v1beta1.QueryTotalSupplyResponse} QueryTotalSupplyResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryTotalSupplyResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.QueryTotalSupplyResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.supply && message.supply.length)) + message.supply = []; + message.supply.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryTotalSupplyResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.bank.v1beta1.QueryTotalSupplyResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.bank.v1beta1.QueryTotalSupplyResponse} QueryTotalSupplyResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryTotalSupplyResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryTotalSupplyResponse message. + * @function verify + * @memberof cosmos.bank.v1beta1.QueryTotalSupplyResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryTotalSupplyResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.supply != null && message.hasOwnProperty("supply")) { + if (!Array.isArray(message.supply)) + return "supply: array expected"; + for (let i = 0; i < message.supply.length; ++i) { + let error = $root.cosmos.base.v1beta1.Coin.verify(message.supply[i]); + if (error) + return "supply." + error; + } + } + return null; + }; + + /** + * Creates a QueryTotalSupplyResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.bank.v1beta1.QueryTotalSupplyResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.bank.v1beta1.QueryTotalSupplyResponse} QueryTotalSupplyResponse + */ + QueryTotalSupplyResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.bank.v1beta1.QueryTotalSupplyResponse) + return object; + let message = new $root.cosmos.bank.v1beta1.QueryTotalSupplyResponse(); + if (object.supply) { + if (!Array.isArray(object.supply)) + throw TypeError(".cosmos.bank.v1beta1.QueryTotalSupplyResponse.supply: array expected"); + message.supply = []; + for (let i = 0; i < object.supply.length; ++i) { + if (typeof object.supply[i] !== "object") + throw TypeError(".cosmos.bank.v1beta1.QueryTotalSupplyResponse.supply: object expected"); + message.supply[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.supply[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a QueryTotalSupplyResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.bank.v1beta1.QueryTotalSupplyResponse + * @static + * @param {cosmos.bank.v1beta1.QueryTotalSupplyResponse} message QueryTotalSupplyResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryTotalSupplyResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.supply = []; + if (message.supply && message.supply.length) { + object.supply = []; + for (let j = 0; j < message.supply.length; ++j) + object.supply[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.supply[j], options); + } + return object; + }; + + /** + * Converts this QueryTotalSupplyResponse to JSON. + * @function toJSON + * @memberof cosmos.bank.v1beta1.QueryTotalSupplyResponse + * @instance + * @returns {Object.} JSON object + */ + QueryTotalSupplyResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryTotalSupplyResponse; + })(); + + v1beta1.QuerySupplyOfRequest = (function() { + + /** + * Properties of a QuerySupplyOfRequest. + * @memberof cosmos.bank.v1beta1 + * @interface IQuerySupplyOfRequest + * @property {string|null} [denom] QuerySupplyOfRequest denom + */ + + /** + * Constructs a new QuerySupplyOfRequest. + * @memberof cosmos.bank.v1beta1 + * @classdesc Represents a QuerySupplyOfRequest. + * @implements IQuerySupplyOfRequest + * @constructor + * @param {cosmos.bank.v1beta1.IQuerySupplyOfRequest=} [properties] Properties to set + */ + function QuerySupplyOfRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QuerySupplyOfRequest denom. + * @member {string} denom + * @memberof cosmos.bank.v1beta1.QuerySupplyOfRequest + * @instance + */ + QuerySupplyOfRequest.prototype.denom = ""; + + /** + * Encodes the specified QuerySupplyOfRequest message. Does not implicitly {@link cosmos.bank.v1beta1.QuerySupplyOfRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.bank.v1beta1.QuerySupplyOfRequest + * @static + * @param {cosmos.bank.v1beta1.IQuerySupplyOfRequest} message QuerySupplyOfRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuerySupplyOfRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.denom != null && Object.hasOwnProperty.call(message, "denom")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.denom); + return writer; + }; + + /** + * Encodes the specified QuerySupplyOfRequest message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.QuerySupplyOfRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.bank.v1beta1.QuerySupplyOfRequest + * @static + * @param {cosmos.bank.v1beta1.IQuerySupplyOfRequest} message QuerySupplyOfRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuerySupplyOfRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QuerySupplyOfRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.bank.v1beta1.QuerySupplyOfRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.bank.v1beta1.QuerySupplyOfRequest} QuerySupplyOfRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuerySupplyOfRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.QuerySupplyOfRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QuerySupplyOfRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.bank.v1beta1.QuerySupplyOfRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.bank.v1beta1.QuerySupplyOfRequest} QuerySupplyOfRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuerySupplyOfRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QuerySupplyOfRequest message. + * @function verify + * @memberof cosmos.bank.v1beta1.QuerySupplyOfRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QuerySupplyOfRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.denom != null && message.hasOwnProperty("denom")) + if (!$util.isString(message.denom)) + return "denom: string expected"; + return null; + }; + + /** + * Creates a QuerySupplyOfRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.bank.v1beta1.QuerySupplyOfRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.bank.v1beta1.QuerySupplyOfRequest} QuerySupplyOfRequest + */ + QuerySupplyOfRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.bank.v1beta1.QuerySupplyOfRequest) + return object; + let message = new $root.cosmos.bank.v1beta1.QuerySupplyOfRequest(); + if (object.denom != null) + message.denom = String(object.denom); + return message; + }; + + /** + * Creates a plain object from a QuerySupplyOfRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.bank.v1beta1.QuerySupplyOfRequest + * @static + * @param {cosmos.bank.v1beta1.QuerySupplyOfRequest} message QuerySupplyOfRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QuerySupplyOfRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.denom = ""; + if (message.denom != null && message.hasOwnProperty("denom")) + object.denom = message.denom; + return object; + }; + + /** + * Converts this QuerySupplyOfRequest to JSON. + * @function toJSON + * @memberof cosmos.bank.v1beta1.QuerySupplyOfRequest + * @instance + * @returns {Object.} JSON object + */ + QuerySupplyOfRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QuerySupplyOfRequest; + })(); + + v1beta1.QuerySupplyOfResponse = (function() { + + /** + * Properties of a QuerySupplyOfResponse. + * @memberof cosmos.bank.v1beta1 + * @interface IQuerySupplyOfResponse + * @property {cosmos.base.v1beta1.ICoin|null} [amount] QuerySupplyOfResponse amount + */ + + /** + * Constructs a new QuerySupplyOfResponse. + * @memberof cosmos.bank.v1beta1 + * @classdesc Represents a QuerySupplyOfResponse. + * @implements IQuerySupplyOfResponse + * @constructor + * @param {cosmos.bank.v1beta1.IQuerySupplyOfResponse=} [properties] Properties to set + */ + function QuerySupplyOfResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QuerySupplyOfResponse amount. + * @member {cosmos.base.v1beta1.ICoin|null|undefined} amount + * @memberof cosmos.bank.v1beta1.QuerySupplyOfResponse + * @instance + */ + QuerySupplyOfResponse.prototype.amount = null; + + /** + * Encodes the specified QuerySupplyOfResponse message. Does not implicitly {@link cosmos.bank.v1beta1.QuerySupplyOfResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.bank.v1beta1.QuerySupplyOfResponse + * @static + * @param {cosmos.bank.v1beta1.IQuerySupplyOfResponse} message QuerySupplyOfResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuerySupplyOfResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.amount != null && Object.hasOwnProperty.call(message, "amount")) + $root.cosmos.base.v1beta1.Coin.encode(message.amount, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QuerySupplyOfResponse message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.QuerySupplyOfResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.bank.v1beta1.QuerySupplyOfResponse + * @static + * @param {cosmos.bank.v1beta1.IQuerySupplyOfResponse} message QuerySupplyOfResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuerySupplyOfResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QuerySupplyOfResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.bank.v1beta1.QuerySupplyOfResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.bank.v1beta1.QuerySupplyOfResponse} QuerySupplyOfResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuerySupplyOfResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.QuerySupplyOfResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.amount = $root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QuerySupplyOfResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.bank.v1beta1.QuerySupplyOfResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.bank.v1beta1.QuerySupplyOfResponse} QuerySupplyOfResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuerySupplyOfResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QuerySupplyOfResponse message. + * @function verify + * @memberof cosmos.bank.v1beta1.QuerySupplyOfResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QuerySupplyOfResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.amount != null && message.hasOwnProperty("amount")) { + let error = $root.cosmos.base.v1beta1.Coin.verify(message.amount); + if (error) + return "amount." + error; + } + return null; + }; + + /** + * Creates a QuerySupplyOfResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.bank.v1beta1.QuerySupplyOfResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.bank.v1beta1.QuerySupplyOfResponse} QuerySupplyOfResponse + */ + QuerySupplyOfResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.bank.v1beta1.QuerySupplyOfResponse) + return object; + let message = new $root.cosmos.bank.v1beta1.QuerySupplyOfResponse(); + if (object.amount != null) { + if (typeof object.amount !== "object") + throw TypeError(".cosmos.bank.v1beta1.QuerySupplyOfResponse.amount: object expected"); + message.amount = $root.cosmos.base.v1beta1.Coin.fromObject(object.amount); + } + return message; + }; + + /** + * Creates a plain object from a QuerySupplyOfResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.bank.v1beta1.QuerySupplyOfResponse + * @static + * @param {cosmos.bank.v1beta1.QuerySupplyOfResponse} message QuerySupplyOfResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QuerySupplyOfResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.amount = null; + if (message.amount != null && message.hasOwnProperty("amount")) + object.amount = $root.cosmos.base.v1beta1.Coin.toObject(message.amount, options); + return object; + }; + + /** + * Converts this QuerySupplyOfResponse to JSON. + * @function toJSON + * @memberof cosmos.bank.v1beta1.QuerySupplyOfResponse + * @instance + * @returns {Object.} JSON object + */ + QuerySupplyOfResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QuerySupplyOfResponse; + })(); + + v1beta1.QueryParamsRequest = (function() { + + /** + * Properties of a QueryParamsRequest. + * @memberof cosmos.bank.v1beta1 + * @interface IQueryParamsRequest + */ + + /** + * Constructs a new QueryParamsRequest. + * @memberof cosmos.bank.v1beta1 + * @classdesc Represents a QueryParamsRequest. + * @implements IQueryParamsRequest + * @constructor + * @param {cosmos.bank.v1beta1.IQueryParamsRequest=} [properties] Properties to set + */ + function QueryParamsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified QueryParamsRequest message. Does not implicitly {@link cosmos.bank.v1beta1.QueryParamsRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.bank.v1beta1.QueryParamsRequest + * @static + * @param {cosmos.bank.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified QueryParamsRequest message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.QueryParamsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.bank.v1beta1.QueryParamsRequest + * @static + * @param {cosmos.bank.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryParamsRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.bank.v1beta1.QueryParamsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.bank.v1beta1.QueryParamsRequest} QueryParamsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.QueryParamsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryParamsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.bank.v1beta1.QueryParamsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.bank.v1beta1.QueryParamsRequest} QueryParamsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryParamsRequest message. + * @function verify + * @memberof cosmos.bank.v1beta1.QueryParamsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryParamsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a QueryParamsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.bank.v1beta1.QueryParamsRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.bank.v1beta1.QueryParamsRequest} QueryParamsRequest + */ + QueryParamsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.bank.v1beta1.QueryParamsRequest) + return object; + return new $root.cosmos.bank.v1beta1.QueryParamsRequest(); + }; + + /** + * Creates a plain object from a QueryParamsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.bank.v1beta1.QueryParamsRequest + * @static + * @param {cosmos.bank.v1beta1.QueryParamsRequest} message QueryParamsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryParamsRequest.toObject = function toObject() { + return {}; + }; + + /** + * Converts this QueryParamsRequest to JSON. + * @function toJSON + * @memberof cosmos.bank.v1beta1.QueryParamsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryParamsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryParamsRequest; + })(); + + v1beta1.QueryParamsResponse = (function() { + + /** + * Properties of a QueryParamsResponse. + * @memberof cosmos.bank.v1beta1 + * @interface IQueryParamsResponse + * @property {cosmos.bank.v1beta1.IParams|null} [params] QueryParamsResponse params + */ + + /** + * Constructs a new QueryParamsResponse. + * @memberof cosmos.bank.v1beta1 + * @classdesc Represents a QueryParamsResponse. + * @implements IQueryParamsResponse + * @constructor + * @param {cosmos.bank.v1beta1.IQueryParamsResponse=} [properties] Properties to set + */ + function QueryParamsResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryParamsResponse params. + * @member {cosmos.bank.v1beta1.IParams|null|undefined} params + * @memberof cosmos.bank.v1beta1.QueryParamsResponse + * @instance + */ + QueryParamsResponse.prototype.params = null; + + /** + * Encodes the specified QueryParamsResponse message. Does not implicitly {@link cosmos.bank.v1beta1.QueryParamsResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.bank.v1beta1.QueryParamsResponse + * @static + * @param {cosmos.bank.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.params != null && Object.hasOwnProperty.call(message, "params")) + $root.cosmos.bank.v1beta1.Params.encode(message.params, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryParamsResponse message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.QueryParamsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.bank.v1beta1.QueryParamsResponse + * @static + * @param {cosmos.bank.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryParamsResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.bank.v1beta1.QueryParamsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.bank.v1beta1.QueryParamsResponse} QueryParamsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.QueryParamsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = $root.cosmos.bank.v1beta1.Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryParamsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.bank.v1beta1.QueryParamsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.bank.v1beta1.QueryParamsResponse} QueryParamsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryParamsResponse message. + * @function verify + * @memberof cosmos.bank.v1beta1.QueryParamsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryParamsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.params != null && message.hasOwnProperty("params")) { + let error = $root.cosmos.bank.v1beta1.Params.verify(message.params); + if (error) + return "params." + error; + } + return null; + }; + + /** + * Creates a QueryParamsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.bank.v1beta1.QueryParamsResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.bank.v1beta1.QueryParamsResponse} QueryParamsResponse + */ + QueryParamsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.bank.v1beta1.QueryParamsResponse) + return object; + let message = new $root.cosmos.bank.v1beta1.QueryParamsResponse(); + if (object.params != null) { + if (typeof object.params !== "object") + throw TypeError(".cosmos.bank.v1beta1.QueryParamsResponse.params: object expected"); + message.params = $root.cosmos.bank.v1beta1.Params.fromObject(object.params); + } + return message; + }; + + /** + * Creates a plain object from a QueryParamsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.bank.v1beta1.QueryParamsResponse + * @static + * @param {cosmos.bank.v1beta1.QueryParamsResponse} message QueryParamsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryParamsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.params = null; + if (message.params != null && message.hasOwnProperty("params")) + object.params = $root.cosmos.bank.v1beta1.Params.toObject(message.params, options); + return object; + }; + + /** + * Converts this QueryParamsResponse to JSON. + * @function toJSON + * @memberof cosmos.bank.v1beta1.QueryParamsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryParamsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryParamsResponse; + })(); + + v1beta1.QueryDenomsMetadataRequest = (function() { + + /** + * Properties of a QueryDenomsMetadataRequest. + * @memberof cosmos.bank.v1beta1 + * @interface IQueryDenomsMetadataRequest + * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryDenomsMetadataRequest pagination + */ + + /** + * Constructs a new QueryDenomsMetadataRequest. + * @memberof cosmos.bank.v1beta1 + * @classdesc Represents a QueryDenomsMetadataRequest. + * @implements IQueryDenomsMetadataRequest + * @constructor + * @param {cosmos.bank.v1beta1.IQueryDenomsMetadataRequest=} [properties] Properties to set + */ + function QueryDenomsMetadataRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryDenomsMetadataRequest pagination. + * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination + * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataRequest + * @instance + */ + QueryDenomsMetadataRequest.prototype.pagination = null; + + /** + * Encodes the specified QueryDenomsMetadataRequest message. Does not implicitly {@link cosmos.bank.v1beta1.QueryDenomsMetadataRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataRequest + * @static + * @param {cosmos.bank.v1beta1.IQueryDenomsMetadataRequest} message QueryDenomsMetadataRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDenomsMetadataRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryDenomsMetadataRequest message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.QueryDenomsMetadataRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataRequest + * @static + * @param {cosmos.bank.v1beta1.IQueryDenomsMetadataRequest} message QueryDenomsMetadataRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDenomsMetadataRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryDenomsMetadataRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.bank.v1beta1.QueryDenomsMetadataRequest} QueryDenomsMetadataRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDenomsMetadataRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.QueryDenomsMetadataRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryDenomsMetadataRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.bank.v1beta1.QueryDenomsMetadataRequest} QueryDenomsMetadataRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDenomsMetadataRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryDenomsMetadataRequest message. + * @function verify + * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryDenomsMetadataRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryDenomsMetadataRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.bank.v1beta1.QueryDenomsMetadataRequest} QueryDenomsMetadataRequest + */ + QueryDenomsMetadataRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.bank.v1beta1.QueryDenomsMetadataRequest) + return object; + let message = new $root.cosmos.bank.v1beta1.QueryDenomsMetadataRequest(); + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.bank.v1beta1.QueryDenomsMetadataRequest.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryDenomsMetadataRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataRequest + * @static + * @param {cosmos.bank.v1beta1.QueryDenomsMetadataRequest} message QueryDenomsMetadataRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryDenomsMetadataRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.pagination = null; + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryDenomsMetadataRequest to JSON. + * @function toJSON + * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataRequest + * @instance + * @returns {Object.} JSON object + */ + QueryDenomsMetadataRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryDenomsMetadataRequest; + })(); + + v1beta1.QueryDenomsMetadataResponse = (function() { + + /** + * Properties of a QueryDenomsMetadataResponse. + * @memberof cosmos.bank.v1beta1 + * @interface IQueryDenomsMetadataResponse + * @property {Array.|null} [metadatas] QueryDenomsMetadataResponse metadatas + * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryDenomsMetadataResponse pagination + */ + + /** + * Constructs a new QueryDenomsMetadataResponse. + * @memberof cosmos.bank.v1beta1 + * @classdesc Represents a QueryDenomsMetadataResponse. + * @implements IQueryDenomsMetadataResponse + * @constructor + * @param {cosmos.bank.v1beta1.IQueryDenomsMetadataResponse=} [properties] Properties to set + */ + function QueryDenomsMetadataResponse(properties) { + this.metadatas = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryDenomsMetadataResponse metadatas. + * @member {Array.} metadatas + * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataResponse + * @instance + */ + QueryDenomsMetadataResponse.prototype.metadatas = $util.emptyArray; + + /** + * QueryDenomsMetadataResponse pagination. + * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination + * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataResponse + * @instance + */ + QueryDenomsMetadataResponse.prototype.pagination = null; + + /** + * Encodes the specified QueryDenomsMetadataResponse message. Does not implicitly {@link cosmos.bank.v1beta1.QueryDenomsMetadataResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataResponse + * @static + * @param {cosmos.bank.v1beta1.IQueryDenomsMetadataResponse} message QueryDenomsMetadataResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDenomsMetadataResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.metadatas != null && message.metadatas.length) + for (let i = 0; i < message.metadatas.length; ++i) + $root.cosmos.bank.v1beta1.Metadata.encode(message.metadatas[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryDenomsMetadataResponse message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.QueryDenomsMetadataResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataResponse + * @static + * @param {cosmos.bank.v1beta1.IQueryDenomsMetadataResponse} message QueryDenomsMetadataResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDenomsMetadataResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryDenomsMetadataResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.bank.v1beta1.QueryDenomsMetadataResponse} QueryDenomsMetadataResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDenomsMetadataResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.QueryDenomsMetadataResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.metadatas && message.metadatas.length)) + message.metadatas = []; + message.metadatas.push($root.cosmos.bank.v1beta1.Metadata.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryDenomsMetadataResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.bank.v1beta1.QueryDenomsMetadataResponse} QueryDenomsMetadataResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDenomsMetadataResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryDenomsMetadataResponse message. + * @function verify + * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryDenomsMetadataResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.metadatas != null && message.hasOwnProperty("metadatas")) { + if (!Array.isArray(message.metadatas)) + return "metadatas: array expected"; + for (let i = 0; i < message.metadatas.length; ++i) { + let error = $root.cosmos.bank.v1beta1.Metadata.verify(message.metadatas[i]); + if (error) + return "metadatas." + error; + } + } + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryDenomsMetadataResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.bank.v1beta1.QueryDenomsMetadataResponse} QueryDenomsMetadataResponse + */ + QueryDenomsMetadataResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.bank.v1beta1.QueryDenomsMetadataResponse) + return object; + let message = new $root.cosmos.bank.v1beta1.QueryDenomsMetadataResponse(); + if (object.metadatas) { + if (!Array.isArray(object.metadatas)) + throw TypeError(".cosmos.bank.v1beta1.QueryDenomsMetadataResponse.metadatas: array expected"); + message.metadatas = []; + for (let i = 0; i < object.metadatas.length; ++i) { + if (typeof object.metadatas[i] !== "object") + throw TypeError(".cosmos.bank.v1beta1.QueryDenomsMetadataResponse.metadatas: object expected"); + message.metadatas[i] = $root.cosmos.bank.v1beta1.Metadata.fromObject(object.metadatas[i]); + } + } + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.bank.v1beta1.QueryDenomsMetadataResponse.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryDenomsMetadataResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataResponse + * @static + * @param {cosmos.bank.v1beta1.QueryDenomsMetadataResponse} message QueryDenomsMetadataResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryDenomsMetadataResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.metadatas = []; + if (options.defaults) + object.pagination = null; + if (message.metadatas && message.metadatas.length) { + object.metadatas = []; + for (let j = 0; j < message.metadatas.length; ++j) + object.metadatas[j] = $root.cosmos.bank.v1beta1.Metadata.toObject(message.metadatas[j], options); + } + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryDenomsMetadataResponse to JSON. + * @function toJSON + * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataResponse + * @instance + * @returns {Object.} JSON object + */ + QueryDenomsMetadataResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryDenomsMetadataResponse; + })(); + + v1beta1.QueryDenomMetadataRequest = (function() { + + /** + * Properties of a QueryDenomMetadataRequest. + * @memberof cosmos.bank.v1beta1 + * @interface IQueryDenomMetadataRequest + * @property {string|null} [denom] QueryDenomMetadataRequest denom + */ + + /** + * Constructs a new QueryDenomMetadataRequest. + * @memberof cosmos.bank.v1beta1 + * @classdesc Represents a QueryDenomMetadataRequest. + * @implements IQueryDenomMetadataRequest + * @constructor + * @param {cosmos.bank.v1beta1.IQueryDenomMetadataRequest=} [properties] Properties to set + */ + function QueryDenomMetadataRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryDenomMetadataRequest denom. + * @member {string} denom + * @memberof cosmos.bank.v1beta1.QueryDenomMetadataRequest + * @instance + */ + QueryDenomMetadataRequest.prototype.denom = ""; + + /** + * Encodes the specified QueryDenomMetadataRequest message. Does not implicitly {@link cosmos.bank.v1beta1.QueryDenomMetadataRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.bank.v1beta1.QueryDenomMetadataRequest + * @static + * @param {cosmos.bank.v1beta1.IQueryDenomMetadataRequest} message QueryDenomMetadataRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDenomMetadataRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.denom != null && Object.hasOwnProperty.call(message, "denom")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.denom); + return writer; + }; + + /** + * Encodes the specified QueryDenomMetadataRequest message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.QueryDenomMetadataRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.bank.v1beta1.QueryDenomMetadataRequest + * @static + * @param {cosmos.bank.v1beta1.IQueryDenomMetadataRequest} message QueryDenomMetadataRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDenomMetadataRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryDenomMetadataRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.bank.v1beta1.QueryDenomMetadataRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.bank.v1beta1.QueryDenomMetadataRequest} QueryDenomMetadataRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDenomMetadataRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.QueryDenomMetadataRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryDenomMetadataRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.bank.v1beta1.QueryDenomMetadataRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.bank.v1beta1.QueryDenomMetadataRequest} QueryDenomMetadataRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDenomMetadataRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryDenomMetadataRequest message. + * @function verify + * @memberof cosmos.bank.v1beta1.QueryDenomMetadataRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryDenomMetadataRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.denom != null && message.hasOwnProperty("denom")) + if (!$util.isString(message.denom)) + return "denom: string expected"; + return null; + }; + + /** + * Creates a QueryDenomMetadataRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.bank.v1beta1.QueryDenomMetadataRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.bank.v1beta1.QueryDenomMetadataRequest} QueryDenomMetadataRequest + */ + QueryDenomMetadataRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.bank.v1beta1.QueryDenomMetadataRequest) + return object; + let message = new $root.cosmos.bank.v1beta1.QueryDenomMetadataRequest(); + if (object.denom != null) + message.denom = String(object.denom); + return message; + }; + + /** + * Creates a plain object from a QueryDenomMetadataRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.bank.v1beta1.QueryDenomMetadataRequest + * @static + * @param {cosmos.bank.v1beta1.QueryDenomMetadataRequest} message QueryDenomMetadataRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryDenomMetadataRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.denom = ""; + if (message.denom != null && message.hasOwnProperty("denom")) + object.denom = message.denom; + return object; + }; + + /** + * Converts this QueryDenomMetadataRequest to JSON. + * @function toJSON + * @memberof cosmos.bank.v1beta1.QueryDenomMetadataRequest + * @instance + * @returns {Object.} JSON object + */ + QueryDenomMetadataRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryDenomMetadataRequest; + })(); + + v1beta1.QueryDenomMetadataResponse = (function() { + + /** + * Properties of a QueryDenomMetadataResponse. + * @memberof cosmos.bank.v1beta1 + * @interface IQueryDenomMetadataResponse + * @property {cosmos.bank.v1beta1.IMetadata|null} [metadata] QueryDenomMetadataResponse metadata + */ + + /** + * Constructs a new QueryDenomMetadataResponse. + * @memberof cosmos.bank.v1beta1 + * @classdesc Represents a QueryDenomMetadataResponse. + * @implements IQueryDenomMetadataResponse + * @constructor + * @param {cosmos.bank.v1beta1.IQueryDenomMetadataResponse=} [properties] Properties to set + */ + function QueryDenomMetadataResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryDenomMetadataResponse metadata. + * @member {cosmos.bank.v1beta1.IMetadata|null|undefined} metadata + * @memberof cosmos.bank.v1beta1.QueryDenomMetadataResponse + * @instance + */ + QueryDenomMetadataResponse.prototype.metadata = null; + + /** + * Encodes the specified QueryDenomMetadataResponse message. Does not implicitly {@link cosmos.bank.v1beta1.QueryDenomMetadataResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.bank.v1beta1.QueryDenomMetadataResponse + * @static + * @param {cosmos.bank.v1beta1.IQueryDenomMetadataResponse} message QueryDenomMetadataResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDenomMetadataResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.cosmos.bank.v1beta1.Metadata.encode(message.metadata, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryDenomMetadataResponse message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.QueryDenomMetadataResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.bank.v1beta1.QueryDenomMetadataResponse + * @static + * @param {cosmos.bank.v1beta1.IQueryDenomMetadataResponse} message QueryDenomMetadataResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDenomMetadataResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryDenomMetadataResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.bank.v1beta1.QueryDenomMetadataResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.bank.v1beta1.QueryDenomMetadataResponse} QueryDenomMetadataResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDenomMetadataResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.QueryDenomMetadataResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.metadata = $root.cosmos.bank.v1beta1.Metadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryDenomMetadataResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.bank.v1beta1.QueryDenomMetadataResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.bank.v1beta1.QueryDenomMetadataResponse} QueryDenomMetadataResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDenomMetadataResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryDenomMetadataResponse message. + * @function verify + * @memberof cosmos.bank.v1beta1.QueryDenomMetadataResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryDenomMetadataResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.metadata != null && message.hasOwnProperty("metadata")) { + let error = $root.cosmos.bank.v1beta1.Metadata.verify(message.metadata); + if (error) + return "metadata." + error; + } + return null; + }; + + /** + * Creates a QueryDenomMetadataResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.bank.v1beta1.QueryDenomMetadataResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.bank.v1beta1.QueryDenomMetadataResponse} QueryDenomMetadataResponse + */ + QueryDenomMetadataResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.bank.v1beta1.QueryDenomMetadataResponse) + return object; + let message = new $root.cosmos.bank.v1beta1.QueryDenomMetadataResponse(); + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".cosmos.bank.v1beta1.QueryDenomMetadataResponse.metadata: object expected"); + message.metadata = $root.cosmos.bank.v1beta1.Metadata.fromObject(object.metadata); + } + return message; + }; + + /** + * Creates a plain object from a QueryDenomMetadataResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.bank.v1beta1.QueryDenomMetadataResponse + * @static + * @param {cosmos.bank.v1beta1.QueryDenomMetadataResponse} message QueryDenomMetadataResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryDenomMetadataResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.metadata = null; + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.cosmos.bank.v1beta1.Metadata.toObject(message.metadata, options); + return object; + }; + + /** + * Converts this QueryDenomMetadataResponse to JSON. + * @function toJSON + * @memberof cosmos.bank.v1beta1.QueryDenomMetadataResponse + * @instance + * @returns {Object.} JSON object + */ + QueryDenomMetadataResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryDenomMetadataResponse; + })(); + + v1beta1.GenesisState = (function() { + + /** + * Properties of a GenesisState. + * @memberof cosmos.bank.v1beta1 + * @interface IGenesisState + * @property {cosmos.bank.v1beta1.IParams|null} [params] GenesisState params + * @property {Array.|null} [balances] GenesisState balances + * @property {Array.|null} [supply] GenesisState supply + * @property {Array.|null} [denom_metadata] GenesisState denom_metadata + */ + + /** + * Constructs a new GenesisState. + * @memberof cosmos.bank.v1beta1 + * @classdesc Represents a GenesisState. + * @implements IGenesisState + * @constructor + * @param {cosmos.bank.v1beta1.IGenesisState=} [properties] Properties to set + */ + function GenesisState(properties) { + this.balances = []; + this.supply = []; + this.denom_metadata = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenesisState params. + * @member {cosmos.bank.v1beta1.IParams|null|undefined} params + * @memberof cosmos.bank.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.params = null; + + /** + * GenesisState balances. + * @member {Array.} balances + * @memberof cosmos.bank.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.balances = $util.emptyArray; + + /** + * GenesisState supply. + * @member {Array.} supply + * @memberof cosmos.bank.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.supply = $util.emptyArray; + + /** + * GenesisState denom_metadata. + * @member {Array.} denom_metadata + * @memberof cosmos.bank.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.denom_metadata = $util.emptyArray; + + /** + * Encodes the specified GenesisState message. Does not implicitly {@link cosmos.bank.v1beta1.GenesisState.verify|verify} messages. + * @function encode + * @memberof cosmos.bank.v1beta1.GenesisState + * @static + * @param {cosmos.bank.v1beta1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.params != null && Object.hasOwnProperty.call(message, "params")) + $root.cosmos.bank.v1beta1.Params.encode(message.params, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.balances != null && message.balances.length) + for (let i = 0; i < message.balances.length; ++i) + $root.cosmos.bank.v1beta1.Balance.encode(message.balances[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.supply != null && message.supply.length) + for (let i = 0; i < message.supply.length; ++i) + $root.cosmos.base.v1beta1.Coin.encode(message.supply[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.denom_metadata != null && message.denom_metadata.length) + for (let i = 0; i < message.denom_metadata.length; ++i) + $root.cosmos.bank.v1beta1.Metadata.encode(message.denom_metadata[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.GenesisState.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.bank.v1beta1.GenesisState + * @static + * @param {cosmos.bank.v1beta1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer. + * @function decode + * @memberof cosmos.bank.v1beta1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.bank.v1beta1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.GenesisState(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = $root.cosmos.bank.v1beta1.Params.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.balances && message.balances.length)) + message.balances = []; + message.balances.push($root.cosmos.bank.v1beta1.Balance.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.supply && message.supply.length)) + message.supply = []; + message.supply.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); + break; + case 4: + if (!(message.denom_metadata && message.denom_metadata.length)) + message.denom_metadata = []; + message.denom_metadata.push($root.cosmos.bank.v1beta1.Metadata.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.bank.v1beta1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.bank.v1beta1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenesisState message. + * @function verify + * @memberof cosmos.bank.v1beta1.GenesisState + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenesisState.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.params != null && message.hasOwnProperty("params")) { + let error = $root.cosmos.bank.v1beta1.Params.verify(message.params); + if (error) + return "params." + error; + } + if (message.balances != null && message.hasOwnProperty("balances")) { + if (!Array.isArray(message.balances)) + return "balances: array expected"; + for (let i = 0; i < message.balances.length; ++i) { + let error = $root.cosmos.bank.v1beta1.Balance.verify(message.balances[i]); + if (error) + return "balances." + error; + } + } + if (message.supply != null && message.hasOwnProperty("supply")) { + if (!Array.isArray(message.supply)) + return "supply: array expected"; + for (let i = 0; i < message.supply.length; ++i) { + let error = $root.cosmos.base.v1beta1.Coin.verify(message.supply[i]); + if (error) + return "supply." + error; + } + } + if (message.denom_metadata != null && message.hasOwnProperty("denom_metadata")) { + if (!Array.isArray(message.denom_metadata)) + return "denom_metadata: array expected"; + for (let i = 0; i < message.denom_metadata.length; ++i) { + let error = $root.cosmos.bank.v1beta1.Metadata.verify(message.denom_metadata[i]); + if (error) + return "denom_metadata." + error; + } + } + return null; + }; + + /** + * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.bank.v1beta1.GenesisState + * @static + * @param {Object.} object Plain object + * @returns {cosmos.bank.v1beta1.GenesisState} GenesisState + */ + GenesisState.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.bank.v1beta1.GenesisState) + return object; + let message = new $root.cosmos.bank.v1beta1.GenesisState(); + if (object.params != null) { + if (typeof object.params !== "object") + throw TypeError(".cosmos.bank.v1beta1.GenesisState.params: object expected"); + message.params = $root.cosmos.bank.v1beta1.Params.fromObject(object.params); + } + if (object.balances) { + if (!Array.isArray(object.balances)) + throw TypeError(".cosmos.bank.v1beta1.GenesisState.balances: array expected"); + message.balances = []; + for (let i = 0; i < object.balances.length; ++i) { + if (typeof object.balances[i] !== "object") + throw TypeError(".cosmos.bank.v1beta1.GenesisState.balances: object expected"); + message.balances[i] = $root.cosmos.bank.v1beta1.Balance.fromObject(object.balances[i]); + } + } + if (object.supply) { + if (!Array.isArray(object.supply)) + throw TypeError(".cosmos.bank.v1beta1.GenesisState.supply: array expected"); + message.supply = []; + for (let i = 0; i < object.supply.length; ++i) { + if (typeof object.supply[i] !== "object") + throw TypeError(".cosmos.bank.v1beta1.GenesisState.supply: object expected"); + message.supply[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.supply[i]); + } + } + if (object.denom_metadata) { + if (!Array.isArray(object.denom_metadata)) + throw TypeError(".cosmos.bank.v1beta1.GenesisState.denom_metadata: array expected"); + message.denom_metadata = []; + for (let i = 0; i < object.denom_metadata.length; ++i) { + if (typeof object.denom_metadata[i] !== "object") + throw TypeError(".cosmos.bank.v1beta1.GenesisState.denom_metadata: object expected"); + message.denom_metadata[i] = $root.cosmos.bank.v1beta1.Metadata.fromObject(object.denom_metadata[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a GenesisState message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.bank.v1beta1.GenesisState + * @static + * @param {cosmos.bank.v1beta1.GenesisState} message GenesisState + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenesisState.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) { + object.balances = []; + object.supply = []; + object.denom_metadata = []; + } + if (options.defaults) + object.params = null; + if (message.params != null && message.hasOwnProperty("params")) + object.params = $root.cosmos.bank.v1beta1.Params.toObject(message.params, options); + if (message.balances && message.balances.length) { + object.balances = []; + for (let j = 0; j < message.balances.length; ++j) + object.balances[j] = $root.cosmos.bank.v1beta1.Balance.toObject(message.balances[j], options); + } + if (message.supply && message.supply.length) { + object.supply = []; + for (let j = 0; j < message.supply.length; ++j) + object.supply[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.supply[j], options); + } + if (message.denom_metadata && message.denom_metadata.length) { + object.denom_metadata = []; + for (let j = 0; j < message.denom_metadata.length; ++j) + object.denom_metadata[j] = $root.cosmos.bank.v1beta1.Metadata.toObject(message.denom_metadata[j], options); + } + return object; + }; + + /** + * Converts this GenesisState to JSON. + * @function toJSON + * @memberof cosmos.bank.v1beta1.GenesisState + * @instance + * @returns {Object.} JSON object + */ + GenesisState.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenesisState; + })(); + + v1beta1.Balance = (function() { + + /** + * Properties of a Balance. + * @memberof cosmos.bank.v1beta1 + * @interface IBalance + * @property {string|null} [address] Balance address + * @property {Array.|null} [coins] Balance coins + */ + + /** + * Constructs a new Balance. + * @memberof cosmos.bank.v1beta1 + * @classdesc Represents a Balance. + * @implements IBalance + * @constructor + * @param {cosmos.bank.v1beta1.IBalance=} [properties] Properties to set + */ + function Balance(properties) { + this.coins = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Balance address. + * @member {string} address + * @memberof cosmos.bank.v1beta1.Balance + * @instance + */ + Balance.prototype.address = ""; + + /** + * Balance coins. + * @member {Array.} coins + * @memberof cosmos.bank.v1beta1.Balance + * @instance + */ + Balance.prototype.coins = $util.emptyArray; + + /** + * Encodes the specified Balance message. Does not implicitly {@link cosmos.bank.v1beta1.Balance.verify|verify} messages. + * @function encode + * @memberof cosmos.bank.v1beta1.Balance + * @static + * @param {cosmos.bank.v1beta1.IBalance} message Balance message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Balance.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.address != null && Object.hasOwnProperty.call(message, "address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.address); + if (message.coins != null && message.coins.length) + for (let i = 0; i < message.coins.length; ++i) + $root.cosmos.base.v1beta1.Coin.encode(message.coins[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Balance message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.Balance.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.bank.v1beta1.Balance + * @static + * @param {cosmos.bank.v1beta1.IBalance} message Balance message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Balance.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Balance message from the specified reader or buffer. + * @function decode + * @memberof cosmos.bank.v1beta1.Balance + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.bank.v1beta1.Balance} Balance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Balance.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.Balance(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + if (!(message.coins && message.coins.length)) + message.coins = []; + message.coins.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Balance message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.bank.v1beta1.Balance + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.bank.v1beta1.Balance} Balance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Balance.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Balance message. + * @function verify + * @memberof cosmos.bank.v1beta1.Balance + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Balance.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.address != null && message.hasOwnProperty("address")) + if (!$util.isString(message.address)) + return "address: string expected"; + if (message.coins != null && message.hasOwnProperty("coins")) { + if (!Array.isArray(message.coins)) + return "coins: array expected"; + for (let i = 0; i < message.coins.length; ++i) { + let error = $root.cosmos.base.v1beta1.Coin.verify(message.coins[i]); + if (error) + return "coins." + error; + } + } + return null; + }; + + /** + * Creates a Balance message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.bank.v1beta1.Balance + * @static + * @param {Object.} object Plain object + * @returns {cosmos.bank.v1beta1.Balance} Balance + */ + Balance.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.bank.v1beta1.Balance) + return object; + let message = new $root.cosmos.bank.v1beta1.Balance(); + if (object.address != null) + message.address = String(object.address); + if (object.coins) { + if (!Array.isArray(object.coins)) + throw TypeError(".cosmos.bank.v1beta1.Balance.coins: array expected"); + message.coins = []; + for (let i = 0; i < object.coins.length; ++i) { + if (typeof object.coins[i] !== "object") + throw TypeError(".cosmos.bank.v1beta1.Balance.coins: object expected"); + message.coins[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.coins[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Balance message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.bank.v1beta1.Balance + * @static + * @param {cosmos.bank.v1beta1.Balance} message Balance + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Balance.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.coins = []; + if (options.defaults) + object.address = ""; + if (message.address != null && message.hasOwnProperty("address")) + object.address = message.address; + if (message.coins && message.coins.length) { + object.coins = []; + for (let j = 0; j < message.coins.length; ++j) + object.coins[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.coins[j], options); + } + return object; + }; + + /** + * Converts this Balance to JSON. + * @function toJSON + * @memberof cosmos.bank.v1beta1.Balance + * @instance + * @returns {Object.} JSON object + */ + Balance.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Balance; + })(); + + return v1beta1; + })(); + + return bank; + })(); + + cosmos.base = (function() { + + /** + * Namespace base. + * @memberof cosmos + * @namespace + */ + const base = {}; + + base.abci = (function() { + + /** + * Namespace abci. + * @memberof cosmos.base + * @namespace + */ + const abci = {}; + + abci.v1beta1 = (function() { + + /** + * Namespace v1beta1. + * @memberof cosmos.base.abci + * @namespace + */ + const v1beta1 = {}; + + v1beta1.TxResponse = (function() { + + /** + * Properties of a TxResponse. + * @memberof cosmos.base.abci.v1beta1 + * @interface ITxResponse + * @property {Long|null} [height] TxResponse height + * @property {string|null} [txhash] TxResponse txhash + * @property {string|null} [codespace] TxResponse codespace + * @property {number|null} [code] TxResponse code + * @property {string|null} [data] TxResponse data + * @property {string|null} [raw_log] TxResponse raw_log + * @property {Array.|null} [logs] TxResponse logs + * @property {string|null} [info] TxResponse info + * @property {Long|null} [gas_wanted] TxResponse gas_wanted + * @property {Long|null} [gas_used] TxResponse gas_used + * @property {google.protobuf.IAny|null} [tx] TxResponse tx + * @property {string|null} [timestamp] TxResponse timestamp + */ + + /** + * Constructs a new TxResponse. + * @memberof cosmos.base.abci.v1beta1 + * @classdesc Represents a TxResponse. + * @implements ITxResponse + * @constructor + * @param {cosmos.base.abci.v1beta1.ITxResponse=} [properties] Properties to set + */ + function TxResponse(properties) { + this.logs = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TxResponse height. + * @member {Long} height + * @memberof cosmos.base.abci.v1beta1.TxResponse + * @instance + */ + TxResponse.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * TxResponse txhash. + * @member {string} txhash + * @memberof cosmos.base.abci.v1beta1.TxResponse + * @instance + */ + TxResponse.prototype.txhash = ""; + + /** + * TxResponse codespace. + * @member {string} codespace + * @memberof cosmos.base.abci.v1beta1.TxResponse + * @instance + */ + TxResponse.prototype.codespace = ""; + + /** + * TxResponse code. + * @member {number} code + * @memberof cosmos.base.abci.v1beta1.TxResponse + * @instance + */ + TxResponse.prototype.code = 0; + + /** + * TxResponse data. + * @member {string} data + * @memberof cosmos.base.abci.v1beta1.TxResponse + * @instance + */ + TxResponse.prototype.data = ""; + + /** + * TxResponse raw_log. + * @member {string} raw_log + * @memberof cosmos.base.abci.v1beta1.TxResponse + * @instance + */ + TxResponse.prototype.raw_log = ""; + + /** + * TxResponse logs. + * @member {Array.} logs + * @memberof cosmos.base.abci.v1beta1.TxResponse + * @instance + */ + TxResponse.prototype.logs = $util.emptyArray; + + /** + * TxResponse info. + * @member {string} info + * @memberof cosmos.base.abci.v1beta1.TxResponse + * @instance + */ + TxResponse.prototype.info = ""; + + /** + * TxResponse gas_wanted. + * @member {Long} gas_wanted + * @memberof cosmos.base.abci.v1beta1.TxResponse + * @instance + */ + TxResponse.prototype.gas_wanted = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * TxResponse gas_used. + * @member {Long} gas_used + * @memberof cosmos.base.abci.v1beta1.TxResponse + * @instance + */ + TxResponse.prototype.gas_used = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * TxResponse tx. + * @member {google.protobuf.IAny|null|undefined} tx + * @memberof cosmos.base.abci.v1beta1.TxResponse + * @instance + */ + TxResponse.prototype.tx = null; + + /** + * TxResponse timestamp. + * @member {string} timestamp + * @memberof cosmos.base.abci.v1beta1.TxResponse + * @instance + */ + TxResponse.prototype.timestamp = ""; + + /** + * Encodes the specified TxResponse message. Does not implicitly {@link cosmos.base.abci.v1beta1.TxResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.base.abci.v1beta1.TxResponse + * @static + * @param {cosmos.base.abci.v1beta1.ITxResponse} message TxResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TxResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.height); + if (message.txhash != null && Object.hasOwnProperty.call(message, "txhash")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.txhash); + if (message.codespace != null && Object.hasOwnProperty.call(message, "codespace")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.codespace); + if (message.code != null && Object.hasOwnProperty.call(message, "code")) + writer.uint32(/* id 4, wireType 0 =*/32).uint32(message.code); + if (message.data != null && Object.hasOwnProperty.call(message, "data")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.data); + if (message.raw_log != null && Object.hasOwnProperty.call(message, "raw_log")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.raw_log); + if (message.logs != null && message.logs.length) + for (let i = 0; i < message.logs.length; ++i) + $root.cosmos.base.abci.v1beta1.ABCIMessageLog.encode(message.logs[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.info != null && Object.hasOwnProperty.call(message, "info")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.info); + if (message.gas_wanted != null && Object.hasOwnProperty.call(message, "gas_wanted")) + writer.uint32(/* id 9, wireType 0 =*/72).int64(message.gas_wanted); + if (message.gas_used != null && Object.hasOwnProperty.call(message, "gas_used")) + writer.uint32(/* id 10, wireType 0 =*/80).int64(message.gas_used); + if (message.tx != null && Object.hasOwnProperty.call(message, "tx")) + $root.google.protobuf.Any.encode(message.tx, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.timestamp); + return writer; + }; + + /** + * Encodes the specified TxResponse message, length delimited. Does not implicitly {@link cosmos.base.abci.v1beta1.TxResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.abci.v1beta1.TxResponse + * @static + * @param {cosmos.base.abci.v1beta1.ITxResponse} message TxResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TxResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TxResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.abci.v1beta1.TxResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.abci.v1beta1.TxResponse} TxResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TxResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.abci.v1beta1.TxResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + case 2: + message.txhash = reader.string(); + break; + case 3: + message.codespace = reader.string(); + break; + case 4: + message.code = reader.uint32(); + break; + case 5: + message.data = reader.string(); + break; + case 6: + message.raw_log = reader.string(); + break; + case 7: + if (!(message.logs && message.logs.length)) + message.logs = []; + message.logs.push($root.cosmos.base.abci.v1beta1.ABCIMessageLog.decode(reader, reader.uint32())); + break; + case 8: + message.info = reader.string(); + break; + case 9: + message.gas_wanted = reader.int64(); + break; + case 10: + message.gas_used = reader.int64(); + break; + case 11: + message.tx = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 12: + message.timestamp = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TxResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.abci.v1beta1.TxResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.abci.v1beta1.TxResponse} TxResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TxResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TxResponse message. + * @function verify + * @memberof cosmos.base.abci.v1beta1.TxResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TxResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) + return "height: integer|Long expected"; + if (message.txhash != null && message.hasOwnProperty("txhash")) + if (!$util.isString(message.txhash)) + return "txhash: string expected"; + if (message.codespace != null && message.hasOwnProperty("codespace")) + if (!$util.isString(message.codespace)) + return "codespace: string expected"; + if (message.code != null && message.hasOwnProperty("code")) + if (!$util.isInteger(message.code)) + return "code: integer expected"; + if (message.data != null && message.hasOwnProperty("data")) + if (!$util.isString(message.data)) + return "data: string expected"; + if (message.raw_log != null && message.hasOwnProperty("raw_log")) + if (!$util.isString(message.raw_log)) + return "raw_log: string expected"; + if (message.logs != null && message.hasOwnProperty("logs")) { + if (!Array.isArray(message.logs)) + return "logs: array expected"; + for (let i = 0; i < message.logs.length; ++i) { + let error = $root.cosmos.base.abci.v1beta1.ABCIMessageLog.verify(message.logs[i]); + if (error) + return "logs." + error; + } + } + if (message.info != null && message.hasOwnProperty("info")) + if (!$util.isString(message.info)) + return "info: string expected"; + if (message.gas_wanted != null && message.hasOwnProperty("gas_wanted")) + if (!$util.isInteger(message.gas_wanted) && !(message.gas_wanted && $util.isInteger(message.gas_wanted.low) && $util.isInteger(message.gas_wanted.high))) + return "gas_wanted: integer|Long expected"; + if (message.gas_used != null && message.hasOwnProperty("gas_used")) + if (!$util.isInteger(message.gas_used) && !(message.gas_used && $util.isInteger(message.gas_used.low) && $util.isInteger(message.gas_used.high))) + return "gas_used: integer|Long expected"; + if (message.tx != null && message.hasOwnProperty("tx")) { + let error = $root.google.protobuf.Any.verify(message.tx); + if (error) + return "tx." + error; + } + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (!$util.isString(message.timestamp)) + return "timestamp: string expected"; + return null; + }; + + /** + * Creates a TxResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.abci.v1beta1.TxResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.abci.v1beta1.TxResponse} TxResponse + */ + TxResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.abci.v1beta1.TxResponse) + return object; + let message = new $root.cosmos.base.abci.v1beta1.TxResponse(); + if (object.height != null) + if ($util.Long) + (message.height = $util.Long.fromValue(object.height)).unsigned = false; + else if (typeof object.height === "string") + message.height = parseInt(object.height, 10); + else if (typeof object.height === "number") + message.height = object.height; + else if (typeof object.height === "object") + message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); + if (object.txhash != null) + message.txhash = String(object.txhash); + if (object.codespace != null) + message.codespace = String(object.codespace); + if (object.code != null) + message.code = object.code >>> 0; + if (object.data != null) + message.data = String(object.data); + if (object.raw_log != null) + message.raw_log = String(object.raw_log); + if (object.logs) { + if (!Array.isArray(object.logs)) + throw TypeError(".cosmos.base.abci.v1beta1.TxResponse.logs: array expected"); + message.logs = []; + for (let i = 0; i < object.logs.length; ++i) { + if (typeof object.logs[i] !== "object") + throw TypeError(".cosmos.base.abci.v1beta1.TxResponse.logs: object expected"); + message.logs[i] = $root.cosmos.base.abci.v1beta1.ABCIMessageLog.fromObject(object.logs[i]); + } + } + if (object.info != null) + message.info = String(object.info); + if (object.gas_wanted != null) + if ($util.Long) + (message.gas_wanted = $util.Long.fromValue(object.gas_wanted)).unsigned = false; + else if (typeof object.gas_wanted === "string") + message.gas_wanted = parseInt(object.gas_wanted, 10); + else if (typeof object.gas_wanted === "number") + message.gas_wanted = object.gas_wanted; + else if (typeof object.gas_wanted === "object") + message.gas_wanted = new $util.LongBits(object.gas_wanted.low >>> 0, object.gas_wanted.high >>> 0).toNumber(); + if (object.gas_used != null) + if ($util.Long) + (message.gas_used = $util.Long.fromValue(object.gas_used)).unsigned = false; + else if (typeof object.gas_used === "string") + message.gas_used = parseInt(object.gas_used, 10); + else if (typeof object.gas_used === "number") + message.gas_used = object.gas_used; + else if (typeof object.gas_used === "object") + message.gas_used = new $util.LongBits(object.gas_used.low >>> 0, object.gas_used.high >>> 0).toNumber(); + if (object.tx != null) { + if (typeof object.tx !== "object") + throw TypeError(".cosmos.base.abci.v1beta1.TxResponse.tx: object expected"); + message.tx = $root.google.protobuf.Any.fromObject(object.tx); + } + if (object.timestamp != null) + message.timestamp = String(object.timestamp); + return message; + }; + + /** + * Creates a plain object from a TxResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.abci.v1beta1.TxResponse + * @static + * @param {cosmos.base.abci.v1beta1.TxResponse} message TxResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TxResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.logs = []; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.height = options.longs === String ? "0" : 0; + object.txhash = ""; + object.codespace = ""; + object.code = 0; + object.data = ""; + object.raw_log = ""; + object.info = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.gas_wanted = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.gas_wanted = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.gas_used = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.gas_used = options.longs === String ? "0" : 0; + object.tx = null; + object.timestamp = ""; + } + if (message.height != null && message.hasOwnProperty("height")) + if (typeof message.height === "number") + object.height = options.longs === String ? String(message.height) : message.height; + else + object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; + if (message.txhash != null && message.hasOwnProperty("txhash")) + object.txhash = message.txhash; + if (message.codespace != null && message.hasOwnProperty("codespace")) + object.codespace = message.codespace; + if (message.code != null && message.hasOwnProperty("code")) + object.code = message.code; + if (message.data != null && message.hasOwnProperty("data")) + object.data = message.data; + if (message.raw_log != null && message.hasOwnProperty("raw_log")) + object.raw_log = message.raw_log; + if (message.logs && message.logs.length) { + object.logs = []; + for (let j = 0; j < message.logs.length; ++j) + object.logs[j] = $root.cosmos.base.abci.v1beta1.ABCIMessageLog.toObject(message.logs[j], options); + } + if (message.info != null && message.hasOwnProperty("info")) + object.info = message.info; + if (message.gas_wanted != null && message.hasOwnProperty("gas_wanted")) + if (typeof message.gas_wanted === "number") + object.gas_wanted = options.longs === String ? String(message.gas_wanted) : message.gas_wanted; + else + object.gas_wanted = options.longs === String ? $util.Long.prototype.toString.call(message.gas_wanted) : options.longs === Number ? new $util.LongBits(message.gas_wanted.low >>> 0, message.gas_wanted.high >>> 0).toNumber() : message.gas_wanted; + if (message.gas_used != null && message.hasOwnProperty("gas_used")) + if (typeof message.gas_used === "number") + object.gas_used = options.longs === String ? String(message.gas_used) : message.gas_used; + else + object.gas_used = options.longs === String ? $util.Long.prototype.toString.call(message.gas_used) : options.longs === Number ? new $util.LongBits(message.gas_used.low >>> 0, message.gas_used.high >>> 0).toNumber() : message.gas_used; + if (message.tx != null && message.hasOwnProperty("tx")) + object.tx = $root.google.protobuf.Any.toObject(message.tx, options); + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + object.timestamp = message.timestamp; + return object; + }; + + /** + * Converts this TxResponse to JSON. + * @function toJSON + * @memberof cosmos.base.abci.v1beta1.TxResponse + * @instance + * @returns {Object.} JSON object + */ + TxResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TxResponse; + })(); + + v1beta1.ABCIMessageLog = (function() { + + /** + * Properties of a ABCIMessageLog. + * @memberof cosmos.base.abci.v1beta1 + * @interface IABCIMessageLog + * @property {number|null} [msg_index] ABCIMessageLog msg_index + * @property {string|null} [log] ABCIMessageLog log + * @property {Array.|null} [events] ABCIMessageLog events + */ + + /** + * Constructs a new ABCIMessageLog. + * @memberof cosmos.base.abci.v1beta1 + * @classdesc Represents a ABCIMessageLog. + * @implements IABCIMessageLog + * @constructor + * @param {cosmos.base.abci.v1beta1.IABCIMessageLog=} [properties] Properties to set + */ + function ABCIMessageLog(properties) { + this.events = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ABCIMessageLog msg_index. + * @member {number} msg_index + * @memberof cosmos.base.abci.v1beta1.ABCIMessageLog + * @instance + */ + ABCIMessageLog.prototype.msg_index = 0; + + /** + * ABCIMessageLog log. + * @member {string} log + * @memberof cosmos.base.abci.v1beta1.ABCIMessageLog + * @instance + */ + ABCIMessageLog.prototype.log = ""; + + /** + * ABCIMessageLog events. + * @member {Array.} events + * @memberof cosmos.base.abci.v1beta1.ABCIMessageLog + * @instance + */ + ABCIMessageLog.prototype.events = $util.emptyArray; + + /** + * Encodes the specified ABCIMessageLog message. Does not implicitly {@link cosmos.base.abci.v1beta1.ABCIMessageLog.verify|verify} messages. + * @function encode + * @memberof cosmos.base.abci.v1beta1.ABCIMessageLog + * @static + * @param {cosmos.base.abci.v1beta1.IABCIMessageLog} message ABCIMessageLog message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ABCIMessageLog.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.msg_index != null && Object.hasOwnProperty.call(message, "msg_index")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.msg_index); + if (message.log != null && Object.hasOwnProperty.call(message, "log")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.log); + if (message.events != null && message.events.length) + for (let i = 0; i < message.events.length; ++i) + $root.cosmos.base.abci.v1beta1.StringEvent.encode(message.events[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ABCIMessageLog message, length delimited. Does not implicitly {@link cosmos.base.abci.v1beta1.ABCIMessageLog.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.abci.v1beta1.ABCIMessageLog + * @static + * @param {cosmos.base.abci.v1beta1.IABCIMessageLog} message ABCIMessageLog message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ABCIMessageLog.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ABCIMessageLog message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.abci.v1beta1.ABCIMessageLog + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.abci.v1beta1.ABCIMessageLog} ABCIMessageLog + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ABCIMessageLog.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.abci.v1beta1.ABCIMessageLog(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.msg_index = reader.uint32(); + break; + case 2: + message.log = reader.string(); + break; + case 3: + if (!(message.events && message.events.length)) + message.events = []; + message.events.push($root.cosmos.base.abci.v1beta1.StringEvent.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ABCIMessageLog message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.abci.v1beta1.ABCIMessageLog + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.abci.v1beta1.ABCIMessageLog} ABCIMessageLog + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ABCIMessageLog.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ABCIMessageLog message. + * @function verify + * @memberof cosmos.base.abci.v1beta1.ABCIMessageLog + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ABCIMessageLog.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.msg_index != null && message.hasOwnProperty("msg_index")) + if (!$util.isInteger(message.msg_index)) + return "msg_index: integer expected"; + if (message.log != null && message.hasOwnProperty("log")) + if (!$util.isString(message.log)) + return "log: string expected"; + if (message.events != null && message.hasOwnProperty("events")) { + if (!Array.isArray(message.events)) + return "events: array expected"; + for (let i = 0; i < message.events.length; ++i) { + let error = $root.cosmos.base.abci.v1beta1.StringEvent.verify(message.events[i]); + if (error) + return "events." + error; + } + } + return null; + }; + + /** + * Creates a ABCIMessageLog message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.abci.v1beta1.ABCIMessageLog + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.abci.v1beta1.ABCIMessageLog} ABCIMessageLog + */ + ABCIMessageLog.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.abci.v1beta1.ABCIMessageLog) + return object; + let message = new $root.cosmos.base.abci.v1beta1.ABCIMessageLog(); + if (object.msg_index != null) + message.msg_index = object.msg_index >>> 0; + if (object.log != null) + message.log = String(object.log); + if (object.events) { + if (!Array.isArray(object.events)) + throw TypeError(".cosmos.base.abci.v1beta1.ABCIMessageLog.events: array expected"); + message.events = []; + for (let i = 0; i < object.events.length; ++i) { + if (typeof object.events[i] !== "object") + throw TypeError(".cosmos.base.abci.v1beta1.ABCIMessageLog.events: object expected"); + message.events[i] = $root.cosmos.base.abci.v1beta1.StringEvent.fromObject(object.events[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ABCIMessageLog message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.abci.v1beta1.ABCIMessageLog + * @static + * @param {cosmos.base.abci.v1beta1.ABCIMessageLog} message ABCIMessageLog + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ABCIMessageLog.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.events = []; + if (options.defaults) { + object.msg_index = 0; + object.log = ""; + } + if (message.msg_index != null && message.hasOwnProperty("msg_index")) + object.msg_index = message.msg_index; + if (message.log != null && message.hasOwnProperty("log")) + object.log = message.log; + if (message.events && message.events.length) { + object.events = []; + for (let j = 0; j < message.events.length; ++j) + object.events[j] = $root.cosmos.base.abci.v1beta1.StringEvent.toObject(message.events[j], options); + } + return object; + }; + + /** + * Converts this ABCIMessageLog to JSON. + * @function toJSON + * @memberof cosmos.base.abci.v1beta1.ABCIMessageLog + * @instance + * @returns {Object.} JSON object + */ + ABCIMessageLog.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ABCIMessageLog; + })(); + + v1beta1.StringEvent = (function() { + + /** + * Properties of a StringEvent. + * @memberof cosmos.base.abci.v1beta1 + * @interface IStringEvent + * @property {string|null} [type] StringEvent type + * @property {Array.|null} [attributes] StringEvent attributes + */ + + /** + * Constructs a new StringEvent. + * @memberof cosmos.base.abci.v1beta1 + * @classdesc Represents a StringEvent. + * @implements IStringEvent + * @constructor + * @param {cosmos.base.abci.v1beta1.IStringEvent=} [properties] Properties to set + */ + function StringEvent(properties) { + this.attributes = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StringEvent type. + * @member {string} type + * @memberof cosmos.base.abci.v1beta1.StringEvent + * @instance + */ + StringEvent.prototype.type = ""; + + /** + * StringEvent attributes. + * @member {Array.} attributes + * @memberof cosmos.base.abci.v1beta1.StringEvent + * @instance + */ + StringEvent.prototype.attributes = $util.emptyArray; + + /** + * Encodes the specified StringEvent message. Does not implicitly {@link cosmos.base.abci.v1beta1.StringEvent.verify|verify} messages. + * @function encode + * @memberof cosmos.base.abci.v1beta1.StringEvent + * @static + * @param {cosmos.base.abci.v1beta1.IStringEvent} message StringEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StringEvent.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.attributes != null && message.attributes.length) + for (let i = 0; i < message.attributes.length; ++i) + $root.cosmos.base.abci.v1beta1.Attribute.encode(message.attributes[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified StringEvent message, length delimited. Does not implicitly {@link cosmos.base.abci.v1beta1.StringEvent.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.abci.v1beta1.StringEvent + * @static + * @param {cosmos.base.abci.v1beta1.IStringEvent} message StringEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StringEvent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StringEvent message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.abci.v1beta1.StringEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.abci.v1beta1.StringEvent} StringEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StringEvent.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.abci.v1beta1.StringEvent(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.string(); + break; + case 2: + if (!(message.attributes && message.attributes.length)) + message.attributes = []; + message.attributes.push($root.cosmos.base.abci.v1beta1.Attribute.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StringEvent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.abci.v1beta1.StringEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.abci.v1beta1.StringEvent} StringEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StringEvent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StringEvent message. + * @function verify + * @memberof cosmos.base.abci.v1beta1.StringEvent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StringEvent.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!Array.isArray(message.attributes)) + return "attributes: array expected"; + for (let i = 0; i < message.attributes.length; ++i) { + let error = $root.cosmos.base.abci.v1beta1.Attribute.verify(message.attributes[i]); + if (error) + return "attributes." + error; + } + } + return null; + }; + + /** + * Creates a StringEvent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.abci.v1beta1.StringEvent + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.abci.v1beta1.StringEvent} StringEvent + */ + StringEvent.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.abci.v1beta1.StringEvent) + return object; + let message = new $root.cosmos.base.abci.v1beta1.StringEvent(); + if (object.type != null) + message.type = String(object.type); + if (object.attributes) { + if (!Array.isArray(object.attributes)) + throw TypeError(".cosmos.base.abci.v1beta1.StringEvent.attributes: array expected"); + message.attributes = []; + for (let i = 0; i < object.attributes.length; ++i) { + if (typeof object.attributes[i] !== "object") + throw TypeError(".cosmos.base.abci.v1beta1.StringEvent.attributes: object expected"); + message.attributes[i] = $root.cosmos.base.abci.v1beta1.Attribute.fromObject(object.attributes[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a StringEvent message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.abci.v1beta1.StringEvent + * @static + * @param {cosmos.base.abci.v1beta1.StringEvent} message StringEvent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StringEvent.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.attributes = []; + if (options.defaults) + object.type = ""; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.attributes && message.attributes.length) { + object.attributes = []; + for (let j = 0; j < message.attributes.length; ++j) + object.attributes[j] = $root.cosmos.base.abci.v1beta1.Attribute.toObject(message.attributes[j], options); + } + return object; + }; + + /** + * Converts this StringEvent to JSON. + * @function toJSON + * @memberof cosmos.base.abci.v1beta1.StringEvent + * @instance + * @returns {Object.} JSON object + */ + StringEvent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return StringEvent; + })(); + + v1beta1.Attribute = (function() { + + /** + * Properties of an Attribute. + * @memberof cosmos.base.abci.v1beta1 + * @interface IAttribute + * @property {string|null} [key] Attribute key + * @property {string|null} [value] Attribute value + */ + + /** + * Constructs a new Attribute. + * @memberof cosmos.base.abci.v1beta1 + * @classdesc Represents an Attribute. + * @implements IAttribute + * @constructor + * @param {cosmos.base.abci.v1beta1.IAttribute=} [properties] Properties to set + */ + function Attribute(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Attribute key. + * @member {string} key + * @memberof cosmos.base.abci.v1beta1.Attribute + * @instance + */ + Attribute.prototype.key = ""; + + /** + * Attribute value. + * @member {string} value + * @memberof cosmos.base.abci.v1beta1.Attribute + * @instance + */ + Attribute.prototype.value = ""; + + /** + * Encodes the specified Attribute message. Does not implicitly {@link cosmos.base.abci.v1beta1.Attribute.verify|verify} messages. + * @function encode + * @memberof cosmos.base.abci.v1beta1.Attribute + * @static + * @param {cosmos.base.abci.v1beta1.IAttribute} message Attribute message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Attribute.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); + return writer; + }; + + /** + * Encodes the specified Attribute message, length delimited. Does not implicitly {@link cosmos.base.abci.v1beta1.Attribute.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.abci.v1beta1.Attribute + * @static + * @param {cosmos.base.abci.v1beta1.IAttribute} message Attribute message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Attribute.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Attribute message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.abci.v1beta1.Attribute + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.abci.v1beta1.Attribute} Attribute + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Attribute.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.abci.v1beta1.Attribute(); + while (reader.pos < end) { + let 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; + }; + + /** + * Decodes an Attribute message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.abci.v1beta1.Attribute + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.abci.v1beta1.Attribute} Attribute + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Attribute.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Attribute message. + * @function verify + * @memberof cosmos.base.abci.v1beta1.Attribute + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Attribute.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + return null; + }; + + /** + * Creates an Attribute message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.abci.v1beta1.Attribute + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.abci.v1beta1.Attribute} Attribute + */ + Attribute.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.abci.v1beta1.Attribute) + return object; + let message = new $root.cosmos.base.abci.v1beta1.Attribute(); + if (object.key != null) + message.key = String(object.key); + if (object.value != null) + message.value = String(object.value); + return message; + }; + + /** + * Creates a plain object from an Attribute message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.abci.v1beta1.Attribute + * @static + * @param {cosmos.base.abci.v1beta1.Attribute} message Attribute + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Attribute.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.key = ""; + object.value = ""; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this Attribute to JSON. + * @function toJSON + * @memberof cosmos.base.abci.v1beta1.Attribute + * @instance + * @returns {Object.} JSON object + */ + Attribute.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Attribute; + })(); + + v1beta1.GasInfo = (function() { + + /** + * Properties of a GasInfo. + * @memberof cosmos.base.abci.v1beta1 + * @interface IGasInfo + * @property {Long|null} [gas_wanted] GasInfo gas_wanted + * @property {Long|null} [gas_used] GasInfo gas_used + */ + + /** + * Constructs a new GasInfo. + * @memberof cosmos.base.abci.v1beta1 + * @classdesc Represents a GasInfo. + * @implements IGasInfo + * @constructor + * @param {cosmos.base.abci.v1beta1.IGasInfo=} [properties] Properties to set + */ + function GasInfo(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GasInfo gas_wanted. + * @member {Long} gas_wanted + * @memberof cosmos.base.abci.v1beta1.GasInfo + * @instance + */ + GasInfo.prototype.gas_wanted = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * GasInfo gas_used. + * @member {Long} gas_used + * @memberof cosmos.base.abci.v1beta1.GasInfo + * @instance + */ + GasInfo.prototype.gas_used = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified GasInfo message. Does not implicitly {@link cosmos.base.abci.v1beta1.GasInfo.verify|verify} messages. + * @function encode + * @memberof cosmos.base.abci.v1beta1.GasInfo + * @static + * @param {cosmos.base.abci.v1beta1.IGasInfo} message GasInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GasInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gas_wanted != null && Object.hasOwnProperty.call(message, "gas_wanted")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.gas_wanted); + if (message.gas_used != null && Object.hasOwnProperty.call(message, "gas_used")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.gas_used); + return writer; + }; + + /** + * Encodes the specified GasInfo message, length delimited. Does not implicitly {@link cosmos.base.abci.v1beta1.GasInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.abci.v1beta1.GasInfo + * @static + * @param {cosmos.base.abci.v1beta1.IGasInfo} message GasInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GasInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GasInfo message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.abci.v1beta1.GasInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.abci.v1beta1.GasInfo} GasInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GasInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.abci.v1beta1.GasInfo(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gas_wanted = reader.uint64(); + break; + case 2: + message.gas_used = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GasInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.abci.v1beta1.GasInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.abci.v1beta1.GasInfo} GasInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GasInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GasInfo message. + * @function verify + * @memberof cosmos.base.abci.v1beta1.GasInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GasInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.gas_wanted != null && message.hasOwnProperty("gas_wanted")) + if (!$util.isInteger(message.gas_wanted) && !(message.gas_wanted && $util.isInteger(message.gas_wanted.low) && $util.isInteger(message.gas_wanted.high))) + return "gas_wanted: integer|Long expected"; + if (message.gas_used != null && message.hasOwnProperty("gas_used")) + if (!$util.isInteger(message.gas_used) && !(message.gas_used && $util.isInteger(message.gas_used.low) && $util.isInteger(message.gas_used.high))) + return "gas_used: integer|Long expected"; + return null; + }; + + /** + * Creates a GasInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.abci.v1beta1.GasInfo + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.abci.v1beta1.GasInfo} GasInfo + */ + GasInfo.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.abci.v1beta1.GasInfo) + return object; + let message = new $root.cosmos.base.abci.v1beta1.GasInfo(); + if (object.gas_wanted != null) + if ($util.Long) + (message.gas_wanted = $util.Long.fromValue(object.gas_wanted)).unsigned = true; + else if (typeof object.gas_wanted === "string") + message.gas_wanted = parseInt(object.gas_wanted, 10); + else if (typeof object.gas_wanted === "number") + message.gas_wanted = object.gas_wanted; + else if (typeof object.gas_wanted === "object") + message.gas_wanted = new $util.LongBits(object.gas_wanted.low >>> 0, object.gas_wanted.high >>> 0).toNumber(true); + if (object.gas_used != null) + if ($util.Long) + (message.gas_used = $util.Long.fromValue(object.gas_used)).unsigned = true; + else if (typeof object.gas_used === "string") + message.gas_used = parseInt(object.gas_used, 10); + else if (typeof object.gas_used === "number") + message.gas_used = object.gas_used; + else if (typeof object.gas_used === "object") + message.gas_used = new $util.LongBits(object.gas_used.low >>> 0, object.gas_used.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a GasInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.abci.v1beta1.GasInfo + * @static + * @param {cosmos.base.abci.v1beta1.GasInfo} message GasInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GasInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.gas_wanted = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.gas_wanted = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.gas_used = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.gas_used = options.longs === String ? "0" : 0; + } + if (message.gas_wanted != null && message.hasOwnProperty("gas_wanted")) + if (typeof message.gas_wanted === "number") + object.gas_wanted = options.longs === String ? String(message.gas_wanted) : message.gas_wanted; + else + object.gas_wanted = options.longs === String ? $util.Long.prototype.toString.call(message.gas_wanted) : options.longs === Number ? new $util.LongBits(message.gas_wanted.low >>> 0, message.gas_wanted.high >>> 0).toNumber(true) : message.gas_wanted; + if (message.gas_used != null && message.hasOwnProperty("gas_used")) + if (typeof message.gas_used === "number") + object.gas_used = options.longs === String ? String(message.gas_used) : message.gas_used; + else + object.gas_used = options.longs === String ? $util.Long.prototype.toString.call(message.gas_used) : options.longs === Number ? new $util.LongBits(message.gas_used.low >>> 0, message.gas_used.high >>> 0).toNumber(true) : message.gas_used; + return object; + }; + + /** + * Converts this GasInfo to JSON. + * @function toJSON + * @memberof cosmos.base.abci.v1beta1.GasInfo + * @instance + * @returns {Object.} JSON object + */ + GasInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GasInfo; + })(); + + v1beta1.Result = (function() { + + /** + * Properties of a Result. + * @memberof cosmos.base.abci.v1beta1 + * @interface IResult + * @property {Uint8Array|null} [data] Result data + * @property {string|null} [log] Result log + * @property {Array.|null} [events] Result events + */ + + /** + * Constructs a new Result. + * @memberof cosmos.base.abci.v1beta1 + * @classdesc Represents a Result. + * @implements IResult + * @constructor + * @param {cosmos.base.abci.v1beta1.IResult=} [properties] Properties to set + */ + function Result(properties) { + this.events = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Result data. + * @member {Uint8Array} data + * @memberof cosmos.base.abci.v1beta1.Result + * @instance + */ + Result.prototype.data = $util.newBuffer([]); + + /** + * Result log. + * @member {string} log + * @memberof cosmos.base.abci.v1beta1.Result + * @instance + */ + Result.prototype.log = ""; + + /** + * Result events. + * @member {Array.} events + * @memberof cosmos.base.abci.v1beta1.Result + * @instance + */ + Result.prototype.events = $util.emptyArray; + + /** + * Encodes the specified Result message. Does not implicitly {@link cosmos.base.abci.v1beta1.Result.verify|verify} messages. + * @function encode + * @memberof cosmos.base.abci.v1beta1.Result + * @static + * @param {cosmos.base.abci.v1beta1.IResult} message Result message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Result.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.data != null && Object.hasOwnProperty.call(message, "data")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.data); + if (message.log != null && Object.hasOwnProperty.call(message, "log")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.log); + if (message.events != null && message.events.length) + for (let i = 0; i < message.events.length; ++i) + $root.tendermint.abci.Event.encode(message.events[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Result message, length delimited. Does not implicitly {@link cosmos.base.abci.v1beta1.Result.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.abci.v1beta1.Result + * @static + * @param {cosmos.base.abci.v1beta1.IResult} message Result message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Result.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Result message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.abci.v1beta1.Result + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.abci.v1beta1.Result} Result + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Result.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.abci.v1beta1.Result(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.data = reader.bytes(); + break; + case 2: + message.log = reader.string(); + break; + case 3: + if (!(message.events && message.events.length)) + message.events = []; + message.events.push($root.tendermint.abci.Event.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Result message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.abci.v1beta1.Result + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.abci.v1beta1.Result} Result + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Result.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Result message. + * @function verify + * @memberof cosmos.base.abci.v1beta1.Result + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Result.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.data != null && message.hasOwnProperty("data")) + if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) + return "data: buffer expected"; + if (message.log != null && message.hasOwnProperty("log")) + if (!$util.isString(message.log)) + return "log: string expected"; + if (message.events != null && message.hasOwnProperty("events")) { + if (!Array.isArray(message.events)) + return "events: array expected"; + for (let i = 0; i < message.events.length; ++i) { + let error = $root.tendermint.abci.Event.verify(message.events[i]); + if (error) + return "events." + error; + } + } + return null; + }; + + /** + * Creates a Result message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.abci.v1beta1.Result + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.abci.v1beta1.Result} Result + */ + Result.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.abci.v1beta1.Result) + return object; + let message = new $root.cosmos.base.abci.v1beta1.Result(); + if (object.data != null) + if (typeof object.data === "string") + $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); + else if (object.data.length) + message.data = object.data; + if (object.log != null) + message.log = String(object.log); + if (object.events) { + if (!Array.isArray(object.events)) + throw TypeError(".cosmos.base.abci.v1beta1.Result.events: array expected"); + message.events = []; + for (let i = 0; i < object.events.length; ++i) { + if (typeof object.events[i] !== "object") + throw TypeError(".cosmos.base.abci.v1beta1.Result.events: object expected"); + message.events[i] = $root.tendermint.abci.Event.fromObject(object.events[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Result message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.abci.v1beta1.Result + * @static + * @param {cosmos.base.abci.v1beta1.Result} message Result + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Result.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.events = []; + if (options.defaults) { + if (options.bytes === String) + object.data = ""; + else { + object.data = []; + if (options.bytes !== Array) + object.data = $util.newBuffer(object.data); + } + object.log = ""; + } + if (message.data != null && message.hasOwnProperty("data")) + object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; + if (message.log != null && message.hasOwnProperty("log")) + object.log = message.log; + if (message.events && message.events.length) { + object.events = []; + for (let j = 0; j < message.events.length; ++j) + object.events[j] = $root.tendermint.abci.Event.toObject(message.events[j], options); + } + return object; + }; + + /** + * Converts this Result to JSON. + * @function toJSON + * @memberof cosmos.base.abci.v1beta1.Result + * @instance + * @returns {Object.} JSON object + */ + Result.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Result; + })(); + + v1beta1.SimulationResponse = (function() { + + /** + * Properties of a SimulationResponse. + * @memberof cosmos.base.abci.v1beta1 + * @interface ISimulationResponse + * @property {cosmos.base.abci.v1beta1.IGasInfo|null} [gas_info] SimulationResponse gas_info + * @property {cosmos.base.abci.v1beta1.IResult|null} [result] SimulationResponse result + */ + + /** + * Constructs a new SimulationResponse. + * @memberof cosmos.base.abci.v1beta1 + * @classdesc Represents a SimulationResponse. + * @implements ISimulationResponse + * @constructor + * @param {cosmos.base.abci.v1beta1.ISimulationResponse=} [properties] Properties to set + */ + function SimulationResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SimulationResponse gas_info. + * @member {cosmos.base.abci.v1beta1.IGasInfo|null|undefined} gas_info + * @memberof cosmos.base.abci.v1beta1.SimulationResponse + * @instance + */ + SimulationResponse.prototype.gas_info = null; + + /** + * SimulationResponse result. + * @member {cosmos.base.abci.v1beta1.IResult|null|undefined} result + * @memberof cosmos.base.abci.v1beta1.SimulationResponse + * @instance + */ + SimulationResponse.prototype.result = null; + + /** + * Encodes the specified SimulationResponse message. Does not implicitly {@link cosmos.base.abci.v1beta1.SimulationResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.base.abci.v1beta1.SimulationResponse + * @static + * @param {cosmos.base.abci.v1beta1.ISimulationResponse} message SimulationResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SimulationResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gas_info != null && Object.hasOwnProperty.call(message, "gas_info")) + $root.cosmos.base.abci.v1beta1.GasInfo.encode(message.gas_info, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.result != null && Object.hasOwnProperty.call(message, "result")) + $root.cosmos.base.abci.v1beta1.Result.encode(message.result, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SimulationResponse message, length delimited. Does not implicitly {@link cosmos.base.abci.v1beta1.SimulationResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.abci.v1beta1.SimulationResponse + * @static + * @param {cosmos.base.abci.v1beta1.ISimulationResponse} message SimulationResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SimulationResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SimulationResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.abci.v1beta1.SimulationResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.abci.v1beta1.SimulationResponse} SimulationResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SimulationResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.abci.v1beta1.SimulationResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gas_info = $root.cosmos.base.abci.v1beta1.GasInfo.decode(reader, reader.uint32()); + break; + case 2: + message.result = $root.cosmos.base.abci.v1beta1.Result.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SimulationResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.abci.v1beta1.SimulationResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.abci.v1beta1.SimulationResponse} SimulationResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SimulationResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SimulationResponse message. + * @function verify + * @memberof cosmos.base.abci.v1beta1.SimulationResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SimulationResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.gas_info != null && message.hasOwnProperty("gas_info")) { + let error = $root.cosmos.base.abci.v1beta1.GasInfo.verify(message.gas_info); + if (error) + return "gas_info." + error; + } + if (message.result != null && message.hasOwnProperty("result")) { + let error = $root.cosmos.base.abci.v1beta1.Result.verify(message.result); + if (error) + return "result." + error; + } + return null; + }; + + /** + * Creates a SimulationResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.abci.v1beta1.SimulationResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.abci.v1beta1.SimulationResponse} SimulationResponse + */ + SimulationResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.abci.v1beta1.SimulationResponse) + return object; + let message = new $root.cosmos.base.abci.v1beta1.SimulationResponse(); + if (object.gas_info != null) { + if (typeof object.gas_info !== "object") + throw TypeError(".cosmos.base.abci.v1beta1.SimulationResponse.gas_info: object expected"); + message.gas_info = $root.cosmos.base.abci.v1beta1.GasInfo.fromObject(object.gas_info); + } + if (object.result != null) { + if (typeof object.result !== "object") + throw TypeError(".cosmos.base.abci.v1beta1.SimulationResponse.result: object expected"); + message.result = $root.cosmos.base.abci.v1beta1.Result.fromObject(object.result); + } + return message; + }; + + /** + * Creates a plain object from a SimulationResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.abci.v1beta1.SimulationResponse + * @static + * @param {cosmos.base.abci.v1beta1.SimulationResponse} message SimulationResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SimulationResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.gas_info = null; + object.result = null; + } + if (message.gas_info != null && message.hasOwnProperty("gas_info")) + object.gas_info = $root.cosmos.base.abci.v1beta1.GasInfo.toObject(message.gas_info, options); + if (message.result != null && message.hasOwnProperty("result")) + object.result = $root.cosmos.base.abci.v1beta1.Result.toObject(message.result, options); + return object; + }; + + /** + * Converts this SimulationResponse to JSON. + * @function toJSON + * @memberof cosmos.base.abci.v1beta1.SimulationResponse + * @instance + * @returns {Object.} JSON object + */ + SimulationResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SimulationResponse; + })(); + + v1beta1.MsgData = (function() { + + /** + * Properties of a MsgData. + * @memberof cosmos.base.abci.v1beta1 + * @interface IMsgData + * @property {string|null} [msg_type] MsgData msg_type + * @property {Uint8Array|null} [data] MsgData data + */ + + /** + * Constructs a new MsgData. + * @memberof cosmos.base.abci.v1beta1 + * @classdesc Represents a MsgData. + * @implements IMsgData + * @constructor + * @param {cosmos.base.abci.v1beta1.IMsgData=} [properties] Properties to set + */ + function MsgData(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgData msg_type. + * @member {string} msg_type + * @memberof cosmos.base.abci.v1beta1.MsgData + * @instance + */ + MsgData.prototype.msg_type = ""; + + /** + * MsgData data. + * @member {Uint8Array} data + * @memberof cosmos.base.abci.v1beta1.MsgData + * @instance + */ + MsgData.prototype.data = $util.newBuffer([]); + + /** + * Encodes the specified MsgData message. Does not implicitly {@link cosmos.base.abci.v1beta1.MsgData.verify|verify} messages. + * @function encode + * @memberof cosmos.base.abci.v1beta1.MsgData + * @static + * @param {cosmos.base.abci.v1beta1.IMsgData} message MsgData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.msg_type != null && Object.hasOwnProperty.call(message, "msg_type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.msg_type); + if (message.data != null && Object.hasOwnProperty.call(message, "data")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.data); + return writer; + }; + + /** + * Encodes the specified MsgData message, length delimited. Does not implicitly {@link cosmos.base.abci.v1beta1.MsgData.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.abci.v1beta1.MsgData + * @static + * @param {cosmos.base.abci.v1beta1.IMsgData} message MsgData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgData message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.abci.v1beta1.MsgData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.abci.v1beta1.MsgData} MsgData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgData.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.abci.v1beta1.MsgData(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.msg_type = reader.string(); + break; + case 2: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.abci.v1beta1.MsgData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.abci.v1beta1.MsgData} MsgData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgData message. + * @function verify + * @memberof cosmos.base.abci.v1beta1.MsgData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.msg_type != null && message.hasOwnProperty("msg_type")) + if (!$util.isString(message.msg_type)) + return "msg_type: string expected"; + if (message.data != null && message.hasOwnProperty("data")) + if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) + return "data: buffer expected"; + return null; + }; + + /** + * Creates a MsgData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.abci.v1beta1.MsgData + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.abci.v1beta1.MsgData} MsgData + */ + MsgData.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.abci.v1beta1.MsgData) + return object; + let message = new $root.cosmos.base.abci.v1beta1.MsgData(); + if (object.msg_type != null) + message.msg_type = String(object.msg_type); + if (object.data != null) + if (typeof object.data === "string") + $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); + else if (object.data.length) + message.data = object.data; + return message; + }; + + /** + * Creates a plain object from a MsgData message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.abci.v1beta1.MsgData + * @static + * @param {cosmos.base.abci.v1beta1.MsgData} message MsgData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgData.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.msg_type = ""; + if (options.bytes === String) + object.data = ""; + else { + object.data = []; + if (options.bytes !== Array) + object.data = $util.newBuffer(object.data); + } + } + if (message.msg_type != null && message.hasOwnProperty("msg_type")) + object.msg_type = message.msg_type; + if (message.data != null && message.hasOwnProperty("data")) + object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; + return object; + }; + + /** + * Converts this MsgData to JSON. + * @function toJSON + * @memberof cosmos.base.abci.v1beta1.MsgData + * @instance + * @returns {Object.} JSON object + */ + MsgData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgData; + })(); + + v1beta1.TxMsgData = (function() { + + /** + * Properties of a TxMsgData. + * @memberof cosmos.base.abci.v1beta1 + * @interface ITxMsgData + * @property {Array.|null} [data] TxMsgData data + */ + + /** + * Constructs a new TxMsgData. + * @memberof cosmos.base.abci.v1beta1 + * @classdesc Represents a TxMsgData. + * @implements ITxMsgData + * @constructor + * @param {cosmos.base.abci.v1beta1.ITxMsgData=} [properties] Properties to set + */ + function TxMsgData(properties) { + this.data = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TxMsgData data. + * @member {Array.} data + * @memberof cosmos.base.abci.v1beta1.TxMsgData + * @instance + */ + TxMsgData.prototype.data = $util.emptyArray; + + /** + * Encodes the specified TxMsgData message. Does not implicitly {@link cosmos.base.abci.v1beta1.TxMsgData.verify|verify} messages. + * @function encode + * @memberof cosmos.base.abci.v1beta1.TxMsgData + * @static + * @param {cosmos.base.abci.v1beta1.ITxMsgData} message TxMsgData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TxMsgData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.data != null && message.data.length) + for (let i = 0; i < message.data.length; ++i) + $root.cosmos.base.abci.v1beta1.MsgData.encode(message.data[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TxMsgData message, length delimited. Does not implicitly {@link cosmos.base.abci.v1beta1.TxMsgData.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.abci.v1beta1.TxMsgData + * @static + * @param {cosmos.base.abci.v1beta1.ITxMsgData} message TxMsgData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TxMsgData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TxMsgData message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.abci.v1beta1.TxMsgData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.abci.v1beta1.TxMsgData} TxMsgData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TxMsgData.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.abci.v1beta1.TxMsgData(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.data && message.data.length)) + message.data = []; + message.data.push($root.cosmos.base.abci.v1beta1.MsgData.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TxMsgData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.abci.v1beta1.TxMsgData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.abci.v1beta1.TxMsgData} TxMsgData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TxMsgData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TxMsgData message. + * @function verify + * @memberof cosmos.base.abci.v1beta1.TxMsgData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TxMsgData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.data != null && message.hasOwnProperty("data")) { + if (!Array.isArray(message.data)) + return "data: array expected"; + for (let i = 0; i < message.data.length; ++i) { + let error = $root.cosmos.base.abci.v1beta1.MsgData.verify(message.data[i]); + if (error) + return "data." + error; + } + } + return null; + }; + + /** + * Creates a TxMsgData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.abci.v1beta1.TxMsgData + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.abci.v1beta1.TxMsgData} TxMsgData + */ + TxMsgData.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.abci.v1beta1.TxMsgData) + return object; + let message = new $root.cosmos.base.abci.v1beta1.TxMsgData(); + if (object.data) { + if (!Array.isArray(object.data)) + throw TypeError(".cosmos.base.abci.v1beta1.TxMsgData.data: array expected"); + message.data = []; + for (let i = 0; i < object.data.length; ++i) { + if (typeof object.data[i] !== "object") + throw TypeError(".cosmos.base.abci.v1beta1.TxMsgData.data: object expected"); + message.data[i] = $root.cosmos.base.abci.v1beta1.MsgData.fromObject(object.data[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a TxMsgData message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.abci.v1beta1.TxMsgData + * @static + * @param {cosmos.base.abci.v1beta1.TxMsgData} message TxMsgData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TxMsgData.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.data = []; + if (message.data && message.data.length) { + object.data = []; + for (let j = 0; j < message.data.length; ++j) + object.data[j] = $root.cosmos.base.abci.v1beta1.MsgData.toObject(message.data[j], options); + } + return object; + }; + + /** + * Converts this TxMsgData to JSON. + * @function toJSON + * @memberof cosmos.base.abci.v1beta1.TxMsgData + * @instance + * @returns {Object.} JSON object + */ + TxMsgData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TxMsgData; + })(); + + v1beta1.SearchTxsResult = (function() { + + /** + * Properties of a SearchTxsResult. + * @memberof cosmos.base.abci.v1beta1 + * @interface ISearchTxsResult + * @property {Long|null} [total_count] SearchTxsResult total_count + * @property {Long|null} [count] SearchTxsResult count + * @property {Long|null} [page_number] SearchTxsResult page_number + * @property {Long|null} [page_total] SearchTxsResult page_total + * @property {Long|null} [limit] SearchTxsResult limit + * @property {Array.|null} [txs] SearchTxsResult txs + */ + + /** + * Constructs a new SearchTxsResult. + * @memberof cosmos.base.abci.v1beta1 + * @classdesc Represents a SearchTxsResult. + * @implements ISearchTxsResult + * @constructor + * @param {cosmos.base.abci.v1beta1.ISearchTxsResult=} [properties] Properties to set + */ + function SearchTxsResult(properties) { + this.txs = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SearchTxsResult total_count. + * @member {Long} total_count + * @memberof cosmos.base.abci.v1beta1.SearchTxsResult + * @instance + */ + SearchTxsResult.prototype.total_count = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * SearchTxsResult count. + * @member {Long} count + * @memberof cosmos.base.abci.v1beta1.SearchTxsResult + * @instance + */ + SearchTxsResult.prototype.count = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * SearchTxsResult page_number. + * @member {Long} page_number + * @memberof cosmos.base.abci.v1beta1.SearchTxsResult + * @instance + */ + SearchTxsResult.prototype.page_number = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * SearchTxsResult page_total. + * @member {Long} page_total + * @memberof cosmos.base.abci.v1beta1.SearchTxsResult + * @instance + */ + SearchTxsResult.prototype.page_total = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * SearchTxsResult limit. + * @member {Long} limit + * @memberof cosmos.base.abci.v1beta1.SearchTxsResult + * @instance + */ + SearchTxsResult.prototype.limit = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * SearchTxsResult txs. + * @member {Array.} txs + * @memberof cosmos.base.abci.v1beta1.SearchTxsResult + * @instance + */ + SearchTxsResult.prototype.txs = $util.emptyArray; + + /** + * Encodes the specified SearchTxsResult message. Does not implicitly {@link cosmos.base.abci.v1beta1.SearchTxsResult.verify|verify} messages. + * @function encode + * @memberof cosmos.base.abci.v1beta1.SearchTxsResult + * @static + * @param {cosmos.base.abci.v1beta1.ISearchTxsResult} message SearchTxsResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchTxsResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.total_count != null && Object.hasOwnProperty.call(message, "total_count")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.total_count); + if (message.count != null && Object.hasOwnProperty.call(message, "count")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.count); + if (message.page_number != null && Object.hasOwnProperty.call(message, "page_number")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.page_number); + if (message.page_total != null && Object.hasOwnProperty.call(message, "page_total")) + writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.page_total); + if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) + writer.uint32(/* id 5, wireType 0 =*/40).uint64(message.limit); + if (message.txs != null && message.txs.length) + for (let i = 0; i < message.txs.length; ++i) + $root.cosmos.base.abci.v1beta1.TxResponse.encode(message.txs[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SearchTxsResult message, length delimited. Does not implicitly {@link cosmos.base.abci.v1beta1.SearchTxsResult.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.abci.v1beta1.SearchTxsResult + * @static + * @param {cosmos.base.abci.v1beta1.ISearchTxsResult} message SearchTxsResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchTxsResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SearchTxsResult message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.abci.v1beta1.SearchTxsResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.abci.v1beta1.SearchTxsResult} SearchTxsResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchTxsResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.abci.v1beta1.SearchTxsResult(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.total_count = reader.uint64(); + break; + case 2: + message.count = reader.uint64(); + break; + case 3: + message.page_number = reader.uint64(); + break; + case 4: + message.page_total = reader.uint64(); + break; + case 5: + message.limit = reader.uint64(); + break; + case 6: + if (!(message.txs && message.txs.length)) + message.txs = []; + message.txs.push($root.cosmos.base.abci.v1beta1.TxResponse.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SearchTxsResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.abci.v1beta1.SearchTxsResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.abci.v1beta1.SearchTxsResult} SearchTxsResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchTxsResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SearchTxsResult message. + * @function verify + * @memberof cosmos.base.abci.v1beta1.SearchTxsResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SearchTxsResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.total_count != null && message.hasOwnProperty("total_count")) + if (!$util.isInteger(message.total_count) && !(message.total_count && $util.isInteger(message.total_count.low) && $util.isInteger(message.total_count.high))) + return "total_count: integer|Long expected"; + if (message.count != null && message.hasOwnProperty("count")) + if (!$util.isInteger(message.count) && !(message.count && $util.isInteger(message.count.low) && $util.isInteger(message.count.high))) + return "count: integer|Long expected"; + if (message.page_number != null && message.hasOwnProperty("page_number")) + if (!$util.isInteger(message.page_number) && !(message.page_number && $util.isInteger(message.page_number.low) && $util.isInteger(message.page_number.high))) + return "page_number: integer|Long expected"; + if (message.page_total != null && message.hasOwnProperty("page_total")) + if (!$util.isInteger(message.page_total) && !(message.page_total && $util.isInteger(message.page_total.low) && $util.isInteger(message.page_total.high))) + return "page_total: integer|Long expected"; + if (message.limit != null && message.hasOwnProperty("limit")) + if (!$util.isInteger(message.limit) && !(message.limit && $util.isInteger(message.limit.low) && $util.isInteger(message.limit.high))) + return "limit: integer|Long expected"; + if (message.txs != null && message.hasOwnProperty("txs")) { + if (!Array.isArray(message.txs)) + return "txs: array expected"; + for (let i = 0; i < message.txs.length; ++i) { + let error = $root.cosmos.base.abci.v1beta1.TxResponse.verify(message.txs[i]); + if (error) + return "txs." + error; + } + } + return null; + }; + + /** + * Creates a SearchTxsResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.abci.v1beta1.SearchTxsResult + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.abci.v1beta1.SearchTxsResult} SearchTxsResult + */ + SearchTxsResult.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.abci.v1beta1.SearchTxsResult) + return object; + let message = new $root.cosmos.base.abci.v1beta1.SearchTxsResult(); + if (object.total_count != null) + if ($util.Long) + (message.total_count = $util.Long.fromValue(object.total_count)).unsigned = true; + else if (typeof object.total_count === "string") + message.total_count = parseInt(object.total_count, 10); + else if (typeof object.total_count === "number") + message.total_count = object.total_count; + else if (typeof object.total_count === "object") + message.total_count = new $util.LongBits(object.total_count.low >>> 0, object.total_count.high >>> 0).toNumber(true); + if (object.count != null) + if ($util.Long) + (message.count = $util.Long.fromValue(object.count)).unsigned = true; + else if (typeof object.count === "string") + message.count = parseInt(object.count, 10); + else if (typeof object.count === "number") + message.count = object.count; + else if (typeof object.count === "object") + message.count = new $util.LongBits(object.count.low >>> 0, object.count.high >>> 0).toNumber(true); + if (object.page_number != null) + if ($util.Long) + (message.page_number = $util.Long.fromValue(object.page_number)).unsigned = true; + else if (typeof object.page_number === "string") + message.page_number = parseInt(object.page_number, 10); + else if (typeof object.page_number === "number") + message.page_number = object.page_number; + else if (typeof object.page_number === "object") + message.page_number = new $util.LongBits(object.page_number.low >>> 0, object.page_number.high >>> 0).toNumber(true); + if (object.page_total != null) + if ($util.Long) + (message.page_total = $util.Long.fromValue(object.page_total)).unsigned = true; + else if (typeof object.page_total === "string") + message.page_total = parseInt(object.page_total, 10); + else if (typeof object.page_total === "number") + message.page_total = object.page_total; + else if (typeof object.page_total === "object") + message.page_total = new $util.LongBits(object.page_total.low >>> 0, object.page_total.high >>> 0).toNumber(true); + if (object.limit != null) + if ($util.Long) + (message.limit = $util.Long.fromValue(object.limit)).unsigned = true; + else if (typeof object.limit === "string") + message.limit = parseInt(object.limit, 10); + else if (typeof object.limit === "number") + message.limit = object.limit; + else if (typeof object.limit === "object") + message.limit = new $util.LongBits(object.limit.low >>> 0, object.limit.high >>> 0).toNumber(true); + if (object.txs) { + if (!Array.isArray(object.txs)) + throw TypeError(".cosmos.base.abci.v1beta1.SearchTxsResult.txs: array expected"); + message.txs = []; + for (let i = 0; i < object.txs.length; ++i) { + if (typeof object.txs[i] !== "object") + throw TypeError(".cosmos.base.abci.v1beta1.SearchTxsResult.txs: object expected"); + message.txs[i] = $root.cosmos.base.abci.v1beta1.TxResponse.fromObject(object.txs[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SearchTxsResult message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.abci.v1beta1.SearchTxsResult + * @static + * @param {cosmos.base.abci.v1beta1.SearchTxsResult} message SearchTxsResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchTxsResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.txs = []; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.total_count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.total_count = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.count = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.page_number = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.page_number = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.page_total = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.page_total = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.limit = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.limit = options.longs === String ? "0" : 0; + } + if (message.total_count != null && message.hasOwnProperty("total_count")) + if (typeof message.total_count === "number") + object.total_count = options.longs === String ? String(message.total_count) : message.total_count; + else + object.total_count = options.longs === String ? $util.Long.prototype.toString.call(message.total_count) : options.longs === Number ? new $util.LongBits(message.total_count.low >>> 0, message.total_count.high >>> 0).toNumber(true) : message.total_count; + if (message.count != null && message.hasOwnProperty("count")) + if (typeof message.count === "number") + object.count = options.longs === String ? String(message.count) : message.count; + else + object.count = options.longs === String ? $util.Long.prototype.toString.call(message.count) : options.longs === Number ? new $util.LongBits(message.count.low >>> 0, message.count.high >>> 0).toNumber(true) : message.count; + if (message.page_number != null && message.hasOwnProperty("page_number")) + if (typeof message.page_number === "number") + object.page_number = options.longs === String ? String(message.page_number) : message.page_number; + else + object.page_number = options.longs === String ? $util.Long.prototype.toString.call(message.page_number) : options.longs === Number ? new $util.LongBits(message.page_number.low >>> 0, message.page_number.high >>> 0).toNumber(true) : message.page_number; + if (message.page_total != null && message.hasOwnProperty("page_total")) + if (typeof message.page_total === "number") + object.page_total = options.longs === String ? String(message.page_total) : message.page_total; + else + object.page_total = options.longs === String ? $util.Long.prototype.toString.call(message.page_total) : options.longs === Number ? new $util.LongBits(message.page_total.low >>> 0, message.page_total.high >>> 0).toNumber(true) : message.page_total; + if (message.limit != null && message.hasOwnProperty("limit")) + if (typeof message.limit === "number") + object.limit = options.longs === String ? String(message.limit) : message.limit; + else + object.limit = options.longs === String ? $util.Long.prototype.toString.call(message.limit) : options.longs === Number ? new $util.LongBits(message.limit.low >>> 0, message.limit.high >>> 0).toNumber(true) : message.limit; + if (message.txs && message.txs.length) { + object.txs = []; + for (let j = 0; j < message.txs.length; ++j) + object.txs[j] = $root.cosmos.base.abci.v1beta1.TxResponse.toObject(message.txs[j], options); + } + return object; + }; + + /** + * Converts this SearchTxsResult to JSON. + * @function toJSON + * @memberof cosmos.base.abci.v1beta1.SearchTxsResult + * @instance + * @returns {Object.} JSON object + */ + SearchTxsResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SearchTxsResult; + })(); + + return v1beta1; + })(); + + return abci; + })(); + + base.kv = (function() { + + /** + * Namespace kv. + * @memberof cosmos.base + * @namespace + */ + const kv = {}; + + kv.v1beta1 = (function() { + + /** + * Namespace v1beta1. + * @memberof cosmos.base.kv + * @namespace + */ + const v1beta1 = {}; + + v1beta1.Pairs = (function() { + + /** + * Properties of a Pairs. + * @memberof cosmos.base.kv.v1beta1 + * @interface IPairs + * @property {Array.|null} [pairs] Pairs pairs + */ + + /** + * Constructs a new Pairs. + * @memberof cosmos.base.kv.v1beta1 + * @classdesc Represents a Pairs. + * @implements IPairs + * @constructor + * @param {cosmos.base.kv.v1beta1.IPairs=} [properties] Properties to set + */ + function Pairs(properties) { + this.pairs = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Pairs pairs. + * @member {Array.} pairs + * @memberof cosmos.base.kv.v1beta1.Pairs + * @instance + */ + Pairs.prototype.pairs = $util.emptyArray; + + /** + * Encodes the specified Pairs message. Does not implicitly {@link cosmos.base.kv.v1beta1.Pairs.verify|verify} messages. + * @function encode + * @memberof cosmos.base.kv.v1beta1.Pairs + * @static + * @param {cosmos.base.kv.v1beta1.IPairs} message Pairs message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Pairs.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pairs != null && message.pairs.length) + for (let i = 0; i < message.pairs.length; ++i) + $root.cosmos.base.kv.v1beta1.Pair.encode(message.pairs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Pairs message, length delimited. Does not implicitly {@link cosmos.base.kv.v1beta1.Pairs.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.kv.v1beta1.Pairs + * @static + * @param {cosmos.base.kv.v1beta1.IPairs} message Pairs message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Pairs.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Pairs message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.kv.v1beta1.Pairs + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.kv.v1beta1.Pairs} Pairs + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Pairs.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.kv.v1beta1.Pairs(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.pairs && message.pairs.length)) + message.pairs = []; + message.pairs.push($root.cosmos.base.kv.v1beta1.Pair.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Pairs message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.kv.v1beta1.Pairs + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.kv.v1beta1.Pairs} Pairs + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Pairs.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Pairs message. + * @function verify + * @memberof cosmos.base.kv.v1beta1.Pairs + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Pairs.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pairs != null && message.hasOwnProperty("pairs")) { + if (!Array.isArray(message.pairs)) + return "pairs: array expected"; + for (let i = 0; i < message.pairs.length; ++i) { + let error = $root.cosmos.base.kv.v1beta1.Pair.verify(message.pairs[i]); + if (error) + return "pairs." + error; + } + } + return null; + }; + + /** + * Creates a Pairs message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.kv.v1beta1.Pairs + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.kv.v1beta1.Pairs} Pairs + */ + Pairs.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.kv.v1beta1.Pairs) + return object; + let message = new $root.cosmos.base.kv.v1beta1.Pairs(); + if (object.pairs) { + if (!Array.isArray(object.pairs)) + throw TypeError(".cosmos.base.kv.v1beta1.Pairs.pairs: array expected"); + message.pairs = []; + for (let i = 0; i < object.pairs.length; ++i) { + if (typeof object.pairs[i] !== "object") + throw TypeError(".cosmos.base.kv.v1beta1.Pairs.pairs: object expected"); + message.pairs[i] = $root.cosmos.base.kv.v1beta1.Pair.fromObject(object.pairs[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Pairs message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.kv.v1beta1.Pairs + * @static + * @param {cosmos.base.kv.v1beta1.Pairs} message Pairs + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Pairs.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.pairs = []; + if (message.pairs && message.pairs.length) { + object.pairs = []; + for (let j = 0; j < message.pairs.length; ++j) + object.pairs[j] = $root.cosmos.base.kv.v1beta1.Pair.toObject(message.pairs[j], options); + } + return object; + }; + + /** + * Converts this Pairs to JSON. + * @function toJSON + * @memberof cosmos.base.kv.v1beta1.Pairs + * @instance + * @returns {Object.} JSON object + */ + Pairs.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Pairs; + })(); + + v1beta1.Pair = (function() { + + /** + * Properties of a Pair. + * @memberof cosmos.base.kv.v1beta1 + * @interface IPair + * @property {Uint8Array|null} [key] Pair key + * @property {Uint8Array|null} [value] Pair value + */ + + /** + * Constructs a new Pair. + * @memberof cosmos.base.kv.v1beta1 + * @classdesc Represents a Pair. + * @implements IPair + * @constructor + * @param {cosmos.base.kv.v1beta1.IPair=} [properties] Properties to set + */ + function Pair(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Pair key. + * @member {Uint8Array} key + * @memberof cosmos.base.kv.v1beta1.Pair + * @instance + */ + Pair.prototype.key = $util.newBuffer([]); + + /** + * Pair value. + * @member {Uint8Array} value + * @memberof cosmos.base.kv.v1beta1.Pair + * @instance + */ + Pair.prototype.value = $util.newBuffer([]); + + /** + * Encodes the specified Pair message. Does not implicitly {@link cosmos.base.kv.v1beta1.Pair.verify|verify} messages. + * @function encode + * @memberof cosmos.base.kv.v1beta1.Pair + * @static + * @param {cosmos.base.kv.v1beta1.IPair} message Pair message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Pair.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value); + return writer; + }; + + /** + * Encodes the specified Pair message, length delimited. Does not implicitly {@link cosmos.base.kv.v1beta1.Pair.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.kv.v1beta1.Pair + * @static + * @param {cosmos.base.kv.v1beta1.IPair} message Pair message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Pair.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Pair message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.kv.v1beta1.Pair + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.kv.v1beta1.Pair} Pair + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Pair.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.kv.v1beta1.Pair(); + while (reader.pos < end) { + let 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; + }; + + /** + * Decodes a Pair message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.kv.v1beta1.Pair + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.kv.v1beta1.Pair} Pair + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Pair.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Pair message. + * @function verify + * @memberof cosmos.base.kv.v1beta1.Pair + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Pair.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) + return "key: buffer expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) + return "value: buffer expected"; + return null; + }; + + /** + * Creates a Pair message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.kv.v1beta1.Pair + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.kv.v1beta1.Pair} Pair + */ + Pair.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.kv.v1beta1.Pair) + return object; + let message = new $root.cosmos.base.kv.v1beta1.Pair(); + if (object.key != null) + if (typeof object.key === "string") + $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); + else if (object.key.length) + message.key = object.key; + if (object.value != null) + if (typeof object.value === "string") + $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); + else if (object.value.length) + message.value = object.value; + return message; + }; + + /** + * Creates a plain object from a Pair message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.kv.v1beta1.Pair + * @static + * @param {cosmos.base.kv.v1beta1.Pair} message Pair + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Pair.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if (options.bytes === String) + object.key = ""; + else { + object.key = []; + if (options.bytes !== Array) + object.key = $util.newBuffer(object.key); + } + if (options.bytes === String) + object.value = ""; + else { + object.value = []; + if (options.bytes !== Array) + object.value = $util.newBuffer(object.value); + } + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; + return object; + }; + + /** + * Converts this Pair to JSON. + * @function toJSON + * @memberof cosmos.base.kv.v1beta1.Pair + * @instance + * @returns {Object.} JSON object + */ + Pair.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Pair; + })(); + + return v1beta1; + })(); + + return kv; + })(); + + base.query = (function() { + + /** + * Namespace query. + * @memberof cosmos.base + * @namespace + */ + const query = {}; + + query.v1beta1 = (function() { + + /** + * Namespace v1beta1. + * @memberof cosmos.base.query + * @namespace + */ + const v1beta1 = {}; + + v1beta1.PageRequest = (function() { + + /** + * Properties of a PageRequest. + * @memberof cosmos.base.query.v1beta1 + * @interface IPageRequest + * @property {Uint8Array|null} [key] PageRequest key + * @property {Long|null} [offset] PageRequest offset + * @property {Long|null} [limit] PageRequest limit + * @property {boolean|null} [count_total] PageRequest count_total + */ + + /** + * Constructs a new PageRequest. + * @memberof cosmos.base.query.v1beta1 + * @classdesc Represents a PageRequest. + * @implements IPageRequest + * @constructor + * @param {cosmos.base.query.v1beta1.IPageRequest=} [properties] Properties to set + */ + function PageRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PageRequest key. + * @member {Uint8Array} key + * @memberof cosmos.base.query.v1beta1.PageRequest + * @instance + */ + PageRequest.prototype.key = $util.newBuffer([]); + + /** + * PageRequest offset. + * @member {Long} offset + * @memberof cosmos.base.query.v1beta1.PageRequest + * @instance + */ + PageRequest.prototype.offset = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * PageRequest limit. + * @member {Long} limit + * @memberof cosmos.base.query.v1beta1.PageRequest + * @instance + */ + PageRequest.prototype.limit = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * PageRequest count_total. + * @member {boolean} count_total + * @memberof cosmos.base.query.v1beta1.PageRequest + * @instance + */ + PageRequest.prototype.count_total = false; + + /** + * Encodes the specified PageRequest message. Does not implicitly {@link cosmos.base.query.v1beta1.PageRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.base.query.v1beta1.PageRequest + * @static + * @param {cosmos.base.query.v1beta1.IPageRequest} message PageRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PageRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.offset); + if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.limit); + if (message.count_total != null && Object.hasOwnProperty.call(message, "count_total")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.count_total); + return writer; + }; + + /** + * Encodes the specified PageRequest message, length delimited. Does not implicitly {@link cosmos.base.query.v1beta1.PageRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.query.v1beta1.PageRequest + * @static + * @param {cosmos.base.query.v1beta1.IPageRequest} message PageRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PageRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PageRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.query.v1beta1.PageRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.query.v1beta1.PageRequest} PageRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PageRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.query.v1beta1.PageRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.offset = reader.uint64(); + break; + case 3: + message.limit = reader.uint64(); + break; + case 4: + message.count_total = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PageRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.query.v1beta1.PageRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.query.v1beta1.PageRequest} PageRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PageRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PageRequest message. + * @function verify + * @memberof cosmos.base.query.v1beta1.PageRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PageRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) + return "key: buffer expected"; + if (message.offset != null && message.hasOwnProperty("offset")) + if (!$util.isInteger(message.offset) && !(message.offset && $util.isInteger(message.offset.low) && $util.isInteger(message.offset.high))) + return "offset: integer|Long expected"; + if (message.limit != null && message.hasOwnProperty("limit")) + if (!$util.isInteger(message.limit) && !(message.limit && $util.isInteger(message.limit.low) && $util.isInteger(message.limit.high))) + return "limit: integer|Long expected"; + if (message.count_total != null && message.hasOwnProperty("count_total")) + if (typeof message.count_total !== "boolean") + return "count_total: boolean expected"; + return null; + }; + + /** + * Creates a PageRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.query.v1beta1.PageRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.query.v1beta1.PageRequest} PageRequest + */ + PageRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.query.v1beta1.PageRequest) + return object; + let message = new $root.cosmos.base.query.v1beta1.PageRequest(); + if (object.key != null) + if (typeof object.key === "string") + $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); + else if (object.key.length) + message.key = object.key; + if (object.offset != null) + if ($util.Long) + (message.offset = $util.Long.fromValue(object.offset)).unsigned = true; + else if (typeof object.offset === "string") + message.offset = parseInt(object.offset, 10); + else if (typeof object.offset === "number") + message.offset = object.offset; + else if (typeof object.offset === "object") + message.offset = new $util.LongBits(object.offset.low >>> 0, object.offset.high >>> 0).toNumber(true); + if (object.limit != null) + if ($util.Long) + (message.limit = $util.Long.fromValue(object.limit)).unsigned = true; + else if (typeof object.limit === "string") + message.limit = parseInt(object.limit, 10); + else if (typeof object.limit === "number") + message.limit = object.limit; + else if (typeof object.limit === "object") + message.limit = new $util.LongBits(object.limit.low >>> 0, object.limit.high >>> 0).toNumber(true); + if (object.count_total != null) + message.count_total = Boolean(object.count_total); + return message; + }; + + /** + * Creates a plain object from a PageRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.query.v1beta1.PageRequest + * @static + * @param {cosmos.base.query.v1beta1.PageRequest} message PageRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PageRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if (options.bytes === String) + object.key = ""; + else { + object.key = []; + if (options.bytes !== Array) + object.key = $util.newBuffer(object.key); + } + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.offset = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.offset = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.limit = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.limit = options.longs === String ? "0" : 0; + object.count_total = false; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; + if (message.offset != null && message.hasOwnProperty("offset")) + if (typeof message.offset === "number") + object.offset = options.longs === String ? String(message.offset) : message.offset; + else + object.offset = options.longs === String ? $util.Long.prototype.toString.call(message.offset) : options.longs === Number ? new $util.LongBits(message.offset.low >>> 0, message.offset.high >>> 0).toNumber(true) : message.offset; + if (message.limit != null && message.hasOwnProperty("limit")) + if (typeof message.limit === "number") + object.limit = options.longs === String ? String(message.limit) : message.limit; + else + object.limit = options.longs === String ? $util.Long.prototype.toString.call(message.limit) : options.longs === Number ? new $util.LongBits(message.limit.low >>> 0, message.limit.high >>> 0).toNumber(true) : message.limit; + if (message.count_total != null && message.hasOwnProperty("count_total")) + object.count_total = message.count_total; + return object; + }; + + /** + * Converts this PageRequest to JSON. + * @function toJSON + * @memberof cosmos.base.query.v1beta1.PageRequest + * @instance + * @returns {Object.} JSON object + */ + PageRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PageRequest; + })(); + + v1beta1.PageResponse = (function() { + + /** + * Properties of a PageResponse. + * @memberof cosmos.base.query.v1beta1 + * @interface IPageResponse + * @property {Uint8Array|null} [next_key] PageResponse next_key + * @property {Long|null} [total] PageResponse total + */ + + /** + * Constructs a new PageResponse. + * @memberof cosmos.base.query.v1beta1 + * @classdesc Represents a PageResponse. + * @implements IPageResponse + * @constructor + * @param {cosmos.base.query.v1beta1.IPageResponse=} [properties] Properties to set + */ + function PageResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PageResponse next_key. + * @member {Uint8Array} next_key + * @memberof cosmos.base.query.v1beta1.PageResponse + * @instance + */ + PageResponse.prototype.next_key = $util.newBuffer([]); + + /** + * PageResponse total. + * @member {Long} total + * @memberof cosmos.base.query.v1beta1.PageResponse + * @instance + */ + PageResponse.prototype.total = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified PageResponse message. Does not implicitly {@link cosmos.base.query.v1beta1.PageResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.base.query.v1beta1.PageResponse + * @static + * @param {cosmos.base.query.v1beta1.IPageResponse} message PageResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PageResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.next_key != null && Object.hasOwnProperty.call(message, "next_key")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.next_key); + if (message.total != null && Object.hasOwnProperty.call(message, "total")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.total); + return writer; + }; + + /** + * Encodes the specified PageResponse message, length delimited. Does not implicitly {@link cosmos.base.query.v1beta1.PageResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.query.v1beta1.PageResponse + * @static + * @param {cosmos.base.query.v1beta1.IPageResponse} message PageResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PageResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PageResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.query.v1beta1.PageResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.query.v1beta1.PageResponse} PageResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PageResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.query.v1beta1.PageResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.next_key = reader.bytes(); + break; + case 2: + message.total = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PageResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.query.v1beta1.PageResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.query.v1beta1.PageResponse} PageResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PageResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PageResponse message. + * @function verify + * @memberof cosmos.base.query.v1beta1.PageResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PageResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.next_key != null && message.hasOwnProperty("next_key")) + if (!(message.next_key && typeof message.next_key.length === "number" || $util.isString(message.next_key))) + return "next_key: buffer expected"; + if (message.total != null && message.hasOwnProperty("total")) + if (!$util.isInteger(message.total) && !(message.total && $util.isInteger(message.total.low) && $util.isInteger(message.total.high))) + return "total: integer|Long expected"; + return null; + }; + + /** + * Creates a PageResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.query.v1beta1.PageResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.query.v1beta1.PageResponse} PageResponse + */ + PageResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.query.v1beta1.PageResponse) + return object; + let message = new $root.cosmos.base.query.v1beta1.PageResponse(); + if (object.next_key != null) + if (typeof object.next_key === "string") + $util.base64.decode(object.next_key, message.next_key = $util.newBuffer($util.base64.length(object.next_key)), 0); + else if (object.next_key.length) + message.next_key = object.next_key; + if (object.total != null) + if ($util.Long) + (message.total = $util.Long.fromValue(object.total)).unsigned = true; + else if (typeof object.total === "string") + message.total = parseInt(object.total, 10); + else if (typeof object.total === "number") + message.total = object.total; + else if (typeof object.total === "object") + message.total = new $util.LongBits(object.total.low >>> 0, object.total.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a PageResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.query.v1beta1.PageResponse + * @static + * @param {cosmos.base.query.v1beta1.PageResponse} message PageResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PageResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if (options.bytes === String) + object.next_key = ""; + else { + object.next_key = []; + if (options.bytes !== Array) + object.next_key = $util.newBuffer(object.next_key); + } + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.total = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.total = options.longs === String ? "0" : 0; + } + if (message.next_key != null && message.hasOwnProperty("next_key")) + object.next_key = options.bytes === String ? $util.base64.encode(message.next_key, 0, message.next_key.length) : options.bytes === Array ? Array.prototype.slice.call(message.next_key) : message.next_key; + if (message.total != null && message.hasOwnProperty("total")) + if (typeof message.total === "number") + object.total = options.longs === String ? String(message.total) : message.total; + else + object.total = options.longs === String ? $util.Long.prototype.toString.call(message.total) : options.longs === Number ? new $util.LongBits(message.total.low >>> 0, message.total.high >>> 0).toNumber(true) : message.total; + return object; + }; + + /** + * Converts this PageResponse to JSON. + * @function toJSON + * @memberof cosmos.base.query.v1beta1.PageResponse + * @instance + * @returns {Object.} JSON object + */ + PageResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PageResponse; + })(); + + return v1beta1; + })(); + + return query; + })(); + + base.reflection = (function() { + + /** + * Namespace reflection. + * @memberof cosmos.base + * @namespace + */ + const reflection = {}; + + reflection.v1beta1 = (function() { + + /** + * Namespace v1beta1. + * @memberof cosmos.base.reflection + * @namespace + */ + const v1beta1 = {}; + + v1beta1.ReflectionService = (function() { + + /** + * Constructs a new ReflectionService service. + * @memberof cosmos.base.reflection.v1beta1 + * @classdesc Represents a ReflectionService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function ReflectionService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (ReflectionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ReflectionService; + + /** + * Callback as used by {@link cosmos.base.reflection.v1beta1.ReflectionService#listAllInterfaces}. + * @memberof cosmos.base.reflection.v1beta1.ReflectionService + * @typedef ListAllInterfacesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.base.reflection.v1beta1.ListAllInterfacesResponse} [response] ListAllInterfacesResponse + */ + + /** + * Calls ListAllInterfaces. + * @function listAllInterfaces + * @memberof cosmos.base.reflection.v1beta1.ReflectionService + * @instance + * @param {cosmos.base.reflection.v1beta1.IListAllInterfacesRequest} request ListAllInterfacesRequest message or plain object + * @param {cosmos.base.reflection.v1beta1.ReflectionService.ListAllInterfacesCallback} callback Node-style callback called with the error, if any, and ListAllInterfacesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ReflectionService.prototype.listAllInterfaces = function listAllInterfaces(request, callback) { + return this.rpcCall(listAllInterfaces, $root.cosmos.base.reflection.v1beta1.ListAllInterfacesRequest, $root.cosmos.base.reflection.v1beta1.ListAllInterfacesResponse, request, callback); + }, "name", { value: "ListAllInterfaces" }); + + /** + * Calls ListAllInterfaces. + * @function listAllInterfaces + * @memberof cosmos.base.reflection.v1beta1.ReflectionService + * @instance + * @param {cosmos.base.reflection.v1beta1.IListAllInterfacesRequest} request ListAllInterfacesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.base.reflection.v1beta1.ReflectionService#listImplementations}. + * @memberof cosmos.base.reflection.v1beta1.ReflectionService + * @typedef ListImplementationsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.base.reflection.v1beta1.ListImplementationsResponse} [response] ListImplementationsResponse + */ + + /** + * Calls ListImplementations. + * @function listImplementations + * @memberof cosmos.base.reflection.v1beta1.ReflectionService + * @instance + * @param {cosmos.base.reflection.v1beta1.IListImplementationsRequest} request ListImplementationsRequest message or plain object + * @param {cosmos.base.reflection.v1beta1.ReflectionService.ListImplementationsCallback} callback Node-style callback called with the error, if any, and ListImplementationsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ReflectionService.prototype.listImplementations = function listImplementations(request, callback) { + return this.rpcCall(listImplementations, $root.cosmos.base.reflection.v1beta1.ListImplementationsRequest, $root.cosmos.base.reflection.v1beta1.ListImplementationsResponse, request, callback); + }, "name", { value: "ListImplementations" }); + + /** + * Calls ListImplementations. + * @function listImplementations + * @memberof cosmos.base.reflection.v1beta1.ReflectionService + * @instance + * @param {cosmos.base.reflection.v1beta1.IListImplementationsRequest} request ListImplementationsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return ReflectionService; + })(); + + v1beta1.ListAllInterfacesRequest = (function() { + + /** + * Properties of a ListAllInterfacesRequest. + * @memberof cosmos.base.reflection.v1beta1 + * @interface IListAllInterfacesRequest + */ + + /** + * Constructs a new ListAllInterfacesRequest. + * @memberof cosmos.base.reflection.v1beta1 + * @classdesc Represents a ListAllInterfacesRequest. + * @implements IListAllInterfacesRequest + * @constructor + * @param {cosmos.base.reflection.v1beta1.IListAllInterfacesRequest=} [properties] Properties to set + */ + function ListAllInterfacesRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified ListAllInterfacesRequest message. Does not implicitly {@link cosmos.base.reflection.v1beta1.ListAllInterfacesRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesRequest + * @static + * @param {cosmos.base.reflection.v1beta1.IListAllInterfacesRequest} message ListAllInterfacesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListAllInterfacesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified ListAllInterfacesRequest message, length delimited. Does not implicitly {@link cosmos.base.reflection.v1beta1.ListAllInterfacesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesRequest + * @static + * @param {cosmos.base.reflection.v1beta1.IListAllInterfacesRequest} message ListAllInterfacesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListAllInterfacesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListAllInterfacesRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.reflection.v1beta1.ListAllInterfacesRequest} ListAllInterfacesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListAllInterfacesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.reflection.v1beta1.ListAllInterfacesRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListAllInterfacesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.reflection.v1beta1.ListAllInterfacesRequest} ListAllInterfacesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListAllInterfacesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListAllInterfacesRequest message. + * @function verify + * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListAllInterfacesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a ListAllInterfacesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.reflection.v1beta1.ListAllInterfacesRequest} ListAllInterfacesRequest + */ + ListAllInterfacesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.reflection.v1beta1.ListAllInterfacesRequest) + return object; + return new $root.cosmos.base.reflection.v1beta1.ListAllInterfacesRequest(); + }; + + /** + * Creates a plain object from a ListAllInterfacesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesRequest + * @static + * @param {cosmos.base.reflection.v1beta1.ListAllInterfacesRequest} message ListAllInterfacesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListAllInterfacesRequest.toObject = function toObject() { + return {}; + }; + + /** + * Converts this ListAllInterfacesRequest to JSON. + * @function toJSON + * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesRequest + * @instance + * @returns {Object.} JSON object + */ + ListAllInterfacesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListAllInterfacesRequest; + })(); + + v1beta1.ListAllInterfacesResponse = (function() { + + /** + * Properties of a ListAllInterfacesResponse. + * @memberof cosmos.base.reflection.v1beta1 + * @interface IListAllInterfacesResponse + * @property {Array.|null} [interface_names] ListAllInterfacesResponse interface_names + */ + + /** + * Constructs a new ListAllInterfacesResponse. + * @memberof cosmos.base.reflection.v1beta1 + * @classdesc Represents a ListAllInterfacesResponse. + * @implements IListAllInterfacesResponse + * @constructor + * @param {cosmos.base.reflection.v1beta1.IListAllInterfacesResponse=} [properties] Properties to set + */ + function ListAllInterfacesResponse(properties) { + this.interface_names = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListAllInterfacesResponse interface_names. + * @member {Array.} interface_names + * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesResponse + * @instance + */ + ListAllInterfacesResponse.prototype.interface_names = $util.emptyArray; + + /** + * Encodes the specified ListAllInterfacesResponse message. Does not implicitly {@link cosmos.base.reflection.v1beta1.ListAllInterfacesResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesResponse + * @static + * @param {cosmos.base.reflection.v1beta1.IListAllInterfacesResponse} message ListAllInterfacesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListAllInterfacesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.interface_names != null && message.interface_names.length) + for (let i = 0; i < message.interface_names.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.interface_names[i]); + return writer; + }; + + /** + * Encodes the specified ListAllInterfacesResponse message, length delimited. Does not implicitly {@link cosmos.base.reflection.v1beta1.ListAllInterfacesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesResponse + * @static + * @param {cosmos.base.reflection.v1beta1.IListAllInterfacesResponse} message ListAllInterfacesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListAllInterfacesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListAllInterfacesResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.reflection.v1beta1.ListAllInterfacesResponse} ListAllInterfacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListAllInterfacesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.reflection.v1beta1.ListAllInterfacesResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.interface_names && message.interface_names.length)) + message.interface_names = []; + message.interface_names.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListAllInterfacesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.reflection.v1beta1.ListAllInterfacesResponse} ListAllInterfacesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListAllInterfacesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListAllInterfacesResponse message. + * @function verify + * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListAllInterfacesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.interface_names != null && message.hasOwnProperty("interface_names")) { + if (!Array.isArray(message.interface_names)) + return "interface_names: array expected"; + for (let i = 0; i < message.interface_names.length; ++i) + if (!$util.isString(message.interface_names[i])) + return "interface_names: string[] expected"; + } + return null; + }; + + /** + * Creates a ListAllInterfacesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.reflection.v1beta1.ListAllInterfacesResponse} ListAllInterfacesResponse + */ + ListAllInterfacesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.reflection.v1beta1.ListAllInterfacesResponse) + return object; + let message = new $root.cosmos.base.reflection.v1beta1.ListAllInterfacesResponse(); + if (object.interface_names) { + if (!Array.isArray(object.interface_names)) + throw TypeError(".cosmos.base.reflection.v1beta1.ListAllInterfacesResponse.interface_names: array expected"); + message.interface_names = []; + for (let i = 0; i < object.interface_names.length; ++i) + message.interface_names[i] = String(object.interface_names[i]); + } + return message; + }; + + /** + * Creates a plain object from a ListAllInterfacesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesResponse + * @static + * @param {cosmos.base.reflection.v1beta1.ListAllInterfacesResponse} message ListAllInterfacesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListAllInterfacesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.interface_names = []; + if (message.interface_names && message.interface_names.length) { + object.interface_names = []; + for (let j = 0; j < message.interface_names.length; ++j) + object.interface_names[j] = message.interface_names[j]; + } + return object; + }; + + /** + * Converts this ListAllInterfacesResponse to JSON. + * @function toJSON + * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesResponse + * @instance + * @returns {Object.} JSON object + */ + ListAllInterfacesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListAllInterfacesResponse; + })(); + + v1beta1.ListImplementationsRequest = (function() { + + /** + * Properties of a ListImplementationsRequest. + * @memberof cosmos.base.reflection.v1beta1 + * @interface IListImplementationsRequest + * @property {string|null} [interface_name] ListImplementationsRequest interface_name + */ + + /** + * Constructs a new ListImplementationsRequest. + * @memberof cosmos.base.reflection.v1beta1 + * @classdesc Represents a ListImplementationsRequest. + * @implements IListImplementationsRequest + * @constructor + * @param {cosmos.base.reflection.v1beta1.IListImplementationsRequest=} [properties] Properties to set + */ + function ListImplementationsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListImplementationsRequest interface_name. + * @member {string} interface_name + * @memberof cosmos.base.reflection.v1beta1.ListImplementationsRequest + * @instance + */ + ListImplementationsRequest.prototype.interface_name = ""; + + /** + * Encodes the specified ListImplementationsRequest message. Does not implicitly {@link cosmos.base.reflection.v1beta1.ListImplementationsRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.base.reflection.v1beta1.ListImplementationsRequest + * @static + * @param {cosmos.base.reflection.v1beta1.IListImplementationsRequest} message ListImplementationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListImplementationsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.interface_name != null && Object.hasOwnProperty.call(message, "interface_name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.interface_name); + return writer; + }; + + /** + * Encodes the specified ListImplementationsRequest message, length delimited. Does not implicitly {@link cosmos.base.reflection.v1beta1.ListImplementationsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.reflection.v1beta1.ListImplementationsRequest + * @static + * @param {cosmos.base.reflection.v1beta1.IListImplementationsRequest} message ListImplementationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListImplementationsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListImplementationsRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.reflection.v1beta1.ListImplementationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.reflection.v1beta1.ListImplementationsRequest} ListImplementationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListImplementationsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.reflection.v1beta1.ListImplementationsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.interface_name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListImplementationsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.reflection.v1beta1.ListImplementationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.reflection.v1beta1.ListImplementationsRequest} ListImplementationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListImplementationsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListImplementationsRequest message. + * @function verify + * @memberof cosmos.base.reflection.v1beta1.ListImplementationsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListImplementationsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.interface_name != null && message.hasOwnProperty("interface_name")) + if (!$util.isString(message.interface_name)) + return "interface_name: string expected"; + return null; + }; + + /** + * Creates a ListImplementationsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.reflection.v1beta1.ListImplementationsRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.reflection.v1beta1.ListImplementationsRequest} ListImplementationsRequest + */ + ListImplementationsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.reflection.v1beta1.ListImplementationsRequest) + return object; + let message = new $root.cosmos.base.reflection.v1beta1.ListImplementationsRequest(); + if (object.interface_name != null) + message.interface_name = String(object.interface_name); + return message; + }; + + /** + * Creates a plain object from a ListImplementationsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.reflection.v1beta1.ListImplementationsRequest + * @static + * @param {cosmos.base.reflection.v1beta1.ListImplementationsRequest} message ListImplementationsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListImplementationsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.interface_name = ""; + if (message.interface_name != null && message.hasOwnProperty("interface_name")) + object.interface_name = message.interface_name; + return object; + }; + + /** + * Converts this ListImplementationsRequest to JSON. + * @function toJSON + * @memberof cosmos.base.reflection.v1beta1.ListImplementationsRequest + * @instance + * @returns {Object.} JSON object + */ + ListImplementationsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListImplementationsRequest; + })(); + + v1beta1.ListImplementationsResponse = (function() { + + /** + * Properties of a ListImplementationsResponse. + * @memberof cosmos.base.reflection.v1beta1 + * @interface IListImplementationsResponse + * @property {Array.|null} [implementation_message_names] ListImplementationsResponse implementation_message_names + */ + + /** + * Constructs a new ListImplementationsResponse. + * @memberof cosmos.base.reflection.v1beta1 + * @classdesc Represents a ListImplementationsResponse. + * @implements IListImplementationsResponse + * @constructor + * @param {cosmos.base.reflection.v1beta1.IListImplementationsResponse=} [properties] Properties to set + */ + function ListImplementationsResponse(properties) { + this.implementation_message_names = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListImplementationsResponse implementation_message_names. + * @member {Array.} implementation_message_names + * @memberof cosmos.base.reflection.v1beta1.ListImplementationsResponse + * @instance + */ + ListImplementationsResponse.prototype.implementation_message_names = $util.emptyArray; + + /** + * Encodes the specified ListImplementationsResponse message. Does not implicitly {@link cosmos.base.reflection.v1beta1.ListImplementationsResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.base.reflection.v1beta1.ListImplementationsResponse + * @static + * @param {cosmos.base.reflection.v1beta1.IListImplementationsResponse} message ListImplementationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListImplementationsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.implementation_message_names != null && message.implementation_message_names.length) + for (let i = 0; i < message.implementation_message_names.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.implementation_message_names[i]); + return writer; + }; + + /** + * Encodes the specified ListImplementationsResponse message, length delimited. Does not implicitly {@link cosmos.base.reflection.v1beta1.ListImplementationsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.reflection.v1beta1.ListImplementationsResponse + * @static + * @param {cosmos.base.reflection.v1beta1.IListImplementationsResponse} message ListImplementationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListImplementationsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListImplementationsResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.reflection.v1beta1.ListImplementationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.reflection.v1beta1.ListImplementationsResponse} ListImplementationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListImplementationsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.reflection.v1beta1.ListImplementationsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.implementation_message_names && message.implementation_message_names.length)) + message.implementation_message_names = []; + message.implementation_message_names.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListImplementationsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.reflection.v1beta1.ListImplementationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.reflection.v1beta1.ListImplementationsResponse} ListImplementationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListImplementationsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListImplementationsResponse message. + * @function verify + * @memberof cosmos.base.reflection.v1beta1.ListImplementationsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListImplementationsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.implementation_message_names != null && message.hasOwnProperty("implementation_message_names")) { + if (!Array.isArray(message.implementation_message_names)) + return "implementation_message_names: array expected"; + for (let i = 0; i < message.implementation_message_names.length; ++i) + if (!$util.isString(message.implementation_message_names[i])) + return "implementation_message_names: string[] expected"; + } + return null; + }; + + /** + * Creates a ListImplementationsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.reflection.v1beta1.ListImplementationsResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.reflection.v1beta1.ListImplementationsResponse} ListImplementationsResponse + */ + ListImplementationsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.reflection.v1beta1.ListImplementationsResponse) + return object; + let message = new $root.cosmos.base.reflection.v1beta1.ListImplementationsResponse(); + if (object.implementation_message_names) { + if (!Array.isArray(object.implementation_message_names)) + throw TypeError(".cosmos.base.reflection.v1beta1.ListImplementationsResponse.implementation_message_names: array expected"); + message.implementation_message_names = []; + for (let i = 0; i < object.implementation_message_names.length; ++i) + message.implementation_message_names[i] = String(object.implementation_message_names[i]); + } + return message; + }; + + /** + * Creates a plain object from a ListImplementationsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.reflection.v1beta1.ListImplementationsResponse + * @static + * @param {cosmos.base.reflection.v1beta1.ListImplementationsResponse} message ListImplementationsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListImplementationsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.implementation_message_names = []; + if (message.implementation_message_names && message.implementation_message_names.length) { + object.implementation_message_names = []; + for (let j = 0; j < message.implementation_message_names.length; ++j) + object.implementation_message_names[j] = message.implementation_message_names[j]; + } + return object; + }; + + /** + * Converts this ListImplementationsResponse to JSON. + * @function toJSON + * @memberof cosmos.base.reflection.v1beta1.ListImplementationsResponse + * @instance + * @returns {Object.} JSON object + */ + ListImplementationsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListImplementationsResponse; + })(); + + return v1beta1; + })(); + + return reflection; + })(); + + base.snapshots = (function() { + + /** + * Namespace snapshots. + * @memberof cosmos.base + * @namespace + */ + const snapshots = {}; + + snapshots.v1beta1 = (function() { + + /** + * Namespace v1beta1. + * @memberof cosmos.base.snapshots + * @namespace + */ + const v1beta1 = {}; + + v1beta1.Snapshot = (function() { + + /** + * Properties of a Snapshot. + * @memberof cosmos.base.snapshots.v1beta1 + * @interface ISnapshot + * @property {Long|null} [height] Snapshot height + * @property {number|null} [format] Snapshot format + * @property {number|null} [chunks] Snapshot chunks + * @property {Uint8Array|null} [hash] Snapshot hash + * @property {cosmos.base.snapshots.v1beta1.IMetadata|null} [metadata] Snapshot metadata + */ + + /** + * Constructs a new Snapshot. + * @memberof cosmos.base.snapshots.v1beta1 + * @classdesc Represents a Snapshot. + * @implements ISnapshot + * @constructor + * @param {cosmos.base.snapshots.v1beta1.ISnapshot=} [properties] Properties to set + */ + function Snapshot(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Snapshot height. + * @member {Long} height + * @memberof cosmos.base.snapshots.v1beta1.Snapshot + * @instance + */ + Snapshot.prototype.height = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Snapshot format. + * @member {number} format + * @memberof cosmos.base.snapshots.v1beta1.Snapshot + * @instance + */ + Snapshot.prototype.format = 0; + + /** + * Snapshot chunks. + * @member {number} chunks + * @memberof cosmos.base.snapshots.v1beta1.Snapshot + * @instance + */ + Snapshot.prototype.chunks = 0; + + /** + * Snapshot hash. + * @member {Uint8Array} hash + * @memberof cosmos.base.snapshots.v1beta1.Snapshot + * @instance + */ + Snapshot.prototype.hash = $util.newBuffer([]); + + /** + * Snapshot metadata. + * @member {cosmos.base.snapshots.v1beta1.IMetadata|null|undefined} metadata + * @memberof cosmos.base.snapshots.v1beta1.Snapshot + * @instance + */ + Snapshot.prototype.metadata = null; + + /** + * Encodes the specified Snapshot message. Does not implicitly {@link cosmos.base.snapshots.v1beta1.Snapshot.verify|verify} messages. + * @function encode + * @memberof cosmos.base.snapshots.v1beta1.Snapshot + * @static + * @param {cosmos.base.snapshots.v1beta1.ISnapshot} message Snapshot message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Snapshot.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.height); + if (message.format != null && Object.hasOwnProperty.call(message, "format")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.format); + if (message.chunks != null && Object.hasOwnProperty.call(message, "chunks")) + writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.chunks); + if (message.hash != null && Object.hasOwnProperty.call(message, "hash")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.hash); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.cosmos.base.snapshots.v1beta1.Metadata.encode(message.metadata, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Snapshot message, length delimited. Does not implicitly {@link cosmos.base.snapshots.v1beta1.Snapshot.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.snapshots.v1beta1.Snapshot + * @static + * @param {cosmos.base.snapshots.v1beta1.ISnapshot} message Snapshot message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Snapshot.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Snapshot message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.snapshots.v1beta1.Snapshot + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.snapshots.v1beta1.Snapshot} Snapshot + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Snapshot.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.snapshots.v1beta1.Snapshot(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.uint64(); + break; + case 2: + message.format = reader.uint32(); + break; + case 3: + message.chunks = reader.uint32(); + break; + case 4: + message.hash = reader.bytes(); + break; + case 5: + message.metadata = $root.cosmos.base.snapshots.v1beta1.Metadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Snapshot message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.snapshots.v1beta1.Snapshot + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.snapshots.v1beta1.Snapshot} Snapshot + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Snapshot.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Snapshot message. + * @function verify + * @memberof cosmos.base.snapshots.v1beta1.Snapshot + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Snapshot.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) + return "height: integer|Long expected"; + if (message.format != null && message.hasOwnProperty("format")) + if (!$util.isInteger(message.format)) + return "format: integer expected"; + if (message.chunks != null && message.hasOwnProperty("chunks")) + if (!$util.isInteger(message.chunks)) + return "chunks: integer expected"; + if (message.hash != null && message.hasOwnProperty("hash")) + if (!(message.hash && typeof message.hash.length === "number" || $util.isString(message.hash))) + return "hash: buffer expected"; + if (message.metadata != null && message.hasOwnProperty("metadata")) { + let error = $root.cosmos.base.snapshots.v1beta1.Metadata.verify(message.metadata); + if (error) + return "metadata." + error; + } + return null; + }; + + /** + * Creates a Snapshot message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.snapshots.v1beta1.Snapshot + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.snapshots.v1beta1.Snapshot} Snapshot + */ + Snapshot.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.snapshots.v1beta1.Snapshot) + return object; + let message = new $root.cosmos.base.snapshots.v1beta1.Snapshot(); + if (object.height != null) + if ($util.Long) + (message.height = $util.Long.fromValue(object.height)).unsigned = true; + else if (typeof object.height === "string") + message.height = parseInt(object.height, 10); + else if (typeof object.height === "number") + message.height = object.height; + else if (typeof object.height === "object") + message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(true); + if (object.format != null) + message.format = object.format >>> 0; + if (object.chunks != null) + message.chunks = object.chunks >>> 0; + if (object.hash != null) + if (typeof object.hash === "string") + $util.base64.decode(object.hash, message.hash = $util.newBuffer($util.base64.length(object.hash)), 0); + else if (object.hash.length) + message.hash = object.hash; + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".cosmos.base.snapshots.v1beta1.Snapshot.metadata: object expected"); + message.metadata = $root.cosmos.base.snapshots.v1beta1.Metadata.fromObject(object.metadata); + } + return message; + }; + + /** + * Creates a plain object from a Snapshot message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.snapshots.v1beta1.Snapshot + * @static + * @param {cosmos.base.snapshots.v1beta1.Snapshot} message Snapshot + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Snapshot.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.height = options.longs === String ? "0" : 0; + object.format = 0; + object.chunks = 0; + if (options.bytes === String) + object.hash = ""; + else { + object.hash = []; + if (options.bytes !== Array) + object.hash = $util.newBuffer(object.hash); + } + object.metadata = null; + } + if (message.height != null && message.hasOwnProperty("height")) + if (typeof message.height === "number") + object.height = options.longs === String ? String(message.height) : message.height; + else + object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber(true) : message.height; + if (message.format != null && message.hasOwnProperty("format")) + object.format = message.format; + if (message.chunks != null && message.hasOwnProperty("chunks")) + object.chunks = message.chunks; + if (message.hash != null && message.hasOwnProperty("hash")) + object.hash = options.bytes === String ? $util.base64.encode(message.hash, 0, message.hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.hash) : message.hash; + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.cosmos.base.snapshots.v1beta1.Metadata.toObject(message.metadata, options); + return object; + }; + + /** + * Converts this Snapshot to JSON. + * @function toJSON + * @memberof cosmos.base.snapshots.v1beta1.Snapshot + * @instance + * @returns {Object.} JSON object + */ + Snapshot.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Snapshot; + })(); + + v1beta1.Metadata = (function() { + + /** + * Properties of a Metadata. + * @memberof cosmos.base.snapshots.v1beta1 + * @interface IMetadata + * @property {Array.|null} [chunk_hashes] Metadata chunk_hashes + */ + + /** + * Constructs a new Metadata. + * @memberof cosmos.base.snapshots.v1beta1 + * @classdesc Represents a Metadata. + * @implements IMetadata + * @constructor + * @param {cosmos.base.snapshots.v1beta1.IMetadata=} [properties] Properties to set + */ + function Metadata(properties) { + this.chunk_hashes = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Metadata chunk_hashes. + * @member {Array.} chunk_hashes + * @memberof cosmos.base.snapshots.v1beta1.Metadata + * @instance + */ + Metadata.prototype.chunk_hashes = $util.emptyArray; + + /** + * Encodes the specified Metadata message. Does not implicitly {@link cosmos.base.snapshots.v1beta1.Metadata.verify|verify} messages. + * @function encode + * @memberof cosmos.base.snapshots.v1beta1.Metadata + * @static + * @param {cosmos.base.snapshots.v1beta1.IMetadata} message Metadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Metadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.chunk_hashes != null && message.chunk_hashes.length) + for (let i = 0; i < message.chunk_hashes.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.chunk_hashes[i]); + return writer; + }; + + /** + * Encodes the specified Metadata message, length delimited. Does not implicitly {@link cosmos.base.snapshots.v1beta1.Metadata.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.snapshots.v1beta1.Metadata + * @static + * @param {cosmos.base.snapshots.v1beta1.IMetadata} message Metadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Metadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Metadata message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.snapshots.v1beta1.Metadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.snapshots.v1beta1.Metadata} Metadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Metadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.snapshots.v1beta1.Metadata(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.chunk_hashes && message.chunk_hashes.length)) + message.chunk_hashes = []; + message.chunk_hashes.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Metadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.snapshots.v1beta1.Metadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.snapshots.v1beta1.Metadata} Metadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Metadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Metadata message. + * @function verify + * @memberof cosmos.base.snapshots.v1beta1.Metadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Metadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.chunk_hashes != null && message.hasOwnProperty("chunk_hashes")) { + if (!Array.isArray(message.chunk_hashes)) + return "chunk_hashes: array expected"; + for (let i = 0; i < message.chunk_hashes.length; ++i) + if (!(message.chunk_hashes[i] && typeof message.chunk_hashes[i].length === "number" || $util.isString(message.chunk_hashes[i]))) + return "chunk_hashes: buffer[] expected"; + } + return null; + }; + + /** + * Creates a Metadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.snapshots.v1beta1.Metadata + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.snapshots.v1beta1.Metadata} Metadata + */ + Metadata.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.snapshots.v1beta1.Metadata) + return object; + let message = new $root.cosmos.base.snapshots.v1beta1.Metadata(); + if (object.chunk_hashes) { + if (!Array.isArray(object.chunk_hashes)) + throw TypeError(".cosmos.base.snapshots.v1beta1.Metadata.chunk_hashes: array expected"); + message.chunk_hashes = []; + for (let i = 0; i < object.chunk_hashes.length; ++i) + if (typeof object.chunk_hashes[i] === "string") + $util.base64.decode(object.chunk_hashes[i], message.chunk_hashes[i] = $util.newBuffer($util.base64.length(object.chunk_hashes[i])), 0); + else if (object.chunk_hashes[i].length) + message.chunk_hashes[i] = object.chunk_hashes[i]; + } + return message; + }; + + /** + * Creates a plain object from a Metadata message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.snapshots.v1beta1.Metadata + * @static + * @param {cosmos.base.snapshots.v1beta1.Metadata} message Metadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Metadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.chunk_hashes = []; + if (message.chunk_hashes && message.chunk_hashes.length) { + object.chunk_hashes = []; + for (let j = 0; j < message.chunk_hashes.length; ++j) + object.chunk_hashes[j] = options.bytes === String ? $util.base64.encode(message.chunk_hashes[j], 0, message.chunk_hashes[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.chunk_hashes[j]) : message.chunk_hashes[j]; + } + return object; + }; + + /** + * Converts this Metadata to JSON. + * @function toJSON + * @memberof cosmos.base.snapshots.v1beta1.Metadata + * @instance + * @returns {Object.} JSON object + */ + Metadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Metadata; + })(); + + return v1beta1; + })(); + + return snapshots; + })(); + + base.store = (function() { + + /** + * Namespace store. + * @memberof cosmos.base + * @namespace + */ + const store = {}; + + store.v1beta1 = (function() { + + /** + * Namespace v1beta1. + * @memberof cosmos.base.store + * @namespace + */ + const v1beta1 = {}; + + v1beta1.CommitInfo = (function() { + + /** + * Properties of a CommitInfo. + * @memberof cosmos.base.store.v1beta1 + * @interface ICommitInfo + * @property {Long|null} [version] CommitInfo version + * @property {Array.|null} [store_infos] CommitInfo store_infos + */ + + /** + * Constructs a new CommitInfo. + * @memberof cosmos.base.store.v1beta1 + * @classdesc Represents a CommitInfo. + * @implements ICommitInfo + * @constructor + * @param {cosmos.base.store.v1beta1.ICommitInfo=} [properties] Properties to set + */ + function CommitInfo(properties) { + this.store_infos = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CommitInfo version. + * @member {Long} version + * @memberof cosmos.base.store.v1beta1.CommitInfo + * @instance + */ + CommitInfo.prototype.version = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * CommitInfo store_infos. + * @member {Array.} store_infos + * @memberof cosmos.base.store.v1beta1.CommitInfo + * @instance + */ + CommitInfo.prototype.store_infos = $util.emptyArray; + + /** + * Encodes the specified CommitInfo message. Does not implicitly {@link cosmos.base.store.v1beta1.CommitInfo.verify|verify} messages. + * @function encode + * @memberof cosmos.base.store.v1beta1.CommitInfo + * @static + * @param {cosmos.base.store.v1beta1.ICommitInfo} message CommitInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommitInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.version); + if (message.store_infos != null && message.store_infos.length) + for (let i = 0; i < message.store_infos.length; ++i) + $root.cosmos.base.store.v1beta1.StoreInfo.encode(message.store_infos[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CommitInfo message, length delimited. Does not implicitly {@link cosmos.base.store.v1beta1.CommitInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.store.v1beta1.CommitInfo + * @static + * @param {cosmos.base.store.v1beta1.ICommitInfo} message CommitInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommitInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CommitInfo message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.store.v1beta1.CommitInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.store.v1beta1.CommitInfo} CommitInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommitInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.store.v1beta1.CommitInfo(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.int64(); + break; + case 2: + if (!(message.store_infos && message.store_infos.length)) + message.store_infos = []; + message.store_infos.push($root.cosmos.base.store.v1beta1.StoreInfo.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CommitInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.store.v1beta1.CommitInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.store.v1beta1.CommitInfo} CommitInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommitInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CommitInfo message. + * @function verify + * @memberof cosmos.base.store.v1beta1.CommitInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CommitInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isInteger(message.version) && !(message.version && $util.isInteger(message.version.low) && $util.isInteger(message.version.high))) + return "version: integer|Long expected"; + if (message.store_infos != null && message.hasOwnProperty("store_infos")) { + if (!Array.isArray(message.store_infos)) + return "store_infos: array expected"; + for (let i = 0; i < message.store_infos.length; ++i) { + let error = $root.cosmos.base.store.v1beta1.StoreInfo.verify(message.store_infos[i]); + if (error) + return "store_infos." + error; + } + } + return null; + }; + + /** + * Creates a CommitInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.store.v1beta1.CommitInfo + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.store.v1beta1.CommitInfo} CommitInfo + */ + CommitInfo.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.store.v1beta1.CommitInfo) + return object; + let message = new $root.cosmos.base.store.v1beta1.CommitInfo(); + if (object.version != null) + if ($util.Long) + (message.version = $util.Long.fromValue(object.version)).unsigned = false; + else if (typeof object.version === "string") + message.version = parseInt(object.version, 10); + else if (typeof object.version === "number") + message.version = object.version; + else if (typeof object.version === "object") + message.version = new $util.LongBits(object.version.low >>> 0, object.version.high >>> 0).toNumber(); + if (object.store_infos) { + if (!Array.isArray(object.store_infos)) + throw TypeError(".cosmos.base.store.v1beta1.CommitInfo.store_infos: array expected"); + message.store_infos = []; + for (let i = 0; i < object.store_infos.length; ++i) { + if (typeof object.store_infos[i] !== "object") + throw TypeError(".cosmos.base.store.v1beta1.CommitInfo.store_infos: object expected"); + message.store_infos[i] = $root.cosmos.base.store.v1beta1.StoreInfo.fromObject(object.store_infos[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a CommitInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.store.v1beta1.CommitInfo + * @static + * @param {cosmos.base.store.v1beta1.CommitInfo} message CommitInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CommitInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.store_infos = []; + if (options.defaults) + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.version = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.version = options.longs === String ? "0" : 0; + if (message.version != null && message.hasOwnProperty("version")) + if (typeof message.version === "number") + object.version = options.longs === String ? String(message.version) : message.version; + else + object.version = options.longs === String ? $util.Long.prototype.toString.call(message.version) : options.longs === Number ? new $util.LongBits(message.version.low >>> 0, message.version.high >>> 0).toNumber() : message.version; + if (message.store_infos && message.store_infos.length) { + object.store_infos = []; + for (let j = 0; j < message.store_infos.length; ++j) + object.store_infos[j] = $root.cosmos.base.store.v1beta1.StoreInfo.toObject(message.store_infos[j], options); + } + return object; + }; + + /** + * Converts this CommitInfo to JSON. + * @function toJSON + * @memberof cosmos.base.store.v1beta1.CommitInfo + * @instance + * @returns {Object.} JSON object + */ + CommitInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CommitInfo; + })(); + + v1beta1.StoreInfo = (function() { + + /** + * Properties of a StoreInfo. + * @memberof cosmos.base.store.v1beta1 + * @interface IStoreInfo + * @property {string|null} [name] StoreInfo name + * @property {cosmos.base.store.v1beta1.ICommitID|null} [commit_id] StoreInfo commit_id + */ + + /** + * Constructs a new StoreInfo. + * @memberof cosmos.base.store.v1beta1 + * @classdesc Represents a StoreInfo. + * @implements IStoreInfo + * @constructor + * @param {cosmos.base.store.v1beta1.IStoreInfo=} [properties] Properties to set + */ + function StoreInfo(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StoreInfo name. + * @member {string} name + * @memberof cosmos.base.store.v1beta1.StoreInfo + * @instance + */ + StoreInfo.prototype.name = ""; + + /** + * StoreInfo commit_id. + * @member {cosmos.base.store.v1beta1.ICommitID|null|undefined} commit_id + * @memberof cosmos.base.store.v1beta1.StoreInfo + * @instance + */ + StoreInfo.prototype.commit_id = null; + + /** + * Encodes the specified StoreInfo message. Does not implicitly {@link cosmos.base.store.v1beta1.StoreInfo.verify|verify} messages. + * @function encode + * @memberof cosmos.base.store.v1beta1.StoreInfo + * @static + * @param {cosmos.base.store.v1beta1.IStoreInfo} message StoreInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StoreInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.commit_id != null && Object.hasOwnProperty.call(message, "commit_id")) + $root.cosmos.base.store.v1beta1.CommitID.encode(message.commit_id, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified StoreInfo message, length delimited. Does not implicitly {@link cosmos.base.store.v1beta1.StoreInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.store.v1beta1.StoreInfo + * @static + * @param {cosmos.base.store.v1beta1.IStoreInfo} message StoreInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StoreInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StoreInfo message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.store.v1beta1.StoreInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.store.v1beta1.StoreInfo} StoreInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StoreInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.store.v1beta1.StoreInfo(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.commit_id = $root.cosmos.base.store.v1beta1.CommitID.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StoreInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.store.v1beta1.StoreInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.store.v1beta1.StoreInfo} StoreInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StoreInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StoreInfo message. + * @function verify + * @memberof cosmos.base.store.v1beta1.StoreInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StoreInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.commit_id != null && message.hasOwnProperty("commit_id")) { + let error = $root.cosmos.base.store.v1beta1.CommitID.verify(message.commit_id); + if (error) + return "commit_id." + error; + } + return null; + }; + + /** + * Creates a StoreInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.store.v1beta1.StoreInfo + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.store.v1beta1.StoreInfo} StoreInfo + */ + StoreInfo.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.store.v1beta1.StoreInfo) + return object; + let message = new $root.cosmos.base.store.v1beta1.StoreInfo(); + if (object.name != null) + message.name = String(object.name); + if (object.commit_id != null) { + if (typeof object.commit_id !== "object") + throw TypeError(".cosmos.base.store.v1beta1.StoreInfo.commit_id: object expected"); + message.commit_id = $root.cosmos.base.store.v1beta1.CommitID.fromObject(object.commit_id); + } + return message; + }; + + /** + * Creates a plain object from a StoreInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.store.v1beta1.StoreInfo + * @static + * @param {cosmos.base.store.v1beta1.StoreInfo} message StoreInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StoreInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.name = ""; + object.commit_id = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.commit_id != null && message.hasOwnProperty("commit_id")) + object.commit_id = $root.cosmos.base.store.v1beta1.CommitID.toObject(message.commit_id, options); + return object; + }; + + /** + * Converts this StoreInfo to JSON. + * @function toJSON + * @memberof cosmos.base.store.v1beta1.StoreInfo + * @instance + * @returns {Object.} JSON object + */ + StoreInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return StoreInfo; + })(); + + v1beta1.CommitID = (function() { + + /** + * Properties of a CommitID. + * @memberof cosmos.base.store.v1beta1 + * @interface ICommitID + * @property {Long|null} [version] CommitID version + * @property {Uint8Array|null} [hash] CommitID hash + */ + + /** + * Constructs a new CommitID. + * @memberof cosmos.base.store.v1beta1 + * @classdesc Represents a CommitID. + * @implements ICommitID + * @constructor + * @param {cosmos.base.store.v1beta1.ICommitID=} [properties] Properties to set + */ + function CommitID(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CommitID version. + * @member {Long} version + * @memberof cosmos.base.store.v1beta1.CommitID + * @instance + */ + CommitID.prototype.version = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * CommitID hash. + * @member {Uint8Array} hash + * @memberof cosmos.base.store.v1beta1.CommitID + * @instance + */ + CommitID.prototype.hash = $util.newBuffer([]); + + /** + * Encodes the specified CommitID message. Does not implicitly {@link cosmos.base.store.v1beta1.CommitID.verify|verify} messages. + * @function encode + * @memberof cosmos.base.store.v1beta1.CommitID + * @static + * @param {cosmos.base.store.v1beta1.ICommitID} message CommitID message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommitID.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.version); + if (message.hash != null && Object.hasOwnProperty.call(message, "hash")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.hash); + return writer; + }; + + /** + * Encodes the specified CommitID message, length delimited. Does not implicitly {@link cosmos.base.store.v1beta1.CommitID.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.store.v1beta1.CommitID + * @static + * @param {cosmos.base.store.v1beta1.ICommitID} message CommitID message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommitID.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CommitID message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.store.v1beta1.CommitID + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.store.v1beta1.CommitID} CommitID + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommitID.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.store.v1beta1.CommitID(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.int64(); + break; + case 2: + message.hash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CommitID message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.store.v1beta1.CommitID + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.store.v1beta1.CommitID} CommitID + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommitID.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CommitID message. + * @function verify + * @memberof cosmos.base.store.v1beta1.CommitID + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CommitID.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isInteger(message.version) && !(message.version && $util.isInteger(message.version.low) && $util.isInteger(message.version.high))) + return "version: integer|Long expected"; + if (message.hash != null && message.hasOwnProperty("hash")) + if (!(message.hash && typeof message.hash.length === "number" || $util.isString(message.hash))) + return "hash: buffer expected"; + return null; + }; + + /** + * Creates a CommitID message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.store.v1beta1.CommitID + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.store.v1beta1.CommitID} CommitID + */ + CommitID.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.store.v1beta1.CommitID) + return object; + let message = new $root.cosmos.base.store.v1beta1.CommitID(); + if (object.version != null) + if ($util.Long) + (message.version = $util.Long.fromValue(object.version)).unsigned = false; + else if (typeof object.version === "string") + message.version = parseInt(object.version, 10); + else if (typeof object.version === "number") + message.version = object.version; + else if (typeof object.version === "object") + message.version = new $util.LongBits(object.version.low >>> 0, object.version.high >>> 0).toNumber(); + if (object.hash != null) + if (typeof object.hash === "string") + $util.base64.decode(object.hash, message.hash = $util.newBuffer($util.base64.length(object.hash)), 0); + else if (object.hash.length) + message.hash = object.hash; + return message; + }; + + /** + * Creates a plain object from a CommitID message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.store.v1beta1.CommitID + * @static + * @param {cosmos.base.store.v1beta1.CommitID} message CommitID + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CommitID.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.version = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.version = options.longs === String ? "0" : 0; + if (options.bytes === String) + object.hash = ""; + else { + object.hash = []; + if (options.bytes !== Array) + object.hash = $util.newBuffer(object.hash); + } + } + if (message.version != null && message.hasOwnProperty("version")) + if (typeof message.version === "number") + object.version = options.longs === String ? String(message.version) : message.version; + else + object.version = options.longs === String ? $util.Long.prototype.toString.call(message.version) : options.longs === Number ? new $util.LongBits(message.version.low >>> 0, message.version.high >>> 0).toNumber() : message.version; + if (message.hash != null && message.hasOwnProperty("hash")) + object.hash = options.bytes === String ? $util.base64.encode(message.hash, 0, message.hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.hash) : message.hash; + return object; + }; + + /** + * Converts this CommitID to JSON. + * @function toJSON + * @memberof cosmos.base.store.v1beta1.CommitID + * @instance + * @returns {Object.} JSON object + */ + CommitID.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CommitID; + })(); + + v1beta1.SnapshotItem = (function() { + + /** + * Properties of a SnapshotItem. + * @memberof cosmos.base.store.v1beta1 + * @interface ISnapshotItem + * @property {cosmos.base.store.v1beta1.ISnapshotStoreItem|null} [store] SnapshotItem store + * @property {cosmos.base.store.v1beta1.ISnapshotIAVLItem|null} [iavl] SnapshotItem iavl + */ + + /** + * Constructs a new SnapshotItem. + * @memberof cosmos.base.store.v1beta1 + * @classdesc Represents a SnapshotItem. + * @implements ISnapshotItem + * @constructor + * @param {cosmos.base.store.v1beta1.ISnapshotItem=} [properties] Properties to set + */ + function SnapshotItem(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SnapshotItem store. + * @member {cosmos.base.store.v1beta1.ISnapshotStoreItem|null|undefined} store + * @memberof cosmos.base.store.v1beta1.SnapshotItem + * @instance + */ + SnapshotItem.prototype.store = null; + + /** + * SnapshotItem iavl. + * @member {cosmos.base.store.v1beta1.ISnapshotIAVLItem|null|undefined} iavl + * @memberof cosmos.base.store.v1beta1.SnapshotItem + * @instance + */ + SnapshotItem.prototype.iavl = null; + + // OneOf field names bound to virtual getters and setters + let $oneOfFields; + + /** + * SnapshotItem item. + * @member {"store"|"iavl"|undefined} item + * @memberof cosmos.base.store.v1beta1.SnapshotItem + * @instance + */ + Object.defineProperty(SnapshotItem.prototype, "item", { + get: $util.oneOfGetter($oneOfFields = ["store", "iavl"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Encodes the specified SnapshotItem message. Does not implicitly {@link cosmos.base.store.v1beta1.SnapshotItem.verify|verify} messages. + * @function encode + * @memberof cosmos.base.store.v1beta1.SnapshotItem + * @static + * @param {cosmos.base.store.v1beta1.ISnapshotItem} message SnapshotItem message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SnapshotItem.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.store != null && Object.hasOwnProperty.call(message, "store")) + $root.cosmos.base.store.v1beta1.SnapshotStoreItem.encode(message.store, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.iavl != null && Object.hasOwnProperty.call(message, "iavl")) + $root.cosmos.base.store.v1beta1.SnapshotIAVLItem.encode(message.iavl, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SnapshotItem message, length delimited. Does not implicitly {@link cosmos.base.store.v1beta1.SnapshotItem.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.store.v1beta1.SnapshotItem + * @static + * @param {cosmos.base.store.v1beta1.ISnapshotItem} message SnapshotItem message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SnapshotItem.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SnapshotItem message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.store.v1beta1.SnapshotItem + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.store.v1beta1.SnapshotItem} SnapshotItem + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SnapshotItem.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.store.v1beta1.SnapshotItem(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.store = $root.cosmos.base.store.v1beta1.SnapshotStoreItem.decode(reader, reader.uint32()); + break; + case 2: + message.iavl = $root.cosmos.base.store.v1beta1.SnapshotIAVLItem.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SnapshotItem message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.store.v1beta1.SnapshotItem + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.store.v1beta1.SnapshotItem} SnapshotItem + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SnapshotItem.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SnapshotItem message. + * @function verify + * @memberof cosmos.base.store.v1beta1.SnapshotItem + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SnapshotItem.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + let properties = {}; + if (message.store != null && message.hasOwnProperty("store")) { + properties.item = 1; + { + let error = $root.cosmos.base.store.v1beta1.SnapshotStoreItem.verify(message.store); + if (error) + return "store." + error; + } + } + if (message.iavl != null && message.hasOwnProperty("iavl")) { + if (properties.item === 1) + return "item: multiple values"; + properties.item = 1; + { + let error = $root.cosmos.base.store.v1beta1.SnapshotIAVLItem.verify(message.iavl); + if (error) + return "iavl." + error; + } + } + return null; + }; + + /** + * Creates a SnapshotItem message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.store.v1beta1.SnapshotItem + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.store.v1beta1.SnapshotItem} SnapshotItem + */ + SnapshotItem.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.store.v1beta1.SnapshotItem) + return object; + let message = new $root.cosmos.base.store.v1beta1.SnapshotItem(); + if (object.store != null) { + if (typeof object.store !== "object") + throw TypeError(".cosmos.base.store.v1beta1.SnapshotItem.store: object expected"); + message.store = $root.cosmos.base.store.v1beta1.SnapshotStoreItem.fromObject(object.store); + } + if (object.iavl != null) { + if (typeof object.iavl !== "object") + throw TypeError(".cosmos.base.store.v1beta1.SnapshotItem.iavl: object expected"); + message.iavl = $root.cosmos.base.store.v1beta1.SnapshotIAVLItem.fromObject(object.iavl); + } + return message; + }; + + /** + * Creates a plain object from a SnapshotItem message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.store.v1beta1.SnapshotItem + * @static + * @param {cosmos.base.store.v1beta1.SnapshotItem} message SnapshotItem + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SnapshotItem.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (message.store != null && message.hasOwnProperty("store")) { + object.store = $root.cosmos.base.store.v1beta1.SnapshotStoreItem.toObject(message.store, options); + if (options.oneofs) + object.item = "store"; + } + if (message.iavl != null && message.hasOwnProperty("iavl")) { + object.iavl = $root.cosmos.base.store.v1beta1.SnapshotIAVLItem.toObject(message.iavl, options); + if (options.oneofs) + object.item = "iavl"; + } + return object; + }; + + /** + * Converts this SnapshotItem to JSON. + * @function toJSON + * @memberof cosmos.base.store.v1beta1.SnapshotItem + * @instance + * @returns {Object.} JSON object + */ + SnapshotItem.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SnapshotItem; + })(); + + v1beta1.SnapshotStoreItem = (function() { + + /** + * Properties of a SnapshotStoreItem. + * @memberof cosmos.base.store.v1beta1 + * @interface ISnapshotStoreItem + * @property {string|null} [name] SnapshotStoreItem name + */ + + /** + * Constructs a new SnapshotStoreItem. + * @memberof cosmos.base.store.v1beta1 + * @classdesc Represents a SnapshotStoreItem. + * @implements ISnapshotStoreItem + * @constructor + * @param {cosmos.base.store.v1beta1.ISnapshotStoreItem=} [properties] Properties to set + */ + function SnapshotStoreItem(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SnapshotStoreItem name. + * @member {string} name + * @memberof cosmos.base.store.v1beta1.SnapshotStoreItem + * @instance + */ + SnapshotStoreItem.prototype.name = ""; + + /** + * Encodes the specified SnapshotStoreItem message. Does not implicitly {@link cosmos.base.store.v1beta1.SnapshotStoreItem.verify|verify} messages. + * @function encode + * @memberof cosmos.base.store.v1beta1.SnapshotStoreItem + * @static + * @param {cosmos.base.store.v1beta1.ISnapshotStoreItem} message SnapshotStoreItem message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SnapshotStoreItem.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified SnapshotStoreItem message, length delimited. Does not implicitly {@link cosmos.base.store.v1beta1.SnapshotStoreItem.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.store.v1beta1.SnapshotStoreItem + * @static + * @param {cosmos.base.store.v1beta1.ISnapshotStoreItem} message SnapshotStoreItem message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SnapshotStoreItem.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SnapshotStoreItem message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.store.v1beta1.SnapshotStoreItem + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.store.v1beta1.SnapshotStoreItem} SnapshotStoreItem + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SnapshotStoreItem.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.store.v1beta1.SnapshotStoreItem(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SnapshotStoreItem message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.store.v1beta1.SnapshotStoreItem + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.store.v1beta1.SnapshotStoreItem} SnapshotStoreItem + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SnapshotStoreItem.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SnapshotStoreItem message. + * @function verify + * @memberof cosmos.base.store.v1beta1.SnapshotStoreItem + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SnapshotStoreItem.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a SnapshotStoreItem message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.store.v1beta1.SnapshotStoreItem + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.store.v1beta1.SnapshotStoreItem} SnapshotStoreItem + */ + SnapshotStoreItem.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.store.v1beta1.SnapshotStoreItem) + return object; + let message = new $root.cosmos.base.store.v1beta1.SnapshotStoreItem(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a SnapshotStoreItem message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.store.v1beta1.SnapshotStoreItem + * @static + * @param {cosmos.base.store.v1beta1.SnapshotStoreItem} message SnapshotStoreItem + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SnapshotStoreItem.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this SnapshotStoreItem to JSON. + * @function toJSON + * @memberof cosmos.base.store.v1beta1.SnapshotStoreItem + * @instance + * @returns {Object.} JSON object + */ + SnapshotStoreItem.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SnapshotStoreItem; + })(); + + v1beta1.SnapshotIAVLItem = (function() { + + /** + * Properties of a SnapshotIAVLItem. + * @memberof cosmos.base.store.v1beta1 + * @interface ISnapshotIAVLItem + * @property {Uint8Array|null} [key] SnapshotIAVLItem key + * @property {Uint8Array|null} [value] SnapshotIAVLItem value + * @property {Long|null} [version] SnapshotIAVLItem version + * @property {number|null} [height] SnapshotIAVLItem height + */ + + /** + * Constructs a new SnapshotIAVLItem. + * @memberof cosmos.base.store.v1beta1 + * @classdesc Represents a SnapshotIAVLItem. + * @implements ISnapshotIAVLItem + * @constructor + * @param {cosmos.base.store.v1beta1.ISnapshotIAVLItem=} [properties] Properties to set + */ + function SnapshotIAVLItem(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SnapshotIAVLItem key. + * @member {Uint8Array} key + * @memberof cosmos.base.store.v1beta1.SnapshotIAVLItem + * @instance + */ + SnapshotIAVLItem.prototype.key = $util.newBuffer([]); + + /** + * SnapshotIAVLItem value. + * @member {Uint8Array} value + * @memberof cosmos.base.store.v1beta1.SnapshotIAVLItem + * @instance + */ + SnapshotIAVLItem.prototype.value = $util.newBuffer([]); + + /** + * SnapshotIAVLItem version. + * @member {Long} version + * @memberof cosmos.base.store.v1beta1.SnapshotIAVLItem + * @instance + */ + SnapshotIAVLItem.prototype.version = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * SnapshotIAVLItem height. + * @member {number} height + * @memberof cosmos.base.store.v1beta1.SnapshotIAVLItem + * @instance + */ + SnapshotIAVLItem.prototype.height = 0; + + /** + * Encodes the specified SnapshotIAVLItem message. Does not implicitly {@link cosmos.base.store.v1beta1.SnapshotIAVLItem.verify|verify} messages. + * @function encode + * @memberof cosmos.base.store.v1beta1.SnapshotIAVLItem + * @static + * @param {cosmos.base.store.v1beta1.ISnapshotIAVLItem} message SnapshotIAVLItem message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SnapshotIAVLItem.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.version); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.height); + return writer; + }; + + /** + * Encodes the specified SnapshotIAVLItem message, length delimited. Does not implicitly {@link cosmos.base.store.v1beta1.SnapshotIAVLItem.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.store.v1beta1.SnapshotIAVLItem + * @static + * @param {cosmos.base.store.v1beta1.ISnapshotIAVLItem} message SnapshotIAVLItem message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SnapshotIAVLItem.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SnapshotIAVLItem message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.store.v1beta1.SnapshotIAVLItem + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.store.v1beta1.SnapshotIAVLItem} SnapshotIAVLItem + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SnapshotIAVLItem.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.store.v1beta1.SnapshotIAVLItem(); + while (reader.pos < end) { + let 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(); + break; + case 4: + message.height = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SnapshotIAVLItem message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.store.v1beta1.SnapshotIAVLItem + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.store.v1beta1.SnapshotIAVLItem} SnapshotIAVLItem + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SnapshotIAVLItem.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SnapshotIAVLItem message. + * @function verify + * @memberof cosmos.base.store.v1beta1.SnapshotIAVLItem + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SnapshotIAVLItem.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) + return "key: buffer expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) + return "value: buffer expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isInteger(message.version) && !(message.version && $util.isInteger(message.version.low) && $util.isInteger(message.version.high))) + return "version: integer|Long expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height)) + return "height: integer expected"; + return null; + }; + + /** + * Creates a SnapshotIAVLItem message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.store.v1beta1.SnapshotIAVLItem + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.store.v1beta1.SnapshotIAVLItem} SnapshotIAVLItem + */ + SnapshotIAVLItem.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.store.v1beta1.SnapshotIAVLItem) + return object; + let message = new $root.cosmos.base.store.v1beta1.SnapshotIAVLItem(); + if (object.key != null) + if (typeof object.key === "string") + $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); + else if (object.key.length) + message.key = object.key; + if (object.value != null) + if (typeof object.value === "string") + $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); + else if (object.value.length) + message.value = object.value; + if (object.version != null) + if ($util.Long) + (message.version = $util.Long.fromValue(object.version)).unsigned = false; + else if (typeof object.version === "string") + message.version = parseInt(object.version, 10); + else if (typeof object.version === "number") + message.version = object.version; + else if (typeof object.version === "object") + message.version = new $util.LongBits(object.version.low >>> 0, object.version.high >>> 0).toNumber(); + if (object.height != null) + message.height = object.height | 0; + return message; + }; + + /** + * Creates a plain object from a SnapshotIAVLItem message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.store.v1beta1.SnapshotIAVLItem + * @static + * @param {cosmos.base.store.v1beta1.SnapshotIAVLItem} message SnapshotIAVLItem + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SnapshotIAVLItem.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if (options.bytes === String) + object.key = ""; + else { + object.key = []; + if (options.bytes !== Array) + object.key = $util.newBuffer(object.key); + } + if (options.bytes === String) + object.value = ""; + else { + object.value = []; + if (options.bytes !== Array) + object.value = $util.newBuffer(object.value); + } + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.version = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.version = options.longs === String ? "0" : 0; + object.height = 0; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; + if (message.version != null && message.hasOwnProperty("version")) + if (typeof message.version === "number") + object.version = options.longs === String ? String(message.version) : message.version; + else + object.version = options.longs === String ? $util.Long.prototype.toString.call(message.version) : options.longs === Number ? new $util.LongBits(message.version.low >>> 0, message.version.high >>> 0).toNumber() : message.version; + if (message.height != null && message.hasOwnProperty("height")) + object.height = message.height; + return object; + }; + + /** + * Converts this SnapshotIAVLItem to JSON. + * @function toJSON + * @memberof cosmos.base.store.v1beta1.SnapshotIAVLItem + * @instance + * @returns {Object.} JSON object + */ + SnapshotIAVLItem.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SnapshotIAVLItem; + })(); + + return v1beta1; + })(); + + return store; + })(); + + base.tendermint = (function() { + + /** + * Namespace tendermint. + * @memberof cosmos.base + * @namespace + */ + const tendermint = {}; + + tendermint.v1beta1 = (function() { + + /** + * Namespace v1beta1. + * @memberof cosmos.base.tendermint + * @namespace + */ + const v1beta1 = {}; + + v1beta1.Service = (function() { + + /** + * Constructs a new Service service. + * @memberof cosmos.base.tendermint.v1beta1 + * @classdesc Represents a Service + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Service(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Service.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Service; + + /** + * Callback as used by {@link cosmos.base.tendermint.v1beta1.Service#getNodeInfo}. + * @memberof cosmos.base.tendermint.v1beta1.Service + * @typedef GetNodeInfoCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.base.tendermint.v1beta1.GetNodeInfoResponse} [response] GetNodeInfoResponse + */ + + /** + * Calls GetNodeInfo. + * @function getNodeInfo + * @memberof cosmos.base.tendermint.v1beta1.Service + * @instance + * @param {cosmos.base.tendermint.v1beta1.IGetNodeInfoRequest} request GetNodeInfoRequest message or plain object + * @param {cosmos.base.tendermint.v1beta1.Service.GetNodeInfoCallback} callback Node-style callback called with the error, if any, and GetNodeInfoResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Service.prototype.getNodeInfo = function getNodeInfo(request, callback) { + return this.rpcCall(getNodeInfo, $root.cosmos.base.tendermint.v1beta1.GetNodeInfoRequest, $root.cosmos.base.tendermint.v1beta1.GetNodeInfoResponse, request, callback); + }, "name", { value: "GetNodeInfo" }); + + /** + * Calls GetNodeInfo. + * @function getNodeInfo + * @memberof cosmos.base.tendermint.v1beta1.Service + * @instance + * @param {cosmos.base.tendermint.v1beta1.IGetNodeInfoRequest} request GetNodeInfoRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.base.tendermint.v1beta1.Service#getSyncing}. + * @memberof cosmos.base.tendermint.v1beta1.Service + * @typedef GetSyncingCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.base.tendermint.v1beta1.GetSyncingResponse} [response] GetSyncingResponse + */ + + /** + * Calls GetSyncing. + * @function getSyncing + * @memberof cosmos.base.tendermint.v1beta1.Service + * @instance + * @param {cosmos.base.tendermint.v1beta1.IGetSyncingRequest} request GetSyncingRequest message or plain object + * @param {cosmos.base.tendermint.v1beta1.Service.GetSyncingCallback} callback Node-style callback called with the error, if any, and GetSyncingResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Service.prototype.getSyncing = function getSyncing(request, callback) { + return this.rpcCall(getSyncing, $root.cosmos.base.tendermint.v1beta1.GetSyncingRequest, $root.cosmos.base.tendermint.v1beta1.GetSyncingResponse, request, callback); + }, "name", { value: "GetSyncing" }); + + /** + * Calls GetSyncing. + * @function getSyncing + * @memberof cosmos.base.tendermint.v1beta1.Service + * @instance + * @param {cosmos.base.tendermint.v1beta1.IGetSyncingRequest} request GetSyncingRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.base.tendermint.v1beta1.Service#getLatestBlock}. + * @memberof cosmos.base.tendermint.v1beta1.Service + * @typedef GetLatestBlockCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.base.tendermint.v1beta1.GetLatestBlockResponse} [response] GetLatestBlockResponse + */ + + /** + * Calls GetLatestBlock. + * @function getLatestBlock + * @memberof cosmos.base.tendermint.v1beta1.Service + * @instance + * @param {cosmos.base.tendermint.v1beta1.IGetLatestBlockRequest} request GetLatestBlockRequest message or plain object + * @param {cosmos.base.tendermint.v1beta1.Service.GetLatestBlockCallback} callback Node-style callback called with the error, if any, and GetLatestBlockResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Service.prototype.getLatestBlock = function getLatestBlock(request, callback) { + return this.rpcCall(getLatestBlock, $root.cosmos.base.tendermint.v1beta1.GetLatestBlockRequest, $root.cosmos.base.tendermint.v1beta1.GetLatestBlockResponse, request, callback); + }, "name", { value: "GetLatestBlock" }); + + /** + * Calls GetLatestBlock. + * @function getLatestBlock + * @memberof cosmos.base.tendermint.v1beta1.Service + * @instance + * @param {cosmos.base.tendermint.v1beta1.IGetLatestBlockRequest} request GetLatestBlockRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.base.tendermint.v1beta1.Service#getBlockByHeight}. + * @memberof cosmos.base.tendermint.v1beta1.Service + * @typedef GetBlockByHeightCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse} [response] GetBlockByHeightResponse + */ + + /** + * Calls GetBlockByHeight. + * @function getBlockByHeight + * @memberof cosmos.base.tendermint.v1beta1.Service + * @instance + * @param {cosmos.base.tendermint.v1beta1.IGetBlockByHeightRequest} request GetBlockByHeightRequest message or plain object + * @param {cosmos.base.tendermint.v1beta1.Service.GetBlockByHeightCallback} callback Node-style callback called with the error, if any, and GetBlockByHeightResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Service.prototype.getBlockByHeight = function getBlockByHeight(request, callback) { + return this.rpcCall(getBlockByHeight, $root.cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest, $root.cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse, request, callback); + }, "name", { value: "GetBlockByHeight" }); + + /** + * Calls GetBlockByHeight. + * @function getBlockByHeight + * @memberof cosmos.base.tendermint.v1beta1.Service + * @instance + * @param {cosmos.base.tendermint.v1beta1.IGetBlockByHeightRequest} request GetBlockByHeightRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.base.tendermint.v1beta1.Service#getLatestValidatorSet}. + * @memberof cosmos.base.tendermint.v1beta1.Service + * @typedef GetLatestValidatorSetCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse} [response] GetLatestValidatorSetResponse + */ + + /** + * Calls GetLatestValidatorSet. + * @function getLatestValidatorSet + * @memberof cosmos.base.tendermint.v1beta1.Service + * @instance + * @param {cosmos.base.tendermint.v1beta1.IGetLatestValidatorSetRequest} request GetLatestValidatorSetRequest message or plain object + * @param {cosmos.base.tendermint.v1beta1.Service.GetLatestValidatorSetCallback} callback Node-style callback called with the error, if any, and GetLatestValidatorSetResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Service.prototype.getLatestValidatorSet = function getLatestValidatorSet(request, callback) { + return this.rpcCall(getLatestValidatorSet, $root.cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest, $root.cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse, request, callback); + }, "name", { value: "GetLatestValidatorSet" }); + + /** + * Calls GetLatestValidatorSet. + * @function getLatestValidatorSet + * @memberof cosmos.base.tendermint.v1beta1.Service + * @instance + * @param {cosmos.base.tendermint.v1beta1.IGetLatestValidatorSetRequest} request GetLatestValidatorSetRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.base.tendermint.v1beta1.Service#getValidatorSetByHeight}. + * @memberof cosmos.base.tendermint.v1beta1.Service + * @typedef GetValidatorSetByHeightCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse} [response] GetValidatorSetByHeightResponse + */ + + /** + * Calls GetValidatorSetByHeight. + * @function getValidatorSetByHeight + * @memberof cosmos.base.tendermint.v1beta1.Service + * @instance + * @param {cosmos.base.tendermint.v1beta1.IGetValidatorSetByHeightRequest} request GetValidatorSetByHeightRequest message or plain object + * @param {cosmos.base.tendermint.v1beta1.Service.GetValidatorSetByHeightCallback} callback Node-style callback called with the error, if any, and GetValidatorSetByHeightResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Service.prototype.getValidatorSetByHeight = function getValidatorSetByHeight(request, callback) { + return this.rpcCall(getValidatorSetByHeight, $root.cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest, $root.cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse, request, callback); + }, "name", { value: "GetValidatorSetByHeight" }); + + /** + * Calls GetValidatorSetByHeight. + * @function getValidatorSetByHeight + * @memberof cosmos.base.tendermint.v1beta1.Service + * @instance + * @param {cosmos.base.tendermint.v1beta1.IGetValidatorSetByHeightRequest} request GetValidatorSetByHeightRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Service; + })(); + + v1beta1.GetValidatorSetByHeightRequest = (function() { + + /** + * Properties of a GetValidatorSetByHeightRequest. + * @memberof cosmos.base.tendermint.v1beta1 + * @interface IGetValidatorSetByHeightRequest + * @property {Long|null} [height] GetValidatorSetByHeightRequest height + * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] GetValidatorSetByHeightRequest pagination + */ + + /** + * Constructs a new GetValidatorSetByHeightRequest. + * @memberof cosmos.base.tendermint.v1beta1 + * @classdesc Represents a GetValidatorSetByHeightRequest. + * @implements IGetValidatorSetByHeightRequest + * @constructor + * @param {cosmos.base.tendermint.v1beta1.IGetValidatorSetByHeightRequest=} [properties] Properties to set + */ + function GetValidatorSetByHeightRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetValidatorSetByHeightRequest height. + * @member {Long} height + * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest + * @instance + */ + GetValidatorSetByHeightRequest.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * GetValidatorSetByHeightRequest pagination. + * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination + * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest + * @instance + */ + GetValidatorSetByHeightRequest.prototype.pagination = null; + + /** + * Encodes the specified GetValidatorSetByHeightRequest message. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest + * @static + * @param {cosmos.base.tendermint.v1beta1.IGetValidatorSetByHeightRequest} message GetValidatorSetByHeightRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetValidatorSetByHeightRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.height); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetValidatorSetByHeightRequest message, length delimited. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest + * @static + * @param {cosmos.base.tendermint.v1beta1.IGetValidatorSetByHeightRequest} message GetValidatorSetByHeightRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetValidatorSetByHeightRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetValidatorSetByHeightRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest} GetValidatorSetByHeightRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetValidatorSetByHeightRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetValidatorSetByHeightRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest} GetValidatorSetByHeightRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetValidatorSetByHeightRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetValidatorSetByHeightRequest message. + * @function verify + * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetValidatorSetByHeightRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) + return "height: integer|Long expected"; + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a GetValidatorSetByHeightRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest} GetValidatorSetByHeightRequest + */ + GetValidatorSetByHeightRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest) + return object; + let message = new $root.cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest(); + if (object.height != null) + if ($util.Long) + (message.height = $util.Long.fromValue(object.height)).unsigned = false; + else if (typeof object.height === "string") + message.height = parseInt(object.height, 10); + else if (typeof object.height === "number") + message.height = object.height; + else if (typeof object.height === "object") + message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a GetValidatorSetByHeightRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest + * @static + * @param {cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest} message GetValidatorSetByHeightRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetValidatorSetByHeightRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.height = options.longs === String ? "0" : 0; + object.pagination = null; + } + if (message.height != null && message.hasOwnProperty("height")) + if (typeof message.height === "number") + object.height = options.longs === String ? String(message.height) : message.height; + else + object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this GetValidatorSetByHeightRequest to JSON. + * @function toJSON + * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest + * @instance + * @returns {Object.} JSON object + */ + GetValidatorSetByHeightRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetValidatorSetByHeightRequest; + })(); + + v1beta1.GetValidatorSetByHeightResponse = (function() { + + /** + * Properties of a GetValidatorSetByHeightResponse. + * @memberof cosmos.base.tendermint.v1beta1 + * @interface IGetValidatorSetByHeightResponse + * @property {Long|null} [block_height] GetValidatorSetByHeightResponse block_height + * @property {Array.|null} [validators] GetValidatorSetByHeightResponse validators + * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] GetValidatorSetByHeightResponse pagination + */ + + /** + * Constructs a new GetValidatorSetByHeightResponse. + * @memberof cosmos.base.tendermint.v1beta1 + * @classdesc Represents a GetValidatorSetByHeightResponse. + * @implements IGetValidatorSetByHeightResponse + * @constructor + * @param {cosmos.base.tendermint.v1beta1.IGetValidatorSetByHeightResponse=} [properties] Properties to set + */ + function GetValidatorSetByHeightResponse(properties) { + this.validators = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetValidatorSetByHeightResponse block_height. + * @member {Long} block_height + * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse + * @instance + */ + GetValidatorSetByHeightResponse.prototype.block_height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * GetValidatorSetByHeightResponse validators. + * @member {Array.} validators + * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse + * @instance + */ + GetValidatorSetByHeightResponse.prototype.validators = $util.emptyArray; + + /** + * GetValidatorSetByHeightResponse pagination. + * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination + * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse + * @instance + */ + GetValidatorSetByHeightResponse.prototype.pagination = null; + + /** + * Encodes the specified GetValidatorSetByHeightResponse message. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse + * @static + * @param {cosmos.base.tendermint.v1beta1.IGetValidatorSetByHeightResponse} message GetValidatorSetByHeightResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetValidatorSetByHeightResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.block_height != null && Object.hasOwnProperty.call(message, "block_height")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.block_height); + if (message.validators != null && message.validators.length) + for (let i = 0; i < message.validators.length; ++i) + $root.cosmos.base.tendermint.v1beta1.Validator.encode(message.validators[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetValidatorSetByHeightResponse message, length delimited. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse + * @static + * @param {cosmos.base.tendermint.v1beta1.IGetValidatorSetByHeightResponse} message GetValidatorSetByHeightResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetValidatorSetByHeightResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetValidatorSetByHeightResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse} GetValidatorSetByHeightResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetValidatorSetByHeightResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.block_height = reader.int64(); + break; + case 2: + if (!(message.validators && message.validators.length)) + message.validators = []; + message.validators.push($root.cosmos.base.tendermint.v1beta1.Validator.decode(reader, reader.uint32())); + break; + case 3: + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetValidatorSetByHeightResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse} GetValidatorSetByHeightResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetValidatorSetByHeightResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetValidatorSetByHeightResponse message. + * @function verify + * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetValidatorSetByHeightResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.block_height != null && message.hasOwnProperty("block_height")) + if (!$util.isInteger(message.block_height) && !(message.block_height && $util.isInteger(message.block_height.low) && $util.isInteger(message.block_height.high))) + return "block_height: integer|Long expected"; + if (message.validators != null && message.hasOwnProperty("validators")) { + if (!Array.isArray(message.validators)) + return "validators: array expected"; + for (let i = 0; i < message.validators.length; ++i) { + let error = $root.cosmos.base.tendermint.v1beta1.Validator.verify(message.validators[i]); + if (error) + return "validators." + error; + } + } + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a GetValidatorSetByHeightResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse} GetValidatorSetByHeightResponse + */ + GetValidatorSetByHeightResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse) + return object; + let message = new $root.cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse(); + if (object.block_height != null) + if ($util.Long) + (message.block_height = $util.Long.fromValue(object.block_height)).unsigned = false; + else if (typeof object.block_height === "string") + message.block_height = parseInt(object.block_height, 10); + else if (typeof object.block_height === "number") + message.block_height = object.block_height; + else if (typeof object.block_height === "object") + message.block_height = new $util.LongBits(object.block_height.low >>> 0, object.block_height.high >>> 0).toNumber(); + if (object.validators) { + if (!Array.isArray(object.validators)) + throw TypeError(".cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse.validators: array expected"); + message.validators = []; + for (let i = 0; i < object.validators.length; ++i) { + if (typeof object.validators[i] !== "object") + throw TypeError(".cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse.validators: object expected"); + message.validators[i] = $root.cosmos.base.tendermint.v1beta1.Validator.fromObject(object.validators[i]); + } + } + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a GetValidatorSetByHeightResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse + * @static + * @param {cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse} message GetValidatorSetByHeightResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetValidatorSetByHeightResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.validators = []; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.block_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.block_height = options.longs === String ? "0" : 0; + object.pagination = null; + } + if (message.block_height != null && message.hasOwnProperty("block_height")) + if (typeof message.block_height === "number") + object.block_height = options.longs === String ? String(message.block_height) : message.block_height; + else + object.block_height = options.longs === String ? $util.Long.prototype.toString.call(message.block_height) : options.longs === Number ? new $util.LongBits(message.block_height.low >>> 0, message.block_height.high >>> 0).toNumber() : message.block_height; + if (message.validators && message.validators.length) { + object.validators = []; + for (let j = 0; j < message.validators.length; ++j) + object.validators[j] = $root.cosmos.base.tendermint.v1beta1.Validator.toObject(message.validators[j], options); + } + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this GetValidatorSetByHeightResponse to JSON. + * @function toJSON + * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse + * @instance + * @returns {Object.} JSON object + */ + GetValidatorSetByHeightResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetValidatorSetByHeightResponse; + })(); + + v1beta1.GetLatestValidatorSetRequest = (function() { + + /** + * Properties of a GetLatestValidatorSetRequest. + * @memberof cosmos.base.tendermint.v1beta1 + * @interface IGetLatestValidatorSetRequest + * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] GetLatestValidatorSetRequest pagination + */ + + /** + * Constructs a new GetLatestValidatorSetRequest. + * @memberof cosmos.base.tendermint.v1beta1 + * @classdesc Represents a GetLatestValidatorSetRequest. + * @implements IGetLatestValidatorSetRequest + * @constructor + * @param {cosmos.base.tendermint.v1beta1.IGetLatestValidatorSetRequest=} [properties] Properties to set + */ + function GetLatestValidatorSetRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetLatestValidatorSetRequest pagination. + * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination + * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest + * @instance + */ + GetLatestValidatorSetRequest.prototype.pagination = null; + + /** + * Encodes the specified GetLatestValidatorSetRequest message. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest + * @static + * @param {cosmos.base.tendermint.v1beta1.IGetLatestValidatorSetRequest} message GetLatestValidatorSetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetLatestValidatorSetRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetLatestValidatorSetRequest message, length delimited. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest + * @static + * @param {cosmos.base.tendermint.v1beta1.IGetLatestValidatorSetRequest} message GetLatestValidatorSetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetLatestValidatorSetRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetLatestValidatorSetRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest} GetLatestValidatorSetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetLatestValidatorSetRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetLatestValidatorSetRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest} GetLatestValidatorSetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetLatestValidatorSetRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetLatestValidatorSetRequest message. + * @function verify + * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetLatestValidatorSetRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a GetLatestValidatorSetRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest} GetLatestValidatorSetRequest + */ + GetLatestValidatorSetRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest) + return object; + let message = new $root.cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest(); + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a GetLatestValidatorSetRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest + * @static + * @param {cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest} message GetLatestValidatorSetRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetLatestValidatorSetRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.pagination = null; + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this GetLatestValidatorSetRequest to JSON. + * @function toJSON + * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest + * @instance + * @returns {Object.} JSON object + */ + GetLatestValidatorSetRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetLatestValidatorSetRequest; + })(); + + v1beta1.GetLatestValidatorSetResponse = (function() { + + /** + * Properties of a GetLatestValidatorSetResponse. + * @memberof cosmos.base.tendermint.v1beta1 + * @interface IGetLatestValidatorSetResponse + * @property {Long|null} [block_height] GetLatestValidatorSetResponse block_height + * @property {Array.|null} [validators] GetLatestValidatorSetResponse validators + * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] GetLatestValidatorSetResponse pagination + */ + + /** + * Constructs a new GetLatestValidatorSetResponse. + * @memberof cosmos.base.tendermint.v1beta1 + * @classdesc Represents a GetLatestValidatorSetResponse. + * @implements IGetLatestValidatorSetResponse + * @constructor + * @param {cosmos.base.tendermint.v1beta1.IGetLatestValidatorSetResponse=} [properties] Properties to set + */ + function GetLatestValidatorSetResponse(properties) { + this.validators = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetLatestValidatorSetResponse block_height. + * @member {Long} block_height + * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse + * @instance + */ + GetLatestValidatorSetResponse.prototype.block_height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * GetLatestValidatorSetResponse validators. + * @member {Array.} validators + * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse + * @instance + */ + GetLatestValidatorSetResponse.prototype.validators = $util.emptyArray; + + /** + * GetLatestValidatorSetResponse pagination. + * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination + * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse + * @instance + */ + GetLatestValidatorSetResponse.prototype.pagination = null; + + /** + * Encodes the specified GetLatestValidatorSetResponse message. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse + * @static + * @param {cosmos.base.tendermint.v1beta1.IGetLatestValidatorSetResponse} message GetLatestValidatorSetResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetLatestValidatorSetResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.block_height != null && Object.hasOwnProperty.call(message, "block_height")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.block_height); + if (message.validators != null && message.validators.length) + for (let i = 0; i < message.validators.length; ++i) + $root.cosmos.base.tendermint.v1beta1.Validator.encode(message.validators[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetLatestValidatorSetResponse message, length delimited. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse + * @static + * @param {cosmos.base.tendermint.v1beta1.IGetLatestValidatorSetResponse} message GetLatestValidatorSetResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetLatestValidatorSetResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetLatestValidatorSetResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse} GetLatestValidatorSetResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetLatestValidatorSetResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.block_height = reader.int64(); + break; + case 2: + if (!(message.validators && message.validators.length)) + message.validators = []; + message.validators.push($root.cosmos.base.tendermint.v1beta1.Validator.decode(reader, reader.uint32())); + break; + case 3: + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetLatestValidatorSetResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse} GetLatestValidatorSetResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetLatestValidatorSetResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetLatestValidatorSetResponse message. + * @function verify + * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetLatestValidatorSetResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.block_height != null && message.hasOwnProperty("block_height")) + if (!$util.isInteger(message.block_height) && !(message.block_height && $util.isInteger(message.block_height.low) && $util.isInteger(message.block_height.high))) + return "block_height: integer|Long expected"; + if (message.validators != null && message.hasOwnProperty("validators")) { + if (!Array.isArray(message.validators)) + return "validators: array expected"; + for (let i = 0; i < message.validators.length; ++i) { + let error = $root.cosmos.base.tendermint.v1beta1.Validator.verify(message.validators[i]); + if (error) + return "validators." + error; + } + } + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a GetLatestValidatorSetResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse} GetLatestValidatorSetResponse + */ + GetLatestValidatorSetResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse) + return object; + let message = new $root.cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse(); + if (object.block_height != null) + if ($util.Long) + (message.block_height = $util.Long.fromValue(object.block_height)).unsigned = false; + else if (typeof object.block_height === "string") + message.block_height = parseInt(object.block_height, 10); + else if (typeof object.block_height === "number") + message.block_height = object.block_height; + else if (typeof object.block_height === "object") + message.block_height = new $util.LongBits(object.block_height.low >>> 0, object.block_height.high >>> 0).toNumber(); + if (object.validators) { + if (!Array.isArray(object.validators)) + throw TypeError(".cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse.validators: array expected"); + message.validators = []; + for (let i = 0; i < object.validators.length; ++i) { + if (typeof object.validators[i] !== "object") + throw TypeError(".cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse.validators: object expected"); + message.validators[i] = $root.cosmos.base.tendermint.v1beta1.Validator.fromObject(object.validators[i]); + } + } + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a GetLatestValidatorSetResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse + * @static + * @param {cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse} message GetLatestValidatorSetResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetLatestValidatorSetResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.validators = []; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.block_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.block_height = options.longs === String ? "0" : 0; + object.pagination = null; + } + if (message.block_height != null && message.hasOwnProperty("block_height")) + if (typeof message.block_height === "number") + object.block_height = options.longs === String ? String(message.block_height) : message.block_height; + else + object.block_height = options.longs === String ? $util.Long.prototype.toString.call(message.block_height) : options.longs === Number ? new $util.LongBits(message.block_height.low >>> 0, message.block_height.high >>> 0).toNumber() : message.block_height; + if (message.validators && message.validators.length) { + object.validators = []; + for (let j = 0; j < message.validators.length; ++j) + object.validators[j] = $root.cosmos.base.tendermint.v1beta1.Validator.toObject(message.validators[j], options); + } + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this GetLatestValidatorSetResponse to JSON. + * @function toJSON + * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse + * @instance + * @returns {Object.} JSON object + */ + GetLatestValidatorSetResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetLatestValidatorSetResponse; + })(); + + v1beta1.Validator = (function() { + + /** + * Properties of a Validator. + * @memberof cosmos.base.tendermint.v1beta1 + * @interface IValidator + * @property {string|null} [address] Validator address + * @property {google.protobuf.IAny|null} [pub_key] Validator pub_key + * @property {Long|null} [voting_power] Validator voting_power + * @property {Long|null} [proposer_priority] Validator proposer_priority + */ + + /** + * Constructs a new Validator. + * @memberof cosmos.base.tendermint.v1beta1 + * @classdesc Represents a Validator. + * @implements IValidator + * @constructor + * @param {cosmos.base.tendermint.v1beta1.IValidator=} [properties] Properties to set + */ + function Validator(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Validator address. + * @member {string} address + * @memberof cosmos.base.tendermint.v1beta1.Validator + * @instance + */ + Validator.prototype.address = ""; + + /** + * Validator pub_key. + * @member {google.protobuf.IAny|null|undefined} pub_key + * @memberof cosmos.base.tendermint.v1beta1.Validator + * @instance + */ + Validator.prototype.pub_key = null; + + /** + * Validator voting_power. + * @member {Long} voting_power + * @memberof cosmos.base.tendermint.v1beta1.Validator + * @instance + */ + Validator.prototype.voting_power = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Validator proposer_priority. + * @member {Long} proposer_priority + * @memberof cosmos.base.tendermint.v1beta1.Validator + * @instance + */ + Validator.prototype.proposer_priority = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Encodes the specified Validator message. Does not implicitly {@link cosmos.base.tendermint.v1beta1.Validator.verify|verify} messages. + * @function encode + * @memberof cosmos.base.tendermint.v1beta1.Validator + * @static + * @param {cosmos.base.tendermint.v1beta1.IValidator} message Validator message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Validator.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.address != null && Object.hasOwnProperty.call(message, "address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.address); + if (message.pub_key != null && Object.hasOwnProperty.call(message, "pub_key")) + $root.google.protobuf.Any.encode(message.pub_key, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.voting_power != null && Object.hasOwnProperty.call(message, "voting_power")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.voting_power); + if (message.proposer_priority != null && Object.hasOwnProperty.call(message, "proposer_priority")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.proposer_priority); + return writer; + }; + + /** + * Encodes the specified Validator message, length delimited. Does not implicitly {@link cosmos.base.tendermint.v1beta1.Validator.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.tendermint.v1beta1.Validator + * @static + * @param {cosmos.base.tendermint.v1beta1.IValidator} message Validator message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Validator.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Validator message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.tendermint.v1beta1.Validator + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.tendermint.v1beta1.Validator} Validator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Validator.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.tendermint.v1beta1.Validator(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.pub_key = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 3: + message.voting_power = reader.int64(); + break; + case 4: + message.proposer_priority = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Validator message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.tendermint.v1beta1.Validator + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.tendermint.v1beta1.Validator} Validator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Validator.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Validator message. + * @function verify + * @memberof cosmos.base.tendermint.v1beta1.Validator + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Validator.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.address != null && message.hasOwnProperty("address")) + if (!$util.isString(message.address)) + return "address: string expected"; + if (message.pub_key != null && message.hasOwnProperty("pub_key")) { + let error = $root.google.protobuf.Any.verify(message.pub_key); + if (error) + return "pub_key." + error; + } + if (message.voting_power != null && message.hasOwnProperty("voting_power")) + if (!$util.isInteger(message.voting_power) && !(message.voting_power && $util.isInteger(message.voting_power.low) && $util.isInteger(message.voting_power.high))) + return "voting_power: integer|Long expected"; + if (message.proposer_priority != null && message.hasOwnProperty("proposer_priority")) + if (!$util.isInteger(message.proposer_priority) && !(message.proposer_priority && $util.isInteger(message.proposer_priority.low) && $util.isInteger(message.proposer_priority.high))) + return "proposer_priority: integer|Long expected"; + return null; + }; + + /** + * Creates a Validator message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.tendermint.v1beta1.Validator + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.tendermint.v1beta1.Validator} Validator + */ + Validator.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.tendermint.v1beta1.Validator) + return object; + let message = new $root.cosmos.base.tendermint.v1beta1.Validator(); + if (object.address != null) + message.address = String(object.address); + if (object.pub_key != null) { + if (typeof object.pub_key !== "object") + throw TypeError(".cosmos.base.tendermint.v1beta1.Validator.pub_key: object expected"); + message.pub_key = $root.google.protobuf.Any.fromObject(object.pub_key); + } + if (object.voting_power != null) + if ($util.Long) + (message.voting_power = $util.Long.fromValue(object.voting_power)).unsigned = false; + else if (typeof object.voting_power === "string") + message.voting_power = parseInt(object.voting_power, 10); + else if (typeof object.voting_power === "number") + message.voting_power = object.voting_power; + else if (typeof object.voting_power === "object") + message.voting_power = new $util.LongBits(object.voting_power.low >>> 0, object.voting_power.high >>> 0).toNumber(); + if (object.proposer_priority != null) + if ($util.Long) + (message.proposer_priority = $util.Long.fromValue(object.proposer_priority)).unsigned = false; + else if (typeof object.proposer_priority === "string") + message.proposer_priority = parseInt(object.proposer_priority, 10); + else if (typeof object.proposer_priority === "number") + message.proposer_priority = object.proposer_priority; + else if (typeof object.proposer_priority === "object") + message.proposer_priority = new $util.LongBits(object.proposer_priority.low >>> 0, object.proposer_priority.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a Validator message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.tendermint.v1beta1.Validator + * @static + * @param {cosmos.base.tendermint.v1beta1.Validator} message Validator + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Validator.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.address = ""; + object.pub_key = null; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.voting_power = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.voting_power = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.proposer_priority = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.proposer_priority = options.longs === String ? "0" : 0; + } + if (message.address != null && message.hasOwnProperty("address")) + object.address = message.address; + if (message.pub_key != null && message.hasOwnProperty("pub_key")) + object.pub_key = $root.google.protobuf.Any.toObject(message.pub_key, options); + if (message.voting_power != null && message.hasOwnProperty("voting_power")) + if (typeof message.voting_power === "number") + object.voting_power = options.longs === String ? String(message.voting_power) : message.voting_power; + else + object.voting_power = options.longs === String ? $util.Long.prototype.toString.call(message.voting_power) : options.longs === Number ? new $util.LongBits(message.voting_power.low >>> 0, message.voting_power.high >>> 0).toNumber() : message.voting_power; + if (message.proposer_priority != null && message.hasOwnProperty("proposer_priority")) + if (typeof message.proposer_priority === "number") + object.proposer_priority = options.longs === String ? String(message.proposer_priority) : message.proposer_priority; + else + object.proposer_priority = options.longs === String ? $util.Long.prototype.toString.call(message.proposer_priority) : options.longs === Number ? new $util.LongBits(message.proposer_priority.low >>> 0, message.proposer_priority.high >>> 0).toNumber() : message.proposer_priority; + return object; + }; + + /** + * Converts this Validator to JSON. + * @function toJSON + * @memberof cosmos.base.tendermint.v1beta1.Validator + * @instance + * @returns {Object.} JSON object + */ + Validator.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Validator; + })(); + + v1beta1.GetBlockByHeightRequest = (function() { + + /** + * Properties of a GetBlockByHeightRequest. + * @memberof cosmos.base.tendermint.v1beta1 + * @interface IGetBlockByHeightRequest + * @property {Long|null} [height] GetBlockByHeightRequest height + */ + + /** + * Constructs a new GetBlockByHeightRequest. + * @memberof cosmos.base.tendermint.v1beta1 + * @classdesc Represents a GetBlockByHeightRequest. + * @implements IGetBlockByHeightRequest + * @constructor + * @param {cosmos.base.tendermint.v1beta1.IGetBlockByHeightRequest=} [properties] Properties to set + */ + function GetBlockByHeightRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetBlockByHeightRequest height. + * @member {Long} height + * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest + * @instance + */ + GetBlockByHeightRequest.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Encodes the specified GetBlockByHeightRequest message. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest + * @static + * @param {cosmos.base.tendermint.v1beta1.IGetBlockByHeightRequest} message GetBlockByHeightRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetBlockByHeightRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.height); + return writer; + }; + + /** + * Encodes the specified GetBlockByHeightRequest message, length delimited. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest + * @static + * @param {cosmos.base.tendermint.v1beta1.IGetBlockByHeightRequest} message GetBlockByHeightRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetBlockByHeightRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetBlockByHeightRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest} GetBlockByHeightRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetBlockByHeightRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetBlockByHeightRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest} GetBlockByHeightRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetBlockByHeightRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetBlockByHeightRequest message. + * @function verify + * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetBlockByHeightRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) + return "height: integer|Long expected"; + return null; + }; + + /** + * Creates a GetBlockByHeightRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest} GetBlockByHeightRequest + */ + GetBlockByHeightRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest) + return object; + let message = new $root.cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest(); + if (object.height != null) + if ($util.Long) + (message.height = $util.Long.fromValue(object.height)).unsigned = false; + else if (typeof object.height === "string") + message.height = parseInt(object.height, 10); + else if (typeof object.height === "number") + message.height = object.height; + else if (typeof object.height === "object") + message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a GetBlockByHeightRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest + * @static + * @param {cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest} message GetBlockByHeightRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetBlockByHeightRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.height = options.longs === String ? "0" : 0; + if (message.height != null && message.hasOwnProperty("height")) + if (typeof message.height === "number") + object.height = options.longs === String ? String(message.height) : message.height; + else + object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; + return object; + }; + + /** + * Converts this GetBlockByHeightRequest to JSON. + * @function toJSON + * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest + * @instance + * @returns {Object.} JSON object + */ + GetBlockByHeightRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetBlockByHeightRequest; + })(); + + v1beta1.GetBlockByHeightResponse = (function() { + + /** + * Properties of a GetBlockByHeightResponse. + * @memberof cosmos.base.tendermint.v1beta1 + * @interface IGetBlockByHeightResponse + * @property {tendermint.types.IBlockID|null} [block_id] GetBlockByHeightResponse block_id + * @property {tendermint.types.IBlock|null} [block] GetBlockByHeightResponse block + */ + + /** + * Constructs a new GetBlockByHeightResponse. + * @memberof cosmos.base.tendermint.v1beta1 + * @classdesc Represents a GetBlockByHeightResponse. + * @implements IGetBlockByHeightResponse + * @constructor + * @param {cosmos.base.tendermint.v1beta1.IGetBlockByHeightResponse=} [properties] Properties to set + */ + function GetBlockByHeightResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetBlockByHeightResponse block_id. + * @member {tendermint.types.IBlockID|null|undefined} block_id + * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse + * @instance + */ + GetBlockByHeightResponse.prototype.block_id = null; + + /** + * GetBlockByHeightResponse block. + * @member {tendermint.types.IBlock|null|undefined} block + * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse + * @instance + */ + GetBlockByHeightResponse.prototype.block = null; + + /** + * Encodes the specified GetBlockByHeightResponse message. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse + * @static + * @param {cosmos.base.tendermint.v1beta1.IGetBlockByHeightResponse} message GetBlockByHeightResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetBlockByHeightResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.block_id != null && Object.hasOwnProperty.call(message, "block_id")) + $root.tendermint.types.BlockID.encode(message.block_id, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.block != null && Object.hasOwnProperty.call(message, "block")) + $root.tendermint.types.Block.encode(message.block, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetBlockByHeightResponse message, length delimited. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse + * @static + * @param {cosmos.base.tendermint.v1beta1.IGetBlockByHeightResponse} message GetBlockByHeightResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetBlockByHeightResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetBlockByHeightResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse} GetBlockByHeightResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetBlockByHeightResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.block_id = $root.tendermint.types.BlockID.decode(reader, reader.uint32()); + break; + case 2: + message.block = $root.tendermint.types.Block.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetBlockByHeightResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse} GetBlockByHeightResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetBlockByHeightResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetBlockByHeightResponse message. + * @function verify + * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetBlockByHeightResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.block_id != null && message.hasOwnProperty("block_id")) { + let error = $root.tendermint.types.BlockID.verify(message.block_id); + if (error) + return "block_id." + error; + } + if (message.block != null && message.hasOwnProperty("block")) { + let error = $root.tendermint.types.Block.verify(message.block); + if (error) + return "block." + error; + } + return null; + }; + + /** + * Creates a GetBlockByHeightResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse} GetBlockByHeightResponse + */ + GetBlockByHeightResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse) + return object; + let message = new $root.cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse(); + if (object.block_id != null) { + if (typeof object.block_id !== "object") + throw TypeError(".cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse.block_id: object expected"); + message.block_id = $root.tendermint.types.BlockID.fromObject(object.block_id); + } + if (object.block != null) { + if (typeof object.block !== "object") + throw TypeError(".cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse.block: object expected"); + message.block = $root.tendermint.types.Block.fromObject(object.block); + } + return message; + }; + + /** + * Creates a plain object from a GetBlockByHeightResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse + * @static + * @param {cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse} message GetBlockByHeightResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetBlockByHeightResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.block_id = null; + object.block = null; + } + if (message.block_id != null && message.hasOwnProperty("block_id")) + object.block_id = $root.tendermint.types.BlockID.toObject(message.block_id, options); + if (message.block != null && message.hasOwnProperty("block")) + object.block = $root.tendermint.types.Block.toObject(message.block, options); + return object; + }; + + /** + * Converts this GetBlockByHeightResponse to JSON. + * @function toJSON + * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse + * @instance + * @returns {Object.} JSON object + */ + GetBlockByHeightResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetBlockByHeightResponse; + })(); + + v1beta1.GetLatestBlockRequest = (function() { + + /** + * Properties of a GetLatestBlockRequest. + * @memberof cosmos.base.tendermint.v1beta1 + * @interface IGetLatestBlockRequest + */ + + /** + * Constructs a new GetLatestBlockRequest. + * @memberof cosmos.base.tendermint.v1beta1 + * @classdesc Represents a GetLatestBlockRequest. + * @implements IGetLatestBlockRequest + * @constructor + * @param {cosmos.base.tendermint.v1beta1.IGetLatestBlockRequest=} [properties] Properties to set + */ + function GetLatestBlockRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified GetLatestBlockRequest message. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetLatestBlockRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockRequest + * @static + * @param {cosmos.base.tendermint.v1beta1.IGetLatestBlockRequest} message GetLatestBlockRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetLatestBlockRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified GetLatestBlockRequest message, length delimited. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetLatestBlockRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockRequest + * @static + * @param {cosmos.base.tendermint.v1beta1.IGetLatestBlockRequest} message GetLatestBlockRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetLatestBlockRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetLatestBlockRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.tendermint.v1beta1.GetLatestBlockRequest} GetLatestBlockRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetLatestBlockRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.tendermint.v1beta1.GetLatestBlockRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetLatestBlockRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.tendermint.v1beta1.GetLatestBlockRequest} GetLatestBlockRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetLatestBlockRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetLatestBlockRequest message. + * @function verify + * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetLatestBlockRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a GetLatestBlockRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.tendermint.v1beta1.GetLatestBlockRequest} GetLatestBlockRequest + */ + GetLatestBlockRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.tendermint.v1beta1.GetLatestBlockRequest) + return object; + return new $root.cosmos.base.tendermint.v1beta1.GetLatestBlockRequest(); + }; + + /** + * Creates a plain object from a GetLatestBlockRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockRequest + * @static + * @param {cosmos.base.tendermint.v1beta1.GetLatestBlockRequest} message GetLatestBlockRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetLatestBlockRequest.toObject = function toObject() { + return {}; + }; + + /** + * Converts this GetLatestBlockRequest to JSON. + * @function toJSON + * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockRequest + * @instance + * @returns {Object.} JSON object + */ + GetLatestBlockRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetLatestBlockRequest; + })(); + + v1beta1.GetLatestBlockResponse = (function() { + + /** + * Properties of a GetLatestBlockResponse. + * @memberof cosmos.base.tendermint.v1beta1 + * @interface IGetLatestBlockResponse + * @property {tendermint.types.IBlockID|null} [block_id] GetLatestBlockResponse block_id + * @property {tendermint.types.IBlock|null} [block] GetLatestBlockResponse block + */ + + /** + * Constructs a new GetLatestBlockResponse. + * @memberof cosmos.base.tendermint.v1beta1 + * @classdesc Represents a GetLatestBlockResponse. + * @implements IGetLatestBlockResponse + * @constructor + * @param {cosmos.base.tendermint.v1beta1.IGetLatestBlockResponse=} [properties] Properties to set + */ + function GetLatestBlockResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetLatestBlockResponse block_id. + * @member {tendermint.types.IBlockID|null|undefined} block_id + * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockResponse + * @instance + */ + GetLatestBlockResponse.prototype.block_id = null; + + /** + * GetLatestBlockResponse block. + * @member {tendermint.types.IBlock|null|undefined} block + * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockResponse + * @instance + */ + GetLatestBlockResponse.prototype.block = null; + + /** + * Encodes the specified GetLatestBlockResponse message. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetLatestBlockResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockResponse + * @static + * @param {cosmos.base.tendermint.v1beta1.IGetLatestBlockResponse} message GetLatestBlockResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetLatestBlockResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.block_id != null && Object.hasOwnProperty.call(message, "block_id")) + $root.tendermint.types.BlockID.encode(message.block_id, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.block != null && Object.hasOwnProperty.call(message, "block")) + $root.tendermint.types.Block.encode(message.block, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetLatestBlockResponse message, length delimited. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetLatestBlockResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockResponse + * @static + * @param {cosmos.base.tendermint.v1beta1.IGetLatestBlockResponse} message GetLatestBlockResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetLatestBlockResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetLatestBlockResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.tendermint.v1beta1.GetLatestBlockResponse} GetLatestBlockResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetLatestBlockResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.tendermint.v1beta1.GetLatestBlockResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.block_id = $root.tendermint.types.BlockID.decode(reader, reader.uint32()); + break; + case 2: + message.block = $root.tendermint.types.Block.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetLatestBlockResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.tendermint.v1beta1.GetLatestBlockResponse} GetLatestBlockResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetLatestBlockResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetLatestBlockResponse message. + * @function verify + * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetLatestBlockResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.block_id != null && message.hasOwnProperty("block_id")) { + let error = $root.tendermint.types.BlockID.verify(message.block_id); + if (error) + return "block_id." + error; + } + if (message.block != null && message.hasOwnProperty("block")) { + let error = $root.tendermint.types.Block.verify(message.block); + if (error) + return "block." + error; + } + return null; + }; + + /** + * Creates a GetLatestBlockResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.tendermint.v1beta1.GetLatestBlockResponse} GetLatestBlockResponse + */ + GetLatestBlockResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.tendermint.v1beta1.GetLatestBlockResponse) + return object; + let message = new $root.cosmos.base.tendermint.v1beta1.GetLatestBlockResponse(); + if (object.block_id != null) { + if (typeof object.block_id !== "object") + throw TypeError(".cosmos.base.tendermint.v1beta1.GetLatestBlockResponse.block_id: object expected"); + message.block_id = $root.tendermint.types.BlockID.fromObject(object.block_id); + } + if (object.block != null) { + if (typeof object.block !== "object") + throw TypeError(".cosmos.base.tendermint.v1beta1.GetLatestBlockResponse.block: object expected"); + message.block = $root.tendermint.types.Block.fromObject(object.block); + } + return message; + }; + + /** + * Creates a plain object from a GetLatestBlockResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockResponse + * @static + * @param {cosmos.base.tendermint.v1beta1.GetLatestBlockResponse} message GetLatestBlockResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetLatestBlockResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.block_id = null; + object.block = null; + } + if (message.block_id != null && message.hasOwnProperty("block_id")) + object.block_id = $root.tendermint.types.BlockID.toObject(message.block_id, options); + if (message.block != null && message.hasOwnProperty("block")) + object.block = $root.tendermint.types.Block.toObject(message.block, options); + return object; + }; + + /** + * Converts this GetLatestBlockResponse to JSON. + * @function toJSON + * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockResponse + * @instance + * @returns {Object.} JSON object + */ + GetLatestBlockResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetLatestBlockResponse; + })(); + + v1beta1.GetSyncingRequest = (function() { + + /** + * Properties of a GetSyncingRequest. + * @memberof cosmos.base.tendermint.v1beta1 + * @interface IGetSyncingRequest + */ + + /** + * Constructs a new GetSyncingRequest. + * @memberof cosmos.base.tendermint.v1beta1 + * @classdesc Represents a GetSyncingRequest. + * @implements IGetSyncingRequest + * @constructor + * @param {cosmos.base.tendermint.v1beta1.IGetSyncingRequest=} [properties] Properties to set + */ + function GetSyncingRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified GetSyncingRequest message. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetSyncingRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.base.tendermint.v1beta1.GetSyncingRequest + * @static + * @param {cosmos.base.tendermint.v1beta1.IGetSyncingRequest} message GetSyncingRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetSyncingRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified GetSyncingRequest message, length delimited. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetSyncingRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.tendermint.v1beta1.GetSyncingRequest + * @static + * @param {cosmos.base.tendermint.v1beta1.IGetSyncingRequest} message GetSyncingRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetSyncingRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetSyncingRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.tendermint.v1beta1.GetSyncingRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.tendermint.v1beta1.GetSyncingRequest} GetSyncingRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetSyncingRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.tendermint.v1beta1.GetSyncingRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetSyncingRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.tendermint.v1beta1.GetSyncingRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.tendermint.v1beta1.GetSyncingRequest} GetSyncingRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetSyncingRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetSyncingRequest message. + * @function verify + * @memberof cosmos.base.tendermint.v1beta1.GetSyncingRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetSyncingRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a GetSyncingRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.tendermint.v1beta1.GetSyncingRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.tendermint.v1beta1.GetSyncingRequest} GetSyncingRequest + */ + GetSyncingRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.tendermint.v1beta1.GetSyncingRequest) + return object; + return new $root.cosmos.base.tendermint.v1beta1.GetSyncingRequest(); + }; + + /** + * Creates a plain object from a GetSyncingRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.tendermint.v1beta1.GetSyncingRequest + * @static + * @param {cosmos.base.tendermint.v1beta1.GetSyncingRequest} message GetSyncingRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetSyncingRequest.toObject = function toObject() { + return {}; + }; + + /** + * Converts this GetSyncingRequest to JSON. + * @function toJSON + * @memberof cosmos.base.tendermint.v1beta1.GetSyncingRequest + * @instance + * @returns {Object.} JSON object + */ + GetSyncingRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetSyncingRequest; + })(); + + v1beta1.GetSyncingResponse = (function() { + + /** + * Properties of a GetSyncingResponse. + * @memberof cosmos.base.tendermint.v1beta1 + * @interface IGetSyncingResponse + * @property {boolean|null} [syncing] GetSyncingResponse syncing + */ + + /** + * Constructs a new GetSyncingResponse. + * @memberof cosmos.base.tendermint.v1beta1 + * @classdesc Represents a GetSyncingResponse. + * @implements IGetSyncingResponse + * @constructor + * @param {cosmos.base.tendermint.v1beta1.IGetSyncingResponse=} [properties] Properties to set + */ + function GetSyncingResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetSyncingResponse syncing. + * @member {boolean} syncing + * @memberof cosmos.base.tendermint.v1beta1.GetSyncingResponse + * @instance + */ + GetSyncingResponse.prototype.syncing = false; + + /** + * Encodes the specified GetSyncingResponse message. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetSyncingResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.base.tendermint.v1beta1.GetSyncingResponse + * @static + * @param {cosmos.base.tendermint.v1beta1.IGetSyncingResponse} message GetSyncingResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetSyncingResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.syncing != null && Object.hasOwnProperty.call(message, "syncing")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.syncing); + return writer; + }; + + /** + * Encodes the specified GetSyncingResponse message, length delimited. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetSyncingResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.tendermint.v1beta1.GetSyncingResponse + * @static + * @param {cosmos.base.tendermint.v1beta1.IGetSyncingResponse} message GetSyncingResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetSyncingResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetSyncingResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.tendermint.v1beta1.GetSyncingResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.tendermint.v1beta1.GetSyncingResponse} GetSyncingResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetSyncingResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.tendermint.v1beta1.GetSyncingResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.syncing = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetSyncingResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.tendermint.v1beta1.GetSyncingResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.tendermint.v1beta1.GetSyncingResponse} GetSyncingResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetSyncingResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetSyncingResponse message. + * @function verify + * @memberof cosmos.base.tendermint.v1beta1.GetSyncingResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetSyncingResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.syncing != null && message.hasOwnProperty("syncing")) + if (typeof message.syncing !== "boolean") + return "syncing: boolean expected"; + return null; + }; + + /** + * Creates a GetSyncingResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.tendermint.v1beta1.GetSyncingResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.tendermint.v1beta1.GetSyncingResponse} GetSyncingResponse + */ + GetSyncingResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.tendermint.v1beta1.GetSyncingResponse) + return object; + let message = new $root.cosmos.base.tendermint.v1beta1.GetSyncingResponse(); + if (object.syncing != null) + message.syncing = Boolean(object.syncing); + return message; + }; + + /** + * Creates a plain object from a GetSyncingResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.tendermint.v1beta1.GetSyncingResponse + * @static + * @param {cosmos.base.tendermint.v1beta1.GetSyncingResponse} message GetSyncingResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetSyncingResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.syncing = false; + if (message.syncing != null && message.hasOwnProperty("syncing")) + object.syncing = message.syncing; + return object; + }; + + /** + * Converts this GetSyncingResponse to JSON. + * @function toJSON + * @memberof cosmos.base.tendermint.v1beta1.GetSyncingResponse + * @instance + * @returns {Object.} JSON object + */ + GetSyncingResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetSyncingResponse; + })(); + + v1beta1.GetNodeInfoRequest = (function() { + + /** + * Properties of a GetNodeInfoRequest. + * @memberof cosmos.base.tendermint.v1beta1 + * @interface IGetNodeInfoRequest + */ + + /** + * Constructs a new GetNodeInfoRequest. + * @memberof cosmos.base.tendermint.v1beta1 + * @classdesc Represents a GetNodeInfoRequest. + * @implements IGetNodeInfoRequest + * @constructor + * @param {cosmos.base.tendermint.v1beta1.IGetNodeInfoRequest=} [properties] Properties to set + */ + function GetNodeInfoRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified GetNodeInfoRequest message. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetNodeInfoRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoRequest + * @static + * @param {cosmos.base.tendermint.v1beta1.IGetNodeInfoRequest} message GetNodeInfoRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetNodeInfoRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified GetNodeInfoRequest message, length delimited. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetNodeInfoRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoRequest + * @static + * @param {cosmos.base.tendermint.v1beta1.IGetNodeInfoRequest} message GetNodeInfoRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetNodeInfoRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetNodeInfoRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.tendermint.v1beta1.GetNodeInfoRequest} GetNodeInfoRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetNodeInfoRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.tendermint.v1beta1.GetNodeInfoRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetNodeInfoRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.tendermint.v1beta1.GetNodeInfoRequest} GetNodeInfoRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetNodeInfoRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetNodeInfoRequest message. + * @function verify + * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetNodeInfoRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a GetNodeInfoRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.tendermint.v1beta1.GetNodeInfoRequest} GetNodeInfoRequest + */ + GetNodeInfoRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.tendermint.v1beta1.GetNodeInfoRequest) + return object; + return new $root.cosmos.base.tendermint.v1beta1.GetNodeInfoRequest(); + }; + + /** + * Creates a plain object from a GetNodeInfoRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoRequest + * @static + * @param {cosmos.base.tendermint.v1beta1.GetNodeInfoRequest} message GetNodeInfoRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetNodeInfoRequest.toObject = function toObject() { + return {}; + }; + + /** + * Converts this GetNodeInfoRequest to JSON. + * @function toJSON + * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoRequest + * @instance + * @returns {Object.} JSON object + */ + GetNodeInfoRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetNodeInfoRequest; + })(); + + v1beta1.GetNodeInfoResponse = (function() { + + /** + * Properties of a GetNodeInfoResponse. + * @memberof cosmos.base.tendermint.v1beta1 + * @interface IGetNodeInfoResponse + * @property {tendermint.p2p.IDefaultNodeInfo|null} [default_node_info] GetNodeInfoResponse default_node_info + * @property {cosmos.base.tendermint.v1beta1.IVersionInfo|null} [application_version] GetNodeInfoResponse application_version + */ + + /** + * Constructs a new GetNodeInfoResponse. + * @memberof cosmos.base.tendermint.v1beta1 + * @classdesc Represents a GetNodeInfoResponse. + * @implements IGetNodeInfoResponse + * @constructor + * @param {cosmos.base.tendermint.v1beta1.IGetNodeInfoResponse=} [properties] Properties to set + */ + function GetNodeInfoResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetNodeInfoResponse default_node_info. + * @member {tendermint.p2p.IDefaultNodeInfo|null|undefined} default_node_info + * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoResponse + * @instance + */ + GetNodeInfoResponse.prototype.default_node_info = null; + + /** + * GetNodeInfoResponse application_version. + * @member {cosmos.base.tendermint.v1beta1.IVersionInfo|null|undefined} application_version + * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoResponse + * @instance + */ + GetNodeInfoResponse.prototype.application_version = null; + + /** + * Encodes the specified GetNodeInfoResponse message. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetNodeInfoResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoResponse + * @static + * @param {cosmos.base.tendermint.v1beta1.IGetNodeInfoResponse} message GetNodeInfoResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetNodeInfoResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.default_node_info != null && Object.hasOwnProperty.call(message, "default_node_info")) + $root.tendermint.p2p.DefaultNodeInfo.encode(message.default_node_info, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.application_version != null && Object.hasOwnProperty.call(message, "application_version")) + $root.cosmos.base.tendermint.v1beta1.VersionInfo.encode(message.application_version, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetNodeInfoResponse message, length delimited. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetNodeInfoResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoResponse + * @static + * @param {cosmos.base.tendermint.v1beta1.IGetNodeInfoResponse} message GetNodeInfoResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetNodeInfoResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetNodeInfoResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.tendermint.v1beta1.GetNodeInfoResponse} GetNodeInfoResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetNodeInfoResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.tendermint.v1beta1.GetNodeInfoResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.default_node_info = $root.tendermint.p2p.DefaultNodeInfo.decode(reader, reader.uint32()); + break; + case 2: + message.application_version = $root.cosmos.base.tendermint.v1beta1.VersionInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetNodeInfoResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.tendermint.v1beta1.GetNodeInfoResponse} GetNodeInfoResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetNodeInfoResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetNodeInfoResponse message. + * @function verify + * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetNodeInfoResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.default_node_info != null && message.hasOwnProperty("default_node_info")) { + let error = $root.tendermint.p2p.DefaultNodeInfo.verify(message.default_node_info); + if (error) + return "default_node_info." + error; + } + if (message.application_version != null && message.hasOwnProperty("application_version")) { + let error = $root.cosmos.base.tendermint.v1beta1.VersionInfo.verify(message.application_version); + if (error) + return "application_version." + error; + } + return null; + }; + + /** + * Creates a GetNodeInfoResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.tendermint.v1beta1.GetNodeInfoResponse} GetNodeInfoResponse + */ + GetNodeInfoResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.tendermint.v1beta1.GetNodeInfoResponse) + return object; + let message = new $root.cosmos.base.tendermint.v1beta1.GetNodeInfoResponse(); + if (object.default_node_info != null) { + if (typeof object.default_node_info !== "object") + throw TypeError(".cosmos.base.tendermint.v1beta1.GetNodeInfoResponse.default_node_info: object expected"); + message.default_node_info = $root.tendermint.p2p.DefaultNodeInfo.fromObject(object.default_node_info); + } + if (object.application_version != null) { + if (typeof object.application_version !== "object") + throw TypeError(".cosmos.base.tendermint.v1beta1.GetNodeInfoResponse.application_version: object expected"); + message.application_version = $root.cosmos.base.tendermint.v1beta1.VersionInfo.fromObject(object.application_version); + } + return message; + }; + + /** + * Creates a plain object from a GetNodeInfoResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoResponse + * @static + * @param {cosmos.base.tendermint.v1beta1.GetNodeInfoResponse} message GetNodeInfoResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetNodeInfoResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.default_node_info = null; + object.application_version = null; + } + if (message.default_node_info != null && message.hasOwnProperty("default_node_info")) + object.default_node_info = $root.tendermint.p2p.DefaultNodeInfo.toObject(message.default_node_info, options); + if (message.application_version != null && message.hasOwnProperty("application_version")) + object.application_version = $root.cosmos.base.tendermint.v1beta1.VersionInfo.toObject(message.application_version, options); + return object; + }; + + /** + * Converts this GetNodeInfoResponse to JSON. + * @function toJSON + * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoResponse + * @instance + * @returns {Object.} JSON object + */ + GetNodeInfoResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetNodeInfoResponse; + })(); + + v1beta1.VersionInfo = (function() { + + /** + * Properties of a VersionInfo. + * @memberof cosmos.base.tendermint.v1beta1 + * @interface IVersionInfo + * @property {string|null} [name] VersionInfo name + * @property {string|null} [app_name] VersionInfo app_name + * @property {string|null} [version] VersionInfo version + * @property {string|null} [git_commit] VersionInfo git_commit + * @property {string|null} [build_tags] VersionInfo build_tags + * @property {string|null} [go_version] VersionInfo go_version + * @property {Array.|null} [build_deps] VersionInfo build_deps + */ + + /** + * Constructs a new VersionInfo. + * @memberof cosmos.base.tendermint.v1beta1 + * @classdesc Represents a VersionInfo. + * @implements IVersionInfo + * @constructor + * @param {cosmos.base.tendermint.v1beta1.IVersionInfo=} [properties] Properties to set + */ + function VersionInfo(properties) { + this.build_deps = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * VersionInfo name. + * @member {string} name + * @memberof cosmos.base.tendermint.v1beta1.VersionInfo + * @instance + */ + VersionInfo.prototype.name = ""; + + /** + * VersionInfo app_name. + * @member {string} app_name + * @memberof cosmos.base.tendermint.v1beta1.VersionInfo + * @instance + */ + VersionInfo.prototype.app_name = ""; + + /** + * VersionInfo version. + * @member {string} version + * @memberof cosmos.base.tendermint.v1beta1.VersionInfo + * @instance + */ + VersionInfo.prototype.version = ""; + + /** + * VersionInfo git_commit. + * @member {string} git_commit + * @memberof cosmos.base.tendermint.v1beta1.VersionInfo + * @instance + */ + VersionInfo.prototype.git_commit = ""; + + /** + * VersionInfo build_tags. + * @member {string} build_tags + * @memberof cosmos.base.tendermint.v1beta1.VersionInfo + * @instance + */ + VersionInfo.prototype.build_tags = ""; + + /** + * VersionInfo go_version. + * @member {string} go_version + * @memberof cosmos.base.tendermint.v1beta1.VersionInfo + * @instance + */ + VersionInfo.prototype.go_version = ""; + + /** + * VersionInfo build_deps. + * @member {Array.} build_deps + * @memberof cosmos.base.tendermint.v1beta1.VersionInfo + * @instance + */ + VersionInfo.prototype.build_deps = $util.emptyArray; + + /** + * Encodes the specified VersionInfo message. Does not implicitly {@link cosmos.base.tendermint.v1beta1.VersionInfo.verify|verify} messages. + * @function encode + * @memberof cosmos.base.tendermint.v1beta1.VersionInfo + * @static + * @param {cosmos.base.tendermint.v1beta1.IVersionInfo} message VersionInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VersionInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.app_name != null && Object.hasOwnProperty.call(message, "app_name")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.app_name); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.version); + if (message.git_commit != null && Object.hasOwnProperty.call(message, "git_commit")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.git_commit); + if (message.build_tags != null && Object.hasOwnProperty.call(message, "build_tags")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.build_tags); + if (message.go_version != null && Object.hasOwnProperty.call(message, "go_version")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.go_version); + if (message.build_deps != null && message.build_deps.length) + for (let i = 0; i < message.build_deps.length; ++i) + $root.cosmos.base.tendermint.v1beta1.Module.encode(message.build_deps[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified VersionInfo message, length delimited. Does not implicitly {@link cosmos.base.tendermint.v1beta1.VersionInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.tendermint.v1beta1.VersionInfo + * @static + * @param {cosmos.base.tendermint.v1beta1.IVersionInfo} message VersionInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VersionInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VersionInfo message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.tendermint.v1beta1.VersionInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.tendermint.v1beta1.VersionInfo} VersionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VersionInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.tendermint.v1beta1.VersionInfo(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.app_name = reader.string(); + break; + case 3: + message.version = reader.string(); + break; + case 4: + message.git_commit = reader.string(); + break; + case 5: + message.build_tags = reader.string(); + break; + case 6: + message.go_version = reader.string(); + break; + case 7: + if (!(message.build_deps && message.build_deps.length)) + message.build_deps = []; + message.build_deps.push($root.cosmos.base.tendermint.v1beta1.Module.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VersionInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.tendermint.v1beta1.VersionInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.tendermint.v1beta1.VersionInfo} VersionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VersionInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VersionInfo message. + * @function verify + * @memberof cosmos.base.tendermint.v1beta1.VersionInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VersionInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.app_name != null && message.hasOwnProperty("app_name")) + if (!$util.isString(message.app_name)) + return "app_name: string expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + if (message.git_commit != null && message.hasOwnProperty("git_commit")) + if (!$util.isString(message.git_commit)) + return "git_commit: string expected"; + if (message.build_tags != null && message.hasOwnProperty("build_tags")) + if (!$util.isString(message.build_tags)) + return "build_tags: string expected"; + if (message.go_version != null && message.hasOwnProperty("go_version")) + if (!$util.isString(message.go_version)) + return "go_version: string expected"; + if (message.build_deps != null && message.hasOwnProperty("build_deps")) { + if (!Array.isArray(message.build_deps)) + return "build_deps: array expected"; + for (let i = 0; i < message.build_deps.length; ++i) { + let error = $root.cosmos.base.tendermint.v1beta1.Module.verify(message.build_deps[i]); + if (error) + return "build_deps." + error; + } + } + return null; + }; + + /** + * Creates a VersionInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.tendermint.v1beta1.VersionInfo + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.tendermint.v1beta1.VersionInfo} VersionInfo + */ + VersionInfo.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.tendermint.v1beta1.VersionInfo) + return object; + let message = new $root.cosmos.base.tendermint.v1beta1.VersionInfo(); + if (object.name != null) + message.name = String(object.name); + if (object.app_name != null) + message.app_name = String(object.app_name); + if (object.version != null) + message.version = String(object.version); + if (object.git_commit != null) + message.git_commit = String(object.git_commit); + if (object.build_tags != null) + message.build_tags = String(object.build_tags); + if (object.go_version != null) + message.go_version = String(object.go_version); + if (object.build_deps) { + if (!Array.isArray(object.build_deps)) + throw TypeError(".cosmos.base.tendermint.v1beta1.VersionInfo.build_deps: array expected"); + message.build_deps = []; + for (let i = 0; i < object.build_deps.length; ++i) { + if (typeof object.build_deps[i] !== "object") + throw TypeError(".cosmos.base.tendermint.v1beta1.VersionInfo.build_deps: object expected"); + message.build_deps[i] = $root.cosmos.base.tendermint.v1beta1.Module.fromObject(object.build_deps[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a VersionInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.tendermint.v1beta1.VersionInfo + * @static + * @param {cosmos.base.tendermint.v1beta1.VersionInfo} message VersionInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VersionInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.build_deps = []; + if (options.defaults) { + object.name = ""; + object.app_name = ""; + object.version = ""; + object.git_commit = ""; + object.build_tags = ""; + object.go_version = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.app_name != null && message.hasOwnProperty("app_name")) + object.app_name = message.app_name; + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + if (message.git_commit != null && message.hasOwnProperty("git_commit")) + object.git_commit = message.git_commit; + if (message.build_tags != null && message.hasOwnProperty("build_tags")) + object.build_tags = message.build_tags; + if (message.go_version != null && message.hasOwnProperty("go_version")) + object.go_version = message.go_version; + if (message.build_deps && message.build_deps.length) { + object.build_deps = []; + for (let j = 0; j < message.build_deps.length; ++j) + object.build_deps[j] = $root.cosmos.base.tendermint.v1beta1.Module.toObject(message.build_deps[j], options); + } + return object; + }; + + /** + * Converts this VersionInfo to JSON. + * @function toJSON + * @memberof cosmos.base.tendermint.v1beta1.VersionInfo + * @instance + * @returns {Object.} JSON object + */ + VersionInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return VersionInfo; + })(); + + v1beta1.Module = (function() { + + /** + * Properties of a Module. + * @memberof cosmos.base.tendermint.v1beta1 + * @interface IModule + * @property {string|null} [path] Module path + * @property {string|null} [version] Module version + * @property {string|null} [sum] Module sum + */ + + /** + * Constructs a new Module. + * @memberof cosmos.base.tendermint.v1beta1 + * @classdesc Represents a Module. + * @implements IModule + * @constructor + * @param {cosmos.base.tendermint.v1beta1.IModule=} [properties] Properties to set + */ + function Module(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Module path. + * @member {string} path + * @memberof cosmos.base.tendermint.v1beta1.Module + * @instance + */ + Module.prototype.path = ""; + + /** + * Module version. + * @member {string} version + * @memberof cosmos.base.tendermint.v1beta1.Module + * @instance + */ + Module.prototype.version = ""; + + /** + * Module sum. + * @member {string} sum + * @memberof cosmos.base.tendermint.v1beta1.Module + * @instance + */ + Module.prototype.sum = ""; + + /** + * Encodes the specified Module message. Does not implicitly {@link cosmos.base.tendermint.v1beta1.Module.verify|verify} messages. + * @function encode + * @memberof cosmos.base.tendermint.v1beta1.Module + * @static + * @param {cosmos.base.tendermint.v1beta1.IModule} message Module message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Module.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.path); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.version); + if (message.sum != null && Object.hasOwnProperty.call(message, "sum")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.sum); + return writer; + }; + + /** + * Encodes the specified Module message, length delimited. Does not implicitly {@link cosmos.base.tendermint.v1beta1.Module.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.tendermint.v1beta1.Module + * @static + * @param {cosmos.base.tendermint.v1beta1.IModule} message Module message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Module.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Module message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.tendermint.v1beta1.Module + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.tendermint.v1beta1.Module} Module + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Module.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.tendermint.v1beta1.Module(); + while (reader.pos < end) { + let 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; + }; + + /** + * Decodes a Module message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.tendermint.v1beta1.Module + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.tendermint.v1beta1.Module} Module + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Module.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Module message. + * @function verify + * @memberof cosmos.base.tendermint.v1beta1.Module + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Module.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!$util.isString(message.path)) + return "path: string expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + if (message.sum != null && message.hasOwnProperty("sum")) + if (!$util.isString(message.sum)) + return "sum: string expected"; + return null; + }; + + /** + * Creates a Module message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.tendermint.v1beta1.Module + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.tendermint.v1beta1.Module} Module + */ + Module.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.tendermint.v1beta1.Module) + return object; + let message = new $root.cosmos.base.tendermint.v1beta1.Module(); + if (object.path != null) + message.path = String(object.path); + if (object.version != null) + message.version = String(object.version); + if (object.sum != null) + message.sum = String(object.sum); + return message; + }; + + /** + * Creates a plain object from a Module message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.tendermint.v1beta1.Module + * @static + * @param {cosmos.base.tendermint.v1beta1.Module} message Module + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Module.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.path = ""; + object.version = ""; + object.sum = ""; + } + if (message.path != null && message.hasOwnProperty("path")) + object.path = message.path; + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + if (message.sum != null && message.hasOwnProperty("sum")) + object.sum = message.sum; + return object; + }; + + /** + * Converts this Module to JSON. + * @function toJSON + * @memberof cosmos.base.tendermint.v1beta1.Module + * @instance + * @returns {Object.} JSON object + */ + Module.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Module; + })(); + + return v1beta1; + })(); + + return tendermint; + })(); + + base.v1beta1 = (function() { + + /** + * Namespace v1beta1. + * @memberof cosmos.base + * @namespace + */ + const v1beta1 = {}; + + v1beta1.Coin = (function() { + + /** + * Properties of a Coin. + * @memberof cosmos.base.v1beta1 + * @interface ICoin + * @property {string|null} [denom] Coin denom + * @property {string|null} [amount] Coin amount + */ + + /** + * Constructs a new Coin. + * @memberof cosmos.base.v1beta1 + * @classdesc Represents a Coin. + * @implements ICoin + * @constructor + * @param {cosmos.base.v1beta1.ICoin=} [properties] Properties to set + */ + function Coin(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Coin denom. + * @member {string} denom + * @memberof cosmos.base.v1beta1.Coin + * @instance + */ + Coin.prototype.denom = ""; + + /** + * Coin amount. + * @member {string} amount + * @memberof cosmos.base.v1beta1.Coin + * @instance + */ + Coin.prototype.amount = ""; + + /** + * Encodes the specified Coin message. Does not implicitly {@link cosmos.base.v1beta1.Coin.verify|verify} messages. + * @function encode + * @memberof cosmos.base.v1beta1.Coin + * @static + * @param {cosmos.base.v1beta1.ICoin} message Coin message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Coin.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.denom != null && Object.hasOwnProperty.call(message, "denom")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.denom); + if (message.amount != null && Object.hasOwnProperty.call(message, "amount")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.amount); + return writer; + }; + + /** + * Encodes the specified Coin message, length delimited. Does not implicitly {@link cosmos.base.v1beta1.Coin.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.v1beta1.Coin + * @static + * @param {cosmos.base.v1beta1.ICoin} message Coin message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Coin.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Coin message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.v1beta1.Coin + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.v1beta1.Coin} Coin + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Coin.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.v1beta1.Coin(); + while (reader.pos < end) { + let 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; + }; + + /** + * Decodes a Coin message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.v1beta1.Coin + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.v1beta1.Coin} Coin + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Coin.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Coin message. + * @function verify + * @memberof cosmos.base.v1beta1.Coin + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Coin.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.denom != null && message.hasOwnProperty("denom")) + if (!$util.isString(message.denom)) + return "denom: string expected"; + if (message.amount != null && message.hasOwnProperty("amount")) + if (!$util.isString(message.amount)) + return "amount: string expected"; + return null; + }; + + /** + * Creates a Coin message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.v1beta1.Coin + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.v1beta1.Coin} Coin + */ + Coin.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.v1beta1.Coin) + return object; + let message = new $root.cosmos.base.v1beta1.Coin(); + if (object.denom != null) + message.denom = String(object.denom); + if (object.amount != null) + message.amount = String(object.amount); + return message; + }; + + /** + * Creates a plain object from a Coin message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.v1beta1.Coin + * @static + * @param {cosmos.base.v1beta1.Coin} message Coin + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Coin.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.denom = ""; + object.amount = ""; + } + if (message.denom != null && message.hasOwnProperty("denom")) + object.denom = message.denom; + if (message.amount != null && message.hasOwnProperty("amount")) + object.amount = message.amount; + return object; + }; + + /** + * Converts this Coin to JSON. + * @function toJSON + * @memberof cosmos.base.v1beta1.Coin + * @instance + * @returns {Object.} JSON object + */ + Coin.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Coin; + })(); + + v1beta1.DecCoin = (function() { + + /** + * Properties of a DecCoin. + * @memberof cosmos.base.v1beta1 + * @interface IDecCoin + * @property {string|null} [denom] DecCoin denom + * @property {string|null} [amount] DecCoin amount + */ + + /** + * Constructs a new DecCoin. + * @memberof cosmos.base.v1beta1 + * @classdesc Represents a DecCoin. + * @implements IDecCoin + * @constructor + * @param {cosmos.base.v1beta1.IDecCoin=} [properties] Properties to set + */ + function DecCoin(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DecCoin denom. + * @member {string} denom + * @memberof cosmos.base.v1beta1.DecCoin + * @instance + */ + DecCoin.prototype.denom = ""; + + /** + * DecCoin amount. + * @member {string} amount + * @memberof cosmos.base.v1beta1.DecCoin + * @instance + */ + DecCoin.prototype.amount = ""; + + /** + * Encodes the specified DecCoin message. Does not implicitly {@link cosmos.base.v1beta1.DecCoin.verify|verify} messages. + * @function encode + * @memberof cosmos.base.v1beta1.DecCoin + * @static + * @param {cosmos.base.v1beta1.IDecCoin} message DecCoin message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DecCoin.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.denom != null && Object.hasOwnProperty.call(message, "denom")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.denom); + if (message.amount != null && Object.hasOwnProperty.call(message, "amount")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.amount); + return writer; + }; + + /** + * Encodes the specified DecCoin message, length delimited. Does not implicitly {@link cosmos.base.v1beta1.DecCoin.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.v1beta1.DecCoin + * @static + * @param {cosmos.base.v1beta1.IDecCoin} message DecCoin message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DecCoin.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DecCoin message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.v1beta1.DecCoin + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.v1beta1.DecCoin} DecCoin + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DecCoin.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.v1beta1.DecCoin(); + while (reader.pos < end) { + let 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; + }; + + /** + * Decodes a DecCoin message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.v1beta1.DecCoin + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.v1beta1.DecCoin} DecCoin + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DecCoin.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DecCoin message. + * @function verify + * @memberof cosmos.base.v1beta1.DecCoin + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DecCoin.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.denom != null && message.hasOwnProperty("denom")) + if (!$util.isString(message.denom)) + return "denom: string expected"; + if (message.amount != null && message.hasOwnProperty("amount")) + if (!$util.isString(message.amount)) + return "amount: string expected"; + return null; + }; + + /** + * Creates a DecCoin message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.v1beta1.DecCoin + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.v1beta1.DecCoin} DecCoin + */ + DecCoin.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.v1beta1.DecCoin) + return object; + let message = new $root.cosmos.base.v1beta1.DecCoin(); + if (object.denom != null) + message.denom = String(object.denom); + if (object.amount != null) + message.amount = String(object.amount); + return message; + }; + + /** + * Creates a plain object from a DecCoin message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.v1beta1.DecCoin + * @static + * @param {cosmos.base.v1beta1.DecCoin} message DecCoin + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DecCoin.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.denom = ""; + object.amount = ""; + } + if (message.denom != null && message.hasOwnProperty("denom")) + object.denom = message.denom; + if (message.amount != null && message.hasOwnProperty("amount")) + object.amount = message.amount; + return object; + }; + + /** + * Converts this DecCoin to JSON. + * @function toJSON + * @memberof cosmos.base.v1beta1.DecCoin + * @instance + * @returns {Object.} JSON object + */ + DecCoin.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DecCoin; + })(); + + v1beta1.IntProto = (function() { + + /** + * Properties of an IntProto. + * @memberof cosmos.base.v1beta1 + * @interface IIntProto + * @property {string|null} [int] IntProto int + */ + + /** + * Constructs a new IntProto. + * @memberof cosmos.base.v1beta1 + * @classdesc Represents an IntProto. + * @implements IIntProto + * @constructor + * @param {cosmos.base.v1beta1.IIntProto=} [properties] Properties to set + */ + function IntProto(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * IntProto int. + * @member {string} int + * @memberof cosmos.base.v1beta1.IntProto + * @instance + */ + IntProto.prototype.int = ""; + + /** + * Encodes the specified IntProto message. Does not implicitly {@link cosmos.base.v1beta1.IntProto.verify|verify} messages. + * @function encode + * @memberof cosmos.base.v1beta1.IntProto + * @static + * @param {cosmos.base.v1beta1.IIntProto} message IntProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IntProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.int != null && Object.hasOwnProperty.call(message, "int")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.int); + return writer; + }; + + /** + * Encodes the specified IntProto message, length delimited. Does not implicitly {@link cosmos.base.v1beta1.IntProto.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.v1beta1.IntProto + * @static + * @param {cosmos.base.v1beta1.IIntProto} message IntProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IntProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an IntProto message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.v1beta1.IntProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.v1beta1.IntProto} IntProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IntProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.v1beta1.IntProto(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.int = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an IntProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.v1beta1.IntProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.v1beta1.IntProto} IntProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IntProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IntProto message. + * @function verify + * @memberof cosmos.base.v1beta1.IntProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IntProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.int != null && message.hasOwnProperty("int")) + if (!$util.isString(message.int)) + return "int: string expected"; + return null; + }; + + /** + * Creates an IntProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.v1beta1.IntProto + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.v1beta1.IntProto} IntProto + */ + IntProto.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.v1beta1.IntProto) + return object; + let message = new $root.cosmos.base.v1beta1.IntProto(); + if (object.int != null) + message.int = String(object.int); + return message; + }; + + /** + * Creates a plain object from an IntProto message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.v1beta1.IntProto + * @static + * @param {cosmos.base.v1beta1.IntProto} message IntProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IntProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.int = ""; + if (message.int != null && message.hasOwnProperty("int")) + object.int = message.int; + return object; + }; + + /** + * Converts this IntProto to JSON. + * @function toJSON + * @memberof cosmos.base.v1beta1.IntProto + * @instance + * @returns {Object.} JSON object + */ + IntProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return IntProto; + })(); + + v1beta1.DecProto = (function() { + + /** + * Properties of a DecProto. + * @memberof cosmos.base.v1beta1 + * @interface IDecProto + * @property {string|null} [dec] DecProto dec + */ + + /** + * Constructs a new DecProto. + * @memberof cosmos.base.v1beta1 + * @classdesc Represents a DecProto. + * @implements IDecProto + * @constructor + * @param {cosmos.base.v1beta1.IDecProto=} [properties] Properties to set + */ + function DecProto(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DecProto dec. + * @member {string} dec + * @memberof cosmos.base.v1beta1.DecProto + * @instance + */ + DecProto.prototype.dec = ""; + + /** + * Encodes the specified DecProto message. Does not implicitly {@link cosmos.base.v1beta1.DecProto.verify|verify} messages. + * @function encode + * @memberof cosmos.base.v1beta1.DecProto + * @static + * @param {cosmos.base.v1beta1.IDecProto} message DecProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DecProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.dec != null && Object.hasOwnProperty.call(message, "dec")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.dec); + return writer; + }; + + /** + * Encodes the specified DecProto message, length delimited. Does not implicitly {@link cosmos.base.v1beta1.DecProto.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.base.v1beta1.DecProto + * @static + * @param {cosmos.base.v1beta1.IDecProto} message DecProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DecProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DecProto message from the specified reader or buffer. + * @function decode + * @memberof cosmos.base.v1beta1.DecProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.base.v1beta1.DecProto} DecProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DecProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.v1beta1.DecProto(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.dec = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DecProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.base.v1beta1.DecProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.base.v1beta1.DecProto} DecProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DecProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DecProto message. + * @function verify + * @memberof cosmos.base.v1beta1.DecProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DecProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.dec != null && message.hasOwnProperty("dec")) + if (!$util.isString(message.dec)) + return "dec: string expected"; + return null; + }; + + /** + * Creates a DecProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.base.v1beta1.DecProto + * @static + * @param {Object.} object Plain object + * @returns {cosmos.base.v1beta1.DecProto} DecProto + */ + DecProto.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.base.v1beta1.DecProto) + return object; + let message = new $root.cosmos.base.v1beta1.DecProto(); + if (object.dec != null) + message.dec = String(object.dec); + return message; + }; + + /** + * Creates a plain object from a DecProto message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.base.v1beta1.DecProto + * @static + * @param {cosmos.base.v1beta1.DecProto} message DecProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DecProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.dec = ""; + if (message.dec != null && message.hasOwnProperty("dec")) + object.dec = message.dec; + return object; + }; + + /** + * Converts this DecProto to JSON. + * @function toJSON + * @memberof cosmos.base.v1beta1.DecProto + * @instance + * @returns {Object.} JSON object + */ + DecProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DecProto; + })(); + + return v1beta1; + })(); + + return base; + })(); + + cosmos.capability = (function() { + + /** + * Namespace capability. + * @memberof cosmos + * @namespace + */ + const capability = {}; + + capability.v1beta1 = (function() { + + /** + * Namespace v1beta1. + * @memberof cosmos.capability + * @namespace + */ + const v1beta1 = {}; + + v1beta1.Capability = (function() { + + /** + * Properties of a Capability. + * @memberof cosmos.capability.v1beta1 + * @interface ICapability + * @property {Long|null} [index] Capability index + */ + + /** + * Constructs a new Capability. + * @memberof cosmos.capability.v1beta1 + * @classdesc Represents a Capability. + * @implements ICapability + * @constructor + * @param {cosmos.capability.v1beta1.ICapability=} [properties] Properties to set + */ + function Capability(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Capability index. + * @member {Long} index + * @memberof cosmos.capability.v1beta1.Capability + * @instance + */ + Capability.prototype.index = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified Capability message. Does not implicitly {@link cosmos.capability.v1beta1.Capability.verify|verify} messages. + * @function encode + * @memberof cosmos.capability.v1beta1.Capability + * @static + * @param {cosmos.capability.v1beta1.ICapability} message Capability message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Capability.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.index != null && Object.hasOwnProperty.call(message, "index")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.index); + return writer; + }; + + /** + * Encodes the specified Capability message, length delimited. Does not implicitly {@link cosmos.capability.v1beta1.Capability.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.capability.v1beta1.Capability + * @static + * @param {cosmos.capability.v1beta1.ICapability} message Capability message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Capability.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Capability message from the specified reader or buffer. + * @function decode + * @memberof cosmos.capability.v1beta1.Capability + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.capability.v1beta1.Capability} Capability + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Capability.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.capability.v1beta1.Capability(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Capability message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.capability.v1beta1.Capability + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.capability.v1beta1.Capability} Capability + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Capability.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Capability message. + * @function verify + * @memberof cosmos.capability.v1beta1.Capability + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Capability.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.index != null && message.hasOwnProperty("index")) + if (!$util.isInteger(message.index) && !(message.index && $util.isInteger(message.index.low) && $util.isInteger(message.index.high))) + return "index: integer|Long expected"; + return null; + }; + + /** + * Creates a Capability message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.capability.v1beta1.Capability + * @static + * @param {Object.} object Plain object + * @returns {cosmos.capability.v1beta1.Capability} Capability + */ + Capability.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.capability.v1beta1.Capability) + return object; + let message = new $root.cosmos.capability.v1beta1.Capability(); + if (object.index != null) + if ($util.Long) + (message.index = $util.Long.fromValue(object.index)).unsigned = true; + else if (typeof object.index === "string") + message.index = parseInt(object.index, 10); + else if (typeof object.index === "number") + message.index = object.index; + else if (typeof object.index === "object") + message.index = new $util.LongBits(object.index.low >>> 0, object.index.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a Capability message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.capability.v1beta1.Capability + * @static + * @param {cosmos.capability.v1beta1.Capability} message Capability + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Capability.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.index = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.index = options.longs === String ? "0" : 0; + if (message.index != null && message.hasOwnProperty("index")) + if (typeof message.index === "number") + object.index = options.longs === String ? String(message.index) : message.index; + else + object.index = options.longs === String ? $util.Long.prototype.toString.call(message.index) : options.longs === Number ? new $util.LongBits(message.index.low >>> 0, message.index.high >>> 0).toNumber(true) : message.index; + return object; + }; + + /** + * Converts this Capability to JSON. + * @function toJSON + * @memberof cosmos.capability.v1beta1.Capability + * @instance + * @returns {Object.} JSON object + */ + Capability.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Capability; + })(); + + v1beta1.Owner = (function() { + + /** + * Properties of an Owner. + * @memberof cosmos.capability.v1beta1 + * @interface IOwner + * @property {string|null} [module] Owner module + * @property {string|null} [name] Owner name + */ + + /** + * Constructs a new Owner. + * @memberof cosmos.capability.v1beta1 + * @classdesc Represents an Owner. + * @implements IOwner + * @constructor + * @param {cosmos.capability.v1beta1.IOwner=} [properties] Properties to set + */ + function Owner(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Owner module. + * @member {string} module + * @memberof cosmos.capability.v1beta1.Owner + * @instance + */ + Owner.prototype.module = ""; + + /** + * Owner name. + * @member {string} name + * @memberof cosmos.capability.v1beta1.Owner + * @instance + */ + Owner.prototype.name = ""; + + /** + * Encodes the specified Owner message. Does not implicitly {@link cosmos.capability.v1beta1.Owner.verify|verify} messages. + * @function encode + * @memberof cosmos.capability.v1beta1.Owner + * @static + * @param {cosmos.capability.v1beta1.IOwner} message Owner message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Owner.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.module != null && Object.hasOwnProperty.call(message, "module")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.module); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.name); + return writer; + }; + + /** + * Encodes the specified Owner message, length delimited. Does not implicitly {@link cosmos.capability.v1beta1.Owner.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.capability.v1beta1.Owner + * @static + * @param {cosmos.capability.v1beta1.IOwner} message Owner message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Owner.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Owner message from the specified reader or buffer. + * @function decode + * @memberof cosmos.capability.v1beta1.Owner + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.capability.v1beta1.Owner} Owner + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Owner.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.capability.v1beta1.Owner(); + while (reader.pos < end) { + let 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; + }; + + /** + * Decodes an Owner message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.capability.v1beta1.Owner + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.capability.v1beta1.Owner} Owner + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Owner.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Owner message. + * @function verify + * @memberof cosmos.capability.v1beta1.Owner + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Owner.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.module != null && message.hasOwnProperty("module")) + if (!$util.isString(message.module)) + return "module: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates an Owner message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.capability.v1beta1.Owner + * @static + * @param {Object.} object Plain object + * @returns {cosmos.capability.v1beta1.Owner} Owner + */ + Owner.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.capability.v1beta1.Owner) + return object; + let message = new $root.cosmos.capability.v1beta1.Owner(); + if (object.module != null) + message.module = String(object.module); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from an Owner message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.capability.v1beta1.Owner + * @static + * @param {cosmos.capability.v1beta1.Owner} message Owner + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Owner.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.module = ""; + object.name = ""; + } + if (message.module != null && message.hasOwnProperty("module")) + object.module = message.module; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this Owner to JSON. + * @function toJSON + * @memberof cosmos.capability.v1beta1.Owner + * @instance + * @returns {Object.} JSON object + */ + Owner.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Owner; + })(); + + v1beta1.CapabilityOwners = (function() { + + /** + * Properties of a CapabilityOwners. + * @memberof cosmos.capability.v1beta1 + * @interface ICapabilityOwners + * @property {Array.|null} [owners] CapabilityOwners owners + */ + + /** + * Constructs a new CapabilityOwners. + * @memberof cosmos.capability.v1beta1 + * @classdesc Represents a CapabilityOwners. + * @implements ICapabilityOwners + * @constructor + * @param {cosmos.capability.v1beta1.ICapabilityOwners=} [properties] Properties to set + */ + function CapabilityOwners(properties) { + this.owners = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CapabilityOwners owners. + * @member {Array.} owners + * @memberof cosmos.capability.v1beta1.CapabilityOwners + * @instance + */ + CapabilityOwners.prototype.owners = $util.emptyArray; + + /** + * Encodes the specified CapabilityOwners message. Does not implicitly {@link cosmos.capability.v1beta1.CapabilityOwners.verify|verify} messages. + * @function encode + * @memberof cosmos.capability.v1beta1.CapabilityOwners + * @static + * @param {cosmos.capability.v1beta1.ICapabilityOwners} message CapabilityOwners message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CapabilityOwners.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.owners != null && message.owners.length) + for (let i = 0; i < message.owners.length; ++i) + $root.cosmos.capability.v1beta1.Owner.encode(message.owners[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CapabilityOwners message, length delimited. Does not implicitly {@link cosmos.capability.v1beta1.CapabilityOwners.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.capability.v1beta1.CapabilityOwners + * @static + * @param {cosmos.capability.v1beta1.ICapabilityOwners} message CapabilityOwners message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CapabilityOwners.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CapabilityOwners message from the specified reader or buffer. + * @function decode + * @memberof cosmos.capability.v1beta1.CapabilityOwners + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.capability.v1beta1.CapabilityOwners} CapabilityOwners + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CapabilityOwners.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.capability.v1beta1.CapabilityOwners(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.owners && message.owners.length)) + message.owners = []; + message.owners.push($root.cosmos.capability.v1beta1.Owner.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CapabilityOwners message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.capability.v1beta1.CapabilityOwners + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.capability.v1beta1.CapabilityOwners} CapabilityOwners + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CapabilityOwners.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CapabilityOwners message. + * @function verify + * @memberof cosmos.capability.v1beta1.CapabilityOwners + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CapabilityOwners.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.owners != null && message.hasOwnProperty("owners")) { + if (!Array.isArray(message.owners)) + return "owners: array expected"; + for (let i = 0; i < message.owners.length; ++i) { + let error = $root.cosmos.capability.v1beta1.Owner.verify(message.owners[i]); + if (error) + return "owners." + error; + } + } + return null; + }; + + /** + * Creates a CapabilityOwners message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.capability.v1beta1.CapabilityOwners + * @static + * @param {Object.} object Plain object + * @returns {cosmos.capability.v1beta1.CapabilityOwners} CapabilityOwners + */ + CapabilityOwners.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.capability.v1beta1.CapabilityOwners) + return object; + let message = new $root.cosmos.capability.v1beta1.CapabilityOwners(); + if (object.owners) { + if (!Array.isArray(object.owners)) + throw TypeError(".cosmos.capability.v1beta1.CapabilityOwners.owners: array expected"); + message.owners = []; + for (let i = 0; i < object.owners.length; ++i) { + if (typeof object.owners[i] !== "object") + throw TypeError(".cosmos.capability.v1beta1.CapabilityOwners.owners: object expected"); + message.owners[i] = $root.cosmos.capability.v1beta1.Owner.fromObject(object.owners[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a CapabilityOwners message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.capability.v1beta1.CapabilityOwners + * @static + * @param {cosmos.capability.v1beta1.CapabilityOwners} message CapabilityOwners + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CapabilityOwners.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.owners = []; + if (message.owners && message.owners.length) { + object.owners = []; + for (let j = 0; j < message.owners.length; ++j) + object.owners[j] = $root.cosmos.capability.v1beta1.Owner.toObject(message.owners[j], options); + } + return object; + }; + + /** + * Converts this CapabilityOwners to JSON. + * @function toJSON + * @memberof cosmos.capability.v1beta1.CapabilityOwners + * @instance + * @returns {Object.} JSON object + */ + CapabilityOwners.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CapabilityOwners; + })(); + + v1beta1.GenesisOwners = (function() { + + /** + * Properties of a GenesisOwners. + * @memberof cosmos.capability.v1beta1 + * @interface IGenesisOwners + * @property {Long|null} [index] GenesisOwners index + * @property {cosmos.capability.v1beta1.ICapabilityOwners|null} [index_owners] GenesisOwners index_owners + */ + + /** + * Constructs a new GenesisOwners. + * @memberof cosmos.capability.v1beta1 + * @classdesc Represents a GenesisOwners. + * @implements IGenesisOwners + * @constructor + * @param {cosmos.capability.v1beta1.IGenesisOwners=} [properties] Properties to set + */ + function GenesisOwners(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenesisOwners index. + * @member {Long} index + * @memberof cosmos.capability.v1beta1.GenesisOwners + * @instance + */ + GenesisOwners.prototype.index = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * GenesisOwners index_owners. + * @member {cosmos.capability.v1beta1.ICapabilityOwners|null|undefined} index_owners + * @memberof cosmos.capability.v1beta1.GenesisOwners + * @instance + */ + GenesisOwners.prototype.index_owners = null; + + /** + * Encodes the specified GenesisOwners message. Does not implicitly {@link cosmos.capability.v1beta1.GenesisOwners.verify|verify} messages. + * @function encode + * @memberof cosmos.capability.v1beta1.GenesisOwners + * @static + * @param {cosmos.capability.v1beta1.IGenesisOwners} message GenesisOwners message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisOwners.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.index != null && Object.hasOwnProperty.call(message, "index")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.index); + if (message.index_owners != null && Object.hasOwnProperty.call(message, "index_owners")) + $root.cosmos.capability.v1beta1.CapabilityOwners.encode(message.index_owners, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GenesisOwners message, length delimited. Does not implicitly {@link cosmos.capability.v1beta1.GenesisOwners.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.capability.v1beta1.GenesisOwners + * @static + * @param {cosmos.capability.v1beta1.IGenesisOwners} message GenesisOwners message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisOwners.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenesisOwners message from the specified reader or buffer. + * @function decode + * @memberof cosmos.capability.v1beta1.GenesisOwners + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.capability.v1beta1.GenesisOwners} GenesisOwners + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisOwners.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.capability.v1beta1.GenesisOwners(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = reader.uint64(); + break; + case 2: + message.index_owners = $root.cosmos.capability.v1beta1.CapabilityOwners.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenesisOwners message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.capability.v1beta1.GenesisOwners + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.capability.v1beta1.GenesisOwners} GenesisOwners + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisOwners.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenesisOwners message. + * @function verify + * @memberof cosmos.capability.v1beta1.GenesisOwners + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenesisOwners.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.index != null && message.hasOwnProperty("index")) + if (!$util.isInteger(message.index) && !(message.index && $util.isInteger(message.index.low) && $util.isInteger(message.index.high))) + return "index: integer|Long expected"; + if (message.index_owners != null && message.hasOwnProperty("index_owners")) { + let error = $root.cosmos.capability.v1beta1.CapabilityOwners.verify(message.index_owners); + if (error) + return "index_owners." + error; + } + return null; + }; + + /** + * Creates a GenesisOwners message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.capability.v1beta1.GenesisOwners + * @static + * @param {Object.} object Plain object + * @returns {cosmos.capability.v1beta1.GenesisOwners} GenesisOwners + */ + GenesisOwners.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.capability.v1beta1.GenesisOwners) + return object; + let message = new $root.cosmos.capability.v1beta1.GenesisOwners(); + if (object.index != null) + if ($util.Long) + (message.index = $util.Long.fromValue(object.index)).unsigned = true; + else if (typeof object.index === "string") + message.index = parseInt(object.index, 10); + else if (typeof object.index === "number") + message.index = object.index; + else if (typeof object.index === "object") + message.index = new $util.LongBits(object.index.low >>> 0, object.index.high >>> 0).toNumber(true); + if (object.index_owners != null) { + if (typeof object.index_owners !== "object") + throw TypeError(".cosmos.capability.v1beta1.GenesisOwners.index_owners: object expected"); + message.index_owners = $root.cosmos.capability.v1beta1.CapabilityOwners.fromObject(object.index_owners); + } + return message; + }; + + /** + * Creates a plain object from a GenesisOwners message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.capability.v1beta1.GenesisOwners + * @static + * @param {cosmos.capability.v1beta1.GenesisOwners} message GenesisOwners + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenesisOwners.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.index = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.index = options.longs === String ? "0" : 0; + object.index_owners = null; + } + if (message.index != null && message.hasOwnProperty("index")) + if (typeof message.index === "number") + object.index = options.longs === String ? String(message.index) : message.index; + else + object.index = options.longs === String ? $util.Long.prototype.toString.call(message.index) : options.longs === Number ? new $util.LongBits(message.index.low >>> 0, message.index.high >>> 0).toNumber(true) : message.index; + if (message.index_owners != null && message.hasOwnProperty("index_owners")) + object.index_owners = $root.cosmos.capability.v1beta1.CapabilityOwners.toObject(message.index_owners, options); + return object; + }; + + /** + * Converts this GenesisOwners to JSON. + * @function toJSON + * @memberof cosmos.capability.v1beta1.GenesisOwners + * @instance + * @returns {Object.} JSON object + */ + GenesisOwners.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenesisOwners; + })(); + + v1beta1.GenesisState = (function() { + + /** + * Properties of a GenesisState. + * @memberof cosmos.capability.v1beta1 + * @interface IGenesisState + * @property {Long|null} [index] GenesisState index + * @property {Array.|null} [owners] GenesisState owners + */ + + /** + * Constructs a new GenesisState. + * @memberof cosmos.capability.v1beta1 + * @classdesc Represents a GenesisState. + * @implements IGenesisState + * @constructor + * @param {cosmos.capability.v1beta1.IGenesisState=} [properties] Properties to set + */ + function GenesisState(properties) { + this.owners = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenesisState index. + * @member {Long} index + * @memberof cosmos.capability.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.index = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * GenesisState owners. + * @member {Array.} owners + * @memberof cosmos.capability.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.owners = $util.emptyArray; + + /** + * Encodes the specified GenesisState message. Does not implicitly {@link cosmos.capability.v1beta1.GenesisState.verify|verify} messages. + * @function encode + * @memberof cosmos.capability.v1beta1.GenesisState + * @static + * @param {cosmos.capability.v1beta1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.index != null && Object.hasOwnProperty.call(message, "index")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.index); + if (message.owners != null && message.owners.length) + for (let i = 0; i < message.owners.length; ++i) + $root.cosmos.capability.v1beta1.GenesisOwners.encode(message.owners[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link cosmos.capability.v1beta1.GenesisState.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.capability.v1beta1.GenesisState + * @static + * @param {cosmos.capability.v1beta1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer. + * @function decode + * @memberof cosmos.capability.v1beta1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.capability.v1beta1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.capability.v1beta1.GenesisState(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = reader.uint64(); + break; + case 2: + if (!(message.owners && message.owners.length)) + message.owners = []; + message.owners.push($root.cosmos.capability.v1beta1.GenesisOwners.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.capability.v1beta1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.capability.v1beta1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenesisState message. + * @function verify + * @memberof cosmos.capability.v1beta1.GenesisState + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenesisState.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.index != null && message.hasOwnProperty("index")) + if (!$util.isInteger(message.index) && !(message.index && $util.isInteger(message.index.low) && $util.isInteger(message.index.high))) + return "index: integer|Long expected"; + if (message.owners != null && message.hasOwnProperty("owners")) { + if (!Array.isArray(message.owners)) + return "owners: array expected"; + for (let i = 0; i < message.owners.length; ++i) { + let error = $root.cosmos.capability.v1beta1.GenesisOwners.verify(message.owners[i]); + if (error) + return "owners." + error; + } + } + return null; + }; + + /** + * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.capability.v1beta1.GenesisState + * @static + * @param {Object.} object Plain object + * @returns {cosmos.capability.v1beta1.GenesisState} GenesisState + */ + GenesisState.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.capability.v1beta1.GenesisState) + return object; + let message = new $root.cosmos.capability.v1beta1.GenesisState(); + if (object.index != null) + if ($util.Long) + (message.index = $util.Long.fromValue(object.index)).unsigned = true; + else if (typeof object.index === "string") + message.index = parseInt(object.index, 10); + else if (typeof object.index === "number") + message.index = object.index; + else if (typeof object.index === "object") + message.index = new $util.LongBits(object.index.low >>> 0, object.index.high >>> 0).toNumber(true); + if (object.owners) { + if (!Array.isArray(object.owners)) + throw TypeError(".cosmos.capability.v1beta1.GenesisState.owners: array expected"); + message.owners = []; + for (let i = 0; i < object.owners.length; ++i) { + if (typeof object.owners[i] !== "object") + throw TypeError(".cosmos.capability.v1beta1.GenesisState.owners: object expected"); + message.owners[i] = $root.cosmos.capability.v1beta1.GenesisOwners.fromObject(object.owners[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a GenesisState message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.capability.v1beta1.GenesisState + * @static + * @param {cosmos.capability.v1beta1.GenesisState} message GenesisState + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenesisState.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.owners = []; + if (options.defaults) + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.index = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.index = options.longs === String ? "0" : 0; + if (message.index != null && message.hasOwnProperty("index")) + if (typeof message.index === "number") + object.index = options.longs === String ? String(message.index) : message.index; + else + object.index = options.longs === String ? $util.Long.prototype.toString.call(message.index) : options.longs === Number ? new $util.LongBits(message.index.low >>> 0, message.index.high >>> 0).toNumber(true) : message.index; + if (message.owners && message.owners.length) { + object.owners = []; + for (let j = 0; j < message.owners.length; ++j) + object.owners[j] = $root.cosmos.capability.v1beta1.GenesisOwners.toObject(message.owners[j], options); + } + return object; + }; + + /** + * Converts this GenesisState to JSON. + * @function toJSON + * @memberof cosmos.capability.v1beta1.GenesisState + * @instance + * @returns {Object.} JSON object + */ + GenesisState.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenesisState; + })(); + + return v1beta1; + })(); + + return capability; + })(); + + cosmos.crisis = (function() { + + /** + * Namespace crisis. + * @memberof cosmos + * @namespace + */ + const crisis = {}; + + crisis.v1beta1 = (function() { + + /** + * Namespace v1beta1. + * @memberof cosmos.crisis + * @namespace + */ + const v1beta1 = {}; + + v1beta1.Msg = (function() { + + /** + * Constructs a new Msg service. + * @memberof cosmos.crisis.v1beta1 + * @classdesc Represents a Msg + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Msg(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Msg.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Msg; + + /** + * Callback as used by {@link cosmos.crisis.v1beta1.Msg#verifyInvariant}. + * @memberof cosmos.crisis.v1beta1.Msg + * @typedef VerifyInvariantCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.crisis.v1beta1.MsgVerifyInvariantResponse} [response] MsgVerifyInvariantResponse + */ + + /** + * Calls VerifyInvariant. + * @function verifyInvariant + * @memberof cosmos.crisis.v1beta1.Msg + * @instance + * @param {cosmos.crisis.v1beta1.IMsgVerifyInvariant} request MsgVerifyInvariant message or plain object + * @param {cosmos.crisis.v1beta1.Msg.VerifyInvariantCallback} callback Node-style callback called with the error, if any, and MsgVerifyInvariantResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.verifyInvariant = function verifyInvariant(request, callback) { + return this.rpcCall(verifyInvariant, $root.cosmos.crisis.v1beta1.MsgVerifyInvariant, $root.cosmos.crisis.v1beta1.MsgVerifyInvariantResponse, request, callback); + }, "name", { value: "VerifyInvariant" }); + + /** + * Calls VerifyInvariant. + * @function verifyInvariant + * @memberof cosmos.crisis.v1beta1.Msg + * @instance + * @param {cosmos.crisis.v1beta1.IMsgVerifyInvariant} request MsgVerifyInvariant message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Msg; + })(); + + v1beta1.MsgVerifyInvariant = (function() { + + /** + * Properties of a MsgVerifyInvariant. + * @memberof cosmos.crisis.v1beta1 + * @interface IMsgVerifyInvariant + * @property {string|null} [sender] MsgVerifyInvariant sender + * @property {string|null} [invariant_module_name] MsgVerifyInvariant invariant_module_name + * @property {string|null} [invariant_route] MsgVerifyInvariant invariant_route + */ + + /** + * Constructs a new MsgVerifyInvariant. + * @memberof cosmos.crisis.v1beta1 + * @classdesc Represents a MsgVerifyInvariant. + * @implements IMsgVerifyInvariant + * @constructor + * @param {cosmos.crisis.v1beta1.IMsgVerifyInvariant=} [properties] Properties to set + */ + function MsgVerifyInvariant(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgVerifyInvariant sender. + * @member {string} sender + * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariant + * @instance + */ + MsgVerifyInvariant.prototype.sender = ""; + + /** + * MsgVerifyInvariant invariant_module_name. + * @member {string} invariant_module_name + * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariant + * @instance + */ + MsgVerifyInvariant.prototype.invariant_module_name = ""; + + /** + * MsgVerifyInvariant invariant_route. + * @member {string} invariant_route + * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariant + * @instance + */ + MsgVerifyInvariant.prototype.invariant_route = ""; + + /** + * Encodes the specified MsgVerifyInvariant message. Does not implicitly {@link cosmos.crisis.v1beta1.MsgVerifyInvariant.verify|verify} messages. + * @function encode + * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariant + * @static + * @param {cosmos.crisis.v1beta1.IMsgVerifyInvariant} message MsgVerifyInvariant message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgVerifyInvariant.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sender != null && Object.hasOwnProperty.call(message, "sender")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.sender); + if (message.invariant_module_name != null && Object.hasOwnProperty.call(message, "invariant_module_name")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.invariant_module_name); + if (message.invariant_route != null && Object.hasOwnProperty.call(message, "invariant_route")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.invariant_route); + return writer; + }; + + /** + * Encodes the specified MsgVerifyInvariant message, length delimited. Does not implicitly {@link cosmos.crisis.v1beta1.MsgVerifyInvariant.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariant + * @static + * @param {cosmos.crisis.v1beta1.IMsgVerifyInvariant} message MsgVerifyInvariant message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgVerifyInvariant.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgVerifyInvariant message from the specified reader or buffer. + * @function decode + * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariant + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.crisis.v1beta1.MsgVerifyInvariant} MsgVerifyInvariant + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgVerifyInvariant.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.crisis.v1beta1.MsgVerifyInvariant(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sender = reader.string(); + break; + case 2: + message.invariant_module_name = reader.string(); + break; + case 3: + message.invariant_route = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgVerifyInvariant message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariant + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.crisis.v1beta1.MsgVerifyInvariant} MsgVerifyInvariant + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgVerifyInvariant.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgVerifyInvariant message. + * @function verify + * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariant + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgVerifyInvariant.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sender != null && message.hasOwnProperty("sender")) + if (!$util.isString(message.sender)) + return "sender: string expected"; + if (message.invariant_module_name != null && message.hasOwnProperty("invariant_module_name")) + if (!$util.isString(message.invariant_module_name)) + return "invariant_module_name: string expected"; + if (message.invariant_route != null && message.hasOwnProperty("invariant_route")) + if (!$util.isString(message.invariant_route)) + return "invariant_route: string expected"; + return null; + }; + + /** + * Creates a MsgVerifyInvariant message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariant + * @static + * @param {Object.} object Plain object + * @returns {cosmos.crisis.v1beta1.MsgVerifyInvariant} MsgVerifyInvariant + */ + MsgVerifyInvariant.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.crisis.v1beta1.MsgVerifyInvariant) + return object; + let message = new $root.cosmos.crisis.v1beta1.MsgVerifyInvariant(); + if (object.sender != null) + message.sender = String(object.sender); + if (object.invariant_module_name != null) + message.invariant_module_name = String(object.invariant_module_name); + if (object.invariant_route != null) + message.invariant_route = String(object.invariant_route); + return message; + }; + + /** + * Creates a plain object from a MsgVerifyInvariant message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariant + * @static + * @param {cosmos.crisis.v1beta1.MsgVerifyInvariant} message MsgVerifyInvariant + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgVerifyInvariant.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.sender = ""; + object.invariant_module_name = ""; + object.invariant_route = ""; + } + if (message.sender != null && message.hasOwnProperty("sender")) + object.sender = message.sender; + if (message.invariant_module_name != null && message.hasOwnProperty("invariant_module_name")) + object.invariant_module_name = message.invariant_module_name; + if (message.invariant_route != null && message.hasOwnProperty("invariant_route")) + object.invariant_route = message.invariant_route; + return object; + }; + + /** + * Converts this MsgVerifyInvariant to JSON. + * @function toJSON + * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariant + * @instance + * @returns {Object.} JSON object + */ + MsgVerifyInvariant.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgVerifyInvariant; + })(); + + v1beta1.MsgVerifyInvariantResponse = (function() { + + /** + * Properties of a MsgVerifyInvariantResponse. + * @memberof cosmos.crisis.v1beta1 + * @interface IMsgVerifyInvariantResponse + */ + + /** + * Constructs a new MsgVerifyInvariantResponse. + * @memberof cosmos.crisis.v1beta1 + * @classdesc Represents a MsgVerifyInvariantResponse. + * @implements IMsgVerifyInvariantResponse + * @constructor + * @param {cosmos.crisis.v1beta1.IMsgVerifyInvariantResponse=} [properties] Properties to set + */ + function MsgVerifyInvariantResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgVerifyInvariantResponse message. Does not implicitly {@link cosmos.crisis.v1beta1.MsgVerifyInvariantResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariantResponse + * @static + * @param {cosmos.crisis.v1beta1.IMsgVerifyInvariantResponse} message MsgVerifyInvariantResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgVerifyInvariantResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgVerifyInvariantResponse message, length delimited. Does not implicitly {@link cosmos.crisis.v1beta1.MsgVerifyInvariantResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariantResponse + * @static + * @param {cosmos.crisis.v1beta1.IMsgVerifyInvariantResponse} message MsgVerifyInvariantResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgVerifyInvariantResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgVerifyInvariantResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariantResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.crisis.v1beta1.MsgVerifyInvariantResponse} MsgVerifyInvariantResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgVerifyInvariantResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.crisis.v1beta1.MsgVerifyInvariantResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgVerifyInvariantResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariantResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.crisis.v1beta1.MsgVerifyInvariantResponse} MsgVerifyInvariantResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgVerifyInvariantResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgVerifyInvariantResponse message. + * @function verify + * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariantResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgVerifyInvariantResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgVerifyInvariantResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariantResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.crisis.v1beta1.MsgVerifyInvariantResponse} MsgVerifyInvariantResponse + */ + MsgVerifyInvariantResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.crisis.v1beta1.MsgVerifyInvariantResponse) + return object; + return new $root.cosmos.crisis.v1beta1.MsgVerifyInvariantResponse(); + }; + + /** + * Creates a plain object from a MsgVerifyInvariantResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariantResponse + * @static + * @param {cosmos.crisis.v1beta1.MsgVerifyInvariantResponse} message MsgVerifyInvariantResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgVerifyInvariantResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgVerifyInvariantResponse to JSON. + * @function toJSON + * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariantResponse + * @instance + * @returns {Object.} JSON object + */ + MsgVerifyInvariantResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgVerifyInvariantResponse; + })(); + + v1beta1.GenesisState = (function() { + + /** + * Properties of a GenesisState. + * @memberof cosmos.crisis.v1beta1 + * @interface IGenesisState + * @property {cosmos.base.v1beta1.ICoin|null} [constant_fee] GenesisState constant_fee + */ + + /** + * Constructs a new GenesisState. + * @memberof cosmos.crisis.v1beta1 + * @classdesc Represents a GenesisState. + * @implements IGenesisState + * @constructor + * @param {cosmos.crisis.v1beta1.IGenesisState=} [properties] Properties to set + */ + function GenesisState(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenesisState constant_fee. + * @member {cosmos.base.v1beta1.ICoin|null|undefined} constant_fee + * @memberof cosmos.crisis.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.constant_fee = null; + + /** + * Encodes the specified GenesisState message. Does not implicitly {@link cosmos.crisis.v1beta1.GenesisState.verify|verify} messages. + * @function encode + * @memberof cosmos.crisis.v1beta1.GenesisState + * @static + * @param {cosmos.crisis.v1beta1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.constant_fee != null && Object.hasOwnProperty.call(message, "constant_fee")) + $root.cosmos.base.v1beta1.Coin.encode(message.constant_fee, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link cosmos.crisis.v1beta1.GenesisState.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.crisis.v1beta1.GenesisState + * @static + * @param {cosmos.crisis.v1beta1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer. + * @function decode + * @memberof cosmos.crisis.v1beta1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.crisis.v1beta1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.crisis.v1beta1.GenesisState(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + message.constant_fee = $root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.crisis.v1beta1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.crisis.v1beta1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenesisState message. + * @function verify + * @memberof cosmos.crisis.v1beta1.GenesisState + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenesisState.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.constant_fee != null && message.hasOwnProperty("constant_fee")) { + let error = $root.cosmos.base.v1beta1.Coin.verify(message.constant_fee); + if (error) + return "constant_fee." + error; + } + return null; + }; + + /** + * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.crisis.v1beta1.GenesisState + * @static + * @param {Object.} object Plain object + * @returns {cosmos.crisis.v1beta1.GenesisState} GenesisState + */ + GenesisState.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.crisis.v1beta1.GenesisState) + return object; + let message = new $root.cosmos.crisis.v1beta1.GenesisState(); + if (object.constant_fee != null) { + if (typeof object.constant_fee !== "object") + throw TypeError(".cosmos.crisis.v1beta1.GenesisState.constant_fee: object expected"); + message.constant_fee = $root.cosmos.base.v1beta1.Coin.fromObject(object.constant_fee); + } + return message; + }; + + /** + * Creates a plain object from a GenesisState message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.crisis.v1beta1.GenesisState + * @static + * @param {cosmos.crisis.v1beta1.GenesisState} message GenesisState + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenesisState.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.constant_fee = null; + if (message.constant_fee != null && message.hasOwnProperty("constant_fee")) + object.constant_fee = $root.cosmos.base.v1beta1.Coin.toObject(message.constant_fee, options); + return object; + }; + + /** + * Converts this GenesisState to JSON. + * @function toJSON + * @memberof cosmos.crisis.v1beta1.GenesisState + * @instance + * @returns {Object.} JSON object + */ + GenesisState.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenesisState; + })(); + + return v1beta1; + })(); + + return crisis; + })(); + + cosmos.crypto = (function() { + + /** + * Namespace crypto. + * @memberof cosmos + * @namespace + */ + const crypto = {}; + + crypto.ed25519 = (function() { + + /** + * Namespace ed25519. + * @memberof cosmos.crypto + * @namespace + */ + const ed25519 = {}; + + ed25519.PubKey = (function() { + + /** + * Properties of a PubKey. + * @memberof cosmos.crypto.ed25519 + * @interface IPubKey + * @property {Uint8Array|null} [key] PubKey key + */ + + /** + * Constructs a new PubKey. + * @memberof cosmos.crypto.ed25519 + * @classdesc Represents a PubKey. + * @implements IPubKey + * @constructor + * @param {cosmos.crypto.ed25519.IPubKey=} [properties] Properties to set + */ + function PubKey(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PubKey key. + * @member {Uint8Array} key + * @memberof cosmos.crypto.ed25519.PubKey + * @instance + */ + PubKey.prototype.key = $util.newBuffer([]); + + /** + * Encodes the specified PubKey message. Does not implicitly {@link cosmos.crypto.ed25519.PubKey.verify|verify} messages. + * @function encode + * @memberof cosmos.crypto.ed25519.PubKey + * @static + * @param {cosmos.crypto.ed25519.IPubKey} message PubKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PubKey.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); + return writer; + }; + + /** + * Encodes the specified PubKey message, length delimited. Does not implicitly {@link cosmos.crypto.ed25519.PubKey.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.crypto.ed25519.PubKey + * @static + * @param {cosmos.crypto.ed25519.IPubKey} message PubKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PubKey.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PubKey message from the specified reader or buffer. + * @function decode + * @memberof cosmos.crypto.ed25519.PubKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.crypto.ed25519.PubKey} PubKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PubKey.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.crypto.ed25519.PubKey(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PubKey message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.crypto.ed25519.PubKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.crypto.ed25519.PubKey} PubKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PubKey.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PubKey message. + * @function verify + * @memberof cosmos.crypto.ed25519.PubKey + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PubKey.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) + return "key: buffer expected"; + return null; + }; + + /** + * Creates a PubKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.crypto.ed25519.PubKey + * @static + * @param {Object.} object Plain object + * @returns {cosmos.crypto.ed25519.PubKey} PubKey + */ + PubKey.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.crypto.ed25519.PubKey) + return object; + let message = new $root.cosmos.crypto.ed25519.PubKey(); + if (object.key != null) + if (typeof object.key === "string") + $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); + else if (object.key.length) + message.key = object.key; + return message; + }; + + /** + * Creates a plain object from a PubKey message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.crypto.ed25519.PubKey + * @static + * @param {cosmos.crypto.ed25519.PubKey} message PubKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PubKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + if (options.bytes === String) + object.key = ""; + else { + object.key = []; + if (options.bytes !== Array) + object.key = $util.newBuffer(object.key); + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; + return object; + }; + + /** + * Converts this PubKey to JSON. + * @function toJSON + * @memberof cosmos.crypto.ed25519.PubKey + * @instance + * @returns {Object.} JSON object + */ + PubKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PubKey; + })(); + + ed25519.PrivKey = (function() { + + /** + * Properties of a PrivKey. + * @memberof cosmos.crypto.ed25519 + * @interface IPrivKey + * @property {Uint8Array|null} [key] PrivKey key + */ + + /** + * Constructs a new PrivKey. + * @memberof cosmos.crypto.ed25519 + * @classdesc Represents a PrivKey. + * @implements IPrivKey + * @constructor + * @param {cosmos.crypto.ed25519.IPrivKey=} [properties] Properties to set + */ + function PrivKey(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PrivKey key. + * @member {Uint8Array} key + * @memberof cosmos.crypto.ed25519.PrivKey + * @instance + */ + PrivKey.prototype.key = $util.newBuffer([]); + + /** + * Encodes the specified PrivKey message. Does not implicitly {@link cosmos.crypto.ed25519.PrivKey.verify|verify} messages. + * @function encode + * @memberof cosmos.crypto.ed25519.PrivKey + * @static + * @param {cosmos.crypto.ed25519.IPrivKey} message PrivKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PrivKey.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); + return writer; + }; + + /** + * Encodes the specified PrivKey message, length delimited. Does not implicitly {@link cosmos.crypto.ed25519.PrivKey.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.crypto.ed25519.PrivKey + * @static + * @param {cosmos.crypto.ed25519.IPrivKey} message PrivKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PrivKey.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PrivKey message from the specified reader or buffer. + * @function decode + * @memberof cosmos.crypto.ed25519.PrivKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.crypto.ed25519.PrivKey} PrivKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PrivKey.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.crypto.ed25519.PrivKey(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PrivKey message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.crypto.ed25519.PrivKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.crypto.ed25519.PrivKey} PrivKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PrivKey.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PrivKey message. + * @function verify + * @memberof cosmos.crypto.ed25519.PrivKey + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PrivKey.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) + return "key: buffer expected"; + return null; + }; + + /** + * Creates a PrivKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.crypto.ed25519.PrivKey + * @static + * @param {Object.} object Plain object + * @returns {cosmos.crypto.ed25519.PrivKey} PrivKey + */ + PrivKey.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.crypto.ed25519.PrivKey) + return object; + let message = new $root.cosmos.crypto.ed25519.PrivKey(); + if (object.key != null) + if (typeof object.key === "string") + $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); + else if (object.key.length) + message.key = object.key; + return message; + }; + + /** + * Creates a plain object from a PrivKey message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.crypto.ed25519.PrivKey + * @static + * @param {cosmos.crypto.ed25519.PrivKey} message PrivKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PrivKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + if (options.bytes === String) + object.key = ""; + else { + object.key = []; + if (options.bytes !== Array) + object.key = $util.newBuffer(object.key); + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; + return object; + }; + + /** + * Converts this PrivKey to JSON. + * @function toJSON + * @memberof cosmos.crypto.ed25519.PrivKey + * @instance + * @returns {Object.} JSON object + */ + PrivKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PrivKey; + })(); + + return ed25519; + })(); + + crypto.multisig = (function() { + + /** + * Namespace multisig. + * @memberof cosmos.crypto + * @namespace + */ + const multisig = {}; + + multisig.LegacyAminoPubKey = (function() { + + /** + * Properties of a LegacyAminoPubKey. + * @memberof cosmos.crypto.multisig + * @interface ILegacyAminoPubKey + * @property {number|null} [threshold] LegacyAminoPubKey threshold + * @property {Array.|null} [public_keys] LegacyAminoPubKey public_keys + */ + + /** + * Constructs a new LegacyAminoPubKey. + * @memberof cosmos.crypto.multisig + * @classdesc Represents a LegacyAminoPubKey. + * @implements ILegacyAminoPubKey + * @constructor + * @param {cosmos.crypto.multisig.ILegacyAminoPubKey=} [properties] Properties to set + */ + function LegacyAminoPubKey(properties) { + this.public_keys = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LegacyAminoPubKey threshold. + * @member {number} threshold + * @memberof cosmos.crypto.multisig.LegacyAminoPubKey + * @instance + */ + LegacyAminoPubKey.prototype.threshold = 0; + + /** + * LegacyAminoPubKey public_keys. + * @member {Array.} public_keys + * @memberof cosmos.crypto.multisig.LegacyAminoPubKey + * @instance + */ + LegacyAminoPubKey.prototype.public_keys = $util.emptyArray; + + /** + * Encodes the specified LegacyAminoPubKey message. Does not implicitly {@link cosmos.crypto.multisig.LegacyAminoPubKey.verify|verify} messages. + * @function encode + * @memberof cosmos.crypto.multisig.LegacyAminoPubKey + * @static + * @param {cosmos.crypto.multisig.ILegacyAminoPubKey} message LegacyAminoPubKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LegacyAminoPubKey.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.threshold != null && Object.hasOwnProperty.call(message, "threshold")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.threshold); + if (message.public_keys != null && message.public_keys.length) + for (let i = 0; i < message.public_keys.length; ++i) + $root.google.protobuf.Any.encode(message.public_keys[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified LegacyAminoPubKey message, length delimited. Does not implicitly {@link cosmos.crypto.multisig.LegacyAminoPubKey.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.crypto.multisig.LegacyAminoPubKey + * @static + * @param {cosmos.crypto.multisig.ILegacyAminoPubKey} message LegacyAminoPubKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LegacyAminoPubKey.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LegacyAminoPubKey message from the specified reader or buffer. + * @function decode + * @memberof cosmos.crypto.multisig.LegacyAminoPubKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.crypto.multisig.LegacyAminoPubKey} LegacyAminoPubKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LegacyAminoPubKey.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.crypto.multisig.LegacyAminoPubKey(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.threshold = reader.uint32(); + break; + case 2: + if (!(message.public_keys && message.public_keys.length)) + message.public_keys = []; + message.public_keys.push($root.google.protobuf.Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LegacyAminoPubKey message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.crypto.multisig.LegacyAminoPubKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.crypto.multisig.LegacyAminoPubKey} LegacyAminoPubKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LegacyAminoPubKey.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LegacyAminoPubKey message. + * @function verify + * @memberof cosmos.crypto.multisig.LegacyAminoPubKey + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LegacyAminoPubKey.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.threshold != null && message.hasOwnProperty("threshold")) + if (!$util.isInteger(message.threshold)) + return "threshold: integer expected"; + if (message.public_keys != null && message.hasOwnProperty("public_keys")) { + if (!Array.isArray(message.public_keys)) + return "public_keys: array expected"; + for (let i = 0; i < message.public_keys.length; ++i) { + let error = $root.google.protobuf.Any.verify(message.public_keys[i]); + if (error) + return "public_keys." + error; + } + } + return null; + }; + + /** + * Creates a LegacyAminoPubKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.crypto.multisig.LegacyAminoPubKey + * @static + * @param {Object.} object Plain object + * @returns {cosmos.crypto.multisig.LegacyAminoPubKey} LegacyAminoPubKey + */ + LegacyAminoPubKey.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.crypto.multisig.LegacyAminoPubKey) + return object; + let message = new $root.cosmos.crypto.multisig.LegacyAminoPubKey(); + if (object.threshold != null) + message.threshold = object.threshold >>> 0; + if (object.public_keys) { + if (!Array.isArray(object.public_keys)) + throw TypeError(".cosmos.crypto.multisig.LegacyAminoPubKey.public_keys: array expected"); + message.public_keys = []; + for (let i = 0; i < object.public_keys.length; ++i) { + if (typeof object.public_keys[i] !== "object") + throw TypeError(".cosmos.crypto.multisig.LegacyAminoPubKey.public_keys: object expected"); + message.public_keys[i] = $root.google.protobuf.Any.fromObject(object.public_keys[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a LegacyAminoPubKey message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.crypto.multisig.LegacyAminoPubKey + * @static + * @param {cosmos.crypto.multisig.LegacyAminoPubKey} message LegacyAminoPubKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LegacyAminoPubKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.public_keys = []; + if (options.defaults) + object.threshold = 0; + if (message.threshold != null && message.hasOwnProperty("threshold")) + object.threshold = message.threshold; + if (message.public_keys && message.public_keys.length) { + object.public_keys = []; + for (let j = 0; j < message.public_keys.length; ++j) + object.public_keys[j] = $root.google.protobuf.Any.toObject(message.public_keys[j], options); + } + return object; + }; + + /** + * Converts this LegacyAminoPubKey to JSON. + * @function toJSON + * @memberof cosmos.crypto.multisig.LegacyAminoPubKey + * @instance + * @returns {Object.} JSON object + */ + LegacyAminoPubKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return LegacyAminoPubKey; + })(); + + multisig.v1beta1 = (function() { + + /** + * Namespace v1beta1. + * @memberof cosmos.crypto.multisig + * @namespace + */ + const v1beta1 = {}; + + v1beta1.MultiSignature = (function() { + + /** + * Properties of a MultiSignature. + * @memberof cosmos.crypto.multisig.v1beta1 + * @interface IMultiSignature + * @property {Array.|null} [signatures] MultiSignature signatures + */ + + /** + * Constructs a new MultiSignature. + * @memberof cosmos.crypto.multisig.v1beta1 + * @classdesc Represents a MultiSignature. + * @implements IMultiSignature + * @constructor + * @param {cosmos.crypto.multisig.v1beta1.IMultiSignature=} [properties] Properties to set + */ + function MultiSignature(properties) { + this.signatures = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MultiSignature signatures. + * @member {Array.} signatures + * @memberof cosmos.crypto.multisig.v1beta1.MultiSignature + * @instance + */ + MultiSignature.prototype.signatures = $util.emptyArray; + + /** + * Encodes the specified MultiSignature message. Does not implicitly {@link cosmos.crypto.multisig.v1beta1.MultiSignature.verify|verify} messages. + * @function encode + * @memberof cosmos.crypto.multisig.v1beta1.MultiSignature + * @static + * @param {cosmos.crypto.multisig.v1beta1.IMultiSignature} message MultiSignature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MultiSignature.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.signatures != null && message.signatures.length) + for (let i = 0; i < message.signatures.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.signatures[i]); + return writer; + }; + + /** + * Encodes the specified MultiSignature message, length delimited. Does not implicitly {@link cosmos.crypto.multisig.v1beta1.MultiSignature.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.crypto.multisig.v1beta1.MultiSignature + * @static + * @param {cosmos.crypto.multisig.v1beta1.IMultiSignature} message MultiSignature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MultiSignature.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MultiSignature message from the specified reader or buffer. + * @function decode + * @memberof cosmos.crypto.multisig.v1beta1.MultiSignature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.crypto.multisig.v1beta1.MultiSignature} MultiSignature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MultiSignature.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.crypto.multisig.v1beta1.MultiSignature(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.signatures && message.signatures.length)) + message.signatures = []; + message.signatures.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MultiSignature message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.crypto.multisig.v1beta1.MultiSignature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.crypto.multisig.v1beta1.MultiSignature} MultiSignature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MultiSignature.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MultiSignature message. + * @function verify + * @memberof cosmos.crypto.multisig.v1beta1.MultiSignature + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MultiSignature.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.signatures != null && message.hasOwnProperty("signatures")) { + if (!Array.isArray(message.signatures)) + return "signatures: array expected"; + for (let i = 0; i < message.signatures.length; ++i) + if (!(message.signatures[i] && typeof message.signatures[i].length === "number" || $util.isString(message.signatures[i]))) + return "signatures: buffer[] expected"; + } + return null; + }; + + /** + * Creates a MultiSignature message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.crypto.multisig.v1beta1.MultiSignature + * @static + * @param {Object.} object Plain object + * @returns {cosmos.crypto.multisig.v1beta1.MultiSignature} MultiSignature + */ + MultiSignature.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.crypto.multisig.v1beta1.MultiSignature) + return object; + let message = new $root.cosmos.crypto.multisig.v1beta1.MultiSignature(); + if (object.signatures) { + if (!Array.isArray(object.signatures)) + throw TypeError(".cosmos.crypto.multisig.v1beta1.MultiSignature.signatures: array expected"); + message.signatures = []; + for (let i = 0; i < object.signatures.length; ++i) + if (typeof object.signatures[i] === "string") + $util.base64.decode(object.signatures[i], message.signatures[i] = $util.newBuffer($util.base64.length(object.signatures[i])), 0); + else if (object.signatures[i].length) + message.signatures[i] = object.signatures[i]; + } + return message; + }; + + /** + * Creates a plain object from a MultiSignature message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.crypto.multisig.v1beta1.MultiSignature + * @static + * @param {cosmos.crypto.multisig.v1beta1.MultiSignature} message MultiSignature + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MultiSignature.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.signatures = []; + if (message.signatures && message.signatures.length) { + object.signatures = []; + for (let j = 0; j < message.signatures.length; ++j) + object.signatures[j] = options.bytes === String ? $util.base64.encode(message.signatures[j], 0, message.signatures[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.signatures[j]) : message.signatures[j]; + } + return object; + }; + + /** + * Converts this MultiSignature to JSON. + * @function toJSON + * @memberof cosmos.crypto.multisig.v1beta1.MultiSignature + * @instance + * @returns {Object.} JSON object + */ + MultiSignature.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MultiSignature; + })(); + + v1beta1.CompactBitArray = (function() { + + /** + * Properties of a CompactBitArray. + * @memberof cosmos.crypto.multisig.v1beta1 + * @interface ICompactBitArray + * @property {number|null} [extra_bits_stored] CompactBitArray extra_bits_stored + * @property {Uint8Array|null} [elems] CompactBitArray elems + */ + + /** + * Constructs a new CompactBitArray. + * @memberof cosmos.crypto.multisig.v1beta1 + * @classdesc Represents a CompactBitArray. + * @implements ICompactBitArray + * @constructor + * @param {cosmos.crypto.multisig.v1beta1.ICompactBitArray=} [properties] Properties to set + */ + function CompactBitArray(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompactBitArray extra_bits_stored. + * @member {number} extra_bits_stored + * @memberof cosmos.crypto.multisig.v1beta1.CompactBitArray + * @instance + */ + CompactBitArray.prototype.extra_bits_stored = 0; + + /** + * CompactBitArray elems. + * @member {Uint8Array} elems + * @memberof cosmos.crypto.multisig.v1beta1.CompactBitArray + * @instance + */ + CompactBitArray.prototype.elems = $util.newBuffer([]); + + /** + * Encodes the specified CompactBitArray message. Does not implicitly {@link cosmos.crypto.multisig.v1beta1.CompactBitArray.verify|verify} messages. + * @function encode + * @memberof cosmos.crypto.multisig.v1beta1.CompactBitArray + * @static + * @param {cosmos.crypto.multisig.v1beta1.ICompactBitArray} message CompactBitArray message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompactBitArray.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.extra_bits_stored != null && Object.hasOwnProperty.call(message, "extra_bits_stored")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.extra_bits_stored); + if (message.elems != null && Object.hasOwnProperty.call(message, "elems")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.elems); + return writer; + }; + + /** + * Encodes the specified CompactBitArray message, length delimited. Does not implicitly {@link cosmos.crypto.multisig.v1beta1.CompactBitArray.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.crypto.multisig.v1beta1.CompactBitArray + * @static + * @param {cosmos.crypto.multisig.v1beta1.ICompactBitArray} message CompactBitArray message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompactBitArray.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CompactBitArray message from the specified reader or buffer. + * @function decode + * @memberof cosmos.crypto.multisig.v1beta1.CompactBitArray + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.crypto.multisig.v1beta1.CompactBitArray} CompactBitArray + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompactBitArray.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.crypto.multisig.v1beta1.CompactBitArray(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.extra_bits_stored = reader.uint32(); + break; + case 2: + message.elems = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CompactBitArray message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.crypto.multisig.v1beta1.CompactBitArray + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.crypto.multisig.v1beta1.CompactBitArray} CompactBitArray + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompactBitArray.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompactBitArray message. + * @function verify + * @memberof cosmos.crypto.multisig.v1beta1.CompactBitArray + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompactBitArray.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.extra_bits_stored != null && message.hasOwnProperty("extra_bits_stored")) + if (!$util.isInteger(message.extra_bits_stored)) + return "extra_bits_stored: integer expected"; + if (message.elems != null && message.hasOwnProperty("elems")) + if (!(message.elems && typeof message.elems.length === "number" || $util.isString(message.elems))) + return "elems: buffer expected"; + return null; + }; + + /** + * Creates a CompactBitArray message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.crypto.multisig.v1beta1.CompactBitArray + * @static + * @param {Object.} object Plain object + * @returns {cosmos.crypto.multisig.v1beta1.CompactBitArray} CompactBitArray + */ + CompactBitArray.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.crypto.multisig.v1beta1.CompactBitArray) + return object; + let message = new $root.cosmos.crypto.multisig.v1beta1.CompactBitArray(); + if (object.extra_bits_stored != null) + message.extra_bits_stored = object.extra_bits_stored >>> 0; + if (object.elems != null) + if (typeof object.elems === "string") + $util.base64.decode(object.elems, message.elems = $util.newBuffer($util.base64.length(object.elems)), 0); + else if (object.elems.length) + message.elems = object.elems; + return message; + }; + + /** + * Creates a plain object from a CompactBitArray message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.crypto.multisig.v1beta1.CompactBitArray + * @static + * @param {cosmos.crypto.multisig.v1beta1.CompactBitArray} message CompactBitArray + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompactBitArray.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.extra_bits_stored = 0; + if (options.bytes === String) + object.elems = ""; + else { + object.elems = []; + if (options.bytes !== Array) + object.elems = $util.newBuffer(object.elems); + } + } + if (message.extra_bits_stored != null && message.hasOwnProperty("extra_bits_stored")) + object.extra_bits_stored = message.extra_bits_stored; + if (message.elems != null && message.hasOwnProperty("elems")) + object.elems = options.bytes === String ? $util.base64.encode(message.elems, 0, message.elems.length) : options.bytes === Array ? Array.prototype.slice.call(message.elems) : message.elems; + return object; + }; + + /** + * Converts this CompactBitArray to JSON. + * @function toJSON + * @memberof cosmos.crypto.multisig.v1beta1.CompactBitArray + * @instance + * @returns {Object.} JSON object + */ + CompactBitArray.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CompactBitArray; + })(); + + return v1beta1; + })(); + + return multisig; + })(); + + crypto.secp256k1 = (function() { + + /** + * Namespace secp256k1. + * @memberof cosmos.crypto + * @namespace + */ + const secp256k1 = {}; + + secp256k1.PubKey = (function() { + + /** + * Properties of a PubKey. + * @memberof cosmos.crypto.secp256k1 + * @interface IPubKey + * @property {Uint8Array|null} [key] PubKey key + */ + + /** + * Constructs a new PubKey. + * @memberof cosmos.crypto.secp256k1 + * @classdesc Represents a PubKey. + * @implements IPubKey + * @constructor + * @param {cosmos.crypto.secp256k1.IPubKey=} [properties] Properties to set + */ + function PubKey(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PubKey key. + * @member {Uint8Array} key + * @memberof cosmos.crypto.secp256k1.PubKey + * @instance + */ + PubKey.prototype.key = $util.newBuffer([]); + + /** + * Encodes the specified PubKey message. Does not implicitly {@link cosmos.crypto.secp256k1.PubKey.verify|verify} messages. + * @function encode + * @memberof cosmos.crypto.secp256k1.PubKey + * @static + * @param {cosmos.crypto.secp256k1.IPubKey} message PubKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PubKey.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); + return writer; + }; + + /** + * Encodes the specified PubKey message, length delimited. Does not implicitly {@link cosmos.crypto.secp256k1.PubKey.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.crypto.secp256k1.PubKey + * @static + * @param {cosmos.crypto.secp256k1.IPubKey} message PubKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PubKey.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PubKey message from the specified reader or buffer. + * @function decode + * @memberof cosmos.crypto.secp256k1.PubKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.crypto.secp256k1.PubKey} PubKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PubKey.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.crypto.secp256k1.PubKey(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PubKey message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.crypto.secp256k1.PubKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.crypto.secp256k1.PubKey} PubKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PubKey.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PubKey message. + * @function verify + * @memberof cosmos.crypto.secp256k1.PubKey + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PubKey.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) + return "key: buffer expected"; + return null; + }; + + /** + * Creates a PubKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.crypto.secp256k1.PubKey + * @static + * @param {Object.} object Plain object + * @returns {cosmos.crypto.secp256k1.PubKey} PubKey + */ + PubKey.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.crypto.secp256k1.PubKey) + return object; + let message = new $root.cosmos.crypto.secp256k1.PubKey(); + if (object.key != null) + if (typeof object.key === "string") + $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); + else if (object.key.length) + message.key = object.key; + return message; + }; + + /** + * Creates a plain object from a PubKey message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.crypto.secp256k1.PubKey + * @static + * @param {cosmos.crypto.secp256k1.PubKey} message PubKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PubKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + if (options.bytes === String) + object.key = ""; + else { + object.key = []; + if (options.bytes !== Array) + object.key = $util.newBuffer(object.key); + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; + return object; + }; + + /** + * Converts this PubKey to JSON. + * @function toJSON + * @memberof cosmos.crypto.secp256k1.PubKey + * @instance + * @returns {Object.} JSON object + */ + PubKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PubKey; + })(); + + secp256k1.PrivKey = (function() { + + /** + * Properties of a PrivKey. + * @memberof cosmos.crypto.secp256k1 + * @interface IPrivKey + * @property {Uint8Array|null} [key] PrivKey key + */ + + /** + * Constructs a new PrivKey. + * @memberof cosmos.crypto.secp256k1 + * @classdesc Represents a PrivKey. + * @implements IPrivKey + * @constructor + * @param {cosmos.crypto.secp256k1.IPrivKey=} [properties] Properties to set + */ + function PrivKey(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PrivKey key. + * @member {Uint8Array} key + * @memberof cosmos.crypto.secp256k1.PrivKey + * @instance + */ + PrivKey.prototype.key = $util.newBuffer([]); + + /** + * Encodes the specified PrivKey message. Does not implicitly {@link cosmos.crypto.secp256k1.PrivKey.verify|verify} messages. + * @function encode + * @memberof cosmos.crypto.secp256k1.PrivKey + * @static + * @param {cosmos.crypto.secp256k1.IPrivKey} message PrivKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PrivKey.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); + return writer; + }; + + /** + * Encodes the specified PrivKey message, length delimited. Does not implicitly {@link cosmos.crypto.secp256k1.PrivKey.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.crypto.secp256k1.PrivKey + * @static + * @param {cosmos.crypto.secp256k1.IPrivKey} message PrivKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PrivKey.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PrivKey message from the specified reader or buffer. + * @function decode + * @memberof cosmos.crypto.secp256k1.PrivKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.crypto.secp256k1.PrivKey} PrivKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PrivKey.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.crypto.secp256k1.PrivKey(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PrivKey message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.crypto.secp256k1.PrivKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.crypto.secp256k1.PrivKey} PrivKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PrivKey.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PrivKey message. + * @function verify + * @memberof cosmos.crypto.secp256k1.PrivKey + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PrivKey.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) + return "key: buffer expected"; + return null; + }; + + /** + * Creates a PrivKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.crypto.secp256k1.PrivKey + * @static + * @param {Object.} object Plain object + * @returns {cosmos.crypto.secp256k1.PrivKey} PrivKey + */ + PrivKey.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.crypto.secp256k1.PrivKey) + return object; + let message = new $root.cosmos.crypto.secp256k1.PrivKey(); + if (object.key != null) + if (typeof object.key === "string") + $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); + else if (object.key.length) + message.key = object.key; + return message; + }; + + /** + * Creates a plain object from a PrivKey message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.crypto.secp256k1.PrivKey + * @static + * @param {cosmos.crypto.secp256k1.PrivKey} message PrivKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PrivKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + if (options.bytes === String) + object.key = ""; + else { + object.key = []; + if (options.bytes !== Array) + object.key = $util.newBuffer(object.key); + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; + return object; + }; + + /** + * Converts this PrivKey to JSON. + * @function toJSON + * @memberof cosmos.crypto.secp256k1.PrivKey + * @instance + * @returns {Object.} JSON object + */ + PrivKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PrivKey; + })(); + + return secp256k1; + })(); + + return crypto; + })(); + + cosmos.distribution = (function() { + + /** + * Namespace distribution. + * @memberof cosmos + * @namespace + */ + const distribution = {}; + + distribution.v1beta1 = (function() { + + /** + * Namespace v1beta1. + * @memberof cosmos.distribution + * @namespace + */ + const v1beta1 = {}; + + v1beta1.Msg = (function() { + + /** + * Constructs a new Msg service. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a Msg + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Msg(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Msg.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Msg; + + /** + * Callback as used by {@link cosmos.distribution.v1beta1.Msg#setWithdrawAddress}. + * @memberof cosmos.distribution.v1beta1.Msg + * @typedef SetWithdrawAddressCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse} [response] MsgSetWithdrawAddressResponse + */ + + /** + * Calls SetWithdrawAddress. + * @function setWithdrawAddress + * @memberof cosmos.distribution.v1beta1.Msg + * @instance + * @param {cosmos.distribution.v1beta1.IMsgSetWithdrawAddress} request MsgSetWithdrawAddress message or plain object + * @param {cosmos.distribution.v1beta1.Msg.SetWithdrawAddressCallback} callback Node-style callback called with the error, if any, and MsgSetWithdrawAddressResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.setWithdrawAddress = function setWithdrawAddress(request, callback) { + return this.rpcCall(setWithdrawAddress, $root.cosmos.distribution.v1beta1.MsgSetWithdrawAddress, $root.cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse, request, callback); + }, "name", { value: "SetWithdrawAddress" }); + + /** + * Calls SetWithdrawAddress. + * @function setWithdrawAddress + * @memberof cosmos.distribution.v1beta1.Msg + * @instance + * @param {cosmos.distribution.v1beta1.IMsgSetWithdrawAddress} request MsgSetWithdrawAddress message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.distribution.v1beta1.Msg#withdrawDelegatorReward}. + * @memberof cosmos.distribution.v1beta1.Msg + * @typedef WithdrawDelegatorRewardCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse} [response] MsgWithdrawDelegatorRewardResponse + */ + + /** + * Calls WithdrawDelegatorReward. + * @function withdrawDelegatorReward + * @memberof cosmos.distribution.v1beta1.Msg + * @instance + * @param {cosmos.distribution.v1beta1.IMsgWithdrawDelegatorReward} request MsgWithdrawDelegatorReward message or plain object + * @param {cosmos.distribution.v1beta1.Msg.WithdrawDelegatorRewardCallback} callback Node-style callback called with the error, if any, and MsgWithdrawDelegatorRewardResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.withdrawDelegatorReward = function withdrawDelegatorReward(request, callback) { + return this.rpcCall(withdrawDelegatorReward, $root.cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward, $root.cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse, request, callback); + }, "name", { value: "WithdrawDelegatorReward" }); + + /** + * Calls WithdrawDelegatorReward. + * @function withdrawDelegatorReward + * @memberof cosmos.distribution.v1beta1.Msg + * @instance + * @param {cosmos.distribution.v1beta1.IMsgWithdrawDelegatorReward} request MsgWithdrawDelegatorReward message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.distribution.v1beta1.Msg#withdrawValidatorCommission}. + * @memberof cosmos.distribution.v1beta1.Msg + * @typedef WithdrawValidatorCommissionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse} [response] MsgWithdrawValidatorCommissionResponse + */ + + /** + * Calls WithdrawValidatorCommission. + * @function withdrawValidatorCommission + * @memberof cosmos.distribution.v1beta1.Msg + * @instance + * @param {cosmos.distribution.v1beta1.IMsgWithdrawValidatorCommission} request MsgWithdrawValidatorCommission message or plain object + * @param {cosmos.distribution.v1beta1.Msg.WithdrawValidatorCommissionCallback} callback Node-style callback called with the error, if any, and MsgWithdrawValidatorCommissionResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.withdrawValidatorCommission = function withdrawValidatorCommission(request, callback) { + return this.rpcCall(withdrawValidatorCommission, $root.cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission, $root.cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse, request, callback); + }, "name", { value: "WithdrawValidatorCommission" }); + + /** + * Calls WithdrawValidatorCommission. + * @function withdrawValidatorCommission + * @memberof cosmos.distribution.v1beta1.Msg + * @instance + * @param {cosmos.distribution.v1beta1.IMsgWithdrawValidatorCommission} request MsgWithdrawValidatorCommission message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.distribution.v1beta1.Msg#fundCommunityPool}. + * @memberof cosmos.distribution.v1beta1.Msg + * @typedef FundCommunityPoolCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse} [response] MsgFundCommunityPoolResponse + */ + + /** + * Calls FundCommunityPool. + * @function fundCommunityPool + * @memberof cosmos.distribution.v1beta1.Msg + * @instance + * @param {cosmos.distribution.v1beta1.IMsgFundCommunityPool} request MsgFundCommunityPool message or plain object + * @param {cosmos.distribution.v1beta1.Msg.FundCommunityPoolCallback} callback Node-style callback called with the error, if any, and MsgFundCommunityPoolResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.fundCommunityPool = function fundCommunityPool(request, callback) { + return this.rpcCall(fundCommunityPool, $root.cosmos.distribution.v1beta1.MsgFundCommunityPool, $root.cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse, request, callback); + }, "name", { value: "FundCommunityPool" }); + + /** + * Calls FundCommunityPool. + * @function fundCommunityPool + * @memberof cosmos.distribution.v1beta1.Msg + * @instance + * @param {cosmos.distribution.v1beta1.IMsgFundCommunityPool} request MsgFundCommunityPool message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Msg; + })(); + + v1beta1.MsgSetWithdrawAddress = (function() { + + /** + * Properties of a MsgSetWithdrawAddress. + * @memberof cosmos.distribution.v1beta1 + * @interface IMsgSetWithdrawAddress + * @property {string|null} [delegator_address] MsgSetWithdrawAddress delegator_address + * @property {string|null} [withdraw_address] MsgSetWithdrawAddress withdraw_address + */ + + /** + * Constructs a new MsgSetWithdrawAddress. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a MsgSetWithdrawAddress. + * @implements IMsgSetWithdrawAddress + * @constructor + * @param {cosmos.distribution.v1beta1.IMsgSetWithdrawAddress=} [properties] Properties to set + */ + function MsgSetWithdrawAddress(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgSetWithdrawAddress delegator_address. + * @member {string} delegator_address + * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddress + * @instance + */ + MsgSetWithdrawAddress.prototype.delegator_address = ""; + + /** + * MsgSetWithdrawAddress withdraw_address. + * @member {string} withdraw_address + * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddress + * @instance + */ + MsgSetWithdrawAddress.prototype.withdraw_address = ""; + + /** + * Encodes the specified MsgSetWithdrawAddress message. Does not implicitly {@link cosmos.distribution.v1beta1.MsgSetWithdrawAddress.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddress + * @static + * @param {cosmos.distribution.v1beta1.IMsgSetWithdrawAddress} message MsgSetWithdrawAddress message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgSetWithdrawAddress.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); + if (message.withdraw_address != null && Object.hasOwnProperty.call(message, "withdraw_address")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.withdraw_address); + return writer; + }; + + /** + * Encodes the specified MsgSetWithdrawAddress message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.MsgSetWithdrawAddress.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddress + * @static + * @param {cosmos.distribution.v1beta1.IMsgSetWithdrawAddress} message MsgSetWithdrawAddress message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgSetWithdrawAddress.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgSetWithdrawAddress message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddress + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.MsgSetWithdrawAddress} MsgSetWithdrawAddress + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgSetWithdrawAddress.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.MsgSetWithdrawAddress(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_address = reader.string(); + break; + case 2: + message.withdraw_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgSetWithdrawAddress message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddress + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.MsgSetWithdrawAddress} MsgSetWithdrawAddress + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgSetWithdrawAddress.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgSetWithdrawAddress message. + * @function verify + * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddress + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgSetWithdrawAddress.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + if (!$util.isString(message.delegator_address)) + return "delegator_address: string expected"; + if (message.withdraw_address != null && message.hasOwnProperty("withdraw_address")) + if (!$util.isString(message.withdraw_address)) + return "withdraw_address: string expected"; + return null; + }; + + /** + * Creates a MsgSetWithdrawAddress message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddress + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.MsgSetWithdrawAddress} MsgSetWithdrawAddress + */ + MsgSetWithdrawAddress.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.MsgSetWithdrawAddress) + return object; + let message = new $root.cosmos.distribution.v1beta1.MsgSetWithdrawAddress(); + if (object.delegator_address != null) + message.delegator_address = String(object.delegator_address); + if (object.withdraw_address != null) + message.withdraw_address = String(object.withdraw_address); + return message; + }; + + /** + * Creates a plain object from a MsgSetWithdrawAddress message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddress + * @static + * @param {cosmos.distribution.v1beta1.MsgSetWithdrawAddress} message MsgSetWithdrawAddress + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgSetWithdrawAddress.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.delegator_address = ""; + object.withdraw_address = ""; + } + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + object.delegator_address = message.delegator_address; + if (message.withdraw_address != null && message.hasOwnProperty("withdraw_address")) + object.withdraw_address = message.withdraw_address; + return object; + }; + + /** + * Converts this MsgSetWithdrawAddress to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddress + * @instance + * @returns {Object.} JSON object + */ + MsgSetWithdrawAddress.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgSetWithdrawAddress; + })(); + + v1beta1.MsgSetWithdrawAddressResponse = (function() { + + /** + * Properties of a MsgSetWithdrawAddressResponse. + * @memberof cosmos.distribution.v1beta1 + * @interface IMsgSetWithdrawAddressResponse + */ + + /** + * Constructs a new MsgSetWithdrawAddressResponse. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a MsgSetWithdrawAddressResponse. + * @implements IMsgSetWithdrawAddressResponse + * @constructor + * @param {cosmos.distribution.v1beta1.IMsgSetWithdrawAddressResponse=} [properties] Properties to set + */ + function MsgSetWithdrawAddressResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgSetWithdrawAddressResponse message. Does not implicitly {@link cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse + * @static + * @param {cosmos.distribution.v1beta1.IMsgSetWithdrawAddressResponse} message MsgSetWithdrawAddressResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgSetWithdrawAddressResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgSetWithdrawAddressResponse message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse + * @static + * @param {cosmos.distribution.v1beta1.IMsgSetWithdrawAddressResponse} message MsgSetWithdrawAddressResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgSetWithdrawAddressResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgSetWithdrawAddressResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse} MsgSetWithdrawAddressResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgSetWithdrawAddressResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgSetWithdrawAddressResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse} MsgSetWithdrawAddressResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgSetWithdrawAddressResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgSetWithdrawAddressResponse message. + * @function verify + * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgSetWithdrawAddressResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgSetWithdrawAddressResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse} MsgSetWithdrawAddressResponse + */ + MsgSetWithdrawAddressResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse) + return object; + return new $root.cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse(); + }; + + /** + * Creates a plain object from a MsgSetWithdrawAddressResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse + * @static + * @param {cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse} message MsgSetWithdrawAddressResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgSetWithdrawAddressResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgSetWithdrawAddressResponse to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse + * @instance + * @returns {Object.} JSON object + */ + MsgSetWithdrawAddressResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgSetWithdrawAddressResponse; + })(); + + v1beta1.MsgWithdrawDelegatorReward = (function() { + + /** + * Properties of a MsgWithdrawDelegatorReward. + * @memberof cosmos.distribution.v1beta1 + * @interface IMsgWithdrawDelegatorReward + * @property {string|null} [delegator_address] MsgWithdrawDelegatorReward delegator_address + * @property {string|null} [validator_address] MsgWithdrawDelegatorReward validator_address + */ + + /** + * Constructs a new MsgWithdrawDelegatorReward. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a MsgWithdrawDelegatorReward. + * @implements IMsgWithdrawDelegatorReward + * @constructor + * @param {cosmos.distribution.v1beta1.IMsgWithdrawDelegatorReward=} [properties] Properties to set + */ + function MsgWithdrawDelegatorReward(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgWithdrawDelegatorReward delegator_address. + * @member {string} delegator_address + * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward + * @instance + */ + MsgWithdrawDelegatorReward.prototype.delegator_address = ""; + + /** + * MsgWithdrawDelegatorReward validator_address. + * @member {string} validator_address + * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward + * @instance + */ + MsgWithdrawDelegatorReward.prototype.validator_address = ""; + + /** + * Encodes the specified MsgWithdrawDelegatorReward message. Does not implicitly {@link cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward + * @static + * @param {cosmos.distribution.v1beta1.IMsgWithdrawDelegatorReward} message MsgWithdrawDelegatorReward message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgWithdrawDelegatorReward.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); + if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.validator_address); + return writer; + }; + + /** + * Encodes the specified MsgWithdrawDelegatorReward message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward + * @static + * @param {cosmos.distribution.v1beta1.IMsgWithdrawDelegatorReward} message MsgWithdrawDelegatorReward message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgWithdrawDelegatorReward.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgWithdrawDelegatorReward message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward} MsgWithdrawDelegatorReward + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgWithdrawDelegatorReward.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_address = reader.string(); + break; + case 2: + message.validator_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgWithdrawDelegatorReward message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward} MsgWithdrawDelegatorReward + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgWithdrawDelegatorReward.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgWithdrawDelegatorReward message. + * @function verify + * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgWithdrawDelegatorReward.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + if (!$util.isString(message.delegator_address)) + return "delegator_address: string expected"; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + if (!$util.isString(message.validator_address)) + return "validator_address: string expected"; + return null; + }; + + /** + * Creates a MsgWithdrawDelegatorReward message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward} MsgWithdrawDelegatorReward + */ + MsgWithdrawDelegatorReward.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward) + return object; + let message = new $root.cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward(); + if (object.delegator_address != null) + message.delegator_address = String(object.delegator_address); + if (object.validator_address != null) + message.validator_address = String(object.validator_address); + return message; + }; + + /** + * Creates a plain object from a MsgWithdrawDelegatorReward message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward + * @static + * @param {cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward} message MsgWithdrawDelegatorReward + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgWithdrawDelegatorReward.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.delegator_address = ""; + object.validator_address = ""; + } + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + object.delegator_address = message.delegator_address; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + object.validator_address = message.validator_address; + return object; + }; + + /** + * Converts this MsgWithdrawDelegatorReward to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward + * @instance + * @returns {Object.} JSON object + */ + MsgWithdrawDelegatorReward.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgWithdrawDelegatorReward; + })(); + + v1beta1.MsgWithdrawDelegatorRewardResponse = (function() { + + /** + * Properties of a MsgWithdrawDelegatorRewardResponse. + * @memberof cosmos.distribution.v1beta1 + * @interface IMsgWithdrawDelegatorRewardResponse + */ + + /** + * Constructs a new MsgWithdrawDelegatorRewardResponse. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a MsgWithdrawDelegatorRewardResponse. + * @implements IMsgWithdrawDelegatorRewardResponse + * @constructor + * @param {cosmos.distribution.v1beta1.IMsgWithdrawDelegatorRewardResponse=} [properties] Properties to set + */ + function MsgWithdrawDelegatorRewardResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgWithdrawDelegatorRewardResponse message. Does not implicitly {@link cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse + * @static + * @param {cosmos.distribution.v1beta1.IMsgWithdrawDelegatorRewardResponse} message MsgWithdrawDelegatorRewardResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgWithdrawDelegatorRewardResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgWithdrawDelegatorRewardResponse message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse + * @static + * @param {cosmos.distribution.v1beta1.IMsgWithdrawDelegatorRewardResponse} message MsgWithdrawDelegatorRewardResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgWithdrawDelegatorRewardResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgWithdrawDelegatorRewardResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse} MsgWithdrawDelegatorRewardResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgWithdrawDelegatorRewardResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgWithdrawDelegatorRewardResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse} MsgWithdrawDelegatorRewardResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgWithdrawDelegatorRewardResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgWithdrawDelegatorRewardResponse message. + * @function verify + * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgWithdrawDelegatorRewardResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgWithdrawDelegatorRewardResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse} MsgWithdrawDelegatorRewardResponse + */ + MsgWithdrawDelegatorRewardResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse) + return object; + return new $root.cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse(); + }; + + /** + * Creates a plain object from a MsgWithdrawDelegatorRewardResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse + * @static + * @param {cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse} message MsgWithdrawDelegatorRewardResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgWithdrawDelegatorRewardResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgWithdrawDelegatorRewardResponse to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse + * @instance + * @returns {Object.} JSON object + */ + MsgWithdrawDelegatorRewardResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgWithdrawDelegatorRewardResponse; + })(); + + v1beta1.MsgWithdrawValidatorCommission = (function() { + + /** + * Properties of a MsgWithdrawValidatorCommission. + * @memberof cosmos.distribution.v1beta1 + * @interface IMsgWithdrawValidatorCommission + * @property {string|null} [validator_address] MsgWithdrawValidatorCommission validator_address + */ + + /** + * Constructs a new MsgWithdrawValidatorCommission. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a MsgWithdrawValidatorCommission. + * @implements IMsgWithdrawValidatorCommission + * @constructor + * @param {cosmos.distribution.v1beta1.IMsgWithdrawValidatorCommission=} [properties] Properties to set + */ + function MsgWithdrawValidatorCommission(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgWithdrawValidatorCommission validator_address. + * @member {string} validator_address + * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission + * @instance + */ + MsgWithdrawValidatorCommission.prototype.validator_address = ""; + + /** + * Encodes the specified MsgWithdrawValidatorCommission message. Does not implicitly {@link cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission + * @static + * @param {cosmos.distribution.v1beta1.IMsgWithdrawValidatorCommission} message MsgWithdrawValidatorCommission message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgWithdrawValidatorCommission.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.validator_address); + return writer; + }; + + /** + * Encodes the specified MsgWithdrawValidatorCommission message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission + * @static + * @param {cosmos.distribution.v1beta1.IMsgWithdrawValidatorCommission} message MsgWithdrawValidatorCommission message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgWithdrawValidatorCommission.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgWithdrawValidatorCommission message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission} MsgWithdrawValidatorCommission + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgWithdrawValidatorCommission.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgWithdrawValidatorCommission message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission} MsgWithdrawValidatorCommission + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgWithdrawValidatorCommission.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgWithdrawValidatorCommission message. + * @function verify + * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgWithdrawValidatorCommission.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + if (!$util.isString(message.validator_address)) + return "validator_address: string expected"; + return null; + }; + + /** + * Creates a MsgWithdrawValidatorCommission message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission} MsgWithdrawValidatorCommission + */ + MsgWithdrawValidatorCommission.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission) + return object; + let message = new $root.cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission(); + if (object.validator_address != null) + message.validator_address = String(object.validator_address); + return message; + }; + + /** + * Creates a plain object from a MsgWithdrawValidatorCommission message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission + * @static + * @param {cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission} message MsgWithdrawValidatorCommission + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgWithdrawValidatorCommission.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.validator_address = ""; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + object.validator_address = message.validator_address; + return object; + }; + + /** + * Converts this MsgWithdrawValidatorCommission to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission + * @instance + * @returns {Object.} JSON object + */ + MsgWithdrawValidatorCommission.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgWithdrawValidatorCommission; + })(); + + v1beta1.MsgWithdrawValidatorCommissionResponse = (function() { + + /** + * Properties of a MsgWithdrawValidatorCommissionResponse. + * @memberof cosmos.distribution.v1beta1 + * @interface IMsgWithdrawValidatorCommissionResponse + */ + + /** + * Constructs a new MsgWithdrawValidatorCommissionResponse. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a MsgWithdrawValidatorCommissionResponse. + * @implements IMsgWithdrawValidatorCommissionResponse + * @constructor + * @param {cosmos.distribution.v1beta1.IMsgWithdrawValidatorCommissionResponse=} [properties] Properties to set + */ + function MsgWithdrawValidatorCommissionResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgWithdrawValidatorCommissionResponse message. Does not implicitly {@link cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse + * @static + * @param {cosmos.distribution.v1beta1.IMsgWithdrawValidatorCommissionResponse} message MsgWithdrawValidatorCommissionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgWithdrawValidatorCommissionResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgWithdrawValidatorCommissionResponse message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse + * @static + * @param {cosmos.distribution.v1beta1.IMsgWithdrawValidatorCommissionResponse} message MsgWithdrawValidatorCommissionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgWithdrawValidatorCommissionResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgWithdrawValidatorCommissionResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse} MsgWithdrawValidatorCommissionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgWithdrawValidatorCommissionResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgWithdrawValidatorCommissionResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse} MsgWithdrawValidatorCommissionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgWithdrawValidatorCommissionResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgWithdrawValidatorCommissionResponse message. + * @function verify + * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgWithdrawValidatorCommissionResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgWithdrawValidatorCommissionResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse} MsgWithdrawValidatorCommissionResponse + */ + MsgWithdrawValidatorCommissionResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse) + return object; + return new $root.cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse(); + }; + + /** + * Creates a plain object from a MsgWithdrawValidatorCommissionResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse + * @static + * @param {cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse} message MsgWithdrawValidatorCommissionResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgWithdrawValidatorCommissionResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgWithdrawValidatorCommissionResponse to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse + * @instance + * @returns {Object.} JSON object + */ + MsgWithdrawValidatorCommissionResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgWithdrawValidatorCommissionResponse; + })(); + + v1beta1.MsgFundCommunityPool = (function() { + + /** + * Properties of a MsgFundCommunityPool. + * @memberof cosmos.distribution.v1beta1 + * @interface IMsgFundCommunityPool + * @property {Array.|null} [amount] MsgFundCommunityPool amount + * @property {string|null} [depositor] MsgFundCommunityPool depositor + */ + + /** + * Constructs a new MsgFundCommunityPool. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a MsgFundCommunityPool. + * @implements IMsgFundCommunityPool + * @constructor + * @param {cosmos.distribution.v1beta1.IMsgFundCommunityPool=} [properties] Properties to set + */ + function MsgFundCommunityPool(properties) { + this.amount = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgFundCommunityPool amount. + * @member {Array.} amount + * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPool + * @instance + */ + MsgFundCommunityPool.prototype.amount = $util.emptyArray; + + /** + * MsgFundCommunityPool depositor. + * @member {string} depositor + * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPool + * @instance + */ + MsgFundCommunityPool.prototype.depositor = ""; + + /** + * Encodes the specified MsgFundCommunityPool message. Does not implicitly {@link cosmos.distribution.v1beta1.MsgFundCommunityPool.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPool + * @static + * @param {cosmos.distribution.v1beta1.IMsgFundCommunityPool} message MsgFundCommunityPool message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgFundCommunityPool.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.amount != null && message.amount.length) + for (let i = 0; i < message.amount.length; ++i) + $root.cosmos.base.v1beta1.Coin.encode(message.amount[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.depositor != null && Object.hasOwnProperty.call(message, "depositor")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.depositor); + return writer; + }; + + /** + * Encodes the specified MsgFundCommunityPool message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.MsgFundCommunityPool.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPool + * @static + * @param {cosmos.distribution.v1beta1.IMsgFundCommunityPool} message MsgFundCommunityPool message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgFundCommunityPool.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgFundCommunityPool message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPool + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.MsgFundCommunityPool} MsgFundCommunityPool + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgFundCommunityPool.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.MsgFundCommunityPool(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.amount && message.amount.length)) + message.amount = []; + message.amount.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); + break; + case 2: + message.depositor = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgFundCommunityPool message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPool + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.MsgFundCommunityPool} MsgFundCommunityPool + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgFundCommunityPool.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgFundCommunityPool message. + * @function verify + * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPool + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgFundCommunityPool.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.amount != null && message.hasOwnProperty("amount")) { + if (!Array.isArray(message.amount)) + return "amount: array expected"; + for (let i = 0; i < message.amount.length; ++i) { + let error = $root.cosmos.base.v1beta1.Coin.verify(message.amount[i]); + if (error) + return "amount." + error; + } + } + if (message.depositor != null && message.hasOwnProperty("depositor")) + if (!$util.isString(message.depositor)) + return "depositor: string expected"; + return null; + }; + + /** + * Creates a MsgFundCommunityPool message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPool + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.MsgFundCommunityPool} MsgFundCommunityPool + */ + MsgFundCommunityPool.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.MsgFundCommunityPool) + return object; + let message = new $root.cosmos.distribution.v1beta1.MsgFundCommunityPool(); + if (object.amount) { + if (!Array.isArray(object.amount)) + throw TypeError(".cosmos.distribution.v1beta1.MsgFundCommunityPool.amount: array expected"); + message.amount = []; + for (let i = 0; i < object.amount.length; ++i) { + if (typeof object.amount[i] !== "object") + throw TypeError(".cosmos.distribution.v1beta1.MsgFundCommunityPool.amount: object expected"); + message.amount[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.amount[i]); + } + } + if (object.depositor != null) + message.depositor = String(object.depositor); + return message; + }; + + /** + * Creates a plain object from a MsgFundCommunityPool message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPool + * @static + * @param {cosmos.distribution.v1beta1.MsgFundCommunityPool} message MsgFundCommunityPool + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgFundCommunityPool.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.amount = []; + if (options.defaults) + object.depositor = ""; + if (message.amount && message.amount.length) { + object.amount = []; + for (let j = 0; j < message.amount.length; ++j) + object.amount[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.amount[j], options); + } + if (message.depositor != null && message.hasOwnProperty("depositor")) + object.depositor = message.depositor; + return object; + }; + + /** + * Converts this MsgFundCommunityPool to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPool + * @instance + * @returns {Object.} JSON object + */ + MsgFundCommunityPool.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgFundCommunityPool; + })(); + + v1beta1.MsgFundCommunityPoolResponse = (function() { + + /** + * Properties of a MsgFundCommunityPoolResponse. + * @memberof cosmos.distribution.v1beta1 + * @interface IMsgFundCommunityPoolResponse + */ + + /** + * Constructs a new MsgFundCommunityPoolResponse. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a MsgFundCommunityPoolResponse. + * @implements IMsgFundCommunityPoolResponse + * @constructor + * @param {cosmos.distribution.v1beta1.IMsgFundCommunityPoolResponse=} [properties] Properties to set + */ + function MsgFundCommunityPoolResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgFundCommunityPoolResponse message. Does not implicitly {@link cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse + * @static + * @param {cosmos.distribution.v1beta1.IMsgFundCommunityPoolResponse} message MsgFundCommunityPoolResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgFundCommunityPoolResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgFundCommunityPoolResponse message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse + * @static + * @param {cosmos.distribution.v1beta1.IMsgFundCommunityPoolResponse} message MsgFundCommunityPoolResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgFundCommunityPoolResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgFundCommunityPoolResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse} MsgFundCommunityPoolResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgFundCommunityPoolResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgFundCommunityPoolResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse} MsgFundCommunityPoolResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgFundCommunityPoolResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgFundCommunityPoolResponse message. + * @function verify + * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgFundCommunityPoolResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgFundCommunityPoolResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse} MsgFundCommunityPoolResponse + */ + MsgFundCommunityPoolResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse) + return object; + return new $root.cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse(); + }; + + /** + * Creates a plain object from a MsgFundCommunityPoolResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse + * @static + * @param {cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse} message MsgFundCommunityPoolResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgFundCommunityPoolResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgFundCommunityPoolResponse to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse + * @instance + * @returns {Object.} JSON object + */ + MsgFundCommunityPoolResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgFundCommunityPoolResponse; + })(); + + v1beta1.Params = (function() { + + /** + * Properties of a Params. + * @memberof cosmos.distribution.v1beta1 + * @interface IParams + * @property {string|null} [community_tax] Params community_tax + * @property {string|null} [base_proposer_reward] Params base_proposer_reward + * @property {string|null} [bonus_proposer_reward] Params bonus_proposer_reward + * @property {boolean|null} [withdraw_addr_enabled] Params withdraw_addr_enabled + */ + + /** + * Constructs a new Params. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a Params. + * @implements IParams + * @constructor + * @param {cosmos.distribution.v1beta1.IParams=} [properties] Properties to set + */ + function Params(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Params community_tax. + * @member {string} community_tax + * @memberof cosmos.distribution.v1beta1.Params + * @instance + */ + Params.prototype.community_tax = ""; + + /** + * Params base_proposer_reward. + * @member {string} base_proposer_reward + * @memberof cosmos.distribution.v1beta1.Params + * @instance + */ + Params.prototype.base_proposer_reward = ""; + + /** + * Params bonus_proposer_reward. + * @member {string} bonus_proposer_reward + * @memberof cosmos.distribution.v1beta1.Params + * @instance + */ + Params.prototype.bonus_proposer_reward = ""; + + /** + * Params withdraw_addr_enabled. + * @member {boolean} withdraw_addr_enabled + * @memberof cosmos.distribution.v1beta1.Params + * @instance + */ + Params.prototype.withdraw_addr_enabled = false; + + /** + * Encodes the specified Params message. Does not implicitly {@link cosmos.distribution.v1beta1.Params.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.Params + * @static + * @param {cosmos.distribution.v1beta1.IParams} message Params message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Params.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.community_tax != null && Object.hasOwnProperty.call(message, "community_tax")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.community_tax); + if (message.base_proposer_reward != null && Object.hasOwnProperty.call(message, "base_proposer_reward")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.base_proposer_reward); + if (message.bonus_proposer_reward != null && Object.hasOwnProperty.call(message, "bonus_proposer_reward")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.bonus_proposer_reward); + if (message.withdraw_addr_enabled != null && Object.hasOwnProperty.call(message, "withdraw_addr_enabled")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.withdraw_addr_enabled); + return writer; + }; + + /** + * Encodes the specified Params message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.Params.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.Params + * @static + * @param {cosmos.distribution.v1beta1.IParams} message Params message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Params.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Params message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.Params + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.Params} Params + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Params.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.Params(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.community_tax = reader.string(); + break; + case 2: + message.base_proposer_reward = reader.string(); + break; + case 3: + message.bonus_proposer_reward = reader.string(); + break; + case 4: + message.withdraw_addr_enabled = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Params message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.Params + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.Params} Params + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Params.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Params message. + * @function verify + * @memberof cosmos.distribution.v1beta1.Params + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Params.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.community_tax != null && message.hasOwnProperty("community_tax")) + if (!$util.isString(message.community_tax)) + return "community_tax: string expected"; + if (message.base_proposer_reward != null && message.hasOwnProperty("base_proposer_reward")) + if (!$util.isString(message.base_proposer_reward)) + return "base_proposer_reward: string expected"; + if (message.bonus_proposer_reward != null && message.hasOwnProperty("bonus_proposer_reward")) + if (!$util.isString(message.bonus_proposer_reward)) + return "bonus_proposer_reward: string expected"; + if (message.withdraw_addr_enabled != null && message.hasOwnProperty("withdraw_addr_enabled")) + if (typeof message.withdraw_addr_enabled !== "boolean") + return "withdraw_addr_enabled: boolean expected"; + return null; + }; + + /** + * Creates a Params message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.Params + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.Params} Params + */ + Params.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.Params) + return object; + let message = new $root.cosmos.distribution.v1beta1.Params(); + if (object.community_tax != null) + message.community_tax = String(object.community_tax); + if (object.base_proposer_reward != null) + message.base_proposer_reward = String(object.base_proposer_reward); + if (object.bonus_proposer_reward != null) + message.bonus_proposer_reward = String(object.bonus_proposer_reward); + if (object.withdraw_addr_enabled != null) + message.withdraw_addr_enabled = Boolean(object.withdraw_addr_enabled); + return message; + }; + + /** + * Creates a plain object from a Params message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.Params + * @static + * @param {cosmos.distribution.v1beta1.Params} message Params + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Params.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.community_tax = ""; + object.base_proposer_reward = ""; + object.bonus_proposer_reward = ""; + object.withdraw_addr_enabled = false; + } + if (message.community_tax != null && message.hasOwnProperty("community_tax")) + object.community_tax = message.community_tax; + if (message.base_proposer_reward != null && message.hasOwnProperty("base_proposer_reward")) + object.base_proposer_reward = message.base_proposer_reward; + if (message.bonus_proposer_reward != null && message.hasOwnProperty("bonus_proposer_reward")) + object.bonus_proposer_reward = message.bonus_proposer_reward; + if (message.withdraw_addr_enabled != null && message.hasOwnProperty("withdraw_addr_enabled")) + object.withdraw_addr_enabled = message.withdraw_addr_enabled; + return object; + }; + + /** + * Converts this Params to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.Params + * @instance + * @returns {Object.} JSON object + */ + Params.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Params; + })(); + + v1beta1.ValidatorHistoricalRewards = (function() { + + /** + * Properties of a ValidatorHistoricalRewards. + * @memberof cosmos.distribution.v1beta1 + * @interface IValidatorHistoricalRewards + * @property {Array.|null} [cumulative_reward_ratio] ValidatorHistoricalRewards cumulative_reward_ratio + * @property {number|null} [reference_count] ValidatorHistoricalRewards reference_count + */ + + /** + * Constructs a new ValidatorHistoricalRewards. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a ValidatorHistoricalRewards. + * @implements IValidatorHistoricalRewards + * @constructor + * @param {cosmos.distribution.v1beta1.IValidatorHistoricalRewards=} [properties] Properties to set + */ + function ValidatorHistoricalRewards(properties) { + this.cumulative_reward_ratio = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ValidatorHistoricalRewards cumulative_reward_ratio. + * @member {Array.} cumulative_reward_ratio + * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewards + * @instance + */ + ValidatorHistoricalRewards.prototype.cumulative_reward_ratio = $util.emptyArray; + + /** + * ValidatorHistoricalRewards reference_count. + * @member {number} reference_count + * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewards + * @instance + */ + ValidatorHistoricalRewards.prototype.reference_count = 0; + + /** + * Encodes the specified ValidatorHistoricalRewards message. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorHistoricalRewards.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewards + * @static + * @param {cosmos.distribution.v1beta1.IValidatorHistoricalRewards} message ValidatorHistoricalRewards message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorHistoricalRewards.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.cumulative_reward_ratio != null && message.cumulative_reward_ratio.length) + for (let i = 0; i < message.cumulative_reward_ratio.length; ++i) + $root.cosmos.base.v1beta1.DecCoin.encode(message.cumulative_reward_ratio[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.reference_count != null && Object.hasOwnProperty.call(message, "reference_count")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.reference_count); + return writer; + }; + + /** + * Encodes the specified ValidatorHistoricalRewards message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorHistoricalRewards.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewards + * @static + * @param {cosmos.distribution.v1beta1.IValidatorHistoricalRewards} message ValidatorHistoricalRewards message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorHistoricalRewards.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ValidatorHistoricalRewards message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewards + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.ValidatorHistoricalRewards} ValidatorHistoricalRewards + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorHistoricalRewards.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.ValidatorHistoricalRewards(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.cumulative_reward_ratio && message.cumulative_reward_ratio.length)) + message.cumulative_reward_ratio = []; + message.cumulative_reward_ratio.push($root.cosmos.base.v1beta1.DecCoin.decode(reader, reader.uint32())); + break; + case 2: + message.reference_count = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ValidatorHistoricalRewards message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewards + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.ValidatorHistoricalRewards} ValidatorHistoricalRewards + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorHistoricalRewards.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ValidatorHistoricalRewards message. + * @function verify + * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewards + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ValidatorHistoricalRewards.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.cumulative_reward_ratio != null && message.hasOwnProperty("cumulative_reward_ratio")) { + if (!Array.isArray(message.cumulative_reward_ratio)) + return "cumulative_reward_ratio: array expected"; + for (let i = 0; i < message.cumulative_reward_ratio.length; ++i) { + let error = $root.cosmos.base.v1beta1.DecCoin.verify(message.cumulative_reward_ratio[i]); + if (error) + return "cumulative_reward_ratio." + error; + } + } + if (message.reference_count != null && message.hasOwnProperty("reference_count")) + if (!$util.isInteger(message.reference_count)) + return "reference_count: integer expected"; + return null; + }; + + /** + * Creates a ValidatorHistoricalRewards message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewards + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.ValidatorHistoricalRewards} ValidatorHistoricalRewards + */ + ValidatorHistoricalRewards.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.ValidatorHistoricalRewards) + return object; + let message = new $root.cosmos.distribution.v1beta1.ValidatorHistoricalRewards(); + if (object.cumulative_reward_ratio) { + if (!Array.isArray(object.cumulative_reward_ratio)) + throw TypeError(".cosmos.distribution.v1beta1.ValidatorHistoricalRewards.cumulative_reward_ratio: array expected"); + message.cumulative_reward_ratio = []; + for (let i = 0; i < object.cumulative_reward_ratio.length; ++i) { + if (typeof object.cumulative_reward_ratio[i] !== "object") + throw TypeError(".cosmos.distribution.v1beta1.ValidatorHistoricalRewards.cumulative_reward_ratio: object expected"); + message.cumulative_reward_ratio[i] = $root.cosmos.base.v1beta1.DecCoin.fromObject(object.cumulative_reward_ratio[i]); + } + } + if (object.reference_count != null) + message.reference_count = object.reference_count >>> 0; + return message; + }; + + /** + * Creates a plain object from a ValidatorHistoricalRewards message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewards + * @static + * @param {cosmos.distribution.v1beta1.ValidatorHistoricalRewards} message ValidatorHistoricalRewards + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ValidatorHistoricalRewards.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.cumulative_reward_ratio = []; + if (options.defaults) + object.reference_count = 0; + if (message.cumulative_reward_ratio && message.cumulative_reward_ratio.length) { + object.cumulative_reward_ratio = []; + for (let j = 0; j < message.cumulative_reward_ratio.length; ++j) + object.cumulative_reward_ratio[j] = $root.cosmos.base.v1beta1.DecCoin.toObject(message.cumulative_reward_ratio[j], options); + } + if (message.reference_count != null && message.hasOwnProperty("reference_count")) + object.reference_count = message.reference_count; + return object; + }; + + /** + * Converts this ValidatorHistoricalRewards to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewards + * @instance + * @returns {Object.} JSON object + */ + ValidatorHistoricalRewards.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ValidatorHistoricalRewards; + })(); + + v1beta1.ValidatorCurrentRewards = (function() { + + /** + * Properties of a ValidatorCurrentRewards. + * @memberof cosmos.distribution.v1beta1 + * @interface IValidatorCurrentRewards + * @property {Array.|null} [rewards] ValidatorCurrentRewards rewards + * @property {Long|null} [period] ValidatorCurrentRewards period + */ + + /** + * Constructs a new ValidatorCurrentRewards. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a ValidatorCurrentRewards. + * @implements IValidatorCurrentRewards + * @constructor + * @param {cosmos.distribution.v1beta1.IValidatorCurrentRewards=} [properties] Properties to set + */ + function ValidatorCurrentRewards(properties) { + this.rewards = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ValidatorCurrentRewards rewards. + * @member {Array.} rewards + * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewards + * @instance + */ + ValidatorCurrentRewards.prototype.rewards = $util.emptyArray; + + /** + * ValidatorCurrentRewards period. + * @member {Long} period + * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewards + * @instance + */ + ValidatorCurrentRewards.prototype.period = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified ValidatorCurrentRewards message. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorCurrentRewards.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewards + * @static + * @param {cosmos.distribution.v1beta1.IValidatorCurrentRewards} message ValidatorCurrentRewards message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorCurrentRewards.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rewards != null && message.rewards.length) + for (let i = 0; i < message.rewards.length; ++i) + $root.cosmos.base.v1beta1.DecCoin.encode(message.rewards[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.period != null && Object.hasOwnProperty.call(message, "period")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.period); + return writer; + }; + + /** + * Encodes the specified ValidatorCurrentRewards message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorCurrentRewards.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewards + * @static + * @param {cosmos.distribution.v1beta1.IValidatorCurrentRewards} message ValidatorCurrentRewards message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorCurrentRewards.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ValidatorCurrentRewards message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewards + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.ValidatorCurrentRewards} ValidatorCurrentRewards + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorCurrentRewards.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.ValidatorCurrentRewards(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.rewards && message.rewards.length)) + message.rewards = []; + message.rewards.push($root.cosmos.base.v1beta1.DecCoin.decode(reader, reader.uint32())); + break; + case 2: + message.period = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ValidatorCurrentRewards message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewards + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.ValidatorCurrentRewards} ValidatorCurrentRewards + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorCurrentRewards.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ValidatorCurrentRewards message. + * @function verify + * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewards + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ValidatorCurrentRewards.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rewards != null && message.hasOwnProperty("rewards")) { + if (!Array.isArray(message.rewards)) + return "rewards: array expected"; + for (let i = 0; i < message.rewards.length; ++i) { + let error = $root.cosmos.base.v1beta1.DecCoin.verify(message.rewards[i]); + if (error) + return "rewards." + error; + } + } + if (message.period != null && message.hasOwnProperty("period")) + if (!$util.isInteger(message.period) && !(message.period && $util.isInteger(message.period.low) && $util.isInteger(message.period.high))) + return "period: integer|Long expected"; + return null; + }; + + /** + * Creates a ValidatorCurrentRewards message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewards + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.ValidatorCurrentRewards} ValidatorCurrentRewards + */ + ValidatorCurrentRewards.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.ValidatorCurrentRewards) + return object; + let message = new $root.cosmos.distribution.v1beta1.ValidatorCurrentRewards(); + if (object.rewards) { + if (!Array.isArray(object.rewards)) + throw TypeError(".cosmos.distribution.v1beta1.ValidatorCurrentRewards.rewards: array expected"); + message.rewards = []; + for (let i = 0; i < object.rewards.length; ++i) { + if (typeof object.rewards[i] !== "object") + throw TypeError(".cosmos.distribution.v1beta1.ValidatorCurrentRewards.rewards: object expected"); + message.rewards[i] = $root.cosmos.base.v1beta1.DecCoin.fromObject(object.rewards[i]); + } + } + if (object.period != null) + if ($util.Long) + (message.period = $util.Long.fromValue(object.period)).unsigned = true; + else if (typeof object.period === "string") + message.period = parseInt(object.period, 10); + else if (typeof object.period === "number") + message.period = object.period; + else if (typeof object.period === "object") + message.period = new $util.LongBits(object.period.low >>> 0, object.period.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a ValidatorCurrentRewards message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewards + * @static + * @param {cosmos.distribution.v1beta1.ValidatorCurrentRewards} message ValidatorCurrentRewards + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ValidatorCurrentRewards.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.rewards = []; + if (options.defaults) + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.period = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.period = options.longs === String ? "0" : 0; + if (message.rewards && message.rewards.length) { + object.rewards = []; + for (let j = 0; j < message.rewards.length; ++j) + object.rewards[j] = $root.cosmos.base.v1beta1.DecCoin.toObject(message.rewards[j], options); + } + if (message.period != null && message.hasOwnProperty("period")) + if (typeof message.period === "number") + object.period = options.longs === String ? String(message.period) : message.period; + else + object.period = options.longs === String ? $util.Long.prototype.toString.call(message.period) : options.longs === Number ? new $util.LongBits(message.period.low >>> 0, message.period.high >>> 0).toNumber(true) : message.period; + return object; + }; + + /** + * Converts this ValidatorCurrentRewards to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewards + * @instance + * @returns {Object.} JSON object + */ + ValidatorCurrentRewards.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ValidatorCurrentRewards; + })(); + + v1beta1.ValidatorAccumulatedCommission = (function() { + + /** + * Properties of a ValidatorAccumulatedCommission. + * @memberof cosmos.distribution.v1beta1 + * @interface IValidatorAccumulatedCommission + * @property {Array.|null} [commission] ValidatorAccumulatedCommission commission + */ + + /** + * Constructs a new ValidatorAccumulatedCommission. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a ValidatorAccumulatedCommission. + * @implements IValidatorAccumulatedCommission + * @constructor + * @param {cosmos.distribution.v1beta1.IValidatorAccumulatedCommission=} [properties] Properties to set + */ + function ValidatorAccumulatedCommission(properties) { + this.commission = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ValidatorAccumulatedCommission commission. + * @member {Array.} commission + * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommission + * @instance + */ + ValidatorAccumulatedCommission.prototype.commission = $util.emptyArray; + + /** + * Encodes the specified ValidatorAccumulatedCommission message. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorAccumulatedCommission.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommission + * @static + * @param {cosmos.distribution.v1beta1.IValidatorAccumulatedCommission} message ValidatorAccumulatedCommission message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorAccumulatedCommission.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commission != null && message.commission.length) + for (let i = 0; i < message.commission.length; ++i) + $root.cosmos.base.v1beta1.DecCoin.encode(message.commission[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ValidatorAccumulatedCommission message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorAccumulatedCommission.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommission + * @static + * @param {cosmos.distribution.v1beta1.IValidatorAccumulatedCommission} message ValidatorAccumulatedCommission message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorAccumulatedCommission.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ValidatorAccumulatedCommission message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommission + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.ValidatorAccumulatedCommission} ValidatorAccumulatedCommission + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorAccumulatedCommission.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommission(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.commission && message.commission.length)) + message.commission = []; + message.commission.push($root.cosmos.base.v1beta1.DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ValidatorAccumulatedCommission message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommission + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.ValidatorAccumulatedCommission} ValidatorAccumulatedCommission + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorAccumulatedCommission.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ValidatorAccumulatedCommission message. + * @function verify + * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommission + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ValidatorAccumulatedCommission.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.commission != null && message.hasOwnProperty("commission")) { + if (!Array.isArray(message.commission)) + return "commission: array expected"; + for (let i = 0; i < message.commission.length; ++i) { + let error = $root.cosmos.base.v1beta1.DecCoin.verify(message.commission[i]); + if (error) + return "commission." + error; + } + } + return null; + }; + + /** + * Creates a ValidatorAccumulatedCommission message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommission + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.ValidatorAccumulatedCommission} ValidatorAccumulatedCommission + */ + ValidatorAccumulatedCommission.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommission) + return object; + let message = new $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommission(); + if (object.commission) { + if (!Array.isArray(object.commission)) + throw TypeError(".cosmos.distribution.v1beta1.ValidatorAccumulatedCommission.commission: array expected"); + message.commission = []; + for (let i = 0; i < object.commission.length; ++i) { + if (typeof object.commission[i] !== "object") + throw TypeError(".cosmos.distribution.v1beta1.ValidatorAccumulatedCommission.commission: object expected"); + message.commission[i] = $root.cosmos.base.v1beta1.DecCoin.fromObject(object.commission[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ValidatorAccumulatedCommission message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommission + * @static + * @param {cosmos.distribution.v1beta1.ValidatorAccumulatedCommission} message ValidatorAccumulatedCommission + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ValidatorAccumulatedCommission.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.commission = []; + if (message.commission && message.commission.length) { + object.commission = []; + for (let j = 0; j < message.commission.length; ++j) + object.commission[j] = $root.cosmos.base.v1beta1.DecCoin.toObject(message.commission[j], options); + } + return object; + }; + + /** + * Converts this ValidatorAccumulatedCommission to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommission + * @instance + * @returns {Object.} JSON object + */ + ValidatorAccumulatedCommission.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ValidatorAccumulatedCommission; + })(); + + v1beta1.ValidatorOutstandingRewards = (function() { + + /** + * Properties of a ValidatorOutstandingRewards. + * @memberof cosmos.distribution.v1beta1 + * @interface IValidatorOutstandingRewards + * @property {Array.|null} [rewards] ValidatorOutstandingRewards rewards + */ + + /** + * Constructs a new ValidatorOutstandingRewards. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a ValidatorOutstandingRewards. + * @implements IValidatorOutstandingRewards + * @constructor + * @param {cosmos.distribution.v1beta1.IValidatorOutstandingRewards=} [properties] Properties to set + */ + function ValidatorOutstandingRewards(properties) { + this.rewards = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ValidatorOutstandingRewards rewards. + * @member {Array.} rewards + * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewards + * @instance + */ + ValidatorOutstandingRewards.prototype.rewards = $util.emptyArray; + + /** + * Encodes the specified ValidatorOutstandingRewards message. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorOutstandingRewards.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewards + * @static + * @param {cosmos.distribution.v1beta1.IValidatorOutstandingRewards} message ValidatorOutstandingRewards message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorOutstandingRewards.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rewards != null && message.rewards.length) + for (let i = 0; i < message.rewards.length; ++i) + $root.cosmos.base.v1beta1.DecCoin.encode(message.rewards[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ValidatorOutstandingRewards message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorOutstandingRewards.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewards + * @static + * @param {cosmos.distribution.v1beta1.IValidatorOutstandingRewards} message ValidatorOutstandingRewards message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorOutstandingRewards.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ValidatorOutstandingRewards message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewards + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.ValidatorOutstandingRewards} ValidatorOutstandingRewards + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorOutstandingRewards.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.ValidatorOutstandingRewards(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.rewards && message.rewards.length)) + message.rewards = []; + message.rewards.push($root.cosmos.base.v1beta1.DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ValidatorOutstandingRewards message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewards + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.ValidatorOutstandingRewards} ValidatorOutstandingRewards + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorOutstandingRewards.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ValidatorOutstandingRewards message. + * @function verify + * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewards + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ValidatorOutstandingRewards.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rewards != null && message.hasOwnProperty("rewards")) { + if (!Array.isArray(message.rewards)) + return "rewards: array expected"; + for (let i = 0; i < message.rewards.length; ++i) { + let error = $root.cosmos.base.v1beta1.DecCoin.verify(message.rewards[i]); + if (error) + return "rewards." + error; + } + } + return null; + }; + + /** + * Creates a ValidatorOutstandingRewards message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewards + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.ValidatorOutstandingRewards} ValidatorOutstandingRewards + */ + ValidatorOutstandingRewards.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.ValidatorOutstandingRewards) + return object; + let message = new $root.cosmos.distribution.v1beta1.ValidatorOutstandingRewards(); + if (object.rewards) { + if (!Array.isArray(object.rewards)) + throw TypeError(".cosmos.distribution.v1beta1.ValidatorOutstandingRewards.rewards: array expected"); + message.rewards = []; + for (let i = 0; i < object.rewards.length; ++i) { + if (typeof object.rewards[i] !== "object") + throw TypeError(".cosmos.distribution.v1beta1.ValidatorOutstandingRewards.rewards: object expected"); + message.rewards[i] = $root.cosmos.base.v1beta1.DecCoin.fromObject(object.rewards[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ValidatorOutstandingRewards message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewards + * @static + * @param {cosmos.distribution.v1beta1.ValidatorOutstandingRewards} message ValidatorOutstandingRewards + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ValidatorOutstandingRewards.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.rewards = []; + if (message.rewards && message.rewards.length) { + object.rewards = []; + for (let j = 0; j < message.rewards.length; ++j) + object.rewards[j] = $root.cosmos.base.v1beta1.DecCoin.toObject(message.rewards[j], options); + } + return object; + }; + + /** + * Converts this ValidatorOutstandingRewards to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewards + * @instance + * @returns {Object.} JSON object + */ + ValidatorOutstandingRewards.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ValidatorOutstandingRewards; + })(); + + v1beta1.ValidatorSlashEvent = (function() { + + /** + * Properties of a ValidatorSlashEvent. + * @memberof cosmos.distribution.v1beta1 + * @interface IValidatorSlashEvent + * @property {Long|null} [validator_period] ValidatorSlashEvent validator_period + * @property {string|null} [fraction] ValidatorSlashEvent fraction + */ + + /** + * Constructs a new ValidatorSlashEvent. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a ValidatorSlashEvent. + * @implements IValidatorSlashEvent + * @constructor + * @param {cosmos.distribution.v1beta1.IValidatorSlashEvent=} [properties] Properties to set + */ + function ValidatorSlashEvent(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ValidatorSlashEvent validator_period. + * @member {Long} validator_period + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvent + * @instance + */ + ValidatorSlashEvent.prototype.validator_period = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * ValidatorSlashEvent fraction. + * @member {string} fraction + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvent + * @instance + */ + ValidatorSlashEvent.prototype.fraction = ""; + + /** + * Encodes the specified ValidatorSlashEvent message. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorSlashEvent.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvent + * @static + * @param {cosmos.distribution.v1beta1.IValidatorSlashEvent} message ValidatorSlashEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorSlashEvent.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.validator_period != null && Object.hasOwnProperty.call(message, "validator_period")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.validator_period); + if (message.fraction != null && Object.hasOwnProperty.call(message, "fraction")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.fraction); + return writer; + }; + + /** + * Encodes the specified ValidatorSlashEvent message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorSlashEvent.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvent + * @static + * @param {cosmos.distribution.v1beta1.IValidatorSlashEvent} message ValidatorSlashEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorSlashEvent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ValidatorSlashEvent message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.ValidatorSlashEvent} ValidatorSlashEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorSlashEvent.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.ValidatorSlashEvent(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_period = reader.uint64(); + break; + case 2: + message.fraction = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ValidatorSlashEvent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.ValidatorSlashEvent} ValidatorSlashEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorSlashEvent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ValidatorSlashEvent message. + * @function verify + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ValidatorSlashEvent.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.validator_period != null && message.hasOwnProperty("validator_period")) + if (!$util.isInteger(message.validator_period) && !(message.validator_period && $util.isInteger(message.validator_period.low) && $util.isInteger(message.validator_period.high))) + return "validator_period: integer|Long expected"; + if (message.fraction != null && message.hasOwnProperty("fraction")) + if (!$util.isString(message.fraction)) + return "fraction: string expected"; + return null; + }; + + /** + * Creates a ValidatorSlashEvent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvent + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.ValidatorSlashEvent} ValidatorSlashEvent + */ + ValidatorSlashEvent.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.ValidatorSlashEvent) + return object; + let message = new $root.cosmos.distribution.v1beta1.ValidatorSlashEvent(); + if (object.validator_period != null) + if ($util.Long) + (message.validator_period = $util.Long.fromValue(object.validator_period)).unsigned = true; + else if (typeof object.validator_period === "string") + message.validator_period = parseInt(object.validator_period, 10); + else if (typeof object.validator_period === "number") + message.validator_period = object.validator_period; + else if (typeof object.validator_period === "object") + message.validator_period = new $util.LongBits(object.validator_period.low >>> 0, object.validator_period.high >>> 0).toNumber(true); + if (object.fraction != null) + message.fraction = String(object.fraction); + return message; + }; + + /** + * Creates a plain object from a ValidatorSlashEvent message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvent + * @static + * @param {cosmos.distribution.v1beta1.ValidatorSlashEvent} message ValidatorSlashEvent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ValidatorSlashEvent.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.validator_period = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.validator_period = options.longs === String ? "0" : 0; + object.fraction = ""; + } + if (message.validator_period != null && message.hasOwnProperty("validator_period")) + if (typeof message.validator_period === "number") + object.validator_period = options.longs === String ? String(message.validator_period) : message.validator_period; + else + object.validator_period = options.longs === String ? $util.Long.prototype.toString.call(message.validator_period) : options.longs === Number ? new $util.LongBits(message.validator_period.low >>> 0, message.validator_period.high >>> 0).toNumber(true) : message.validator_period; + if (message.fraction != null && message.hasOwnProperty("fraction")) + object.fraction = message.fraction; + return object; + }; + + /** + * Converts this ValidatorSlashEvent to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvent + * @instance + * @returns {Object.} JSON object + */ + ValidatorSlashEvent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ValidatorSlashEvent; + })(); + + v1beta1.ValidatorSlashEvents = (function() { + + /** + * Properties of a ValidatorSlashEvents. + * @memberof cosmos.distribution.v1beta1 + * @interface IValidatorSlashEvents + * @property {Array.|null} [validator_slash_events] ValidatorSlashEvents validator_slash_events + */ + + /** + * Constructs a new ValidatorSlashEvents. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a ValidatorSlashEvents. + * @implements IValidatorSlashEvents + * @constructor + * @param {cosmos.distribution.v1beta1.IValidatorSlashEvents=} [properties] Properties to set + */ + function ValidatorSlashEvents(properties) { + this.validator_slash_events = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ValidatorSlashEvents validator_slash_events. + * @member {Array.} validator_slash_events + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvents + * @instance + */ + ValidatorSlashEvents.prototype.validator_slash_events = $util.emptyArray; + + /** + * Encodes the specified ValidatorSlashEvents message. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorSlashEvents.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvents + * @static + * @param {cosmos.distribution.v1beta1.IValidatorSlashEvents} message ValidatorSlashEvents message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorSlashEvents.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.validator_slash_events != null && message.validator_slash_events.length) + for (let i = 0; i < message.validator_slash_events.length; ++i) + $root.cosmos.distribution.v1beta1.ValidatorSlashEvent.encode(message.validator_slash_events[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ValidatorSlashEvents message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorSlashEvents.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvents + * @static + * @param {cosmos.distribution.v1beta1.IValidatorSlashEvents} message ValidatorSlashEvents message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorSlashEvents.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ValidatorSlashEvents message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvents + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.ValidatorSlashEvents} ValidatorSlashEvents + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorSlashEvents.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.ValidatorSlashEvents(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.validator_slash_events && message.validator_slash_events.length)) + message.validator_slash_events = []; + message.validator_slash_events.push($root.cosmos.distribution.v1beta1.ValidatorSlashEvent.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ValidatorSlashEvents message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvents + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.ValidatorSlashEvents} ValidatorSlashEvents + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorSlashEvents.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ValidatorSlashEvents message. + * @function verify + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvents + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ValidatorSlashEvents.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.validator_slash_events != null && message.hasOwnProperty("validator_slash_events")) { + if (!Array.isArray(message.validator_slash_events)) + return "validator_slash_events: array expected"; + for (let i = 0; i < message.validator_slash_events.length; ++i) { + let error = $root.cosmos.distribution.v1beta1.ValidatorSlashEvent.verify(message.validator_slash_events[i]); + if (error) + return "validator_slash_events." + error; + } + } + return null; + }; + + /** + * Creates a ValidatorSlashEvents message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvents + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.ValidatorSlashEvents} ValidatorSlashEvents + */ + ValidatorSlashEvents.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.ValidatorSlashEvents) + return object; + let message = new $root.cosmos.distribution.v1beta1.ValidatorSlashEvents(); + if (object.validator_slash_events) { + if (!Array.isArray(object.validator_slash_events)) + throw TypeError(".cosmos.distribution.v1beta1.ValidatorSlashEvents.validator_slash_events: array expected"); + message.validator_slash_events = []; + for (let i = 0; i < object.validator_slash_events.length; ++i) { + if (typeof object.validator_slash_events[i] !== "object") + throw TypeError(".cosmos.distribution.v1beta1.ValidatorSlashEvents.validator_slash_events: object expected"); + message.validator_slash_events[i] = $root.cosmos.distribution.v1beta1.ValidatorSlashEvent.fromObject(object.validator_slash_events[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ValidatorSlashEvents message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvents + * @static + * @param {cosmos.distribution.v1beta1.ValidatorSlashEvents} message ValidatorSlashEvents + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ValidatorSlashEvents.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.validator_slash_events = []; + if (message.validator_slash_events && message.validator_slash_events.length) { + object.validator_slash_events = []; + for (let j = 0; j < message.validator_slash_events.length; ++j) + object.validator_slash_events[j] = $root.cosmos.distribution.v1beta1.ValidatorSlashEvent.toObject(message.validator_slash_events[j], options); + } + return object; + }; + + /** + * Converts this ValidatorSlashEvents to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvents + * @instance + * @returns {Object.} JSON object + */ + ValidatorSlashEvents.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ValidatorSlashEvents; + })(); + + v1beta1.FeePool = (function() { + + /** + * Properties of a FeePool. + * @memberof cosmos.distribution.v1beta1 + * @interface IFeePool + * @property {Array.|null} [community_pool] FeePool community_pool + */ + + /** + * Constructs a new FeePool. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a FeePool. + * @implements IFeePool + * @constructor + * @param {cosmos.distribution.v1beta1.IFeePool=} [properties] Properties to set + */ + function FeePool(properties) { + this.community_pool = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FeePool community_pool. + * @member {Array.} community_pool + * @memberof cosmos.distribution.v1beta1.FeePool + * @instance + */ + FeePool.prototype.community_pool = $util.emptyArray; + + /** + * Encodes the specified FeePool message. Does not implicitly {@link cosmos.distribution.v1beta1.FeePool.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.FeePool + * @static + * @param {cosmos.distribution.v1beta1.IFeePool} message FeePool message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeePool.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.community_pool != null && message.community_pool.length) + for (let i = 0; i < message.community_pool.length; ++i) + $root.cosmos.base.v1beta1.DecCoin.encode(message.community_pool[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FeePool message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.FeePool.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.FeePool + * @static + * @param {cosmos.distribution.v1beta1.IFeePool} message FeePool message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeePool.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FeePool message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.FeePool + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.FeePool} FeePool + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeePool.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.FeePool(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.community_pool && message.community_pool.length)) + message.community_pool = []; + message.community_pool.push($root.cosmos.base.v1beta1.DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FeePool message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.FeePool + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.FeePool} FeePool + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeePool.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FeePool message. + * @function verify + * @memberof cosmos.distribution.v1beta1.FeePool + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FeePool.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.community_pool != null && message.hasOwnProperty("community_pool")) { + if (!Array.isArray(message.community_pool)) + return "community_pool: array expected"; + for (let i = 0; i < message.community_pool.length; ++i) { + let error = $root.cosmos.base.v1beta1.DecCoin.verify(message.community_pool[i]); + if (error) + return "community_pool." + error; + } + } + return null; + }; + + /** + * Creates a FeePool message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.FeePool + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.FeePool} FeePool + */ + FeePool.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.FeePool) + return object; + let message = new $root.cosmos.distribution.v1beta1.FeePool(); + if (object.community_pool) { + if (!Array.isArray(object.community_pool)) + throw TypeError(".cosmos.distribution.v1beta1.FeePool.community_pool: array expected"); + message.community_pool = []; + for (let i = 0; i < object.community_pool.length; ++i) { + if (typeof object.community_pool[i] !== "object") + throw TypeError(".cosmos.distribution.v1beta1.FeePool.community_pool: object expected"); + message.community_pool[i] = $root.cosmos.base.v1beta1.DecCoin.fromObject(object.community_pool[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a FeePool message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.FeePool + * @static + * @param {cosmos.distribution.v1beta1.FeePool} message FeePool + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FeePool.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.community_pool = []; + if (message.community_pool && message.community_pool.length) { + object.community_pool = []; + for (let j = 0; j < message.community_pool.length; ++j) + object.community_pool[j] = $root.cosmos.base.v1beta1.DecCoin.toObject(message.community_pool[j], options); + } + return object; + }; + + /** + * Converts this FeePool to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.FeePool + * @instance + * @returns {Object.} JSON object + */ + FeePool.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FeePool; + })(); + + v1beta1.CommunityPoolSpendProposal = (function() { + + /** + * Properties of a CommunityPoolSpendProposal. + * @memberof cosmos.distribution.v1beta1 + * @interface ICommunityPoolSpendProposal + * @property {string|null} [title] CommunityPoolSpendProposal title + * @property {string|null} [description] CommunityPoolSpendProposal description + * @property {string|null} [recipient] CommunityPoolSpendProposal recipient + * @property {Array.|null} [amount] CommunityPoolSpendProposal amount + */ + + /** + * Constructs a new CommunityPoolSpendProposal. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a CommunityPoolSpendProposal. + * @implements ICommunityPoolSpendProposal + * @constructor + * @param {cosmos.distribution.v1beta1.ICommunityPoolSpendProposal=} [properties] Properties to set + */ + function CommunityPoolSpendProposal(properties) { + this.amount = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CommunityPoolSpendProposal title. + * @member {string} title + * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposal + * @instance + */ + CommunityPoolSpendProposal.prototype.title = ""; + + /** + * CommunityPoolSpendProposal description. + * @member {string} description + * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposal + * @instance + */ + CommunityPoolSpendProposal.prototype.description = ""; + + /** + * CommunityPoolSpendProposal recipient. + * @member {string} recipient + * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposal + * @instance + */ + CommunityPoolSpendProposal.prototype.recipient = ""; + + /** + * CommunityPoolSpendProposal amount. + * @member {Array.} amount + * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposal + * @instance + */ + CommunityPoolSpendProposal.prototype.amount = $util.emptyArray; + + /** + * Encodes the specified CommunityPoolSpendProposal message. Does not implicitly {@link cosmos.distribution.v1beta1.CommunityPoolSpendProposal.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposal + * @static + * @param {cosmos.distribution.v1beta1.ICommunityPoolSpendProposal} message CommunityPoolSpendProposal message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommunityPoolSpendProposal.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.recipient != null && Object.hasOwnProperty.call(message, "recipient")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.recipient); + if (message.amount != null && message.amount.length) + for (let i = 0; i < message.amount.length; ++i) + $root.cosmos.base.v1beta1.Coin.encode(message.amount[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CommunityPoolSpendProposal message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.CommunityPoolSpendProposal.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposal + * @static + * @param {cosmos.distribution.v1beta1.ICommunityPoolSpendProposal} message CommunityPoolSpendProposal message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommunityPoolSpendProposal.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CommunityPoolSpendProposal message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposal + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.CommunityPoolSpendProposal} CommunityPoolSpendProposal + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommunityPoolSpendProposal.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.CommunityPoolSpendProposal(); + while (reader.pos < end) { + let 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: + if (!(message.amount && message.amount.length)) + message.amount = []; + message.amount.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CommunityPoolSpendProposal message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposal + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.CommunityPoolSpendProposal} CommunityPoolSpendProposal + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommunityPoolSpendProposal.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CommunityPoolSpendProposal message. + * @function verify + * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposal + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CommunityPoolSpendProposal.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.recipient != null && message.hasOwnProperty("recipient")) + if (!$util.isString(message.recipient)) + return "recipient: string expected"; + if (message.amount != null && message.hasOwnProperty("amount")) { + if (!Array.isArray(message.amount)) + return "amount: array expected"; + for (let i = 0; i < message.amount.length; ++i) { + let error = $root.cosmos.base.v1beta1.Coin.verify(message.amount[i]); + if (error) + return "amount." + error; + } + } + return null; + }; + + /** + * Creates a CommunityPoolSpendProposal message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposal + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.CommunityPoolSpendProposal} CommunityPoolSpendProposal + */ + CommunityPoolSpendProposal.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.CommunityPoolSpendProposal) + return object; + let message = new $root.cosmos.distribution.v1beta1.CommunityPoolSpendProposal(); + if (object.title != null) + message.title = String(object.title); + if (object.description != null) + message.description = String(object.description); + if (object.recipient != null) + message.recipient = String(object.recipient); + if (object.amount) { + if (!Array.isArray(object.amount)) + throw TypeError(".cosmos.distribution.v1beta1.CommunityPoolSpendProposal.amount: array expected"); + message.amount = []; + for (let i = 0; i < object.amount.length; ++i) { + if (typeof object.amount[i] !== "object") + throw TypeError(".cosmos.distribution.v1beta1.CommunityPoolSpendProposal.amount: object expected"); + message.amount[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.amount[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a CommunityPoolSpendProposal message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposal + * @static + * @param {cosmos.distribution.v1beta1.CommunityPoolSpendProposal} message CommunityPoolSpendProposal + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CommunityPoolSpendProposal.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.amount = []; + if (options.defaults) { + object.title = ""; + object.description = ""; + object.recipient = ""; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.recipient != null && message.hasOwnProperty("recipient")) + object.recipient = message.recipient; + if (message.amount && message.amount.length) { + object.amount = []; + for (let j = 0; j < message.amount.length; ++j) + object.amount[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.amount[j], options); + } + return object; + }; + + /** + * Converts this CommunityPoolSpendProposal to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposal + * @instance + * @returns {Object.} JSON object + */ + CommunityPoolSpendProposal.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CommunityPoolSpendProposal; + })(); + + v1beta1.DelegatorStartingInfo = (function() { + + /** + * Properties of a DelegatorStartingInfo. + * @memberof cosmos.distribution.v1beta1 + * @interface IDelegatorStartingInfo + * @property {Long|null} [previous_period] DelegatorStartingInfo previous_period + * @property {string|null} [stake] DelegatorStartingInfo stake + * @property {Long|null} [height] DelegatorStartingInfo height + */ + + /** + * Constructs a new DelegatorStartingInfo. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a DelegatorStartingInfo. + * @implements IDelegatorStartingInfo + * @constructor + * @param {cosmos.distribution.v1beta1.IDelegatorStartingInfo=} [properties] Properties to set + */ + function DelegatorStartingInfo(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DelegatorStartingInfo previous_period. + * @member {Long} previous_period + * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfo + * @instance + */ + DelegatorStartingInfo.prototype.previous_period = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * DelegatorStartingInfo stake. + * @member {string} stake + * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfo + * @instance + */ + DelegatorStartingInfo.prototype.stake = ""; + + /** + * DelegatorStartingInfo height. + * @member {Long} height + * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfo + * @instance + */ + DelegatorStartingInfo.prototype.height = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified DelegatorStartingInfo message. Does not implicitly {@link cosmos.distribution.v1beta1.DelegatorStartingInfo.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfo + * @static + * @param {cosmos.distribution.v1beta1.IDelegatorStartingInfo} message DelegatorStartingInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DelegatorStartingInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.previous_period != null && Object.hasOwnProperty.call(message, "previous_period")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.previous_period); + if (message.stake != null && Object.hasOwnProperty.call(message, "stake")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.stake); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.height); + return writer; + }; + + /** + * Encodes the specified DelegatorStartingInfo message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.DelegatorStartingInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfo + * @static + * @param {cosmos.distribution.v1beta1.IDelegatorStartingInfo} message DelegatorStartingInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DelegatorStartingInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DelegatorStartingInfo message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.DelegatorStartingInfo} DelegatorStartingInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DelegatorStartingInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.DelegatorStartingInfo(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.previous_period = reader.uint64(); + break; + case 2: + message.stake = reader.string(); + break; + case 3: + message.height = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DelegatorStartingInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.DelegatorStartingInfo} DelegatorStartingInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DelegatorStartingInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DelegatorStartingInfo message. + * @function verify + * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DelegatorStartingInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.previous_period != null && message.hasOwnProperty("previous_period")) + if (!$util.isInteger(message.previous_period) && !(message.previous_period && $util.isInteger(message.previous_period.low) && $util.isInteger(message.previous_period.high))) + return "previous_period: integer|Long expected"; + if (message.stake != null && message.hasOwnProperty("stake")) + if (!$util.isString(message.stake)) + return "stake: string expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) + return "height: integer|Long expected"; + return null; + }; + + /** + * Creates a DelegatorStartingInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfo + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.DelegatorStartingInfo} DelegatorStartingInfo + */ + DelegatorStartingInfo.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.DelegatorStartingInfo) + return object; + let message = new $root.cosmos.distribution.v1beta1.DelegatorStartingInfo(); + if (object.previous_period != null) + if ($util.Long) + (message.previous_period = $util.Long.fromValue(object.previous_period)).unsigned = true; + else if (typeof object.previous_period === "string") + message.previous_period = parseInt(object.previous_period, 10); + else if (typeof object.previous_period === "number") + message.previous_period = object.previous_period; + else if (typeof object.previous_period === "object") + message.previous_period = new $util.LongBits(object.previous_period.low >>> 0, object.previous_period.high >>> 0).toNumber(true); + if (object.stake != null) + message.stake = String(object.stake); + if (object.height != null) + if ($util.Long) + (message.height = $util.Long.fromValue(object.height)).unsigned = true; + else if (typeof object.height === "string") + message.height = parseInt(object.height, 10); + else if (typeof object.height === "number") + message.height = object.height; + else if (typeof object.height === "object") + message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a DelegatorStartingInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfo + * @static + * @param {cosmos.distribution.v1beta1.DelegatorStartingInfo} message DelegatorStartingInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DelegatorStartingInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.previous_period = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.previous_period = options.longs === String ? "0" : 0; + object.stake = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.height = options.longs === String ? "0" : 0; + } + if (message.previous_period != null && message.hasOwnProperty("previous_period")) + if (typeof message.previous_period === "number") + object.previous_period = options.longs === String ? String(message.previous_period) : message.previous_period; + else + object.previous_period = options.longs === String ? $util.Long.prototype.toString.call(message.previous_period) : options.longs === Number ? new $util.LongBits(message.previous_period.low >>> 0, message.previous_period.high >>> 0).toNumber(true) : message.previous_period; + if (message.stake != null && message.hasOwnProperty("stake")) + object.stake = message.stake; + if (message.height != null && message.hasOwnProperty("height")) + if (typeof message.height === "number") + object.height = options.longs === String ? String(message.height) : message.height; + else + object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber(true) : message.height; + return object; + }; + + /** + * Converts this DelegatorStartingInfo to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfo + * @instance + * @returns {Object.} JSON object + */ + DelegatorStartingInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DelegatorStartingInfo; + })(); + + v1beta1.DelegationDelegatorReward = (function() { + + /** + * Properties of a DelegationDelegatorReward. + * @memberof cosmos.distribution.v1beta1 + * @interface IDelegationDelegatorReward + * @property {string|null} [validator_address] DelegationDelegatorReward validator_address + * @property {Array.|null} [reward] DelegationDelegatorReward reward + */ + + /** + * Constructs a new DelegationDelegatorReward. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a DelegationDelegatorReward. + * @implements IDelegationDelegatorReward + * @constructor + * @param {cosmos.distribution.v1beta1.IDelegationDelegatorReward=} [properties] Properties to set + */ + function DelegationDelegatorReward(properties) { + this.reward = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DelegationDelegatorReward validator_address. + * @member {string} validator_address + * @memberof cosmos.distribution.v1beta1.DelegationDelegatorReward + * @instance + */ + DelegationDelegatorReward.prototype.validator_address = ""; + + /** + * DelegationDelegatorReward reward. + * @member {Array.} reward + * @memberof cosmos.distribution.v1beta1.DelegationDelegatorReward + * @instance + */ + DelegationDelegatorReward.prototype.reward = $util.emptyArray; + + /** + * Encodes the specified DelegationDelegatorReward message. Does not implicitly {@link cosmos.distribution.v1beta1.DelegationDelegatorReward.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.DelegationDelegatorReward + * @static + * @param {cosmos.distribution.v1beta1.IDelegationDelegatorReward} message DelegationDelegatorReward message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DelegationDelegatorReward.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.validator_address); + if (message.reward != null && message.reward.length) + for (let i = 0; i < message.reward.length; ++i) + $root.cosmos.base.v1beta1.DecCoin.encode(message.reward[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DelegationDelegatorReward message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.DelegationDelegatorReward.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.DelegationDelegatorReward + * @static + * @param {cosmos.distribution.v1beta1.IDelegationDelegatorReward} message DelegationDelegatorReward message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DelegationDelegatorReward.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DelegationDelegatorReward message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.DelegationDelegatorReward + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.DelegationDelegatorReward} DelegationDelegatorReward + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DelegationDelegatorReward.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.DelegationDelegatorReward(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_address = reader.string(); + break; + case 2: + if (!(message.reward && message.reward.length)) + message.reward = []; + message.reward.push($root.cosmos.base.v1beta1.DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DelegationDelegatorReward message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.DelegationDelegatorReward + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.DelegationDelegatorReward} DelegationDelegatorReward + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DelegationDelegatorReward.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DelegationDelegatorReward message. + * @function verify + * @memberof cosmos.distribution.v1beta1.DelegationDelegatorReward + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DelegationDelegatorReward.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + if (!$util.isString(message.validator_address)) + return "validator_address: string expected"; + if (message.reward != null && message.hasOwnProperty("reward")) { + if (!Array.isArray(message.reward)) + return "reward: array expected"; + for (let i = 0; i < message.reward.length; ++i) { + let error = $root.cosmos.base.v1beta1.DecCoin.verify(message.reward[i]); + if (error) + return "reward." + error; + } + } + return null; + }; + + /** + * Creates a DelegationDelegatorReward message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.DelegationDelegatorReward + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.DelegationDelegatorReward} DelegationDelegatorReward + */ + DelegationDelegatorReward.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.DelegationDelegatorReward) + return object; + let message = new $root.cosmos.distribution.v1beta1.DelegationDelegatorReward(); + if (object.validator_address != null) + message.validator_address = String(object.validator_address); + if (object.reward) { + if (!Array.isArray(object.reward)) + throw TypeError(".cosmos.distribution.v1beta1.DelegationDelegatorReward.reward: array expected"); + message.reward = []; + for (let i = 0; i < object.reward.length; ++i) { + if (typeof object.reward[i] !== "object") + throw TypeError(".cosmos.distribution.v1beta1.DelegationDelegatorReward.reward: object expected"); + message.reward[i] = $root.cosmos.base.v1beta1.DecCoin.fromObject(object.reward[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a DelegationDelegatorReward message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.DelegationDelegatorReward + * @static + * @param {cosmos.distribution.v1beta1.DelegationDelegatorReward} message DelegationDelegatorReward + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DelegationDelegatorReward.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.reward = []; + if (options.defaults) + object.validator_address = ""; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + object.validator_address = message.validator_address; + if (message.reward && message.reward.length) { + object.reward = []; + for (let j = 0; j < message.reward.length; ++j) + object.reward[j] = $root.cosmos.base.v1beta1.DecCoin.toObject(message.reward[j], options); + } + return object; + }; + + /** + * Converts this DelegationDelegatorReward to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.DelegationDelegatorReward + * @instance + * @returns {Object.} JSON object + */ + DelegationDelegatorReward.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DelegationDelegatorReward; + })(); + + v1beta1.CommunityPoolSpendProposalWithDeposit = (function() { + + /** + * Properties of a CommunityPoolSpendProposalWithDeposit. + * @memberof cosmos.distribution.v1beta1 + * @interface ICommunityPoolSpendProposalWithDeposit + * @property {string|null} [title] CommunityPoolSpendProposalWithDeposit title + * @property {string|null} [description] CommunityPoolSpendProposalWithDeposit description + * @property {string|null} [recipient] CommunityPoolSpendProposalWithDeposit recipient + * @property {string|null} [amount] CommunityPoolSpendProposalWithDeposit amount + * @property {string|null} [deposit] CommunityPoolSpendProposalWithDeposit deposit + */ + + /** + * Constructs a new CommunityPoolSpendProposalWithDeposit. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a CommunityPoolSpendProposalWithDeposit. + * @implements ICommunityPoolSpendProposalWithDeposit + * @constructor + * @param {cosmos.distribution.v1beta1.ICommunityPoolSpendProposalWithDeposit=} [properties] Properties to set + */ + function CommunityPoolSpendProposalWithDeposit(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CommunityPoolSpendProposalWithDeposit title. + * @member {string} title + * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit + * @instance + */ + CommunityPoolSpendProposalWithDeposit.prototype.title = ""; + + /** + * CommunityPoolSpendProposalWithDeposit description. + * @member {string} description + * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit + * @instance + */ + CommunityPoolSpendProposalWithDeposit.prototype.description = ""; + + /** + * CommunityPoolSpendProposalWithDeposit recipient. + * @member {string} recipient + * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit + * @instance + */ + CommunityPoolSpendProposalWithDeposit.prototype.recipient = ""; + + /** + * CommunityPoolSpendProposalWithDeposit amount. + * @member {string} amount + * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit + * @instance + */ + CommunityPoolSpendProposalWithDeposit.prototype.amount = ""; + + /** + * CommunityPoolSpendProposalWithDeposit deposit. + * @member {string} deposit + * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit + * @instance + */ + CommunityPoolSpendProposalWithDeposit.prototype.deposit = ""; + + /** + * Encodes the specified CommunityPoolSpendProposalWithDeposit message. Does not implicitly {@link cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit + * @static + * @param {cosmos.distribution.v1beta1.ICommunityPoolSpendProposalWithDeposit} message CommunityPoolSpendProposalWithDeposit message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommunityPoolSpendProposalWithDeposit.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.recipient != null && Object.hasOwnProperty.call(message, "recipient")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.recipient); + if (message.amount != null && Object.hasOwnProperty.call(message, "amount")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.amount); + if (message.deposit != null && Object.hasOwnProperty.call(message, "deposit")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.deposit); + return writer; + }; + + /** + * Encodes the specified CommunityPoolSpendProposalWithDeposit message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit + * @static + * @param {cosmos.distribution.v1beta1.ICommunityPoolSpendProposalWithDeposit} message CommunityPoolSpendProposalWithDeposit message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommunityPoolSpendProposalWithDeposit.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CommunityPoolSpendProposalWithDeposit message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit} CommunityPoolSpendProposalWithDeposit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommunityPoolSpendProposalWithDeposit.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit(); + while (reader.pos < end) { + let 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; + }; + + /** + * Decodes a CommunityPoolSpendProposalWithDeposit message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit} CommunityPoolSpendProposalWithDeposit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommunityPoolSpendProposalWithDeposit.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CommunityPoolSpendProposalWithDeposit message. + * @function verify + * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CommunityPoolSpendProposalWithDeposit.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.recipient != null && message.hasOwnProperty("recipient")) + if (!$util.isString(message.recipient)) + return "recipient: string expected"; + if (message.amount != null && message.hasOwnProperty("amount")) + if (!$util.isString(message.amount)) + return "amount: string expected"; + if (message.deposit != null && message.hasOwnProperty("deposit")) + if (!$util.isString(message.deposit)) + return "deposit: string expected"; + return null; + }; + + /** + * Creates a CommunityPoolSpendProposalWithDeposit message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit} CommunityPoolSpendProposalWithDeposit + */ + CommunityPoolSpendProposalWithDeposit.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit) + return object; + let message = new $root.cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit(); + if (object.title != null) + message.title = String(object.title); + if (object.description != null) + message.description = String(object.description); + if (object.recipient != null) + message.recipient = String(object.recipient); + if (object.amount != null) + message.amount = String(object.amount); + if (object.deposit != null) + message.deposit = String(object.deposit); + return message; + }; + + /** + * Creates a plain object from a CommunityPoolSpendProposalWithDeposit message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit + * @static + * @param {cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit} message CommunityPoolSpendProposalWithDeposit + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CommunityPoolSpendProposalWithDeposit.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.title = ""; + object.description = ""; + object.recipient = ""; + object.amount = ""; + object.deposit = ""; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.recipient != null && message.hasOwnProperty("recipient")) + object.recipient = message.recipient; + if (message.amount != null && message.hasOwnProperty("amount")) + object.amount = message.amount; + if (message.deposit != null && message.hasOwnProperty("deposit")) + object.deposit = message.deposit; + return object; + }; + + /** + * Converts this CommunityPoolSpendProposalWithDeposit to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit + * @instance + * @returns {Object.} JSON object + */ + CommunityPoolSpendProposalWithDeposit.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CommunityPoolSpendProposalWithDeposit; + })(); + + v1beta1.Query = (function() { + + /** + * Constructs a new Query service. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a Query + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Query(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Query.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Query; + + /** + * Callback as used by {@link cosmos.distribution.v1beta1.Query#params}. + * @memberof cosmos.distribution.v1beta1.Query + * @typedef ParamsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.distribution.v1beta1.QueryParamsResponse} [response] QueryParamsResponse + */ + + /** + * Calls Params. + * @function params + * @memberof cosmos.distribution.v1beta1.Query + * @instance + * @param {cosmos.distribution.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object + * @param {cosmos.distribution.v1beta1.Query.ParamsCallback} callback Node-style callback called with the error, if any, and QueryParamsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.params = function params(request, callback) { + return this.rpcCall(params, $root.cosmos.distribution.v1beta1.QueryParamsRequest, $root.cosmos.distribution.v1beta1.QueryParamsResponse, request, callback); + }, "name", { value: "Params" }); + + /** + * Calls Params. + * @function params + * @memberof cosmos.distribution.v1beta1.Query + * @instance + * @param {cosmos.distribution.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.distribution.v1beta1.Query#validatorOutstandingRewards}. + * @memberof cosmos.distribution.v1beta1.Query + * @typedef ValidatorOutstandingRewardsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse} [response] QueryValidatorOutstandingRewardsResponse + */ + + /** + * Calls ValidatorOutstandingRewards. + * @function validatorOutstandingRewards + * @memberof cosmos.distribution.v1beta1.Query + * @instance + * @param {cosmos.distribution.v1beta1.IQueryValidatorOutstandingRewardsRequest} request QueryValidatorOutstandingRewardsRequest message or plain object + * @param {cosmos.distribution.v1beta1.Query.ValidatorOutstandingRewardsCallback} callback Node-style callback called with the error, if any, and QueryValidatorOutstandingRewardsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.validatorOutstandingRewards = function validatorOutstandingRewards(request, callback) { + return this.rpcCall(validatorOutstandingRewards, $root.cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest, $root.cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse, request, callback); + }, "name", { value: "ValidatorOutstandingRewards" }); + + /** + * Calls ValidatorOutstandingRewards. + * @function validatorOutstandingRewards + * @memberof cosmos.distribution.v1beta1.Query + * @instance + * @param {cosmos.distribution.v1beta1.IQueryValidatorOutstandingRewardsRequest} request QueryValidatorOutstandingRewardsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.distribution.v1beta1.Query#validatorCommission}. + * @memberof cosmos.distribution.v1beta1.Query + * @typedef ValidatorCommissionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.distribution.v1beta1.QueryValidatorCommissionResponse} [response] QueryValidatorCommissionResponse + */ + + /** + * Calls ValidatorCommission. + * @function validatorCommission + * @memberof cosmos.distribution.v1beta1.Query + * @instance + * @param {cosmos.distribution.v1beta1.IQueryValidatorCommissionRequest} request QueryValidatorCommissionRequest message or plain object + * @param {cosmos.distribution.v1beta1.Query.ValidatorCommissionCallback} callback Node-style callback called with the error, if any, and QueryValidatorCommissionResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.validatorCommission = function validatorCommission(request, callback) { + return this.rpcCall(validatorCommission, $root.cosmos.distribution.v1beta1.QueryValidatorCommissionRequest, $root.cosmos.distribution.v1beta1.QueryValidatorCommissionResponse, request, callback); + }, "name", { value: "ValidatorCommission" }); + + /** + * Calls ValidatorCommission. + * @function validatorCommission + * @memberof cosmos.distribution.v1beta1.Query + * @instance + * @param {cosmos.distribution.v1beta1.IQueryValidatorCommissionRequest} request QueryValidatorCommissionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.distribution.v1beta1.Query#validatorSlashes}. + * @memberof cosmos.distribution.v1beta1.Query + * @typedef ValidatorSlashesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.distribution.v1beta1.QueryValidatorSlashesResponse} [response] QueryValidatorSlashesResponse + */ + + /** + * Calls ValidatorSlashes. + * @function validatorSlashes + * @memberof cosmos.distribution.v1beta1.Query + * @instance + * @param {cosmos.distribution.v1beta1.IQueryValidatorSlashesRequest} request QueryValidatorSlashesRequest message or plain object + * @param {cosmos.distribution.v1beta1.Query.ValidatorSlashesCallback} callback Node-style callback called with the error, if any, and QueryValidatorSlashesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.validatorSlashes = function validatorSlashes(request, callback) { + return this.rpcCall(validatorSlashes, $root.cosmos.distribution.v1beta1.QueryValidatorSlashesRequest, $root.cosmos.distribution.v1beta1.QueryValidatorSlashesResponse, request, callback); + }, "name", { value: "ValidatorSlashes" }); + + /** + * Calls ValidatorSlashes. + * @function validatorSlashes + * @memberof cosmos.distribution.v1beta1.Query + * @instance + * @param {cosmos.distribution.v1beta1.IQueryValidatorSlashesRequest} request QueryValidatorSlashesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.distribution.v1beta1.Query#delegationRewards}. + * @memberof cosmos.distribution.v1beta1.Query + * @typedef DelegationRewardsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.distribution.v1beta1.QueryDelegationRewardsResponse} [response] QueryDelegationRewardsResponse + */ + + /** + * Calls DelegationRewards. + * @function delegationRewards + * @memberof cosmos.distribution.v1beta1.Query + * @instance + * @param {cosmos.distribution.v1beta1.IQueryDelegationRewardsRequest} request QueryDelegationRewardsRequest message or plain object + * @param {cosmos.distribution.v1beta1.Query.DelegationRewardsCallback} callback Node-style callback called with the error, if any, and QueryDelegationRewardsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.delegationRewards = function delegationRewards(request, callback) { + return this.rpcCall(delegationRewards, $root.cosmos.distribution.v1beta1.QueryDelegationRewardsRequest, $root.cosmos.distribution.v1beta1.QueryDelegationRewardsResponse, request, callback); + }, "name", { value: "DelegationRewards" }); + + /** + * Calls DelegationRewards. + * @function delegationRewards + * @memberof cosmos.distribution.v1beta1.Query + * @instance + * @param {cosmos.distribution.v1beta1.IQueryDelegationRewardsRequest} request QueryDelegationRewardsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.distribution.v1beta1.Query#delegationTotalRewards}. + * @memberof cosmos.distribution.v1beta1.Query + * @typedef DelegationTotalRewardsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse} [response] QueryDelegationTotalRewardsResponse + */ + + /** + * Calls DelegationTotalRewards. + * @function delegationTotalRewards + * @memberof cosmos.distribution.v1beta1.Query + * @instance + * @param {cosmos.distribution.v1beta1.IQueryDelegationTotalRewardsRequest} request QueryDelegationTotalRewardsRequest message or plain object + * @param {cosmos.distribution.v1beta1.Query.DelegationTotalRewardsCallback} callback Node-style callback called with the error, if any, and QueryDelegationTotalRewardsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.delegationTotalRewards = function delegationTotalRewards(request, callback) { + return this.rpcCall(delegationTotalRewards, $root.cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest, $root.cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse, request, callback); + }, "name", { value: "DelegationTotalRewards" }); + + /** + * Calls DelegationTotalRewards. + * @function delegationTotalRewards + * @memberof cosmos.distribution.v1beta1.Query + * @instance + * @param {cosmos.distribution.v1beta1.IQueryDelegationTotalRewardsRequest} request QueryDelegationTotalRewardsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.distribution.v1beta1.Query#delegatorValidators}. + * @memberof cosmos.distribution.v1beta1.Query + * @typedef DelegatorValidatorsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse} [response] QueryDelegatorValidatorsResponse + */ + + /** + * Calls DelegatorValidators. + * @function delegatorValidators + * @memberof cosmos.distribution.v1beta1.Query + * @instance + * @param {cosmos.distribution.v1beta1.IQueryDelegatorValidatorsRequest} request QueryDelegatorValidatorsRequest message or plain object + * @param {cosmos.distribution.v1beta1.Query.DelegatorValidatorsCallback} callback Node-style callback called with the error, if any, and QueryDelegatorValidatorsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.delegatorValidators = function delegatorValidators(request, callback) { + return this.rpcCall(delegatorValidators, $root.cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest, $root.cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse, request, callback); + }, "name", { value: "DelegatorValidators" }); + + /** + * Calls DelegatorValidators. + * @function delegatorValidators + * @memberof cosmos.distribution.v1beta1.Query + * @instance + * @param {cosmos.distribution.v1beta1.IQueryDelegatorValidatorsRequest} request QueryDelegatorValidatorsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.distribution.v1beta1.Query#delegatorWithdrawAddress}. + * @memberof cosmos.distribution.v1beta1.Query + * @typedef DelegatorWithdrawAddressCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse} [response] QueryDelegatorWithdrawAddressResponse + */ + + /** + * Calls DelegatorWithdrawAddress. + * @function delegatorWithdrawAddress + * @memberof cosmos.distribution.v1beta1.Query + * @instance + * @param {cosmos.distribution.v1beta1.IQueryDelegatorWithdrawAddressRequest} request QueryDelegatorWithdrawAddressRequest message or plain object + * @param {cosmos.distribution.v1beta1.Query.DelegatorWithdrawAddressCallback} callback Node-style callback called with the error, if any, and QueryDelegatorWithdrawAddressResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.delegatorWithdrawAddress = function delegatorWithdrawAddress(request, callback) { + return this.rpcCall(delegatorWithdrawAddress, $root.cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest, $root.cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse, request, callback); + }, "name", { value: "DelegatorWithdrawAddress" }); + + /** + * Calls DelegatorWithdrawAddress. + * @function delegatorWithdrawAddress + * @memberof cosmos.distribution.v1beta1.Query + * @instance + * @param {cosmos.distribution.v1beta1.IQueryDelegatorWithdrawAddressRequest} request QueryDelegatorWithdrawAddressRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.distribution.v1beta1.Query#communityPool}. + * @memberof cosmos.distribution.v1beta1.Query + * @typedef CommunityPoolCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.distribution.v1beta1.QueryCommunityPoolResponse} [response] QueryCommunityPoolResponse + */ + + /** + * Calls CommunityPool. + * @function communityPool + * @memberof cosmos.distribution.v1beta1.Query + * @instance + * @param {cosmos.distribution.v1beta1.IQueryCommunityPoolRequest} request QueryCommunityPoolRequest message or plain object + * @param {cosmos.distribution.v1beta1.Query.CommunityPoolCallback} callback Node-style callback called with the error, if any, and QueryCommunityPoolResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.communityPool = function communityPool(request, callback) { + return this.rpcCall(communityPool, $root.cosmos.distribution.v1beta1.QueryCommunityPoolRequest, $root.cosmos.distribution.v1beta1.QueryCommunityPoolResponse, request, callback); + }, "name", { value: "CommunityPool" }); + + /** + * Calls CommunityPool. + * @function communityPool + * @memberof cosmos.distribution.v1beta1.Query + * @instance + * @param {cosmos.distribution.v1beta1.IQueryCommunityPoolRequest} request QueryCommunityPoolRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Query; + })(); + + v1beta1.QueryParamsRequest = (function() { + + /** + * Properties of a QueryParamsRequest. + * @memberof cosmos.distribution.v1beta1 + * @interface IQueryParamsRequest + */ + + /** + * Constructs a new QueryParamsRequest. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a QueryParamsRequest. + * @implements IQueryParamsRequest + * @constructor + * @param {cosmos.distribution.v1beta1.IQueryParamsRequest=} [properties] Properties to set + */ + function QueryParamsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified QueryParamsRequest message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryParamsRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.QueryParamsRequest + * @static + * @param {cosmos.distribution.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified QueryParamsRequest message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryParamsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryParamsRequest + * @static + * @param {cosmos.distribution.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryParamsRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.QueryParamsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.QueryParamsRequest} QueryParamsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryParamsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryParamsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryParamsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.QueryParamsRequest} QueryParamsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryParamsRequest message. + * @function verify + * @memberof cosmos.distribution.v1beta1.QueryParamsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryParamsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a QueryParamsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.QueryParamsRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.QueryParamsRequest} QueryParamsRequest + */ + QueryParamsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.QueryParamsRequest) + return object; + return new $root.cosmos.distribution.v1beta1.QueryParamsRequest(); + }; + + /** + * Creates a plain object from a QueryParamsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.QueryParamsRequest + * @static + * @param {cosmos.distribution.v1beta1.QueryParamsRequest} message QueryParamsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryParamsRequest.toObject = function toObject() { + return {}; + }; + + /** + * Converts this QueryParamsRequest to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.QueryParamsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryParamsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryParamsRequest; + })(); + + v1beta1.QueryParamsResponse = (function() { + + /** + * Properties of a QueryParamsResponse. + * @memberof cosmos.distribution.v1beta1 + * @interface IQueryParamsResponse + * @property {cosmos.distribution.v1beta1.IParams|null} [params] QueryParamsResponse params + */ + + /** + * Constructs a new QueryParamsResponse. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a QueryParamsResponse. + * @implements IQueryParamsResponse + * @constructor + * @param {cosmos.distribution.v1beta1.IQueryParamsResponse=} [properties] Properties to set + */ + function QueryParamsResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryParamsResponse params. + * @member {cosmos.distribution.v1beta1.IParams|null|undefined} params + * @memberof cosmos.distribution.v1beta1.QueryParamsResponse + * @instance + */ + QueryParamsResponse.prototype.params = null; + + /** + * Encodes the specified QueryParamsResponse message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryParamsResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.QueryParamsResponse + * @static + * @param {cosmos.distribution.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.params != null && Object.hasOwnProperty.call(message, "params")) + $root.cosmos.distribution.v1beta1.Params.encode(message.params, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryParamsResponse message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryParamsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryParamsResponse + * @static + * @param {cosmos.distribution.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryParamsResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.QueryParamsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.QueryParamsResponse} QueryParamsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryParamsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = $root.cosmos.distribution.v1beta1.Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryParamsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryParamsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.QueryParamsResponse} QueryParamsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryParamsResponse message. + * @function verify + * @memberof cosmos.distribution.v1beta1.QueryParamsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryParamsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.params != null && message.hasOwnProperty("params")) { + let error = $root.cosmos.distribution.v1beta1.Params.verify(message.params); + if (error) + return "params." + error; + } + return null; + }; + + /** + * Creates a QueryParamsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.QueryParamsResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.QueryParamsResponse} QueryParamsResponse + */ + QueryParamsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.QueryParamsResponse) + return object; + let message = new $root.cosmos.distribution.v1beta1.QueryParamsResponse(); + if (object.params != null) { + if (typeof object.params !== "object") + throw TypeError(".cosmos.distribution.v1beta1.QueryParamsResponse.params: object expected"); + message.params = $root.cosmos.distribution.v1beta1.Params.fromObject(object.params); + } + return message; + }; + + /** + * Creates a plain object from a QueryParamsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.QueryParamsResponse + * @static + * @param {cosmos.distribution.v1beta1.QueryParamsResponse} message QueryParamsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryParamsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.params = null; + if (message.params != null && message.hasOwnProperty("params")) + object.params = $root.cosmos.distribution.v1beta1.Params.toObject(message.params, options); + return object; + }; + + /** + * Converts this QueryParamsResponse to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.QueryParamsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryParamsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryParamsResponse; + })(); + + v1beta1.QueryValidatorOutstandingRewardsRequest = (function() { + + /** + * Properties of a QueryValidatorOutstandingRewardsRequest. + * @memberof cosmos.distribution.v1beta1 + * @interface IQueryValidatorOutstandingRewardsRequest + * @property {string|null} [validator_address] QueryValidatorOutstandingRewardsRequest validator_address + */ + + /** + * Constructs a new QueryValidatorOutstandingRewardsRequest. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a QueryValidatorOutstandingRewardsRequest. + * @implements IQueryValidatorOutstandingRewardsRequest + * @constructor + * @param {cosmos.distribution.v1beta1.IQueryValidatorOutstandingRewardsRequest=} [properties] Properties to set + */ + function QueryValidatorOutstandingRewardsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryValidatorOutstandingRewardsRequest validator_address. + * @member {string} validator_address + * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest + * @instance + */ + QueryValidatorOutstandingRewardsRequest.prototype.validator_address = ""; + + /** + * Encodes the specified QueryValidatorOutstandingRewardsRequest message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest + * @static + * @param {cosmos.distribution.v1beta1.IQueryValidatorOutstandingRewardsRequest} message QueryValidatorOutstandingRewardsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryValidatorOutstandingRewardsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.validator_address); + return writer; + }; + + /** + * Encodes the specified QueryValidatorOutstandingRewardsRequest message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest + * @static + * @param {cosmos.distribution.v1beta1.IQueryValidatorOutstandingRewardsRequest} message QueryValidatorOutstandingRewardsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryValidatorOutstandingRewardsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryValidatorOutstandingRewardsRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest} QueryValidatorOutstandingRewardsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryValidatorOutstandingRewardsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryValidatorOutstandingRewardsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest} QueryValidatorOutstandingRewardsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryValidatorOutstandingRewardsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryValidatorOutstandingRewardsRequest message. + * @function verify + * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryValidatorOutstandingRewardsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + if (!$util.isString(message.validator_address)) + return "validator_address: string expected"; + return null; + }; + + /** + * Creates a QueryValidatorOutstandingRewardsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest} QueryValidatorOutstandingRewardsRequest + */ + QueryValidatorOutstandingRewardsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest) + return object; + let message = new $root.cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest(); + if (object.validator_address != null) + message.validator_address = String(object.validator_address); + return message; + }; + + /** + * Creates a plain object from a QueryValidatorOutstandingRewardsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest + * @static + * @param {cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest} message QueryValidatorOutstandingRewardsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryValidatorOutstandingRewardsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.validator_address = ""; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + object.validator_address = message.validator_address; + return object; + }; + + /** + * Converts this QueryValidatorOutstandingRewardsRequest to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryValidatorOutstandingRewardsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryValidatorOutstandingRewardsRequest; + })(); + + v1beta1.QueryValidatorOutstandingRewardsResponse = (function() { + + /** + * Properties of a QueryValidatorOutstandingRewardsResponse. + * @memberof cosmos.distribution.v1beta1 + * @interface IQueryValidatorOutstandingRewardsResponse + * @property {cosmos.distribution.v1beta1.IValidatorOutstandingRewards|null} [rewards] QueryValidatorOutstandingRewardsResponse rewards + */ + + /** + * Constructs a new QueryValidatorOutstandingRewardsResponse. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a QueryValidatorOutstandingRewardsResponse. + * @implements IQueryValidatorOutstandingRewardsResponse + * @constructor + * @param {cosmos.distribution.v1beta1.IQueryValidatorOutstandingRewardsResponse=} [properties] Properties to set + */ + function QueryValidatorOutstandingRewardsResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryValidatorOutstandingRewardsResponse rewards. + * @member {cosmos.distribution.v1beta1.IValidatorOutstandingRewards|null|undefined} rewards + * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse + * @instance + */ + QueryValidatorOutstandingRewardsResponse.prototype.rewards = null; + + /** + * Encodes the specified QueryValidatorOutstandingRewardsResponse message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse + * @static + * @param {cosmos.distribution.v1beta1.IQueryValidatorOutstandingRewardsResponse} message QueryValidatorOutstandingRewardsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryValidatorOutstandingRewardsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rewards != null && Object.hasOwnProperty.call(message, "rewards")) + $root.cosmos.distribution.v1beta1.ValidatorOutstandingRewards.encode(message.rewards, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryValidatorOutstandingRewardsResponse message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse + * @static + * @param {cosmos.distribution.v1beta1.IQueryValidatorOutstandingRewardsResponse} message QueryValidatorOutstandingRewardsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryValidatorOutstandingRewardsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryValidatorOutstandingRewardsResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse} QueryValidatorOutstandingRewardsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryValidatorOutstandingRewardsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rewards = $root.cosmos.distribution.v1beta1.ValidatorOutstandingRewards.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryValidatorOutstandingRewardsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse} QueryValidatorOutstandingRewardsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryValidatorOutstandingRewardsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryValidatorOutstandingRewardsResponse message. + * @function verify + * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryValidatorOutstandingRewardsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rewards != null && message.hasOwnProperty("rewards")) { + let error = $root.cosmos.distribution.v1beta1.ValidatorOutstandingRewards.verify(message.rewards); + if (error) + return "rewards." + error; + } + return null; + }; + + /** + * Creates a QueryValidatorOutstandingRewardsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse} QueryValidatorOutstandingRewardsResponse + */ + QueryValidatorOutstandingRewardsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse) + return object; + let message = new $root.cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse(); + if (object.rewards != null) { + if (typeof object.rewards !== "object") + throw TypeError(".cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse.rewards: object expected"); + message.rewards = $root.cosmos.distribution.v1beta1.ValidatorOutstandingRewards.fromObject(object.rewards); + } + return message; + }; + + /** + * Creates a plain object from a QueryValidatorOutstandingRewardsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse + * @static + * @param {cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse} message QueryValidatorOutstandingRewardsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryValidatorOutstandingRewardsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.rewards = null; + if (message.rewards != null && message.hasOwnProperty("rewards")) + object.rewards = $root.cosmos.distribution.v1beta1.ValidatorOutstandingRewards.toObject(message.rewards, options); + return object; + }; + + /** + * Converts this QueryValidatorOutstandingRewardsResponse to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryValidatorOutstandingRewardsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryValidatorOutstandingRewardsResponse; + })(); + + v1beta1.QueryValidatorCommissionRequest = (function() { + + /** + * Properties of a QueryValidatorCommissionRequest. + * @memberof cosmos.distribution.v1beta1 + * @interface IQueryValidatorCommissionRequest + * @property {string|null} [validator_address] QueryValidatorCommissionRequest validator_address + */ + + /** + * Constructs a new QueryValidatorCommissionRequest. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a QueryValidatorCommissionRequest. + * @implements IQueryValidatorCommissionRequest + * @constructor + * @param {cosmos.distribution.v1beta1.IQueryValidatorCommissionRequest=} [properties] Properties to set + */ + function QueryValidatorCommissionRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryValidatorCommissionRequest validator_address. + * @member {string} validator_address + * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionRequest + * @instance + */ + QueryValidatorCommissionRequest.prototype.validator_address = ""; + + /** + * Encodes the specified QueryValidatorCommissionRequest message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryValidatorCommissionRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionRequest + * @static + * @param {cosmos.distribution.v1beta1.IQueryValidatorCommissionRequest} message QueryValidatorCommissionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryValidatorCommissionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.validator_address); + return writer; + }; + + /** + * Encodes the specified QueryValidatorCommissionRequest message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryValidatorCommissionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionRequest + * @static + * @param {cosmos.distribution.v1beta1.IQueryValidatorCommissionRequest} message QueryValidatorCommissionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryValidatorCommissionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryValidatorCommissionRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.QueryValidatorCommissionRequest} QueryValidatorCommissionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryValidatorCommissionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryValidatorCommissionRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryValidatorCommissionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.QueryValidatorCommissionRequest} QueryValidatorCommissionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryValidatorCommissionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryValidatorCommissionRequest message. + * @function verify + * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryValidatorCommissionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + if (!$util.isString(message.validator_address)) + return "validator_address: string expected"; + return null; + }; + + /** + * Creates a QueryValidatorCommissionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.QueryValidatorCommissionRequest} QueryValidatorCommissionRequest + */ + QueryValidatorCommissionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.QueryValidatorCommissionRequest) + return object; + let message = new $root.cosmos.distribution.v1beta1.QueryValidatorCommissionRequest(); + if (object.validator_address != null) + message.validator_address = String(object.validator_address); + return message; + }; + + /** + * Creates a plain object from a QueryValidatorCommissionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionRequest + * @static + * @param {cosmos.distribution.v1beta1.QueryValidatorCommissionRequest} message QueryValidatorCommissionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryValidatorCommissionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.validator_address = ""; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + object.validator_address = message.validator_address; + return object; + }; + + /** + * Converts this QueryValidatorCommissionRequest to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionRequest + * @instance + * @returns {Object.} JSON object + */ + QueryValidatorCommissionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryValidatorCommissionRequest; + })(); + + v1beta1.QueryValidatorCommissionResponse = (function() { + + /** + * Properties of a QueryValidatorCommissionResponse. + * @memberof cosmos.distribution.v1beta1 + * @interface IQueryValidatorCommissionResponse + * @property {cosmos.distribution.v1beta1.IValidatorAccumulatedCommission|null} [commission] QueryValidatorCommissionResponse commission + */ + + /** + * Constructs a new QueryValidatorCommissionResponse. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a QueryValidatorCommissionResponse. + * @implements IQueryValidatorCommissionResponse + * @constructor + * @param {cosmos.distribution.v1beta1.IQueryValidatorCommissionResponse=} [properties] Properties to set + */ + function QueryValidatorCommissionResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryValidatorCommissionResponse commission. + * @member {cosmos.distribution.v1beta1.IValidatorAccumulatedCommission|null|undefined} commission + * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionResponse + * @instance + */ + QueryValidatorCommissionResponse.prototype.commission = null; + + /** + * Encodes the specified QueryValidatorCommissionResponse message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryValidatorCommissionResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionResponse + * @static + * @param {cosmos.distribution.v1beta1.IQueryValidatorCommissionResponse} message QueryValidatorCommissionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryValidatorCommissionResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commission != null && Object.hasOwnProperty.call(message, "commission")) + $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommission.encode(message.commission, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryValidatorCommissionResponse message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryValidatorCommissionResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionResponse + * @static + * @param {cosmos.distribution.v1beta1.IQueryValidatorCommissionResponse} message QueryValidatorCommissionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryValidatorCommissionResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryValidatorCommissionResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.QueryValidatorCommissionResponse} QueryValidatorCommissionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryValidatorCommissionResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryValidatorCommissionResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commission = $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryValidatorCommissionResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.QueryValidatorCommissionResponse} QueryValidatorCommissionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryValidatorCommissionResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryValidatorCommissionResponse message. + * @function verify + * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryValidatorCommissionResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.commission != null && message.hasOwnProperty("commission")) { + let error = $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommission.verify(message.commission); + if (error) + return "commission." + error; + } + return null; + }; + + /** + * Creates a QueryValidatorCommissionResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.QueryValidatorCommissionResponse} QueryValidatorCommissionResponse + */ + QueryValidatorCommissionResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.QueryValidatorCommissionResponse) + return object; + let message = new $root.cosmos.distribution.v1beta1.QueryValidatorCommissionResponse(); + if (object.commission != null) { + if (typeof object.commission !== "object") + throw TypeError(".cosmos.distribution.v1beta1.QueryValidatorCommissionResponse.commission: object expected"); + message.commission = $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommission.fromObject(object.commission); + } + return message; + }; + + /** + * Creates a plain object from a QueryValidatorCommissionResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionResponse + * @static + * @param {cosmos.distribution.v1beta1.QueryValidatorCommissionResponse} message QueryValidatorCommissionResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryValidatorCommissionResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.commission = null; + if (message.commission != null && message.hasOwnProperty("commission")) + object.commission = $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommission.toObject(message.commission, options); + return object; + }; + + /** + * Converts this QueryValidatorCommissionResponse to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionResponse + * @instance + * @returns {Object.} JSON object + */ + QueryValidatorCommissionResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryValidatorCommissionResponse; + })(); + + v1beta1.QueryValidatorSlashesRequest = (function() { + + /** + * Properties of a QueryValidatorSlashesRequest. + * @memberof cosmos.distribution.v1beta1 + * @interface IQueryValidatorSlashesRequest + * @property {string|null} [validator_address] QueryValidatorSlashesRequest validator_address + * @property {Long|null} [starting_height] QueryValidatorSlashesRequest starting_height + * @property {Long|null} [ending_height] QueryValidatorSlashesRequest ending_height + * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryValidatorSlashesRequest pagination + */ + + /** + * Constructs a new QueryValidatorSlashesRequest. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a QueryValidatorSlashesRequest. + * @implements IQueryValidatorSlashesRequest + * @constructor + * @param {cosmos.distribution.v1beta1.IQueryValidatorSlashesRequest=} [properties] Properties to set + */ + function QueryValidatorSlashesRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryValidatorSlashesRequest validator_address. + * @member {string} validator_address + * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesRequest + * @instance + */ + QueryValidatorSlashesRequest.prototype.validator_address = ""; + + /** + * QueryValidatorSlashesRequest starting_height. + * @member {Long} starting_height + * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesRequest + * @instance + */ + QueryValidatorSlashesRequest.prototype.starting_height = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * QueryValidatorSlashesRequest ending_height. + * @member {Long} ending_height + * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesRequest + * @instance + */ + QueryValidatorSlashesRequest.prototype.ending_height = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * QueryValidatorSlashesRequest pagination. + * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination + * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesRequest + * @instance + */ + QueryValidatorSlashesRequest.prototype.pagination = null; + + /** + * Encodes the specified QueryValidatorSlashesRequest message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryValidatorSlashesRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesRequest + * @static + * @param {cosmos.distribution.v1beta1.IQueryValidatorSlashesRequest} message QueryValidatorSlashesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryValidatorSlashesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.validator_address); + if (message.starting_height != null && Object.hasOwnProperty.call(message, "starting_height")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.starting_height); + if (message.ending_height != null && Object.hasOwnProperty.call(message, "ending_height")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.ending_height); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryValidatorSlashesRequest message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryValidatorSlashesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesRequest + * @static + * @param {cosmos.distribution.v1beta1.IQueryValidatorSlashesRequest} message QueryValidatorSlashesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryValidatorSlashesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryValidatorSlashesRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.QueryValidatorSlashesRequest} QueryValidatorSlashesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryValidatorSlashesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryValidatorSlashesRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_address = reader.string(); + break; + case 2: + message.starting_height = reader.uint64(); + break; + case 3: + message.ending_height = reader.uint64(); + break; + case 4: + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryValidatorSlashesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.QueryValidatorSlashesRequest} QueryValidatorSlashesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryValidatorSlashesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryValidatorSlashesRequest message. + * @function verify + * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryValidatorSlashesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + if (!$util.isString(message.validator_address)) + return "validator_address: string expected"; + if (message.starting_height != null && message.hasOwnProperty("starting_height")) + if (!$util.isInteger(message.starting_height) && !(message.starting_height && $util.isInteger(message.starting_height.low) && $util.isInteger(message.starting_height.high))) + return "starting_height: integer|Long expected"; + if (message.ending_height != null && message.hasOwnProperty("ending_height")) + if (!$util.isInteger(message.ending_height) && !(message.ending_height && $util.isInteger(message.ending_height.low) && $util.isInteger(message.ending_height.high))) + return "ending_height: integer|Long expected"; + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryValidatorSlashesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.QueryValidatorSlashesRequest} QueryValidatorSlashesRequest + */ + QueryValidatorSlashesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.QueryValidatorSlashesRequest) + return object; + let message = new $root.cosmos.distribution.v1beta1.QueryValidatorSlashesRequest(); + if (object.validator_address != null) + message.validator_address = String(object.validator_address); + if (object.starting_height != null) + if ($util.Long) + (message.starting_height = $util.Long.fromValue(object.starting_height)).unsigned = true; + else if (typeof object.starting_height === "string") + message.starting_height = parseInt(object.starting_height, 10); + else if (typeof object.starting_height === "number") + message.starting_height = object.starting_height; + else if (typeof object.starting_height === "object") + message.starting_height = new $util.LongBits(object.starting_height.low >>> 0, object.starting_height.high >>> 0).toNumber(true); + if (object.ending_height != null) + if ($util.Long) + (message.ending_height = $util.Long.fromValue(object.ending_height)).unsigned = true; + else if (typeof object.ending_height === "string") + message.ending_height = parseInt(object.ending_height, 10); + else if (typeof object.ending_height === "number") + message.ending_height = object.ending_height; + else if (typeof object.ending_height === "object") + message.ending_height = new $util.LongBits(object.ending_height.low >>> 0, object.ending_height.high >>> 0).toNumber(true); + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.distribution.v1beta1.QueryValidatorSlashesRequest.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryValidatorSlashesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesRequest + * @static + * @param {cosmos.distribution.v1beta1.QueryValidatorSlashesRequest} message QueryValidatorSlashesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryValidatorSlashesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.validator_address = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.starting_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.starting_height = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.ending_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.ending_height = options.longs === String ? "0" : 0; + object.pagination = null; + } + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + object.validator_address = message.validator_address; + if (message.starting_height != null && message.hasOwnProperty("starting_height")) + if (typeof message.starting_height === "number") + object.starting_height = options.longs === String ? String(message.starting_height) : message.starting_height; + else + object.starting_height = options.longs === String ? $util.Long.prototype.toString.call(message.starting_height) : options.longs === Number ? new $util.LongBits(message.starting_height.low >>> 0, message.starting_height.high >>> 0).toNumber(true) : message.starting_height; + if (message.ending_height != null && message.hasOwnProperty("ending_height")) + if (typeof message.ending_height === "number") + object.ending_height = options.longs === String ? String(message.ending_height) : message.ending_height; + else + object.ending_height = options.longs === String ? $util.Long.prototype.toString.call(message.ending_height) : options.longs === Number ? new $util.LongBits(message.ending_height.low >>> 0, message.ending_height.high >>> 0).toNumber(true) : message.ending_height; + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryValidatorSlashesRequest to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesRequest + * @instance + * @returns {Object.} JSON object + */ + QueryValidatorSlashesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryValidatorSlashesRequest; + })(); + + v1beta1.QueryValidatorSlashesResponse = (function() { + + /** + * Properties of a QueryValidatorSlashesResponse. + * @memberof cosmos.distribution.v1beta1 + * @interface IQueryValidatorSlashesResponse + * @property {Array.|null} [slashes] QueryValidatorSlashesResponse slashes + * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryValidatorSlashesResponse pagination + */ + + /** + * Constructs a new QueryValidatorSlashesResponse. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a QueryValidatorSlashesResponse. + * @implements IQueryValidatorSlashesResponse + * @constructor + * @param {cosmos.distribution.v1beta1.IQueryValidatorSlashesResponse=} [properties] Properties to set + */ + function QueryValidatorSlashesResponse(properties) { + this.slashes = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryValidatorSlashesResponse slashes. + * @member {Array.} slashes + * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesResponse + * @instance + */ + QueryValidatorSlashesResponse.prototype.slashes = $util.emptyArray; + + /** + * QueryValidatorSlashesResponse pagination. + * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination + * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesResponse + * @instance + */ + QueryValidatorSlashesResponse.prototype.pagination = null; + + /** + * Encodes the specified QueryValidatorSlashesResponse message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryValidatorSlashesResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesResponse + * @static + * @param {cosmos.distribution.v1beta1.IQueryValidatorSlashesResponse} message QueryValidatorSlashesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryValidatorSlashesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.slashes != null && message.slashes.length) + for (let i = 0; i < message.slashes.length; ++i) + $root.cosmos.distribution.v1beta1.ValidatorSlashEvent.encode(message.slashes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryValidatorSlashesResponse message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryValidatorSlashesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesResponse + * @static + * @param {cosmos.distribution.v1beta1.IQueryValidatorSlashesResponse} message QueryValidatorSlashesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryValidatorSlashesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryValidatorSlashesResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.QueryValidatorSlashesResponse} QueryValidatorSlashesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryValidatorSlashesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryValidatorSlashesResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.slashes && message.slashes.length)) + message.slashes = []; + message.slashes.push($root.cosmos.distribution.v1beta1.ValidatorSlashEvent.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryValidatorSlashesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.QueryValidatorSlashesResponse} QueryValidatorSlashesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryValidatorSlashesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryValidatorSlashesResponse message. + * @function verify + * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryValidatorSlashesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.slashes != null && message.hasOwnProperty("slashes")) { + if (!Array.isArray(message.slashes)) + return "slashes: array expected"; + for (let i = 0; i < message.slashes.length; ++i) { + let error = $root.cosmos.distribution.v1beta1.ValidatorSlashEvent.verify(message.slashes[i]); + if (error) + return "slashes." + error; + } + } + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryValidatorSlashesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.QueryValidatorSlashesResponse} QueryValidatorSlashesResponse + */ + QueryValidatorSlashesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.QueryValidatorSlashesResponse) + return object; + let message = new $root.cosmos.distribution.v1beta1.QueryValidatorSlashesResponse(); + if (object.slashes) { + if (!Array.isArray(object.slashes)) + throw TypeError(".cosmos.distribution.v1beta1.QueryValidatorSlashesResponse.slashes: array expected"); + message.slashes = []; + for (let i = 0; i < object.slashes.length; ++i) { + if (typeof object.slashes[i] !== "object") + throw TypeError(".cosmos.distribution.v1beta1.QueryValidatorSlashesResponse.slashes: object expected"); + message.slashes[i] = $root.cosmos.distribution.v1beta1.ValidatorSlashEvent.fromObject(object.slashes[i]); + } + } + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.distribution.v1beta1.QueryValidatorSlashesResponse.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryValidatorSlashesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesResponse + * @static + * @param {cosmos.distribution.v1beta1.QueryValidatorSlashesResponse} message QueryValidatorSlashesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryValidatorSlashesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.slashes = []; + if (options.defaults) + object.pagination = null; + if (message.slashes && message.slashes.length) { + object.slashes = []; + for (let j = 0; j < message.slashes.length; ++j) + object.slashes[j] = $root.cosmos.distribution.v1beta1.ValidatorSlashEvent.toObject(message.slashes[j], options); + } + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryValidatorSlashesResponse to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesResponse + * @instance + * @returns {Object.} JSON object + */ + QueryValidatorSlashesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryValidatorSlashesResponse; + })(); + + v1beta1.QueryDelegationRewardsRequest = (function() { + + /** + * Properties of a QueryDelegationRewardsRequest. + * @memberof cosmos.distribution.v1beta1 + * @interface IQueryDelegationRewardsRequest + * @property {string|null} [delegator_address] QueryDelegationRewardsRequest delegator_address + * @property {string|null} [validator_address] QueryDelegationRewardsRequest validator_address + */ + + /** + * Constructs a new QueryDelegationRewardsRequest. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a QueryDelegationRewardsRequest. + * @implements IQueryDelegationRewardsRequest + * @constructor + * @param {cosmos.distribution.v1beta1.IQueryDelegationRewardsRequest=} [properties] Properties to set + */ + function QueryDelegationRewardsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryDelegationRewardsRequest delegator_address. + * @member {string} delegator_address + * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsRequest + * @instance + */ + QueryDelegationRewardsRequest.prototype.delegator_address = ""; + + /** + * QueryDelegationRewardsRequest validator_address. + * @member {string} validator_address + * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsRequest + * @instance + */ + QueryDelegationRewardsRequest.prototype.validator_address = ""; + + /** + * Encodes the specified QueryDelegationRewardsRequest message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegationRewardsRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsRequest + * @static + * @param {cosmos.distribution.v1beta1.IQueryDelegationRewardsRequest} message QueryDelegationRewardsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegationRewardsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); + if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.validator_address); + return writer; + }; + + /** + * Encodes the specified QueryDelegationRewardsRequest message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegationRewardsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsRequest + * @static + * @param {cosmos.distribution.v1beta1.IQueryDelegationRewardsRequest} message QueryDelegationRewardsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegationRewardsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryDelegationRewardsRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.QueryDelegationRewardsRequest} QueryDelegationRewardsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegationRewardsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryDelegationRewardsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_address = reader.string(); + break; + case 2: + message.validator_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryDelegationRewardsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.QueryDelegationRewardsRequest} QueryDelegationRewardsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegationRewardsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryDelegationRewardsRequest message. + * @function verify + * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryDelegationRewardsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + if (!$util.isString(message.delegator_address)) + return "delegator_address: string expected"; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + if (!$util.isString(message.validator_address)) + return "validator_address: string expected"; + return null; + }; + + /** + * Creates a QueryDelegationRewardsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.QueryDelegationRewardsRequest} QueryDelegationRewardsRequest + */ + QueryDelegationRewardsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.QueryDelegationRewardsRequest) + return object; + let message = new $root.cosmos.distribution.v1beta1.QueryDelegationRewardsRequest(); + if (object.delegator_address != null) + message.delegator_address = String(object.delegator_address); + if (object.validator_address != null) + message.validator_address = String(object.validator_address); + return message; + }; + + /** + * Creates a plain object from a QueryDelegationRewardsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsRequest + * @static + * @param {cosmos.distribution.v1beta1.QueryDelegationRewardsRequest} message QueryDelegationRewardsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryDelegationRewardsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.delegator_address = ""; + object.validator_address = ""; + } + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + object.delegator_address = message.delegator_address; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + object.validator_address = message.validator_address; + return object; + }; + + /** + * Converts this QueryDelegationRewardsRequest to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryDelegationRewardsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryDelegationRewardsRequest; + })(); + + v1beta1.QueryDelegationRewardsResponse = (function() { + + /** + * Properties of a QueryDelegationRewardsResponse. + * @memberof cosmos.distribution.v1beta1 + * @interface IQueryDelegationRewardsResponse + * @property {Array.|null} [rewards] QueryDelegationRewardsResponse rewards + */ + + /** + * Constructs a new QueryDelegationRewardsResponse. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a QueryDelegationRewardsResponse. + * @implements IQueryDelegationRewardsResponse + * @constructor + * @param {cosmos.distribution.v1beta1.IQueryDelegationRewardsResponse=} [properties] Properties to set + */ + function QueryDelegationRewardsResponse(properties) { + this.rewards = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryDelegationRewardsResponse rewards. + * @member {Array.} rewards + * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsResponse + * @instance + */ + QueryDelegationRewardsResponse.prototype.rewards = $util.emptyArray; + + /** + * Encodes the specified QueryDelegationRewardsResponse message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegationRewardsResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsResponse + * @static + * @param {cosmos.distribution.v1beta1.IQueryDelegationRewardsResponse} message QueryDelegationRewardsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegationRewardsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rewards != null && message.rewards.length) + for (let i = 0; i < message.rewards.length; ++i) + $root.cosmos.base.v1beta1.DecCoin.encode(message.rewards[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryDelegationRewardsResponse message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegationRewardsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsResponse + * @static + * @param {cosmos.distribution.v1beta1.IQueryDelegationRewardsResponse} message QueryDelegationRewardsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegationRewardsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryDelegationRewardsResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.QueryDelegationRewardsResponse} QueryDelegationRewardsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegationRewardsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryDelegationRewardsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.rewards && message.rewards.length)) + message.rewards = []; + message.rewards.push($root.cosmos.base.v1beta1.DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryDelegationRewardsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.QueryDelegationRewardsResponse} QueryDelegationRewardsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegationRewardsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryDelegationRewardsResponse message. + * @function verify + * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryDelegationRewardsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rewards != null && message.hasOwnProperty("rewards")) { + if (!Array.isArray(message.rewards)) + return "rewards: array expected"; + for (let i = 0; i < message.rewards.length; ++i) { + let error = $root.cosmos.base.v1beta1.DecCoin.verify(message.rewards[i]); + if (error) + return "rewards." + error; + } + } + return null; + }; + + /** + * Creates a QueryDelegationRewardsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.QueryDelegationRewardsResponse} QueryDelegationRewardsResponse + */ + QueryDelegationRewardsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.QueryDelegationRewardsResponse) + return object; + let message = new $root.cosmos.distribution.v1beta1.QueryDelegationRewardsResponse(); + if (object.rewards) { + if (!Array.isArray(object.rewards)) + throw TypeError(".cosmos.distribution.v1beta1.QueryDelegationRewardsResponse.rewards: array expected"); + message.rewards = []; + for (let i = 0; i < object.rewards.length; ++i) { + if (typeof object.rewards[i] !== "object") + throw TypeError(".cosmos.distribution.v1beta1.QueryDelegationRewardsResponse.rewards: object expected"); + message.rewards[i] = $root.cosmos.base.v1beta1.DecCoin.fromObject(object.rewards[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a QueryDelegationRewardsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsResponse + * @static + * @param {cosmos.distribution.v1beta1.QueryDelegationRewardsResponse} message QueryDelegationRewardsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryDelegationRewardsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.rewards = []; + if (message.rewards && message.rewards.length) { + object.rewards = []; + for (let j = 0; j < message.rewards.length; ++j) + object.rewards[j] = $root.cosmos.base.v1beta1.DecCoin.toObject(message.rewards[j], options); + } + return object; + }; + + /** + * Converts this QueryDelegationRewardsResponse to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryDelegationRewardsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryDelegationRewardsResponse; + })(); + + v1beta1.QueryDelegationTotalRewardsRequest = (function() { + + /** + * Properties of a QueryDelegationTotalRewardsRequest. + * @memberof cosmos.distribution.v1beta1 + * @interface IQueryDelegationTotalRewardsRequest + * @property {string|null} [delegator_address] QueryDelegationTotalRewardsRequest delegator_address + */ + + /** + * Constructs a new QueryDelegationTotalRewardsRequest. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a QueryDelegationTotalRewardsRequest. + * @implements IQueryDelegationTotalRewardsRequest + * @constructor + * @param {cosmos.distribution.v1beta1.IQueryDelegationTotalRewardsRequest=} [properties] Properties to set + */ + function QueryDelegationTotalRewardsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryDelegationTotalRewardsRequest delegator_address. + * @member {string} delegator_address + * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest + * @instance + */ + QueryDelegationTotalRewardsRequest.prototype.delegator_address = ""; + + /** + * Encodes the specified QueryDelegationTotalRewardsRequest message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest + * @static + * @param {cosmos.distribution.v1beta1.IQueryDelegationTotalRewardsRequest} message QueryDelegationTotalRewardsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegationTotalRewardsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); + return writer; + }; + + /** + * Encodes the specified QueryDelegationTotalRewardsRequest message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest + * @static + * @param {cosmos.distribution.v1beta1.IQueryDelegationTotalRewardsRequest} message QueryDelegationTotalRewardsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegationTotalRewardsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryDelegationTotalRewardsRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest} QueryDelegationTotalRewardsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegationTotalRewardsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryDelegationTotalRewardsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest} QueryDelegationTotalRewardsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegationTotalRewardsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryDelegationTotalRewardsRequest message. + * @function verify + * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryDelegationTotalRewardsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + if (!$util.isString(message.delegator_address)) + return "delegator_address: string expected"; + return null; + }; + + /** + * Creates a QueryDelegationTotalRewardsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest} QueryDelegationTotalRewardsRequest + */ + QueryDelegationTotalRewardsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest) + return object; + let message = new $root.cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest(); + if (object.delegator_address != null) + message.delegator_address = String(object.delegator_address); + return message; + }; + + /** + * Creates a plain object from a QueryDelegationTotalRewardsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest + * @static + * @param {cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest} message QueryDelegationTotalRewardsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryDelegationTotalRewardsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.delegator_address = ""; + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + object.delegator_address = message.delegator_address; + return object; + }; + + /** + * Converts this QueryDelegationTotalRewardsRequest to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryDelegationTotalRewardsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryDelegationTotalRewardsRequest; + })(); + + v1beta1.QueryDelegationTotalRewardsResponse = (function() { + + /** + * Properties of a QueryDelegationTotalRewardsResponse. + * @memberof cosmos.distribution.v1beta1 + * @interface IQueryDelegationTotalRewardsResponse + * @property {Array.|null} [rewards] QueryDelegationTotalRewardsResponse rewards + * @property {Array.|null} [total] QueryDelegationTotalRewardsResponse total + */ + + /** + * Constructs a new QueryDelegationTotalRewardsResponse. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a QueryDelegationTotalRewardsResponse. + * @implements IQueryDelegationTotalRewardsResponse + * @constructor + * @param {cosmos.distribution.v1beta1.IQueryDelegationTotalRewardsResponse=} [properties] Properties to set + */ + function QueryDelegationTotalRewardsResponse(properties) { + this.rewards = []; + this.total = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryDelegationTotalRewardsResponse rewards. + * @member {Array.} rewards + * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse + * @instance + */ + QueryDelegationTotalRewardsResponse.prototype.rewards = $util.emptyArray; + + /** + * QueryDelegationTotalRewardsResponse total. + * @member {Array.} total + * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse + * @instance + */ + QueryDelegationTotalRewardsResponse.prototype.total = $util.emptyArray; + + /** + * Encodes the specified QueryDelegationTotalRewardsResponse message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse + * @static + * @param {cosmos.distribution.v1beta1.IQueryDelegationTotalRewardsResponse} message QueryDelegationTotalRewardsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegationTotalRewardsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rewards != null && message.rewards.length) + for (let i = 0; i < message.rewards.length; ++i) + $root.cosmos.distribution.v1beta1.DelegationDelegatorReward.encode(message.rewards[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.total != null && message.total.length) + for (let i = 0; i < message.total.length; ++i) + $root.cosmos.base.v1beta1.DecCoin.encode(message.total[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryDelegationTotalRewardsResponse message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse + * @static + * @param {cosmos.distribution.v1beta1.IQueryDelegationTotalRewardsResponse} message QueryDelegationTotalRewardsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegationTotalRewardsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryDelegationTotalRewardsResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse} QueryDelegationTotalRewardsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegationTotalRewardsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.rewards && message.rewards.length)) + message.rewards = []; + message.rewards.push($root.cosmos.distribution.v1beta1.DelegationDelegatorReward.decode(reader, reader.uint32())); + break; + case 2: + if (!(message.total && message.total.length)) + message.total = []; + message.total.push($root.cosmos.base.v1beta1.DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryDelegationTotalRewardsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse} QueryDelegationTotalRewardsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegationTotalRewardsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryDelegationTotalRewardsResponse message. + * @function verify + * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryDelegationTotalRewardsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rewards != null && message.hasOwnProperty("rewards")) { + if (!Array.isArray(message.rewards)) + return "rewards: array expected"; + for (let i = 0; i < message.rewards.length; ++i) { + let error = $root.cosmos.distribution.v1beta1.DelegationDelegatorReward.verify(message.rewards[i]); + if (error) + return "rewards." + error; + } + } + if (message.total != null && message.hasOwnProperty("total")) { + if (!Array.isArray(message.total)) + return "total: array expected"; + for (let i = 0; i < message.total.length; ++i) { + let error = $root.cosmos.base.v1beta1.DecCoin.verify(message.total[i]); + if (error) + return "total." + error; + } + } + return null; + }; + + /** + * Creates a QueryDelegationTotalRewardsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse} QueryDelegationTotalRewardsResponse + */ + QueryDelegationTotalRewardsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse) + return object; + let message = new $root.cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse(); + if (object.rewards) { + if (!Array.isArray(object.rewards)) + throw TypeError(".cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse.rewards: array expected"); + message.rewards = []; + for (let i = 0; i < object.rewards.length; ++i) { + if (typeof object.rewards[i] !== "object") + throw TypeError(".cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse.rewards: object expected"); + message.rewards[i] = $root.cosmos.distribution.v1beta1.DelegationDelegatorReward.fromObject(object.rewards[i]); + } + } + if (object.total) { + if (!Array.isArray(object.total)) + throw TypeError(".cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse.total: array expected"); + message.total = []; + for (let i = 0; i < object.total.length; ++i) { + if (typeof object.total[i] !== "object") + throw TypeError(".cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse.total: object expected"); + message.total[i] = $root.cosmos.base.v1beta1.DecCoin.fromObject(object.total[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a QueryDelegationTotalRewardsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse + * @static + * @param {cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse} message QueryDelegationTotalRewardsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryDelegationTotalRewardsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) { + object.rewards = []; + object.total = []; + } + if (message.rewards && message.rewards.length) { + object.rewards = []; + for (let j = 0; j < message.rewards.length; ++j) + object.rewards[j] = $root.cosmos.distribution.v1beta1.DelegationDelegatorReward.toObject(message.rewards[j], options); + } + if (message.total && message.total.length) { + object.total = []; + for (let j = 0; j < message.total.length; ++j) + object.total[j] = $root.cosmos.base.v1beta1.DecCoin.toObject(message.total[j], options); + } + return object; + }; + + /** + * Converts this QueryDelegationTotalRewardsResponse to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryDelegationTotalRewardsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryDelegationTotalRewardsResponse; + })(); + + v1beta1.QueryDelegatorValidatorsRequest = (function() { + + /** + * Properties of a QueryDelegatorValidatorsRequest. + * @memberof cosmos.distribution.v1beta1 + * @interface IQueryDelegatorValidatorsRequest + * @property {string|null} [delegator_address] QueryDelegatorValidatorsRequest delegator_address + */ + + /** + * Constructs a new QueryDelegatorValidatorsRequest. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a QueryDelegatorValidatorsRequest. + * @implements IQueryDelegatorValidatorsRequest + * @constructor + * @param {cosmos.distribution.v1beta1.IQueryDelegatorValidatorsRequest=} [properties] Properties to set + */ + function QueryDelegatorValidatorsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryDelegatorValidatorsRequest delegator_address. + * @member {string} delegator_address + * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest + * @instance + */ + QueryDelegatorValidatorsRequest.prototype.delegator_address = ""; + + /** + * Encodes the specified QueryDelegatorValidatorsRequest message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest + * @static + * @param {cosmos.distribution.v1beta1.IQueryDelegatorValidatorsRequest} message QueryDelegatorValidatorsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegatorValidatorsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); + return writer; + }; + + /** + * Encodes the specified QueryDelegatorValidatorsRequest message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest + * @static + * @param {cosmos.distribution.v1beta1.IQueryDelegatorValidatorsRequest} message QueryDelegatorValidatorsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegatorValidatorsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryDelegatorValidatorsRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest} QueryDelegatorValidatorsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegatorValidatorsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryDelegatorValidatorsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest} QueryDelegatorValidatorsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegatorValidatorsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryDelegatorValidatorsRequest message. + * @function verify + * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryDelegatorValidatorsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + if (!$util.isString(message.delegator_address)) + return "delegator_address: string expected"; + return null; + }; + + /** + * Creates a QueryDelegatorValidatorsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest} QueryDelegatorValidatorsRequest + */ + QueryDelegatorValidatorsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest) + return object; + let message = new $root.cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest(); + if (object.delegator_address != null) + message.delegator_address = String(object.delegator_address); + return message; + }; + + /** + * Creates a plain object from a QueryDelegatorValidatorsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest + * @static + * @param {cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest} message QueryDelegatorValidatorsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryDelegatorValidatorsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.delegator_address = ""; + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + object.delegator_address = message.delegator_address; + return object; + }; + + /** + * Converts this QueryDelegatorValidatorsRequest to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryDelegatorValidatorsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryDelegatorValidatorsRequest; + })(); + + v1beta1.QueryDelegatorValidatorsResponse = (function() { + + /** + * Properties of a QueryDelegatorValidatorsResponse. + * @memberof cosmos.distribution.v1beta1 + * @interface IQueryDelegatorValidatorsResponse + * @property {Array.|null} [validators] QueryDelegatorValidatorsResponse validators + */ + + /** + * Constructs a new QueryDelegatorValidatorsResponse. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a QueryDelegatorValidatorsResponse. + * @implements IQueryDelegatorValidatorsResponse + * @constructor + * @param {cosmos.distribution.v1beta1.IQueryDelegatorValidatorsResponse=} [properties] Properties to set + */ + function QueryDelegatorValidatorsResponse(properties) { + this.validators = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryDelegatorValidatorsResponse validators. + * @member {Array.} validators + * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse + * @instance + */ + QueryDelegatorValidatorsResponse.prototype.validators = $util.emptyArray; + + /** + * Encodes the specified QueryDelegatorValidatorsResponse message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse + * @static + * @param {cosmos.distribution.v1beta1.IQueryDelegatorValidatorsResponse} message QueryDelegatorValidatorsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegatorValidatorsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.validators != null && message.validators.length) + for (let i = 0; i < message.validators.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.validators[i]); + return writer; + }; + + /** + * Encodes the specified QueryDelegatorValidatorsResponse message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse + * @static + * @param {cosmos.distribution.v1beta1.IQueryDelegatorValidatorsResponse} message QueryDelegatorValidatorsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegatorValidatorsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryDelegatorValidatorsResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse} QueryDelegatorValidatorsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegatorValidatorsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.validators && message.validators.length)) + message.validators = []; + message.validators.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryDelegatorValidatorsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse} QueryDelegatorValidatorsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegatorValidatorsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryDelegatorValidatorsResponse message. + * @function verify + * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryDelegatorValidatorsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.validators != null && message.hasOwnProperty("validators")) { + if (!Array.isArray(message.validators)) + return "validators: array expected"; + for (let i = 0; i < message.validators.length; ++i) + if (!$util.isString(message.validators[i])) + return "validators: string[] expected"; + } + return null; + }; + + /** + * Creates a QueryDelegatorValidatorsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse} QueryDelegatorValidatorsResponse + */ + QueryDelegatorValidatorsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse) + return object; + let message = new $root.cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse(); + if (object.validators) { + if (!Array.isArray(object.validators)) + throw TypeError(".cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse.validators: array expected"); + message.validators = []; + for (let i = 0; i < object.validators.length; ++i) + message.validators[i] = String(object.validators[i]); + } + return message; + }; + + /** + * Creates a plain object from a QueryDelegatorValidatorsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse + * @static + * @param {cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse} message QueryDelegatorValidatorsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryDelegatorValidatorsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.validators = []; + if (message.validators && message.validators.length) { + object.validators = []; + for (let j = 0; j < message.validators.length; ++j) + object.validators[j] = message.validators[j]; + } + return object; + }; + + /** + * Converts this QueryDelegatorValidatorsResponse to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryDelegatorValidatorsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryDelegatorValidatorsResponse; + })(); + + v1beta1.QueryDelegatorWithdrawAddressRequest = (function() { + + /** + * Properties of a QueryDelegatorWithdrawAddressRequest. + * @memberof cosmos.distribution.v1beta1 + * @interface IQueryDelegatorWithdrawAddressRequest + * @property {string|null} [delegator_address] QueryDelegatorWithdrawAddressRequest delegator_address + */ + + /** + * Constructs a new QueryDelegatorWithdrawAddressRequest. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a QueryDelegatorWithdrawAddressRequest. + * @implements IQueryDelegatorWithdrawAddressRequest + * @constructor + * @param {cosmos.distribution.v1beta1.IQueryDelegatorWithdrawAddressRequest=} [properties] Properties to set + */ + function QueryDelegatorWithdrawAddressRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryDelegatorWithdrawAddressRequest delegator_address. + * @member {string} delegator_address + * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest + * @instance + */ + QueryDelegatorWithdrawAddressRequest.prototype.delegator_address = ""; + + /** + * Encodes the specified QueryDelegatorWithdrawAddressRequest message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest + * @static + * @param {cosmos.distribution.v1beta1.IQueryDelegatorWithdrawAddressRequest} message QueryDelegatorWithdrawAddressRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegatorWithdrawAddressRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); + return writer; + }; + + /** + * Encodes the specified QueryDelegatorWithdrawAddressRequest message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest + * @static + * @param {cosmos.distribution.v1beta1.IQueryDelegatorWithdrawAddressRequest} message QueryDelegatorWithdrawAddressRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegatorWithdrawAddressRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryDelegatorWithdrawAddressRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest} QueryDelegatorWithdrawAddressRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegatorWithdrawAddressRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryDelegatorWithdrawAddressRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest} QueryDelegatorWithdrawAddressRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegatorWithdrawAddressRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryDelegatorWithdrawAddressRequest message. + * @function verify + * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryDelegatorWithdrawAddressRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + if (!$util.isString(message.delegator_address)) + return "delegator_address: string expected"; + return null; + }; + + /** + * Creates a QueryDelegatorWithdrawAddressRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest} QueryDelegatorWithdrawAddressRequest + */ + QueryDelegatorWithdrawAddressRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest) + return object; + let message = new $root.cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest(); + if (object.delegator_address != null) + message.delegator_address = String(object.delegator_address); + return message; + }; + + /** + * Creates a plain object from a QueryDelegatorWithdrawAddressRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest + * @static + * @param {cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest} message QueryDelegatorWithdrawAddressRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryDelegatorWithdrawAddressRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.delegator_address = ""; + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + object.delegator_address = message.delegator_address; + return object; + }; + + /** + * Converts this QueryDelegatorWithdrawAddressRequest to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest + * @instance + * @returns {Object.} JSON object + */ + QueryDelegatorWithdrawAddressRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryDelegatorWithdrawAddressRequest; + })(); + + v1beta1.QueryDelegatorWithdrawAddressResponse = (function() { + + /** + * Properties of a QueryDelegatorWithdrawAddressResponse. + * @memberof cosmos.distribution.v1beta1 + * @interface IQueryDelegatorWithdrawAddressResponse + * @property {string|null} [withdraw_address] QueryDelegatorWithdrawAddressResponse withdraw_address + */ + + /** + * Constructs a new QueryDelegatorWithdrawAddressResponse. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a QueryDelegatorWithdrawAddressResponse. + * @implements IQueryDelegatorWithdrawAddressResponse + * @constructor + * @param {cosmos.distribution.v1beta1.IQueryDelegatorWithdrawAddressResponse=} [properties] Properties to set + */ + function QueryDelegatorWithdrawAddressResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryDelegatorWithdrawAddressResponse withdraw_address. + * @member {string} withdraw_address + * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse + * @instance + */ + QueryDelegatorWithdrawAddressResponse.prototype.withdraw_address = ""; + + /** + * Encodes the specified QueryDelegatorWithdrawAddressResponse message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse + * @static + * @param {cosmos.distribution.v1beta1.IQueryDelegatorWithdrawAddressResponse} message QueryDelegatorWithdrawAddressResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegatorWithdrawAddressResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.withdraw_address != null && Object.hasOwnProperty.call(message, "withdraw_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.withdraw_address); + return writer; + }; + + /** + * Encodes the specified QueryDelegatorWithdrawAddressResponse message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse + * @static + * @param {cosmos.distribution.v1beta1.IQueryDelegatorWithdrawAddressResponse} message QueryDelegatorWithdrawAddressResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegatorWithdrawAddressResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryDelegatorWithdrawAddressResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse} QueryDelegatorWithdrawAddressResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegatorWithdrawAddressResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.withdraw_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryDelegatorWithdrawAddressResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse} QueryDelegatorWithdrawAddressResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegatorWithdrawAddressResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryDelegatorWithdrawAddressResponse message. + * @function verify + * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryDelegatorWithdrawAddressResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.withdraw_address != null && message.hasOwnProperty("withdraw_address")) + if (!$util.isString(message.withdraw_address)) + return "withdraw_address: string expected"; + return null; + }; + + /** + * Creates a QueryDelegatorWithdrawAddressResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse} QueryDelegatorWithdrawAddressResponse + */ + QueryDelegatorWithdrawAddressResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse) + return object; + let message = new $root.cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse(); + if (object.withdraw_address != null) + message.withdraw_address = String(object.withdraw_address); + return message; + }; + + /** + * Creates a plain object from a QueryDelegatorWithdrawAddressResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse + * @static + * @param {cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse} message QueryDelegatorWithdrawAddressResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryDelegatorWithdrawAddressResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.withdraw_address = ""; + if (message.withdraw_address != null && message.hasOwnProperty("withdraw_address")) + object.withdraw_address = message.withdraw_address; + return object; + }; + + /** + * Converts this QueryDelegatorWithdrawAddressResponse to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse + * @instance + * @returns {Object.} JSON object + */ + QueryDelegatorWithdrawAddressResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryDelegatorWithdrawAddressResponse; + })(); + + v1beta1.QueryCommunityPoolRequest = (function() { + + /** + * Properties of a QueryCommunityPoolRequest. + * @memberof cosmos.distribution.v1beta1 + * @interface IQueryCommunityPoolRequest + */ + + /** + * Constructs a new QueryCommunityPoolRequest. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a QueryCommunityPoolRequest. + * @implements IQueryCommunityPoolRequest + * @constructor + * @param {cosmos.distribution.v1beta1.IQueryCommunityPoolRequest=} [properties] Properties to set + */ + function QueryCommunityPoolRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified QueryCommunityPoolRequest message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryCommunityPoolRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolRequest + * @static + * @param {cosmos.distribution.v1beta1.IQueryCommunityPoolRequest} message QueryCommunityPoolRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryCommunityPoolRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified QueryCommunityPoolRequest message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryCommunityPoolRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolRequest + * @static + * @param {cosmos.distribution.v1beta1.IQueryCommunityPoolRequest} message QueryCommunityPoolRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryCommunityPoolRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryCommunityPoolRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.QueryCommunityPoolRequest} QueryCommunityPoolRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryCommunityPoolRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryCommunityPoolRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryCommunityPoolRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.QueryCommunityPoolRequest} QueryCommunityPoolRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryCommunityPoolRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryCommunityPoolRequest message. + * @function verify + * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryCommunityPoolRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a QueryCommunityPoolRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.QueryCommunityPoolRequest} QueryCommunityPoolRequest + */ + QueryCommunityPoolRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.QueryCommunityPoolRequest) + return object; + return new $root.cosmos.distribution.v1beta1.QueryCommunityPoolRequest(); + }; + + /** + * Creates a plain object from a QueryCommunityPoolRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolRequest + * @static + * @param {cosmos.distribution.v1beta1.QueryCommunityPoolRequest} message QueryCommunityPoolRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryCommunityPoolRequest.toObject = function toObject() { + return {}; + }; + + /** + * Converts this QueryCommunityPoolRequest to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolRequest + * @instance + * @returns {Object.} JSON object + */ + QueryCommunityPoolRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryCommunityPoolRequest; + })(); + + v1beta1.QueryCommunityPoolResponse = (function() { + + /** + * Properties of a QueryCommunityPoolResponse. + * @memberof cosmos.distribution.v1beta1 + * @interface IQueryCommunityPoolResponse + * @property {Array.|null} [pool] QueryCommunityPoolResponse pool + */ + + /** + * Constructs a new QueryCommunityPoolResponse. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a QueryCommunityPoolResponse. + * @implements IQueryCommunityPoolResponse + * @constructor + * @param {cosmos.distribution.v1beta1.IQueryCommunityPoolResponse=} [properties] Properties to set + */ + function QueryCommunityPoolResponse(properties) { + this.pool = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryCommunityPoolResponse pool. + * @member {Array.} pool + * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolResponse + * @instance + */ + QueryCommunityPoolResponse.prototype.pool = $util.emptyArray; + + /** + * Encodes the specified QueryCommunityPoolResponse message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryCommunityPoolResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolResponse + * @static + * @param {cosmos.distribution.v1beta1.IQueryCommunityPoolResponse} message QueryCommunityPoolResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryCommunityPoolResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pool != null && message.pool.length) + for (let i = 0; i < message.pool.length; ++i) + $root.cosmos.base.v1beta1.DecCoin.encode(message.pool[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryCommunityPoolResponse message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryCommunityPoolResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolResponse + * @static + * @param {cosmos.distribution.v1beta1.IQueryCommunityPoolResponse} message QueryCommunityPoolResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryCommunityPoolResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryCommunityPoolResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.QueryCommunityPoolResponse} QueryCommunityPoolResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryCommunityPoolResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryCommunityPoolResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.pool && message.pool.length)) + message.pool = []; + message.pool.push($root.cosmos.base.v1beta1.DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryCommunityPoolResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.QueryCommunityPoolResponse} QueryCommunityPoolResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryCommunityPoolResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryCommunityPoolResponse message. + * @function verify + * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryCommunityPoolResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pool != null && message.hasOwnProperty("pool")) { + if (!Array.isArray(message.pool)) + return "pool: array expected"; + for (let i = 0; i < message.pool.length; ++i) { + let error = $root.cosmos.base.v1beta1.DecCoin.verify(message.pool[i]); + if (error) + return "pool." + error; + } + } + return null; + }; + + /** + * Creates a QueryCommunityPoolResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.QueryCommunityPoolResponse} QueryCommunityPoolResponse + */ + QueryCommunityPoolResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.QueryCommunityPoolResponse) + return object; + let message = new $root.cosmos.distribution.v1beta1.QueryCommunityPoolResponse(); + if (object.pool) { + if (!Array.isArray(object.pool)) + throw TypeError(".cosmos.distribution.v1beta1.QueryCommunityPoolResponse.pool: array expected"); + message.pool = []; + for (let i = 0; i < object.pool.length; ++i) { + if (typeof object.pool[i] !== "object") + throw TypeError(".cosmos.distribution.v1beta1.QueryCommunityPoolResponse.pool: object expected"); + message.pool[i] = $root.cosmos.base.v1beta1.DecCoin.fromObject(object.pool[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a QueryCommunityPoolResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolResponse + * @static + * @param {cosmos.distribution.v1beta1.QueryCommunityPoolResponse} message QueryCommunityPoolResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryCommunityPoolResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.pool = []; + if (message.pool && message.pool.length) { + object.pool = []; + for (let j = 0; j < message.pool.length; ++j) + object.pool[j] = $root.cosmos.base.v1beta1.DecCoin.toObject(message.pool[j], options); + } + return object; + }; + + /** + * Converts this QueryCommunityPoolResponse to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolResponse + * @instance + * @returns {Object.} JSON object + */ + QueryCommunityPoolResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryCommunityPoolResponse; + })(); + + v1beta1.DelegatorWithdrawInfo = (function() { + + /** + * Properties of a DelegatorWithdrawInfo. + * @memberof cosmos.distribution.v1beta1 + * @interface IDelegatorWithdrawInfo + * @property {string|null} [delegator_address] DelegatorWithdrawInfo delegator_address + * @property {string|null} [withdraw_address] DelegatorWithdrawInfo withdraw_address + */ + + /** + * Constructs a new DelegatorWithdrawInfo. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a DelegatorWithdrawInfo. + * @implements IDelegatorWithdrawInfo + * @constructor + * @param {cosmos.distribution.v1beta1.IDelegatorWithdrawInfo=} [properties] Properties to set + */ + function DelegatorWithdrawInfo(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DelegatorWithdrawInfo delegator_address. + * @member {string} delegator_address + * @memberof cosmos.distribution.v1beta1.DelegatorWithdrawInfo + * @instance + */ + DelegatorWithdrawInfo.prototype.delegator_address = ""; + + /** + * DelegatorWithdrawInfo withdraw_address. + * @member {string} withdraw_address + * @memberof cosmos.distribution.v1beta1.DelegatorWithdrawInfo + * @instance + */ + DelegatorWithdrawInfo.prototype.withdraw_address = ""; + + /** + * Encodes the specified DelegatorWithdrawInfo message. Does not implicitly {@link cosmos.distribution.v1beta1.DelegatorWithdrawInfo.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.DelegatorWithdrawInfo + * @static + * @param {cosmos.distribution.v1beta1.IDelegatorWithdrawInfo} message DelegatorWithdrawInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DelegatorWithdrawInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); + if (message.withdraw_address != null && Object.hasOwnProperty.call(message, "withdraw_address")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.withdraw_address); + return writer; + }; + + /** + * Encodes the specified DelegatorWithdrawInfo message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.DelegatorWithdrawInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.DelegatorWithdrawInfo + * @static + * @param {cosmos.distribution.v1beta1.IDelegatorWithdrawInfo} message DelegatorWithdrawInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DelegatorWithdrawInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DelegatorWithdrawInfo message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.DelegatorWithdrawInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.DelegatorWithdrawInfo} DelegatorWithdrawInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DelegatorWithdrawInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.DelegatorWithdrawInfo(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_address = reader.string(); + break; + case 2: + message.withdraw_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DelegatorWithdrawInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.DelegatorWithdrawInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.DelegatorWithdrawInfo} DelegatorWithdrawInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DelegatorWithdrawInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DelegatorWithdrawInfo message. + * @function verify + * @memberof cosmos.distribution.v1beta1.DelegatorWithdrawInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DelegatorWithdrawInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + if (!$util.isString(message.delegator_address)) + return "delegator_address: string expected"; + if (message.withdraw_address != null && message.hasOwnProperty("withdraw_address")) + if (!$util.isString(message.withdraw_address)) + return "withdraw_address: string expected"; + return null; + }; + + /** + * Creates a DelegatorWithdrawInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.DelegatorWithdrawInfo + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.DelegatorWithdrawInfo} DelegatorWithdrawInfo + */ + DelegatorWithdrawInfo.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.DelegatorWithdrawInfo) + return object; + let message = new $root.cosmos.distribution.v1beta1.DelegatorWithdrawInfo(); + if (object.delegator_address != null) + message.delegator_address = String(object.delegator_address); + if (object.withdraw_address != null) + message.withdraw_address = String(object.withdraw_address); + return message; + }; + + /** + * Creates a plain object from a DelegatorWithdrawInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.DelegatorWithdrawInfo + * @static + * @param {cosmos.distribution.v1beta1.DelegatorWithdrawInfo} message DelegatorWithdrawInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DelegatorWithdrawInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.delegator_address = ""; + object.withdraw_address = ""; + } + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + object.delegator_address = message.delegator_address; + if (message.withdraw_address != null && message.hasOwnProperty("withdraw_address")) + object.withdraw_address = message.withdraw_address; + return object; + }; + + /** + * Converts this DelegatorWithdrawInfo to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.DelegatorWithdrawInfo + * @instance + * @returns {Object.} JSON object + */ + DelegatorWithdrawInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DelegatorWithdrawInfo; + })(); + + v1beta1.ValidatorOutstandingRewardsRecord = (function() { + + /** + * Properties of a ValidatorOutstandingRewardsRecord. + * @memberof cosmos.distribution.v1beta1 + * @interface IValidatorOutstandingRewardsRecord + * @property {string|null} [validator_address] ValidatorOutstandingRewardsRecord validator_address + * @property {Array.|null} [outstanding_rewards] ValidatorOutstandingRewardsRecord outstanding_rewards + */ + + /** + * Constructs a new ValidatorOutstandingRewardsRecord. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a ValidatorOutstandingRewardsRecord. + * @implements IValidatorOutstandingRewardsRecord + * @constructor + * @param {cosmos.distribution.v1beta1.IValidatorOutstandingRewardsRecord=} [properties] Properties to set + */ + function ValidatorOutstandingRewardsRecord(properties) { + this.outstanding_rewards = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ValidatorOutstandingRewardsRecord validator_address. + * @member {string} validator_address + * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord + * @instance + */ + ValidatorOutstandingRewardsRecord.prototype.validator_address = ""; + + /** + * ValidatorOutstandingRewardsRecord outstanding_rewards. + * @member {Array.} outstanding_rewards + * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord + * @instance + */ + ValidatorOutstandingRewardsRecord.prototype.outstanding_rewards = $util.emptyArray; + + /** + * Encodes the specified ValidatorOutstandingRewardsRecord message. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord + * @static + * @param {cosmos.distribution.v1beta1.IValidatorOutstandingRewardsRecord} message ValidatorOutstandingRewardsRecord message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorOutstandingRewardsRecord.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.validator_address); + if (message.outstanding_rewards != null && message.outstanding_rewards.length) + for (let i = 0; i < message.outstanding_rewards.length; ++i) + $root.cosmos.base.v1beta1.DecCoin.encode(message.outstanding_rewards[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ValidatorOutstandingRewardsRecord message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord + * @static + * @param {cosmos.distribution.v1beta1.IValidatorOutstandingRewardsRecord} message ValidatorOutstandingRewardsRecord message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorOutstandingRewardsRecord.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ValidatorOutstandingRewardsRecord message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord} ValidatorOutstandingRewardsRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorOutstandingRewardsRecord.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_address = reader.string(); + break; + case 2: + if (!(message.outstanding_rewards && message.outstanding_rewards.length)) + message.outstanding_rewards = []; + message.outstanding_rewards.push($root.cosmos.base.v1beta1.DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ValidatorOutstandingRewardsRecord message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord} ValidatorOutstandingRewardsRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorOutstandingRewardsRecord.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ValidatorOutstandingRewardsRecord message. + * @function verify + * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ValidatorOutstandingRewardsRecord.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + if (!$util.isString(message.validator_address)) + return "validator_address: string expected"; + if (message.outstanding_rewards != null && message.hasOwnProperty("outstanding_rewards")) { + if (!Array.isArray(message.outstanding_rewards)) + return "outstanding_rewards: array expected"; + for (let i = 0; i < message.outstanding_rewards.length; ++i) { + let error = $root.cosmos.base.v1beta1.DecCoin.verify(message.outstanding_rewards[i]); + if (error) + return "outstanding_rewards." + error; + } + } + return null; + }; + + /** + * Creates a ValidatorOutstandingRewardsRecord message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord} ValidatorOutstandingRewardsRecord + */ + ValidatorOutstandingRewardsRecord.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord) + return object; + let message = new $root.cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord(); + if (object.validator_address != null) + message.validator_address = String(object.validator_address); + if (object.outstanding_rewards) { + if (!Array.isArray(object.outstanding_rewards)) + throw TypeError(".cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord.outstanding_rewards: array expected"); + message.outstanding_rewards = []; + for (let i = 0; i < object.outstanding_rewards.length; ++i) { + if (typeof object.outstanding_rewards[i] !== "object") + throw TypeError(".cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord.outstanding_rewards: object expected"); + message.outstanding_rewards[i] = $root.cosmos.base.v1beta1.DecCoin.fromObject(object.outstanding_rewards[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ValidatorOutstandingRewardsRecord message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord + * @static + * @param {cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord} message ValidatorOutstandingRewardsRecord + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ValidatorOutstandingRewardsRecord.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.outstanding_rewards = []; + if (options.defaults) + object.validator_address = ""; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + object.validator_address = message.validator_address; + if (message.outstanding_rewards && message.outstanding_rewards.length) { + object.outstanding_rewards = []; + for (let j = 0; j < message.outstanding_rewards.length; ++j) + object.outstanding_rewards[j] = $root.cosmos.base.v1beta1.DecCoin.toObject(message.outstanding_rewards[j], options); + } + return object; + }; + + /** + * Converts this ValidatorOutstandingRewardsRecord to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord + * @instance + * @returns {Object.} JSON object + */ + ValidatorOutstandingRewardsRecord.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ValidatorOutstandingRewardsRecord; + })(); + + v1beta1.ValidatorAccumulatedCommissionRecord = (function() { + + /** + * Properties of a ValidatorAccumulatedCommissionRecord. + * @memberof cosmos.distribution.v1beta1 + * @interface IValidatorAccumulatedCommissionRecord + * @property {string|null} [validator_address] ValidatorAccumulatedCommissionRecord validator_address + * @property {cosmos.distribution.v1beta1.IValidatorAccumulatedCommission|null} [accumulated] ValidatorAccumulatedCommissionRecord accumulated + */ + + /** + * Constructs a new ValidatorAccumulatedCommissionRecord. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a ValidatorAccumulatedCommissionRecord. + * @implements IValidatorAccumulatedCommissionRecord + * @constructor + * @param {cosmos.distribution.v1beta1.IValidatorAccumulatedCommissionRecord=} [properties] Properties to set + */ + function ValidatorAccumulatedCommissionRecord(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ValidatorAccumulatedCommissionRecord validator_address. + * @member {string} validator_address + * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord + * @instance + */ + ValidatorAccumulatedCommissionRecord.prototype.validator_address = ""; + + /** + * ValidatorAccumulatedCommissionRecord accumulated. + * @member {cosmos.distribution.v1beta1.IValidatorAccumulatedCommission|null|undefined} accumulated + * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord + * @instance + */ + ValidatorAccumulatedCommissionRecord.prototype.accumulated = null; + + /** + * Encodes the specified ValidatorAccumulatedCommissionRecord message. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord + * @static + * @param {cosmos.distribution.v1beta1.IValidatorAccumulatedCommissionRecord} message ValidatorAccumulatedCommissionRecord message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorAccumulatedCommissionRecord.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.validator_address); + if (message.accumulated != null && Object.hasOwnProperty.call(message, "accumulated")) + $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommission.encode(message.accumulated, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ValidatorAccumulatedCommissionRecord message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord + * @static + * @param {cosmos.distribution.v1beta1.IValidatorAccumulatedCommissionRecord} message ValidatorAccumulatedCommissionRecord message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorAccumulatedCommissionRecord.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ValidatorAccumulatedCommissionRecord message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord} ValidatorAccumulatedCommissionRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorAccumulatedCommissionRecord.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_address = reader.string(); + break; + case 2: + message.accumulated = $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ValidatorAccumulatedCommissionRecord message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord} ValidatorAccumulatedCommissionRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorAccumulatedCommissionRecord.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ValidatorAccumulatedCommissionRecord message. + * @function verify + * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ValidatorAccumulatedCommissionRecord.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + if (!$util.isString(message.validator_address)) + return "validator_address: string expected"; + if (message.accumulated != null && message.hasOwnProperty("accumulated")) { + let error = $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommission.verify(message.accumulated); + if (error) + return "accumulated." + error; + } + return null; + }; + + /** + * Creates a ValidatorAccumulatedCommissionRecord message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord} ValidatorAccumulatedCommissionRecord + */ + ValidatorAccumulatedCommissionRecord.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord) + return object; + let message = new $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord(); + if (object.validator_address != null) + message.validator_address = String(object.validator_address); + if (object.accumulated != null) { + if (typeof object.accumulated !== "object") + throw TypeError(".cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord.accumulated: object expected"); + message.accumulated = $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommission.fromObject(object.accumulated); + } + return message; + }; + + /** + * Creates a plain object from a ValidatorAccumulatedCommissionRecord message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord + * @static + * @param {cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord} message ValidatorAccumulatedCommissionRecord + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ValidatorAccumulatedCommissionRecord.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.validator_address = ""; + object.accumulated = null; + } + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + object.validator_address = message.validator_address; + if (message.accumulated != null && message.hasOwnProperty("accumulated")) + object.accumulated = $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommission.toObject(message.accumulated, options); + return object; + }; + + /** + * Converts this ValidatorAccumulatedCommissionRecord to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord + * @instance + * @returns {Object.} JSON object + */ + ValidatorAccumulatedCommissionRecord.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ValidatorAccumulatedCommissionRecord; + })(); + + v1beta1.ValidatorHistoricalRewardsRecord = (function() { + + /** + * Properties of a ValidatorHistoricalRewardsRecord. + * @memberof cosmos.distribution.v1beta1 + * @interface IValidatorHistoricalRewardsRecord + * @property {string|null} [validator_address] ValidatorHistoricalRewardsRecord validator_address + * @property {Long|null} [period] ValidatorHistoricalRewardsRecord period + * @property {cosmos.distribution.v1beta1.IValidatorHistoricalRewards|null} [rewards] ValidatorHistoricalRewardsRecord rewards + */ + + /** + * Constructs a new ValidatorHistoricalRewardsRecord. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a ValidatorHistoricalRewardsRecord. + * @implements IValidatorHistoricalRewardsRecord + * @constructor + * @param {cosmos.distribution.v1beta1.IValidatorHistoricalRewardsRecord=} [properties] Properties to set + */ + function ValidatorHistoricalRewardsRecord(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ValidatorHistoricalRewardsRecord validator_address. + * @member {string} validator_address + * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord + * @instance + */ + ValidatorHistoricalRewardsRecord.prototype.validator_address = ""; + + /** + * ValidatorHistoricalRewardsRecord period. + * @member {Long} period + * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord + * @instance + */ + ValidatorHistoricalRewardsRecord.prototype.period = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * ValidatorHistoricalRewardsRecord rewards. + * @member {cosmos.distribution.v1beta1.IValidatorHistoricalRewards|null|undefined} rewards + * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord + * @instance + */ + ValidatorHistoricalRewardsRecord.prototype.rewards = null; + + /** + * Encodes the specified ValidatorHistoricalRewardsRecord message. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord + * @static + * @param {cosmos.distribution.v1beta1.IValidatorHistoricalRewardsRecord} message ValidatorHistoricalRewardsRecord message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorHistoricalRewardsRecord.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.validator_address); + if (message.period != null && Object.hasOwnProperty.call(message, "period")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.period); + if (message.rewards != null && Object.hasOwnProperty.call(message, "rewards")) + $root.cosmos.distribution.v1beta1.ValidatorHistoricalRewards.encode(message.rewards, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ValidatorHistoricalRewardsRecord message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord + * @static + * @param {cosmos.distribution.v1beta1.IValidatorHistoricalRewardsRecord} message ValidatorHistoricalRewardsRecord message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorHistoricalRewardsRecord.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ValidatorHistoricalRewardsRecord message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord} ValidatorHistoricalRewardsRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorHistoricalRewardsRecord.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_address = reader.string(); + break; + case 2: + message.period = reader.uint64(); + break; + case 3: + message.rewards = $root.cosmos.distribution.v1beta1.ValidatorHistoricalRewards.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ValidatorHistoricalRewardsRecord message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord} ValidatorHistoricalRewardsRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorHistoricalRewardsRecord.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ValidatorHistoricalRewardsRecord message. + * @function verify + * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ValidatorHistoricalRewardsRecord.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + if (!$util.isString(message.validator_address)) + return "validator_address: string expected"; + if (message.period != null && message.hasOwnProperty("period")) + if (!$util.isInteger(message.period) && !(message.period && $util.isInteger(message.period.low) && $util.isInteger(message.period.high))) + return "period: integer|Long expected"; + if (message.rewards != null && message.hasOwnProperty("rewards")) { + let error = $root.cosmos.distribution.v1beta1.ValidatorHistoricalRewards.verify(message.rewards); + if (error) + return "rewards." + error; + } + return null; + }; + + /** + * Creates a ValidatorHistoricalRewardsRecord message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord} ValidatorHistoricalRewardsRecord + */ + ValidatorHistoricalRewardsRecord.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord) + return object; + let message = new $root.cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord(); + if (object.validator_address != null) + message.validator_address = String(object.validator_address); + if (object.period != null) + if ($util.Long) + (message.period = $util.Long.fromValue(object.period)).unsigned = true; + else if (typeof object.period === "string") + message.period = parseInt(object.period, 10); + else if (typeof object.period === "number") + message.period = object.period; + else if (typeof object.period === "object") + message.period = new $util.LongBits(object.period.low >>> 0, object.period.high >>> 0).toNumber(true); + if (object.rewards != null) { + if (typeof object.rewards !== "object") + throw TypeError(".cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord.rewards: object expected"); + message.rewards = $root.cosmos.distribution.v1beta1.ValidatorHistoricalRewards.fromObject(object.rewards); + } + return message; + }; + + /** + * Creates a plain object from a ValidatorHistoricalRewardsRecord message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord + * @static + * @param {cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord} message ValidatorHistoricalRewardsRecord + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ValidatorHistoricalRewardsRecord.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.validator_address = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.period = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.period = options.longs === String ? "0" : 0; + object.rewards = null; + } + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + object.validator_address = message.validator_address; + if (message.period != null && message.hasOwnProperty("period")) + if (typeof message.period === "number") + object.period = options.longs === String ? String(message.period) : message.period; + else + object.period = options.longs === String ? $util.Long.prototype.toString.call(message.period) : options.longs === Number ? new $util.LongBits(message.period.low >>> 0, message.period.high >>> 0).toNumber(true) : message.period; + if (message.rewards != null && message.hasOwnProperty("rewards")) + object.rewards = $root.cosmos.distribution.v1beta1.ValidatorHistoricalRewards.toObject(message.rewards, options); + return object; + }; + + /** + * Converts this ValidatorHistoricalRewardsRecord to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord + * @instance + * @returns {Object.} JSON object + */ + ValidatorHistoricalRewardsRecord.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ValidatorHistoricalRewardsRecord; + })(); + + v1beta1.ValidatorCurrentRewardsRecord = (function() { + + /** + * Properties of a ValidatorCurrentRewardsRecord. + * @memberof cosmos.distribution.v1beta1 + * @interface IValidatorCurrentRewardsRecord + * @property {string|null} [validator_address] ValidatorCurrentRewardsRecord validator_address + * @property {cosmos.distribution.v1beta1.IValidatorCurrentRewards|null} [rewards] ValidatorCurrentRewardsRecord rewards + */ + + /** + * Constructs a new ValidatorCurrentRewardsRecord. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a ValidatorCurrentRewardsRecord. + * @implements IValidatorCurrentRewardsRecord + * @constructor + * @param {cosmos.distribution.v1beta1.IValidatorCurrentRewardsRecord=} [properties] Properties to set + */ + function ValidatorCurrentRewardsRecord(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ValidatorCurrentRewardsRecord validator_address. + * @member {string} validator_address + * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord + * @instance + */ + ValidatorCurrentRewardsRecord.prototype.validator_address = ""; + + /** + * ValidatorCurrentRewardsRecord rewards. + * @member {cosmos.distribution.v1beta1.IValidatorCurrentRewards|null|undefined} rewards + * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord + * @instance + */ + ValidatorCurrentRewardsRecord.prototype.rewards = null; + + /** + * Encodes the specified ValidatorCurrentRewardsRecord message. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord + * @static + * @param {cosmos.distribution.v1beta1.IValidatorCurrentRewardsRecord} message ValidatorCurrentRewardsRecord message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorCurrentRewardsRecord.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.validator_address); + if (message.rewards != null && Object.hasOwnProperty.call(message, "rewards")) + $root.cosmos.distribution.v1beta1.ValidatorCurrentRewards.encode(message.rewards, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ValidatorCurrentRewardsRecord message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord + * @static + * @param {cosmos.distribution.v1beta1.IValidatorCurrentRewardsRecord} message ValidatorCurrentRewardsRecord message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorCurrentRewardsRecord.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ValidatorCurrentRewardsRecord message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord} ValidatorCurrentRewardsRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorCurrentRewardsRecord.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_address = reader.string(); + break; + case 2: + message.rewards = $root.cosmos.distribution.v1beta1.ValidatorCurrentRewards.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ValidatorCurrentRewardsRecord message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord} ValidatorCurrentRewardsRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorCurrentRewardsRecord.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ValidatorCurrentRewardsRecord message. + * @function verify + * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ValidatorCurrentRewardsRecord.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + if (!$util.isString(message.validator_address)) + return "validator_address: string expected"; + if (message.rewards != null && message.hasOwnProperty("rewards")) { + let error = $root.cosmos.distribution.v1beta1.ValidatorCurrentRewards.verify(message.rewards); + if (error) + return "rewards." + error; + } + return null; + }; + + /** + * Creates a ValidatorCurrentRewardsRecord message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord} ValidatorCurrentRewardsRecord + */ + ValidatorCurrentRewardsRecord.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord) + return object; + let message = new $root.cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord(); + if (object.validator_address != null) + message.validator_address = String(object.validator_address); + if (object.rewards != null) { + if (typeof object.rewards !== "object") + throw TypeError(".cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord.rewards: object expected"); + message.rewards = $root.cosmos.distribution.v1beta1.ValidatorCurrentRewards.fromObject(object.rewards); + } + return message; + }; + + /** + * Creates a plain object from a ValidatorCurrentRewardsRecord message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord + * @static + * @param {cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord} message ValidatorCurrentRewardsRecord + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ValidatorCurrentRewardsRecord.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.validator_address = ""; + object.rewards = null; + } + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + object.validator_address = message.validator_address; + if (message.rewards != null && message.hasOwnProperty("rewards")) + object.rewards = $root.cosmos.distribution.v1beta1.ValidatorCurrentRewards.toObject(message.rewards, options); + return object; + }; + + /** + * Converts this ValidatorCurrentRewardsRecord to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord + * @instance + * @returns {Object.} JSON object + */ + ValidatorCurrentRewardsRecord.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ValidatorCurrentRewardsRecord; + })(); + + v1beta1.DelegatorStartingInfoRecord = (function() { + + /** + * Properties of a DelegatorStartingInfoRecord. + * @memberof cosmos.distribution.v1beta1 + * @interface IDelegatorStartingInfoRecord + * @property {string|null} [delegator_address] DelegatorStartingInfoRecord delegator_address + * @property {string|null} [validator_address] DelegatorStartingInfoRecord validator_address + * @property {cosmos.distribution.v1beta1.IDelegatorStartingInfo|null} [starting_info] DelegatorStartingInfoRecord starting_info + */ + + /** + * Constructs a new DelegatorStartingInfoRecord. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a DelegatorStartingInfoRecord. + * @implements IDelegatorStartingInfoRecord + * @constructor + * @param {cosmos.distribution.v1beta1.IDelegatorStartingInfoRecord=} [properties] Properties to set + */ + function DelegatorStartingInfoRecord(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DelegatorStartingInfoRecord delegator_address. + * @member {string} delegator_address + * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfoRecord + * @instance + */ + DelegatorStartingInfoRecord.prototype.delegator_address = ""; + + /** + * DelegatorStartingInfoRecord validator_address. + * @member {string} validator_address + * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfoRecord + * @instance + */ + DelegatorStartingInfoRecord.prototype.validator_address = ""; + + /** + * DelegatorStartingInfoRecord starting_info. + * @member {cosmos.distribution.v1beta1.IDelegatorStartingInfo|null|undefined} starting_info + * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfoRecord + * @instance + */ + DelegatorStartingInfoRecord.prototype.starting_info = null; + + /** + * Encodes the specified DelegatorStartingInfoRecord message. Does not implicitly {@link cosmos.distribution.v1beta1.DelegatorStartingInfoRecord.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfoRecord + * @static + * @param {cosmos.distribution.v1beta1.IDelegatorStartingInfoRecord} message DelegatorStartingInfoRecord message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DelegatorStartingInfoRecord.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); + if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.validator_address); + if (message.starting_info != null && Object.hasOwnProperty.call(message, "starting_info")) + $root.cosmos.distribution.v1beta1.DelegatorStartingInfo.encode(message.starting_info, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DelegatorStartingInfoRecord message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.DelegatorStartingInfoRecord.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfoRecord + * @static + * @param {cosmos.distribution.v1beta1.IDelegatorStartingInfoRecord} message DelegatorStartingInfoRecord message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DelegatorStartingInfoRecord.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DelegatorStartingInfoRecord message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfoRecord + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.DelegatorStartingInfoRecord} DelegatorStartingInfoRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DelegatorStartingInfoRecord.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.DelegatorStartingInfoRecord(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_address = reader.string(); + break; + case 2: + message.validator_address = reader.string(); + break; + case 3: + message.starting_info = $root.cosmos.distribution.v1beta1.DelegatorStartingInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DelegatorStartingInfoRecord message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfoRecord + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.DelegatorStartingInfoRecord} DelegatorStartingInfoRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DelegatorStartingInfoRecord.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DelegatorStartingInfoRecord message. + * @function verify + * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfoRecord + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DelegatorStartingInfoRecord.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + if (!$util.isString(message.delegator_address)) + return "delegator_address: string expected"; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + if (!$util.isString(message.validator_address)) + return "validator_address: string expected"; + if (message.starting_info != null && message.hasOwnProperty("starting_info")) { + let error = $root.cosmos.distribution.v1beta1.DelegatorStartingInfo.verify(message.starting_info); + if (error) + return "starting_info." + error; + } + return null; + }; + + /** + * Creates a DelegatorStartingInfoRecord message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfoRecord + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.DelegatorStartingInfoRecord} DelegatorStartingInfoRecord + */ + DelegatorStartingInfoRecord.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.DelegatorStartingInfoRecord) + return object; + let message = new $root.cosmos.distribution.v1beta1.DelegatorStartingInfoRecord(); + if (object.delegator_address != null) + message.delegator_address = String(object.delegator_address); + if (object.validator_address != null) + message.validator_address = String(object.validator_address); + if (object.starting_info != null) { + if (typeof object.starting_info !== "object") + throw TypeError(".cosmos.distribution.v1beta1.DelegatorStartingInfoRecord.starting_info: object expected"); + message.starting_info = $root.cosmos.distribution.v1beta1.DelegatorStartingInfo.fromObject(object.starting_info); + } + return message; + }; + + /** + * Creates a plain object from a DelegatorStartingInfoRecord message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfoRecord + * @static + * @param {cosmos.distribution.v1beta1.DelegatorStartingInfoRecord} message DelegatorStartingInfoRecord + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DelegatorStartingInfoRecord.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.delegator_address = ""; + object.validator_address = ""; + object.starting_info = null; + } + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + object.delegator_address = message.delegator_address; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + object.validator_address = message.validator_address; + if (message.starting_info != null && message.hasOwnProperty("starting_info")) + object.starting_info = $root.cosmos.distribution.v1beta1.DelegatorStartingInfo.toObject(message.starting_info, options); + return object; + }; + + /** + * Converts this DelegatorStartingInfoRecord to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfoRecord + * @instance + * @returns {Object.} JSON object + */ + DelegatorStartingInfoRecord.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DelegatorStartingInfoRecord; + })(); + + v1beta1.ValidatorSlashEventRecord = (function() { + + /** + * Properties of a ValidatorSlashEventRecord. + * @memberof cosmos.distribution.v1beta1 + * @interface IValidatorSlashEventRecord + * @property {string|null} [validator_address] ValidatorSlashEventRecord validator_address + * @property {Long|null} [height] ValidatorSlashEventRecord height + * @property {Long|null} [period] ValidatorSlashEventRecord period + * @property {cosmos.distribution.v1beta1.IValidatorSlashEvent|null} [validator_slash_event] ValidatorSlashEventRecord validator_slash_event + */ + + /** + * Constructs a new ValidatorSlashEventRecord. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a ValidatorSlashEventRecord. + * @implements IValidatorSlashEventRecord + * @constructor + * @param {cosmos.distribution.v1beta1.IValidatorSlashEventRecord=} [properties] Properties to set + */ + function ValidatorSlashEventRecord(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ValidatorSlashEventRecord validator_address. + * @member {string} validator_address + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEventRecord + * @instance + */ + ValidatorSlashEventRecord.prototype.validator_address = ""; + + /** + * ValidatorSlashEventRecord height. + * @member {Long} height + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEventRecord + * @instance + */ + ValidatorSlashEventRecord.prototype.height = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * ValidatorSlashEventRecord period. + * @member {Long} period + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEventRecord + * @instance + */ + ValidatorSlashEventRecord.prototype.period = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * ValidatorSlashEventRecord validator_slash_event. + * @member {cosmos.distribution.v1beta1.IValidatorSlashEvent|null|undefined} validator_slash_event + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEventRecord + * @instance + */ + ValidatorSlashEventRecord.prototype.validator_slash_event = null; + + /** + * Encodes the specified ValidatorSlashEventRecord message. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorSlashEventRecord.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEventRecord + * @static + * @param {cosmos.distribution.v1beta1.IValidatorSlashEventRecord} message ValidatorSlashEventRecord message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorSlashEventRecord.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.validator_address); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.height); + if (message.period != null && Object.hasOwnProperty.call(message, "period")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.period); + if (message.validator_slash_event != null && Object.hasOwnProperty.call(message, "validator_slash_event")) + $root.cosmos.distribution.v1beta1.ValidatorSlashEvent.encode(message.validator_slash_event, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ValidatorSlashEventRecord message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorSlashEventRecord.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEventRecord + * @static + * @param {cosmos.distribution.v1beta1.IValidatorSlashEventRecord} message ValidatorSlashEventRecord message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorSlashEventRecord.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ValidatorSlashEventRecord message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEventRecord + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.ValidatorSlashEventRecord} ValidatorSlashEventRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorSlashEventRecord.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.ValidatorSlashEventRecord(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_address = reader.string(); + break; + case 2: + message.height = reader.uint64(); + break; + case 3: + message.period = reader.uint64(); + break; + case 4: + message.validator_slash_event = $root.cosmos.distribution.v1beta1.ValidatorSlashEvent.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ValidatorSlashEventRecord message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEventRecord + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.ValidatorSlashEventRecord} ValidatorSlashEventRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorSlashEventRecord.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ValidatorSlashEventRecord message. + * @function verify + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEventRecord + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ValidatorSlashEventRecord.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + if (!$util.isString(message.validator_address)) + return "validator_address: string expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) + return "height: integer|Long expected"; + if (message.period != null && message.hasOwnProperty("period")) + if (!$util.isInteger(message.period) && !(message.period && $util.isInteger(message.period.low) && $util.isInteger(message.period.high))) + return "period: integer|Long expected"; + if (message.validator_slash_event != null && message.hasOwnProperty("validator_slash_event")) { + let error = $root.cosmos.distribution.v1beta1.ValidatorSlashEvent.verify(message.validator_slash_event); + if (error) + return "validator_slash_event." + error; + } + return null; + }; + + /** + * Creates a ValidatorSlashEventRecord message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEventRecord + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.ValidatorSlashEventRecord} ValidatorSlashEventRecord + */ + ValidatorSlashEventRecord.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.ValidatorSlashEventRecord) + return object; + let message = new $root.cosmos.distribution.v1beta1.ValidatorSlashEventRecord(); + if (object.validator_address != null) + message.validator_address = String(object.validator_address); + if (object.height != null) + if ($util.Long) + (message.height = $util.Long.fromValue(object.height)).unsigned = true; + else if (typeof object.height === "string") + message.height = parseInt(object.height, 10); + else if (typeof object.height === "number") + message.height = object.height; + else if (typeof object.height === "object") + message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(true); + if (object.period != null) + if ($util.Long) + (message.period = $util.Long.fromValue(object.period)).unsigned = true; + else if (typeof object.period === "string") + message.period = parseInt(object.period, 10); + else if (typeof object.period === "number") + message.period = object.period; + else if (typeof object.period === "object") + message.period = new $util.LongBits(object.period.low >>> 0, object.period.high >>> 0).toNumber(true); + if (object.validator_slash_event != null) { + if (typeof object.validator_slash_event !== "object") + throw TypeError(".cosmos.distribution.v1beta1.ValidatorSlashEventRecord.validator_slash_event: object expected"); + message.validator_slash_event = $root.cosmos.distribution.v1beta1.ValidatorSlashEvent.fromObject(object.validator_slash_event); + } + return message; + }; + + /** + * Creates a plain object from a ValidatorSlashEventRecord message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEventRecord + * @static + * @param {cosmos.distribution.v1beta1.ValidatorSlashEventRecord} message ValidatorSlashEventRecord + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ValidatorSlashEventRecord.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.validator_address = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.height = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.period = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.period = options.longs === String ? "0" : 0; + object.validator_slash_event = null; + } + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + object.validator_address = message.validator_address; + if (message.height != null && message.hasOwnProperty("height")) + if (typeof message.height === "number") + object.height = options.longs === String ? String(message.height) : message.height; + else + object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber(true) : message.height; + if (message.period != null && message.hasOwnProperty("period")) + if (typeof message.period === "number") + object.period = options.longs === String ? String(message.period) : message.period; + else + object.period = options.longs === String ? $util.Long.prototype.toString.call(message.period) : options.longs === Number ? new $util.LongBits(message.period.low >>> 0, message.period.high >>> 0).toNumber(true) : message.period; + if (message.validator_slash_event != null && message.hasOwnProperty("validator_slash_event")) + object.validator_slash_event = $root.cosmos.distribution.v1beta1.ValidatorSlashEvent.toObject(message.validator_slash_event, options); + return object; + }; + + /** + * Converts this ValidatorSlashEventRecord to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.ValidatorSlashEventRecord + * @instance + * @returns {Object.} JSON object + */ + ValidatorSlashEventRecord.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ValidatorSlashEventRecord; + })(); + + v1beta1.GenesisState = (function() { + + /** + * Properties of a GenesisState. + * @memberof cosmos.distribution.v1beta1 + * @interface IGenesisState + * @property {cosmos.distribution.v1beta1.IParams|null} [params] GenesisState params + * @property {cosmos.distribution.v1beta1.IFeePool|null} [fee_pool] GenesisState fee_pool + * @property {Array.|null} [delegator_withdraw_infos] GenesisState delegator_withdraw_infos + * @property {string|null} [previous_proposer] GenesisState previous_proposer + * @property {Array.|null} [outstanding_rewards] GenesisState outstanding_rewards + * @property {Array.|null} [validator_accumulated_commissions] GenesisState validator_accumulated_commissions + * @property {Array.|null} [validator_historical_rewards] GenesisState validator_historical_rewards + * @property {Array.|null} [validator_current_rewards] GenesisState validator_current_rewards + * @property {Array.|null} [delegator_starting_infos] GenesisState delegator_starting_infos + * @property {Array.|null} [validator_slash_events] GenesisState validator_slash_events + */ + + /** + * Constructs a new GenesisState. + * @memberof cosmos.distribution.v1beta1 + * @classdesc Represents a GenesisState. + * @implements IGenesisState + * @constructor + * @param {cosmos.distribution.v1beta1.IGenesisState=} [properties] Properties to set + */ + function GenesisState(properties) { + this.delegator_withdraw_infos = []; + this.outstanding_rewards = []; + this.validator_accumulated_commissions = []; + this.validator_historical_rewards = []; + this.validator_current_rewards = []; + this.delegator_starting_infos = []; + this.validator_slash_events = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenesisState params. + * @member {cosmos.distribution.v1beta1.IParams|null|undefined} params + * @memberof cosmos.distribution.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.params = null; + + /** + * GenesisState fee_pool. + * @member {cosmos.distribution.v1beta1.IFeePool|null|undefined} fee_pool + * @memberof cosmos.distribution.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.fee_pool = null; + + /** + * GenesisState delegator_withdraw_infos. + * @member {Array.} delegator_withdraw_infos + * @memberof cosmos.distribution.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.delegator_withdraw_infos = $util.emptyArray; + + /** + * GenesisState previous_proposer. + * @member {string} previous_proposer + * @memberof cosmos.distribution.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.previous_proposer = ""; + + /** + * GenesisState outstanding_rewards. + * @member {Array.} outstanding_rewards + * @memberof cosmos.distribution.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.outstanding_rewards = $util.emptyArray; + + /** + * GenesisState validator_accumulated_commissions. + * @member {Array.} validator_accumulated_commissions + * @memberof cosmos.distribution.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.validator_accumulated_commissions = $util.emptyArray; + + /** + * GenesisState validator_historical_rewards. + * @member {Array.} validator_historical_rewards + * @memberof cosmos.distribution.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.validator_historical_rewards = $util.emptyArray; + + /** + * GenesisState validator_current_rewards. + * @member {Array.} validator_current_rewards + * @memberof cosmos.distribution.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.validator_current_rewards = $util.emptyArray; + + /** + * GenesisState delegator_starting_infos. + * @member {Array.} delegator_starting_infos + * @memberof cosmos.distribution.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.delegator_starting_infos = $util.emptyArray; + + /** + * GenesisState validator_slash_events. + * @member {Array.} validator_slash_events + * @memberof cosmos.distribution.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.validator_slash_events = $util.emptyArray; + + /** + * Encodes the specified GenesisState message. Does not implicitly {@link cosmos.distribution.v1beta1.GenesisState.verify|verify} messages. + * @function encode + * @memberof cosmos.distribution.v1beta1.GenesisState + * @static + * @param {cosmos.distribution.v1beta1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.params != null && Object.hasOwnProperty.call(message, "params")) + $root.cosmos.distribution.v1beta1.Params.encode(message.params, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.fee_pool != null && Object.hasOwnProperty.call(message, "fee_pool")) + $root.cosmos.distribution.v1beta1.FeePool.encode(message.fee_pool, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.delegator_withdraw_infos != null && message.delegator_withdraw_infos.length) + for (let i = 0; i < message.delegator_withdraw_infos.length; ++i) + $root.cosmos.distribution.v1beta1.DelegatorWithdrawInfo.encode(message.delegator_withdraw_infos[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.previous_proposer != null && Object.hasOwnProperty.call(message, "previous_proposer")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.previous_proposer); + if (message.outstanding_rewards != null && message.outstanding_rewards.length) + for (let i = 0; i < message.outstanding_rewards.length; ++i) + $root.cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord.encode(message.outstanding_rewards[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.validator_accumulated_commissions != null && message.validator_accumulated_commissions.length) + for (let i = 0; i < message.validator_accumulated_commissions.length; ++i) + $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord.encode(message.validator_accumulated_commissions[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.validator_historical_rewards != null && message.validator_historical_rewards.length) + for (let i = 0; i < message.validator_historical_rewards.length; ++i) + $root.cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord.encode(message.validator_historical_rewards[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.validator_current_rewards != null && message.validator_current_rewards.length) + for (let i = 0; i < message.validator_current_rewards.length; ++i) + $root.cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord.encode(message.validator_current_rewards[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.delegator_starting_infos != null && message.delegator_starting_infos.length) + for (let i = 0; i < message.delegator_starting_infos.length; ++i) + $root.cosmos.distribution.v1beta1.DelegatorStartingInfoRecord.encode(message.delegator_starting_infos[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.validator_slash_events != null && message.validator_slash_events.length) + for (let i = 0; i < message.validator_slash_events.length; ++i) + $root.cosmos.distribution.v1beta1.ValidatorSlashEventRecord.encode(message.validator_slash_events[i], writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.GenesisState.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.distribution.v1beta1.GenesisState + * @static + * @param {cosmos.distribution.v1beta1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer. + * @function decode + * @memberof cosmos.distribution.v1beta1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.distribution.v1beta1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.GenesisState(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = $root.cosmos.distribution.v1beta1.Params.decode(reader, reader.uint32()); + break; + case 2: + message.fee_pool = $root.cosmos.distribution.v1beta1.FeePool.decode(reader, reader.uint32()); + break; + case 3: + if (!(message.delegator_withdraw_infos && message.delegator_withdraw_infos.length)) + message.delegator_withdraw_infos = []; + message.delegator_withdraw_infos.push($root.cosmos.distribution.v1beta1.DelegatorWithdrawInfo.decode(reader, reader.uint32())); + break; + case 4: + message.previous_proposer = reader.string(); + break; + case 5: + if (!(message.outstanding_rewards && message.outstanding_rewards.length)) + message.outstanding_rewards = []; + message.outstanding_rewards.push($root.cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + break; + case 6: + if (!(message.validator_accumulated_commissions && message.validator_accumulated_commissions.length)) + message.validator_accumulated_commissions = []; + message.validator_accumulated_commissions.push($root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32())); + break; + case 7: + if (!(message.validator_historical_rewards && message.validator_historical_rewards.length)) + message.validator_historical_rewards = []; + message.validator_historical_rewards.push($root.cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + break; + case 8: + if (!(message.validator_current_rewards && message.validator_current_rewards.length)) + message.validator_current_rewards = []; + message.validator_current_rewards.push($root.cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + break; + case 9: + if (!(message.delegator_starting_infos && message.delegator_starting_infos.length)) + message.delegator_starting_infos = []; + message.delegator_starting_infos.push($root.cosmos.distribution.v1beta1.DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + break; + case 10: + if (!(message.validator_slash_events && message.validator_slash_events.length)) + message.validator_slash_events = []; + message.validator_slash_events.push($root.cosmos.distribution.v1beta1.ValidatorSlashEventRecord.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.distribution.v1beta1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.distribution.v1beta1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenesisState message. + * @function verify + * @memberof cosmos.distribution.v1beta1.GenesisState + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenesisState.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.params != null && message.hasOwnProperty("params")) { + let error = $root.cosmos.distribution.v1beta1.Params.verify(message.params); + if (error) + return "params." + error; + } + if (message.fee_pool != null && message.hasOwnProperty("fee_pool")) { + let error = $root.cosmos.distribution.v1beta1.FeePool.verify(message.fee_pool); + if (error) + return "fee_pool." + error; + } + if (message.delegator_withdraw_infos != null && message.hasOwnProperty("delegator_withdraw_infos")) { + if (!Array.isArray(message.delegator_withdraw_infos)) + return "delegator_withdraw_infos: array expected"; + for (let i = 0; i < message.delegator_withdraw_infos.length; ++i) { + let error = $root.cosmos.distribution.v1beta1.DelegatorWithdrawInfo.verify(message.delegator_withdraw_infos[i]); + if (error) + return "delegator_withdraw_infos." + error; + } + } + if (message.previous_proposer != null && message.hasOwnProperty("previous_proposer")) + if (!$util.isString(message.previous_proposer)) + return "previous_proposer: string expected"; + if (message.outstanding_rewards != null && message.hasOwnProperty("outstanding_rewards")) { + if (!Array.isArray(message.outstanding_rewards)) + return "outstanding_rewards: array expected"; + for (let i = 0; i < message.outstanding_rewards.length; ++i) { + let error = $root.cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord.verify(message.outstanding_rewards[i]); + if (error) + return "outstanding_rewards." + error; + } + } + if (message.validator_accumulated_commissions != null && message.hasOwnProperty("validator_accumulated_commissions")) { + if (!Array.isArray(message.validator_accumulated_commissions)) + return "validator_accumulated_commissions: array expected"; + for (let i = 0; i < message.validator_accumulated_commissions.length; ++i) { + let error = $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord.verify(message.validator_accumulated_commissions[i]); + if (error) + return "validator_accumulated_commissions." + error; + } + } + if (message.validator_historical_rewards != null && message.hasOwnProperty("validator_historical_rewards")) { + if (!Array.isArray(message.validator_historical_rewards)) + return "validator_historical_rewards: array expected"; + for (let i = 0; i < message.validator_historical_rewards.length; ++i) { + let error = $root.cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord.verify(message.validator_historical_rewards[i]); + if (error) + return "validator_historical_rewards." + error; + } + } + if (message.validator_current_rewards != null && message.hasOwnProperty("validator_current_rewards")) { + if (!Array.isArray(message.validator_current_rewards)) + return "validator_current_rewards: array expected"; + for (let i = 0; i < message.validator_current_rewards.length; ++i) { + let error = $root.cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord.verify(message.validator_current_rewards[i]); + if (error) + return "validator_current_rewards." + error; + } + } + if (message.delegator_starting_infos != null && message.hasOwnProperty("delegator_starting_infos")) { + if (!Array.isArray(message.delegator_starting_infos)) + return "delegator_starting_infos: array expected"; + for (let i = 0; i < message.delegator_starting_infos.length; ++i) { + let error = $root.cosmos.distribution.v1beta1.DelegatorStartingInfoRecord.verify(message.delegator_starting_infos[i]); + if (error) + return "delegator_starting_infos." + error; + } + } + if (message.validator_slash_events != null && message.hasOwnProperty("validator_slash_events")) { + if (!Array.isArray(message.validator_slash_events)) + return "validator_slash_events: array expected"; + for (let i = 0; i < message.validator_slash_events.length; ++i) { + let error = $root.cosmos.distribution.v1beta1.ValidatorSlashEventRecord.verify(message.validator_slash_events[i]); + if (error) + return "validator_slash_events." + error; + } + } + return null; + }; + + /** + * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.distribution.v1beta1.GenesisState + * @static + * @param {Object.} object Plain object + * @returns {cosmos.distribution.v1beta1.GenesisState} GenesisState + */ + GenesisState.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.distribution.v1beta1.GenesisState) + return object; + let message = new $root.cosmos.distribution.v1beta1.GenesisState(); + if (object.params != null) { + if (typeof object.params !== "object") + throw TypeError(".cosmos.distribution.v1beta1.GenesisState.params: object expected"); + message.params = $root.cosmos.distribution.v1beta1.Params.fromObject(object.params); + } + if (object.fee_pool != null) { + if (typeof object.fee_pool !== "object") + throw TypeError(".cosmos.distribution.v1beta1.GenesisState.fee_pool: object expected"); + message.fee_pool = $root.cosmos.distribution.v1beta1.FeePool.fromObject(object.fee_pool); + } + if (object.delegator_withdraw_infos) { + if (!Array.isArray(object.delegator_withdraw_infos)) + throw TypeError(".cosmos.distribution.v1beta1.GenesisState.delegator_withdraw_infos: array expected"); + message.delegator_withdraw_infos = []; + for (let i = 0; i < object.delegator_withdraw_infos.length; ++i) { + if (typeof object.delegator_withdraw_infos[i] !== "object") + throw TypeError(".cosmos.distribution.v1beta1.GenesisState.delegator_withdraw_infos: object expected"); + message.delegator_withdraw_infos[i] = $root.cosmos.distribution.v1beta1.DelegatorWithdrawInfo.fromObject(object.delegator_withdraw_infos[i]); + } + } + if (object.previous_proposer != null) + message.previous_proposer = String(object.previous_proposer); + if (object.outstanding_rewards) { + if (!Array.isArray(object.outstanding_rewards)) + throw TypeError(".cosmos.distribution.v1beta1.GenesisState.outstanding_rewards: array expected"); + message.outstanding_rewards = []; + for (let i = 0; i < object.outstanding_rewards.length; ++i) { + if (typeof object.outstanding_rewards[i] !== "object") + throw TypeError(".cosmos.distribution.v1beta1.GenesisState.outstanding_rewards: object expected"); + message.outstanding_rewards[i] = $root.cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord.fromObject(object.outstanding_rewards[i]); + } + } + if (object.validator_accumulated_commissions) { + if (!Array.isArray(object.validator_accumulated_commissions)) + throw TypeError(".cosmos.distribution.v1beta1.GenesisState.validator_accumulated_commissions: array expected"); + message.validator_accumulated_commissions = []; + for (let i = 0; i < object.validator_accumulated_commissions.length; ++i) { + if (typeof object.validator_accumulated_commissions[i] !== "object") + throw TypeError(".cosmos.distribution.v1beta1.GenesisState.validator_accumulated_commissions: object expected"); + message.validator_accumulated_commissions[i] = $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord.fromObject(object.validator_accumulated_commissions[i]); + } + } + if (object.validator_historical_rewards) { + if (!Array.isArray(object.validator_historical_rewards)) + throw TypeError(".cosmos.distribution.v1beta1.GenesisState.validator_historical_rewards: array expected"); + message.validator_historical_rewards = []; + for (let i = 0; i < object.validator_historical_rewards.length; ++i) { + if (typeof object.validator_historical_rewards[i] !== "object") + throw TypeError(".cosmos.distribution.v1beta1.GenesisState.validator_historical_rewards: object expected"); + message.validator_historical_rewards[i] = $root.cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord.fromObject(object.validator_historical_rewards[i]); + } + } + if (object.validator_current_rewards) { + if (!Array.isArray(object.validator_current_rewards)) + throw TypeError(".cosmos.distribution.v1beta1.GenesisState.validator_current_rewards: array expected"); + message.validator_current_rewards = []; + for (let i = 0; i < object.validator_current_rewards.length; ++i) { + if (typeof object.validator_current_rewards[i] !== "object") + throw TypeError(".cosmos.distribution.v1beta1.GenesisState.validator_current_rewards: object expected"); + message.validator_current_rewards[i] = $root.cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord.fromObject(object.validator_current_rewards[i]); + } + } + if (object.delegator_starting_infos) { + if (!Array.isArray(object.delegator_starting_infos)) + throw TypeError(".cosmos.distribution.v1beta1.GenesisState.delegator_starting_infos: array expected"); + message.delegator_starting_infos = []; + for (let i = 0; i < object.delegator_starting_infos.length; ++i) { + if (typeof object.delegator_starting_infos[i] !== "object") + throw TypeError(".cosmos.distribution.v1beta1.GenesisState.delegator_starting_infos: object expected"); + message.delegator_starting_infos[i] = $root.cosmos.distribution.v1beta1.DelegatorStartingInfoRecord.fromObject(object.delegator_starting_infos[i]); + } + } + if (object.validator_slash_events) { + if (!Array.isArray(object.validator_slash_events)) + throw TypeError(".cosmos.distribution.v1beta1.GenesisState.validator_slash_events: array expected"); + message.validator_slash_events = []; + for (let i = 0; i < object.validator_slash_events.length; ++i) { + if (typeof object.validator_slash_events[i] !== "object") + throw TypeError(".cosmos.distribution.v1beta1.GenesisState.validator_slash_events: object expected"); + message.validator_slash_events[i] = $root.cosmos.distribution.v1beta1.ValidatorSlashEventRecord.fromObject(object.validator_slash_events[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a GenesisState message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.distribution.v1beta1.GenesisState + * @static + * @param {cosmos.distribution.v1beta1.GenesisState} message GenesisState + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenesisState.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) { + object.delegator_withdraw_infos = []; + object.outstanding_rewards = []; + object.validator_accumulated_commissions = []; + object.validator_historical_rewards = []; + object.validator_current_rewards = []; + object.delegator_starting_infos = []; + object.validator_slash_events = []; + } + if (options.defaults) { + object.params = null; + object.fee_pool = null; + object.previous_proposer = ""; + } + if (message.params != null && message.hasOwnProperty("params")) + object.params = $root.cosmos.distribution.v1beta1.Params.toObject(message.params, options); + if (message.fee_pool != null && message.hasOwnProperty("fee_pool")) + object.fee_pool = $root.cosmos.distribution.v1beta1.FeePool.toObject(message.fee_pool, options); + if (message.delegator_withdraw_infos && message.delegator_withdraw_infos.length) { + object.delegator_withdraw_infos = []; + for (let j = 0; j < message.delegator_withdraw_infos.length; ++j) + object.delegator_withdraw_infos[j] = $root.cosmos.distribution.v1beta1.DelegatorWithdrawInfo.toObject(message.delegator_withdraw_infos[j], options); + } + if (message.previous_proposer != null && message.hasOwnProperty("previous_proposer")) + object.previous_proposer = message.previous_proposer; + if (message.outstanding_rewards && message.outstanding_rewards.length) { + object.outstanding_rewards = []; + for (let j = 0; j < message.outstanding_rewards.length; ++j) + object.outstanding_rewards[j] = $root.cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord.toObject(message.outstanding_rewards[j], options); + } + if (message.validator_accumulated_commissions && message.validator_accumulated_commissions.length) { + object.validator_accumulated_commissions = []; + for (let j = 0; j < message.validator_accumulated_commissions.length; ++j) + object.validator_accumulated_commissions[j] = $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord.toObject(message.validator_accumulated_commissions[j], options); + } + if (message.validator_historical_rewards && message.validator_historical_rewards.length) { + object.validator_historical_rewards = []; + for (let j = 0; j < message.validator_historical_rewards.length; ++j) + object.validator_historical_rewards[j] = $root.cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord.toObject(message.validator_historical_rewards[j], options); + } + if (message.validator_current_rewards && message.validator_current_rewards.length) { + object.validator_current_rewards = []; + for (let j = 0; j < message.validator_current_rewards.length; ++j) + object.validator_current_rewards[j] = $root.cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord.toObject(message.validator_current_rewards[j], options); + } + if (message.delegator_starting_infos && message.delegator_starting_infos.length) { + object.delegator_starting_infos = []; + for (let j = 0; j < message.delegator_starting_infos.length; ++j) + object.delegator_starting_infos[j] = $root.cosmos.distribution.v1beta1.DelegatorStartingInfoRecord.toObject(message.delegator_starting_infos[j], options); + } + if (message.validator_slash_events && message.validator_slash_events.length) { + object.validator_slash_events = []; + for (let j = 0; j < message.validator_slash_events.length; ++j) + object.validator_slash_events[j] = $root.cosmos.distribution.v1beta1.ValidatorSlashEventRecord.toObject(message.validator_slash_events[j], options); + } + return object; + }; + + /** + * Converts this GenesisState to JSON. + * @function toJSON + * @memberof cosmos.distribution.v1beta1.GenesisState + * @instance + * @returns {Object.} JSON object + */ + GenesisState.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenesisState; + })(); + + return v1beta1; + })(); + + return distribution; + })(); + + cosmos.evidence = (function() { + + /** + * Namespace evidence. + * @memberof cosmos + * @namespace + */ + const evidence = {}; + + evidence.v1beta1 = (function() { + + /** + * Namespace v1beta1. + * @memberof cosmos.evidence + * @namespace + */ + const v1beta1 = {}; + + v1beta1.Msg = (function() { + + /** + * Constructs a new Msg service. + * @memberof cosmos.evidence.v1beta1 + * @classdesc Represents a Msg + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Msg(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Msg.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Msg; + + /** + * Callback as used by {@link cosmos.evidence.v1beta1.Msg#submitEvidence}. + * @memberof cosmos.evidence.v1beta1.Msg + * @typedef SubmitEvidenceCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse} [response] MsgSubmitEvidenceResponse + */ + + /** + * Calls SubmitEvidence. + * @function submitEvidence + * @memberof cosmos.evidence.v1beta1.Msg + * @instance + * @param {cosmos.evidence.v1beta1.IMsgSubmitEvidence} request MsgSubmitEvidence message or plain object + * @param {cosmos.evidence.v1beta1.Msg.SubmitEvidenceCallback} callback Node-style callback called with the error, if any, and MsgSubmitEvidenceResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.submitEvidence = function submitEvidence(request, callback) { + return this.rpcCall(submitEvidence, $root.cosmos.evidence.v1beta1.MsgSubmitEvidence, $root.cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse, request, callback); + }, "name", { value: "SubmitEvidence" }); + + /** + * Calls SubmitEvidence. + * @function submitEvidence + * @memberof cosmos.evidence.v1beta1.Msg + * @instance + * @param {cosmos.evidence.v1beta1.IMsgSubmitEvidence} request MsgSubmitEvidence message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Msg; + })(); + + v1beta1.MsgSubmitEvidence = (function() { + + /** + * Properties of a MsgSubmitEvidence. + * @memberof cosmos.evidence.v1beta1 + * @interface IMsgSubmitEvidence + * @property {string|null} [submitter] MsgSubmitEvidence submitter + * @property {google.protobuf.IAny|null} [evidence] MsgSubmitEvidence evidence + */ + + /** + * Constructs a new MsgSubmitEvidence. + * @memberof cosmos.evidence.v1beta1 + * @classdesc Represents a MsgSubmitEvidence. + * @implements IMsgSubmitEvidence + * @constructor + * @param {cosmos.evidence.v1beta1.IMsgSubmitEvidence=} [properties] Properties to set + */ + function MsgSubmitEvidence(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgSubmitEvidence submitter. + * @member {string} submitter + * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidence + * @instance + */ + MsgSubmitEvidence.prototype.submitter = ""; + + /** + * MsgSubmitEvidence evidence. + * @member {google.protobuf.IAny|null|undefined} evidence + * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidence + * @instance + */ + MsgSubmitEvidence.prototype.evidence = null; + + /** + * Encodes the specified MsgSubmitEvidence message. Does not implicitly {@link cosmos.evidence.v1beta1.MsgSubmitEvidence.verify|verify} messages. + * @function encode + * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidence + * @static + * @param {cosmos.evidence.v1beta1.IMsgSubmitEvidence} message MsgSubmitEvidence message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgSubmitEvidence.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.submitter != null && Object.hasOwnProperty.call(message, "submitter")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.submitter); + if (message.evidence != null && Object.hasOwnProperty.call(message, "evidence")) + $root.google.protobuf.Any.encode(message.evidence, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MsgSubmitEvidence message, length delimited. Does not implicitly {@link cosmos.evidence.v1beta1.MsgSubmitEvidence.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidence + * @static + * @param {cosmos.evidence.v1beta1.IMsgSubmitEvidence} message MsgSubmitEvidence message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgSubmitEvidence.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgSubmitEvidence message from the specified reader or buffer. + * @function decode + * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidence + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.evidence.v1beta1.MsgSubmitEvidence} MsgSubmitEvidence + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgSubmitEvidence.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.evidence.v1beta1.MsgSubmitEvidence(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.submitter = reader.string(); + break; + case 2: + message.evidence = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgSubmitEvidence message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidence + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.evidence.v1beta1.MsgSubmitEvidence} MsgSubmitEvidence + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgSubmitEvidence.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgSubmitEvidence message. + * @function verify + * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidence + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgSubmitEvidence.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.submitter != null && message.hasOwnProperty("submitter")) + if (!$util.isString(message.submitter)) + return "submitter: string expected"; + if (message.evidence != null && message.hasOwnProperty("evidence")) { + let error = $root.google.protobuf.Any.verify(message.evidence); + if (error) + return "evidence." + error; + } + return null; + }; + + /** + * Creates a MsgSubmitEvidence message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidence + * @static + * @param {Object.} object Plain object + * @returns {cosmos.evidence.v1beta1.MsgSubmitEvidence} MsgSubmitEvidence + */ + MsgSubmitEvidence.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.evidence.v1beta1.MsgSubmitEvidence) + return object; + let message = new $root.cosmos.evidence.v1beta1.MsgSubmitEvidence(); + if (object.submitter != null) + message.submitter = String(object.submitter); + if (object.evidence != null) { + if (typeof object.evidence !== "object") + throw TypeError(".cosmos.evidence.v1beta1.MsgSubmitEvidence.evidence: object expected"); + message.evidence = $root.google.protobuf.Any.fromObject(object.evidence); + } + return message; + }; + + /** + * Creates a plain object from a MsgSubmitEvidence message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidence + * @static + * @param {cosmos.evidence.v1beta1.MsgSubmitEvidence} message MsgSubmitEvidence + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgSubmitEvidence.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.submitter = ""; + object.evidence = null; + } + if (message.submitter != null && message.hasOwnProperty("submitter")) + object.submitter = message.submitter; + if (message.evidence != null && message.hasOwnProperty("evidence")) + object.evidence = $root.google.protobuf.Any.toObject(message.evidence, options); + return object; + }; + + /** + * Converts this MsgSubmitEvidence to JSON. + * @function toJSON + * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidence + * @instance + * @returns {Object.} JSON object + */ + MsgSubmitEvidence.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgSubmitEvidence; + })(); + + v1beta1.MsgSubmitEvidenceResponse = (function() { + + /** + * Properties of a MsgSubmitEvidenceResponse. + * @memberof cosmos.evidence.v1beta1 + * @interface IMsgSubmitEvidenceResponse + * @property {Uint8Array|null} [hash] MsgSubmitEvidenceResponse hash + */ + + /** + * Constructs a new MsgSubmitEvidenceResponse. + * @memberof cosmos.evidence.v1beta1 + * @classdesc Represents a MsgSubmitEvidenceResponse. + * @implements IMsgSubmitEvidenceResponse + * @constructor + * @param {cosmos.evidence.v1beta1.IMsgSubmitEvidenceResponse=} [properties] Properties to set + */ + function MsgSubmitEvidenceResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgSubmitEvidenceResponse hash. + * @member {Uint8Array} hash + * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse + * @instance + */ + MsgSubmitEvidenceResponse.prototype.hash = $util.newBuffer([]); + + /** + * Encodes the specified MsgSubmitEvidenceResponse message. Does not implicitly {@link cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse + * @static + * @param {cosmos.evidence.v1beta1.IMsgSubmitEvidenceResponse} message MsgSubmitEvidenceResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgSubmitEvidenceResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.hash != null && Object.hasOwnProperty.call(message, "hash")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.hash); + return writer; + }; + + /** + * Encodes the specified MsgSubmitEvidenceResponse message, length delimited. Does not implicitly {@link cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse + * @static + * @param {cosmos.evidence.v1beta1.IMsgSubmitEvidenceResponse} message MsgSubmitEvidenceResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgSubmitEvidenceResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgSubmitEvidenceResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse} MsgSubmitEvidenceResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgSubmitEvidenceResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 4: + message.hash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgSubmitEvidenceResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse} MsgSubmitEvidenceResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgSubmitEvidenceResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgSubmitEvidenceResponse message. + * @function verify + * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgSubmitEvidenceResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.hash != null && message.hasOwnProperty("hash")) + if (!(message.hash && typeof message.hash.length === "number" || $util.isString(message.hash))) + return "hash: buffer expected"; + return null; + }; + + /** + * Creates a MsgSubmitEvidenceResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse} MsgSubmitEvidenceResponse + */ + MsgSubmitEvidenceResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse) + return object; + let message = new $root.cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse(); + if (object.hash != null) + if (typeof object.hash === "string") + $util.base64.decode(object.hash, message.hash = $util.newBuffer($util.base64.length(object.hash)), 0); + else if (object.hash.length) + message.hash = object.hash; + return message; + }; + + /** + * Creates a plain object from a MsgSubmitEvidenceResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse + * @static + * @param {cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse} message MsgSubmitEvidenceResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgSubmitEvidenceResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + if (options.bytes === String) + object.hash = ""; + else { + object.hash = []; + if (options.bytes !== Array) + object.hash = $util.newBuffer(object.hash); + } + if (message.hash != null && message.hasOwnProperty("hash")) + object.hash = options.bytes === String ? $util.base64.encode(message.hash, 0, message.hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.hash) : message.hash; + return object; + }; + + /** + * Converts this MsgSubmitEvidenceResponse to JSON. + * @function toJSON + * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse + * @instance + * @returns {Object.} JSON object + */ + MsgSubmitEvidenceResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgSubmitEvidenceResponse; + })(); + + v1beta1.Equivocation = (function() { + + /** + * Properties of an Equivocation. + * @memberof cosmos.evidence.v1beta1 + * @interface IEquivocation + * @property {Long|null} [height] Equivocation height + * @property {google.protobuf.ITimestamp|null} [time] Equivocation time + * @property {Long|null} [power] Equivocation power + * @property {string|null} [consensus_address] Equivocation consensus_address + */ + + /** + * Constructs a new Equivocation. + * @memberof cosmos.evidence.v1beta1 + * @classdesc Represents an Equivocation. + * @implements IEquivocation + * @constructor + * @param {cosmos.evidence.v1beta1.IEquivocation=} [properties] Properties to set + */ + function Equivocation(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Equivocation height. + * @member {Long} height + * @memberof cosmos.evidence.v1beta1.Equivocation + * @instance + */ + Equivocation.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Equivocation time. + * @member {google.protobuf.ITimestamp|null|undefined} time + * @memberof cosmos.evidence.v1beta1.Equivocation + * @instance + */ + Equivocation.prototype.time = null; + + /** + * Equivocation power. + * @member {Long} power + * @memberof cosmos.evidence.v1beta1.Equivocation + * @instance + */ + Equivocation.prototype.power = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Equivocation consensus_address. + * @member {string} consensus_address + * @memberof cosmos.evidence.v1beta1.Equivocation + * @instance + */ + Equivocation.prototype.consensus_address = ""; + + /** + * Encodes the specified Equivocation message. Does not implicitly {@link cosmos.evidence.v1beta1.Equivocation.verify|verify} messages. + * @function encode + * @memberof cosmos.evidence.v1beta1.Equivocation + * @static + * @param {cosmos.evidence.v1beta1.IEquivocation} message Equivocation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Equivocation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.height); + if (message.time != null && Object.hasOwnProperty.call(message, "time")) + $root.google.protobuf.Timestamp.encode(message.time, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.power != null && Object.hasOwnProperty.call(message, "power")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.power); + if (message.consensus_address != null && Object.hasOwnProperty.call(message, "consensus_address")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.consensus_address); + return writer; + }; + + /** + * Encodes the specified Equivocation message, length delimited. Does not implicitly {@link cosmos.evidence.v1beta1.Equivocation.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.evidence.v1beta1.Equivocation + * @static + * @param {cosmos.evidence.v1beta1.IEquivocation} message Equivocation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Equivocation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Equivocation message from the specified reader or buffer. + * @function decode + * @memberof cosmos.evidence.v1beta1.Equivocation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.evidence.v1beta1.Equivocation} Equivocation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Equivocation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.evidence.v1beta1.Equivocation(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + case 2: + message.time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.power = reader.int64(); + break; + case 4: + message.consensus_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Equivocation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.evidence.v1beta1.Equivocation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.evidence.v1beta1.Equivocation} Equivocation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Equivocation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Equivocation message. + * @function verify + * @memberof cosmos.evidence.v1beta1.Equivocation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Equivocation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) + return "height: integer|Long expected"; + if (message.time != null && message.hasOwnProperty("time")) { + let error = $root.google.protobuf.Timestamp.verify(message.time); + if (error) + return "time." + error; + } + if (message.power != null && message.hasOwnProperty("power")) + if (!$util.isInteger(message.power) && !(message.power && $util.isInteger(message.power.low) && $util.isInteger(message.power.high))) + return "power: integer|Long expected"; + if (message.consensus_address != null && message.hasOwnProperty("consensus_address")) + if (!$util.isString(message.consensus_address)) + return "consensus_address: string expected"; + return null; + }; + + /** + * Creates an Equivocation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.evidence.v1beta1.Equivocation + * @static + * @param {Object.} object Plain object + * @returns {cosmos.evidence.v1beta1.Equivocation} Equivocation + */ + Equivocation.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.evidence.v1beta1.Equivocation) + return object; + let message = new $root.cosmos.evidence.v1beta1.Equivocation(); + if (object.height != null) + if ($util.Long) + (message.height = $util.Long.fromValue(object.height)).unsigned = false; + else if (typeof object.height === "string") + message.height = parseInt(object.height, 10); + else if (typeof object.height === "number") + message.height = object.height; + else if (typeof object.height === "object") + message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); + if (object.time != null) { + if (typeof object.time !== "object") + throw TypeError(".cosmos.evidence.v1beta1.Equivocation.time: object expected"); + message.time = $root.google.protobuf.Timestamp.fromObject(object.time); + } + if (object.power != null) + if ($util.Long) + (message.power = $util.Long.fromValue(object.power)).unsigned = false; + else if (typeof object.power === "string") + message.power = parseInt(object.power, 10); + else if (typeof object.power === "number") + message.power = object.power; + else if (typeof object.power === "object") + message.power = new $util.LongBits(object.power.low >>> 0, object.power.high >>> 0).toNumber(); + if (object.consensus_address != null) + message.consensus_address = String(object.consensus_address); + return message; + }; + + /** + * Creates a plain object from an Equivocation message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.evidence.v1beta1.Equivocation + * @static + * @param {cosmos.evidence.v1beta1.Equivocation} message Equivocation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Equivocation.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.height = options.longs === String ? "0" : 0; + object.time = null; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.power = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.power = options.longs === String ? "0" : 0; + object.consensus_address = ""; + } + if (message.height != null && message.hasOwnProperty("height")) + if (typeof message.height === "number") + object.height = options.longs === String ? String(message.height) : message.height; + else + object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; + if (message.time != null && message.hasOwnProperty("time")) + object.time = $root.google.protobuf.Timestamp.toObject(message.time, options); + if (message.power != null && message.hasOwnProperty("power")) + if (typeof message.power === "number") + object.power = options.longs === String ? String(message.power) : message.power; + else + object.power = options.longs === String ? $util.Long.prototype.toString.call(message.power) : options.longs === Number ? new $util.LongBits(message.power.low >>> 0, message.power.high >>> 0).toNumber() : message.power; + if (message.consensus_address != null && message.hasOwnProperty("consensus_address")) + object.consensus_address = message.consensus_address; + return object; + }; + + /** + * Converts this Equivocation to JSON. + * @function toJSON + * @memberof cosmos.evidence.v1beta1.Equivocation + * @instance + * @returns {Object.} JSON object + */ + Equivocation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Equivocation; + })(); + + v1beta1.Query = (function() { + + /** + * Constructs a new Query service. + * @memberof cosmos.evidence.v1beta1 + * @classdesc Represents a Query + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Query(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Query.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Query; + + /** + * Callback as used by {@link cosmos.evidence.v1beta1.Query#evidence}. + * @memberof cosmos.evidence.v1beta1.Query + * @typedef EvidenceCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.evidence.v1beta1.QueryEvidenceResponse} [response] QueryEvidenceResponse + */ + + /** + * Calls Evidence. + * @function evidence + * @memberof cosmos.evidence.v1beta1.Query + * @instance + * @param {cosmos.evidence.v1beta1.IQueryEvidenceRequest} request QueryEvidenceRequest message or plain object + * @param {cosmos.evidence.v1beta1.Query.EvidenceCallback} callback Node-style callback called with the error, if any, and QueryEvidenceResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.evidence = function evidence(request, callback) { + return this.rpcCall(evidence, $root.cosmos.evidence.v1beta1.QueryEvidenceRequest, $root.cosmos.evidence.v1beta1.QueryEvidenceResponse, request, callback); + }, "name", { value: "Evidence" }); + + /** + * Calls Evidence. + * @function evidence + * @memberof cosmos.evidence.v1beta1.Query + * @instance + * @param {cosmos.evidence.v1beta1.IQueryEvidenceRequest} request QueryEvidenceRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.evidence.v1beta1.Query#allEvidence}. + * @memberof cosmos.evidence.v1beta1.Query + * @typedef AllEvidenceCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.evidence.v1beta1.QueryAllEvidenceResponse} [response] QueryAllEvidenceResponse + */ + + /** + * Calls AllEvidence. + * @function allEvidence + * @memberof cosmos.evidence.v1beta1.Query + * @instance + * @param {cosmos.evidence.v1beta1.IQueryAllEvidenceRequest} request QueryAllEvidenceRequest message or plain object + * @param {cosmos.evidence.v1beta1.Query.AllEvidenceCallback} callback Node-style callback called with the error, if any, and QueryAllEvidenceResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.allEvidence = function allEvidence(request, callback) { + return this.rpcCall(allEvidence, $root.cosmos.evidence.v1beta1.QueryAllEvidenceRequest, $root.cosmos.evidence.v1beta1.QueryAllEvidenceResponse, request, callback); + }, "name", { value: "AllEvidence" }); + + /** + * Calls AllEvidence. + * @function allEvidence + * @memberof cosmos.evidence.v1beta1.Query + * @instance + * @param {cosmos.evidence.v1beta1.IQueryAllEvidenceRequest} request QueryAllEvidenceRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Query; + })(); + + v1beta1.QueryEvidenceRequest = (function() { + + /** + * Properties of a QueryEvidenceRequest. + * @memberof cosmos.evidence.v1beta1 + * @interface IQueryEvidenceRequest + * @property {Uint8Array|null} [evidence_hash] QueryEvidenceRequest evidence_hash + */ + + /** + * Constructs a new QueryEvidenceRequest. + * @memberof cosmos.evidence.v1beta1 + * @classdesc Represents a QueryEvidenceRequest. + * @implements IQueryEvidenceRequest + * @constructor + * @param {cosmos.evidence.v1beta1.IQueryEvidenceRequest=} [properties] Properties to set + */ + function QueryEvidenceRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryEvidenceRequest evidence_hash. + * @member {Uint8Array} evidence_hash + * @memberof cosmos.evidence.v1beta1.QueryEvidenceRequest + * @instance + */ + QueryEvidenceRequest.prototype.evidence_hash = $util.newBuffer([]); + + /** + * Encodes the specified QueryEvidenceRequest message. Does not implicitly {@link cosmos.evidence.v1beta1.QueryEvidenceRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.evidence.v1beta1.QueryEvidenceRequest + * @static + * @param {cosmos.evidence.v1beta1.IQueryEvidenceRequest} message QueryEvidenceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryEvidenceRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.evidence_hash != null && Object.hasOwnProperty.call(message, "evidence_hash")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.evidence_hash); + return writer; + }; + + /** + * Encodes the specified QueryEvidenceRequest message, length delimited. Does not implicitly {@link cosmos.evidence.v1beta1.QueryEvidenceRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.evidence.v1beta1.QueryEvidenceRequest + * @static + * @param {cosmos.evidence.v1beta1.IQueryEvidenceRequest} message QueryEvidenceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryEvidenceRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryEvidenceRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.evidence.v1beta1.QueryEvidenceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.evidence.v1beta1.QueryEvidenceRequest} QueryEvidenceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryEvidenceRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.evidence.v1beta1.QueryEvidenceRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.evidence_hash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryEvidenceRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.evidence.v1beta1.QueryEvidenceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.evidence.v1beta1.QueryEvidenceRequest} QueryEvidenceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryEvidenceRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryEvidenceRequest message. + * @function verify + * @memberof cosmos.evidence.v1beta1.QueryEvidenceRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryEvidenceRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.evidence_hash != null && message.hasOwnProperty("evidence_hash")) + if (!(message.evidence_hash && typeof message.evidence_hash.length === "number" || $util.isString(message.evidence_hash))) + return "evidence_hash: buffer expected"; + return null; + }; + + /** + * Creates a QueryEvidenceRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.evidence.v1beta1.QueryEvidenceRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.evidence.v1beta1.QueryEvidenceRequest} QueryEvidenceRequest + */ + QueryEvidenceRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.evidence.v1beta1.QueryEvidenceRequest) + return object; + let message = new $root.cosmos.evidence.v1beta1.QueryEvidenceRequest(); + if (object.evidence_hash != null) + if (typeof object.evidence_hash === "string") + $util.base64.decode(object.evidence_hash, message.evidence_hash = $util.newBuffer($util.base64.length(object.evidence_hash)), 0); + else if (object.evidence_hash.length) + message.evidence_hash = object.evidence_hash; + return message; + }; + + /** + * Creates a plain object from a QueryEvidenceRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.evidence.v1beta1.QueryEvidenceRequest + * @static + * @param {cosmos.evidence.v1beta1.QueryEvidenceRequest} message QueryEvidenceRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryEvidenceRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + if (options.bytes === String) + object.evidence_hash = ""; + else { + object.evidence_hash = []; + if (options.bytes !== Array) + object.evidence_hash = $util.newBuffer(object.evidence_hash); + } + if (message.evidence_hash != null && message.hasOwnProperty("evidence_hash")) + object.evidence_hash = options.bytes === String ? $util.base64.encode(message.evidence_hash, 0, message.evidence_hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.evidence_hash) : message.evidence_hash; + return object; + }; + + /** + * Converts this QueryEvidenceRequest to JSON. + * @function toJSON + * @memberof cosmos.evidence.v1beta1.QueryEvidenceRequest + * @instance + * @returns {Object.} JSON object + */ + QueryEvidenceRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryEvidenceRequest; + })(); + + v1beta1.QueryEvidenceResponse = (function() { + + /** + * Properties of a QueryEvidenceResponse. + * @memberof cosmos.evidence.v1beta1 + * @interface IQueryEvidenceResponse + * @property {google.protobuf.IAny|null} [evidence] QueryEvidenceResponse evidence + */ + + /** + * Constructs a new QueryEvidenceResponse. + * @memberof cosmos.evidence.v1beta1 + * @classdesc Represents a QueryEvidenceResponse. + * @implements IQueryEvidenceResponse + * @constructor + * @param {cosmos.evidence.v1beta1.IQueryEvidenceResponse=} [properties] Properties to set + */ + function QueryEvidenceResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryEvidenceResponse evidence. + * @member {google.protobuf.IAny|null|undefined} evidence + * @memberof cosmos.evidence.v1beta1.QueryEvidenceResponse + * @instance + */ + QueryEvidenceResponse.prototype.evidence = null; + + /** + * Encodes the specified QueryEvidenceResponse message. Does not implicitly {@link cosmos.evidence.v1beta1.QueryEvidenceResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.evidence.v1beta1.QueryEvidenceResponse + * @static + * @param {cosmos.evidence.v1beta1.IQueryEvidenceResponse} message QueryEvidenceResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryEvidenceResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.evidence != null && Object.hasOwnProperty.call(message, "evidence")) + $root.google.protobuf.Any.encode(message.evidence, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryEvidenceResponse message, length delimited. Does not implicitly {@link cosmos.evidence.v1beta1.QueryEvidenceResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.evidence.v1beta1.QueryEvidenceResponse + * @static + * @param {cosmos.evidence.v1beta1.IQueryEvidenceResponse} message QueryEvidenceResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryEvidenceResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryEvidenceResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.evidence.v1beta1.QueryEvidenceResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.evidence.v1beta1.QueryEvidenceResponse} QueryEvidenceResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryEvidenceResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.evidence.v1beta1.QueryEvidenceResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.evidence = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryEvidenceResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.evidence.v1beta1.QueryEvidenceResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.evidence.v1beta1.QueryEvidenceResponse} QueryEvidenceResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryEvidenceResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryEvidenceResponse message. + * @function verify + * @memberof cosmos.evidence.v1beta1.QueryEvidenceResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryEvidenceResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.evidence != null && message.hasOwnProperty("evidence")) { + let error = $root.google.protobuf.Any.verify(message.evidence); + if (error) + return "evidence." + error; + } + return null; + }; + + /** + * Creates a QueryEvidenceResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.evidence.v1beta1.QueryEvidenceResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.evidence.v1beta1.QueryEvidenceResponse} QueryEvidenceResponse + */ + QueryEvidenceResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.evidence.v1beta1.QueryEvidenceResponse) + return object; + let message = new $root.cosmos.evidence.v1beta1.QueryEvidenceResponse(); + if (object.evidence != null) { + if (typeof object.evidence !== "object") + throw TypeError(".cosmos.evidence.v1beta1.QueryEvidenceResponse.evidence: object expected"); + message.evidence = $root.google.protobuf.Any.fromObject(object.evidence); + } + return message; + }; + + /** + * Creates a plain object from a QueryEvidenceResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.evidence.v1beta1.QueryEvidenceResponse + * @static + * @param {cosmos.evidence.v1beta1.QueryEvidenceResponse} message QueryEvidenceResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryEvidenceResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.evidence = null; + if (message.evidence != null && message.hasOwnProperty("evidence")) + object.evidence = $root.google.protobuf.Any.toObject(message.evidence, options); + return object; + }; + + /** + * Converts this QueryEvidenceResponse to JSON. + * @function toJSON + * @memberof cosmos.evidence.v1beta1.QueryEvidenceResponse + * @instance + * @returns {Object.} JSON object + */ + QueryEvidenceResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryEvidenceResponse; + })(); + + v1beta1.QueryAllEvidenceRequest = (function() { + + /** + * Properties of a QueryAllEvidenceRequest. + * @memberof cosmos.evidence.v1beta1 + * @interface IQueryAllEvidenceRequest + * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryAllEvidenceRequest pagination + */ + + /** + * Constructs a new QueryAllEvidenceRequest. + * @memberof cosmos.evidence.v1beta1 + * @classdesc Represents a QueryAllEvidenceRequest. + * @implements IQueryAllEvidenceRequest + * @constructor + * @param {cosmos.evidence.v1beta1.IQueryAllEvidenceRequest=} [properties] Properties to set + */ + function QueryAllEvidenceRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryAllEvidenceRequest pagination. + * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination + * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceRequest + * @instance + */ + QueryAllEvidenceRequest.prototype.pagination = null; + + /** + * Encodes the specified QueryAllEvidenceRequest message. Does not implicitly {@link cosmos.evidence.v1beta1.QueryAllEvidenceRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceRequest + * @static + * @param {cosmos.evidence.v1beta1.IQueryAllEvidenceRequest} message QueryAllEvidenceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryAllEvidenceRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryAllEvidenceRequest message, length delimited. Does not implicitly {@link cosmos.evidence.v1beta1.QueryAllEvidenceRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceRequest + * @static + * @param {cosmos.evidence.v1beta1.IQueryAllEvidenceRequest} message QueryAllEvidenceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryAllEvidenceRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryAllEvidenceRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.evidence.v1beta1.QueryAllEvidenceRequest} QueryAllEvidenceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryAllEvidenceRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.evidence.v1beta1.QueryAllEvidenceRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryAllEvidenceRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.evidence.v1beta1.QueryAllEvidenceRequest} QueryAllEvidenceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryAllEvidenceRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryAllEvidenceRequest message. + * @function verify + * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryAllEvidenceRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryAllEvidenceRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.evidence.v1beta1.QueryAllEvidenceRequest} QueryAllEvidenceRequest + */ + QueryAllEvidenceRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.evidence.v1beta1.QueryAllEvidenceRequest) + return object; + let message = new $root.cosmos.evidence.v1beta1.QueryAllEvidenceRequest(); + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.evidence.v1beta1.QueryAllEvidenceRequest.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryAllEvidenceRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceRequest + * @static + * @param {cosmos.evidence.v1beta1.QueryAllEvidenceRequest} message QueryAllEvidenceRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryAllEvidenceRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.pagination = null; + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryAllEvidenceRequest to JSON. + * @function toJSON + * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceRequest + * @instance + * @returns {Object.} JSON object + */ + QueryAllEvidenceRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryAllEvidenceRequest; + })(); + + v1beta1.QueryAllEvidenceResponse = (function() { + + /** + * Properties of a QueryAllEvidenceResponse. + * @memberof cosmos.evidence.v1beta1 + * @interface IQueryAllEvidenceResponse + * @property {Array.|null} [evidence] QueryAllEvidenceResponse evidence + * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryAllEvidenceResponse pagination + */ + + /** + * Constructs a new QueryAllEvidenceResponse. + * @memberof cosmos.evidence.v1beta1 + * @classdesc Represents a QueryAllEvidenceResponse. + * @implements IQueryAllEvidenceResponse + * @constructor + * @param {cosmos.evidence.v1beta1.IQueryAllEvidenceResponse=} [properties] Properties to set + */ + function QueryAllEvidenceResponse(properties) { + this.evidence = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryAllEvidenceResponse evidence. + * @member {Array.} evidence + * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceResponse + * @instance + */ + QueryAllEvidenceResponse.prototype.evidence = $util.emptyArray; + + /** + * QueryAllEvidenceResponse pagination. + * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination + * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceResponse + * @instance + */ + QueryAllEvidenceResponse.prototype.pagination = null; + + /** + * Encodes the specified QueryAllEvidenceResponse message. Does not implicitly {@link cosmos.evidence.v1beta1.QueryAllEvidenceResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceResponse + * @static + * @param {cosmos.evidence.v1beta1.IQueryAllEvidenceResponse} message QueryAllEvidenceResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryAllEvidenceResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.evidence != null && message.evidence.length) + for (let i = 0; i < message.evidence.length; ++i) + $root.google.protobuf.Any.encode(message.evidence[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryAllEvidenceResponse message, length delimited. Does not implicitly {@link cosmos.evidence.v1beta1.QueryAllEvidenceResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceResponse + * @static + * @param {cosmos.evidence.v1beta1.IQueryAllEvidenceResponse} message QueryAllEvidenceResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryAllEvidenceResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryAllEvidenceResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.evidence.v1beta1.QueryAllEvidenceResponse} QueryAllEvidenceResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryAllEvidenceResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.evidence.v1beta1.QueryAllEvidenceResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.evidence && message.evidence.length)) + message.evidence = []; + message.evidence.push($root.google.protobuf.Any.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryAllEvidenceResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.evidence.v1beta1.QueryAllEvidenceResponse} QueryAllEvidenceResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryAllEvidenceResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryAllEvidenceResponse message. + * @function verify + * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryAllEvidenceResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.evidence != null && message.hasOwnProperty("evidence")) { + if (!Array.isArray(message.evidence)) + return "evidence: array expected"; + for (let i = 0; i < message.evidence.length; ++i) { + let error = $root.google.protobuf.Any.verify(message.evidence[i]); + if (error) + return "evidence." + error; + } + } + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryAllEvidenceResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.evidence.v1beta1.QueryAllEvidenceResponse} QueryAllEvidenceResponse + */ + QueryAllEvidenceResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.evidence.v1beta1.QueryAllEvidenceResponse) + return object; + let message = new $root.cosmos.evidence.v1beta1.QueryAllEvidenceResponse(); + if (object.evidence) { + if (!Array.isArray(object.evidence)) + throw TypeError(".cosmos.evidence.v1beta1.QueryAllEvidenceResponse.evidence: array expected"); + message.evidence = []; + for (let i = 0; i < object.evidence.length; ++i) { + if (typeof object.evidence[i] !== "object") + throw TypeError(".cosmos.evidence.v1beta1.QueryAllEvidenceResponse.evidence: object expected"); + message.evidence[i] = $root.google.protobuf.Any.fromObject(object.evidence[i]); + } + } + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.evidence.v1beta1.QueryAllEvidenceResponse.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryAllEvidenceResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceResponse + * @static + * @param {cosmos.evidence.v1beta1.QueryAllEvidenceResponse} message QueryAllEvidenceResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryAllEvidenceResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.evidence = []; + if (options.defaults) + object.pagination = null; + if (message.evidence && message.evidence.length) { + object.evidence = []; + for (let j = 0; j < message.evidence.length; ++j) + object.evidence[j] = $root.google.protobuf.Any.toObject(message.evidence[j], options); + } + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryAllEvidenceResponse to JSON. + * @function toJSON + * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceResponse + * @instance + * @returns {Object.} JSON object + */ + QueryAllEvidenceResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryAllEvidenceResponse; + })(); + + v1beta1.GenesisState = (function() { + + /** + * Properties of a GenesisState. + * @memberof cosmos.evidence.v1beta1 + * @interface IGenesisState + * @property {Array.|null} [evidence] GenesisState evidence + */ + + /** + * Constructs a new GenesisState. + * @memberof cosmos.evidence.v1beta1 + * @classdesc Represents a GenesisState. + * @implements IGenesisState + * @constructor + * @param {cosmos.evidence.v1beta1.IGenesisState=} [properties] Properties to set + */ + function GenesisState(properties) { + this.evidence = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenesisState evidence. + * @member {Array.} evidence + * @memberof cosmos.evidence.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.evidence = $util.emptyArray; + + /** + * Encodes the specified GenesisState message. Does not implicitly {@link cosmos.evidence.v1beta1.GenesisState.verify|verify} messages. + * @function encode + * @memberof cosmos.evidence.v1beta1.GenesisState + * @static + * @param {cosmos.evidence.v1beta1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.evidence != null && message.evidence.length) + for (let i = 0; i < message.evidence.length; ++i) + $root.google.protobuf.Any.encode(message.evidence[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link cosmos.evidence.v1beta1.GenesisState.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.evidence.v1beta1.GenesisState + * @static + * @param {cosmos.evidence.v1beta1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer. + * @function decode + * @memberof cosmos.evidence.v1beta1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.evidence.v1beta1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.evidence.v1beta1.GenesisState(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.evidence && message.evidence.length)) + message.evidence = []; + message.evidence.push($root.google.protobuf.Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.evidence.v1beta1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.evidence.v1beta1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenesisState message. + * @function verify + * @memberof cosmos.evidence.v1beta1.GenesisState + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenesisState.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.evidence != null && message.hasOwnProperty("evidence")) { + if (!Array.isArray(message.evidence)) + return "evidence: array expected"; + for (let i = 0; i < message.evidence.length; ++i) { + let error = $root.google.protobuf.Any.verify(message.evidence[i]); + if (error) + return "evidence." + error; + } + } + return null; + }; + + /** + * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.evidence.v1beta1.GenesisState + * @static + * @param {Object.} object Plain object + * @returns {cosmos.evidence.v1beta1.GenesisState} GenesisState + */ + GenesisState.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.evidence.v1beta1.GenesisState) + return object; + let message = new $root.cosmos.evidence.v1beta1.GenesisState(); + if (object.evidence) { + if (!Array.isArray(object.evidence)) + throw TypeError(".cosmos.evidence.v1beta1.GenesisState.evidence: array expected"); + message.evidence = []; + for (let i = 0; i < object.evidence.length; ++i) { + if (typeof object.evidence[i] !== "object") + throw TypeError(".cosmos.evidence.v1beta1.GenesisState.evidence: object expected"); + message.evidence[i] = $root.google.protobuf.Any.fromObject(object.evidence[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a GenesisState message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.evidence.v1beta1.GenesisState + * @static + * @param {cosmos.evidence.v1beta1.GenesisState} message GenesisState + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenesisState.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.evidence = []; + if (message.evidence && message.evidence.length) { + object.evidence = []; + for (let j = 0; j < message.evidence.length; ++j) + object.evidence[j] = $root.google.protobuf.Any.toObject(message.evidence[j], options); + } + return object; + }; + + /** + * Converts this GenesisState to JSON. + * @function toJSON + * @memberof cosmos.evidence.v1beta1.GenesisState + * @instance + * @returns {Object.} JSON object + */ + GenesisState.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenesisState; + })(); + + return v1beta1; + })(); + + return evidence; + })(); + + cosmos.genutil = (function() { + + /** + * Namespace genutil. + * @memberof cosmos + * @namespace + */ + const genutil = {}; + + genutil.v1beta1 = (function() { + + /** + * Namespace v1beta1. + * @memberof cosmos.genutil + * @namespace + */ + const v1beta1 = {}; + + v1beta1.GenesisState = (function() { + + /** + * Properties of a GenesisState. + * @memberof cosmos.genutil.v1beta1 + * @interface IGenesisState + * @property {Array.|null} [gen_txs] GenesisState gen_txs + */ + + /** + * Constructs a new GenesisState. + * @memberof cosmos.genutil.v1beta1 + * @classdesc Represents a GenesisState. + * @implements IGenesisState + * @constructor + * @param {cosmos.genutil.v1beta1.IGenesisState=} [properties] Properties to set + */ + function GenesisState(properties) { + this.gen_txs = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenesisState gen_txs. + * @member {Array.} gen_txs + * @memberof cosmos.genutil.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.gen_txs = $util.emptyArray; + + /** + * Encodes the specified GenesisState message. Does not implicitly {@link cosmos.genutil.v1beta1.GenesisState.verify|verify} messages. + * @function encode + * @memberof cosmos.genutil.v1beta1.GenesisState + * @static + * @param {cosmos.genutil.v1beta1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gen_txs != null && message.gen_txs.length) + for (let i = 0; i < message.gen_txs.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.gen_txs[i]); + return writer; + }; + + /** + * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link cosmos.genutil.v1beta1.GenesisState.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.genutil.v1beta1.GenesisState + * @static + * @param {cosmos.genutil.v1beta1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer. + * @function decode + * @memberof cosmos.genutil.v1beta1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.genutil.v1beta1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.genutil.v1beta1.GenesisState(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.gen_txs && message.gen_txs.length)) + message.gen_txs = []; + message.gen_txs.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.genutil.v1beta1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.genutil.v1beta1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenesisState message. + * @function verify + * @memberof cosmos.genutil.v1beta1.GenesisState + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenesisState.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.gen_txs != null && message.hasOwnProperty("gen_txs")) { + if (!Array.isArray(message.gen_txs)) + return "gen_txs: array expected"; + for (let i = 0; i < message.gen_txs.length; ++i) + if (!(message.gen_txs[i] && typeof message.gen_txs[i].length === "number" || $util.isString(message.gen_txs[i]))) + return "gen_txs: buffer[] expected"; + } + return null; + }; + + /** + * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.genutil.v1beta1.GenesisState + * @static + * @param {Object.} object Plain object + * @returns {cosmos.genutil.v1beta1.GenesisState} GenesisState + */ + GenesisState.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.genutil.v1beta1.GenesisState) + return object; + let message = new $root.cosmos.genutil.v1beta1.GenesisState(); + if (object.gen_txs) { + if (!Array.isArray(object.gen_txs)) + throw TypeError(".cosmos.genutil.v1beta1.GenesisState.gen_txs: array expected"); + message.gen_txs = []; + for (let i = 0; i < object.gen_txs.length; ++i) + if (typeof object.gen_txs[i] === "string") + $util.base64.decode(object.gen_txs[i], message.gen_txs[i] = $util.newBuffer($util.base64.length(object.gen_txs[i])), 0); + else if (object.gen_txs[i].length) + message.gen_txs[i] = object.gen_txs[i]; + } + return message; + }; + + /** + * Creates a plain object from a GenesisState message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.genutil.v1beta1.GenesisState + * @static + * @param {cosmos.genutil.v1beta1.GenesisState} message GenesisState + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenesisState.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.gen_txs = []; + if (message.gen_txs && message.gen_txs.length) { + object.gen_txs = []; + for (let j = 0; j < message.gen_txs.length; ++j) + object.gen_txs[j] = options.bytes === String ? $util.base64.encode(message.gen_txs[j], 0, message.gen_txs[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.gen_txs[j]) : message.gen_txs[j]; + } + return object; + }; + + /** + * Converts this GenesisState to JSON. + * @function toJSON + * @memberof cosmos.genutil.v1beta1.GenesisState + * @instance + * @returns {Object.} JSON object + */ + GenesisState.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenesisState; + })(); + + return v1beta1; + })(); + + return genutil; + })(); + + cosmos.gov = (function() { + + /** + * Namespace gov. + * @memberof cosmos + * @namespace + */ + const gov = {}; + + gov.v1beta1 = (function() { + + /** + * Namespace v1beta1. + * @memberof cosmos.gov + * @namespace + */ + const v1beta1 = {}; + + v1beta1.Msg = (function() { + + /** + * Constructs a new Msg service. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a Msg + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Msg(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Msg.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Msg; + + /** + * Callback as used by {@link cosmos.gov.v1beta1.Msg#submitProposal}. + * @memberof cosmos.gov.v1beta1.Msg + * @typedef SubmitProposalCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.gov.v1beta1.MsgSubmitProposalResponse} [response] MsgSubmitProposalResponse + */ + + /** + * Calls SubmitProposal. + * @function submitProposal + * @memberof cosmos.gov.v1beta1.Msg + * @instance + * @param {cosmos.gov.v1beta1.IMsgSubmitProposal} request MsgSubmitProposal message or plain object + * @param {cosmos.gov.v1beta1.Msg.SubmitProposalCallback} callback Node-style callback called with the error, if any, and MsgSubmitProposalResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.submitProposal = function submitProposal(request, callback) { + return this.rpcCall(submitProposal, $root.cosmos.gov.v1beta1.MsgSubmitProposal, $root.cosmos.gov.v1beta1.MsgSubmitProposalResponse, request, callback); + }, "name", { value: "SubmitProposal" }); + + /** + * Calls SubmitProposal. + * @function submitProposal + * @memberof cosmos.gov.v1beta1.Msg + * @instance + * @param {cosmos.gov.v1beta1.IMsgSubmitProposal} request MsgSubmitProposal message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.gov.v1beta1.Msg#vote}. + * @memberof cosmos.gov.v1beta1.Msg + * @typedef VoteCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.gov.v1beta1.MsgVoteResponse} [response] MsgVoteResponse + */ + + /** + * Calls Vote. + * @function vote + * @memberof cosmos.gov.v1beta1.Msg + * @instance + * @param {cosmos.gov.v1beta1.IMsgVote} request MsgVote message or plain object + * @param {cosmos.gov.v1beta1.Msg.VoteCallback} callback Node-style callback called with the error, if any, and MsgVoteResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.vote = function vote(request, callback) { + return this.rpcCall(vote, $root.cosmos.gov.v1beta1.MsgVote, $root.cosmos.gov.v1beta1.MsgVoteResponse, request, callback); + }, "name", { value: "Vote" }); + + /** + * Calls Vote. + * @function vote + * @memberof cosmos.gov.v1beta1.Msg + * @instance + * @param {cosmos.gov.v1beta1.IMsgVote} request MsgVote message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.gov.v1beta1.Msg#deposit}. + * @memberof cosmos.gov.v1beta1.Msg + * @typedef DepositCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.gov.v1beta1.MsgDepositResponse} [response] MsgDepositResponse + */ + + /** + * Calls Deposit. + * @function deposit + * @memberof cosmos.gov.v1beta1.Msg + * @instance + * @param {cosmos.gov.v1beta1.IMsgDeposit} request MsgDeposit message or plain object + * @param {cosmos.gov.v1beta1.Msg.DepositCallback} callback Node-style callback called with the error, if any, and MsgDepositResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.deposit = function deposit(request, callback) { + return this.rpcCall(deposit, $root.cosmos.gov.v1beta1.MsgDeposit, $root.cosmos.gov.v1beta1.MsgDepositResponse, request, callback); + }, "name", { value: "Deposit" }); + + /** + * Calls Deposit. + * @function deposit + * @memberof cosmos.gov.v1beta1.Msg + * @instance + * @param {cosmos.gov.v1beta1.IMsgDeposit} request MsgDeposit message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Msg; + })(); + + v1beta1.MsgSubmitProposal = (function() { + + /** + * Properties of a MsgSubmitProposal. + * @memberof cosmos.gov.v1beta1 + * @interface IMsgSubmitProposal + * @property {google.protobuf.IAny|null} [content] MsgSubmitProposal content + * @property {Array.|null} [initial_deposit] MsgSubmitProposal initial_deposit + * @property {string|null} [proposer] MsgSubmitProposal proposer + */ + + /** + * Constructs a new MsgSubmitProposal. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a MsgSubmitProposal. + * @implements IMsgSubmitProposal + * @constructor + * @param {cosmos.gov.v1beta1.IMsgSubmitProposal=} [properties] Properties to set + */ + function MsgSubmitProposal(properties) { + this.initial_deposit = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgSubmitProposal content. + * @member {google.protobuf.IAny|null|undefined} content + * @memberof cosmos.gov.v1beta1.MsgSubmitProposal + * @instance + */ + MsgSubmitProposal.prototype.content = null; + + /** + * MsgSubmitProposal initial_deposit. + * @member {Array.} initial_deposit + * @memberof cosmos.gov.v1beta1.MsgSubmitProposal + * @instance + */ + MsgSubmitProposal.prototype.initial_deposit = $util.emptyArray; + + /** + * MsgSubmitProposal proposer. + * @member {string} proposer + * @memberof cosmos.gov.v1beta1.MsgSubmitProposal + * @instance + */ + MsgSubmitProposal.prototype.proposer = ""; + + /** + * Encodes the specified MsgSubmitProposal message. Does not implicitly {@link cosmos.gov.v1beta1.MsgSubmitProposal.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.MsgSubmitProposal + * @static + * @param {cosmos.gov.v1beta1.IMsgSubmitProposal} message MsgSubmitProposal message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgSubmitProposal.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.content != null && Object.hasOwnProperty.call(message, "content")) + $root.google.protobuf.Any.encode(message.content, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.initial_deposit != null && message.initial_deposit.length) + for (let i = 0; i < message.initial_deposit.length; ++i) + $root.cosmos.base.v1beta1.Coin.encode(message.initial_deposit[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.proposer != null && Object.hasOwnProperty.call(message, "proposer")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.proposer); + return writer; + }; + + /** + * Encodes the specified MsgSubmitProposal message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.MsgSubmitProposal.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.MsgSubmitProposal + * @static + * @param {cosmos.gov.v1beta1.IMsgSubmitProposal} message MsgSubmitProposal message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgSubmitProposal.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgSubmitProposal message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.MsgSubmitProposal + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.MsgSubmitProposal} MsgSubmitProposal + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgSubmitProposal.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.MsgSubmitProposal(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.content = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.initial_deposit && message.initial_deposit.length)) + message.initial_deposit = []; + message.initial_deposit.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); + break; + case 3: + message.proposer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgSubmitProposal message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.MsgSubmitProposal + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.MsgSubmitProposal} MsgSubmitProposal + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgSubmitProposal.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgSubmitProposal message. + * @function verify + * @memberof cosmos.gov.v1beta1.MsgSubmitProposal + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgSubmitProposal.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.content != null && message.hasOwnProperty("content")) { + let error = $root.google.protobuf.Any.verify(message.content); + if (error) + return "content." + error; + } + if (message.initial_deposit != null && message.hasOwnProperty("initial_deposit")) { + if (!Array.isArray(message.initial_deposit)) + return "initial_deposit: array expected"; + for (let i = 0; i < message.initial_deposit.length; ++i) { + let error = $root.cosmos.base.v1beta1.Coin.verify(message.initial_deposit[i]); + if (error) + return "initial_deposit." + error; + } + } + if (message.proposer != null && message.hasOwnProperty("proposer")) + if (!$util.isString(message.proposer)) + return "proposer: string expected"; + return null; + }; + + /** + * Creates a MsgSubmitProposal message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.MsgSubmitProposal + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.MsgSubmitProposal} MsgSubmitProposal + */ + MsgSubmitProposal.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.MsgSubmitProposal) + return object; + let message = new $root.cosmos.gov.v1beta1.MsgSubmitProposal(); + if (object.content != null) { + if (typeof object.content !== "object") + throw TypeError(".cosmos.gov.v1beta1.MsgSubmitProposal.content: object expected"); + message.content = $root.google.protobuf.Any.fromObject(object.content); + } + if (object.initial_deposit) { + if (!Array.isArray(object.initial_deposit)) + throw TypeError(".cosmos.gov.v1beta1.MsgSubmitProposal.initial_deposit: array expected"); + message.initial_deposit = []; + for (let i = 0; i < object.initial_deposit.length; ++i) { + if (typeof object.initial_deposit[i] !== "object") + throw TypeError(".cosmos.gov.v1beta1.MsgSubmitProposal.initial_deposit: object expected"); + message.initial_deposit[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.initial_deposit[i]); + } + } + if (object.proposer != null) + message.proposer = String(object.proposer); + return message; + }; + + /** + * Creates a plain object from a MsgSubmitProposal message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.MsgSubmitProposal + * @static + * @param {cosmos.gov.v1beta1.MsgSubmitProposal} message MsgSubmitProposal + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgSubmitProposal.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.initial_deposit = []; + if (options.defaults) { + object.content = null; + object.proposer = ""; + } + if (message.content != null && message.hasOwnProperty("content")) + object.content = $root.google.protobuf.Any.toObject(message.content, options); + if (message.initial_deposit && message.initial_deposit.length) { + object.initial_deposit = []; + for (let j = 0; j < message.initial_deposit.length; ++j) + object.initial_deposit[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.initial_deposit[j], options); + } + if (message.proposer != null && message.hasOwnProperty("proposer")) + object.proposer = message.proposer; + return object; + }; + + /** + * Converts this MsgSubmitProposal to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.MsgSubmitProposal + * @instance + * @returns {Object.} JSON object + */ + MsgSubmitProposal.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgSubmitProposal; + })(); + + v1beta1.MsgSubmitProposalResponse = (function() { + + /** + * Properties of a MsgSubmitProposalResponse. + * @memberof cosmos.gov.v1beta1 + * @interface IMsgSubmitProposalResponse + * @property {Long|null} [proposal_id] MsgSubmitProposalResponse proposal_id + */ + + /** + * Constructs a new MsgSubmitProposalResponse. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a MsgSubmitProposalResponse. + * @implements IMsgSubmitProposalResponse + * @constructor + * @param {cosmos.gov.v1beta1.IMsgSubmitProposalResponse=} [properties] Properties to set + */ + function MsgSubmitProposalResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgSubmitProposalResponse proposal_id. + * @member {Long} proposal_id + * @memberof cosmos.gov.v1beta1.MsgSubmitProposalResponse + * @instance + */ + MsgSubmitProposalResponse.prototype.proposal_id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified MsgSubmitProposalResponse message. Does not implicitly {@link cosmos.gov.v1beta1.MsgSubmitProposalResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.MsgSubmitProposalResponse + * @static + * @param {cosmos.gov.v1beta1.IMsgSubmitProposalResponse} message MsgSubmitProposalResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgSubmitProposalResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.proposal_id != null && Object.hasOwnProperty.call(message, "proposal_id")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.proposal_id); + return writer; + }; + + /** + * Encodes the specified MsgSubmitProposalResponse message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.MsgSubmitProposalResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.MsgSubmitProposalResponse + * @static + * @param {cosmos.gov.v1beta1.IMsgSubmitProposalResponse} message MsgSubmitProposalResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgSubmitProposalResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgSubmitProposalResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.MsgSubmitProposalResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.MsgSubmitProposalResponse} MsgSubmitProposalResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgSubmitProposalResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.MsgSubmitProposalResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal_id = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgSubmitProposalResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.MsgSubmitProposalResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.MsgSubmitProposalResponse} MsgSubmitProposalResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgSubmitProposalResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgSubmitProposalResponse message. + * @function verify + * @memberof cosmos.gov.v1beta1.MsgSubmitProposalResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgSubmitProposalResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) + if (!$util.isInteger(message.proposal_id) && !(message.proposal_id && $util.isInteger(message.proposal_id.low) && $util.isInteger(message.proposal_id.high))) + return "proposal_id: integer|Long expected"; + return null; + }; + + /** + * Creates a MsgSubmitProposalResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.MsgSubmitProposalResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.MsgSubmitProposalResponse} MsgSubmitProposalResponse + */ + MsgSubmitProposalResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.MsgSubmitProposalResponse) + return object; + let message = new $root.cosmos.gov.v1beta1.MsgSubmitProposalResponse(); + if (object.proposal_id != null) + if ($util.Long) + (message.proposal_id = $util.Long.fromValue(object.proposal_id)).unsigned = true; + else if (typeof object.proposal_id === "string") + message.proposal_id = parseInt(object.proposal_id, 10); + else if (typeof object.proposal_id === "number") + message.proposal_id = object.proposal_id; + else if (typeof object.proposal_id === "object") + message.proposal_id = new $util.LongBits(object.proposal_id.low >>> 0, object.proposal_id.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a MsgSubmitProposalResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.MsgSubmitProposalResponse + * @static + * @param {cosmos.gov.v1beta1.MsgSubmitProposalResponse} message MsgSubmitProposalResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgSubmitProposalResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.proposal_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.proposal_id = options.longs === String ? "0" : 0; + if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) + if (typeof message.proposal_id === "number") + object.proposal_id = options.longs === String ? String(message.proposal_id) : message.proposal_id; + else + object.proposal_id = options.longs === String ? $util.Long.prototype.toString.call(message.proposal_id) : options.longs === Number ? new $util.LongBits(message.proposal_id.low >>> 0, message.proposal_id.high >>> 0).toNumber(true) : message.proposal_id; + return object; + }; + + /** + * Converts this MsgSubmitProposalResponse to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.MsgSubmitProposalResponse + * @instance + * @returns {Object.} JSON object + */ + MsgSubmitProposalResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgSubmitProposalResponse; + })(); + + v1beta1.MsgVote = (function() { + + /** + * Properties of a MsgVote. + * @memberof cosmos.gov.v1beta1 + * @interface IMsgVote + * @property {Long|null} [proposal_id] MsgVote proposal_id + * @property {string|null} [voter] MsgVote voter + * @property {cosmos.gov.v1beta1.VoteOption|null} [option] MsgVote option + */ + + /** + * Constructs a new MsgVote. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a MsgVote. + * @implements IMsgVote + * @constructor + * @param {cosmos.gov.v1beta1.IMsgVote=} [properties] Properties to set + */ + function MsgVote(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgVote proposal_id. + * @member {Long} proposal_id + * @memberof cosmos.gov.v1beta1.MsgVote + * @instance + */ + MsgVote.prototype.proposal_id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * MsgVote voter. + * @member {string} voter + * @memberof cosmos.gov.v1beta1.MsgVote + * @instance + */ + MsgVote.prototype.voter = ""; + + /** + * MsgVote option. + * @member {cosmos.gov.v1beta1.VoteOption} option + * @memberof cosmos.gov.v1beta1.MsgVote + * @instance + */ + MsgVote.prototype.option = 0; + + /** + * Encodes the specified MsgVote message. Does not implicitly {@link cosmos.gov.v1beta1.MsgVote.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.MsgVote + * @static + * @param {cosmos.gov.v1beta1.IMsgVote} message MsgVote message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgVote.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.proposal_id != null && Object.hasOwnProperty.call(message, "proposal_id")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.proposal_id); + if (message.voter != null && Object.hasOwnProperty.call(message, "voter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.voter); + if (message.option != null && Object.hasOwnProperty.call(message, "option")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.option); + return writer; + }; + + /** + * Encodes the specified MsgVote message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.MsgVote.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.MsgVote + * @static + * @param {cosmos.gov.v1beta1.IMsgVote} message MsgVote message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgVote.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgVote message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.MsgVote + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.MsgVote} MsgVote + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgVote.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.MsgVote(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal_id = reader.uint64(); + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.option = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgVote message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.MsgVote + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.MsgVote} MsgVote + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgVote.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgVote message. + * @function verify + * @memberof cosmos.gov.v1beta1.MsgVote + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgVote.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) + if (!$util.isInteger(message.proposal_id) && !(message.proposal_id && $util.isInteger(message.proposal_id.low) && $util.isInteger(message.proposal_id.high))) + return "proposal_id: integer|Long expected"; + if (message.voter != null && message.hasOwnProperty("voter")) + if (!$util.isString(message.voter)) + return "voter: string expected"; + if (message.option != null && message.hasOwnProperty("option")) + switch (message.option) { + default: + return "option: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + return null; + }; + + /** + * Creates a MsgVote message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.MsgVote + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.MsgVote} MsgVote + */ + MsgVote.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.MsgVote) + return object; + let message = new $root.cosmos.gov.v1beta1.MsgVote(); + if (object.proposal_id != null) + if ($util.Long) + (message.proposal_id = $util.Long.fromValue(object.proposal_id)).unsigned = true; + else if (typeof object.proposal_id === "string") + message.proposal_id = parseInt(object.proposal_id, 10); + else if (typeof object.proposal_id === "number") + message.proposal_id = object.proposal_id; + else if (typeof object.proposal_id === "object") + message.proposal_id = new $util.LongBits(object.proposal_id.low >>> 0, object.proposal_id.high >>> 0).toNumber(true); + if (object.voter != null) + message.voter = String(object.voter); + switch (object.option) { + case "VOTE_OPTION_UNSPECIFIED": + case 0: + message.option = 0; + break; + case "VOTE_OPTION_YES": + case 1: + message.option = 1; + break; + case "VOTE_OPTION_ABSTAIN": + case 2: + message.option = 2; + break; + case "VOTE_OPTION_NO": + case 3: + message.option = 3; + break; + case "VOTE_OPTION_NO_WITH_VETO": + case 4: + message.option = 4; + break; + } + return message; + }; + + /** + * Creates a plain object from a MsgVote message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.MsgVote + * @static + * @param {cosmos.gov.v1beta1.MsgVote} message MsgVote + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgVote.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.proposal_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.proposal_id = options.longs === String ? "0" : 0; + object.voter = ""; + object.option = options.enums === String ? "VOTE_OPTION_UNSPECIFIED" : 0; + } + if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) + if (typeof message.proposal_id === "number") + object.proposal_id = options.longs === String ? String(message.proposal_id) : message.proposal_id; + else + object.proposal_id = options.longs === String ? $util.Long.prototype.toString.call(message.proposal_id) : options.longs === Number ? new $util.LongBits(message.proposal_id.low >>> 0, message.proposal_id.high >>> 0).toNumber(true) : message.proposal_id; + if (message.voter != null && message.hasOwnProperty("voter")) + object.voter = message.voter; + if (message.option != null && message.hasOwnProperty("option")) + object.option = options.enums === String ? $root.cosmos.gov.v1beta1.VoteOption[message.option] : message.option; + return object; + }; + + /** + * Converts this MsgVote to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.MsgVote + * @instance + * @returns {Object.} JSON object + */ + MsgVote.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgVote; + })(); + + v1beta1.MsgVoteResponse = (function() { + + /** + * Properties of a MsgVoteResponse. + * @memberof cosmos.gov.v1beta1 + * @interface IMsgVoteResponse + */ + + /** + * Constructs a new MsgVoteResponse. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a MsgVoteResponse. + * @implements IMsgVoteResponse + * @constructor + * @param {cosmos.gov.v1beta1.IMsgVoteResponse=} [properties] Properties to set + */ + function MsgVoteResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgVoteResponse message. Does not implicitly {@link cosmos.gov.v1beta1.MsgVoteResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.MsgVoteResponse + * @static + * @param {cosmos.gov.v1beta1.IMsgVoteResponse} message MsgVoteResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgVoteResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgVoteResponse message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.MsgVoteResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.MsgVoteResponse + * @static + * @param {cosmos.gov.v1beta1.IMsgVoteResponse} message MsgVoteResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgVoteResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgVoteResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.MsgVoteResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.MsgVoteResponse} MsgVoteResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgVoteResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.MsgVoteResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgVoteResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.MsgVoteResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.MsgVoteResponse} MsgVoteResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgVoteResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgVoteResponse message. + * @function verify + * @memberof cosmos.gov.v1beta1.MsgVoteResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgVoteResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgVoteResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.MsgVoteResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.MsgVoteResponse} MsgVoteResponse + */ + MsgVoteResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.MsgVoteResponse) + return object; + return new $root.cosmos.gov.v1beta1.MsgVoteResponse(); + }; + + /** + * Creates a plain object from a MsgVoteResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.MsgVoteResponse + * @static + * @param {cosmos.gov.v1beta1.MsgVoteResponse} message MsgVoteResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgVoteResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgVoteResponse to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.MsgVoteResponse + * @instance + * @returns {Object.} JSON object + */ + MsgVoteResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgVoteResponse; + })(); + + v1beta1.MsgDeposit = (function() { + + /** + * Properties of a MsgDeposit. + * @memberof cosmos.gov.v1beta1 + * @interface IMsgDeposit + * @property {Long|null} [proposal_id] MsgDeposit proposal_id + * @property {string|null} [depositor] MsgDeposit depositor + * @property {Array.|null} [amount] MsgDeposit amount + */ + + /** + * Constructs a new MsgDeposit. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a MsgDeposit. + * @implements IMsgDeposit + * @constructor + * @param {cosmos.gov.v1beta1.IMsgDeposit=} [properties] Properties to set + */ + function MsgDeposit(properties) { + this.amount = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgDeposit proposal_id. + * @member {Long} proposal_id + * @memberof cosmos.gov.v1beta1.MsgDeposit + * @instance + */ + MsgDeposit.prototype.proposal_id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * MsgDeposit depositor. + * @member {string} depositor + * @memberof cosmos.gov.v1beta1.MsgDeposit + * @instance + */ + MsgDeposit.prototype.depositor = ""; + + /** + * MsgDeposit amount. + * @member {Array.} amount + * @memberof cosmos.gov.v1beta1.MsgDeposit + * @instance + */ + MsgDeposit.prototype.amount = $util.emptyArray; + + /** + * Encodes the specified MsgDeposit message. Does not implicitly {@link cosmos.gov.v1beta1.MsgDeposit.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.MsgDeposit + * @static + * @param {cosmos.gov.v1beta1.IMsgDeposit} message MsgDeposit message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgDeposit.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.proposal_id != null && Object.hasOwnProperty.call(message, "proposal_id")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.proposal_id); + if (message.depositor != null && Object.hasOwnProperty.call(message, "depositor")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.depositor); + if (message.amount != null && message.amount.length) + for (let i = 0; i < message.amount.length; ++i) + $root.cosmos.base.v1beta1.Coin.encode(message.amount[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MsgDeposit message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.MsgDeposit.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.MsgDeposit + * @static + * @param {cosmos.gov.v1beta1.IMsgDeposit} message MsgDeposit message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgDeposit.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgDeposit message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.MsgDeposit + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.MsgDeposit} MsgDeposit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgDeposit.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.MsgDeposit(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal_id = reader.uint64(); + break; + case 2: + message.depositor = reader.string(); + break; + case 3: + if (!(message.amount && message.amount.length)) + message.amount = []; + message.amount.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgDeposit message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.MsgDeposit + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.MsgDeposit} MsgDeposit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgDeposit.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgDeposit message. + * @function verify + * @memberof cosmos.gov.v1beta1.MsgDeposit + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgDeposit.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) + if (!$util.isInteger(message.proposal_id) && !(message.proposal_id && $util.isInteger(message.proposal_id.low) && $util.isInteger(message.proposal_id.high))) + return "proposal_id: integer|Long expected"; + if (message.depositor != null && message.hasOwnProperty("depositor")) + if (!$util.isString(message.depositor)) + return "depositor: string expected"; + if (message.amount != null && message.hasOwnProperty("amount")) { + if (!Array.isArray(message.amount)) + return "amount: array expected"; + for (let i = 0; i < message.amount.length; ++i) { + let error = $root.cosmos.base.v1beta1.Coin.verify(message.amount[i]); + if (error) + return "amount." + error; + } + } + return null; + }; + + /** + * Creates a MsgDeposit message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.MsgDeposit + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.MsgDeposit} MsgDeposit + */ + MsgDeposit.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.MsgDeposit) + return object; + let message = new $root.cosmos.gov.v1beta1.MsgDeposit(); + if (object.proposal_id != null) + if ($util.Long) + (message.proposal_id = $util.Long.fromValue(object.proposal_id)).unsigned = true; + else if (typeof object.proposal_id === "string") + message.proposal_id = parseInt(object.proposal_id, 10); + else if (typeof object.proposal_id === "number") + message.proposal_id = object.proposal_id; + else if (typeof object.proposal_id === "object") + message.proposal_id = new $util.LongBits(object.proposal_id.low >>> 0, object.proposal_id.high >>> 0).toNumber(true); + if (object.depositor != null) + message.depositor = String(object.depositor); + if (object.amount) { + if (!Array.isArray(object.amount)) + throw TypeError(".cosmos.gov.v1beta1.MsgDeposit.amount: array expected"); + message.amount = []; + for (let i = 0; i < object.amount.length; ++i) { + if (typeof object.amount[i] !== "object") + throw TypeError(".cosmos.gov.v1beta1.MsgDeposit.amount: object expected"); + message.amount[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.amount[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a MsgDeposit message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.MsgDeposit + * @static + * @param {cosmos.gov.v1beta1.MsgDeposit} message MsgDeposit + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgDeposit.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.amount = []; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.proposal_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.proposal_id = options.longs === String ? "0" : 0; + object.depositor = ""; + } + if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) + if (typeof message.proposal_id === "number") + object.proposal_id = options.longs === String ? String(message.proposal_id) : message.proposal_id; + else + object.proposal_id = options.longs === String ? $util.Long.prototype.toString.call(message.proposal_id) : options.longs === Number ? new $util.LongBits(message.proposal_id.low >>> 0, message.proposal_id.high >>> 0).toNumber(true) : message.proposal_id; + if (message.depositor != null && message.hasOwnProperty("depositor")) + object.depositor = message.depositor; + if (message.amount && message.amount.length) { + object.amount = []; + for (let j = 0; j < message.amount.length; ++j) + object.amount[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.amount[j], options); + } + return object; + }; + + /** + * Converts this MsgDeposit to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.MsgDeposit + * @instance + * @returns {Object.} JSON object + */ + MsgDeposit.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgDeposit; + })(); + + v1beta1.MsgDepositResponse = (function() { + + /** + * Properties of a MsgDepositResponse. + * @memberof cosmos.gov.v1beta1 + * @interface IMsgDepositResponse + */ + + /** + * Constructs a new MsgDepositResponse. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a MsgDepositResponse. + * @implements IMsgDepositResponse + * @constructor + * @param {cosmos.gov.v1beta1.IMsgDepositResponse=} [properties] Properties to set + */ + function MsgDepositResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgDepositResponse message. Does not implicitly {@link cosmos.gov.v1beta1.MsgDepositResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.MsgDepositResponse + * @static + * @param {cosmos.gov.v1beta1.IMsgDepositResponse} message MsgDepositResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgDepositResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgDepositResponse message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.MsgDepositResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.MsgDepositResponse + * @static + * @param {cosmos.gov.v1beta1.IMsgDepositResponse} message MsgDepositResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgDepositResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgDepositResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.MsgDepositResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.MsgDepositResponse} MsgDepositResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgDepositResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.MsgDepositResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgDepositResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.MsgDepositResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.MsgDepositResponse} MsgDepositResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgDepositResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgDepositResponse message. + * @function verify + * @memberof cosmos.gov.v1beta1.MsgDepositResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgDepositResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgDepositResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.MsgDepositResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.MsgDepositResponse} MsgDepositResponse + */ + MsgDepositResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.MsgDepositResponse) + return object; + return new $root.cosmos.gov.v1beta1.MsgDepositResponse(); + }; + + /** + * Creates a plain object from a MsgDepositResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.MsgDepositResponse + * @static + * @param {cosmos.gov.v1beta1.MsgDepositResponse} message MsgDepositResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgDepositResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgDepositResponse to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.MsgDepositResponse + * @instance + * @returns {Object.} JSON object + */ + MsgDepositResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgDepositResponse; + })(); + + /** + * VoteOption enum. + * @name cosmos.gov.v1beta1.VoteOption + * @enum {number} + * @property {number} VOTE_OPTION_UNSPECIFIED=0 VOTE_OPTION_UNSPECIFIED value + * @property {number} VOTE_OPTION_YES=1 VOTE_OPTION_YES value + * @property {number} VOTE_OPTION_ABSTAIN=2 VOTE_OPTION_ABSTAIN value + * @property {number} VOTE_OPTION_NO=3 VOTE_OPTION_NO value + * @property {number} VOTE_OPTION_NO_WITH_VETO=4 VOTE_OPTION_NO_WITH_VETO value + */ + v1beta1.VoteOption = (function() { + const valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "VOTE_OPTION_UNSPECIFIED"] = 0; + values[valuesById[1] = "VOTE_OPTION_YES"] = 1; + values[valuesById[2] = "VOTE_OPTION_ABSTAIN"] = 2; + values[valuesById[3] = "VOTE_OPTION_NO"] = 3; + values[valuesById[4] = "VOTE_OPTION_NO_WITH_VETO"] = 4; + return values; + })(); + + v1beta1.TextProposal = (function() { + + /** + * Properties of a TextProposal. + * @memberof cosmos.gov.v1beta1 + * @interface ITextProposal + * @property {string|null} [title] TextProposal title + * @property {string|null} [description] TextProposal description + */ + + /** + * Constructs a new TextProposal. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a TextProposal. + * @implements ITextProposal + * @constructor + * @param {cosmos.gov.v1beta1.ITextProposal=} [properties] Properties to set + */ + function TextProposal(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TextProposal title. + * @member {string} title + * @memberof cosmos.gov.v1beta1.TextProposal + * @instance + */ + TextProposal.prototype.title = ""; + + /** + * TextProposal description. + * @member {string} description + * @memberof cosmos.gov.v1beta1.TextProposal + * @instance + */ + TextProposal.prototype.description = ""; + + /** + * Encodes the specified TextProposal message. Does not implicitly {@link cosmos.gov.v1beta1.TextProposal.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.TextProposal + * @static + * @param {cosmos.gov.v1beta1.ITextProposal} message TextProposal message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextProposal.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + return writer; + }; + + /** + * Encodes the specified TextProposal message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.TextProposal.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.TextProposal + * @static + * @param {cosmos.gov.v1beta1.ITextProposal} message TextProposal message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextProposal.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TextProposal message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.TextProposal + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.TextProposal} TextProposal + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextProposal.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.TextProposal(); + while (reader.pos < end) { + let 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; + }; + + /** + * Decodes a TextProposal message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.TextProposal + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.TextProposal} TextProposal + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextProposal.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TextProposal message. + * @function verify + * @memberof cosmos.gov.v1beta1.TextProposal + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TextProposal.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + return null; + }; + + /** + * Creates a TextProposal message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.TextProposal + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.TextProposal} TextProposal + */ + TextProposal.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.TextProposal) + return object; + let message = new $root.cosmos.gov.v1beta1.TextProposal(); + if (object.title != null) + message.title = String(object.title); + if (object.description != null) + message.description = String(object.description); + return message; + }; + + /** + * Creates a plain object from a TextProposal message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.TextProposal + * @static + * @param {cosmos.gov.v1beta1.TextProposal} message TextProposal + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TextProposal.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.title = ""; + object.description = ""; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + return object; + }; + + /** + * Converts this TextProposal to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.TextProposal + * @instance + * @returns {Object.} JSON object + */ + TextProposal.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TextProposal; + })(); + + v1beta1.Deposit = (function() { + + /** + * Properties of a Deposit. + * @memberof cosmos.gov.v1beta1 + * @interface IDeposit + * @property {Long|null} [proposal_id] Deposit proposal_id + * @property {string|null} [depositor] Deposit depositor + * @property {Array.|null} [amount] Deposit amount + */ + + /** + * Constructs a new Deposit. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a Deposit. + * @implements IDeposit + * @constructor + * @param {cosmos.gov.v1beta1.IDeposit=} [properties] Properties to set + */ + function Deposit(properties) { + this.amount = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Deposit proposal_id. + * @member {Long} proposal_id + * @memberof cosmos.gov.v1beta1.Deposit + * @instance + */ + Deposit.prototype.proposal_id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Deposit depositor. + * @member {string} depositor + * @memberof cosmos.gov.v1beta1.Deposit + * @instance + */ + Deposit.prototype.depositor = ""; + + /** + * Deposit amount. + * @member {Array.} amount + * @memberof cosmos.gov.v1beta1.Deposit + * @instance + */ + Deposit.prototype.amount = $util.emptyArray; + + /** + * Encodes the specified Deposit message. Does not implicitly {@link cosmos.gov.v1beta1.Deposit.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.Deposit + * @static + * @param {cosmos.gov.v1beta1.IDeposit} message Deposit message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Deposit.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.proposal_id != null && Object.hasOwnProperty.call(message, "proposal_id")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.proposal_id); + if (message.depositor != null && Object.hasOwnProperty.call(message, "depositor")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.depositor); + if (message.amount != null && message.amount.length) + for (let i = 0; i < message.amount.length; ++i) + $root.cosmos.base.v1beta1.Coin.encode(message.amount[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Deposit message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.Deposit.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.Deposit + * @static + * @param {cosmos.gov.v1beta1.IDeposit} message Deposit message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Deposit.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Deposit message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.Deposit + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.Deposit} Deposit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Deposit.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.Deposit(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal_id = reader.uint64(); + break; + case 2: + message.depositor = reader.string(); + break; + case 3: + if (!(message.amount && message.amount.length)) + message.amount = []; + message.amount.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Deposit message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.Deposit + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.Deposit} Deposit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Deposit.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Deposit message. + * @function verify + * @memberof cosmos.gov.v1beta1.Deposit + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Deposit.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) + if (!$util.isInteger(message.proposal_id) && !(message.proposal_id && $util.isInteger(message.proposal_id.low) && $util.isInteger(message.proposal_id.high))) + return "proposal_id: integer|Long expected"; + if (message.depositor != null && message.hasOwnProperty("depositor")) + if (!$util.isString(message.depositor)) + return "depositor: string expected"; + if (message.amount != null && message.hasOwnProperty("amount")) { + if (!Array.isArray(message.amount)) + return "amount: array expected"; + for (let i = 0; i < message.amount.length; ++i) { + let error = $root.cosmos.base.v1beta1.Coin.verify(message.amount[i]); + if (error) + return "amount." + error; + } + } + return null; + }; + + /** + * Creates a Deposit message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.Deposit + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.Deposit} Deposit + */ + Deposit.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.Deposit) + return object; + let message = new $root.cosmos.gov.v1beta1.Deposit(); + if (object.proposal_id != null) + if ($util.Long) + (message.proposal_id = $util.Long.fromValue(object.proposal_id)).unsigned = true; + else if (typeof object.proposal_id === "string") + message.proposal_id = parseInt(object.proposal_id, 10); + else if (typeof object.proposal_id === "number") + message.proposal_id = object.proposal_id; + else if (typeof object.proposal_id === "object") + message.proposal_id = new $util.LongBits(object.proposal_id.low >>> 0, object.proposal_id.high >>> 0).toNumber(true); + if (object.depositor != null) + message.depositor = String(object.depositor); + if (object.amount) { + if (!Array.isArray(object.amount)) + throw TypeError(".cosmos.gov.v1beta1.Deposit.amount: array expected"); + message.amount = []; + for (let i = 0; i < object.amount.length; ++i) { + if (typeof object.amount[i] !== "object") + throw TypeError(".cosmos.gov.v1beta1.Deposit.amount: object expected"); + message.amount[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.amount[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Deposit message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.Deposit + * @static + * @param {cosmos.gov.v1beta1.Deposit} message Deposit + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Deposit.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.amount = []; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.proposal_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.proposal_id = options.longs === String ? "0" : 0; + object.depositor = ""; + } + if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) + if (typeof message.proposal_id === "number") + object.proposal_id = options.longs === String ? String(message.proposal_id) : message.proposal_id; + else + object.proposal_id = options.longs === String ? $util.Long.prototype.toString.call(message.proposal_id) : options.longs === Number ? new $util.LongBits(message.proposal_id.low >>> 0, message.proposal_id.high >>> 0).toNumber(true) : message.proposal_id; + if (message.depositor != null && message.hasOwnProperty("depositor")) + object.depositor = message.depositor; + if (message.amount && message.amount.length) { + object.amount = []; + for (let j = 0; j < message.amount.length; ++j) + object.amount[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.amount[j], options); + } + return object; + }; + + /** + * Converts this Deposit to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.Deposit + * @instance + * @returns {Object.} JSON object + */ + Deposit.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Deposit; + })(); + + v1beta1.Proposal = (function() { + + /** + * Properties of a Proposal. + * @memberof cosmos.gov.v1beta1 + * @interface IProposal + * @property {Long|null} [proposal_id] Proposal proposal_id + * @property {google.protobuf.IAny|null} [content] Proposal content + * @property {cosmos.gov.v1beta1.ProposalStatus|null} [status] Proposal status + * @property {cosmos.gov.v1beta1.ITallyResult|null} [final_tally_result] Proposal final_tally_result + * @property {google.protobuf.ITimestamp|null} [submit_time] Proposal submit_time + * @property {google.protobuf.ITimestamp|null} [deposit_end_time] Proposal deposit_end_time + * @property {Array.|null} [total_deposit] Proposal total_deposit + * @property {google.protobuf.ITimestamp|null} [voting_start_time] Proposal voting_start_time + * @property {google.protobuf.ITimestamp|null} [voting_end_time] Proposal voting_end_time + */ + + /** + * Constructs a new Proposal. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a Proposal. + * @implements IProposal + * @constructor + * @param {cosmos.gov.v1beta1.IProposal=} [properties] Properties to set + */ + function Proposal(properties) { + this.total_deposit = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Proposal proposal_id. + * @member {Long} proposal_id + * @memberof cosmos.gov.v1beta1.Proposal + * @instance + */ + Proposal.prototype.proposal_id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Proposal content. + * @member {google.protobuf.IAny|null|undefined} content + * @memberof cosmos.gov.v1beta1.Proposal + * @instance + */ + Proposal.prototype.content = null; + + /** + * Proposal status. + * @member {cosmos.gov.v1beta1.ProposalStatus} status + * @memberof cosmos.gov.v1beta1.Proposal + * @instance + */ + Proposal.prototype.status = 0; + + /** + * Proposal final_tally_result. + * @member {cosmos.gov.v1beta1.ITallyResult|null|undefined} final_tally_result + * @memberof cosmos.gov.v1beta1.Proposal + * @instance + */ + Proposal.prototype.final_tally_result = null; + + /** + * Proposal submit_time. + * @member {google.protobuf.ITimestamp|null|undefined} submit_time + * @memberof cosmos.gov.v1beta1.Proposal + * @instance + */ + Proposal.prototype.submit_time = null; + + /** + * Proposal deposit_end_time. + * @member {google.protobuf.ITimestamp|null|undefined} deposit_end_time + * @memberof cosmos.gov.v1beta1.Proposal + * @instance + */ + Proposal.prototype.deposit_end_time = null; + + /** + * Proposal total_deposit. + * @member {Array.} total_deposit + * @memberof cosmos.gov.v1beta1.Proposal + * @instance + */ + Proposal.prototype.total_deposit = $util.emptyArray; + + /** + * Proposal voting_start_time. + * @member {google.protobuf.ITimestamp|null|undefined} voting_start_time + * @memberof cosmos.gov.v1beta1.Proposal + * @instance + */ + Proposal.prototype.voting_start_time = null; + + /** + * Proposal voting_end_time. + * @member {google.protobuf.ITimestamp|null|undefined} voting_end_time + * @memberof cosmos.gov.v1beta1.Proposal + * @instance + */ + Proposal.prototype.voting_end_time = null; + + /** + * Encodes the specified Proposal message. Does not implicitly {@link cosmos.gov.v1beta1.Proposal.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.Proposal + * @static + * @param {cosmos.gov.v1beta1.IProposal} message Proposal message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Proposal.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.proposal_id != null && Object.hasOwnProperty.call(message, "proposal_id")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.proposal_id); + if (message.content != null && Object.hasOwnProperty.call(message, "content")) + $root.google.protobuf.Any.encode(message.content, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.status); + if (message.final_tally_result != null && Object.hasOwnProperty.call(message, "final_tally_result")) + $root.cosmos.gov.v1beta1.TallyResult.encode(message.final_tally_result, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.submit_time != null && Object.hasOwnProperty.call(message, "submit_time")) + $root.google.protobuf.Timestamp.encode(message.submit_time, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.deposit_end_time != null && Object.hasOwnProperty.call(message, "deposit_end_time")) + $root.google.protobuf.Timestamp.encode(message.deposit_end_time, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.total_deposit != null && message.total_deposit.length) + for (let i = 0; i < message.total_deposit.length; ++i) + $root.cosmos.base.v1beta1.Coin.encode(message.total_deposit[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.voting_start_time != null && Object.hasOwnProperty.call(message, "voting_start_time")) + $root.google.protobuf.Timestamp.encode(message.voting_start_time, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.voting_end_time != null && Object.hasOwnProperty.call(message, "voting_end_time")) + $root.google.protobuf.Timestamp.encode(message.voting_end_time, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Proposal message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.Proposal.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.Proposal + * @static + * @param {cosmos.gov.v1beta1.IProposal} message Proposal message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Proposal.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Proposal message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.Proposal + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.Proposal} Proposal + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Proposal.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.Proposal(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal_id = reader.uint64(); + break; + case 2: + message.content = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 3: + message.status = reader.int32(); + break; + case 4: + message.final_tally_result = $root.cosmos.gov.v1beta1.TallyResult.decode(reader, reader.uint32()); + break; + case 5: + message.submit_time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 6: + message.deposit_end_time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 7: + if (!(message.total_deposit && message.total_deposit.length)) + message.total_deposit = []; + message.total_deposit.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); + break; + case 8: + message.voting_start_time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 9: + message.voting_end_time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Proposal message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.Proposal + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.Proposal} Proposal + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Proposal.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Proposal message. + * @function verify + * @memberof cosmos.gov.v1beta1.Proposal + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Proposal.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) + if (!$util.isInteger(message.proposal_id) && !(message.proposal_id && $util.isInteger(message.proposal_id.low) && $util.isInteger(message.proposal_id.high))) + return "proposal_id: integer|Long expected"; + if (message.content != null && message.hasOwnProperty("content")) { + let error = $root.google.protobuf.Any.verify(message.content); + if (error) + return "content." + error; + } + if (message.status != null && message.hasOwnProperty("status")) + switch (message.status) { + default: + return "status: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.final_tally_result != null && message.hasOwnProperty("final_tally_result")) { + let error = $root.cosmos.gov.v1beta1.TallyResult.verify(message.final_tally_result); + if (error) + return "final_tally_result." + error; + } + if (message.submit_time != null && message.hasOwnProperty("submit_time")) { + let error = $root.google.protobuf.Timestamp.verify(message.submit_time); + if (error) + return "submit_time." + error; + } + if (message.deposit_end_time != null && message.hasOwnProperty("deposit_end_time")) { + let error = $root.google.protobuf.Timestamp.verify(message.deposit_end_time); + if (error) + return "deposit_end_time." + error; + } + if (message.total_deposit != null && message.hasOwnProperty("total_deposit")) { + if (!Array.isArray(message.total_deposit)) + return "total_deposit: array expected"; + for (let i = 0; i < message.total_deposit.length; ++i) { + let error = $root.cosmos.base.v1beta1.Coin.verify(message.total_deposit[i]); + if (error) + return "total_deposit." + error; + } + } + if (message.voting_start_time != null && message.hasOwnProperty("voting_start_time")) { + let error = $root.google.protobuf.Timestamp.verify(message.voting_start_time); + if (error) + return "voting_start_time." + error; + } + if (message.voting_end_time != null && message.hasOwnProperty("voting_end_time")) { + let error = $root.google.protobuf.Timestamp.verify(message.voting_end_time); + if (error) + return "voting_end_time." + error; + } + return null; + }; + + /** + * Creates a Proposal message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.Proposal + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.Proposal} Proposal + */ + Proposal.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.Proposal) + return object; + let message = new $root.cosmos.gov.v1beta1.Proposal(); + if (object.proposal_id != null) + if ($util.Long) + (message.proposal_id = $util.Long.fromValue(object.proposal_id)).unsigned = true; + else if (typeof object.proposal_id === "string") + message.proposal_id = parseInt(object.proposal_id, 10); + else if (typeof object.proposal_id === "number") + message.proposal_id = object.proposal_id; + else if (typeof object.proposal_id === "object") + message.proposal_id = new $util.LongBits(object.proposal_id.low >>> 0, object.proposal_id.high >>> 0).toNumber(true); + if (object.content != null) { + if (typeof object.content !== "object") + throw TypeError(".cosmos.gov.v1beta1.Proposal.content: object expected"); + message.content = $root.google.protobuf.Any.fromObject(object.content); + } + switch (object.status) { + case "PROPOSAL_STATUS_UNSPECIFIED": + case 0: + message.status = 0; + break; + case "PROPOSAL_STATUS_DEPOSIT_PERIOD": + case 1: + message.status = 1; + break; + case "PROPOSAL_STATUS_VOTING_PERIOD": + case 2: + message.status = 2; + break; + case "PROPOSAL_STATUS_PASSED": + case 3: + message.status = 3; + break; + case "PROPOSAL_STATUS_REJECTED": + case 4: + message.status = 4; + break; + case "PROPOSAL_STATUS_FAILED": + case 5: + message.status = 5; + break; + } + if (object.final_tally_result != null) { + if (typeof object.final_tally_result !== "object") + throw TypeError(".cosmos.gov.v1beta1.Proposal.final_tally_result: object expected"); + message.final_tally_result = $root.cosmos.gov.v1beta1.TallyResult.fromObject(object.final_tally_result); + } + if (object.submit_time != null) { + if (typeof object.submit_time !== "object") + throw TypeError(".cosmos.gov.v1beta1.Proposal.submit_time: object expected"); + message.submit_time = $root.google.protobuf.Timestamp.fromObject(object.submit_time); + } + if (object.deposit_end_time != null) { + if (typeof object.deposit_end_time !== "object") + throw TypeError(".cosmos.gov.v1beta1.Proposal.deposit_end_time: object expected"); + message.deposit_end_time = $root.google.protobuf.Timestamp.fromObject(object.deposit_end_time); + } + if (object.total_deposit) { + if (!Array.isArray(object.total_deposit)) + throw TypeError(".cosmos.gov.v1beta1.Proposal.total_deposit: array expected"); + message.total_deposit = []; + for (let i = 0; i < object.total_deposit.length; ++i) { + if (typeof object.total_deposit[i] !== "object") + throw TypeError(".cosmos.gov.v1beta1.Proposal.total_deposit: object expected"); + message.total_deposit[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.total_deposit[i]); + } + } + if (object.voting_start_time != null) { + if (typeof object.voting_start_time !== "object") + throw TypeError(".cosmos.gov.v1beta1.Proposal.voting_start_time: object expected"); + message.voting_start_time = $root.google.protobuf.Timestamp.fromObject(object.voting_start_time); + } + if (object.voting_end_time != null) { + if (typeof object.voting_end_time !== "object") + throw TypeError(".cosmos.gov.v1beta1.Proposal.voting_end_time: object expected"); + message.voting_end_time = $root.google.protobuf.Timestamp.fromObject(object.voting_end_time); + } + return message; + }; + + /** + * Creates a plain object from a Proposal message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.Proposal + * @static + * @param {cosmos.gov.v1beta1.Proposal} message Proposal + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Proposal.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.total_deposit = []; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.proposal_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.proposal_id = options.longs === String ? "0" : 0; + object.content = null; + object.status = options.enums === String ? "PROPOSAL_STATUS_UNSPECIFIED" : 0; + object.final_tally_result = null; + object.submit_time = null; + object.deposit_end_time = null; + object.voting_start_time = null; + object.voting_end_time = null; + } + if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) + if (typeof message.proposal_id === "number") + object.proposal_id = options.longs === String ? String(message.proposal_id) : message.proposal_id; + else + object.proposal_id = options.longs === String ? $util.Long.prototype.toString.call(message.proposal_id) : options.longs === Number ? new $util.LongBits(message.proposal_id.low >>> 0, message.proposal_id.high >>> 0).toNumber(true) : message.proposal_id; + if (message.content != null && message.hasOwnProperty("content")) + object.content = $root.google.protobuf.Any.toObject(message.content, options); + if (message.status != null && message.hasOwnProperty("status")) + object.status = options.enums === String ? $root.cosmos.gov.v1beta1.ProposalStatus[message.status] : message.status; + if (message.final_tally_result != null && message.hasOwnProperty("final_tally_result")) + object.final_tally_result = $root.cosmos.gov.v1beta1.TallyResult.toObject(message.final_tally_result, options); + if (message.submit_time != null && message.hasOwnProperty("submit_time")) + object.submit_time = $root.google.protobuf.Timestamp.toObject(message.submit_time, options); + if (message.deposit_end_time != null && message.hasOwnProperty("deposit_end_time")) + object.deposit_end_time = $root.google.protobuf.Timestamp.toObject(message.deposit_end_time, options); + if (message.total_deposit && message.total_deposit.length) { + object.total_deposit = []; + for (let j = 0; j < message.total_deposit.length; ++j) + object.total_deposit[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.total_deposit[j], options); + } + if (message.voting_start_time != null && message.hasOwnProperty("voting_start_time")) + object.voting_start_time = $root.google.protobuf.Timestamp.toObject(message.voting_start_time, options); + if (message.voting_end_time != null && message.hasOwnProperty("voting_end_time")) + object.voting_end_time = $root.google.protobuf.Timestamp.toObject(message.voting_end_time, options); + return object; + }; + + /** + * Converts this Proposal to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.Proposal + * @instance + * @returns {Object.} JSON object + */ + Proposal.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Proposal; + })(); + + /** + * ProposalStatus enum. + * @name cosmos.gov.v1beta1.ProposalStatus + * @enum {number} + * @property {number} PROPOSAL_STATUS_UNSPECIFIED=0 PROPOSAL_STATUS_UNSPECIFIED value + * @property {number} PROPOSAL_STATUS_DEPOSIT_PERIOD=1 PROPOSAL_STATUS_DEPOSIT_PERIOD value + * @property {number} PROPOSAL_STATUS_VOTING_PERIOD=2 PROPOSAL_STATUS_VOTING_PERIOD value + * @property {number} PROPOSAL_STATUS_PASSED=3 PROPOSAL_STATUS_PASSED value + * @property {number} PROPOSAL_STATUS_REJECTED=4 PROPOSAL_STATUS_REJECTED value + * @property {number} PROPOSAL_STATUS_FAILED=5 PROPOSAL_STATUS_FAILED value + */ + v1beta1.ProposalStatus = (function() { + const valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "PROPOSAL_STATUS_UNSPECIFIED"] = 0; + values[valuesById[1] = "PROPOSAL_STATUS_DEPOSIT_PERIOD"] = 1; + values[valuesById[2] = "PROPOSAL_STATUS_VOTING_PERIOD"] = 2; + values[valuesById[3] = "PROPOSAL_STATUS_PASSED"] = 3; + values[valuesById[4] = "PROPOSAL_STATUS_REJECTED"] = 4; + values[valuesById[5] = "PROPOSAL_STATUS_FAILED"] = 5; + return values; + })(); + + v1beta1.TallyResult = (function() { + + /** + * Properties of a TallyResult. + * @memberof cosmos.gov.v1beta1 + * @interface ITallyResult + * @property {string|null} [yes] TallyResult yes + * @property {string|null} [abstain] TallyResult abstain + * @property {string|null} [no] TallyResult no + * @property {string|null} [no_with_veto] TallyResult no_with_veto + */ + + /** + * Constructs a new TallyResult. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a TallyResult. + * @implements ITallyResult + * @constructor + * @param {cosmos.gov.v1beta1.ITallyResult=} [properties] Properties to set + */ + function TallyResult(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TallyResult yes. + * @member {string} yes + * @memberof cosmos.gov.v1beta1.TallyResult + * @instance + */ + TallyResult.prototype.yes = ""; + + /** + * TallyResult abstain. + * @member {string} abstain + * @memberof cosmos.gov.v1beta1.TallyResult + * @instance + */ + TallyResult.prototype.abstain = ""; + + /** + * TallyResult no. + * @member {string} no + * @memberof cosmos.gov.v1beta1.TallyResult + * @instance + */ + TallyResult.prototype.no = ""; + + /** + * TallyResult no_with_veto. + * @member {string} no_with_veto + * @memberof cosmos.gov.v1beta1.TallyResult + * @instance + */ + TallyResult.prototype.no_with_veto = ""; + + /** + * Encodes the specified TallyResult message. Does not implicitly {@link cosmos.gov.v1beta1.TallyResult.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.TallyResult + * @static + * @param {cosmos.gov.v1beta1.ITallyResult} message TallyResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TallyResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.yes != null && Object.hasOwnProperty.call(message, "yes")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.yes); + if (message.abstain != null && Object.hasOwnProperty.call(message, "abstain")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.abstain); + if (message.no != null && Object.hasOwnProperty.call(message, "no")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.no); + if (message.no_with_veto != null && Object.hasOwnProperty.call(message, "no_with_veto")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.no_with_veto); + return writer; + }; + + /** + * Encodes the specified TallyResult message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.TallyResult.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.TallyResult + * @static + * @param {cosmos.gov.v1beta1.ITallyResult} message TallyResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TallyResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TallyResult message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.TallyResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.TallyResult} TallyResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TallyResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.TallyResult(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.yes = reader.string(); + break; + case 2: + message.abstain = reader.string(); + break; + case 3: + message.no = reader.string(); + break; + case 4: + message.no_with_veto = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TallyResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.TallyResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.TallyResult} TallyResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TallyResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TallyResult message. + * @function verify + * @memberof cosmos.gov.v1beta1.TallyResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TallyResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.yes != null && message.hasOwnProperty("yes")) + if (!$util.isString(message.yes)) + return "yes: string expected"; + if (message.abstain != null && message.hasOwnProperty("abstain")) + if (!$util.isString(message.abstain)) + return "abstain: string expected"; + if (message.no != null && message.hasOwnProperty("no")) + if (!$util.isString(message.no)) + return "no: string expected"; + if (message.no_with_veto != null && message.hasOwnProperty("no_with_veto")) + if (!$util.isString(message.no_with_veto)) + return "no_with_veto: string expected"; + return null; + }; + + /** + * Creates a TallyResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.TallyResult + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.TallyResult} TallyResult + */ + TallyResult.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.TallyResult) + return object; + let message = new $root.cosmos.gov.v1beta1.TallyResult(); + if (object.yes != null) + message.yes = String(object.yes); + if (object.abstain != null) + message.abstain = String(object.abstain); + if (object.no != null) + message.no = String(object.no); + if (object.no_with_veto != null) + message.no_with_veto = String(object.no_with_veto); + return message; + }; + + /** + * Creates a plain object from a TallyResult message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.TallyResult + * @static + * @param {cosmos.gov.v1beta1.TallyResult} message TallyResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TallyResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.yes = ""; + object.abstain = ""; + object.no = ""; + object.no_with_veto = ""; + } + if (message.yes != null && message.hasOwnProperty("yes")) + object.yes = message.yes; + if (message.abstain != null && message.hasOwnProperty("abstain")) + object.abstain = message.abstain; + if (message.no != null && message.hasOwnProperty("no")) + object.no = message.no; + if (message.no_with_veto != null && message.hasOwnProperty("no_with_veto")) + object.no_with_veto = message.no_with_veto; + return object; + }; + + /** + * Converts this TallyResult to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.TallyResult + * @instance + * @returns {Object.} JSON object + */ + TallyResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TallyResult; + })(); + + v1beta1.Vote = (function() { + + /** + * Properties of a Vote. + * @memberof cosmos.gov.v1beta1 + * @interface IVote + * @property {Long|null} [proposal_id] Vote proposal_id + * @property {string|null} [voter] Vote voter + * @property {cosmos.gov.v1beta1.VoteOption|null} [option] Vote option + */ + + /** + * Constructs a new Vote. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a Vote. + * @implements IVote + * @constructor + * @param {cosmos.gov.v1beta1.IVote=} [properties] Properties to set + */ + function Vote(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Vote proposal_id. + * @member {Long} proposal_id + * @memberof cosmos.gov.v1beta1.Vote + * @instance + */ + Vote.prototype.proposal_id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Vote voter. + * @member {string} voter + * @memberof cosmos.gov.v1beta1.Vote + * @instance + */ + Vote.prototype.voter = ""; + + /** + * Vote option. + * @member {cosmos.gov.v1beta1.VoteOption} option + * @memberof cosmos.gov.v1beta1.Vote + * @instance + */ + Vote.prototype.option = 0; + + /** + * Encodes the specified Vote message. Does not implicitly {@link cosmos.gov.v1beta1.Vote.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.Vote + * @static + * @param {cosmos.gov.v1beta1.IVote} message Vote message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Vote.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.proposal_id != null && Object.hasOwnProperty.call(message, "proposal_id")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.proposal_id); + if (message.voter != null && Object.hasOwnProperty.call(message, "voter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.voter); + if (message.option != null && Object.hasOwnProperty.call(message, "option")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.option); + return writer; + }; + + /** + * Encodes the specified Vote message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.Vote.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.Vote + * @static + * @param {cosmos.gov.v1beta1.IVote} message Vote message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Vote.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Vote message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.Vote + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.Vote} Vote + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Vote.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.Vote(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal_id = reader.uint64(); + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.option = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Vote message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.Vote + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.Vote} Vote + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Vote.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Vote message. + * @function verify + * @memberof cosmos.gov.v1beta1.Vote + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Vote.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) + if (!$util.isInteger(message.proposal_id) && !(message.proposal_id && $util.isInteger(message.proposal_id.low) && $util.isInteger(message.proposal_id.high))) + return "proposal_id: integer|Long expected"; + if (message.voter != null && message.hasOwnProperty("voter")) + if (!$util.isString(message.voter)) + return "voter: string expected"; + if (message.option != null && message.hasOwnProperty("option")) + switch (message.option) { + default: + return "option: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + return null; + }; + + /** + * Creates a Vote message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.Vote + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.Vote} Vote + */ + Vote.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.Vote) + return object; + let message = new $root.cosmos.gov.v1beta1.Vote(); + if (object.proposal_id != null) + if ($util.Long) + (message.proposal_id = $util.Long.fromValue(object.proposal_id)).unsigned = true; + else if (typeof object.proposal_id === "string") + message.proposal_id = parseInt(object.proposal_id, 10); + else if (typeof object.proposal_id === "number") + message.proposal_id = object.proposal_id; + else if (typeof object.proposal_id === "object") + message.proposal_id = new $util.LongBits(object.proposal_id.low >>> 0, object.proposal_id.high >>> 0).toNumber(true); + if (object.voter != null) + message.voter = String(object.voter); + switch (object.option) { + case "VOTE_OPTION_UNSPECIFIED": + case 0: + message.option = 0; + break; + case "VOTE_OPTION_YES": + case 1: + message.option = 1; + break; + case "VOTE_OPTION_ABSTAIN": + case 2: + message.option = 2; + break; + case "VOTE_OPTION_NO": + case 3: + message.option = 3; + break; + case "VOTE_OPTION_NO_WITH_VETO": + case 4: + message.option = 4; + break; + } + return message; + }; + + /** + * Creates a plain object from a Vote message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.Vote + * @static + * @param {cosmos.gov.v1beta1.Vote} message Vote + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Vote.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.proposal_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.proposal_id = options.longs === String ? "0" : 0; + object.voter = ""; + object.option = options.enums === String ? "VOTE_OPTION_UNSPECIFIED" : 0; + } + if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) + if (typeof message.proposal_id === "number") + object.proposal_id = options.longs === String ? String(message.proposal_id) : message.proposal_id; + else + object.proposal_id = options.longs === String ? $util.Long.prototype.toString.call(message.proposal_id) : options.longs === Number ? new $util.LongBits(message.proposal_id.low >>> 0, message.proposal_id.high >>> 0).toNumber(true) : message.proposal_id; + if (message.voter != null && message.hasOwnProperty("voter")) + object.voter = message.voter; + if (message.option != null && message.hasOwnProperty("option")) + object.option = options.enums === String ? $root.cosmos.gov.v1beta1.VoteOption[message.option] : message.option; + return object; + }; + + /** + * Converts this Vote to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.Vote + * @instance + * @returns {Object.} JSON object + */ + Vote.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Vote; + })(); + + v1beta1.DepositParams = (function() { + + /** + * Properties of a DepositParams. + * @memberof cosmos.gov.v1beta1 + * @interface IDepositParams + * @property {Array.|null} [min_deposit] DepositParams min_deposit + * @property {google.protobuf.IDuration|null} [max_deposit_period] DepositParams max_deposit_period + */ + + /** + * Constructs a new DepositParams. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a DepositParams. + * @implements IDepositParams + * @constructor + * @param {cosmos.gov.v1beta1.IDepositParams=} [properties] Properties to set + */ + function DepositParams(properties) { + this.min_deposit = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DepositParams min_deposit. + * @member {Array.} min_deposit + * @memberof cosmos.gov.v1beta1.DepositParams + * @instance + */ + DepositParams.prototype.min_deposit = $util.emptyArray; + + /** + * DepositParams max_deposit_period. + * @member {google.protobuf.IDuration|null|undefined} max_deposit_period + * @memberof cosmos.gov.v1beta1.DepositParams + * @instance + */ + DepositParams.prototype.max_deposit_period = null; + + /** + * Encodes the specified DepositParams message. Does not implicitly {@link cosmos.gov.v1beta1.DepositParams.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.DepositParams + * @static + * @param {cosmos.gov.v1beta1.IDepositParams} message DepositParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DepositParams.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.min_deposit != null && message.min_deposit.length) + for (let i = 0; i < message.min_deposit.length; ++i) + $root.cosmos.base.v1beta1.Coin.encode(message.min_deposit[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.max_deposit_period != null && Object.hasOwnProperty.call(message, "max_deposit_period")) + $root.google.protobuf.Duration.encode(message.max_deposit_period, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DepositParams message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.DepositParams.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.DepositParams + * @static + * @param {cosmos.gov.v1beta1.IDepositParams} message DepositParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DepositParams.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DepositParams message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.DepositParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.DepositParams} DepositParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DepositParams.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.DepositParams(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.min_deposit && message.min_deposit.length)) + message.min_deposit = []; + message.min_deposit.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); + break; + case 2: + message.max_deposit_period = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DepositParams message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.DepositParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.DepositParams} DepositParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DepositParams.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DepositParams message. + * @function verify + * @memberof cosmos.gov.v1beta1.DepositParams + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DepositParams.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.min_deposit != null && message.hasOwnProperty("min_deposit")) { + if (!Array.isArray(message.min_deposit)) + return "min_deposit: array expected"; + for (let i = 0; i < message.min_deposit.length; ++i) { + let error = $root.cosmos.base.v1beta1.Coin.verify(message.min_deposit[i]); + if (error) + return "min_deposit." + error; + } + } + if (message.max_deposit_period != null && message.hasOwnProperty("max_deposit_period")) { + let error = $root.google.protobuf.Duration.verify(message.max_deposit_period); + if (error) + return "max_deposit_period." + error; + } + return null; + }; + + /** + * Creates a DepositParams message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.DepositParams + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.DepositParams} DepositParams + */ + DepositParams.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.DepositParams) + return object; + let message = new $root.cosmos.gov.v1beta1.DepositParams(); + if (object.min_deposit) { + if (!Array.isArray(object.min_deposit)) + throw TypeError(".cosmos.gov.v1beta1.DepositParams.min_deposit: array expected"); + message.min_deposit = []; + for (let i = 0; i < object.min_deposit.length; ++i) { + if (typeof object.min_deposit[i] !== "object") + throw TypeError(".cosmos.gov.v1beta1.DepositParams.min_deposit: object expected"); + message.min_deposit[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.min_deposit[i]); + } + } + if (object.max_deposit_period != null) { + if (typeof object.max_deposit_period !== "object") + throw TypeError(".cosmos.gov.v1beta1.DepositParams.max_deposit_period: object expected"); + message.max_deposit_period = $root.google.protobuf.Duration.fromObject(object.max_deposit_period); + } + return message; + }; + + /** + * Creates a plain object from a DepositParams message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.DepositParams + * @static + * @param {cosmos.gov.v1beta1.DepositParams} message DepositParams + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DepositParams.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.min_deposit = []; + if (options.defaults) + object.max_deposit_period = null; + if (message.min_deposit && message.min_deposit.length) { + object.min_deposit = []; + for (let j = 0; j < message.min_deposit.length; ++j) + object.min_deposit[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.min_deposit[j], options); + } + if (message.max_deposit_period != null && message.hasOwnProperty("max_deposit_period")) + object.max_deposit_period = $root.google.protobuf.Duration.toObject(message.max_deposit_period, options); + return object; + }; + + /** + * Converts this DepositParams to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.DepositParams + * @instance + * @returns {Object.} JSON object + */ + DepositParams.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DepositParams; + })(); + + v1beta1.VotingParams = (function() { + + /** + * Properties of a VotingParams. + * @memberof cosmos.gov.v1beta1 + * @interface IVotingParams + * @property {google.protobuf.IDuration|null} [voting_period] VotingParams voting_period + */ + + /** + * Constructs a new VotingParams. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a VotingParams. + * @implements IVotingParams + * @constructor + * @param {cosmos.gov.v1beta1.IVotingParams=} [properties] Properties to set + */ + function VotingParams(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * VotingParams voting_period. + * @member {google.protobuf.IDuration|null|undefined} voting_period + * @memberof cosmos.gov.v1beta1.VotingParams + * @instance + */ + VotingParams.prototype.voting_period = null; + + /** + * Encodes the specified VotingParams message. Does not implicitly {@link cosmos.gov.v1beta1.VotingParams.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.VotingParams + * @static + * @param {cosmos.gov.v1beta1.IVotingParams} message VotingParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VotingParams.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.voting_period != null && Object.hasOwnProperty.call(message, "voting_period")) + $root.google.protobuf.Duration.encode(message.voting_period, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified VotingParams message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.VotingParams.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.VotingParams + * @static + * @param {cosmos.gov.v1beta1.IVotingParams} message VotingParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VotingParams.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VotingParams message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.VotingParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.VotingParams} VotingParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VotingParams.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.VotingParams(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.voting_period = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VotingParams message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.VotingParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.VotingParams} VotingParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VotingParams.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VotingParams message. + * @function verify + * @memberof cosmos.gov.v1beta1.VotingParams + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VotingParams.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.voting_period != null && message.hasOwnProperty("voting_period")) { + let error = $root.google.protobuf.Duration.verify(message.voting_period); + if (error) + return "voting_period." + error; + } + return null; + }; + + /** + * Creates a VotingParams message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.VotingParams + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.VotingParams} VotingParams + */ + VotingParams.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.VotingParams) + return object; + let message = new $root.cosmos.gov.v1beta1.VotingParams(); + if (object.voting_period != null) { + if (typeof object.voting_period !== "object") + throw TypeError(".cosmos.gov.v1beta1.VotingParams.voting_period: object expected"); + message.voting_period = $root.google.protobuf.Duration.fromObject(object.voting_period); + } + return message; + }; + + /** + * Creates a plain object from a VotingParams message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.VotingParams + * @static + * @param {cosmos.gov.v1beta1.VotingParams} message VotingParams + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VotingParams.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.voting_period = null; + if (message.voting_period != null && message.hasOwnProperty("voting_period")) + object.voting_period = $root.google.protobuf.Duration.toObject(message.voting_period, options); + return object; + }; + + /** + * Converts this VotingParams to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.VotingParams + * @instance + * @returns {Object.} JSON object + */ + VotingParams.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return VotingParams; + })(); + + v1beta1.TallyParams = (function() { + + /** + * Properties of a TallyParams. + * @memberof cosmos.gov.v1beta1 + * @interface ITallyParams + * @property {Uint8Array|null} [quorum] TallyParams quorum + * @property {Uint8Array|null} [threshold] TallyParams threshold + * @property {Uint8Array|null} [veto_threshold] TallyParams veto_threshold + */ + + /** + * Constructs a new TallyParams. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a TallyParams. + * @implements ITallyParams + * @constructor + * @param {cosmos.gov.v1beta1.ITallyParams=} [properties] Properties to set + */ + function TallyParams(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TallyParams quorum. + * @member {Uint8Array} quorum + * @memberof cosmos.gov.v1beta1.TallyParams + * @instance + */ + TallyParams.prototype.quorum = $util.newBuffer([]); + + /** + * TallyParams threshold. + * @member {Uint8Array} threshold + * @memberof cosmos.gov.v1beta1.TallyParams + * @instance + */ + TallyParams.prototype.threshold = $util.newBuffer([]); + + /** + * TallyParams veto_threshold. + * @member {Uint8Array} veto_threshold + * @memberof cosmos.gov.v1beta1.TallyParams + * @instance + */ + TallyParams.prototype.veto_threshold = $util.newBuffer([]); + + /** + * Encodes the specified TallyParams message. Does not implicitly {@link cosmos.gov.v1beta1.TallyParams.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.TallyParams + * @static + * @param {cosmos.gov.v1beta1.ITallyParams} message TallyParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TallyParams.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.quorum != null && Object.hasOwnProperty.call(message, "quorum")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.quorum); + if (message.threshold != null && Object.hasOwnProperty.call(message, "threshold")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.threshold); + if (message.veto_threshold != null && Object.hasOwnProperty.call(message, "veto_threshold")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.veto_threshold); + return writer; + }; + + /** + * Encodes the specified TallyParams message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.TallyParams.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.TallyParams + * @static + * @param {cosmos.gov.v1beta1.ITallyParams} message TallyParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TallyParams.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TallyParams message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.TallyParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.TallyParams} TallyParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TallyParams.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.TallyParams(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.quorum = reader.bytes(); + break; + case 2: + message.threshold = reader.bytes(); + break; + case 3: + message.veto_threshold = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TallyParams message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.TallyParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.TallyParams} TallyParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TallyParams.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TallyParams message. + * @function verify + * @memberof cosmos.gov.v1beta1.TallyParams + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TallyParams.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.quorum != null && message.hasOwnProperty("quorum")) + if (!(message.quorum && typeof message.quorum.length === "number" || $util.isString(message.quorum))) + return "quorum: buffer expected"; + if (message.threshold != null && message.hasOwnProperty("threshold")) + if (!(message.threshold && typeof message.threshold.length === "number" || $util.isString(message.threshold))) + return "threshold: buffer expected"; + if (message.veto_threshold != null && message.hasOwnProperty("veto_threshold")) + if (!(message.veto_threshold && typeof message.veto_threshold.length === "number" || $util.isString(message.veto_threshold))) + return "veto_threshold: buffer expected"; + return null; + }; + + /** + * Creates a TallyParams message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.TallyParams + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.TallyParams} TallyParams + */ + TallyParams.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.TallyParams) + return object; + let message = new $root.cosmos.gov.v1beta1.TallyParams(); + if (object.quorum != null) + if (typeof object.quorum === "string") + $util.base64.decode(object.quorum, message.quorum = $util.newBuffer($util.base64.length(object.quorum)), 0); + else if (object.quorum.length) + message.quorum = object.quorum; + if (object.threshold != null) + if (typeof object.threshold === "string") + $util.base64.decode(object.threshold, message.threshold = $util.newBuffer($util.base64.length(object.threshold)), 0); + else if (object.threshold.length) + message.threshold = object.threshold; + if (object.veto_threshold != null) + if (typeof object.veto_threshold === "string") + $util.base64.decode(object.veto_threshold, message.veto_threshold = $util.newBuffer($util.base64.length(object.veto_threshold)), 0); + else if (object.veto_threshold.length) + message.veto_threshold = object.veto_threshold; + return message; + }; + + /** + * Creates a plain object from a TallyParams message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.TallyParams + * @static + * @param {cosmos.gov.v1beta1.TallyParams} message TallyParams + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TallyParams.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if (options.bytes === String) + object.quorum = ""; + else { + object.quorum = []; + if (options.bytes !== Array) + object.quorum = $util.newBuffer(object.quorum); + } + if (options.bytes === String) + object.threshold = ""; + else { + object.threshold = []; + if (options.bytes !== Array) + object.threshold = $util.newBuffer(object.threshold); + } + if (options.bytes === String) + object.veto_threshold = ""; + else { + object.veto_threshold = []; + if (options.bytes !== Array) + object.veto_threshold = $util.newBuffer(object.veto_threshold); + } + } + if (message.quorum != null && message.hasOwnProperty("quorum")) + object.quorum = options.bytes === String ? $util.base64.encode(message.quorum, 0, message.quorum.length) : options.bytes === Array ? Array.prototype.slice.call(message.quorum) : message.quorum; + if (message.threshold != null && message.hasOwnProperty("threshold")) + object.threshold = options.bytes === String ? $util.base64.encode(message.threshold, 0, message.threshold.length) : options.bytes === Array ? Array.prototype.slice.call(message.threshold) : message.threshold; + if (message.veto_threshold != null && message.hasOwnProperty("veto_threshold")) + object.veto_threshold = options.bytes === String ? $util.base64.encode(message.veto_threshold, 0, message.veto_threshold.length) : options.bytes === Array ? Array.prototype.slice.call(message.veto_threshold) : message.veto_threshold; + return object; + }; + + /** + * Converts this TallyParams to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.TallyParams + * @instance + * @returns {Object.} JSON object + */ + TallyParams.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TallyParams; + })(); + + v1beta1.Query = (function() { + + /** + * Constructs a new Query service. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a Query + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Query(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Query.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Query; + + /** + * Callback as used by {@link cosmos.gov.v1beta1.Query#proposal}. + * @memberof cosmos.gov.v1beta1.Query + * @typedef ProposalCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.gov.v1beta1.QueryProposalResponse} [response] QueryProposalResponse + */ + + /** + * Calls Proposal. + * @function proposal + * @memberof cosmos.gov.v1beta1.Query + * @instance + * @param {cosmos.gov.v1beta1.IQueryProposalRequest} request QueryProposalRequest message or plain object + * @param {cosmos.gov.v1beta1.Query.ProposalCallback} callback Node-style callback called with the error, if any, and QueryProposalResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.proposal = function proposal(request, callback) { + return this.rpcCall(proposal, $root.cosmos.gov.v1beta1.QueryProposalRequest, $root.cosmos.gov.v1beta1.QueryProposalResponse, request, callback); + }, "name", { value: "Proposal" }); + + /** + * Calls Proposal. + * @function proposal + * @memberof cosmos.gov.v1beta1.Query + * @instance + * @param {cosmos.gov.v1beta1.IQueryProposalRequest} request QueryProposalRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.gov.v1beta1.Query#proposals}. + * @memberof cosmos.gov.v1beta1.Query + * @typedef ProposalsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.gov.v1beta1.QueryProposalsResponse} [response] QueryProposalsResponse + */ + + /** + * Calls Proposals. + * @function proposals + * @memberof cosmos.gov.v1beta1.Query + * @instance + * @param {cosmos.gov.v1beta1.IQueryProposalsRequest} request QueryProposalsRequest message or plain object + * @param {cosmos.gov.v1beta1.Query.ProposalsCallback} callback Node-style callback called with the error, if any, and QueryProposalsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.proposals = function proposals(request, callback) { + return this.rpcCall(proposals, $root.cosmos.gov.v1beta1.QueryProposalsRequest, $root.cosmos.gov.v1beta1.QueryProposalsResponse, request, callback); + }, "name", { value: "Proposals" }); + + /** + * Calls Proposals. + * @function proposals + * @memberof cosmos.gov.v1beta1.Query + * @instance + * @param {cosmos.gov.v1beta1.IQueryProposalsRequest} request QueryProposalsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.gov.v1beta1.Query#vote}. + * @memberof cosmos.gov.v1beta1.Query + * @typedef VoteCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.gov.v1beta1.QueryVoteResponse} [response] QueryVoteResponse + */ + + /** + * Calls Vote. + * @function vote + * @memberof cosmos.gov.v1beta1.Query + * @instance + * @param {cosmos.gov.v1beta1.IQueryVoteRequest} request QueryVoteRequest message or plain object + * @param {cosmos.gov.v1beta1.Query.VoteCallback} callback Node-style callback called with the error, if any, and QueryVoteResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.vote = function vote(request, callback) { + return this.rpcCall(vote, $root.cosmos.gov.v1beta1.QueryVoteRequest, $root.cosmos.gov.v1beta1.QueryVoteResponse, request, callback); + }, "name", { value: "Vote" }); + + /** + * Calls Vote. + * @function vote + * @memberof cosmos.gov.v1beta1.Query + * @instance + * @param {cosmos.gov.v1beta1.IQueryVoteRequest} request QueryVoteRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.gov.v1beta1.Query#votes}. + * @memberof cosmos.gov.v1beta1.Query + * @typedef VotesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.gov.v1beta1.QueryVotesResponse} [response] QueryVotesResponse + */ + + /** + * Calls Votes. + * @function votes + * @memberof cosmos.gov.v1beta1.Query + * @instance + * @param {cosmos.gov.v1beta1.IQueryVotesRequest} request QueryVotesRequest message or plain object + * @param {cosmos.gov.v1beta1.Query.VotesCallback} callback Node-style callback called with the error, if any, and QueryVotesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.votes = function votes(request, callback) { + return this.rpcCall(votes, $root.cosmos.gov.v1beta1.QueryVotesRequest, $root.cosmos.gov.v1beta1.QueryVotesResponse, request, callback); + }, "name", { value: "Votes" }); + + /** + * Calls Votes. + * @function votes + * @memberof cosmos.gov.v1beta1.Query + * @instance + * @param {cosmos.gov.v1beta1.IQueryVotesRequest} request QueryVotesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.gov.v1beta1.Query#params}. + * @memberof cosmos.gov.v1beta1.Query + * @typedef ParamsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.gov.v1beta1.QueryParamsResponse} [response] QueryParamsResponse + */ + + /** + * Calls Params. + * @function params + * @memberof cosmos.gov.v1beta1.Query + * @instance + * @param {cosmos.gov.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object + * @param {cosmos.gov.v1beta1.Query.ParamsCallback} callback Node-style callback called with the error, if any, and QueryParamsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.params = function params(request, callback) { + return this.rpcCall(params, $root.cosmos.gov.v1beta1.QueryParamsRequest, $root.cosmos.gov.v1beta1.QueryParamsResponse, request, callback); + }, "name", { value: "Params" }); + + /** + * Calls Params. + * @function params + * @memberof cosmos.gov.v1beta1.Query + * @instance + * @param {cosmos.gov.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.gov.v1beta1.Query#deposit}. + * @memberof cosmos.gov.v1beta1.Query + * @typedef DepositCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.gov.v1beta1.QueryDepositResponse} [response] QueryDepositResponse + */ + + /** + * Calls Deposit. + * @function deposit + * @memberof cosmos.gov.v1beta1.Query + * @instance + * @param {cosmos.gov.v1beta1.IQueryDepositRequest} request QueryDepositRequest message or plain object + * @param {cosmos.gov.v1beta1.Query.DepositCallback} callback Node-style callback called with the error, if any, and QueryDepositResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.deposit = function deposit(request, callback) { + return this.rpcCall(deposit, $root.cosmos.gov.v1beta1.QueryDepositRequest, $root.cosmos.gov.v1beta1.QueryDepositResponse, request, callback); + }, "name", { value: "Deposit" }); + + /** + * Calls Deposit. + * @function deposit + * @memberof cosmos.gov.v1beta1.Query + * @instance + * @param {cosmos.gov.v1beta1.IQueryDepositRequest} request QueryDepositRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.gov.v1beta1.Query#deposits}. + * @memberof cosmos.gov.v1beta1.Query + * @typedef DepositsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.gov.v1beta1.QueryDepositsResponse} [response] QueryDepositsResponse + */ + + /** + * Calls Deposits. + * @function deposits + * @memberof cosmos.gov.v1beta1.Query + * @instance + * @param {cosmos.gov.v1beta1.IQueryDepositsRequest} request QueryDepositsRequest message or plain object + * @param {cosmos.gov.v1beta1.Query.DepositsCallback} callback Node-style callback called with the error, if any, and QueryDepositsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.deposits = function deposits(request, callback) { + return this.rpcCall(deposits, $root.cosmos.gov.v1beta1.QueryDepositsRequest, $root.cosmos.gov.v1beta1.QueryDepositsResponse, request, callback); + }, "name", { value: "Deposits" }); + + /** + * Calls Deposits. + * @function deposits + * @memberof cosmos.gov.v1beta1.Query + * @instance + * @param {cosmos.gov.v1beta1.IQueryDepositsRequest} request QueryDepositsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.gov.v1beta1.Query#tallyResult}. + * @memberof cosmos.gov.v1beta1.Query + * @typedef TallyResultCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.gov.v1beta1.QueryTallyResultResponse} [response] QueryTallyResultResponse + */ + + /** + * Calls TallyResult. + * @function tallyResult + * @memberof cosmos.gov.v1beta1.Query + * @instance + * @param {cosmos.gov.v1beta1.IQueryTallyResultRequest} request QueryTallyResultRequest message or plain object + * @param {cosmos.gov.v1beta1.Query.TallyResultCallback} callback Node-style callback called with the error, if any, and QueryTallyResultResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.tallyResult = function tallyResult(request, callback) { + return this.rpcCall(tallyResult, $root.cosmos.gov.v1beta1.QueryTallyResultRequest, $root.cosmos.gov.v1beta1.QueryTallyResultResponse, request, callback); + }, "name", { value: "TallyResult" }); + + /** + * Calls TallyResult. + * @function tallyResult + * @memberof cosmos.gov.v1beta1.Query + * @instance + * @param {cosmos.gov.v1beta1.IQueryTallyResultRequest} request QueryTallyResultRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Query; + })(); + + v1beta1.QueryProposalRequest = (function() { + + /** + * Properties of a QueryProposalRequest. + * @memberof cosmos.gov.v1beta1 + * @interface IQueryProposalRequest + * @property {Long|null} [proposal_id] QueryProposalRequest proposal_id + */ + + /** + * Constructs a new QueryProposalRequest. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a QueryProposalRequest. + * @implements IQueryProposalRequest + * @constructor + * @param {cosmos.gov.v1beta1.IQueryProposalRequest=} [properties] Properties to set + */ + function QueryProposalRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryProposalRequest proposal_id. + * @member {Long} proposal_id + * @memberof cosmos.gov.v1beta1.QueryProposalRequest + * @instance + */ + QueryProposalRequest.prototype.proposal_id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified QueryProposalRequest message. Does not implicitly {@link cosmos.gov.v1beta1.QueryProposalRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.QueryProposalRequest + * @static + * @param {cosmos.gov.v1beta1.IQueryProposalRequest} message QueryProposalRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryProposalRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.proposal_id != null && Object.hasOwnProperty.call(message, "proposal_id")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.proposal_id); + return writer; + }; + + /** + * Encodes the specified QueryProposalRequest message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryProposalRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.QueryProposalRequest + * @static + * @param {cosmos.gov.v1beta1.IQueryProposalRequest} message QueryProposalRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryProposalRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryProposalRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.QueryProposalRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.QueryProposalRequest} QueryProposalRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryProposalRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryProposalRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal_id = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryProposalRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.QueryProposalRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.QueryProposalRequest} QueryProposalRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryProposalRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryProposalRequest message. + * @function verify + * @memberof cosmos.gov.v1beta1.QueryProposalRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryProposalRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) + if (!$util.isInteger(message.proposal_id) && !(message.proposal_id && $util.isInteger(message.proposal_id.low) && $util.isInteger(message.proposal_id.high))) + return "proposal_id: integer|Long expected"; + return null; + }; + + /** + * Creates a QueryProposalRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.QueryProposalRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.QueryProposalRequest} QueryProposalRequest + */ + QueryProposalRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.QueryProposalRequest) + return object; + let message = new $root.cosmos.gov.v1beta1.QueryProposalRequest(); + if (object.proposal_id != null) + if ($util.Long) + (message.proposal_id = $util.Long.fromValue(object.proposal_id)).unsigned = true; + else if (typeof object.proposal_id === "string") + message.proposal_id = parseInt(object.proposal_id, 10); + else if (typeof object.proposal_id === "number") + message.proposal_id = object.proposal_id; + else if (typeof object.proposal_id === "object") + message.proposal_id = new $util.LongBits(object.proposal_id.low >>> 0, object.proposal_id.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a QueryProposalRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.QueryProposalRequest + * @static + * @param {cosmos.gov.v1beta1.QueryProposalRequest} message QueryProposalRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryProposalRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.proposal_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.proposal_id = options.longs === String ? "0" : 0; + if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) + if (typeof message.proposal_id === "number") + object.proposal_id = options.longs === String ? String(message.proposal_id) : message.proposal_id; + else + object.proposal_id = options.longs === String ? $util.Long.prototype.toString.call(message.proposal_id) : options.longs === Number ? new $util.LongBits(message.proposal_id.low >>> 0, message.proposal_id.high >>> 0).toNumber(true) : message.proposal_id; + return object; + }; + + /** + * Converts this QueryProposalRequest to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.QueryProposalRequest + * @instance + * @returns {Object.} JSON object + */ + QueryProposalRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryProposalRequest; + })(); + + v1beta1.QueryProposalResponse = (function() { + + /** + * Properties of a QueryProposalResponse. + * @memberof cosmos.gov.v1beta1 + * @interface IQueryProposalResponse + * @property {cosmos.gov.v1beta1.IProposal|null} [proposal] QueryProposalResponse proposal + */ + + /** + * Constructs a new QueryProposalResponse. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a QueryProposalResponse. + * @implements IQueryProposalResponse + * @constructor + * @param {cosmos.gov.v1beta1.IQueryProposalResponse=} [properties] Properties to set + */ + function QueryProposalResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryProposalResponse proposal. + * @member {cosmos.gov.v1beta1.IProposal|null|undefined} proposal + * @memberof cosmos.gov.v1beta1.QueryProposalResponse + * @instance + */ + QueryProposalResponse.prototype.proposal = null; + + /** + * Encodes the specified QueryProposalResponse message. Does not implicitly {@link cosmos.gov.v1beta1.QueryProposalResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.QueryProposalResponse + * @static + * @param {cosmos.gov.v1beta1.IQueryProposalResponse} message QueryProposalResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryProposalResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.proposal != null && Object.hasOwnProperty.call(message, "proposal")) + $root.cosmos.gov.v1beta1.Proposal.encode(message.proposal, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryProposalResponse message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryProposalResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.QueryProposalResponse + * @static + * @param {cosmos.gov.v1beta1.IQueryProposalResponse} message QueryProposalResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryProposalResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryProposalResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.QueryProposalResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.QueryProposalResponse} QueryProposalResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryProposalResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryProposalResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal = $root.cosmos.gov.v1beta1.Proposal.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryProposalResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.QueryProposalResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.QueryProposalResponse} QueryProposalResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryProposalResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryProposalResponse message. + * @function verify + * @memberof cosmos.gov.v1beta1.QueryProposalResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryProposalResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.proposal != null && message.hasOwnProperty("proposal")) { + let error = $root.cosmos.gov.v1beta1.Proposal.verify(message.proposal); + if (error) + return "proposal." + error; + } + return null; + }; + + /** + * Creates a QueryProposalResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.QueryProposalResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.QueryProposalResponse} QueryProposalResponse + */ + QueryProposalResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.QueryProposalResponse) + return object; + let message = new $root.cosmos.gov.v1beta1.QueryProposalResponse(); + if (object.proposal != null) { + if (typeof object.proposal !== "object") + throw TypeError(".cosmos.gov.v1beta1.QueryProposalResponse.proposal: object expected"); + message.proposal = $root.cosmos.gov.v1beta1.Proposal.fromObject(object.proposal); + } + return message; + }; + + /** + * Creates a plain object from a QueryProposalResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.QueryProposalResponse + * @static + * @param {cosmos.gov.v1beta1.QueryProposalResponse} message QueryProposalResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryProposalResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.proposal = null; + if (message.proposal != null && message.hasOwnProperty("proposal")) + object.proposal = $root.cosmos.gov.v1beta1.Proposal.toObject(message.proposal, options); + return object; + }; + + /** + * Converts this QueryProposalResponse to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.QueryProposalResponse + * @instance + * @returns {Object.} JSON object + */ + QueryProposalResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryProposalResponse; + })(); + + v1beta1.QueryProposalsRequest = (function() { + + /** + * Properties of a QueryProposalsRequest. + * @memberof cosmos.gov.v1beta1 + * @interface IQueryProposalsRequest + * @property {cosmos.gov.v1beta1.ProposalStatus|null} [proposal_status] QueryProposalsRequest proposal_status + * @property {string|null} [voter] QueryProposalsRequest voter + * @property {string|null} [depositor] QueryProposalsRequest depositor + * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryProposalsRequest pagination + */ + + /** + * Constructs a new QueryProposalsRequest. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a QueryProposalsRequest. + * @implements IQueryProposalsRequest + * @constructor + * @param {cosmos.gov.v1beta1.IQueryProposalsRequest=} [properties] Properties to set + */ + function QueryProposalsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryProposalsRequest proposal_status. + * @member {cosmos.gov.v1beta1.ProposalStatus} proposal_status + * @memberof cosmos.gov.v1beta1.QueryProposalsRequest + * @instance + */ + QueryProposalsRequest.prototype.proposal_status = 0; + + /** + * QueryProposalsRequest voter. + * @member {string} voter + * @memberof cosmos.gov.v1beta1.QueryProposalsRequest + * @instance + */ + QueryProposalsRequest.prototype.voter = ""; + + /** + * QueryProposalsRequest depositor. + * @member {string} depositor + * @memberof cosmos.gov.v1beta1.QueryProposalsRequest + * @instance + */ + QueryProposalsRequest.prototype.depositor = ""; + + /** + * QueryProposalsRequest pagination. + * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination + * @memberof cosmos.gov.v1beta1.QueryProposalsRequest + * @instance + */ + QueryProposalsRequest.prototype.pagination = null; + + /** + * Encodes the specified QueryProposalsRequest message. Does not implicitly {@link cosmos.gov.v1beta1.QueryProposalsRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.QueryProposalsRequest + * @static + * @param {cosmos.gov.v1beta1.IQueryProposalsRequest} message QueryProposalsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryProposalsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.proposal_status != null && Object.hasOwnProperty.call(message, "proposal_status")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.proposal_status); + if (message.voter != null && Object.hasOwnProperty.call(message, "voter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.voter); + if (message.depositor != null && Object.hasOwnProperty.call(message, "depositor")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.depositor); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryProposalsRequest message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryProposalsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.QueryProposalsRequest + * @static + * @param {cosmos.gov.v1beta1.IQueryProposalsRequest} message QueryProposalsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryProposalsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryProposalsRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.QueryProposalsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.QueryProposalsRequest} QueryProposalsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryProposalsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryProposalsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal_status = reader.int32(); + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.depositor = reader.string(); + break; + case 4: + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryProposalsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.QueryProposalsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.QueryProposalsRequest} QueryProposalsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryProposalsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryProposalsRequest message. + * @function verify + * @memberof cosmos.gov.v1beta1.QueryProposalsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryProposalsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.proposal_status != null && message.hasOwnProperty("proposal_status")) + switch (message.proposal_status) { + default: + return "proposal_status: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.voter != null && message.hasOwnProperty("voter")) + if (!$util.isString(message.voter)) + return "voter: string expected"; + if (message.depositor != null && message.hasOwnProperty("depositor")) + if (!$util.isString(message.depositor)) + return "depositor: string expected"; + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryProposalsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.QueryProposalsRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.QueryProposalsRequest} QueryProposalsRequest + */ + QueryProposalsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.QueryProposalsRequest) + return object; + let message = new $root.cosmos.gov.v1beta1.QueryProposalsRequest(); + switch (object.proposal_status) { + case "PROPOSAL_STATUS_UNSPECIFIED": + case 0: + message.proposal_status = 0; + break; + case "PROPOSAL_STATUS_DEPOSIT_PERIOD": + case 1: + message.proposal_status = 1; + break; + case "PROPOSAL_STATUS_VOTING_PERIOD": + case 2: + message.proposal_status = 2; + break; + case "PROPOSAL_STATUS_PASSED": + case 3: + message.proposal_status = 3; + break; + case "PROPOSAL_STATUS_REJECTED": + case 4: + message.proposal_status = 4; + break; + case "PROPOSAL_STATUS_FAILED": + case 5: + message.proposal_status = 5; + break; + } + if (object.voter != null) + message.voter = String(object.voter); + if (object.depositor != null) + message.depositor = String(object.depositor); + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.gov.v1beta1.QueryProposalsRequest.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryProposalsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.QueryProposalsRequest + * @static + * @param {cosmos.gov.v1beta1.QueryProposalsRequest} message QueryProposalsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryProposalsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.proposal_status = options.enums === String ? "PROPOSAL_STATUS_UNSPECIFIED" : 0; + object.voter = ""; + object.depositor = ""; + object.pagination = null; + } + if (message.proposal_status != null && message.hasOwnProperty("proposal_status")) + object.proposal_status = options.enums === String ? $root.cosmos.gov.v1beta1.ProposalStatus[message.proposal_status] : message.proposal_status; + if (message.voter != null && message.hasOwnProperty("voter")) + object.voter = message.voter; + if (message.depositor != null && message.hasOwnProperty("depositor")) + object.depositor = message.depositor; + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryProposalsRequest to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.QueryProposalsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryProposalsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryProposalsRequest; + })(); + + v1beta1.QueryProposalsResponse = (function() { + + /** + * Properties of a QueryProposalsResponse. + * @memberof cosmos.gov.v1beta1 + * @interface IQueryProposalsResponse + * @property {Array.|null} [proposals] QueryProposalsResponse proposals + * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryProposalsResponse pagination + */ + + /** + * Constructs a new QueryProposalsResponse. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a QueryProposalsResponse. + * @implements IQueryProposalsResponse + * @constructor + * @param {cosmos.gov.v1beta1.IQueryProposalsResponse=} [properties] Properties to set + */ + function QueryProposalsResponse(properties) { + this.proposals = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryProposalsResponse proposals. + * @member {Array.} proposals + * @memberof cosmos.gov.v1beta1.QueryProposalsResponse + * @instance + */ + QueryProposalsResponse.prototype.proposals = $util.emptyArray; + + /** + * QueryProposalsResponse pagination. + * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination + * @memberof cosmos.gov.v1beta1.QueryProposalsResponse + * @instance + */ + QueryProposalsResponse.prototype.pagination = null; + + /** + * Encodes the specified QueryProposalsResponse message. Does not implicitly {@link cosmos.gov.v1beta1.QueryProposalsResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.QueryProposalsResponse + * @static + * @param {cosmos.gov.v1beta1.IQueryProposalsResponse} message QueryProposalsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryProposalsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.proposals != null && message.proposals.length) + for (let i = 0; i < message.proposals.length; ++i) + $root.cosmos.gov.v1beta1.Proposal.encode(message.proposals[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryProposalsResponse message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryProposalsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.QueryProposalsResponse + * @static + * @param {cosmos.gov.v1beta1.IQueryProposalsResponse} message QueryProposalsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryProposalsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryProposalsResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.QueryProposalsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.QueryProposalsResponse} QueryProposalsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryProposalsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryProposalsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.proposals && message.proposals.length)) + message.proposals = []; + message.proposals.push($root.cosmos.gov.v1beta1.Proposal.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryProposalsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.QueryProposalsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.QueryProposalsResponse} QueryProposalsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryProposalsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryProposalsResponse message. + * @function verify + * @memberof cosmos.gov.v1beta1.QueryProposalsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryProposalsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.proposals != null && message.hasOwnProperty("proposals")) { + if (!Array.isArray(message.proposals)) + return "proposals: array expected"; + for (let i = 0; i < message.proposals.length; ++i) { + let error = $root.cosmos.gov.v1beta1.Proposal.verify(message.proposals[i]); + if (error) + return "proposals." + error; + } + } + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryProposalsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.QueryProposalsResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.QueryProposalsResponse} QueryProposalsResponse + */ + QueryProposalsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.QueryProposalsResponse) + return object; + let message = new $root.cosmos.gov.v1beta1.QueryProposalsResponse(); + if (object.proposals) { + if (!Array.isArray(object.proposals)) + throw TypeError(".cosmos.gov.v1beta1.QueryProposalsResponse.proposals: array expected"); + message.proposals = []; + for (let i = 0; i < object.proposals.length; ++i) { + if (typeof object.proposals[i] !== "object") + throw TypeError(".cosmos.gov.v1beta1.QueryProposalsResponse.proposals: object expected"); + message.proposals[i] = $root.cosmos.gov.v1beta1.Proposal.fromObject(object.proposals[i]); + } + } + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.gov.v1beta1.QueryProposalsResponse.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryProposalsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.QueryProposalsResponse + * @static + * @param {cosmos.gov.v1beta1.QueryProposalsResponse} message QueryProposalsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryProposalsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.proposals = []; + if (options.defaults) + object.pagination = null; + if (message.proposals && message.proposals.length) { + object.proposals = []; + for (let j = 0; j < message.proposals.length; ++j) + object.proposals[j] = $root.cosmos.gov.v1beta1.Proposal.toObject(message.proposals[j], options); + } + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryProposalsResponse to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.QueryProposalsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryProposalsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryProposalsResponse; + })(); + + v1beta1.QueryVoteRequest = (function() { + + /** + * Properties of a QueryVoteRequest. + * @memberof cosmos.gov.v1beta1 + * @interface IQueryVoteRequest + * @property {Long|null} [proposal_id] QueryVoteRequest proposal_id + * @property {string|null} [voter] QueryVoteRequest voter + */ + + /** + * Constructs a new QueryVoteRequest. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a QueryVoteRequest. + * @implements IQueryVoteRequest + * @constructor + * @param {cosmos.gov.v1beta1.IQueryVoteRequest=} [properties] Properties to set + */ + function QueryVoteRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryVoteRequest proposal_id. + * @member {Long} proposal_id + * @memberof cosmos.gov.v1beta1.QueryVoteRequest + * @instance + */ + QueryVoteRequest.prototype.proposal_id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * QueryVoteRequest voter. + * @member {string} voter + * @memberof cosmos.gov.v1beta1.QueryVoteRequest + * @instance + */ + QueryVoteRequest.prototype.voter = ""; + + /** + * Encodes the specified QueryVoteRequest message. Does not implicitly {@link cosmos.gov.v1beta1.QueryVoteRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.QueryVoteRequest + * @static + * @param {cosmos.gov.v1beta1.IQueryVoteRequest} message QueryVoteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryVoteRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.proposal_id != null && Object.hasOwnProperty.call(message, "proposal_id")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.proposal_id); + if (message.voter != null && Object.hasOwnProperty.call(message, "voter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.voter); + return writer; + }; + + /** + * Encodes the specified QueryVoteRequest message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryVoteRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.QueryVoteRequest + * @static + * @param {cosmos.gov.v1beta1.IQueryVoteRequest} message QueryVoteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryVoteRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryVoteRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.QueryVoteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.QueryVoteRequest} QueryVoteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryVoteRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryVoteRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal_id = reader.uint64(); + break; + case 2: + message.voter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryVoteRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.QueryVoteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.QueryVoteRequest} QueryVoteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryVoteRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryVoteRequest message. + * @function verify + * @memberof cosmos.gov.v1beta1.QueryVoteRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryVoteRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) + if (!$util.isInteger(message.proposal_id) && !(message.proposal_id && $util.isInteger(message.proposal_id.low) && $util.isInteger(message.proposal_id.high))) + return "proposal_id: integer|Long expected"; + if (message.voter != null && message.hasOwnProperty("voter")) + if (!$util.isString(message.voter)) + return "voter: string expected"; + return null; + }; + + /** + * Creates a QueryVoteRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.QueryVoteRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.QueryVoteRequest} QueryVoteRequest + */ + QueryVoteRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.QueryVoteRequest) + return object; + let message = new $root.cosmos.gov.v1beta1.QueryVoteRequest(); + if (object.proposal_id != null) + if ($util.Long) + (message.proposal_id = $util.Long.fromValue(object.proposal_id)).unsigned = true; + else if (typeof object.proposal_id === "string") + message.proposal_id = parseInt(object.proposal_id, 10); + else if (typeof object.proposal_id === "number") + message.proposal_id = object.proposal_id; + else if (typeof object.proposal_id === "object") + message.proposal_id = new $util.LongBits(object.proposal_id.low >>> 0, object.proposal_id.high >>> 0).toNumber(true); + if (object.voter != null) + message.voter = String(object.voter); + return message; + }; + + /** + * Creates a plain object from a QueryVoteRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.QueryVoteRequest + * @static + * @param {cosmos.gov.v1beta1.QueryVoteRequest} message QueryVoteRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryVoteRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.proposal_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.proposal_id = options.longs === String ? "0" : 0; + object.voter = ""; + } + if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) + if (typeof message.proposal_id === "number") + object.proposal_id = options.longs === String ? String(message.proposal_id) : message.proposal_id; + else + object.proposal_id = options.longs === String ? $util.Long.prototype.toString.call(message.proposal_id) : options.longs === Number ? new $util.LongBits(message.proposal_id.low >>> 0, message.proposal_id.high >>> 0).toNumber(true) : message.proposal_id; + if (message.voter != null && message.hasOwnProperty("voter")) + object.voter = message.voter; + return object; + }; + + /** + * Converts this QueryVoteRequest to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.QueryVoteRequest + * @instance + * @returns {Object.} JSON object + */ + QueryVoteRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryVoteRequest; + })(); + + v1beta1.QueryVoteResponse = (function() { + + /** + * Properties of a QueryVoteResponse. + * @memberof cosmos.gov.v1beta1 + * @interface IQueryVoteResponse + * @property {cosmos.gov.v1beta1.IVote|null} [vote] QueryVoteResponse vote + */ + + /** + * Constructs a new QueryVoteResponse. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a QueryVoteResponse. + * @implements IQueryVoteResponse + * @constructor + * @param {cosmos.gov.v1beta1.IQueryVoteResponse=} [properties] Properties to set + */ + function QueryVoteResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryVoteResponse vote. + * @member {cosmos.gov.v1beta1.IVote|null|undefined} vote + * @memberof cosmos.gov.v1beta1.QueryVoteResponse + * @instance + */ + QueryVoteResponse.prototype.vote = null; + + /** + * Encodes the specified QueryVoteResponse message. Does not implicitly {@link cosmos.gov.v1beta1.QueryVoteResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.QueryVoteResponse + * @static + * @param {cosmos.gov.v1beta1.IQueryVoteResponse} message QueryVoteResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryVoteResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.vote != null && Object.hasOwnProperty.call(message, "vote")) + $root.cosmos.gov.v1beta1.Vote.encode(message.vote, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryVoteResponse message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryVoteResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.QueryVoteResponse + * @static + * @param {cosmos.gov.v1beta1.IQueryVoteResponse} message QueryVoteResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryVoteResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryVoteResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.QueryVoteResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.QueryVoteResponse} QueryVoteResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryVoteResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryVoteResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.vote = $root.cosmos.gov.v1beta1.Vote.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryVoteResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.QueryVoteResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.QueryVoteResponse} QueryVoteResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryVoteResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryVoteResponse message. + * @function verify + * @memberof cosmos.gov.v1beta1.QueryVoteResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryVoteResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.vote != null && message.hasOwnProperty("vote")) { + let error = $root.cosmos.gov.v1beta1.Vote.verify(message.vote); + if (error) + return "vote." + error; + } + return null; + }; + + /** + * Creates a QueryVoteResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.QueryVoteResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.QueryVoteResponse} QueryVoteResponse + */ + QueryVoteResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.QueryVoteResponse) + return object; + let message = new $root.cosmos.gov.v1beta1.QueryVoteResponse(); + if (object.vote != null) { + if (typeof object.vote !== "object") + throw TypeError(".cosmos.gov.v1beta1.QueryVoteResponse.vote: object expected"); + message.vote = $root.cosmos.gov.v1beta1.Vote.fromObject(object.vote); + } + return message; + }; + + /** + * Creates a plain object from a QueryVoteResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.QueryVoteResponse + * @static + * @param {cosmos.gov.v1beta1.QueryVoteResponse} message QueryVoteResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryVoteResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.vote = null; + if (message.vote != null && message.hasOwnProperty("vote")) + object.vote = $root.cosmos.gov.v1beta1.Vote.toObject(message.vote, options); + return object; + }; + + /** + * Converts this QueryVoteResponse to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.QueryVoteResponse + * @instance + * @returns {Object.} JSON object + */ + QueryVoteResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryVoteResponse; + })(); + + v1beta1.QueryVotesRequest = (function() { + + /** + * Properties of a QueryVotesRequest. + * @memberof cosmos.gov.v1beta1 + * @interface IQueryVotesRequest + * @property {Long|null} [proposal_id] QueryVotesRequest proposal_id + * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryVotesRequest pagination + */ + + /** + * Constructs a new QueryVotesRequest. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a QueryVotesRequest. + * @implements IQueryVotesRequest + * @constructor + * @param {cosmos.gov.v1beta1.IQueryVotesRequest=} [properties] Properties to set + */ + function QueryVotesRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryVotesRequest proposal_id. + * @member {Long} proposal_id + * @memberof cosmos.gov.v1beta1.QueryVotesRequest + * @instance + */ + QueryVotesRequest.prototype.proposal_id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * QueryVotesRequest pagination. + * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination + * @memberof cosmos.gov.v1beta1.QueryVotesRequest + * @instance + */ + QueryVotesRequest.prototype.pagination = null; + + /** + * Encodes the specified QueryVotesRequest message. Does not implicitly {@link cosmos.gov.v1beta1.QueryVotesRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.QueryVotesRequest + * @static + * @param {cosmos.gov.v1beta1.IQueryVotesRequest} message QueryVotesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryVotesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.proposal_id != null && Object.hasOwnProperty.call(message, "proposal_id")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.proposal_id); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryVotesRequest message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryVotesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.QueryVotesRequest + * @static + * @param {cosmos.gov.v1beta1.IQueryVotesRequest} message QueryVotesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryVotesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryVotesRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.QueryVotesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.QueryVotesRequest} QueryVotesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryVotesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryVotesRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal_id = reader.uint64(); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryVotesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.QueryVotesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.QueryVotesRequest} QueryVotesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryVotesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryVotesRequest message. + * @function verify + * @memberof cosmos.gov.v1beta1.QueryVotesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryVotesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) + if (!$util.isInteger(message.proposal_id) && !(message.proposal_id && $util.isInteger(message.proposal_id.low) && $util.isInteger(message.proposal_id.high))) + return "proposal_id: integer|Long expected"; + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryVotesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.QueryVotesRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.QueryVotesRequest} QueryVotesRequest + */ + QueryVotesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.QueryVotesRequest) + return object; + let message = new $root.cosmos.gov.v1beta1.QueryVotesRequest(); + if (object.proposal_id != null) + if ($util.Long) + (message.proposal_id = $util.Long.fromValue(object.proposal_id)).unsigned = true; + else if (typeof object.proposal_id === "string") + message.proposal_id = parseInt(object.proposal_id, 10); + else if (typeof object.proposal_id === "number") + message.proposal_id = object.proposal_id; + else if (typeof object.proposal_id === "object") + message.proposal_id = new $util.LongBits(object.proposal_id.low >>> 0, object.proposal_id.high >>> 0).toNumber(true); + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.gov.v1beta1.QueryVotesRequest.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryVotesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.QueryVotesRequest + * @static + * @param {cosmos.gov.v1beta1.QueryVotesRequest} message QueryVotesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryVotesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.proposal_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.proposal_id = options.longs === String ? "0" : 0; + object.pagination = null; + } + if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) + if (typeof message.proposal_id === "number") + object.proposal_id = options.longs === String ? String(message.proposal_id) : message.proposal_id; + else + object.proposal_id = options.longs === String ? $util.Long.prototype.toString.call(message.proposal_id) : options.longs === Number ? new $util.LongBits(message.proposal_id.low >>> 0, message.proposal_id.high >>> 0).toNumber(true) : message.proposal_id; + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryVotesRequest to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.QueryVotesRequest + * @instance + * @returns {Object.} JSON object + */ + QueryVotesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryVotesRequest; + })(); + + v1beta1.QueryVotesResponse = (function() { + + /** + * Properties of a QueryVotesResponse. + * @memberof cosmos.gov.v1beta1 + * @interface IQueryVotesResponse + * @property {Array.|null} [votes] QueryVotesResponse votes + * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryVotesResponse pagination + */ + + /** + * Constructs a new QueryVotesResponse. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a QueryVotesResponse. + * @implements IQueryVotesResponse + * @constructor + * @param {cosmos.gov.v1beta1.IQueryVotesResponse=} [properties] Properties to set + */ + function QueryVotesResponse(properties) { + this.votes = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryVotesResponse votes. + * @member {Array.} votes + * @memberof cosmos.gov.v1beta1.QueryVotesResponse + * @instance + */ + QueryVotesResponse.prototype.votes = $util.emptyArray; + + /** + * QueryVotesResponse pagination. + * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination + * @memberof cosmos.gov.v1beta1.QueryVotesResponse + * @instance + */ + QueryVotesResponse.prototype.pagination = null; + + /** + * Encodes the specified QueryVotesResponse message. Does not implicitly {@link cosmos.gov.v1beta1.QueryVotesResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.QueryVotesResponse + * @static + * @param {cosmos.gov.v1beta1.IQueryVotesResponse} message QueryVotesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryVotesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.votes != null && message.votes.length) + for (let i = 0; i < message.votes.length; ++i) + $root.cosmos.gov.v1beta1.Vote.encode(message.votes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryVotesResponse message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryVotesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.QueryVotesResponse + * @static + * @param {cosmos.gov.v1beta1.IQueryVotesResponse} message QueryVotesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryVotesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryVotesResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.QueryVotesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.QueryVotesResponse} QueryVotesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryVotesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryVotesResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.votes && message.votes.length)) + message.votes = []; + message.votes.push($root.cosmos.gov.v1beta1.Vote.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryVotesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.QueryVotesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.QueryVotesResponse} QueryVotesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryVotesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryVotesResponse message. + * @function verify + * @memberof cosmos.gov.v1beta1.QueryVotesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryVotesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.votes != null && message.hasOwnProperty("votes")) { + if (!Array.isArray(message.votes)) + return "votes: array expected"; + for (let i = 0; i < message.votes.length; ++i) { + let error = $root.cosmos.gov.v1beta1.Vote.verify(message.votes[i]); + if (error) + return "votes." + error; + } + } + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryVotesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.QueryVotesResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.QueryVotesResponse} QueryVotesResponse + */ + QueryVotesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.QueryVotesResponse) + return object; + let message = new $root.cosmos.gov.v1beta1.QueryVotesResponse(); + if (object.votes) { + if (!Array.isArray(object.votes)) + throw TypeError(".cosmos.gov.v1beta1.QueryVotesResponse.votes: array expected"); + message.votes = []; + for (let i = 0; i < object.votes.length; ++i) { + if (typeof object.votes[i] !== "object") + throw TypeError(".cosmos.gov.v1beta1.QueryVotesResponse.votes: object expected"); + message.votes[i] = $root.cosmos.gov.v1beta1.Vote.fromObject(object.votes[i]); + } + } + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.gov.v1beta1.QueryVotesResponse.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryVotesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.QueryVotesResponse + * @static + * @param {cosmos.gov.v1beta1.QueryVotesResponse} message QueryVotesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryVotesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.votes = []; + if (options.defaults) + object.pagination = null; + if (message.votes && message.votes.length) { + object.votes = []; + for (let j = 0; j < message.votes.length; ++j) + object.votes[j] = $root.cosmos.gov.v1beta1.Vote.toObject(message.votes[j], options); + } + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryVotesResponse to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.QueryVotesResponse + * @instance + * @returns {Object.} JSON object + */ + QueryVotesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryVotesResponse; + })(); + + v1beta1.QueryParamsRequest = (function() { + + /** + * Properties of a QueryParamsRequest. + * @memberof cosmos.gov.v1beta1 + * @interface IQueryParamsRequest + * @property {string|null} [params_type] QueryParamsRequest params_type + */ + + /** + * Constructs a new QueryParamsRequest. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a QueryParamsRequest. + * @implements IQueryParamsRequest + * @constructor + * @param {cosmos.gov.v1beta1.IQueryParamsRequest=} [properties] Properties to set + */ + function QueryParamsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryParamsRequest params_type. + * @member {string} params_type + * @memberof cosmos.gov.v1beta1.QueryParamsRequest + * @instance + */ + QueryParamsRequest.prototype.params_type = ""; + + /** + * Encodes the specified QueryParamsRequest message. Does not implicitly {@link cosmos.gov.v1beta1.QueryParamsRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.QueryParamsRequest + * @static + * @param {cosmos.gov.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.params_type != null && Object.hasOwnProperty.call(message, "params_type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.params_type); + return writer; + }; + + /** + * Encodes the specified QueryParamsRequest message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryParamsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.QueryParamsRequest + * @static + * @param {cosmos.gov.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryParamsRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.QueryParamsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.QueryParamsRequest} QueryParamsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryParamsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params_type = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryParamsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.QueryParamsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.QueryParamsRequest} QueryParamsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryParamsRequest message. + * @function verify + * @memberof cosmos.gov.v1beta1.QueryParamsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryParamsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.params_type != null && message.hasOwnProperty("params_type")) + if (!$util.isString(message.params_type)) + return "params_type: string expected"; + return null; + }; + + /** + * Creates a QueryParamsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.QueryParamsRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.QueryParamsRequest} QueryParamsRequest + */ + QueryParamsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.QueryParamsRequest) + return object; + let message = new $root.cosmos.gov.v1beta1.QueryParamsRequest(); + if (object.params_type != null) + message.params_type = String(object.params_type); + return message; + }; + + /** + * Creates a plain object from a QueryParamsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.QueryParamsRequest + * @static + * @param {cosmos.gov.v1beta1.QueryParamsRequest} message QueryParamsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryParamsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.params_type = ""; + if (message.params_type != null && message.hasOwnProperty("params_type")) + object.params_type = message.params_type; + return object; + }; + + /** + * Converts this QueryParamsRequest to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.QueryParamsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryParamsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryParamsRequest; + })(); + + v1beta1.QueryParamsResponse = (function() { + + /** + * Properties of a QueryParamsResponse. + * @memberof cosmos.gov.v1beta1 + * @interface IQueryParamsResponse + * @property {cosmos.gov.v1beta1.IVotingParams|null} [voting_params] QueryParamsResponse voting_params + * @property {cosmos.gov.v1beta1.IDepositParams|null} [deposit_params] QueryParamsResponse deposit_params + * @property {cosmos.gov.v1beta1.ITallyParams|null} [tally_params] QueryParamsResponse tally_params + */ + + /** + * Constructs a new QueryParamsResponse. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a QueryParamsResponse. + * @implements IQueryParamsResponse + * @constructor + * @param {cosmos.gov.v1beta1.IQueryParamsResponse=} [properties] Properties to set + */ + function QueryParamsResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryParamsResponse voting_params. + * @member {cosmos.gov.v1beta1.IVotingParams|null|undefined} voting_params + * @memberof cosmos.gov.v1beta1.QueryParamsResponse + * @instance + */ + QueryParamsResponse.prototype.voting_params = null; + + /** + * QueryParamsResponse deposit_params. + * @member {cosmos.gov.v1beta1.IDepositParams|null|undefined} deposit_params + * @memberof cosmos.gov.v1beta1.QueryParamsResponse + * @instance + */ + QueryParamsResponse.prototype.deposit_params = null; + + /** + * QueryParamsResponse tally_params. + * @member {cosmos.gov.v1beta1.ITallyParams|null|undefined} tally_params + * @memberof cosmos.gov.v1beta1.QueryParamsResponse + * @instance + */ + QueryParamsResponse.prototype.tally_params = null; + + /** + * Encodes the specified QueryParamsResponse message. Does not implicitly {@link cosmos.gov.v1beta1.QueryParamsResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.QueryParamsResponse + * @static + * @param {cosmos.gov.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.voting_params != null && Object.hasOwnProperty.call(message, "voting_params")) + $root.cosmos.gov.v1beta1.VotingParams.encode(message.voting_params, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.deposit_params != null && Object.hasOwnProperty.call(message, "deposit_params")) + $root.cosmos.gov.v1beta1.DepositParams.encode(message.deposit_params, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.tally_params != null && Object.hasOwnProperty.call(message, "tally_params")) + $root.cosmos.gov.v1beta1.TallyParams.encode(message.tally_params, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryParamsResponse message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryParamsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.QueryParamsResponse + * @static + * @param {cosmos.gov.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryParamsResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.QueryParamsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.QueryParamsResponse} QueryParamsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryParamsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.voting_params = $root.cosmos.gov.v1beta1.VotingParams.decode(reader, reader.uint32()); + break; + case 2: + message.deposit_params = $root.cosmos.gov.v1beta1.DepositParams.decode(reader, reader.uint32()); + break; + case 3: + message.tally_params = $root.cosmos.gov.v1beta1.TallyParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryParamsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.QueryParamsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.QueryParamsResponse} QueryParamsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryParamsResponse message. + * @function verify + * @memberof cosmos.gov.v1beta1.QueryParamsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryParamsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.voting_params != null && message.hasOwnProperty("voting_params")) { + let error = $root.cosmos.gov.v1beta1.VotingParams.verify(message.voting_params); + if (error) + return "voting_params." + error; + } + if (message.deposit_params != null && message.hasOwnProperty("deposit_params")) { + let error = $root.cosmos.gov.v1beta1.DepositParams.verify(message.deposit_params); + if (error) + return "deposit_params." + error; + } + if (message.tally_params != null && message.hasOwnProperty("tally_params")) { + let error = $root.cosmos.gov.v1beta1.TallyParams.verify(message.tally_params); + if (error) + return "tally_params." + error; + } + return null; + }; + + /** + * Creates a QueryParamsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.QueryParamsResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.QueryParamsResponse} QueryParamsResponse + */ + QueryParamsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.QueryParamsResponse) + return object; + let message = new $root.cosmos.gov.v1beta1.QueryParamsResponse(); + if (object.voting_params != null) { + if (typeof object.voting_params !== "object") + throw TypeError(".cosmos.gov.v1beta1.QueryParamsResponse.voting_params: object expected"); + message.voting_params = $root.cosmos.gov.v1beta1.VotingParams.fromObject(object.voting_params); + } + if (object.deposit_params != null) { + if (typeof object.deposit_params !== "object") + throw TypeError(".cosmos.gov.v1beta1.QueryParamsResponse.deposit_params: object expected"); + message.deposit_params = $root.cosmos.gov.v1beta1.DepositParams.fromObject(object.deposit_params); + } + if (object.tally_params != null) { + if (typeof object.tally_params !== "object") + throw TypeError(".cosmos.gov.v1beta1.QueryParamsResponse.tally_params: object expected"); + message.tally_params = $root.cosmos.gov.v1beta1.TallyParams.fromObject(object.tally_params); + } + return message; + }; + + /** + * Creates a plain object from a QueryParamsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.QueryParamsResponse + * @static + * @param {cosmos.gov.v1beta1.QueryParamsResponse} message QueryParamsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryParamsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.voting_params = null; + object.deposit_params = null; + object.tally_params = null; + } + if (message.voting_params != null && message.hasOwnProperty("voting_params")) + object.voting_params = $root.cosmos.gov.v1beta1.VotingParams.toObject(message.voting_params, options); + if (message.deposit_params != null && message.hasOwnProperty("deposit_params")) + object.deposit_params = $root.cosmos.gov.v1beta1.DepositParams.toObject(message.deposit_params, options); + if (message.tally_params != null && message.hasOwnProperty("tally_params")) + object.tally_params = $root.cosmos.gov.v1beta1.TallyParams.toObject(message.tally_params, options); + return object; + }; + + /** + * Converts this QueryParamsResponse to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.QueryParamsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryParamsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryParamsResponse; + })(); + + v1beta1.QueryDepositRequest = (function() { + + /** + * Properties of a QueryDepositRequest. + * @memberof cosmos.gov.v1beta1 + * @interface IQueryDepositRequest + * @property {Long|null} [proposal_id] QueryDepositRequest proposal_id + * @property {string|null} [depositor] QueryDepositRequest depositor + */ + + /** + * Constructs a new QueryDepositRequest. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a QueryDepositRequest. + * @implements IQueryDepositRequest + * @constructor + * @param {cosmos.gov.v1beta1.IQueryDepositRequest=} [properties] Properties to set + */ + function QueryDepositRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryDepositRequest proposal_id. + * @member {Long} proposal_id + * @memberof cosmos.gov.v1beta1.QueryDepositRequest + * @instance + */ + QueryDepositRequest.prototype.proposal_id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * QueryDepositRequest depositor. + * @member {string} depositor + * @memberof cosmos.gov.v1beta1.QueryDepositRequest + * @instance + */ + QueryDepositRequest.prototype.depositor = ""; + + /** + * Encodes the specified QueryDepositRequest message. Does not implicitly {@link cosmos.gov.v1beta1.QueryDepositRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.QueryDepositRequest + * @static + * @param {cosmos.gov.v1beta1.IQueryDepositRequest} message QueryDepositRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDepositRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.proposal_id != null && Object.hasOwnProperty.call(message, "proposal_id")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.proposal_id); + if (message.depositor != null && Object.hasOwnProperty.call(message, "depositor")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.depositor); + return writer; + }; + + /** + * Encodes the specified QueryDepositRequest message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryDepositRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.QueryDepositRequest + * @static + * @param {cosmos.gov.v1beta1.IQueryDepositRequest} message QueryDepositRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDepositRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryDepositRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.QueryDepositRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.QueryDepositRequest} QueryDepositRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDepositRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryDepositRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal_id = reader.uint64(); + break; + case 2: + message.depositor = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryDepositRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.QueryDepositRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.QueryDepositRequest} QueryDepositRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDepositRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryDepositRequest message. + * @function verify + * @memberof cosmos.gov.v1beta1.QueryDepositRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryDepositRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) + if (!$util.isInteger(message.proposal_id) && !(message.proposal_id && $util.isInteger(message.proposal_id.low) && $util.isInteger(message.proposal_id.high))) + return "proposal_id: integer|Long expected"; + if (message.depositor != null && message.hasOwnProperty("depositor")) + if (!$util.isString(message.depositor)) + return "depositor: string expected"; + return null; + }; + + /** + * Creates a QueryDepositRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.QueryDepositRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.QueryDepositRequest} QueryDepositRequest + */ + QueryDepositRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.QueryDepositRequest) + return object; + let message = new $root.cosmos.gov.v1beta1.QueryDepositRequest(); + if (object.proposal_id != null) + if ($util.Long) + (message.proposal_id = $util.Long.fromValue(object.proposal_id)).unsigned = true; + else if (typeof object.proposal_id === "string") + message.proposal_id = parseInt(object.proposal_id, 10); + else if (typeof object.proposal_id === "number") + message.proposal_id = object.proposal_id; + else if (typeof object.proposal_id === "object") + message.proposal_id = new $util.LongBits(object.proposal_id.low >>> 0, object.proposal_id.high >>> 0).toNumber(true); + if (object.depositor != null) + message.depositor = String(object.depositor); + return message; + }; + + /** + * Creates a plain object from a QueryDepositRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.QueryDepositRequest + * @static + * @param {cosmos.gov.v1beta1.QueryDepositRequest} message QueryDepositRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryDepositRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.proposal_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.proposal_id = options.longs === String ? "0" : 0; + object.depositor = ""; + } + if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) + if (typeof message.proposal_id === "number") + object.proposal_id = options.longs === String ? String(message.proposal_id) : message.proposal_id; + else + object.proposal_id = options.longs === String ? $util.Long.prototype.toString.call(message.proposal_id) : options.longs === Number ? new $util.LongBits(message.proposal_id.low >>> 0, message.proposal_id.high >>> 0).toNumber(true) : message.proposal_id; + if (message.depositor != null && message.hasOwnProperty("depositor")) + object.depositor = message.depositor; + return object; + }; + + /** + * Converts this QueryDepositRequest to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.QueryDepositRequest + * @instance + * @returns {Object.} JSON object + */ + QueryDepositRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryDepositRequest; + })(); + + v1beta1.QueryDepositResponse = (function() { + + /** + * Properties of a QueryDepositResponse. + * @memberof cosmos.gov.v1beta1 + * @interface IQueryDepositResponse + * @property {cosmos.gov.v1beta1.IDeposit|null} [deposit] QueryDepositResponse deposit + */ + + /** + * Constructs a new QueryDepositResponse. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a QueryDepositResponse. + * @implements IQueryDepositResponse + * @constructor + * @param {cosmos.gov.v1beta1.IQueryDepositResponse=} [properties] Properties to set + */ + function QueryDepositResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryDepositResponse deposit. + * @member {cosmos.gov.v1beta1.IDeposit|null|undefined} deposit + * @memberof cosmos.gov.v1beta1.QueryDepositResponse + * @instance + */ + QueryDepositResponse.prototype.deposit = null; + + /** + * Encodes the specified QueryDepositResponse message. Does not implicitly {@link cosmos.gov.v1beta1.QueryDepositResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.QueryDepositResponse + * @static + * @param {cosmos.gov.v1beta1.IQueryDepositResponse} message QueryDepositResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDepositResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deposit != null && Object.hasOwnProperty.call(message, "deposit")) + $root.cosmos.gov.v1beta1.Deposit.encode(message.deposit, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryDepositResponse message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryDepositResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.QueryDepositResponse + * @static + * @param {cosmos.gov.v1beta1.IQueryDepositResponse} message QueryDepositResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDepositResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryDepositResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.QueryDepositResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.QueryDepositResponse} QueryDepositResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDepositResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryDepositResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deposit = $root.cosmos.gov.v1beta1.Deposit.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryDepositResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.QueryDepositResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.QueryDepositResponse} QueryDepositResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDepositResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryDepositResponse message. + * @function verify + * @memberof cosmos.gov.v1beta1.QueryDepositResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryDepositResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deposit != null && message.hasOwnProperty("deposit")) { + let error = $root.cosmos.gov.v1beta1.Deposit.verify(message.deposit); + if (error) + return "deposit." + error; + } + return null; + }; + + /** + * Creates a QueryDepositResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.QueryDepositResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.QueryDepositResponse} QueryDepositResponse + */ + QueryDepositResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.QueryDepositResponse) + return object; + let message = new $root.cosmos.gov.v1beta1.QueryDepositResponse(); + if (object.deposit != null) { + if (typeof object.deposit !== "object") + throw TypeError(".cosmos.gov.v1beta1.QueryDepositResponse.deposit: object expected"); + message.deposit = $root.cosmos.gov.v1beta1.Deposit.fromObject(object.deposit); + } + return message; + }; + + /** + * Creates a plain object from a QueryDepositResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.QueryDepositResponse + * @static + * @param {cosmos.gov.v1beta1.QueryDepositResponse} message QueryDepositResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryDepositResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.deposit = null; + if (message.deposit != null && message.hasOwnProperty("deposit")) + object.deposit = $root.cosmos.gov.v1beta1.Deposit.toObject(message.deposit, options); + return object; + }; + + /** + * Converts this QueryDepositResponse to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.QueryDepositResponse + * @instance + * @returns {Object.} JSON object + */ + QueryDepositResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryDepositResponse; + })(); + + v1beta1.QueryDepositsRequest = (function() { + + /** + * Properties of a QueryDepositsRequest. + * @memberof cosmos.gov.v1beta1 + * @interface IQueryDepositsRequest + * @property {Long|null} [proposal_id] QueryDepositsRequest proposal_id + * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryDepositsRequest pagination + */ + + /** + * Constructs a new QueryDepositsRequest. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a QueryDepositsRequest. + * @implements IQueryDepositsRequest + * @constructor + * @param {cosmos.gov.v1beta1.IQueryDepositsRequest=} [properties] Properties to set + */ + function QueryDepositsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryDepositsRequest proposal_id. + * @member {Long} proposal_id + * @memberof cosmos.gov.v1beta1.QueryDepositsRequest + * @instance + */ + QueryDepositsRequest.prototype.proposal_id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * QueryDepositsRequest pagination. + * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination + * @memberof cosmos.gov.v1beta1.QueryDepositsRequest + * @instance + */ + QueryDepositsRequest.prototype.pagination = null; + + /** + * Encodes the specified QueryDepositsRequest message. Does not implicitly {@link cosmos.gov.v1beta1.QueryDepositsRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.QueryDepositsRequest + * @static + * @param {cosmos.gov.v1beta1.IQueryDepositsRequest} message QueryDepositsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDepositsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.proposal_id != null && Object.hasOwnProperty.call(message, "proposal_id")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.proposal_id); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryDepositsRequest message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryDepositsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.QueryDepositsRequest + * @static + * @param {cosmos.gov.v1beta1.IQueryDepositsRequest} message QueryDepositsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDepositsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryDepositsRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.QueryDepositsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.QueryDepositsRequest} QueryDepositsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDepositsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryDepositsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal_id = reader.uint64(); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryDepositsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.QueryDepositsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.QueryDepositsRequest} QueryDepositsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDepositsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryDepositsRequest message. + * @function verify + * @memberof cosmos.gov.v1beta1.QueryDepositsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryDepositsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) + if (!$util.isInteger(message.proposal_id) && !(message.proposal_id && $util.isInteger(message.proposal_id.low) && $util.isInteger(message.proposal_id.high))) + return "proposal_id: integer|Long expected"; + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryDepositsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.QueryDepositsRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.QueryDepositsRequest} QueryDepositsRequest + */ + QueryDepositsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.QueryDepositsRequest) + return object; + let message = new $root.cosmos.gov.v1beta1.QueryDepositsRequest(); + if (object.proposal_id != null) + if ($util.Long) + (message.proposal_id = $util.Long.fromValue(object.proposal_id)).unsigned = true; + else if (typeof object.proposal_id === "string") + message.proposal_id = parseInt(object.proposal_id, 10); + else if (typeof object.proposal_id === "number") + message.proposal_id = object.proposal_id; + else if (typeof object.proposal_id === "object") + message.proposal_id = new $util.LongBits(object.proposal_id.low >>> 0, object.proposal_id.high >>> 0).toNumber(true); + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.gov.v1beta1.QueryDepositsRequest.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryDepositsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.QueryDepositsRequest + * @static + * @param {cosmos.gov.v1beta1.QueryDepositsRequest} message QueryDepositsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryDepositsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.proposal_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.proposal_id = options.longs === String ? "0" : 0; + object.pagination = null; + } + if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) + if (typeof message.proposal_id === "number") + object.proposal_id = options.longs === String ? String(message.proposal_id) : message.proposal_id; + else + object.proposal_id = options.longs === String ? $util.Long.prototype.toString.call(message.proposal_id) : options.longs === Number ? new $util.LongBits(message.proposal_id.low >>> 0, message.proposal_id.high >>> 0).toNumber(true) : message.proposal_id; + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryDepositsRequest to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.QueryDepositsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryDepositsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryDepositsRequest; + })(); + + v1beta1.QueryDepositsResponse = (function() { + + /** + * Properties of a QueryDepositsResponse. + * @memberof cosmos.gov.v1beta1 + * @interface IQueryDepositsResponse + * @property {Array.|null} [deposits] QueryDepositsResponse deposits + * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryDepositsResponse pagination + */ + + /** + * Constructs a new QueryDepositsResponse. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a QueryDepositsResponse. + * @implements IQueryDepositsResponse + * @constructor + * @param {cosmos.gov.v1beta1.IQueryDepositsResponse=} [properties] Properties to set + */ + function QueryDepositsResponse(properties) { + this.deposits = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryDepositsResponse deposits. + * @member {Array.} deposits + * @memberof cosmos.gov.v1beta1.QueryDepositsResponse + * @instance + */ + QueryDepositsResponse.prototype.deposits = $util.emptyArray; + + /** + * QueryDepositsResponse pagination. + * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination + * @memberof cosmos.gov.v1beta1.QueryDepositsResponse + * @instance + */ + QueryDepositsResponse.prototype.pagination = null; + + /** + * Encodes the specified QueryDepositsResponse message. Does not implicitly {@link cosmos.gov.v1beta1.QueryDepositsResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.QueryDepositsResponse + * @static + * @param {cosmos.gov.v1beta1.IQueryDepositsResponse} message QueryDepositsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDepositsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deposits != null && message.deposits.length) + for (let i = 0; i < message.deposits.length; ++i) + $root.cosmos.gov.v1beta1.Deposit.encode(message.deposits[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryDepositsResponse message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryDepositsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.QueryDepositsResponse + * @static + * @param {cosmos.gov.v1beta1.IQueryDepositsResponse} message QueryDepositsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDepositsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryDepositsResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.QueryDepositsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.QueryDepositsResponse} QueryDepositsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDepositsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryDepositsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.deposits && message.deposits.length)) + message.deposits = []; + message.deposits.push($root.cosmos.gov.v1beta1.Deposit.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryDepositsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.QueryDepositsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.QueryDepositsResponse} QueryDepositsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDepositsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryDepositsResponse message. + * @function verify + * @memberof cosmos.gov.v1beta1.QueryDepositsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryDepositsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deposits != null && message.hasOwnProperty("deposits")) { + if (!Array.isArray(message.deposits)) + return "deposits: array expected"; + for (let i = 0; i < message.deposits.length; ++i) { + let error = $root.cosmos.gov.v1beta1.Deposit.verify(message.deposits[i]); + if (error) + return "deposits." + error; + } + } + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryDepositsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.QueryDepositsResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.QueryDepositsResponse} QueryDepositsResponse + */ + QueryDepositsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.QueryDepositsResponse) + return object; + let message = new $root.cosmos.gov.v1beta1.QueryDepositsResponse(); + if (object.deposits) { + if (!Array.isArray(object.deposits)) + throw TypeError(".cosmos.gov.v1beta1.QueryDepositsResponse.deposits: array expected"); + message.deposits = []; + for (let i = 0; i < object.deposits.length; ++i) { + if (typeof object.deposits[i] !== "object") + throw TypeError(".cosmos.gov.v1beta1.QueryDepositsResponse.deposits: object expected"); + message.deposits[i] = $root.cosmos.gov.v1beta1.Deposit.fromObject(object.deposits[i]); + } + } + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.gov.v1beta1.QueryDepositsResponse.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryDepositsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.QueryDepositsResponse + * @static + * @param {cosmos.gov.v1beta1.QueryDepositsResponse} message QueryDepositsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryDepositsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.deposits = []; + if (options.defaults) + object.pagination = null; + if (message.deposits && message.deposits.length) { + object.deposits = []; + for (let j = 0; j < message.deposits.length; ++j) + object.deposits[j] = $root.cosmos.gov.v1beta1.Deposit.toObject(message.deposits[j], options); + } + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryDepositsResponse to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.QueryDepositsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryDepositsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryDepositsResponse; + })(); + + v1beta1.QueryTallyResultRequest = (function() { + + /** + * Properties of a QueryTallyResultRequest. + * @memberof cosmos.gov.v1beta1 + * @interface IQueryTallyResultRequest + * @property {Long|null} [proposal_id] QueryTallyResultRequest proposal_id + */ + + /** + * Constructs a new QueryTallyResultRequest. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a QueryTallyResultRequest. + * @implements IQueryTallyResultRequest + * @constructor + * @param {cosmos.gov.v1beta1.IQueryTallyResultRequest=} [properties] Properties to set + */ + function QueryTallyResultRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryTallyResultRequest proposal_id. + * @member {Long} proposal_id + * @memberof cosmos.gov.v1beta1.QueryTallyResultRequest + * @instance + */ + QueryTallyResultRequest.prototype.proposal_id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified QueryTallyResultRequest message. Does not implicitly {@link cosmos.gov.v1beta1.QueryTallyResultRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.QueryTallyResultRequest + * @static + * @param {cosmos.gov.v1beta1.IQueryTallyResultRequest} message QueryTallyResultRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryTallyResultRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.proposal_id != null && Object.hasOwnProperty.call(message, "proposal_id")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.proposal_id); + return writer; + }; + + /** + * Encodes the specified QueryTallyResultRequest message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryTallyResultRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.QueryTallyResultRequest + * @static + * @param {cosmos.gov.v1beta1.IQueryTallyResultRequest} message QueryTallyResultRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryTallyResultRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryTallyResultRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.QueryTallyResultRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.QueryTallyResultRequest} QueryTallyResultRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryTallyResultRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryTallyResultRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal_id = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryTallyResultRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.QueryTallyResultRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.QueryTallyResultRequest} QueryTallyResultRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryTallyResultRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryTallyResultRequest message. + * @function verify + * @memberof cosmos.gov.v1beta1.QueryTallyResultRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryTallyResultRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) + if (!$util.isInteger(message.proposal_id) && !(message.proposal_id && $util.isInteger(message.proposal_id.low) && $util.isInteger(message.proposal_id.high))) + return "proposal_id: integer|Long expected"; + return null; + }; + + /** + * Creates a QueryTallyResultRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.QueryTallyResultRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.QueryTallyResultRequest} QueryTallyResultRequest + */ + QueryTallyResultRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.QueryTallyResultRequest) + return object; + let message = new $root.cosmos.gov.v1beta1.QueryTallyResultRequest(); + if (object.proposal_id != null) + if ($util.Long) + (message.proposal_id = $util.Long.fromValue(object.proposal_id)).unsigned = true; + else if (typeof object.proposal_id === "string") + message.proposal_id = parseInt(object.proposal_id, 10); + else if (typeof object.proposal_id === "number") + message.proposal_id = object.proposal_id; + else if (typeof object.proposal_id === "object") + message.proposal_id = new $util.LongBits(object.proposal_id.low >>> 0, object.proposal_id.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a QueryTallyResultRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.QueryTallyResultRequest + * @static + * @param {cosmos.gov.v1beta1.QueryTallyResultRequest} message QueryTallyResultRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryTallyResultRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.proposal_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.proposal_id = options.longs === String ? "0" : 0; + if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) + if (typeof message.proposal_id === "number") + object.proposal_id = options.longs === String ? String(message.proposal_id) : message.proposal_id; + else + object.proposal_id = options.longs === String ? $util.Long.prototype.toString.call(message.proposal_id) : options.longs === Number ? new $util.LongBits(message.proposal_id.low >>> 0, message.proposal_id.high >>> 0).toNumber(true) : message.proposal_id; + return object; + }; + + /** + * Converts this QueryTallyResultRequest to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.QueryTallyResultRequest + * @instance + * @returns {Object.} JSON object + */ + QueryTallyResultRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryTallyResultRequest; + })(); + + v1beta1.QueryTallyResultResponse = (function() { + + /** + * Properties of a QueryTallyResultResponse. + * @memberof cosmos.gov.v1beta1 + * @interface IQueryTallyResultResponse + * @property {cosmos.gov.v1beta1.ITallyResult|null} [tally] QueryTallyResultResponse tally + */ + + /** + * Constructs a new QueryTallyResultResponse. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a QueryTallyResultResponse. + * @implements IQueryTallyResultResponse + * @constructor + * @param {cosmos.gov.v1beta1.IQueryTallyResultResponse=} [properties] Properties to set + */ + function QueryTallyResultResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryTallyResultResponse tally. + * @member {cosmos.gov.v1beta1.ITallyResult|null|undefined} tally + * @memberof cosmos.gov.v1beta1.QueryTallyResultResponse + * @instance + */ + QueryTallyResultResponse.prototype.tally = null; + + /** + * Encodes the specified QueryTallyResultResponse message. Does not implicitly {@link cosmos.gov.v1beta1.QueryTallyResultResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.QueryTallyResultResponse + * @static + * @param {cosmos.gov.v1beta1.IQueryTallyResultResponse} message QueryTallyResultResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryTallyResultResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.tally != null && Object.hasOwnProperty.call(message, "tally")) + $root.cosmos.gov.v1beta1.TallyResult.encode(message.tally, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryTallyResultResponse message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryTallyResultResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.QueryTallyResultResponse + * @static + * @param {cosmos.gov.v1beta1.IQueryTallyResultResponse} message QueryTallyResultResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryTallyResultResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryTallyResultResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.QueryTallyResultResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.QueryTallyResultResponse} QueryTallyResultResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryTallyResultResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryTallyResultResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tally = $root.cosmos.gov.v1beta1.TallyResult.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryTallyResultResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.QueryTallyResultResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.QueryTallyResultResponse} QueryTallyResultResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryTallyResultResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryTallyResultResponse message. + * @function verify + * @memberof cosmos.gov.v1beta1.QueryTallyResultResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryTallyResultResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.tally != null && message.hasOwnProperty("tally")) { + let error = $root.cosmos.gov.v1beta1.TallyResult.verify(message.tally); + if (error) + return "tally." + error; + } + return null; + }; + + /** + * Creates a QueryTallyResultResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.QueryTallyResultResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.QueryTallyResultResponse} QueryTallyResultResponse + */ + QueryTallyResultResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.QueryTallyResultResponse) + return object; + let message = new $root.cosmos.gov.v1beta1.QueryTallyResultResponse(); + if (object.tally != null) { + if (typeof object.tally !== "object") + throw TypeError(".cosmos.gov.v1beta1.QueryTallyResultResponse.tally: object expected"); + message.tally = $root.cosmos.gov.v1beta1.TallyResult.fromObject(object.tally); + } + return message; + }; + + /** + * Creates a plain object from a QueryTallyResultResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.QueryTallyResultResponse + * @static + * @param {cosmos.gov.v1beta1.QueryTallyResultResponse} message QueryTallyResultResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryTallyResultResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.tally = null; + if (message.tally != null && message.hasOwnProperty("tally")) + object.tally = $root.cosmos.gov.v1beta1.TallyResult.toObject(message.tally, options); + return object; + }; + + /** + * Converts this QueryTallyResultResponse to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.QueryTallyResultResponse + * @instance + * @returns {Object.} JSON object + */ + QueryTallyResultResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryTallyResultResponse; + })(); + + v1beta1.GenesisState = (function() { + + /** + * Properties of a GenesisState. + * @memberof cosmos.gov.v1beta1 + * @interface IGenesisState + * @property {Long|null} [starting_proposal_id] GenesisState starting_proposal_id + * @property {Array.|null} [deposits] GenesisState deposits + * @property {Array.|null} [votes] GenesisState votes + * @property {Array.|null} [proposals] GenesisState proposals + * @property {cosmos.gov.v1beta1.IDepositParams|null} [deposit_params] GenesisState deposit_params + * @property {cosmos.gov.v1beta1.IVotingParams|null} [voting_params] GenesisState voting_params + * @property {cosmos.gov.v1beta1.ITallyParams|null} [tally_params] GenesisState tally_params + */ + + /** + * Constructs a new GenesisState. + * @memberof cosmos.gov.v1beta1 + * @classdesc Represents a GenesisState. + * @implements IGenesisState + * @constructor + * @param {cosmos.gov.v1beta1.IGenesisState=} [properties] Properties to set + */ + function GenesisState(properties) { + this.deposits = []; + this.votes = []; + this.proposals = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenesisState starting_proposal_id. + * @member {Long} starting_proposal_id + * @memberof cosmos.gov.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.starting_proposal_id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * GenesisState deposits. + * @member {Array.} deposits + * @memberof cosmos.gov.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.deposits = $util.emptyArray; + + /** + * GenesisState votes. + * @member {Array.} votes + * @memberof cosmos.gov.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.votes = $util.emptyArray; + + /** + * GenesisState proposals. + * @member {Array.} proposals + * @memberof cosmos.gov.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.proposals = $util.emptyArray; + + /** + * GenesisState deposit_params. + * @member {cosmos.gov.v1beta1.IDepositParams|null|undefined} deposit_params + * @memberof cosmos.gov.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.deposit_params = null; + + /** + * GenesisState voting_params. + * @member {cosmos.gov.v1beta1.IVotingParams|null|undefined} voting_params + * @memberof cosmos.gov.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.voting_params = null; + + /** + * GenesisState tally_params. + * @member {cosmos.gov.v1beta1.ITallyParams|null|undefined} tally_params + * @memberof cosmos.gov.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.tally_params = null; + + /** + * Encodes the specified GenesisState message. Does not implicitly {@link cosmos.gov.v1beta1.GenesisState.verify|verify} messages. + * @function encode + * @memberof cosmos.gov.v1beta1.GenesisState + * @static + * @param {cosmos.gov.v1beta1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.starting_proposal_id != null && Object.hasOwnProperty.call(message, "starting_proposal_id")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.starting_proposal_id); + if (message.deposits != null && message.deposits.length) + for (let i = 0; i < message.deposits.length; ++i) + $root.cosmos.gov.v1beta1.Deposit.encode(message.deposits[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.votes != null && message.votes.length) + for (let i = 0; i < message.votes.length; ++i) + $root.cosmos.gov.v1beta1.Vote.encode(message.votes[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.proposals != null && message.proposals.length) + for (let i = 0; i < message.proposals.length; ++i) + $root.cosmos.gov.v1beta1.Proposal.encode(message.proposals[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.deposit_params != null && Object.hasOwnProperty.call(message, "deposit_params")) + $root.cosmos.gov.v1beta1.DepositParams.encode(message.deposit_params, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.voting_params != null && Object.hasOwnProperty.call(message, "voting_params")) + $root.cosmos.gov.v1beta1.VotingParams.encode(message.voting_params, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.tally_params != null && Object.hasOwnProperty.call(message, "tally_params")) + $root.cosmos.gov.v1beta1.TallyParams.encode(message.tally_params, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.GenesisState.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.gov.v1beta1.GenesisState + * @static + * @param {cosmos.gov.v1beta1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer. + * @function decode + * @memberof cosmos.gov.v1beta1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.gov.v1beta1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.GenesisState(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.starting_proposal_id = reader.uint64(); + break; + case 2: + if (!(message.deposits && message.deposits.length)) + message.deposits = []; + message.deposits.push($root.cosmos.gov.v1beta1.Deposit.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.votes && message.votes.length)) + message.votes = []; + message.votes.push($root.cosmos.gov.v1beta1.Vote.decode(reader, reader.uint32())); + break; + case 4: + if (!(message.proposals && message.proposals.length)) + message.proposals = []; + message.proposals.push($root.cosmos.gov.v1beta1.Proposal.decode(reader, reader.uint32())); + break; + case 5: + message.deposit_params = $root.cosmos.gov.v1beta1.DepositParams.decode(reader, reader.uint32()); + break; + case 6: + message.voting_params = $root.cosmos.gov.v1beta1.VotingParams.decode(reader, reader.uint32()); + break; + case 7: + message.tally_params = $root.cosmos.gov.v1beta1.TallyParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.gov.v1beta1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.gov.v1beta1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenesisState message. + * @function verify + * @memberof cosmos.gov.v1beta1.GenesisState + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenesisState.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.starting_proposal_id != null && message.hasOwnProperty("starting_proposal_id")) + if (!$util.isInteger(message.starting_proposal_id) && !(message.starting_proposal_id && $util.isInteger(message.starting_proposal_id.low) && $util.isInteger(message.starting_proposal_id.high))) + return "starting_proposal_id: integer|Long expected"; + if (message.deposits != null && message.hasOwnProperty("deposits")) { + if (!Array.isArray(message.deposits)) + return "deposits: array expected"; + for (let i = 0; i < message.deposits.length; ++i) { + let error = $root.cosmos.gov.v1beta1.Deposit.verify(message.deposits[i]); + if (error) + return "deposits." + error; + } + } + if (message.votes != null && message.hasOwnProperty("votes")) { + if (!Array.isArray(message.votes)) + return "votes: array expected"; + for (let i = 0; i < message.votes.length; ++i) { + let error = $root.cosmos.gov.v1beta1.Vote.verify(message.votes[i]); + if (error) + return "votes." + error; + } + } + if (message.proposals != null && message.hasOwnProperty("proposals")) { + if (!Array.isArray(message.proposals)) + return "proposals: array expected"; + for (let i = 0; i < message.proposals.length; ++i) { + let error = $root.cosmos.gov.v1beta1.Proposal.verify(message.proposals[i]); + if (error) + return "proposals." + error; + } + } + if (message.deposit_params != null && message.hasOwnProperty("deposit_params")) { + let error = $root.cosmos.gov.v1beta1.DepositParams.verify(message.deposit_params); + if (error) + return "deposit_params." + error; + } + if (message.voting_params != null && message.hasOwnProperty("voting_params")) { + let error = $root.cosmos.gov.v1beta1.VotingParams.verify(message.voting_params); + if (error) + return "voting_params." + error; + } + if (message.tally_params != null && message.hasOwnProperty("tally_params")) { + let error = $root.cosmos.gov.v1beta1.TallyParams.verify(message.tally_params); + if (error) + return "tally_params." + error; + } + return null; + }; + + /** + * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.gov.v1beta1.GenesisState + * @static + * @param {Object.} object Plain object + * @returns {cosmos.gov.v1beta1.GenesisState} GenesisState + */ + GenesisState.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.gov.v1beta1.GenesisState) + return object; + let message = new $root.cosmos.gov.v1beta1.GenesisState(); + if (object.starting_proposal_id != null) + if ($util.Long) + (message.starting_proposal_id = $util.Long.fromValue(object.starting_proposal_id)).unsigned = true; + else if (typeof object.starting_proposal_id === "string") + message.starting_proposal_id = parseInt(object.starting_proposal_id, 10); + else if (typeof object.starting_proposal_id === "number") + message.starting_proposal_id = object.starting_proposal_id; + else if (typeof object.starting_proposal_id === "object") + message.starting_proposal_id = new $util.LongBits(object.starting_proposal_id.low >>> 0, object.starting_proposal_id.high >>> 0).toNumber(true); + if (object.deposits) { + if (!Array.isArray(object.deposits)) + throw TypeError(".cosmos.gov.v1beta1.GenesisState.deposits: array expected"); + message.deposits = []; + for (let i = 0; i < object.deposits.length; ++i) { + if (typeof object.deposits[i] !== "object") + throw TypeError(".cosmos.gov.v1beta1.GenesisState.deposits: object expected"); + message.deposits[i] = $root.cosmos.gov.v1beta1.Deposit.fromObject(object.deposits[i]); + } + } + if (object.votes) { + if (!Array.isArray(object.votes)) + throw TypeError(".cosmos.gov.v1beta1.GenesisState.votes: array expected"); + message.votes = []; + for (let i = 0; i < object.votes.length; ++i) { + if (typeof object.votes[i] !== "object") + throw TypeError(".cosmos.gov.v1beta1.GenesisState.votes: object expected"); + message.votes[i] = $root.cosmos.gov.v1beta1.Vote.fromObject(object.votes[i]); + } + } + if (object.proposals) { + if (!Array.isArray(object.proposals)) + throw TypeError(".cosmos.gov.v1beta1.GenesisState.proposals: array expected"); + message.proposals = []; + for (let i = 0; i < object.proposals.length; ++i) { + if (typeof object.proposals[i] !== "object") + throw TypeError(".cosmos.gov.v1beta1.GenesisState.proposals: object expected"); + message.proposals[i] = $root.cosmos.gov.v1beta1.Proposal.fromObject(object.proposals[i]); + } + } + if (object.deposit_params != null) { + if (typeof object.deposit_params !== "object") + throw TypeError(".cosmos.gov.v1beta1.GenesisState.deposit_params: object expected"); + message.deposit_params = $root.cosmos.gov.v1beta1.DepositParams.fromObject(object.deposit_params); + } + if (object.voting_params != null) { + if (typeof object.voting_params !== "object") + throw TypeError(".cosmos.gov.v1beta1.GenesisState.voting_params: object expected"); + message.voting_params = $root.cosmos.gov.v1beta1.VotingParams.fromObject(object.voting_params); + } + if (object.tally_params != null) { + if (typeof object.tally_params !== "object") + throw TypeError(".cosmos.gov.v1beta1.GenesisState.tally_params: object expected"); + message.tally_params = $root.cosmos.gov.v1beta1.TallyParams.fromObject(object.tally_params); + } + return message; + }; + + /** + * Creates a plain object from a GenesisState message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.gov.v1beta1.GenesisState + * @static + * @param {cosmos.gov.v1beta1.GenesisState} message GenesisState + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenesisState.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) { + object.deposits = []; + object.votes = []; + object.proposals = []; + } + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.starting_proposal_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.starting_proposal_id = options.longs === String ? "0" : 0; + object.deposit_params = null; + object.voting_params = null; + object.tally_params = null; + } + if (message.starting_proposal_id != null && message.hasOwnProperty("starting_proposal_id")) + if (typeof message.starting_proposal_id === "number") + object.starting_proposal_id = options.longs === String ? String(message.starting_proposal_id) : message.starting_proposal_id; + else + object.starting_proposal_id = options.longs === String ? $util.Long.prototype.toString.call(message.starting_proposal_id) : options.longs === Number ? new $util.LongBits(message.starting_proposal_id.low >>> 0, message.starting_proposal_id.high >>> 0).toNumber(true) : message.starting_proposal_id; + if (message.deposits && message.deposits.length) { + object.deposits = []; + for (let j = 0; j < message.deposits.length; ++j) + object.deposits[j] = $root.cosmos.gov.v1beta1.Deposit.toObject(message.deposits[j], options); + } + if (message.votes && message.votes.length) { + object.votes = []; + for (let j = 0; j < message.votes.length; ++j) + object.votes[j] = $root.cosmos.gov.v1beta1.Vote.toObject(message.votes[j], options); + } + if (message.proposals && message.proposals.length) { + object.proposals = []; + for (let j = 0; j < message.proposals.length; ++j) + object.proposals[j] = $root.cosmos.gov.v1beta1.Proposal.toObject(message.proposals[j], options); + } + if (message.deposit_params != null && message.hasOwnProperty("deposit_params")) + object.deposit_params = $root.cosmos.gov.v1beta1.DepositParams.toObject(message.deposit_params, options); + if (message.voting_params != null && message.hasOwnProperty("voting_params")) + object.voting_params = $root.cosmos.gov.v1beta1.VotingParams.toObject(message.voting_params, options); + if (message.tally_params != null && message.hasOwnProperty("tally_params")) + object.tally_params = $root.cosmos.gov.v1beta1.TallyParams.toObject(message.tally_params, options); + return object; + }; + + /** + * Converts this GenesisState to JSON. + * @function toJSON + * @memberof cosmos.gov.v1beta1.GenesisState + * @instance + * @returns {Object.} JSON object + */ + GenesisState.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenesisState; + })(); + + return v1beta1; + })(); + + return gov; + })(); + + cosmos.mint = (function() { + + /** + * Namespace mint. + * @memberof cosmos + * @namespace + */ + const mint = {}; + + mint.v1beta1 = (function() { + + /** + * Namespace v1beta1. + * @memberof cosmos.mint + * @namespace + */ + const v1beta1 = {}; + + v1beta1.Query = (function() { + + /** + * Constructs a new Query service. + * @memberof cosmos.mint.v1beta1 + * @classdesc Represents a Query + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Query(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Query.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Query; + + /** + * Callback as used by {@link cosmos.mint.v1beta1.Query#params}. + * @memberof cosmos.mint.v1beta1.Query + * @typedef ParamsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.mint.v1beta1.QueryParamsResponse} [response] QueryParamsResponse + */ + + /** + * Calls Params. + * @function params + * @memberof cosmos.mint.v1beta1.Query + * @instance + * @param {cosmos.mint.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object + * @param {cosmos.mint.v1beta1.Query.ParamsCallback} callback Node-style callback called with the error, if any, and QueryParamsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.params = function params(request, callback) { + return this.rpcCall(params, $root.cosmos.mint.v1beta1.QueryParamsRequest, $root.cosmos.mint.v1beta1.QueryParamsResponse, request, callback); + }, "name", { value: "Params" }); + + /** + * Calls Params. + * @function params + * @memberof cosmos.mint.v1beta1.Query + * @instance + * @param {cosmos.mint.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.mint.v1beta1.Query#inflation}. + * @memberof cosmos.mint.v1beta1.Query + * @typedef InflationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.mint.v1beta1.QueryInflationResponse} [response] QueryInflationResponse + */ + + /** + * Calls Inflation. + * @function inflation + * @memberof cosmos.mint.v1beta1.Query + * @instance + * @param {cosmos.mint.v1beta1.IQueryInflationRequest} request QueryInflationRequest message or plain object + * @param {cosmos.mint.v1beta1.Query.InflationCallback} callback Node-style callback called with the error, if any, and QueryInflationResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.inflation = function inflation(request, callback) { + return this.rpcCall(inflation, $root.cosmos.mint.v1beta1.QueryInflationRequest, $root.cosmos.mint.v1beta1.QueryInflationResponse, request, callback); + }, "name", { value: "Inflation" }); + + /** + * Calls Inflation. + * @function inflation + * @memberof cosmos.mint.v1beta1.Query + * @instance + * @param {cosmos.mint.v1beta1.IQueryInflationRequest} request QueryInflationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.mint.v1beta1.Query#annualProvisions}. + * @memberof cosmos.mint.v1beta1.Query + * @typedef AnnualProvisionsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.mint.v1beta1.QueryAnnualProvisionsResponse} [response] QueryAnnualProvisionsResponse + */ + + /** + * Calls AnnualProvisions. + * @function annualProvisions + * @memberof cosmos.mint.v1beta1.Query + * @instance + * @param {cosmos.mint.v1beta1.IQueryAnnualProvisionsRequest} request QueryAnnualProvisionsRequest message or plain object + * @param {cosmos.mint.v1beta1.Query.AnnualProvisionsCallback} callback Node-style callback called with the error, if any, and QueryAnnualProvisionsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.annualProvisions = function annualProvisions(request, callback) { + return this.rpcCall(annualProvisions, $root.cosmos.mint.v1beta1.QueryAnnualProvisionsRequest, $root.cosmos.mint.v1beta1.QueryAnnualProvisionsResponse, request, callback); + }, "name", { value: "AnnualProvisions" }); + + /** + * Calls AnnualProvisions. + * @function annualProvisions + * @memberof cosmos.mint.v1beta1.Query + * @instance + * @param {cosmos.mint.v1beta1.IQueryAnnualProvisionsRequest} request QueryAnnualProvisionsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Query; + })(); + + v1beta1.QueryParamsRequest = (function() { + + /** + * Properties of a QueryParamsRequest. + * @memberof cosmos.mint.v1beta1 + * @interface IQueryParamsRequest + */ + + /** + * Constructs a new QueryParamsRequest. + * @memberof cosmos.mint.v1beta1 + * @classdesc Represents a QueryParamsRequest. + * @implements IQueryParamsRequest + * @constructor + * @param {cosmos.mint.v1beta1.IQueryParamsRequest=} [properties] Properties to set + */ + function QueryParamsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified QueryParamsRequest message. Does not implicitly {@link cosmos.mint.v1beta1.QueryParamsRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.mint.v1beta1.QueryParamsRequest + * @static + * @param {cosmos.mint.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified QueryParamsRequest message, length delimited. Does not implicitly {@link cosmos.mint.v1beta1.QueryParamsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.mint.v1beta1.QueryParamsRequest + * @static + * @param {cosmos.mint.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryParamsRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.mint.v1beta1.QueryParamsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.mint.v1beta1.QueryParamsRequest} QueryParamsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.mint.v1beta1.QueryParamsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryParamsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.mint.v1beta1.QueryParamsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.mint.v1beta1.QueryParamsRequest} QueryParamsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryParamsRequest message. + * @function verify + * @memberof cosmos.mint.v1beta1.QueryParamsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryParamsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a QueryParamsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.mint.v1beta1.QueryParamsRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.mint.v1beta1.QueryParamsRequest} QueryParamsRequest + */ + QueryParamsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.mint.v1beta1.QueryParamsRequest) + return object; + return new $root.cosmos.mint.v1beta1.QueryParamsRequest(); + }; + + /** + * Creates a plain object from a QueryParamsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.mint.v1beta1.QueryParamsRequest + * @static + * @param {cosmos.mint.v1beta1.QueryParamsRequest} message QueryParamsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryParamsRequest.toObject = function toObject() { + return {}; + }; + + /** + * Converts this QueryParamsRequest to JSON. + * @function toJSON + * @memberof cosmos.mint.v1beta1.QueryParamsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryParamsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryParamsRequest; + })(); + + v1beta1.QueryParamsResponse = (function() { + + /** + * Properties of a QueryParamsResponse. + * @memberof cosmos.mint.v1beta1 + * @interface IQueryParamsResponse + * @property {cosmos.mint.v1beta1.IParams|null} [params] QueryParamsResponse params + */ + + /** + * Constructs a new QueryParamsResponse. + * @memberof cosmos.mint.v1beta1 + * @classdesc Represents a QueryParamsResponse. + * @implements IQueryParamsResponse + * @constructor + * @param {cosmos.mint.v1beta1.IQueryParamsResponse=} [properties] Properties to set + */ + function QueryParamsResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryParamsResponse params. + * @member {cosmos.mint.v1beta1.IParams|null|undefined} params + * @memberof cosmos.mint.v1beta1.QueryParamsResponse + * @instance + */ + QueryParamsResponse.prototype.params = null; + + /** + * Encodes the specified QueryParamsResponse message. Does not implicitly {@link cosmos.mint.v1beta1.QueryParamsResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.mint.v1beta1.QueryParamsResponse + * @static + * @param {cosmos.mint.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.params != null && Object.hasOwnProperty.call(message, "params")) + $root.cosmos.mint.v1beta1.Params.encode(message.params, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryParamsResponse message, length delimited. Does not implicitly {@link cosmos.mint.v1beta1.QueryParamsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.mint.v1beta1.QueryParamsResponse + * @static + * @param {cosmos.mint.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryParamsResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.mint.v1beta1.QueryParamsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.mint.v1beta1.QueryParamsResponse} QueryParamsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.mint.v1beta1.QueryParamsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = $root.cosmos.mint.v1beta1.Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryParamsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.mint.v1beta1.QueryParamsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.mint.v1beta1.QueryParamsResponse} QueryParamsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryParamsResponse message. + * @function verify + * @memberof cosmos.mint.v1beta1.QueryParamsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryParamsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.params != null && message.hasOwnProperty("params")) { + let error = $root.cosmos.mint.v1beta1.Params.verify(message.params); + if (error) + return "params." + error; + } + return null; + }; + + /** + * Creates a QueryParamsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.mint.v1beta1.QueryParamsResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.mint.v1beta1.QueryParamsResponse} QueryParamsResponse + */ + QueryParamsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.mint.v1beta1.QueryParamsResponse) + return object; + let message = new $root.cosmos.mint.v1beta1.QueryParamsResponse(); + if (object.params != null) { + if (typeof object.params !== "object") + throw TypeError(".cosmos.mint.v1beta1.QueryParamsResponse.params: object expected"); + message.params = $root.cosmos.mint.v1beta1.Params.fromObject(object.params); + } + return message; + }; + + /** + * Creates a plain object from a QueryParamsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.mint.v1beta1.QueryParamsResponse + * @static + * @param {cosmos.mint.v1beta1.QueryParamsResponse} message QueryParamsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryParamsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.params = null; + if (message.params != null && message.hasOwnProperty("params")) + object.params = $root.cosmos.mint.v1beta1.Params.toObject(message.params, options); + return object; + }; + + /** + * Converts this QueryParamsResponse to JSON. + * @function toJSON + * @memberof cosmos.mint.v1beta1.QueryParamsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryParamsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryParamsResponse; + })(); + + v1beta1.QueryInflationRequest = (function() { + + /** + * Properties of a QueryInflationRequest. + * @memberof cosmos.mint.v1beta1 + * @interface IQueryInflationRequest + */ + + /** + * Constructs a new QueryInflationRequest. + * @memberof cosmos.mint.v1beta1 + * @classdesc Represents a QueryInflationRequest. + * @implements IQueryInflationRequest + * @constructor + * @param {cosmos.mint.v1beta1.IQueryInflationRequest=} [properties] Properties to set + */ + function QueryInflationRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified QueryInflationRequest message. Does not implicitly {@link cosmos.mint.v1beta1.QueryInflationRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.mint.v1beta1.QueryInflationRequest + * @static + * @param {cosmos.mint.v1beta1.IQueryInflationRequest} message QueryInflationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryInflationRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified QueryInflationRequest message, length delimited. Does not implicitly {@link cosmos.mint.v1beta1.QueryInflationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.mint.v1beta1.QueryInflationRequest + * @static + * @param {cosmos.mint.v1beta1.IQueryInflationRequest} message QueryInflationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryInflationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryInflationRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.mint.v1beta1.QueryInflationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.mint.v1beta1.QueryInflationRequest} QueryInflationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryInflationRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.mint.v1beta1.QueryInflationRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryInflationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.mint.v1beta1.QueryInflationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.mint.v1beta1.QueryInflationRequest} QueryInflationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryInflationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryInflationRequest message. + * @function verify + * @memberof cosmos.mint.v1beta1.QueryInflationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryInflationRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a QueryInflationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.mint.v1beta1.QueryInflationRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.mint.v1beta1.QueryInflationRequest} QueryInflationRequest + */ + QueryInflationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.mint.v1beta1.QueryInflationRequest) + return object; + return new $root.cosmos.mint.v1beta1.QueryInflationRequest(); + }; + + /** + * Creates a plain object from a QueryInflationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.mint.v1beta1.QueryInflationRequest + * @static + * @param {cosmos.mint.v1beta1.QueryInflationRequest} message QueryInflationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryInflationRequest.toObject = function toObject() { + return {}; + }; + + /** + * Converts this QueryInflationRequest to JSON. + * @function toJSON + * @memberof cosmos.mint.v1beta1.QueryInflationRequest + * @instance + * @returns {Object.} JSON object + */ + QueryInflationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryInflationRequest; + })(); + + v1beta1.QueryInflationResponse = (function() { + + /** + * Properties of a QueryInflationResponse. + * @memberof cosmos.mint.v1beta1 + * @interface IQueryInflationResponse + * @property {Uint8Array|null} [inflation] QueryInflationResponse inflation + */ + + /** + * Constructs a new QueryInflationResponse. + * @memberof cosmos.mint.v1beta1 + * @classdesc Represents a QueryInflationResponse. + * @implements IQueryInflationResponse + * @constructor + * @param {cosmos.mint.v1beta1.IQueryInflationResponse=} [properties] Properties to set + */ + function QueryInflationResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryInflationResponse inflation. + * @member {Uint8Array} inflation + * @memberof cosmos.mint.v1beta1.QueryInflationResponse + * @instance + */ + QueryInflationResponse.prototype.inflation = $util.newBuffer([]); + + /** + * Encodes the specified QueryInflationResponse message. Does not implicitly {@link cosmos.mint.v1beta1.QueryInflationResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.mint.v1beta1.QueryInflationResponse + * @static + * @param {cosmos.mint.v1beta1.IQueryInflationResponse} message QueryInflationResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryInflationResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.inflation != null && Object.hasOwnProperty.call(message, "inflation")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.inflation); + return writer; + }; + + /** + * Encodes the specified QueryInflationResponse message, length delimited. Does not implicitly {@link cosmos.mint.v1beta1.QueryInflationResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.mint.v1beta1.QueryInflationResponse + * @static + * @param {cosmos.mint.v1beta1.IQueryInflationResponse} message QueryInflationResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryInflationResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryInflationResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.mint.v1beta1.QueryInflationResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.mint.v1beta1.QueryInflationResponse} QueryInflationResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryInflationResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.mint.v1beta1.QueryInflationResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.inflation = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryInflationResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.mint.v1beta1.QueryInflationResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.mint.v1beta1.QueryInflationResponse} QueryInflationResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryInflationResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryInflationResponse message. + * @function verify + * @memberof cosmos.mint.v1beta1.QueryInflationResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryInflationResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.inflation != null && message.hasOwnProperty("inflation")) + if (!(message.inflation && typeof message.inflation.length === "number" || $util.isString(message.inflation))) + return "inflation: buffer expected"; + return null; + }; + + /** + * Creates a QueryInflationResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.mint.v1beta1.QueryInflationResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.mint.v1beta1.QueryInflationResponse} QueryInflationResponse + */ + QueryInflationResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.mint.v1beta1.QueryInflationResponse) + return object; + let message = new $root.cosmos.mint.v1beta1.QueryInflationResponse(); + if (object.inflation != null) + if (typeof object.inflation === "string") + $util.base64.decode(object.inflation, message.inflation = $util.newBuffer($util.base64.length(object.inflation)), 0); + else if (object.inflation.length) + message.inflation = object.inflation; + return message; + }; + + /** + * Creates a plain object from a QueryInflationResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.mint.v1beta1.QueryInflationResponse + * @static + * @param {cosmos.mint.v1beta1.QueryInflationResponse} message QueryInflationResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryInflationResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + if (options.bytes === String) + object.inflation = ""; + else { + object.inflation = []; + if (options.bytes !== Array) + object.inflation = $util.newBuffer(object.inflation); + } + if (message.inflation != null && message.hasOwnProperty("inflation")) + object.inflation = options.bytes === String ? $util.base64.encode(message.inflation, 0, message.inflation.length) : options.bytes === Array ? Array.prototype.slice.call(message.inflation) : message.inflation; + return object; + }; + + /** + * Converts this QueryInflationResponse to JSON. + * @function toJSON + * @memberof cosmos.mint.v1beta1.QueryInflationResponse + * @instance + * @returns {Object.} JSON object + */ + QueryInflationResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryInflationResponse; + })(); + + v1beta1.QueryAnnualProvisionsRequest = (function() { + + /** + * Properties of a QueryAnnualProvisionsRequest. + * @memberof cosmos.mint.v1beta1 + * @interface IQueryAnnualProvisionsRequest + */ + + /** + * Constructs a new QueryAnnualProvisionsRequest. + * @memberof cosmos.mint.v1beta1 + * @classdesc Represents a QueryAnnualProvisionsRequest. + * @implements IQueryAnnualProvisionsRequest + * @constructor + * @param {cosmos.mint.v1beta1.IQueryAnnualProvisionsRequest=} [properties] Properties to set + */ + function QueryAnnualProvisionsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified QueryAnnualProvisionsRequest message. Does not implicitly {@link cosmos.mint.v1beta1.QueryAnnualProvisionsRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsRequest + * @static + * @param {cosmos.mint.v1beta1.IQueryAnnualProvisionsRequest} message QueryAnnualProvisionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryAnnualProvisionsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified QueryAnnualProvisionsRequest message, length delimited. Does not implicitly {@link cosmos.mint.v1beta1.QueryAnnualProvisionsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsRequest + * @static + * @param {cosmos.mint.v1beta1.IQueryAnnualProvisionsRequest} message QueryAnnualProvisionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryAnnualProvisionsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryAnnualProvisionsRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.mint.v1beta1.QueryAnnualProvisionsRequest} QueryAnnualProvisionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryAnnualProvisionsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.mint.v1beta1.QueryAnnualProvisionsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryAnnualProvisionsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.mint.v1beta1.QueryAnnualProvisionsRequest} QueryAnnualProvisionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryAnnualProvisionsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryAnnualProvisionsRequest message. + * @function verify + * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryAnnualProvisionsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a QueryAnnualProvisionsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.mint.v1beta1.QueryAnnualProvisionsRequest} QueryAnnualProvisionsRequest + */ + QueryAnnualProvisionsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.mint.v1beta1.QueryAnnualProvisionsRequest) + return object; + return new $root.cosmos.mint.v1beta1.QueryAnnualProvisionsRequest(); + }; + + /** + * Creates a plain object from a QueryAnnualProvisionsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsRequest + * @static + * @param {cosmos.mint.v1beta1.QueryAnnualProvisionsRequest} message QueryAnnualProvisionsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryAnnualProvisionsRequest.toObject = function toObject() { + return {}; + }; + + /** + * Converts this QueryAnnualProvisionsRequest to JSON. + * @function toJSON + * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryAnnualProvisionsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryAnnualProvisionsRequest; + })(); + + v1beta1.QueryAnnualProvisionsResponse = (function() { + + /** + * Properties of a QueryAnnualProvisionsResponse. + * @memberof cosmos.mint.v1beta1 + * @interface IQueryAnnualProvisionsResponse + * @property {Uint8Array|null} [annual_provisions] QueryAnnualProvisionsResponse annual_provisions + */ + + /** + * Constructs a new QueryAnnualProvisionsResponse. + * @memberof cosmos.mint.v1beta1 + * @classdesc Represents a QueryAnnualProvisionsResponse. + * @implements IQueryAnnualProvisionsResponse + * @constructor + * @param {cosmos.mint.v1beta1.IQueryAnnualProvisionsResponse=} [properties] Properties to set + */ + function QueryAnnualProvisionsResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryAnnualProvisionsResponse annual_provisions. + * @member {Uint8Array} annual_provisions + * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsResponse + * @instance + */ + QueryAnnualProvisionsResponse.prototype.annual_provisions = $util.newBuffer([]); + + /** + * Encodes the specified QueryAnnualProvisionsResponse message. Does not implicitly {@link cosmos.mint.v1beta1.QueryAnnualProvisionsResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsResponse + * @static + * @param {cosmos.mint.v1beta1.IQueryAnnualProvisionsResponse} message QueryAnnualProvisionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryAnnualProvisionsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.annual_provisions != null && Object.hasOwnProperty.call(message, "annual_provisions")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.annual_provisions); + return writer; + }; + + /** + * Encodes the specified QueryAnnualProvisionsResponse message, length delimited. Does not implicitly {@link cosmos.mint.v1beta1.QueryAnnualProvisionsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsResponse + * @static + * @param {cosmos.mint.v1beta1.IQueryAnnualProvisionsResponse} message QueryAnnualProvisionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryAnnualProvisionsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryAnnualProvisionsResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.mint.v1beta1.QueryAnnualProvisionsResponse} QueryAnnualProvisionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryAnnualProvisionsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.mint.v1beta1.QueryAnnualProvisionsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.annual_provisions = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryAnnualProvisionsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.mint.v1beta1.QueryAnnualProvisionsResponse} QueryAnnualProvisionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryAnnualProvisionsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryAnnualProvisionsResponse message. + * @function verify + * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryAnnualProvisionsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.annual_provisions != null && message.hasOwnProperty("annual_provisions")) + if (!(message.annual_provisions && typeof message.annual_provisions.length === "number" || $util.isString(message.annual_provisions))) + return "annual_provisions: buffer expected"; + return null; + }; + + /** + * Creates a QueryAnnualProvisionsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.mint.v1beta1.QueryAnnualProvisionsResponse} QueryAnnualProvisionsResponse + */ + QueryAnnualProvisionsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.mint.v1beta1.QueryAnnualProvisionsResponse) + return object; + let message = new $root.cosmos.mint.v1beta1.QueryAnnualProvisionsResponse(); + if (object.annual_provisions != null) + if (typeof object.annual_provisions === "string") + $util.base64.decode(object.annual_provisions, message.annual_provisions = $util.newBuffer($util.base64.length(object.annual_provisions)), 0); + else if (object.annual_provisions.length) + message.annual_provisions = object.annual_provisions; + return message; + }; + + /** + * Creates a plain object from a QueryAnnualProvisionsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsResponse + * @static + * @param {cosmos.mint.v1beta1.QueryAnnualProvisionsResponse} message QueryAnnualProvisionsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryAnnualProvisionsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + if (options.bytes === String) + object.annual_provisions = ""; + else { + object.annual_provisions = []; + if (options.bytes !== Array) + object.annual_provisions = $util.newBuffer(object.annual_provisions); + } + if (message.annual_provisions != null && message.hasOwnProperty("annual_provisions")) + object.annual_provisions = options.bytes === String ? $util.base64.encode(message.annual_provisions, 0, message.annual_provisions.length) : options.bytes === Array ? Array.prototype.slice.call(message.annual_provisions) : message.annual_provisions; + return object; + }; + + /** + * Converts this QueryAnnualProvisionsResponse to JSON. + * @function toJSON + * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryAnnualProvisionsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryAnnualProvisionsResponse; + })(); + + v1beta1.GenesisState = (function() { + + /** + * Properties of a GenesisState. + * @memberof cosmos.mint.v1beta1 + * @interface IGenesisState + * @property {cosmos.mint.v1beta1.IMinter|null} [minter] GenesisState minter + * @property {cosmos.mint.v1beta1.IParams|null} [params] GenesisState params + */ + + /** + * Constructs a new GenesisState. + * @memberof cosmos.mint.v1beta1 + * @classdesc Represents a GenesisState. + * @implements IGenesisState + * @constructor + * @param {cosmos.mint.v1beta1.IGenesisState=} [properties] Properties to set + */ + function GenesisState(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenesisState minter. + * @member {cosmos.mint.v1beta1.IMinter|null|undefined} minter + * @memberof cosmos.mint.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.minter = null; + + /** + * GenesisState params. + * @member {cosmos.mint.v1beta1.IParams|null|undefined} params + * @memberof cosmos.mint.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.params = null; + + /** + * Encodes the specified GenesisState message. Does not implicitly {@link cosmos.mint.v1beta1.GenesisState.verify|verify} messages. + * @function encode + * @memberof cosmos.mint.v1beta1.GenesisState + * @static + * @param {cosmos.mint.v1beta1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.minter != null && Object.hasOwnProperty.call(message, "minter")) + $root.cosmos.mint.v1beta1.Minter.encode(message.minter, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.params != null && Object.hasOwnProperty.call(message, "params")) + $root.cosmos.mint.v1beta1.Params.encode(message.params, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link cosmos.mint.v1beta1.GenesisState.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.mint.v1beta1.GenesisState + * @static + * @param {cosmos.mint.v1beta1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer. + * @function decode + * @memberof cosmos.mint.v1beta1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.mint.v1beta1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.mint.v1beta1.GenesisState(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.minter = $root.cosmos.mint.v1beta1.Minter.decode(reader, reader.uint32()); + break; + case 2: + message.params = $root.cosmos.mint.v1beta1.Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.mint.v1beta1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.mint.v1beta1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenesisState message. + * @function verify + * @memberof cosmos.mint.v1beta1.GenesisState + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenesisState.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.minter != null && message.hasOwnProperty("minter")) { + let error = $root.cosmos.mint.v1beta1.Minter.verify(message.minter); + if (error) + return "minter." + error; + } + if (message.params != null && message.hasOwnProperty("params")) { + let error = $root.cosmos.mint.v1beta1.Params.verify(message.params); + if (error) + return "params." + error; + } + return null; + }; + + /** + * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.mint.v1beta1.GenesisState + * @static + * @param {Object.} object Plain object + * @returns {cosmos.mint.v1beta1.GenesisState} GenesisState + */ + GenesisState.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.mint.v1beta1.GenesisState) + return object; + let message = new $root.cosmos.mint.v1beta1.GenesisState(); + if (object.minter != null) { + if (typeof object.minter !== "object") + throw TypeError(".cosmos.mint.v1beta1.GenesisState.minter: object expected"); + message.minter = $root.cosmos.mint.v1beta1.Minter.fromObject(object.minter); + } + if (object.params != null) { + if (typeof object.params !== "object") + throw TypeError(".cosmos.mint.v1beta1.GenesisState.params: object expected"); + message.params = $root.cosmos.mint.v1beta1.Params.fromObject(object.params); + } + return message; + }; + + /** + * Creates a plain object from a GenesisState message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.mint.v1beta1.GenesisState + * @static + * @param {cosmos.mint.v1beta1.GenesisState} message GenesisState + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenesisState.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.minter = null; + object.params = null; + } + if (message.minter != null && message.hasOwnProperty("minter")) + object.minter = $root.cosmos.mint.v1beta1.Minter.toObject(message.minter, options); + if (message.params != null && message.hasOwnProperty("params")) + object.params = $root.cosmos.mint.v1beta1.Params.toObject(message.params, options); + return object; + }; + + /** + * Converts this GenesisState to JSON. + * @function toJSON + * @memberof cosmos.mint.v1beta1.GenesisState + * @instance + * @returns {Object.} JSON object + */ + GenesisState.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenesisState; + })(); + + v1beta1.Minter = (function() { + + /** + * Properties of a Minter. + * @memberof cosmos.mint.v1beta1 + * @interface IMinter + * @property {string|null} [inflation] Minter inflation + * @property {string|null} [annual_provisions] Minter annual_provisions + */ + + /** + * Constructs a new Minter. + * @memberof cosmos.mint.v1beta1 + * @classdesc Represents a Minter. + * @implements IMinter + * @constructor + * @param {cosmos.mint.v1beta1.IMinter=} [properties] Properties to set + */ + function Minter(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Minter inflation. + * @member {string} inflation + * @memberof cosmos.mint.v1beta1.Minter + * @instance + */ + Minter.prototype.inflation = ""; + + /** + * Minter annual_provisions. + * @member {string} annual_provisions + * @memberof cosmos.mint.v1beta1.Minter + * @instance + */ + Minter.prototype.annual_provisions = ""; + + /** + * Encodes the specified Minter message. Does not implicitly {@link cosmos.mint.v1beta1.Minter.verify|verify} messages. + * @function encode + * @memberof cosmos.mint.v1beta1.Minter + * @static + * @param {cosmos.mint.v1beta1.IMinter} message Minter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Minter.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.inflation != null && Object.hasOwnProperty.call(message, "inflation")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.inflation); + if (message.annual_provisions != null && Object.hasOwnProperty.call(message, "annual_provisions")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.annual_provisions); + return writer; + }; + + /** + * Encodes the specified Minter message, length delimited. Does not implicitly {@link cosmos.mint.v1beta1.Minter.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.mint.v1beta1.Minter + * @static + * @param {cosmos.mint.v1beta1.IMinter} message Minter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Minter.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Minter message from the specified reader or buffer. + * @function decode + * @memberof cosmos.mint.v1beta1.Minter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.mint.v1beta1.Minter} Minter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Minter.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.mint.v1beta1.Minter(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.inflation = reader.string(); + break; + case 2: + message.annual_provisions = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Minter message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.mint.v1beta1.Minter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.mint.v1beta1.Minter} Minter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Minter.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Minter message. + * @function verify + * @memberof cosmos.mint.v1beta1.Minter + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Minter.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.inflation != null && message.hasOwnProperty("inflation")) + if (!$util.isString(message.inflation)) + return "inflation: string expected"; + if (message.annual_provisions != null && message.hasOwnProperty("annual_provisions")) + if (!$util.isString(message.annual_provisions)) + return "annual_provisions: string expected"; + return null; + }; + + /** + * Creates a Minter message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.mint.v1beta1.Minter + * @static + * @param {Object.} object Plain object + * @returns {cosmos.mint.v1beta1.Minter} Minter + */ + Minter.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.mint.v1beta1.Minter) + return object; + let message = new $root.cosmos.mint.v1beta1.Minter(); + if (object.inflation != null) + message.inflation = String(object.inflation); + if (object.annual_provisions != null) + message.annual_provisions = String(object.annual_provisions); + return message; + }; + + /** + * Creates a plain object from a Minter message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.mint.v1beta1.Minter + * @static + * @param {cosmos.mint.v1beta1.Minter} message Minter + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Minter.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.inflation = ""; + object.annual_provisions = ""; + } + if (message.inflation != null && message.hasOwnProperty("inflation")) + object.inflation = message.inflation; + if (message.annual_provisions != null && message.hasOwnProperty("annual_provisions")) + object.annual_provisions = message.annual_provisions; + return object; + }; + + /** + * Converts this Minter to JSON. + * @function toJSON + * @memberof cosmos.mint.v1beta1.Minter + * @instance + * @returns {Object.} JSON object + */ + Minter.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Minter; + })(); + + v1beta1.Params = (function() { + + /** + * Properties of a Params. + * @memberof cosmos.mint.v1beta1 + * @interface IParams + * @property {string|null} [mint_denom] Params mint_denom + * @property {string|null} [inflation_rate_change] Params inflation_rate_change + * @property {string|null} [inflation_max] Params inflation_max + * @property {string|null} [inflation_min] Params inflation_min + * @property {string|null} [goal_bonded] Params goal_bonded + * @property {Long|null} [blocks_per_year] Params blocks_per_year + */ + + /** + * Constructs a new Params. + * @memberof cosmos.mint.v1beta1 + * @classdesc Represents a Params. + * @implements IParams + * @constructor + * @param {cosmos.mint.v1beta1.IParams=} [properties] Properties to set + */ + function Params(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Params mint_denom. + * @member {string} mint_denom + * @memberof cosmos.mint.v1beta1.Params + * @instance + */ + Params.prototype.mint_denom = ""; + + /** + * Params inflation_rate_change. + * @member {string} inflation_rate_change + * @memberof cosmos.mint.v1beta1.Params + * @instance + */ + Params.prototype.inflation_rate_change = ""; + + /** + * Params inflation_max. + * @member {string} inflation_max + * @memberof cosmos.mint.v1beta1.Params + * @instance + */ + Params.prototype.inflation_max = ""; + + /** + * Params inflation_min. + * @member {string} inflation_min + * @memberof cosmos.mint.v1beta1.Params + * @instance + */ + Params.prototype.inflation_min = ""; + + /** + * Params goal_bonded. + * @member {string} goal_bonded + * @memberof cosmos.mint.v1beta1.Params + * @instance + */ + Params.prototype.goal_bonded = ""; + + /** + * Params blocks_per_year. + * @member {Long} blocks_per_year + * @memberof cosmos.mint.v1beta1.Params + * @instance + */ + Params.prototype.blocks_per_year = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified Params message. Does not implicitly {@link cosmos.mint.v1beta1.Params.verify|verify} messages. + * @function encode + * @memberof cosmos.mint.v1beta1.Params + * @static + * @param {cosmos.mint.v1beta1.IParams} message Params message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Params.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mint_denom != null && Object.hasOwnProperty.call(message, "mint_denom")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.mint_denom); + if (message.inflation_rate_change != null && Object.hasOwnProperty.call(message, "inflation_rate_change")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.inflation_rate_change); + if (message.inflation_max != null && Object.hasOwnProperty.call(message, "inflation_max")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.inflation_max); + if (message.inflation_min != null && Object.hasOwnProperty.call(message, "inflation_min")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.inflation_min); + if (message.goal_bonded != null && Object.hasOwnProperty.call(message, "goal_bonded")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.goal_bonded); + if (message.blocks_per_year != null && Object.hasOwnProperty.call(message, "blocks_per_year")) + writer.uint32(/* id 6, wireType 0 =*/48).uint64(message.blocks_per_year); + return writer; + }; + + /** + * Encodes the specified Params message, length delimited. Does not implicitly {@link cosmos.mint.v1beta1.Params.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.mint.v1beta1.Params + * @static + * @param {cosmos.mint.v1beta1.IParams} message Params message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Params.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Params message from the specified reader or buffer. + * @function decode + * @memberof cosmos.mint.v1beta1.Params + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.mint.v1beta1.Params} Params + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Params.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.mint.v1beta1.Params(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mint_denom = reader.string(); + break; + case 2: + message.inflation_rate_change = reader.string(); + break; + case 3: + message.inflation_max = reader.string(); + break; + case 4: + message.inflation_min = reader.string(); + break; + case 5: + message.goal_bonded = reader.string(); + break; + case 6: + message.blocks_per_year = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Params message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.mint.v1beta1.Params + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.mint.v1beta1.Params} Params + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Params.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Params message. + * @function verify + * @memberof cosmos.mint.v1beta1.Params + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Params.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mint_denom != null && message.hasOwnProperty("mint_denom")) + if (!$util.isString(message.mint_denom)) + return "mint_denom: string expected"; + if (message.inflation_rate_change != null && message.hasOwnProperty("inflation_rate_change")) + if (!$util.isString(message.inflation_rate_change)) + return "inflation_rate_change: string expected"; + if (message.inflation_max != null && message.hasOwnProperty("inflation_max")) + if (!$util.isString(message.inflation_max)) + return "inflation_max: string expected"; + if (message.inflation_min != null && message.hasOwnProperty("inflation_min")) + if (!$util.isString(message.inflation_min)) + return "inflation_min: string expected"; + if (message.goal_bonded != null && message.hasOwnProperty("goal_bonded")) + if (!$util.isString(message.goal_bonded)) + return "goal_bonded: string expected"; + if (message.blocks_per_year != null && message.hasOwnProperty("blocks_per_year")) + if (!$util.isInteger(message.blocks_per_year) && !(message.blocks_per_year && $util.isInteger(message.blocks_per_year.low) && $util.isInteger(message.blocks_per_year.high))) + return "blocks_per_year: integer|Long expected"; + return null; + }; + + /** + * Creates a Params message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.mint.v1beta1.Params + * @static + * @param {Object.} object Plain object + * @returns {cosmos.mint.v1beta1.Params} Params + */ + Params.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.mint.v1beta1.Params) + return object; + let message = new $root.cosmos.mint.v1beta1.Params(); + if (object.mint_denom != null) + message.mint_denom = String(object.mint_denom); + if (object.inflation_rate_change != null) + message.inflation_rate_change = String(object.inflation_rate_change); + if (object.inflation_max != null) + message.inflation_max = String(object.inflation_max); + if (object.inflation_min != null) + message.inflation_min = String(object.inflation_min); + if (object.goal_bonded != null) + message.goal_bonded = String(object.goal_bonded); + if (object.blocks_per_year != null) + if ($util.Long) + (message.blocks_per_year = $util.Long.fromValue(object.blocks_per_year)).unsigned = true; + else if (typeof object.blocks_per_year === "string") + message.blocks_per_year = parseInt(object.blocks_per_year, 10); + else if (typeof object.blocks_per_year === "number") + message.blocks_per_year = object.blocks_per_year; + else if (typeof object.blocks_per_year === "object") + message.blocks_per_year = new $util.LongBits(object.blocks_per_year.low >>> 0, object.blocks_per_year.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a Params message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.mint.v1beta1.Params + * @static + * @param {cosmos.mint.v1beta1.Params} message Params + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Params.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.mint_denom = ""; + object.inflation_rate_change = ""; + object.inflation_max = ""; + object.inflation_min = ""; + object.goal_bonded = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.blocks_per_year = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.blocks_per_year = options.longs === String ? "0" : 0; + } + if (message.mint_denom != null && message.hasOwnProperty("mint_denom")) + object.mint_denom = message.mint_denom; + if (message.inflation_rate_change != null && message.hasOwnProperty("inflation_rate_change")) + object.inflation_rate_change = message.inflation_rate_change; + if (message.inflation_max != null && message.hasOwnProperty("inflation_max")) + object.inflation_max = message.inflation_max; + if (message.inflation_min != null && message.hasOwnProperty("inflation_min")) + object.inflation_min = message.inflation_min; + if (message.goal_bonded != null && message.hasOwnProperty("goal_bonded")) + object.goal_bonded = message.goal_bonded; + if (message.blocks_per_year != null && message.hasOwnProperty("blocks_per_year")) + if (typeof message.blocks_per_year === "number") + object.blocks_per_year = options.longs === String ? String(message.blocks_per_year) : message.blocks_per_year; + else + object.blocks_per_year = options.longs === String ? $util.Long.prototype.toString.call(message.blocks_per_year) : options.longs === Number ? new $util.LongBits(message.blocks_per_year.low >>> 0, message.blocks_per_year.high >>> 0).toNumber(true) : message.blocks_per_year; + return object; + }; + + /** + * Converts this Params to JSON. + * @function toJSON + * @memberof cosmos.mint.v1beta1.Params + * @instance + * @returns {Object.} JSON object + */ + Params.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Params; + })(); + + return v1beta1; + })(); + + return mint; + })(); + + cosmos.params = (function() { + + /** + * Namespace params. + * @memberof cosmos + * @namespace + */ + const params = {}; + + params.v1beta1 = (function() { + + /** + * Namespace v1beta1. + * @memberof cosmos.params + * @namespace + */ + const v1beta1 = {}; + + v1beta1.Query = (function() { + + /** + * Constructs a new Query service. + * @memberof cosmos.params.v1beta1 + * @classdesc Represents a Query + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Query(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Query.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Query; + + /** + * Callback as used by {@link cosmos.params.v1beta1.Query#params}. + * @memberof cosmos.params.v1beta1.Query + * @typedef ParamsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.params.v1beta1.QueryParamsResponse} [response] QueryParamsResponse + */ + + /** + * Calls Params. + * @function params + * @memberof cosmos.params.v1beta1.Query + * @instance + * @param {cosmos.params.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object + * @param {cosmos.params.v1beta1.Query.ParamsCallback} callback Node-style callback called with the error, if any, and QueryParamsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.params = function params(request, callback) { + return this.rpcCall(params, $root.cosmos.params.v1beta1.QueryParamsRequest, $root.cosmos.params.v1beta1.QueryParamsResponse, request, callback); + }, "name", { value: "Params" }); + + /** + * Calls Params. + * @function params + * @memberof cosmos.params.v1beta1.Query + * @instance + * @param {cosmos.params.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Query; + })(); + + v1beta1.QueryParamsRequest = (function() { + + /** + * Properties of a QueryParamsRequest. + * @memberof cosmos.params.v1beta1 + * @interface IQueryParamsRequest + * @property {string|null} [subspace] QueryParamsRequest subspace + * @property {string|null} [key] QueryParamsRequest key + */ + + /** + * Constructs a new QueryParamsRequest. + * @memberof cosmos.params.v1beta1 + * @classdesc Represents a QueryParamsRequest. + * @implements IQueryParamsRequest + * @constructor + * @param {cosmos.params.v1beta1.IQueryParamsRequest=} [properties] Properties to set + */ + function QueryParamsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryParamsRequest subspace. + * @member {string} subspace + * @memberof cosmos.params.v1beta1.QueryParamsRequest + * @instance + */ + QueryParamsRequest.prototype.subspace = ""; + + /** + * QueryParamsRequest key. + * @member {string} key + * @memberof cosmos.params.v1beta1.QueryParamsRequest + * @instance + */ + QueryParamsRequest.prototype.key = ""; + + /** + * Encodes the specified QueryParamsRequest message. Does not implicitly {@link cosmos.params.v1beta1.QueryParamsRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.params.v1beta1.QueryParamsRequest + * @static + * @param {cosmos.params.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.subspace != null && Object.hasOwnProperty.call(message, "subspace")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.subspace); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.key); + return writer; + }; + + /** + * Encodes the specified QueryParamsRequest message, length delimited. Does not implicitly {@link cosmos.params.v1beta1.QueryParamsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.params.v1beta1.QueryParamsRequest + * @static + * @param {cosmos.params.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryParamsRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.params.v1beta1.QueryParamsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.params.v1beta1.QueryParamsRequest} QueryParamsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.params.v1beta1.QueryParamsRequest(); + while (reader.pos < end) { + let 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; + }; + + /** + * Decodes a QueryParamsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.params.v1beta1.QueryParamsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.params.v1beta1.QueryParamsRequest} QueryParamsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryParamsRequest message. + * @function verify + * @memberof cosmos.params.v1beta1.QueryParamsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryParamsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.subspace != null && message.hasOwnProperty("subspace")) + if (!$util.isString(message.subspace)) + return "subspace: string expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + return null; + }; + + /** + * Creates a QueryParamsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.params.v1beta1.QueryParamsRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.params.v1beta1.QueryParamsRequest} QueryParamsRequest + */ + QueryParamsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.params.v1beta1.QueryParamsRequest) + return object; + let message = new $root.cosmos.params.v1beta1.QueryParamsRequest(); + if (object.subspace != null) + message.subspace = String(object.subspace); + if (object.key != null) + message.key = String(object.key); + return message; + }; + + /** + * Creates a plain object from a QueryParamsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.params.v1beta1.QueryParamsRequest + * @static + * @param {cosmos.params.v1beta1.QueryParamsRequest} message QueryParamsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryParamsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.subspace = ""; + object.key = ""; + } + if (message.subspace != null && message.hasOwnProperty("subspace")) + object.subspace = message.subspace; + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + return object; + }; + + /** + * Converts this QueryParamsRequest to JSON. + * @function toJSON + * @memberof cosmos.params.v1beta1.QueryParamsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryParamsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryParamsRequest; + })(); + + v1beta1.QueryParamsResponse = (function() { + + /** + * Properties of a QueryParamsResponse. + * @memberof cosmos.params.v1beta1 + * @interface IQueryParamsResponse + * @property {cosmos.params.v1beta1.IParamChange|null} [param] QueryParamsResponse param + */ + + /** + * Constructs a new QueryParamsResponse. + * @memberof cosmos.params.v1beta1 + * @classdesc Represents a QueryParamsResponse. + * @implements IQueryParamsResponse + * @constructor + * @param {cosmos.params.v1beta1.IQueryParamsResponse=} [properties] Properties to set + */ + function QueryParamsResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryParamsResponse param. + * @member {cosmos.params.v1beta1.IParamChange|null|undefined} param + * @memberof cosmos.params.v1beta1.QueryParamsResponse + * @instance + */ + QueryParamsResponse.prototype.param = null; + + /** + * Encodes the specified QueryParamsResponse message. Does not implicitly {@link cosmos.params.v1beta1.QueryParamsResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.params.v1beta1.QueryParamsResponse + * @static + * @param {cosmos.params.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.param != null && Object.hasOwnProperty.call(message, "param")) + $root.cosmos.params.v1beta1.ParamChange.encode(message.param, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryParamsResponse message, length delimited. Does not implicitly {@link cosmos.params.v1beta1.QueryParamsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.params.v1beta1.QueryParamsResponse + * @static + * @param {cosmos.params.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryParamsResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.params.v1beta1.QueryParamsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.params.v1beta1.QueryParamsResponse} QueryParamsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.params.v1beta1.QueryParamsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.param = $root.cosmos.params.v1beta1.ParamChange.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryParamsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.params.v1beta1.QueryParamsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.params.v1beta1.QueryParamsResponse} QueryParamsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryParamsResponse message. + * @function verify + * @memberof cosmos.params.v1beta1.QueryParamsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryParamsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.param != null && message.hasOwnProperty("param")) { + let error = $root.cosmos.params.v1beta1.ParamChange.verify(message.param); + if (error) + return "param." + error; + } + return null; + }; + + /** + * Creates a QueryParamsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.params.v1beta1.QueryParamsResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.params.v1beta1.QueryParamsResponse} QueryParamsResponse + */ + QueryParamsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.params.v1beta1.QueryParamsResponse) + return object; + let message = new $root.cosmos.params.v1beta1.QueryParamsResponse(); + if (object.param != null) { + if (typeof object.param !== "object") + throw TypeError(".cosmos.params.v1beta1.QueryParamsResponse.param: object expected"); + message.param = $root.cosmos.params.v1beta1.ParamChange.fromObject(object.param); + } + return message; + }; + + /** + * Creates a plain object from a QueryParamsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.params.v1beta1.QueryParamsResponse + * @static + * @param {cosmos.params.v1beta1.QueryParamsResponse} message QueryParamsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryParamsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.param = null; + if (message.param != null && message.hasOwnProperty("param")) + object.param = $root.cosmos.params.v1beta1.ParamChange.toObject(message.param, options); + return object; + }; + + /** + * Converts this QueryParamsResponse to JSON. + * @function toJSON + * @memberof cosmos.params.v1beta1.QueryParamsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryParamsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryParamsResponse; + })(); + + v1beta1.ParameterChangeProposal = (function() { + + /** + * Properties of a ParameterChangeProposal. + * @memberof cosmos.params.v1beta1 + * @interface IParameterChangeProposal + * @property {string|null} [title] ParameterChangeProposal title + * @property {string|null} [description] ParameterChangeProposal description + * @property {Array.|null} [changes] ParameterChangeProposal changes + */ + + /** + * Constructs a new ParameterChangeProposal. + * @memberof cosmos.params.v1beta1 + * @classdesc Represents a ParameterChangeProposal. + * @implements IParameterChangeProposal + * @constructor + * @param {cosmos.params.v1beta1.IParameterChangeProposal=} [properties] Properties to set + */ + function ParameterChangeProposal(properties) { + this.changes = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ParameterChangeProposal title. + * @member {string} title + * @memberof cosmos.params.v1beta1.ParameterChangeProposal + * @instance + */ + ParameterChangeProposal.prototype.title = ""; + + /** + * ParameterChangeProposal description. + * @member {string} description + * @memberof cosmos.params.v1beta1.ParameterChangeProposal + * @instance + */ + ParameterChangeProposal.prototype.description = ""; + + /** + * ParameterChangeProposal changes. + * @member {Array.} changes + * @memberof cosmos.params.v1beta1.ParameterChangeProposal + * @instance + */ + ParameterChangeProposal.prototype.changes = $util.emptyArray; + + /** + * Encodes the specified ParameterChangeProposal message. Does not implicitly {@link cosmos.params.v1beta1.ParameterChangeProposal.verify|verify} messages. + * @function encode + * @memberof cosmos.params.v1beta1.ParameterChangeProposal + * @static + * @param {cosmos.params.v1beta1.IParameterChangeProposal} message ParameterChangeProposal message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ParameterChangeProposal.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.changes != null && message.changes.length) + for (let i = 0; i < message.changes.length; ++i) + $root.cosmos.params.v1beta1.ParamChange.encode(message.changes[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ParameterChangeProposal message, length delimited. Does not implicitly {@link cosmos.params.v1beta1.ParameterChangeProposal.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.params.v1beta1.ParameterChangeProposal + * @static + * @param {cosmos.params.v1beta1.IParameterChangeProposal} message ParameterChangeProposal message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ParameterChangeProposal.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ParameterChangeProposal message from the specified reader or buffer. + * @function decode + * @memberof cosmos.params.v1beta1.ParameterChangeProposal + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.params.v1beta1.ParameterChangeProposal} ParameterChangeProposal + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ParameterChangeProposal.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.params.v1beta1.ParameterChangeProposal(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + if (!(message.changes && message.changes.length)) + message.changes = []; + message.changes.push($root.cosmos.params.v1beta1.ParamChange.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ParameterChangeProposal message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.params.v1beta1.ParameterChangeProposal + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.params.v1beta1.ParameterChangeProposal} ParameterChangeProposal + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ParameterChangeProposal.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ParameterChangeProposal message. + * @function verify + * @memberof cosmos.params.v1beta1.ParameterChangeProposal + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ParameterChangeProposal.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.changes != null && message.hasOwnProperty("changes")) { + if (!Array.isArray(message.changes)) + return "changes: array expected"; + for (let i = 0; i < message.changes.length; ++i) { + let error = $root.cosmos.params.v1beta1.ParamChange.verify(message.changes[i]); + if (error) + return "changes." + error; + } + } + return null; + }; + + /** + * Creates a ParameterChangeProposal message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.params.v1beta1.ParameterChangeProposal + * @static + * @param {Object.} object Plain object + * @returns {cosmos.params.v1beta1.ParameterChangeProposal} ParameterChangeProposal + */ + ParameterChangeProposal.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.params.v1beta1.ParameterChangeProposal) + return object; + let message = new $root.cosmos.params.v1beta1.ParameterChangeProposal(); + if (object.title != null) + message.title = String(object.title); + if (object.description != null) + message.description = String(object.description); + if (object.changes) { + if (!Array.isArray(object.changes)) + throw TypeError(".cosmos.params.v1beta1.ParameterChangeProposal.changes: array expected"); + message.changes = []; + for (let i = 0; i < object.changes.length; ++i) { + if (typeof object.changes[i] !== "object") + throw TypeError(".cosmos.params.v1beta1.ParameterChangeProposal.changes: object expected"); + message.changes[i] = $root.cosmos.params.v1beta1.ParamChange.fromObject(object.changes[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ParameterChangeProposal message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.params.v1beta1.ParameterChangeProposal + * @static + * @param {cosmos.params.v1beta1.ParameterChangeProposal} message ParameterChangeProposal + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ParameterChangeProposal.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.changes = []; + if (options.defaults) { + object.title = ""; + object.description = ""; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.changes && message.changes.length) { + object.changes = []; + for (let j = 0; j < message.changes.length; ++j) + object.changes[j] = $root.cosmos.params.v1beta1.ParamChange.toObject(message.changes[j], options); + } + return object; + }; + + /** + * Converts this ParameterChangeProposal to JSON. + * @function toJSON + * @memberof cosmos.params.v1beta1.ParameterChangeProposal + * @instance + * @returns {Object.} JSON object + */ + ParameterChangeProposal.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ParameterChangeProposal; + })(); + + v1beta1.ParamChange = (function() { + + /** + * Properties of a ParamChange. + * @memberof cosmos.params.v1beta1 + * @interface IParamChange + * @property {string|null} [subspace] ParamChange subspace + * @property {string|null} [key] ParamChange key + * @property {string|null} [value] ParamChange value + */ + + /** + * Constructs a new ParamChange. + * @memberof cosmos.params.v1beta1 + * @classdesc Represents a ParamChange. + * @implements IParamChange + * @constructor + * @param {cosmos.params.v1beta1.IParamChange=} [properties] Properties to set + */ + function ParamChange(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ParamChange subspace. + * @member {string} subspace + * @memberof cosmos.params.v1beta1.ParamChange + * @instance + */ + ParamChange.prototype.subspace = ""; + + /** + * ParamChange key. + * @member {string} key + * @memberof cosmos.params.v1beta1.ParamChange + * @instance + */ + ParamChange.prototype.key = ""; + + /** + * ParamChange value. + * @member {string} value + * @memberof cosmos.params.v1beta1.ParamChange + * @instance + */ + ParamChange.prototype.value = ""; + + /** + * Encodes the specified ParamChange message. Does not implicitly {@link cosmos.params.v1beta1.ParamChange.verify|verify} messages. + * @function encode + * @memberof cosmos.params.v1beta1.ParamChange + * @static + * @param {cosmos.params.v1beta1.IParamChange} message ParamChange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ParamChange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.subspace != null && Object.hasOwnProperty.call(message, "subspace")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.subspace); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.key); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.value); + return writer; + }; + + /** + * Encodes the specified ParamChange message, length delimited. Does not implicitly {@link cosmos.params.v1beta1.ParamChange.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.params.v1beta1.ParamChange + * @static + * @param {cosmos.params.v1beta1.IParamChange} message ParamChange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ParamChange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ParamChange message from the specified reader or buffer. + * @function decode + * @memberof cosmos.params.v1beta1.ParamChange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.params.v1beta1.ParamChange} ParamChange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ParamChange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.params.v1beta1.ParamChange(); + while (reader.pos < end) { + let 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; + }; + + /** + * Decodes a ParamChange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.params.v1beta1.ParamChange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.params.v1beta1.ParamChange} ParamChange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ParamChange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ParamChange message. + * @function verify + * @memberof cosmos.params.v1beta1.ParamChange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ParamChange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.subspace != null && message.hasOwnProperty("subspace")) + if (!$util.isString(message.subspace)) + return "subspace: string expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + return null; + }; + + /** + * Creates a ParamChange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.params.v1beta1.ParamChange + * @static + * @param {Object.} object Plain object + * @returns {cosmos.params.v1beta1.ParamChange} ParamChange + */ + ParamChange.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.params.v1beta1.ParamChange) + return object; + let message = new $root.cosmos.params.v1beta1.ParamChange(); + if (object.subspace != null) + message.subspace = String(object.subspace); + if (object.key != null) + message.key = String(object.key); + if (object.value != null) + message.value = String(object.value); + return message; + }; + + /** + * Creates a plain object from a ParamChange message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.params.v1beta1.ParamChange + * @static + * @param {cosmos.params.v1beta1.ParamChange} message ParamChange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ParamChange.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.subspace = ""; + object.key = ""; + object.value = ""; + } + if (message.subspace != null && message.hasOwnProperty("subspace")) + object.subspace = message.subspace; + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this ParamChange to JSON. + * @function toJSON + * @memberof cosmos.params.v1beta1.ParamChange + * @instance + * @returns {Object.} JSON object + */ + ParamChange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ParamChange; + })(); + + return v1beta1; + })(); + + return params; + })(); + + cosmos.slashing = (function() { + + /** + * Namespace slashing. + * @memberof cosmos + * @namespace + */ + const slashing = {}; + + slashing.v1beta1 = (function() { + + /** + * Namespace v1beta1. + * @memberof cosmos.slashing + * @namespace + */ + const v1beta1 = {}; + + v1beta1.Msg = (function() { + + /** + * Constructs a new Msg service. + * @memberof cosmos.slashing.v1beta1 + * @classdesc Represents a Msg + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Msg(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Msg.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Msg; + + /** + * Callback as used by {@link cosmos.slashing.v1beta1.Msg#unjail}. + * @memberof cosmos.slashing.v1beta1.Msg + * @typedef UnjailCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.slashing.v1beta1.MsgUnjailResponse} [response] MsgUnjailResponse + */ + + /** + * Calls Unjail. + * @function unjail + * @memberof cosmos.slashing.v1beta1.Msg + * @instance + * @param {cosmos.slashing.v1beta1.IMsgUnjail} request MsgUnjail message or plain object + * @param {cosmos.slashing.v1beta1.Msg.UnjailCallback} callback Node-style callback called with the error, if any, and MsgUnjailResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.unjail = function unjail(request, callback) { + return this.rpcCall(unjail, $root.cosmos.slashing.v1beta1.MsgUnjail, $root.cosmos.slashing.v1beta1.MsgUnjailResponse, request, callback); + }, "name", { value: "Unjail" }); + + /** + * Calls Unjail. + * @function unjail + * @memberof cosmos.slashing.v1beta1.Msg + * @instance + * @param {cosmos.slashing.v1beta1.IMsgUnjail} request MsgUnjail message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Msg; + })(); + + v1beta1.MsgUnjail = (function() { + + /** + * Properties of a MsgUnjail. + * @memberof cosmos.slashing.v1beta1 + * @interface IMsgUnjail + * @property {string|null} [validator_addr] MsgUnjail validator_addr + */ + + /** + * Constructs a new MsgUnjail. + * @memberof cosmos.slashing.v1beta1 + * @classdesc Represents a MsgUnjail. + * @implements IMsgUnjail + * @constructor + * @param {cosmos.slashing.v1beta1.IMsgUnjail=} [properties] Properties to set + */ + function MsgUnjail(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgUnjail validator_addr. + * @member {string} validator_addr + * @memberof cosmos.slashing.v1beta1.MsgUnjail + * @instance + */ + MsgUnjail.prototype.validator_addr = ""; + + /** + * Encodes the specified MsgUnjail message. Does not implicitly {@link cosmos.slashing.v1beta1.MsgUnjail.verify|verify} messages. + * @function encode + * @memberof cosmos.slashing.v1beta1.MsgUnjail + * @static + * @param {cosmos.slashing.v1beta1.IMsgUnjail} message MsgUnjail message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgUnjail.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.validator_addr != null && Object.hasOwnProperty.call(message, "validator_addr")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.validator_addr); + return writer; + }; + + /** + * Encodes the specified MsgUnjail message, length delimited. Does not implicitly {@link cosmos.slashing.v1beta1.MsgUnjail.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.slashing.v1beta1.MsgUnjail + * @static + * @param {cosmos.slashing.v1beta1.IMsgUnjail} message MsgUnjail message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgUnjail.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgUnjail message from the specified reader or buffer. + * @function decode + * @memberof cosmos.slashing.v1beta1.MsgUnjail + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.slashing.v1beta1.MsgUnjail} MsgUnjail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgUnjail.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.slashing.v1beta1.MsgUnjail(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_addr = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgUnjail message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.slashing.v1beta1.MsgUnjail + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.slashing.v1beta1.MsgUnjail} MsgUnjail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgUnjail.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgUnjail message. + * @function verify + * @memberof cosmos.slashing.v1beta1.MsgUnjail + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgUnjail.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.validator_addr != null && message.hasOwnProperty("validator_addr")) + if (!$util.isString(message.validator_addr)) + return "validator_addr: string expected"; + return null; + }; + + /** + * Creates a MsgUnjail message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.slashing.v1beta1.MsgUnjail + * @static + * @param {Object.} object Plain object + * @returns {cosmos.slashing.v1beta1.MsgUnjail} MsgUnjail + */ + MsgUnjail.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.slashing.v1beta1.MsgUnjail) + return object; + let message = new $root.cosmos.slashing.v1beta1.MsgUnjail(); + if (object.validator_addr != null) + message.validator_addr = String(object.validator_addr); + return message; + }; + + /** + * Creates a plain object from a MsgUnjail message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.slashing.v1beta1.MsgUnjail + * @static + * @param {cosmos.slashing.v1beta1.MsgUnjail} message MsgUnjail + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgUnjail.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.validator_addr = ""; + if (message.validator_addr != null && message.hasOwnProperty("validator_addr")) + object.validator_addr = message.validator_addr; + return object; + }; + + /** + * Converts this MsgUnjail to JSON. + * @function toJSON + * @memberof cosmos.slashing.v1beta1.MsgUnjail + * @instance + * @returns {Object.} JSON object + */ + MsgUnjail.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgUnjail; + })(); + + v1beta1.MsgUnjailResponse = (function() { + + /** + * Properties of a MsgUnjailResponse. + * @memberof cosmos.slashing.v1beta1 + * @interface IMsgUnjailResponse + */ + + /** + * Constructs a new MsgUnjailResponse. + * @memberof cosmos.slashing.v1beta1 + * @classdesc Represents a MsgUnjailResponse. + * @implements IMsgUnjailResponse + * @constructor + * @param {cosmos.slashing.v1beta1.IMsgUnjailResponse=} [properties] Properties to set + */ + function MsgUnjailResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgUnjailResponse message. Does not implicitly {@link cosmos.slashing.v1beta1.MsgUnjailResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.slashing.v1beta1.MsgUnjailResponse + * @static + * @param {cosmos.slashing.v1beta1.IMsgUnjailResponse} message MsgUnjailResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgUnjailResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgUnjailResponse message, length delimited. Does not implicitly {@link cosmos.slashing.v1beta1.MsgUnjailResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.slashing.v1beta1.MsgUnjailResponse + * @static + * @param {cosmos.slashing.v1beta1.IMsgUnjailResponse} message MsgUnjailResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgUnjailResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgUnjailResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.slashing.v1beta1.MsgUnjailResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.slashing.v1beta1.MsgUnjailResponse} MsgUnjailResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgUnjailResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.slashing.v1beta1.MsgUnjailResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgUnjailResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.slashing.v1beta1.MsgUnjailResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.slashing.v1beta1.MsgUnjailResponse} MsgUnjailResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgUnjailResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgUnjailResponse message. + * @function verify + * @memberof cosmos.slashing.v1beta1.MsgUnjailResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgUnjailResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgUnjailResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.slashing.v1beta1.MsgUnjailResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.slashing.v1beta1.MsgUnjailResponse} MsgUnjailResponse + */ + MsgUnjailResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.slashing.v1beta1.MsgUnjailResponse) + return object; + return new $root.cosmos.slashing.v1beta1.MsgUnjailResponse(); + }; + + /** + * Creates a plain object from a MsgUnjailResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.slashing.v1beta1.MsgUnjailResponse + * @static + * @param {cosmos.slashing.v1beta1.MsgUnjailResponse} message MsgUnjailResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgUnjailResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgUnjailResponse to JSON. + * @function toJSON + * @memberof cosmos.slashing.v1beta1.MsgUnjailResponse + * @instance + * @returns {Object.} JSON object + */ + MsgUnjailResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgUnjailResponse; + })(); + + v1beta1.ValidatorSigningInfo = (function() { + + /** + * Properties of a ValidatorSigningInfo. + * @memberof cosmos.slashing.v1beta1 + * @interface IValidatorSigningInfo + * @property {string|null} [address] ValidatorSigningInfo address + * @property {Long|null} [start_height] ValidatorSigningInfo start_height + * @property {Long|null} [index_offset] ValidatorSigningInfo index_offset + * @property {google.protobuf.ITimestamp|null} [jailed_until] ValidatorSigningInfo jailed_until + * @property {boolean|null} [tombstoned] ValidatorSigningInfo tombstoned + * @property {Long|null} [missed_blocks_counter] ValidatorSigningInfo missed_blocks_counter + */ + + /** + * Constructs a new ValidatorSigningInfo. + * @memberof cosmos.slashing.v1beta1 + * @classdesc Represents a ValidatorSigningInfo. + * @implements IValidatorSigningInfo + * @constructor + * @param {cosmos.slashing.v1beta1.IValidatorSigningInfo=} [properties] Properties to set + */ + function ValidatorSigningInfo(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ValidatorSigningInfo address. + * @member {string} address + * @memberof cosmos.slashing.v1beta1.ValidatorSigningInfo + * @instance + */ + ValidatorSigningInfo.prototype.address = ""; + + /** + * ValidatorSigningInfo start_height. + * @member {Long} start_height + * @memberof cosmos.slashing.v1beta1.ValidatorSigningInfo + * @instance + */ + ValidatorSigningInfo.prototype.start_height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ValidatorSigningInfo index_offset. + * @member {Long} index_offset + * @memberof cosmos.slashing.v1beta1.ValidatorSigningInfo + * @instance + */ + ValidatorSigningInfo.prototype.index_offset = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ValidatorSigningInfo jailed_until. + * @member {google.protobuf.ITimestamp|null|undefined} jailed_until + * @memberof cosmos.slashing.v1beta1.ValidatorSigningInfo + * @instance + */ + ValidatorSigningInfo.prototype.jailed_until = null; + + /** + * ValidatorSigningInfo tombstoned. + * @member {boolean} tombstoned + * @memberof cosmos.slashing.v1beta1.ValidatorSigningInfo + * @instance + */ + ValidatorSigningInfo.prototype.tombstoned = false; + + /** + * ValidatorSigningInfo missed_blocks_counter. + * @member {Long} missed_blocks_counter + * @memberof cosmos.slashing.v1beta1.ValidatorSigningInfo + * @instance + */ + ValidatorSigningInfo.prototype.missed_blocks_counter = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Encodes the specified ValidatorSigningInfo message. Does not implicitly {@link cosmos.slashing.v1beta1.ValidatorSigningInfo.verify|verify} messages. + * @function encode + * @memberof cosmos.slashing.v1beta1.ValidatorSigningInfo + * @static + * @param {cosmos.slashing.v1beta1.IValidatorSigningInfo} message ValidatorSigningInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorSigningInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.address != null && Object.hasOwnProperty.call(message, "address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.address); + if (message.start_height != null && Object.hasOwnProperty.call(message, "start_height")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.start_height); + if (message.index_offset != null && Object.hasOwnProperty.call(message, "index_offset")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.index_offset); + if (message.jailed_until != null && Object.hasOwnProperty.call(message, "jailed_until")) + $root.google.protobuf.Timestamp.encode(message.jailed_until, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.tombstoned != null && Object.hasOwnProperty.call(message, "tombstoned")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.tombstoned); + if (message.missed_blocks_counter != null && Object.hasOwnProperty.call(message, "missed_blocks_counter")) + writer.uint32(/* id 6, wireType 0 =*/48).int64(message.missed_blocks_counter); + return writer; + }; + + /** + * Encodes the specified ValidatorSigningInfo message, length delimited. Does not implicitly {@link cosmos.slashing.v1beta1.ValidatorSigningInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.slashing.v1beta1.ValidatorSigningInfo + * @static + * @param {cosmos.slashing.v1beta1.IValidatorSigningInfo} message ValidatorSigningInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorSigningInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ValidatorSigningInfo message from the specified reader or buffer. + * @function decode + * @memberof cosmos.slashing.v1beta1.ValidatorSigningInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.slashing.v1beta1.ValidatorSigningInfo} ValidatorSigningInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorSigningInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.slashing.v1beta1.ValidatorSigningInfo(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.start_height = reader.int64(); + break; + case 3: + message.index_offset = reader.int64(); + break; + case 4: + message.jailed_until = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 5: + message.tombstoned = reader.bool(); + break; + case 6: + message.missed_blocks_counter = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ValidatorSigningInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.slashing.v1beta1.ValidatorSigningInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.slashing.v1beta1.ValidatorSigningInfo} ValidatorSigningInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorSigningInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ValidatorSigningInfo message. + * @function verify + * @memberof cosmos.slashing.v1beta1.ValidatorSigningInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ValidatorSigningInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.address != null && message.hasOwnProperty("address")) + if (!$util.isString(message.address)) + return "address: string expected"; + if (message.start_height != null && message.hasOwnProperty("start_height")) + if (!$util.isInteger(message.start_height) && !(message.start_height && $util.isInteger(message.start_height.low) && $util.isInteger(message.start_height.high))) + return "start_height: integer|Long expected"; + if (message.index_offset != null && message.hasOwnProperty("index_offset")) + if (!$util.isInteger(message.index_offset) && !(message.index_offset && $util.isInteger(message.index_offset.low) && $util.isInteger(message.index_offset.high))) + return "index_offset: integer|Long expected"; + if (message.jailed_until != null && message.hasOwnProperty("jailed_until")) { + let error = $root.google.protobuf.Timestamp.verify(message.jailed_until); + if (error) + return "jailed_until." + error; + } + if (message.tombstoned != null && message.hasOwnProperty("tombstoned")) + if (typeof message.tombstoned !== "boolean") + return "tombstoned: boolean expected"; + if (message.missed_blocks_counter != null && message.hasOwnProperty("missed_blocks_counter")) + if (!$util.isInteger(message.missed_blocks_counter) && !(message.missed_blocks_counter && $util.isInteger(message.missed_blocks_counter.low) && $util.isInteger(message.missed_blocks_counter.high))) + return "missed_blocks_counter: integer|Long expected"; + return null; + }; + + /** + * Creates a ValidatorSigningInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.slashing.v1beta1.ValidatorSigningInfo + * @static + * @param {Object.} object Plain object + * @returns {cosmos.slashing.v1beta1.ValidatorSigningInfo} ValidatorSigningInfo + */ + ValidatorSigningInfo.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.slashing.v1beta1.ValidatorSigningInfo) + return object; + let message = new $root.cosmos.slashing.v1beta1.ValidatorSigningInfo(); + if (object.address != null) + message.address = String(object.address); + if (object.start_height != null) + if ($util.Long) + (message.start_height = $util.Long.fromValue(object.start_height)).unsigned = false; + else if (typeof object.start_height === "string") + message.start_height = parseInt(object.start_height, 10); + else if (typeof object.start_height === "number") + message.start_height = object.start_height; + else if (typeof object.start_height === "object") + message.start_height = new $util.LongBits(object.start_height.low >>> 0, object.start_height.high >>> 0).toNumber(); + if (object.index_offset != null) + if ($util.Long) + (message.index_offset = $util.Long.fromValue(object.index_offset)).unsigned = false; + else if (typeof object.index_offset === "string") + message.index_offset = parseInt(object.index_offset, 10); + else if (typeof object.index_offset === "number") + message.index_offset = object.index_offset; + else if (typeof object.index_offset === "object") + message.index_offset = new $util.LongBits(object.index_offset.low >>> 0, object.index_offset.high >>> 0).toNumber(); + if (object.jailed_until != null) { + if (typeof object.jailed_until !== "object") + throw TypeError(".cosmos.slashing.v1beta1.ValidatorSigningInfo.jailed_until: object expected"); + message.jailed_until = $root.google.protobuf.Timestamp.fromObject(object.jailed_until); + } + if (object.tombstoned != null) + message.tombstoned = Boolean(object.tombstoned); + if (object.missed_blocks_counter != null) + if ($util.Long) + (message.missed_blocks_counter = $util.Long.fromValue(object.missed_blocks_counter)).unsigned = false; + else if (typeof object.missed_blocks_counter === "string") + message.missed_blocks_counter = parseInt(object.missed_blocks_counter, 10); + else if (typeof object.missed_blocks_counter === "number") + message.missed_blocks_counter = object.missed_blocks_counter; + else if (typeof object.missed_blocks_counter === "object") + message.missed_blocks_counter = new $util.LongBits(object.missed_blocks_counter.low >>> 0, object.missed_blocks_counter.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a ValidatorSigningInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.slashing.v1beta1.ValidatorSigningInfo + * @static + * @param {cosmos.slashing.v1beta1.ValidatorSigningInfo} message ValidatorSigningInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ValidatorSigningInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.address = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.start_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.start_height = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.index_offset = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.index_offset = options.longs === String ? "0" : 0; + object.jailed_until = null; + object.tombstoned = false; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.missed_blocks_counter = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.missed_blocks_counter = options.longs === String ? "0" : 0; + } + if (message.address != null && message.hasOwnProperty("address")) + object.address = message.address; + if (message.start_height != null && message.hasOwnProperty("start_height")) + if (typeof message.start_height === "number") + object.start_height = options.longs === String ? String(message.start_height) : message.start_height; + else + object.start_height = options.longs === String ? $util.Long.prototype.toString.call(message.start_height) : options.longs === Number ? new $util.LongBits(message.start_height.low >>> 0, message.start_height.high >>> 0).toNumber() : message.start_height; + if (message.index_offset != null && message.hasOwnProperty("index_offset")) + if (typeof message.index_offset === "number") + object.index_offset = options.longs === String ? String(message.index_offset) : message.index_offset; + else + object.index_offset = options.longs === String ? $util.Long.prototype.toString.call(message.index_offset) : options.longs === Number ? new $util.LongBits(message.index_offset.low >>> 0, message.index_offset.high >>> 0).toNumber() : message.index_offset; + if (message.jailed_until != null && message.hasOwnProperty("jailed_until")) + object.jailed_until = $root.google.protobuf.Timestamp.toObject(message.jailed_until, options); + if (message.tombstoned != null && message.hasOwnProperty("tombstoned")) + object.tombstoned = message.tombstoned; + if (message.missed_blocks_counter != null && message.hasOwnProperty("missed_blocks_counter")) + if (typeof message.missed_blocks_counter === "number") + object.missed_blocks_counter = options.longs === String ? String(message.missed_blocks_counter) : message.missed_blocks_counter; + else + object.missed_blocks_counter = options.longs === String ? $util.Long.prototype.toString.call(message.missed_blocks_counter) : options.longs === Number ? new $util.LongBits(message.missed_blocks_counter.low >>> 0, message.missed_blocks_counter.high >>> 0).toNumber() : message.missed_blocks_counter; + return object; + }; + + /** + * Converts this ValidatorSigningInfo to JSON. + * @function toJSON + * @memberof cosmos.slashing.v1beta1.ValidatorSigningInfo + * @instance + * @returns {Object.} JSON object + */ + ValidatorSigningInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ValidatorSigningInfo; + })(); + + v1beta1.Params = (function() { + + /** + * Properties of a Params. + * @memberof cosmos.slashing.v1beta1 + * @interface IParams + * @property {Long|null} [signed_blocks_window] Params signed_blocks_window + * @property {Uint8Array|null} [min_signed_per_window] Params min_signed_per_window + * @property {google.protobuf.IDuration|null} [downtime_jail_duration] Params downtime_jail_duration + * @property {Uint8Array|null} [slash_fraction_double_sign] Params slash_fraction_double_sign + * @property {Uint8Array|null} [slash_fraction_downtime] Params slash_fraction_downtime + */ + + /** + * Constructs a new Params. + * @memberof cosmos.slashing.v1beta1 + * @classdesc Represents a Params. + * @implements IParams + * @constructor + * @param {cosmos.slashing.v1beta1.IParams=} [properties] Properties to set + */ + function Params(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Params signed_blocks_window. + * @member {Long} signed_blocks_window + * @memberof cosmos.slashing.v1beta1.Params + * @instance + */ + Params.prototype.signed_blocks_window = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Params min_signed_per_window. + * @member {Uint8Array} min_signed_per_window + * @memberof cosmos.slashing.v1beta1.Params + * @instance + */ + Params.prototype.min_signed_per_window = $util.newBuffer([]); + + /** + * Params downtime_jail_duration. + * @member {google.protobuf.IDuration|null|undefined} downtime_jail_duration + * @memberof cosmos.slashing.v1beta1.Params + * @instance + */ + Params.prototype.downtime_jail_duration = null; + + /** + * Params slash_fraction_double_sign. + * @member {Uint8Array} slash_fraction_double_sign + * @memberof cosmos.slashing.v1beta1.Params + * @instance + */ + Params.prototype.slash_fraction_double_sign = $util.newBuffer([]); + + /** + * Params slash_fraction_downtime. + * @member {Uint8Array} slash_fraction_downtime + * @memberof cosmos.slashing.v1beta1.Params + * @instance + */ + Params.prototype.slash_fraction_downtime = $util.newBuffer([]); + + /** + * Encodes the specified Params message. Does not implicitly {@link cosmos.slashing.v1beta1.Params.verify|verify} messages. + * @function encode + * @memberof cosmos.slashing.v1beta1.Params + * @static + * @param {cosmos.slashing.v1beta1.IParams} message Params message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Params.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.signed_blocks_window != null && Object.hasOwnProperty.call(message, "signed_blocks_window")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.signed_blocks_window); + if (message.min_signed_per_window != null && Object.hasOwnProperty.call(message, "min_signed_per_window")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.min_signed_per_window); + if (message.downtime_jail_duration != null && Object.hasOwnProperty.call(message, "downtime_jail_duration")) + $root.google.protobuf.Duration.encode(message.downtime_jail_duration, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.slash_fraction_double_sign != null && Object.hasOwnProperty.call(message, "slash_fraction_double_sign")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.slash_fraction_double_sign); + if (message.slash_fraction_downtime != null && Object.hasOwnProperty.call(message, "slash_fraction_downtime")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.slash_fraction_downtime); + return writer; + }; + + /** + * Encodes the specified Params message, length delimited. Does not implicitly {@link cosmos.slashing.v1beta1.Params.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.slashing.v1beta1.Params + * @static + * @param {cosmos.slashing.v1beta1.IParams} message Params message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Params.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Params message from the specified reader or buffer. + * @function decode + * @memberof cosmos.slashing.v1beta1.Params + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.slashing.v1beta1.Params} Params + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Params.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.slashing.v1beta1.Params(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signed_blocks_window = reader.int64(); + break; + case 2: + message.min_signed_per_window = reader.bytes(); + break; + case 3: + message.downtime_jail_duration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + case 4: + message.slash_fraction_double_sign = reader.bytes(); + break; + case 5: + message.slash_fraction_downtime = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Params message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.slashing.v1beta1.Params + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.slashing.v1beta1.Params} Params + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Params.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Params message. + * @function verify + * @memberof cosmos.slashing.v1beta1.Params + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Params.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.signed_blocks_window != null && message.hasOwnProperty("signed_blocks_window")) + if (!$util.isInteger(message.signed_blocks_window) && !(message.signed_blocks_window && $util.isInteger(message.signed_blocks_window.low) && $util.isInteger(message.signed_blocks_window.high))) + return "signed_blocks_window: integer|Long expected"; + if (message.min_signed_per_window != null && message.hasOwnProperty("min_signed_per_window")) + if (!(message.min_signed_per_window && typeof message.min_signed_per_window.length === "number" || $util.isString(message.min_signed_per_window))) + return "min_signed_per_window: buffer expected"; + if (message.downtime_jail_duration != null && message.hasOwnProperty("downtime_jail_duration")) { + let error = $root.google.protobuf.Duration.verify(message.downtime_jail_duration); + if (error) + return "downtime_jail_duration." + error; + } + if (message.slash_fraction_double_sign != null && message.hasOwnProperty("slash_fraction_double_sign")) + if (!(message.slash_fraction_double_sign && typeof message.slash_fraction_double_sign.length === "number" || $util.isString(message.slash_fraction_double_sign))) + return "slash_fraction_double_sign: buffer expected"; + if (message.slash_fraction_downtime != null && message.hasOwnProperty("slash_fraction_downtime")) + if (!(message.slash_fraction_downtime && typeof message.slash_fraction_downtime.length === "number" || $util.isString(message.slash_fraction_downtime))) + return "slash_fraction_downtime: buffer expected"; + return null; + }; + + /** + * Creates a Params message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.slashing.v1beta1.Params + * @static + * @param {Object.} object Plain object + * @returns {cosmos.slashing.v1beta1.Params} Params + */ + Params.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.slashing.v1beta1.Params) + return object; + let message = new $root.cosmos.slashing.v1beta1.Params(); + if (object.signed_blocks_window != null) + if ($util.Long) + (message.signed_blocks_window = $util.Long.fromValue(object.signed_blocks_window)).unsigned = false; + else if (typeof object.signed_blocks_window === "string") + message.signed_blocks_window = parseInt(object.signed_blocks_window, 10); + else if (typeof object.signed_blocks_window === "number") + message.signed_blocks_window = object.signed_blocks_window; + else if (typeof object.signed_blocks_window === "object") + message.signed_blocks_window = new $util.LongBits(object.signed_blocks_window.low >>> 0, object.signed_blocks_window.high >>> 0).toNumber(); + if (object.min_signed_per_window != null) + if (typeof object.min_signed_per_window === "string") + $util.base64.decode(object.min_signed_per_window, message.min_signed_per_window = $util.newBuffer($util.base64.length(object.min_signed_per_window)), 0); + else if (object.min_signed_per_window.length) + message.min_signed_per_window = object.min_signed_per_window; + if (object.downtime_jail_duration != null) { + if (typeof object.downtime_jail_duration !== "object") + throw TypeError(".cosmos.slashing.v1beta1.Params.downtime_jail_duration: object expected"); + message.downtime_jail_duration = $root.google.protobuf.Duration.fromObject(object.downtime_jail_duration); + } + if (object.slash_fraction_double_sign != null) + if (typeof object.slash_fraction_double_sign === "string") + $util.base64.decode(object.slash_fraction_double_sign, message.slash_fraction_double_sign = $util.newBuffer($util.base64.length(object.slash_fraction_double_sign)), 0); + else if (object.slash_fraction_double_sign.length) + message.slash_fraction_double_sign = object.slash_fraction_double_sign; + if (object.slash_fraction_downtime != null) + if (typeof object.slash_fraction_downtime === "string") + $util.base64.decode(object.slash_fraction_downtime, message.slash_fraction_downtime = $util.newBuffer($util.base64.length(object.slash_fraction_downtime)), 0); + else if (object.slash_fraction_downtime.length) + message.slash_fraction_downtime = object.slash_fraction_downtime; + return message; + }; + + /** + * Creates a plain object from a Params message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.slashing.v1beta1.Params + * @static + * @param {cosmos.slashing.v1beta1.Params} message Params + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Params.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.signed_blocks_window = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.signed_blocks_window = options.longs === String ? "0" : 0; + if (options.bytes === String) + object.min_signed_per_window = ""; + else { + object.min_signed_per_window = []; + if (options.bytes !== Array) + object.min_signed_per_window = $util.newBuffer(object.min_signed_per_window); + } + object.downtime_jail_duration = null; + if (options.bytes === String) + object.slash_fraction_double_sign = ""; + else { + object.slash_fraction_double_sign = []; + if (options.bytes !== Array) + object.slash_fraction_double_sign = $util.newBuffer(object.slash_fraction_double_sign); + } + if (options.bytes === String) + object.slash_fraction_downtime = ""; + else { + object.slash_fraction_downtime = []; + if (options.bytes !== Array) + object.slash_fraction_downtime = $util.newBuffer(object.slash_fraction_downtime); + } + } + if (message.signed_blocks_window != null && message.hasOwnProperty("signed_blocks_window")) + if (typeof message.signed_blocks_window === "number") + object.signed_blocks_window = options.longs === String ? String(message.signed_blocks_window) : message.signed_blocks_window; + else + object.signed_blocks_window = options.longs === String ? $util.Long.prototype.toString.call(message.signed_blocks_window) : options.longs === Number ? new $util.LongBits(message.signed_blocks_window.low >>> 0, message.signed_blocks_window.high >>> 0).toNumber() : message.signed_blocks_window; + if (message.min_signed_per_window != null && message.hasOwnProperty("min_signed_per_window")) + object.min_signed_per_window = options.bytes === String ? $util.base64.encode(message.min_signed_per_window, 0, message.min_signed_per_window.length) : options.bytes === Array ? Array.prototype.slice.call(message.min_signed_per_window) : message.min_signed_per_window; + if (message.downtime_jail_duration != null && message.hasOwnProperty("downtime_jail_duration")) + object.downtime_jail_duration = $root.google.protobuf.Duration.toObject(message.downtime_jail_duration, options); + if (message.slash_fraction_double_sign != null && message.hasOwnProperty("slash_fraction_double_sign")) + object.slash_fraction_double_sign = options.bytes === String ? $util.base64.encode(message.slash_fraction_double_sign, 0, message.slash_fraction_double_sign.length) : options.bytes === Array ? Array.prototype.slice.call(message.slash_fraction_double_sign) : message.slash_fraction_double_sign; + if (message.slash_fraction_downtime != null && message.hasOwnProperty("slash_fraction_downtime")) + object.slash_fraction_downtime = options.bytes === String ? $util.base64.encode(message.slash_fraction_downtime, 0, message.slash_fraction_downtime.length) : options.bytes === Array ? Array.prototype.slice.call(message.slash_fraction_downtime) : message.slash_fraction_downtime; + return object; + }; + + /** + * Converts this Params to JSON. + * @function toJSON + * @memberof cosmos.slashing.v1beta1.Params + * @instance + * @returns {Object.} JSON object + */ + Params.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Params; + })(); + + v1beta1.Query = (function() { + + /** + * Constructs a new Query service. + * @memberof cosmos.slashing.v1beta1 + * @classdesc Represents a Query + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Query(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Query.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Query; + + /** + * Callback as used by {@link cosmos.slashing.v1beta1.Query#params}. + * @memberof cosmos.slashing.v1beta1.Query + * @typedef ParamsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.slashing.v1beta1.QueryParamsResponse} [response] QueryParamsResponse + */ + + /** + * Calls Params. + * @function params + * @memberof cosmos.slashing.v1beta1.Query + * @instance + * @param {cosmos.slashing.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object + * @param {cosmos.slashing.v1beta1.Query.ParamsCallback} callback Node-style callback called with the error, if any, and QueryParamsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.params = function params(request, callback) { + return this.rpcCall(params, $root.cosmos.slashing.v1beta1.QueryParamsRequest, $root.cosmos.slashing.v1beta1.QueryParamsResponse, request, callback); + }, "name", { value: "Params" }); + + /** + * Calls Params. + * @function params + * @memberof cosmos.slashing.v1beta1.Query + * @instance + * @param {cosmos.slashing.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.slashing.v1beta1.Query#signingInfo}. + * @memberof cosmos.slashing.v1beta1.Query + * @typedef SigningInfoCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.slashing.v1beta1.QuerySigningInfoResponse} [response] QuerySigningInfoResponse + */ + + /** + * Calls SigningInfo. + * @function signingInfo + * @memberof cosmos.slashing.v1beta1.Query + * @instance + * @param {cosmos.slashing.v1beta1.IQuerySigningInfoRequest} request QuerySigningInfoRequest message or plain object + * @param {cosmos.slashing.v1beta1.Query.SigningInfoCallback} callback Node-style callback called with the error, if any, and QuerySigningInfoResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.signingInfo = function signingInfo(request, callback) { + return this.rpcCall(signingInfo, $root.cosmos.slashing.v1beta1.QuerySigningInfoRequest, $root.cosmos.slashing.v1beta1.QuerySigningInfoResponse, request, callback); + }, "name", { value: "SigningInfo" }); + + /** + * Calls SigningInfo. + * @function signingInfo + * @memberof cosmos.slashing.v1beta1.Query + * @instance + * @param {cosmos.slashing.v1beta1.IQuerySigningInfoRequest} request QuerySigningInfoRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.slashing.v1beta1.Query#signingInfos}. + * @memberof cosmos.slashing.v1beta1.Query + * @typedef SigningInfosCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.slashing.v1beta1.QuerySigningInfosResponse} [response] QuerySigningInfosResponse + */ + + /** + * Calls SigningInfos. + * @function signingInfos + * @memberof cosmos.slashing.v1beta1.Query + * @instance + * @param {cosmos.slashing.v1beta1.IQuerySigningInfosRequest} request QuerySigningInfosRequest message or plain object + * @param {cosmos.slashing.v1beta1.Query.SigningInfosCallback} callback Node-style callback called with the error, if any, and QuerySigningInfosResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.signingInfos = function signingInfos(request, callback) { + return this.rpcCall(signingInfos, $root.cosmos.slashing.v1beta1.QuerySigningInfosRequest, $root.cosmos.slashing.v1beta1.QuerySigningInfosResponse, request, callback); + }, "name", { value: "SigningInfos" }); + + /** + * Calls SigningInfos. + * @function signingInfos + * @memberof cosmos.slashing.v1beta1.Query + * @instance + * @param {cosmos.slashing.v1beta1.IQuerySigningInfosRequest} request QuerySigningInfosRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Query; + })(); + + v1beta1.QueryParamsRequest = (function() { + + /** + * Properties of a QueryParamsRequest. + * @memberof cosmos.slashing.v1beta1 + * @interface IQueryParamsRequest + */ + + /** + * Constructs a new QueryParamsRequest. + * @memberof cosmos.slashing.v1beta1 + * @classdesc Represents a QueryParamsRequest. + * @implements IQueryParamsRequest + * @constructor + * @param {cosmos.slashing.v1beta1.IQueryParamsRequest=} [properties] Properties to set + */ + function QueryParamsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified QueryParamsRequest message. Does not implicitly {@link cosmos.slashing.v1beta1.QueryParamsRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.slashing.v1beta1.QueryParamsRequest + * @static + * @param {cosmos.slashing.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified QueryParamsRequest message, length delimited. Does not implicitly {@link cosmos.slashing.v1beta1.QueryParamsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.slashing.v1beta1.QueryParamsRequest + * @static + * @param {cosmos.slashing.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryParamsRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.slashing.v1beta1.QueryParamsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.slashing.v1beta1.QueryParamsRequest} QueryParamsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.slashing.v1beta1.QueryParamsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryParamsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.slashing.v1beta1.QueryParamsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.slashing.v1beta1.QueryParamsRequest} QueryParamsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryParamsRequest message. + * @function verify + * @memberof cosmos.slashing.v1beta1.QueryParamsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryParamsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a QueryParamsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.slashing.v1beta1.QueryParamsRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.slashing.v1beta1.QueryParamsRequest} QueryParamsRequest + */ + QueryParamsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.slashing.v1beta1.QueryParamsRequest) + return object; + return new $root.cosmos.slashing.v1beta1.QueryParamsRequest(); + }; + + /** + * Creates a plain object from a QueryParamsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.slashing.v1beta1.QueryParamsRequest + * @static + * @param {cosmos.slashing.v1beta1.QueryParamsRequest} message QueryParamsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryParamsRequest.toObject = function toObject() { + return {}; + }; + + /** + * Converts this QueryParamsRequest to JSON. + * @function toJSON + * @memberof cosmos.slashing.v1beta1.QueryParamsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryParamsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryParamsRequest; + })(); + + v1beta1.QueryParamsResponse = (function() { + + /** + * Properties of a QueryParamsResponse. + * @memberof cosmos.slashing.v1beta1 + * @interface IQueryParamsResponse + * @property {cosmos.slashing.v1beta1.IParams|null} [params] QueryParamsResponse params + */ + + /** + * Constructs a new QueryParamsResponse. + * @memberof cosmos.slashing.v1beta1 + * @classdesc Represents a QueryParamsResponse. + * @implements IQueryParamsResponse + * @constructor + * @param {cosmos.slashing.v1beta1.IQueryParamsResponse=} [properties] Properties to set + */ + function QueryParamsResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryParamsResponse params. + * @member {cosmos.slashing.v1beta1.IParams|null|undefined} params + * @memberof cosmos.slashing.v1beta1.QueryParamsResponse + * @instance + */ + QueryParamsResponse.prototype.params = null; + + /** + * Encodes the specified QueryParamsResponse message. Does not implicitly {@link cosmos.slashing.v1beta1.QueryParamsResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.slashing.v1beta1.QueryParamsResponse + * @static + * @param {cosmos.slashing.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.params != null && Object.hasOwnProperty.call(message, "params")) + $root.cosmos.slashing.v1beta1.Params.encode(message.params, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryParamsResponse message, length delimited. Does not implicitly {@link cosmos.slashing.v1beta1.QueryParamsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.slashing.v1beta1.QueryParamsResponse + * @static + * @param {cosmos.slashing.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryParamsResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.slashing.v1beta1.QueryParamsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.slashing.v1beta1.QueryParamsResponse} QueryParamsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.slashing.v1beta1.QueryParamsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = $root.cosmos.slashing.v1beta1.Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryParamsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.slashing.v1beta1.QueryParamsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.slashing.v1beta1.QueryParamsResponse} QueryParamsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryParamsResponse message. + * @function verify + * @memberof cosmos.slashing.v1beta1.QueryParamsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryParamsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.params != null && message.hasOwnProperty("params")) { + let error = $root.cosmos.slashing.v1beta1.Params.verify(message.params); + if (error) + return "params." + error; + } + return null; + }; + + /** + * Creates a QueryParamsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.slashing.v1beta1.QueryParamsResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.slashing.v1beta1.QueryParamsResponse} QueryParamsResponse + */ + QueryParamsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.slashing.v1beta1.QueryParamsResponse) + return object; + let message = new $root.cosmos.slashing.v1beta1.QueryParamsResponse(); + if (object.params != null) { + if (typeof object.params !== "object") + throw TypeError(".cosmos.slashing.v1beta1.QueryParamsResponse.params: object expected"); + message.params = $root.cosmos.slashing.v1beta1.Params.fromObject(object.params); + } + return message; + }; + + /** + * Creates a plain object from a QueryParamsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.slashing.v1beta1.QueryParamsResponse + * @static + * @param {cosmos.slashing.v1beta1.QueryParamsResponse} message QueryParamsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryParamsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.params = null; + if (message.params != null && message.hasOwnProperty("params")) + object.params = $root.cosmos.slashing.v1beta1.Params.toObject(message.params, options); + return object; + }; + + /** + * Converts this QueryParamsResponse to JSON. + * @function toJSON + * @memberof cosmos.slashing.v1beta1.QueryParamsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryParamsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryParamsResponse; + })(); + + v1beta1.QuerySigningInfoRequest = (function() { + + /** + * Properties of a QuerySigningInfoRequest. + * @memberof cosmos.slashing.v1beta1 + * @interface IQuerySigningInfoRequest + * @property {string|null} [cons_address] QuerySigningInfoRequest cons_address + */ + + /** + * Constructs a new QuerySigningInfoRequest. + * @memberof cosmos.slashing.v1beta1 + * @classdesc Represents a QuerySigningInfoRequest. + * @implements IQuerySigningInfoRequest + * @constructor + * @param {cosmos.slashing.v1beta1.IQuerySigningInfoRequest=} [properties] Properties to set + */ + function QuerySigningInfoRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QuerySigningInfoRequest cons_address. + * @member {string} cons_address + * @memberof cosmos.slashing.v1beta1.QuerySigningInfoRequest + * @instance + */ + QuerySigningInfoRequest.prototype.cons_address = ""; + + /** + * Encodes the specified QuerySigningInfoRequest message. Does not implicitly {@link cosmos.slashing.v1beta1.QuerySigningInfoRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.slashing.v1beta1.QuerySigningInfoRequest + * @static + * @param {cosmos.slashing.v1beta1.IQuerySigningInfoRequest} message QuerySigningInfoRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuerySigningInfoRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.cons_address != null && Object.hasOwnProperty.call(message, "cons_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.cons_address); + return writer; + }; + + /** + * Encodes the specified QuerySigningInfoRequest message, length delimited. Does not implicitly {@link cosmos.slashing.v1beta1.QuerySigningInfoRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.slashing.v1beta1.QuerySigningInfoRequest + * @static + * @param {cosmos.slashing.v1beta1.IQuerySigningInfoRequest} message QuerySigningInfoRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuerySigningInfoRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QuerySigningInfoRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.slashing.v1beta1.QuerySigningInfoRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.slashing.v1beta1.QuerySigningInfoRequest} QuerySigningInfoRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuerySigningInfoRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.slashing.v1beta1.QuerySigningInfoRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.cons_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QuerySigningInfoRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.slashing.v1beta1.QuerySigningInfoRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.slashing.v1beta1.QuerySigningInfoRequest} QuerySigningInfoRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuerySigningInfoRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QuerySigningInfoRequest message. + * @function verify + * @memberof cosmos.slashing.v1beta1.QuerySigningInfoRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QuerySigningInfoRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.cons_address != null && message.hasOwnProperty("cons_address")) + if (!$util.isString(message.cons_address)) + return "cons_address: string expected"; + return null; + }; + + /** + * Creates a QuerySigningInfoRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.slashing.v1beta1.QuerySigningInfoRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.slashing.v1beta1.QuerySigningInfoRequest} QuerySigningInfoRequest + */ + QuerySigningInfoRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.slashing.v1beta1.QuerySigningInfoRequest) + return object; + let message = new $root.cosmos.slashing.v1beta1.QuerySigningInfoRequest(); + if (object.cons_address != null) + message.cons_address = String(object.cons_address); + return message; + }; + + /** + * Creates a plain object from a QuerySigningInfoRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.slashing.v1beta1.QuerySigningInfoRequest + * @static + * @param {cosmos.slashing.v1beta1.QuerySigningInfoRequest} message QuerySigningInfoRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QuerySigningInfoRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.cons_address = ""; + if (message.cons_address != null && message.hasOwnProperty("cons_address")) + object.cons_address = message.cons_address; + return object; + }; + + /** + * Converts this QuerySigningInfoRequest to JSON. + * @function toJSON + * @memberof cosmos.slashing.v1beta1.QuerySigningInfoRequest + * @instance + * @returns {Object.} JSON object + */ + QuerySigningInfoRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QuerySigningInfoRequest; + })(); + + v1beta1.QuerySigningInfoResponse = (function() { + + /** + * Properties of a QuerySigningInfoResponse. + * @memberof cosmos.slashing.v1beta1 + * @interface IQuerySigningInfoResponse + * @property {cosmos.slashing.v1beta1.IValidatorSigningInfo|null} [val_signing_info] QuerySigningInfoResponse val_signing_info + */ + + /** + * Constructs a new QuerySigningInfoResponse. + * @memberof cosmos.slashing.v1beta1 + * @classdesc Represents a QuerySigningInfoResponse. + * @implements IQuerySigningInfoResponse + * @constructor + * @param {cosmos.slashing.v1beta1.IQuerySigningInfoResponse=} [properties] Properties to set + */ + function QuerySigningInfoResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QuerySigningInfoResponse val_signing_info. + * @member {cosmos.slashing.v1beta1.IValidatorSigningInfo|null|undefined} val_signing_info + * @memberof cosmos.slashing.v1beta1.QuerySigningInfoResponse + * @instance + */ + QuerySigningInfoResponse.prototype.val_signing_info = null; + + /** + * Encodes the specified QuerySigningInfoResponse message. Does not implicitly {@link cosmos.slashing.v1beta1.QuerySigningInfoResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.slashing.v1beta1.QuerySigningInfoResponse + * @static + * @param {cosmos.slashing.v1beta1.IQuerySigningInfoResponse} message QuerySigningInfoResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuerySigningInfoResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.val_signing_info != null && Object.hasOwnProperty.call(message, "val_signing_info")) + $root.cosmos.slashing.v1beta1.ValidatorSigningInfo.encode(message.val_signing_info, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QuerySigningInfoResponse message, length delimited. Does not implicitly {@link cosmos.slashing.v1beta1.QuerySigningInfoResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.slashing.v1beta1.QuerySigningInfoResponse + * @static + * @param {cosmos.slashing.v1beta1.IQuerySigningInfoResponse} message QuerySigningInfoResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuerySigningInfoResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QuerySigningInfoResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.slashing.v1beta1.QuerySigningInfoResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.slashing.v1beta1.QuerySigningInfoResponse} QuerySigningInfoResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuerySigningInfoResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.slashing.v1beta1.QuerySigningInfoResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.val_signing_info = $root.cosmos.slashing.v1beta1.ValidatorSigningInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QuerySigningInfoResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.slashing.v1beta1.QuerySigningInfoResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.slashing.v1beta1.QuerySigningInfoResponse} QuerySigningInfoResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuerySigningInfoResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QuerySigningInfoResponse message. + * @function verify + * @memberof cosmos.slashing.v1beta1.QuerySigningInfoResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QuerySigningInfoResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.val_signing_info != null && message.hasOwnProperty("val_signing_info")) { + let error = $root.cosmos.slashing.v1beta1.ValidatorSigningInfo.verify(message.val_signing_info); + if (error) + return "val_signing_info." + error; + } + return null; + }; + + /** + * Creates a QuerySigningInfoResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.slashing.v1beta1.QuerySigningInfoResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.slashing.v1beta1.QuerySigningInfoResponse} QuerySigningInfoResponse + */ + QuerySigningInfoResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.slashing.v1beta1.QuerySigningInfoResponse) + return object; + let message = new $root.cosmos.slashing.v1beta1.QuerySigningInfoResponse(); + if (object.val_signing_info != null) { + if (typeof object.val_signing_info !== "object") + throw TypeError(".cosmos.slashing.v1beta1.QuerySigningInfoResponse.val_signing_info: object expected"); + message.val_signing_info = $root.cosmos.slashing.v1beta1.ValidatorSigningInfo.fromObject(object.val_signing_info); + } + return message; + }; + + /** + * Creates a plain object from a QuerySigningInfoResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.slashing.v1beta1.QuerySigningInfoResponse + * @static + * @param {cosmos.slashing.v1beta1.QuerySigningInfoResponse} message QuerySigningInfoResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QuerySigningInfoResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.val_signing_info = null; + if (message.val_signing_info != null && message.hasOwnProperty("val_signing_info")) + object.val_signing_info = $root.cosmos.slashing.v1beta1.ValidatorSigningInfo.toObject(message.val_signing_info, options); + return object; + }; + + /** + * Converts this QuerySigningInfoResponse to JSON. + * @function toJSON + * @memberof cosmos.slashing.v1beta1.QuerySigningInfoResponse + * @instance + * @returns {Object.} JSON object + */ + QuerySigningInfoResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QuerySigningInfoResponse; + })(); + + v1beta1.QuerySigningInfosRequest = (function() { + + /** + * Properties of a QuerySigningInfosRequest. + * @memberof cosmos.slashing.v1beta1 + * @interface IQuerySigningInfosRequest + * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QuerySigningInfosRequest pagination + */ + + /** + * Constructs a new QuerySigningInfosRequest. + * @memberof cosmos.slashing.v1beta1 + * @classdesc Represents a QuerySigningInfosRequest. + * @implements IQuerySigningInfosRequest + * @constructor + * @param {cosmos.slashing.v1beta1.IQuerySigningInfosRequest=} [properties] Properties to set + */ + function QuerySigningInfosRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QuerySigningInfosRequest pagination. + * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination + * @memberof cosmos.slashing.v1beta1.QuerySigningInfosRequest + * @instance + */ + QuerySigningInfosRequest.prototype.pagination = null; + + /** + * Encodes the specified QuerySigningInfosRequest message. Does not implicitly {@link cosmos.slashing.v1beta1.QuerySigningInfosRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.slashing.v1beta1.QuerySigningInfosRequest + * @static + * @param {cosmos.slashing.v1beta1.IQuerySigningInfosRequest} message QuerySigningInfosRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuerySigningInfosRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QuerySigningInfosRequest message, length delimited. Does not implicitly {@link cosmos.slashing.v1beta1.QuerySigningInfosRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.slashing.v1beta1.QuerySigningInfosRequest + * @static + * @param {cosmos.slashing.v1beta1.IQuerySigningInfosRequest} message QuerySigningInfosRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuerySigningInfosRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QuerySigningInfosRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.slashing.v1beta1.QuerySigningInfosRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.slashing.v1beta1.QuerySigningInfosRequest} QuerySigningInfosRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuerySigningInfosRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.slashing.v1beta1.QuerySigningInfosRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QuerySigningInfosRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.slashing.v1beta1.QuerySigningInfosRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.slashing.v1beta1.QuerySigningInfosRequest} QuerySigningInfosRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuerySigningInfosRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QuerySigningInfosRequest message. + * @function verify + * @memberof cosmos.slashing.v1beta1.QuerySigningInfosRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QuerySigningInfosRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QuerySigningInfosRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.slashing.v1beta1.QuerySigningInfosRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.slashing.v1beta1.QuerySigningInfosRequest} QuerySigningInfosRequest + */ + QuerySigningInfosRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.slashing.v1beta1.QuerySigningInfosRequest) + return object; + let message = new $root.cosmos.slashing.v1beta1.QuerySigningInfosRequest(); + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.slashing.v1beta1.QuerySigningInfosRequest.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QuerySigningInfosRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.slashing.v1beta1.QuerySigningInfosRequest + * @static + * @param {cosmos.slashing.v1beta1.QuerySigningInfosRequest} message QuerySigningInfosRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QuerySigningInfosRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.pagination = null; + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QuerySigningInfosRequest to JSON. + * @function toJSON + * @memberof cosmos.slashing.v1beta1.QuerySigningInfosRequest + * @instance + * @returns {Object.} JSON object + */ + QuerySigningInfosRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QuerySigningInfosRequest; + })(); + + v1beta1.QuerySigningInfosResponse = (function() { + + /** + * Properties of a QuerySigningInfosResponse. + * @memberof cosmos.slashing.v1beta1 + * @interface IQuerySigningInfosResponse + * @property {Array.|null} [info] QuerySigningInfosResponse info + * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QuerySigningInfosResponse pagination + */ + + /** + * Constructs a new QuerySigningInfosResponse. + * @memberof cosmos.slashing.v1beta1 + * @classdesc Represents a QuerySigningInfosResponse. + * @implements IQuerySigningInfosResponse + * @constructor + * @param {cosmos.slashing.v1beta1.IQuerySigningInfosResponse=} [properties] Properties to set + */ + function QuerySigningInfosResponse(properties) { + this.info = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QuerySigningInfosResponse info. + * @member {Array.} info + * @memberof cosmos.slashing.v1beta1.QuerySigningInfosResponse + * @instance + */ + QuerySigningInfosResponse.prototype.info = $util.emptyArray; + + /** + * QuerySigningInfosResponse pagination. + * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination + * @memberof cosmos.slashing.v1beta1.QuerySigningInfosResponse + * @instance + */ + QuerySigningInfosResponse.prototype.pagination = null; + + /** + * Encodes the specified QuerySigningInfosResponse message. Does not implicitly {@link cosmos.slashing.v1beta1.QuerySigningInfosResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.slashing.v1beta1.QuerySigningInfosResponse + * @static + * @param {cosmos.slashing.v1beta1.IQuerySigningInfosResponse} message QuerySigningInfosResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuerySigningInfosResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.info != null && message.info.length) + for (let i = 0; i < message.info.length; ++i) + $root.cosmos.slashing.v1beta1.ValidatorSigningInfo.encode(message.info[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QuerySigningInfosResponse message, length delimited. Does not implicitly {@link cosmos.slashing.v1beta1.QuerySigningInfosResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.slashing.v1beta1.QuerySigningInfosResponse + * @static + * @param {cosmos.slashing.v1beta1.IQuerySigningInfosResponse} message QuerySigningInfosResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuerySigningInfosResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QuerySigningInfosResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.slashing.v1beta1.QuerySigningInfosResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.slashing.v1beta1.QuerySigningInfosResponse} QuerySigningInfosResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuerySigningInfosResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.slashing.v1beta1.QuerySigningInfosResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.info && message.info.length)) + message.info = []; + message.info.push($root.cosmos.slashing.v1beta1.ValidatorSigningInfo.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QuerySigningInfosResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.slashing.v1beta1.QuerySigningInfosResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.slashing.v1beta1.QuerySigningInfosResponse} QuerySigningInfosResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuerySigningInfosResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QuerySigningInfosResponse message. + * @function verify + * @memberof cosmos.slashing.v1beta1.QuerySigningInfosResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QuerySigningInfosResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.info != null && message.hasOwnProperty("info")) { + if (!Array.isArray(message.info)) + return "info: array expected"; + for (let i = 0; i < message.info.length; ++i) { + let error = $root.cosmos.slashing.v1beta1.ValidatorSigningInfo.verify(message.info[i]); + if (error) + return "info." + error; + } + } + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QuerySigningInfosResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.slashing.v1beta1.QuerySigningInfosResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.slashing.v1beta1.QuerySigningInfosResponse} QuerySigningInfosResponse + */ + QuerySigningInfosResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.slashing.v1beta1.QuerySigningInfosResponse) + return object; + let message = new $root.cosmos.slashing.v1beta1.QuerySigningInfosResponse(); + if (object.info) { + if (!Array.isArray(object.info)) + throw TypeError(".cosmos.slashing.v1beta1.QuerySigningInfosResponse.info: array expected"); + message.info = []; + for (let i = 0; i < object.info.length; ++i) { + if (typeof object.info[i] !== "object") + throw TypeError(".cosmos.slashing.v1beta1.QuerySigningInfosResponse.info: object expected"); + message.info[i] = $root.cosmos.slashing.v1beta1.ValidatorSigningInfo.fromObject(object.info[i]); + } + } + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.slashing.v1beta1.QuerySigningInfosResponse.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QuerySigningInfosResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.slashing.v1beta1.QuerySigningInfosResponse + * @static + * @param {cosmos.slashing.v1beta1.QuerySigningInfosResponse} message QuerySigningInfosResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QuerySigningInfosResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.info = []; + if (options.defaults) + object.pagination = null; + if (message.info && message.info.length) { + object.info = []; + for (let j = 0; j < message.info.length; ++j) + object.info[j] = $root.cosmos.slashing.v1beta1.ValidatorSigningInfo.toObject(message.info[j], options); + } + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QuerySigningInfosResponse to JSON. + * @function toJSON + * @memberof cosmos.slashing.v1beta1.QuerySigningInfosResponse + * @instance + * @returns {Object.} JSON object + */ + QuerySigningInfosResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QuerySigningInfosResponse; + })(); + + v1beta1.GenesisState = (function() { + + /** + * Properties of a GenesisState. + * @memberof cosmos.slashing.v1beta1 + * @interface IGenesisState + * @property {cosmos.slashing.v1beta1.IParams|null} [params] GenesisState params + * @property {Array.|null} [signing_infos] GenesisState signing_infos + * @property {Array.|null} [missed_blocks] GenesisState missed_blocks + */ + + /** + * Constructs a new GenesisState. + * @memberof cosmos.slashing.v1beta1 + * @classdesc Represents a GenesisState. + * @implements IGenesisState + * @constructor + * @param {cosmos.slashing.v1beta1.IGenesisState=} [properties] Properties to set + */ + function GenesisState(properties) { + this.signing_infos = []; + this.missed_blocks = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenesisState params. + * @member {cosmos.slashing.v1beta1.IParams|null|undefined} params + * @memberof cosmos.slashing.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.params = null; + + /** + * GenesisState signing_infos. + * @member {Array.} signing_infos + * @memberof cosmos.slashing.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.signing_infos = $util.emptyArray; + + /** + * GenesisState missed_blocks. + * @member {Array.} missed_blocks + * @memberof cosmos.slashing.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.missed_blocks = $util.emptyArray; + + /** + * Encodes the specified GenesisState message. Does not implicitly {@link cosmos.slashing.v1beta1.GenesisState.verify|verify} messages. + * @function encode + * @memberof cosmos.slashing.v1beta1.GenesisState + * @static + * @param {cosmos.slashing.v1beta1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.params != null && Object.hasOwnProperty.call(message, "params")) + $root.cosmos.slashing.v1beta1.Params.encode(message.params, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.signing_infos != null && message.signing_infos.length) + for (let i = 0; i < message.signing_infos.length; ++i) + $root.cosmos.slashing.v1beta1.SigningInfo.encode(message.signing_infos[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.missed_blocks != null && message.missed_blocks.length) + for (let i = 0; i < message.missed_blocks.length; ++i) + $root.cosmos.slashing.v1beta1.ValidatorMissedBlocks.encode(message.missed_blocks[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link cosmos.slashing.v1beta1.GenesisState.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.slashing.v1beta1.GenesisState + * @static + * @param {cosmos.slashing.v1beta1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer. + * @function decode + * @memberof cosmos.slashing.v1beta1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.slashing.v1beta1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.slashing.v1beta1.GenesisState(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = $root.cosmos.slashing.v1beta1.Params.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.signing_infos && message.signing_infos.length)) + message.signing_infos = []; + message.signing_infos.push($root.cosmos.slashing.v1beta1.SigningInfo.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.missed_blocks && message.missed_blocks.length)) + message.missed_blocks = []; + message.missed_blocks.push($root.cosmos.slashing.v1beta1.ValidatorMissedBlocks.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.slashing.v1beta1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.slashing.v1beta1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenesisState message. + * @function verify + * @memberof cosmos.slashing.v1beta1.GenesisState + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenesisState.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.params != null && message.hasOwnProperty("params")) { + let error = $root.cosmos.slashing.v1beta1.Params.verify(message.params); + if (error) + return "params." + error; + } + if (message.signing_infos != null && message.hasOwnProperty("signing_infos")) { + if (!Array.isArray(message.signing_infos)) + return "signing_infos: array expected"; + for (let i = 0; i < message.signing_infos.length; ++i) { + let error = $root.cosmos.slashing.v1beta1.SigningInfo.verify(message.signing_infos[i]); + if (error) + return "signing_infos." + error; + } + } + if (message.missed_blocks != null && message.hasOwnProperty("missed_blocks")) { + if (!Array.isArray(message.missed_blocks)) + return "missed_blocks: array expected"; + for (let i = 0; i < message.missed_blocks.length; ++i) { + let error = $root.cosmos.slashing.v1beta1.ValidatorMissedBlocks.verify(message.missed_blocks[i]); + if (error) + return "missed_blocks." + error; + } + } + return null; + }; + + /** + * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.slashing.v1beta1.GenesisState + * @static + * @param {Object.} object Plain object + * @returns {cosmos.slashing.v1beta1.GenesisState} GenesisState + */ + GenesisState.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.slashing.v1beta1.GenesisState) + return object; + let message = new $root.cosmos.slashing.v1beta1.GenesisState(); + if (object.params != null) { + if (typeof object.params !== "object") + throw TypeError(".cosmos.slashing.v1beta1.GenesisState.params: object expected"); + message.params = $root.cosmos.slashing.v1beta1.Params.fromObject(object.params); + } + if (object.signing_infos) { + if (!Array.isArray(object.signing_infos)) + throw TypeError(".cosmos.slashing.v1beta1.GenesisState.signing_infos: array expected"); + message.signing_infos = []; + for (let i = 0; i < object.signing_infos.length; ++i) { + if (typeof object.signing_infos[i] !== "object") + throw TypeError(".cosmos.slashing.v1beta1.GenesisState.signing_infos: object expected"); + message.signing_infos[i] = $root.cosmos.slashing.v1beta1.SigningInfo.fromObject(object.signing_infos[i]); + } + } + if (object.missed_blocks) { + if (!Array.isArray(object.missed_blocks)) + throw TypeError(".cosmos.slashing.v1beta1.GenesisState.missed_blocks: array expected"); + message.missed_blocks = []; + for (let i = 0; i < object.missed_blocks.length; ++i) { + if (typeof object.missed_blocks[i] !== "object") + throw TypeError(".cosmos.slashing.v1beta1.GenesisState.missed_blocks: object expected"); + message.missed_blocks[i] = $root.cosmos.slashing.v1beta1.ValidatorMissedBlocks.fromObject(object.missed_blocks[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a GenesisState message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.slashing.v1beta1.GenesisState + * @static + * @param {cosmos.slashing.v1beta1.GenesisState} message GenesisState + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenesisState.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) { + object.signing_infos = []; + object.missed_blocks = []; + } + if (options.defaults) + object.params = null; + if (message.params != null && message.hasOwnProperty("params")) + object.params = $root.cosmos.slashing.v1beta1.Params.toObject(message.params, options); + if (message.signing_infos && message.signing_infos.length) { + object.signing_infos = []; + for (let j = 0; j < message.signing_infos.length; ++j) + object.signing_infos[j] = $root.cosmos.slashing.v1beta1.SigningInfo.toObject(message.signing_infos[j], options); + } + if (message.missed_blocks && message.missed_blocks.length) { + object.missed_blocks = []; + for (let j = 0; j < message.missed_blocks.length; ++j) + object.missed_blocks[j] = $root.cosmos.slashing.v1beta1.ValidatorMissedBlocks.toObject(message.missed_blocks[j], options); + } + return object; + }; + + /** + * Converts this GenesisState to JSON. + * @function toJSON + * @memberof cosmos.slashing.v1beta1.GenesisState + * @instance + * @returns {Object.} JSON object + */ + GenesisState.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenesisState; + })(); + + v1beta1.SigningInfo = (function() { + + /** + * Properties of a SigningInfo. + * @memberof cosmos.slashing.v1beta1 + * @interface ISigningInfo + * @property {string|null} [address] SigningInfo address + * @property {cosmos.slashing.v1beta1.IValidatorSigningInfo|null} [validator_signing_info] SigningInfo validator_signing_info + */ + + /** + * Constructs a new SigningInfo. + * @memberof cosmos.slashing.v1beta1 + * @classdesc Represents a SigningInfo. + * @implements ISigningInfo + * @constructor + * @param {cosmos.slashing.v1beta1.ISigningInfo=} [properties] Properties to set + */ + function SigningInfo(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SigningInfo address. + * @member {string} address + * @memberof cosmos.slashing.v1beta1.SigningInfo + * @instance + */ + SigningInfo.prototype.address = ""; + + /** + * SigningInfo validator_signing_info. + * @member {cosmos.slashing.v1beta1.IValidatorSigningInfo|null|undefined} validator_signing_info + * @memberof cosmos.slashing.v1beta1.SigningInfo + * @instance + */ + SigningInfo.prototype.validator_signing_info = null; + + /** + * Encodes the specified SigningInfo message. Does not implicitly {@link cosmos.slashing.v1beta1.SigningInfo.verify|verify} messages. + * @function encode + * @memberof cosmos.slashing.v1beta1.SigningInfo + * @static + * @param {cosmos.slashing.v1beta1.ISigningInfo} message SigningInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SigningInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.address != null && Object.hasOwnProperty.call(message, "address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.address); + if (message.validator_signing_info != null && Object.hasOwnProperty.call(message, "validator_signing_info")) + $root.cosmos.slashing.v1beta1.ValidatorSigningInfo.encode(message.validator_signing_info, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SigningInfo message, length delimited. Does not implicitly {@link cosmos.slashing.v1beta1.SigningInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.slashing.v1beta1.SigningInfo + * @static + * @param {cosmos.slashing.v1beta1.ISigningInfo} message SigningInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SigningInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SigningInfo message from the specified reader or buffer. + * @function decode + * @memberof cosmos.slashing.v1beta1.SigningInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.slashing.v1beta1.SigningInfo} SigningInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SigningInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.slashing.v1beta1.SigningInfo(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.validator_signing_info = $root.cosmos.slashing.v1beta1.ValidatorSigningInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SigningInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.slashing.v1beta1.SigningInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.slashing.v1beta1.SigningInfo} SigningInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SigningInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SigningInfo message. + * @function verify + * @memberof cosmos.slashing.v1beta1.SigningInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SigningInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.address != null && message.hasOwnProperty("address")) + if (!$util.isString(message.address)) + return "address: string expected"; + if (message.validator_signing_info != null && message.hasOwnProperty("validator_signing_info")) { + let error = $root.cosmos.slashing.v1beta1.ValidatorSigningInfo.verify(message.validator_signing_info); + if (error) + return "validator_signing_info." + error; + } + return null; + }; + + /** + * Creates a SigningInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.slashing.v1beta1.SigningInfo + * @static + * @param {Object.} object Plain object + * @returns {cosmos.slashing.v1beta1.SigningInfo} SigningInfo + */ + SigningInfo.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.slashing.v1beta1.SigningInfo) + return object; + let message = new $root.cosmos.slashing.v1beta1.SigningInfo(); + if (object.address != null) + message.address = String(object.address); + if (object.validator_signing_info != null) { + if (typeof object.validator_signing_info !== "object") + throw TypeError(".cosmos.slashing.v1beta1.SigningInfo.validator_signing_info: object expected"); + message.validator_signing_info = $root.cosmos.slashing.v1beta1.ValidatorSigningInfo.fromObject(object.validator_signing_info); + } + return message; + }; + + /** + * Creates a plain object from a SigningInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.slashing.v1beta1.SigningInfo + * @static + * @param {cosmos.slashing.v1beta1.SigningInfo} message SigningInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SigningInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.address = ""; + object.validator_signing_info = null; + } + if (message.address != null && message.hasOwnProperty("address")) + object.address = message.address; + if (message.validator_signing_info != null && message.hasOwnProperty("validator_signing_info")) + object.validator_signing_info = $root.cosmos.slashing.v1beta1.ValidatorSigningInfo.toObject(message.validator_signing_info, options); + return object; + }; + + /** + * Converts this SigningInfo to JSON. + * @function toJSON + * @memberof cosmos.slashing.v1beta1.SigningInfo + * @instance + * @returns {Object.} JSON object + */ + SigningInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SigningInfo; + })(); + + v1beta1.ValidatorMissedBlocks = (function() { + + /** + * Properties of a ValidatorMissedBlocks. + * @memberof cosmos.slashing.v1beta1 + * @interface IValidatorMissedBlocks + * @property {string|null} [address] ValidatorMissedBlocks address + * @property {Array.|null} [missed_blocks] ValidatorMissedBlocks missed_blocks + */ + + /** + * Constructs a new ValidatorMissedBlocks. + * @memberof cosmos.slashing.v1beta1 + * @classdesc Represents a ValidatorMissedBlocks. + * @implements IValidatorMissedBlocks + * @constructor + * @param {cosmos.slashing.v1beta1.IValidatorMissedBlocks=} [properties] Properties to set + */ + function ValidatorMissedBlocks(properties) { + this.missed_blocks = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ValidatorMissedBlocks address. + * @member {string} address + * @memberof cosmos.slashing.v1beta1.ValidatorMissedBlocks + * @instance + */ + ValidatorMissedBlocks.prototype.address = ""; + + /** + * ValidatorMissedBlocks missed_blocks. + * @member {Array.} missed_blocks + * @memberof cosmos.slashing.v1beta1.ValidatorMissedBlocks + * @instance + */ + ValidatorMissedBlocks.prototype.missed_blocks = $util.emptyArray; + + /** + * Encodes the specified ValidatorMissedBlocks message. Does not implicitly {@link cosmos.slashing.v1beta1.ValidatorMissedBlocks.verify|verify} messages. + * @function encode + * @memberof cosmos.slashing.v1beta1.ValidatorMissedBlocks + * @static + * @param {cosmos.slashing.v1beta1.IValidatorMissedBlocks} message ValidatorMissedBlocks message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorMissedBlocks.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.address != null && Object.hasOwnProperty.call(message, "address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.address); + if (message.missed_blocks != null && message.missed_blocks.length) + for (let i = 0; i < message.missed_blocks.length; ++i) + $root.cosmos.slashing.v1beta1.MissedBlock.encode(message.missed_blocks[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ValidatorMissedBlocks message, length delimited. Does not implicitly {@link cosmos.slashing.v1beta1.ValidatorMissedBlocks.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.slashing.v1beta1.ValidatorMissedBlocks + * @static + * @param {cosmos.slashing.v1beta1.IValidatorMissedBlocks} message ValidatorMissedBlocks message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorMissedBlocks.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ValidatorMissedBlocks message from the specified reader or buffer. + * @function decode + * @memberof cosmos.slashing.v1beta1.ValidatorMissedBlocks + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.slashing.v1beta1.ValidatorMissedBlocks} ValidatorMissedBlocks + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorMissedBlocks.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.slashing.v1beta1.ValidatorMissedBlocks(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + if (!(message.missed_blocks && message.missed_blocks.length)) + message.missed_blocks = []; + message.missed_blocks.push($root.cosmos.slashing.v1beta1.MissedBlock.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ValidatorMissedBlocks message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.slashing.v1beta1.ValidatorMissedBlocks + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.slashing.v1beta1.ValidatorMissedBlocks} ValidatorMissedBlocks + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorMissedBlocks.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ValidatorMissedBlocks message. + * @function verify + * @memberof cosmos.slashing.v1beta1.ValidatorMissedBlocks + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ValidatorMissedBlocks.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.address != null && message.hasOwnProperty("address")) + if (!$util.isString(message.address)) + return "address: string expected"; + if (message.missed_blocks != null && message.hasOwnProperty("missed_blocks")) { + if (!Array.isArray(message.missed_blocks)) + return "missed_blocks: array expected"; + for (let i = 0; i < message.missed_blocks.length; ++i) { + let error = $root.cosmos.slashing.v1beta1.MissedBlock.verify(message.missed_blocks[i]); + if (error) + return "missed_blocks." + error; + } + } + return null; + }; + + /** + * Creates a ValidatorMissedBlocks message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.slashing.v1beta1.ValidatorMissedBlocks + * @static + * @param {Object.} object Plain object + * @returns {cosmos.slashing.v1beta1.ValidatorMissedBlocks} ValidatorMissedBlocks + */ + ValidatorMissedBlocks.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.slashing.v1beta1.ValidatorMissedBlocks) + return object; + let message = new $root.cosmos.slashing.v1beta1.ValidatorMissedBlocks(); + if (object.address != null) + message.address = String(object.address); + if (object.missed_blocks) { + if (!Array.isArray(object.missed_blocks)) + throw TypeError(".cosmos.slashing.v1beta1.ValidatorMissedBlocks.missed_blocks: array expected"); + message.missed_blocks = []; + for (let i = 0; i < object.missed_blocks.length; ++i) { + if (typeof object.missed_blocks[i] !== "object") + throw TypeError(".cosmos.slashing.v1beta1.ValidatorMissedBlocks.missed_blocks: object expected"); + message.missed_blocks[i] = $root.cosmos.slashing.v1beta1.MissedBlock.fromObject(object.missed_blocks[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ValidatorMissedBlocks message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.slashing.v1beta1.ValidatorMissedBlocks + * @static + * @param {cosmos.slashing.v1beta1.ValidatorMissedBlocks} message ValidatorMissedBlocks + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ValidatorMissedBlocks.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.missed_blocks = []; + if (options.defaults) + object.address = ""; + if (message.address != null && message.hasOwnProperty("address")) + object.address = message.address; + if (message.missed_blocks && message.missed_blocks.length) { + object.missed_blocks = []; + for (let j = 0; j < message.missed_blocks.length; ++j) + object.missed_blocks[j] = $root.cosmos.slashing.v1beta1.MissedBlock.toObject(message.missed_blocks[j], options); + } + return object; + }; + + /** + * Converts this ValidatorMissedBlocks to JSON. + * @function toJSON + * @memberof cosmos.slashing.v1beta1.ValidatorMissedBlocks + * @instance + * @returns {Object.} JSON object + */ + ValidatorMissedBlocks.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ValidatorMissedBlocks; + })(); + + v1beta1.MissedBlock = (function() { + + /** + * Properties of a MissedBlock. + * @memberof cosmos.slashing.v1beta1 + * @interface IMissedBlock + * @property {Long|null} [index] MissedBlock index + * @property {boolean|null} [missed] MissedBlock missed + */ + + /** + * Constructs a new MissedBlock. + * @memberof cosmos.slashing.v1beta1 + * @classdesc Represents a MissedBlock. + * @implements IMissedBlock + * @constructor + * @param {cosmos.slashing.v1beta1.IMissedBlock=} [properties] Properties to set + */ + function MissedBlock(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MissedBlock index. + * @member {Long} index + * @memberof cosmos.slashing.v1beta1.MissedBlock + * @instance + */ + MissedBlock.prototype.index = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * MissedBlock missed. + * @member {boolean} missed + * @memberof cosmos.slashing.v1beta1.MissedBlock + * @instance + */ + MissedBlock.prototype.missed = false; + + /** + * Encodes the specified MissedBlock message. Does not implicitly {@link cosmos.slashing.v1beta1.MissedBlock.verify|verify} messages. + * @function encode + * @memberof cosmos.slashing.v1beta1.MissedBlock + * @static + * @param {cosmos.slashing.v1beta1.IMissedBlock} message MissedBlock message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MissedBlock.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.index != null && Object.hasOwnProperty.call(message, "index")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.index); + if (message.missed != null && Object.hasOwnProperty.call(message, "missed")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.missed); + return writer; + }; + + /** + * Encodes the specified MissedBlock message, length delimited. Does not implicitly {@link cosmos.slashing.v1beta1.MissedBlock.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.slashing.v1beta1.MissedBlock + * @static + * @param {cosmos.slashing.v1beta1.IMissedBlock} message MissedBlock message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MissedBlock.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MissedBlock message from the specified reader or buffer. + * @function decode + * @memberof cosmos.slashing.v1beta1.MissedBlock + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.slashing.v1beta1.MissedBlock} MissedBlock + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MissedBlock.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.slashing.v1beta1.MissedBlock(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = reader.int64(); + break; + case 2: + message.missed = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MissedBlock message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.slashing.v1beta1.MissedBlock + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.slashing.v1beta1.MissedBlock} MissedBlock + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MissedBlock.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MissedBlock message. + * @function verify + * @memberof cosmos.slashing.v1beta1.MissedBlock + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MissedBlock.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.index != null && message.hasOwnProperty("index")) + if (!$util.isInteger(message.index) && !(message.index && $util.isInteger(message.index.low) && $util.isInteger(message.index.high))) + return "index: integer|Long expected"; + if (message.missed != null && message.hasOwnProperty("missed")) + if (typeof message.missed !== "boolean") + return "missed: boolean expected"; + return null; + }; + + /** + * Creates a MissedBlock message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.slashing.v1beta1.MissedBlock + * @static + * @param {Object.} object Plain object + * @returns {cosmos.slashing.v1beta1.MissedBlock} MissedBlock + */ + MissedBlock.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.slashing.v1beta1.MissedBlock) + return object; + let message = new $root.cosmos.slashing.v1beta1.MissedBlock(); + if (object.index != null) + if ($util.Long) + (message.index = $util.Long.fromValue(object.index)).unsigned = false; + else if (typeof object.index === "string") + message.index = parseInt(object.index, 10); + else if (typeof object.index === "number") + message.index = object.index; + else if (typeof object.index === "object") + message.index = new $util.LongBits(object.index.low >>> 0, object.index.high >>> 0).toNumber(); + if (object.missed != null) + message.missed = Boolean(object.missed); + return message; + }; + + /** + * Creates a plain object from a MissedBlock message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.slashing.v1beta1.MissedBlock + * @static + * @param {cosmos.slashing.v1beta1.MissedBlock} message MissedBlock + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MissedBlock.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.index = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.index = options.longs === String ? "0" : 0; + object.missed = false; + } + if (message.index != null && message.hasOwnProperty("index")) + if (typeof message.index === "number") + object.index = options.longs === String ? String(message.index) : message.index; + else + object.index = options.longs === String ? $util.Long.prototype.toString.call(message.index) : options.longs === Number ? new $util.LongBits(message.index.low >>> 0, message.index.high >>> 0).toNumber() : message.index; + if (message.missed != null && message.hasOwnProperty("missed")) + object.missed = message.missed; + return object; + }; + + /** + * Converts this MissedBlock to JSON. + * @function toJSON + * @memberof cosmos.slashing.v1beta1.MissedBlock + * @instance + * @returns {Object.} JSON object + */ + MissedBlock.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MissedBlock; + })(); + + return v1beta1; + })(); + + return slashing; + })(); + + cosmos.staking = (function() { + + /** + * Namespace staking. + * @memberof cosmos + * @namespace + */ + const staking = {}; + + staking.v1beta1 = (function() { + + /** + * Namespace v1beta1. + * @memberof cosmos.staking + * @namespace + */ + const v1beta1 = {}; + + v1beta1.Msg = (function() { + + /** + * Constructs a new Msg service. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a Msg + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Msg(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Msg.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Msg; + + /** + * Callback as used by {@link cosmos.staking.v1beta1.Msg#createValidator}. + * @memberof cosmos.staking.v1beta1.Msg + * @typedef CreateValidatorCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.staking.v1beta1.MsgCreateValidatorResponse} [response] MsgCreateValidatorResponse + */ + + /** + * Calls CreateValidator. + * @function createValidator + * @memberof cosmos.staking.v1beta1.Msg + * @instance + * @param {cosmos.staking.v1beta1.IMsgCreateValidator} request MsgCreateValidator message or plain object + * @param {cosmos.staking.v1beta1.Msg.CreateValidatorCallback} callback Node-style callback called with the error, if any, and MsgCreateValidatorResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.createValidator = function createValidator(request, callback) { + return this.rpcCall(createValidator, $root.cosmos.staking.v1beta1.MsgCreateValidator, $root.cosmos.staking.v1beta1.MsgCreateValidatorResponse, request, callback); + }, "name", { value: "CreateValidator" }); + + /** + * Calls CreateValidator. + * @function createValidator + * @memberof cosmos.staking.v1beta1.Msg + * @instance + * @param {cosmos.staking.v1beta1.IMsgCreateValidator} request MsgCreateValidator message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.staking.v1beta1.Msg#editValidator}. + * @memberof cosmos.staking.v1beta1.Msg + * @typedef EditValidatorCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.staking.v1beta1.MsgEditValidatorResponse} [response] MsgEditValidatorResponse + */ + + /** + * Calls EditValidator. + * @function editValidator + * @memberof cosmos.staking.v1beta1.Msg + * @instance + * @param {cosmos.staking.v1beta1.IMsgEditValidator} request MsgEditValidator message or plain object + * @param {cosmos.staking.v1beta1.Msg.EditValidatorCallback} callback Node-style callback called with the error, if any, and MsgEditValidatorResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.editValidator = function editValidator(request, callback) { + return this.rpcCall(editValidator, $root.cosmos.staking.v1beta1.MsgEditValidator, $root.cosmos.staking.v1beta1.MsgEditValidatorResponse, request, callback); + }, "name", { value: "EditValidator" }); + + /** + * Calls EditValidator. + * @function editValidator + * @memberof cosmos.staking.v1beta1.Msg + * @instance + * @param {cosmos.staking.v1beta1.IMsgEditValidator} request MsgEditValidator message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.staking.v1beta1.Msg#delegate}. + * @memberof cosmos.staking.v1beta1.Msg + * @typedef DelegateCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.staking.v1beta1.MsgDelegateResponse} [response] MsgDelegateResponse + */ + + /** + * Calls Delegate. + * @function delegate + * @memberof cosmos.staking.v1beta1.Msg + * @instance + * @param {cosmos.staking.v1beta1.IMsgDelegate} request MsgDelegate message or plain object + * @param {cosmos.staking.v1beta1.Msg.DelegateCallback} callback Node-style callback called with the error, if any, and MsgDelegateResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.delegate = function delegate(request, callback) { + return this.rpcCall(delegate, $root.cosmos.staking.v1beta1.MsgDelegate, $root.cosmos.staking.v1beta1.MsgDelegateResponse, request, callback); + }, "name", { value: "Delegate" }); + + /** + * Calls Delegate. + * @function delegate + * @memberof cosmos.staking.v1beta1.Msg + * @instance + * @param {cosmos.staking.v1beta1.IMsgDelegate} request MsgDelegate message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.staking.v1beta1.Msg#beginRedelegate}. + * @memberof cosmos.staking.v1beta1.Msg + * @typedef BeginRedelegateCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.staking.v1beta1.MsgBeginRedelegateResponse} [response] MsgBeginRedelegateResponse + */ + + /** + * Calls BeginRedelegate. + * @function beginRedelegate + * @memberof cosmos.staking.v1beta1.Msg + * @instance + * @param {cosmos.staking.v1beta1.IMsgBeginRedelegate} request MsgBeginRedelegate message or plain object + * @param {cosmos.staking.v1beta1.Msg.BeginRedelegateCallback} callback Node-style callback called with the error, if any, and MsgBeginRedelegateResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.beginRedelegate = function beginRedelegate(request, callback) { + return this.rpcCall(beginRedelegate, $root.cosmos.staking.v1beta1.MsgBeginRedelegate, $root.cosmos.staking.v1beta1.MsgBeginRedelegateResponse, request, callback); + }, "name", { value: "BeginRedelegate" }); + + /** + * Calls BeginRedelegate. + * @function beginRedelegate + * @memberof cosmos.staking.v1beta1.Msg + * @instance + * @param {cosmos.staking.v1beta1.IMsgBeginRedelegate} request MsgBeginRedelegate message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.staking.v1beta1.Msg#undelegate}. + * @memberof cosmos.staking.v1beta1.Msg + * @typedef UndelegateCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.staking.v1beta1.MsgUndelegateResponse} [response] MsgUndelegateResponse + */ + + /** + * Calls Undelegate. + * @function undelegate + * @memberof cosmos.staking.v1beta1.Msg + * @instance + * @param {cosmos.staking.v1beta1.IMsgUndelegate} request MsgUndelegate message or plain object + * @param {cosmos.staking.v1beta1.Msg.UndelegateCallback} callback Node-style callback called with the error, if any, and MsgUndelegateResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.undelegate = function undelegate(request, callback) { + return this.rpcCall(undelegate, $root.cosmos.staking.v1beta1.MsgUndelegate, $root.cosmos.staking.v1beta1.MsgUndelegateResponse, request, callback); + }, "name", { value: "Undelegate" }); + + /** + * Calls Undelegate. + * @function undelegate + * @memberof cosmos.staking.v1beta1.Msg + * @instance + * @param {cosmos.staking.v1beta1.IMsgUndelegate} request MsgUndelegate message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Msg; + })(); + + v1beta1.MsgCreateValidator = (function() { + + /** + * Properties of a MsgCreateValidator. + * @memberof cosmos.staking.v1beta1 + * @interface IMsgCreateValidator + * @property {cosmos.staking.v1beta1.IDescription|null} [description] MsgCreateValidator description + * @property {cosmos.staking.v1beta1.ICommissionRates|null} [commission] MsgCreateValidator commission + * @property {string|null} [min_self_delegation] MsgCreateValidator min_self_delegation + * @property {string|null} [delegator_address] MsgCreateValidator delegator_address + * @property {string|null} [validator_address] MsgCreateValidator validator_address + * @property {google.protobuf.IAny|null} [pubkey] MsgCreateValidator pubkey + * @property {cosmos.base.v1beta1.ICoin|null} [value] MsgCreateValidator value + */ + + /** + * Constructs a new MsgCreateValidator. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a MsgCreateValidator. + * @implements IMsgCreateValidator + * @constructor + * @param {cosmos.staking.v1beta1.IMsgCreateValidator=} [properties] Properties to set + */ + function MsgCreateValidator(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgCreateValidator description. + * @member {cosmos.staking.v1beta1.IDescription|null|undefined} description + * @memberof cosmos.staking.v1beta1.MsgCreateValidator + * @instance + */ + MsgCreateValidator.prototype.description = null; + + /** + * MsgCreateValidator commission. + * @member {cosmos.staking.v1beta1.ICommissionRates|null|undefined} commission + * @memberof cosmos.staking.v1beta1.MsgCreateValidator + * @instance + */ + MsgCreateValidator.prototype.commission = null; + + /** + * MsgCreateValidator min_self_delegation. + * @member {string} min_self_delegation + * @memberof cosmos.staking.v1beta1.MsgCreateValidator + * @instance + */ + MsgCreateValidator.prototype.min_self_delegation = ""; + + /** + * MsgCreateValidator delegator_address. + * @member {string} delegator_address + * @memberof cosmos.staking.v1beta1.MsgCreateValidator + * @instance + */ + MsgCreateValidator.prototype.delegator_address = ""; + + /** + * MsgCreateValidator validator_address. + * @member {string} validator_address + * @memberof cosmos.staking.v1beta1.MsgCreateValidator + * @instance + */ + MsgCreateValidator.prototype.validator_address = ""; + + /** + * MsgCreateValidator pubkey. + * @member {google.protobuf.IAny|null|undefined} pubkey + * @memberof cosmos.staking.v1beta1.MsgCreateValidator + * @instance + */ + MsgCreateValidator.prototype.pubkey = null; + + /** + * MsgCreateValidator value. + * @member {cosmos.base.v1beta1.ICoin|null|undefined} value + * @memberof cosmos.staking.v1beta1.MsgCreateValidator + * @instance + */ + MsgCreateValidator.prototype.value = null; + + /** + * Encodes the specified MsgCreateValidator message. Does not implicitly {@link cosmos.staking.v1beta1.MsgCreateValidator.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.MsgCreateValidator + * @static + * @param {cosmos.staking.v1beta1.IMsgCreateValidator} message MsgCreateValidator message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgCreateValidator.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + $root.cosmos.staking.v1beta1.Description.encode(message.description, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.commission != null && Object.hasOwnProperty.call(message, "commission")) + $root.cosmos.staking.v1beta1.CommissionRates.encode(message.commission, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.min_self_delegation != null && Object.hasOwnProperty.call(message, "min_self_delegation")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.min_self_delegation); + if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.delegator_address); + if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.validator_address); + if (message.pubkey != null && Object.hasOwnProperty.call(message, "pubkey")) + $root.google.protobuf.Any.encode(message.pubkey, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + $root.cosmos.base.v1beta1.Coin.encode(message.value, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MsgCreateValidator message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.MsgCreateValidator.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.MsgCreateValidator + * @static + * @param {cosmos.staking.v1beta1.IMsgCreateValidator} message MsgCreateValidator message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgCreateValidator.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgCreateValidator message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.MsgCreateValidator + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.MsgCreateValidator} MsgCreateValidator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgCreateValidator.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.MsgCreateValidator(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.description = $root.cosmos.staking.v1beta1.Description.decode(reader, reader.uint32()); + break; + case 2: + message.commission = $root.cosmos.staking.v1beta1.CommissionRates.decode(reader, reader.uint32()); + break; + case 3: + message.min_self_delegation = reader.string(); + break; + case 4: + message.delegator_address = reader.string(); + break; + case 5: + message.validator_address = reader.string(); + break; + case 6: + message.pubkey = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 7: + message.value = $root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgCreateValidator message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.MsgCreateValidator + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.MsgCreateValidator} MsgCreateValidator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgCreateValidator.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgCreateValidator message. + * @function verify + * @memberof cosmos.staking.v1beta1.MsgCreateValidator + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgCreateValidator.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.description != null && message.hasOwnProperty("description")) { + let error = $root.cosmos.staking.v1beta1.Description.verify(message.description); + if (error) + return "description." + error; + } + if (message.commission != null && message.hasOwnProperty("commission")) { + let error = $root.cosmos.staking.v1beta1.CommissionRates.verify(message.commission); + if (error) + return "commission." + error; + } + if (message.min_self_delegation != null && message.hasOwnProperty("min_self_delegation")) + if (!$util.isString(message.min_self_delegation)) + return "min_self_delegation: string expected"; + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + if (!$util.isString(message.delegator_address)) + return "delegator_address: string expected"; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + if (!$util.isString(message.validator_address)) + return "validator_address: string expected"; + if (message.pubkey != null && message.hasOwnProperty("pubkey")) { + let error = $root.google.protobuf.Any.verify(message.pubkey); + if (error) + return "pubkey." + error; + } + if (message.value != null && message.hasOwnProperty("value")) { + let error = $root.cosmos.base.v1beta1.Coin.verify(message.value); + if (error) + return "value." + error; + } + return null; + }; + + /** + * Creates a MsgCreateValidator message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.MsgCreateValidator + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.MsgCreateValidator} MsgCreateValidator + */ + MsgCreateValidator.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.MsgCreateValidator) + return object; + let message = new $root.cosmos.staking.v1beta1.MsgCreateValidator(); + if (object.description != null) { + if (typeof object.description !== "object") + throw TypeError(".cosmos.staking.v1beta1.MsgCreateValidator.description: object expected"); + message.description = $root.cosmos.staking.v1beta1.Description.fromObject(object.description); + } + if (object.commission != null) { + if (typeof object.commission !== "object") + throw TypeError(".cosmos.staking.v1beta1.MsgCreateValidator.commission: object expected"); + message.commission = $root.cosmos.staking.v1beta1.CommissionRates.fromObject(object.commission); + } + if (object.min_self_delegation != null) + message.min_self_delegation = String(object.min_self_delegation); + if (object.delegator_address != null) + message.delegator_address = String(object.delegator_address); + if (object.validator_address != null) + message.validator_address = String(object.validator_address); + if (object.pubkey != null) { + if (typeof object.pubkey !== "object") + throw TypeError(".cosmos.staking.v1beta1.MsgCreateValidator.pubkey: object expected"); + message.pubkey = $root.google.protobuf.Any.fromObject(object.pubkey); + } + if (object.value != null) { + if (typeof object.value !== "object") + throw TypeError(".cosmos.staking.v1beta1.MsgCreateValidator.value: object expected"); + message.value = $root.cosmos.base.v1beta1.Coin.fromObject(object.value); + } + return message; + }; + + /** + * Creates a plain object from a MsgCreateValidator message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.MsgCreateValidator + * @static + * @param {cosmos.staking.v1beta1.MsgCreateValidator} message MsgCreateValidator + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgCreateValidator.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.description = null; + object.commission = null; + object.min_self_delegation = ""; + object.delegator_address = ""; + object.validator_address = ""; + object.pubkey = null; + object.value = null; + } + if (message.description != null && message.hasOwnProperty("description")) + object.description = $root.cosmos.staking.v1beta1.Description.toObject(message.description, options); + if (message.commission != null && message.hasOwnProperty("commission")) + object.commission = $root.cosmos.staking.v1beta1.CommissionRates.toObject(message.commission, options); + if (message.min_self_delegation != null && message.hasOwnProperty("min_self_delegation")) + object.min_self_delegation = message.min_self_delegation; + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + object.delegator_address = message.delegator_address; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + object.validator_address = message.validator_address; + if (message.pubkey != null && message.hasOwnProperty("pubkey")) + object.pubkey = $root.google.protobuf.Any.toObject(message.pubkey, options); + if (message.value != null && message.hasOwnProperty("value")) + object.value = $root.cosmos.base.v1beta1.Coin.toObject(message.value, options); + return object; + }; + + /** + * Converts this MsgCreateValidator to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.MsgCreateValidator + * @instance + * @returns {Object.} JSON object + */ + MsgCreateValidator.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgCreateValidator; + })(); + + v1beta1.MsgCreateValidatorResponse = (function() { + + /** + * Properties of a MsgCreateValidatorResponse. + * @memberof cosmos.staking.v1beta1 + * @interface IMsgCreateValidatorResponse + */ + + /** + * Constructs a new MsgCreateValidatorResponse. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a MsgCreateValidatorResponse. + * @implements IMsgCreateValidatorResponse + * @constructor + * @param {cosmos.staking.v1beta1.IMsgCreateValidatorResponse=} [properties] Properties to set + */ + function MsgCreateValidatorResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgCreateValidatorResponse message. Does not implicitly {@link cosmos.staking.v1beta1.MsgCreateValidatorResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.MsgCreateValidatorResponse + * @static + * @param {cosmos.staking.v1beta1.IMsgCreateValidatorResponse} message MsgCreateValidatorResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgCreateValidatorResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgCreateValidatorResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.MsgCreateValidatorResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.MsgCreateValidatorResponse + * @static + * @param {cosmos.staking.v1beta1.IMsgCreateValidatorResponse} message MsgCreateValidatorResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgCreateValidatorResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgCreateValidatorResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.MsgCreateValidatorResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.MsgCreateValidatorResponse} MsgCreateValidatorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgCreateValidatorResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.MsgCreateValidatorResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgCreateValidatorResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.MsgCreateValidatorResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.MsgCreateValidatorResponse} MsgCreateValidatorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgCreateValidatorResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgCreateValidatorResponse message. + * @function verify + * @memberof cosmos.staking.v1beta1.MsgCreateValidatorResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgCreateValidatorResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgCreateValidatorResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.MsgCreateValidatorResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.MsgCreateValidatorResponse} MsgCreateValidatorResponse + */ + MsgCreateValidatorResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.MsgCreateValidatorResponse) + return object; + return new $root.cosmos.staking.v1beta1.MsgCreateValidatorResponse(); + }; + + /** + * Creates a plain object from a MsgCreateValidatorResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.MsgCreateValidatorResponse + * @static + * @param {cosmos.staking.v1beta1.MsgCreateValidatorResponse} message MsgCreateValidatorResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgCreateValidatorResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgCreateValidatorResponse to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.MsgCreateValidatorResponse + * @instance + * @returns {Object.} JSON object + */ + MsgCreateValidatorResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgCreateValidatorResponse; + })(); + + v1beta1.MsgEditValidator = (function() { + + /** + * Properties of a MsgEditValidator. + * @memberof cosmos.staking.v1beta1 + * @interface IMsgEditValidator + * @property {cosmos.staking.v1beta1.IDescription|null} [description] MsgEditValidator description + * @property {string|null} [validator_address] MsgEditValidator validator_address + * @property {string|null} [commission_rate] MsgEditValidator commission_rate + * @property {string|null} [min_self_delegation] MsgEditValidator min_self_delegation + */ + + /** + * Constructs a new MsgEditValidator. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a MsgEditValidator. + * @implements IMsgEditValidator + * @constructor + * @param {cosmos.staking.v1beta1.IMsgEditValidator=} [properties] Properties to set + */ + function MsgEditValidator(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgEditValidator description. + * @member {cosmos.staking.v1beta1.IDescription|null|undefined} description + * @memberof cosmos.staking.v1beta1.MsgEditValidator + * @instance + */ + MsgEditValidator.prototype.description = null; + + /** + * MsgEditValidator validator_address. + * @member {string} validator_address + * @memberof cosmos.staking.v1beta1.MsgEditValidator + * @instance + */ + MsgEditValidator.prototype.validator_address = ""; + + /** + * MsgEditValidator commission_rate. + * @member {string} commission_rate + * @memberof cosmos.staking.v1beta1.MsgEditValidator + * @instance + */ + MsgEditValidator.prototype.commission_rate = ""; + + /** + * MsgEditValidator min_self_delegation. + * @member {string} min_self_delegation + * @memberof cosmos.staking.v1beta1.MsgEditValidator + * @instance + */ + MsgEditValidator.prototype.min_self_delegation = ""; + + /** + * Encodes the specified MsgEditValidator message. Does not implicitly {@link cosmos.staking.v1beta1.MsgEditValidator.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.MsgEditValidator + * @static + * @param {cosmos.staking.v1beta1.IMsgEditValidator} message MsgEditValidator message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgEditValidator.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + $root.cosmos.staking.v1beta1.Description.encode(message.description, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.validator_address); + if (message.commission_rate != null && Object.hasOwnProperty.call(message, "commission_rate")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.commission_rate); + if (message.min_self_delegation != null && Object.hasOwnProperty.call(message, "min_self_delegation")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.min_self_delegation); + return writer; + }; + + /** + * Encodes the specified MsgEditValidator message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.MsgEditValidator.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.MsgEditValidator + * @static + * @param {cosmos.staking.v1beta1.IMsgEditValidator} message MsgEditValidator message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgEditValidator.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgEditValidator message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.MsgEditValidator + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.MsgEditValidator} MsgEditValidator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgEditValidator.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.MsgEditValidator(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.description = $root.cosmos.staking.v1beta1.Description.decode(reader, reader.uint32()); + break; + case 2: + message.validator_address = reader.string(); + break; + case 3: + message.commission_rate = reader.string(); + break; + case 4: + message.min_self_delegation = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgEditValidator message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.MsgEditValidator + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.MsgEditValidator} MsgEditValidator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgEditValidator.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgEditValidator message. + * @function verify + * @memberof cosmos.staking.v1beta1.MsgEditValidator + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgEditValidator.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.description != null && message.hasOwnProperty("description")) { + let error = $root.cosmos.staking.v1beta1.Description.verify(message.description); + if (error) + return "description." + error; + } + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + if (!$util.isString(message.validator_address)) + return "validator_address: string expected"; + if (message.commission_rate != null && message.hasOwnProperty("commission_rate")) + if (!$util.isString(message.commission_rate)) + return "commission_rate: string expected"; + if (message.min_self_delegation != null && message.hasOwnProperty("min_self_delegation")) + if (!$util.isString(message.min_self_delegation)) + return "min_self_delegation: string expected"; + return null; + }; + + /** + * Creates a MsgEditValidator message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.MsgEditValidator + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.MsgEditValidator} MsgEditValidator + */ + MsgEditValidator.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.MsgEditValidator) + return object; + let message = new $root.cosmos.staking.v1beta1.MsgEditValidator(); + if (object.description != null) { + if (typeof object.description !== "object") + throw TypeError(".cosmos.staking.v1beta1.MsgEditValidator.description: object expected"); + message.description = $root.cosmos.staking.v1beta1.Description.fromObject(object.description); + } + if (object.validator_address != null) + message.validator_address = String(object.validator_address); + if (object.commission_rate != null) + message.commission_rate = String(object.commission_rate); + if (object.min_self_delegation != null) + message.min_self_delegation = String(object.min_self_delegation); + return message; + }; + + /** + * Creates a plain object from a MsgEditValidator message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.MsgEditValidator + * @static + * @param {cosmos.staking.v1beta1.MsgEditValidator} message MsgEditValidator + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgEditValidator.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.description = null; + object.validator_address = ""; + object.commission_rate = ""; + object.min_self_delegation = ""; + } + if (message.description != null && message.hasOwnProperty("description")) + object.description = $root.cosmos.staking.v1beta1.Description.toObject(message.description, options); + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + object.validator_address = message.validator_address; + if (message.commission_rate != null && message.hasOwnProperty("commission_rate")) + object.commission_rate = message.commission_rate; + if (message.min_self_delegation != null && message.hasOwnProperty("min_self_delegation")) + object.min_self_delegation = message.min_self_delegation; + return object; + }; + + /** + * Converts this MsgEditValidator to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.MsgEditValidator + * @instance + * @returns {Object.} JSON object + */ + MsgEditValidator.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgEditValidator; + })(); + + v1beta1.MsgEditValidatorResponse = (function() { + + /** + * Properties of a MsgEditValidatorResponse. + * @memberof cosmos.staking.v1beta1 + * @interface IMsgEditValidatorResponse + */ + + /** + * Constructs a new MsgEditValidatorResponse. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a MsgEditValidatorResponse. + * @implements IMsgEditValidatorResponse + * @constructor + * @param {cosmos.staking.v1beta1.IMsgEditValidatorResponse=} [properties] Properties to set + */ + function MsgEditValidatorResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgEditValidatorResponse message. Does not implicitly {@link cosmos.staking.v1beta1.MsgEditValidatorResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.MsgEditValidatorResponse + * @static + * @param {cosmos.staking.v1beta1.IMsgEditValidatorResponse} message MsgEditValidatorResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgEditValidatorResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgEditValidatorResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.MsgEditValidatorResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.MsgEditValidatorResponse + * @static + * @param {cosmos.staking.v1beta1.IMsgEditValidatorResponse} message MsgEditValidatorResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgEditValidatorResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgEditValidatorResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.MsgEditValidatorResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.MsgEditValidatorResponse} MsgEditValidatorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgEditValidatorResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.MsgEditValidatorResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgEditValidatorResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.MsgEditValidatorResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.MsgEditValidatorResponse} MsgEditValidatorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgEditValidatorResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgEditValidatorResponse message. + * @function verify + * @memberof cosmos.staking.v1beta1.MsgEditValidatorResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgEditValidatorResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgEditValidatorResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.MsgEditValidatorResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.MsgEditValidatorResponse} MsgEditValidatorResponse + */ + MsgEditValidatorResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.MsgEditValidatorResponse) + return object; + return new $root.cosmos.staking.v1beta1.MsgEditValidatorResponse(); + }; + + /** + * Creates a plain object from a MsgEditValidatorResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.MsgEditValidatorResponse + * @static + * @param {cosmos.staking.v1beta1.MsgEditValidatorResponse} message MsgEditValidatorResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgEditValidatorResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgEditValidatorResponse to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.MsgEditValidatorResponse + * @instance + * @returns {Object.} JSON object + */ + MsgEditValidatorResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgEditValidatorResponse; + })(); + + v1beta1.MsgDelegate = (function() { + + /** + * Properties of a MsgDelegate. + * @memberof cosmos.staking.v1beta1 + * @interface IMsgDelegate + * @property {string|null} [delegator_address] MsgDelegate delegator_address + * @property {string|null} [validator_address] MsgDelegate validator_address + * @property {cosmos.base.v1beta1.ICoin|null} [amount] MsgDelegate amount + */ + + /** + * Constructs a new MsgDelegate. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a MsgDelegate. + * @implements IMsgDelegate + * @constructor + * @param {cosmos.staking.v1beta1.IMsgDelegate=} [properties] Properties to set + */ + function MsgDelegate(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgDelegate delegator_address. + * @member {string} delegator_address + * @memberof cosmos.staking.v1beta1.MsgDelegate + * @instance + */ + MsgDelegate.prototype.delegator_address = ""; + + /** + * MsgDelegate validator_address. + * @member {string} validator_address + * @memberof cosmos.staking.v1beta1.MsgDelegate + * @instance + */ + MsgDelegate.prototype.validator_address = ""; + + /** + * MsgDelegate amount. + * @member {cosmos.base.v1beta1.ICoin|null|undefined} amount + * @memberof cosmos.staking.v1beta1.MsgDelegate + * @instance + */ + MsgDelegate.prototype.amount = null; + + /** + * Encodes the specified MsgDelegate message. Does not implicitly {@link cosmos.staking.v1beta1.MsgDelegate.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.MsgDelegate + * @static + * @param {cosmos.staking.v1beta1.IMsgDelegate} message MsgDelegate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgDelegate.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); + if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.validator_address); + if (message.amount != null && Object.hasOwnProperty.call(message, "amount")) + $root.cosmos.base.v1beta1.Coin.encode(message.amount, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MsgDelegate message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.MsgDelegate.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.MsgDelegate + * @static + * @param {cosmos.staking.v1beta1.IMsgDelegate} message MsgDelegate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgDelegate.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgDelegate message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.MsgDelegate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.MsgDelegate} MsgDelegate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgDelegate.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.MsgDelegate(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_address = reader.string(); + break; + case 2: + message.validator_address = reader.string(); + break; + case 3: + message.amount = $root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgDelegate message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.MsgDelegate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.MsgDelegate} MsgDelegate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgDelegate.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgDelegate message. + * @function verify + * @memberof cosmos.staking.v1beta1.MsgDelegate + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgDelegate.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + if (!$util.isString(message.delegator_address)) + return "delegator_address: string expected"; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + if (!$util.isString(message.validator_address)) + return "validator_address: string expected"; + if (message.amount != null && message.hasOwnProperty("amount")) { + let error = $root.cosmos.base.v1beta1.Coin.verify(message.amount); + if (error) + return "amount." + error; + } + return null; + }; + + /** + * Creates a MsgDelegate message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.MsgDelegate + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.MsgDelegate} MsgDelegate + */ + MsgDelegate.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.MsgDelegate) + return object; + let message = new $root.cosmos.staking.v1beta1.MsgDelegate(); + if (object.delegator_address != null) + message.delegator_address = String(object.delegator_address); + if (object.validator_address != null) + message.validator_address = String(object.validator_address); + if (object.amount != null) { + if (typeof object.amount !== "object") + throw TypeError(".cosmos.staking.v1beta1.MsgDelegate.amount: object expected"); + message.amount = $root.cosmos.base.v1beta1.Coin.fromObject(object.amount); + } + return message; + }; + + /** + * Creates a plain object from a MsgDelegate message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.MsgDelegate + * @static + * @param {cosmos.staking.v1beta1.MsgDelegate} message MsgDelegate + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgDelegate.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.delegator_address = ""; + object.validator_address = ""; + object.amount = null; + } + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + object.delegator_address = message.delegator_address; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + object.validator_address = message.validator_address; + if (message.amount != null && message.hasOwnProperty("amount")) + object.amount = $root.cosmos.base.v1beta1.Coin.toObject(message.amount, options); + return object; + }; + + /** + * Converts this MsgDelegate to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.MsgDelegate + * @instance + * @returns {Object.} JSON object + */ + MsgDelegate.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgDelegate; + })(); + + v1beta1.MsgDelegateResponse = (function() { + + /** + * Properties of a MsgDelegateResponse. + * @memberof cosmos.staking.v1beta1 + * @interface IMsgDelegateResponse + */ + + /** + * Constructs a new MsgDelegateResponse. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a MsgDelegateResponse. + * @implements IMsgDelegateResponse + * @constructor + * @param {cosmos.staking.v1beta1.IMsgDelegateResponse=} [properties] Properties to set + */ + function MsgDelegateResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgDelegateResponse message. Does not implicitly {@link cosmos.staking.v1beta1.MsgDelegateResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.MsgDelegateResponse + * @static + * @param {cosmos.staking.v1beta1.IMsgDelegateResponse} message MsgDelegateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgDelegateResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgDelegateResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.MsgDelegateResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.MsgDelegateResponse + * @static + * @param {cosmos.staking.v1beta1.IMsgDelegateResponse} message MsgDelegateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgDelegateResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgDelegateResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.MsgDelegateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.MsgDelegateResponse} MsgDelegateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgDelegateResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.MsgDelegateResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgDelegateResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.MsgDelegateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.MsgDelegateResponse} MsgDelegateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgDelegateResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgDelegateResponse message. + * @function verify + * @memberof cosmos.staking.v1beta1.MsgDelegateResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgDelegateResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgDelegateResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.MsgDelegateResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.MsgDelegateResponse} MsgDelegateResponse + */ + MsgDelegateResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.MsgDelegateResponse) + return object; + return new $root.cosmos.staking.v1beta1.MsgDelegateResponse(); + }; + + /** + * Creates a plain object from a MsgDelegateResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.MsgDelegateResponse + * @static + * @param {cosmos.staking.v1beta1.MsgDelegateResponse} message MsgDelegateResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgDelegateResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgDelegateResponse to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.MsgDelegateResponse + * @instance + * @returns {Object.} JSON object + */ + MsgDelegateResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgDelegateResponse; + })(); + + v1beta1.MsgBeginRedelegate = (function() { + + /** + * Properties of a MsgBeginRedelegate. + * @memberof cosmos.staking.v1beta1 + * @interface IMsgBeginRedelegate + * @property {string|null} [delegator_address] MsgBeginRedelegate delegator_address + * @property {string|null} [validator_src_address] MsgBeginRedelegate validator_src_address + * @property {string|null} [validator_dst_address] MsgBeginRedelegate validator_dst_address + * @property {cosmos.base.v1beta1.ICoin|null} [amount] MsgBeginRedelegate amount + */ + + /** + * Constructs a new MsgBeginRedelegate. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a MsgBeginRedelegate. + * @implements IMsgBeginRedelegate + * @constructor + * @param {cosmos.staking.v1beta1.IMsgBeginRedelegate=} [properties] Properties to set + */ + function MsgBeginRedelegate(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgBeginRedelegate delegator_address. + * @member {string} delegator_address + * @memberof cosmos.staking.v1beta1.MsgBeginRedelegate + * @instance + */ + MsgBeginRedelegate.prototype.delegator_address = ""; + + /** + * MsgBeginRedelegate validator_src_address. + * @member {string} validator_src_address + * @memberof cosmos.staking.v1beta1.MsgBeginRedelegate + * @instance + */ + MsgBeginRedelegate.prototype.validator_src_address = ""; + + /** + * MsgBeginRedelegate validator_dst_address. + * @member {string} validator_dst_address + * @memberof cosmos.staking.v1beta1.MsgBeginRedelegate + * @instance + */ + MsgBeginRedelegate.prototype.validator_dst_address = ""; + + /** + * MsgBeginRedelegate amount. + * @member {cosmos.base.v1beta1.ICoin|null|undefined} amount + * @memberof cosmos.staking.v1beta1.MsgBeginRedelegate + * @instance + */ + MsgBeginRedelegate.prototype.amount = null; + + /** + * Encodes the specified MsgBeginRedelegate message. Does not implicitly {@link cosmos.staking.v1beta1.MsgBeginRedelegate.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.MsgBeginRedelegate + * @static + * @param {cosmos.staking.v1beta1.IMsgBeginRedelegate} message MsgBeginRedelegate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgBeginRedelegate.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); + if (message.validator_src_address != null && Object.hasOwnProperty.call(message, "validator_src_address")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.validator_src_address); + if (message.validator_dst_address != null && Object.hasOwnProperty.call(message, "validator_dst_address")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.validator_dst_address); + if (message.amount != null && Object.hasOwnProperty.call(message, "amount")) + $root.cosmos.base.v1beta1.Coin.encode(message.amount, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MsgBeginRedelegate message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.MsgBeginRedelegate.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.MsgBeginRedelegate + * @static + * @param {cosmos.staking.v1beta1.IMsgBeginRedelegate} message MsgBeginRedelegate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgBeginRedelegate.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgBeginRedelegate message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.MsgBeginRedelegate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.MsgBeginRedelegate} MsgBeginRedelegate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgBeginRedelegate.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.MsgBeginRedelegate(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_address = reader.string(); + break; + case 2: + message.validator_src_address = reader.string(); + break; + case 3: + message.validator_dst_address = reader.string(); + break; + case 4: + message.amount = $root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgBeginRedelegate message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.MsgBeginRedelegate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.MsgBeginRedelegate} MsgBeginRedelegate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgBeginRedelegate.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgBeginRedelegate message. + * @function verify + * @memberof cosmos.staking.v1beta1.MsgBeginRedelegate + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgBeginRedelegate.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + if (!$util.isString(message.delegator_address)) + return "delegator_address: string expected"; + if (message.validator_src_address != null && message.hasOwnProperty("validator_src_address")) + if (!$util.isString(message.validator_src_address)) + return "validator_src_address: string expected"; + if (message.validator_dst_address != null && message.hasOwnProperty("validator_dst_address")) + if (!$util.isString(message.validator_dst_address)) + return "validator_dst_address: string expected"; + if (message.amount != null && message.hasOwnProperty("amount")) { + let error = $root.cosmos.base.v1beta1.Coin.verify(message.amount); + if (error) + return "amount." + error; + } + return null; + }; + + /** + * Creates a MsgBeginRedelegate message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.MsgBeginRedelegate + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.MsgBeginRedelegate} MsgBeginRedelegate + */ + MsgBeginRedelegate.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.MsgBeginRedelegate) + return object; + let message = new $root.cosmos.staking.v1beta1.MsgBeginRedelegate(); + if (object.delegator_address != null) + message.delegator_address = String(object.delegator_address); + if (object.validator_src_address != null) + message.validator_src_address = String(object.validator_src_address); + if (object.validator_dst_address != null) + message.validator_dst_address = String(object.validator_dst_address); + if (object.amount != null) { + if (typeof object.amount !== "object") + throw TypeError(".cosmos.staking.v1beta1.MsgBeginRedelegate.amount: object expected"); + message.amount = $root.cosmos.base.v1beta1.Coin.fromObject(object.amount); + } + return message; + }; + + /** + * Creates a plain object from a MsgBeginRedelegate message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.MsgBeginRedelegate + * @static + * @param {cosmos.staking.v1beta1.MsgBeginRedelegate} message MsgBeginRedelegate + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgBeginRedelegate.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.delegator_address = ""; + object.validator_src_address = ""; + object.validator_dst_address = ""; + object.amount = null; + } + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + object.delegator_address = message.delegator_address; + if (message.validator_src_address != null && message.hasOwnProperty("validator_src_address")) + object.validator_src_address = message.validator_src_address; + if (message.validator_dst_address != null && message.hasOwnProperty("validator_dst_address")) + object.validator_dst_address = message.validator_dst_address; + if (message.amount != null && message.hasOwnProperty("amount")) + object.amount = $root.cosmos.base.v1beta1.Coin.toObject(message.amount, options); + return object; + }; + + /** + * Converts this MsgBeginRedelegate to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.MsgBeginRedelegate + * @instance + * @returns {Object.} JSON object + */ + MsgBeginRedelegate.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgBeginRedelegate; + })(); + + v1beta1.MsgBeginRedelegateResponse = (function() { + + /** + * Properties of a MsgBeginRedelegateResponse. + * @memberof cosmos.staking.v1beta1 + * @interface IMsgBeginRedelegateResponse + * @property {google.protobuf.ITimestamp|null} [completion_time] MsgBeginRedelegateResponse completion_time + */ + + /** + * Constructs a new MsgBeginRedelegateResponse. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a MsgBeginRedelegateResponse. + * @implements IMsgBeginRedelegateResponse + * @constructor + * @param {cosmos.staking.v1beta1.IMsgBeginRedelegateResponse=} [properties] Properties to set + */ + function MsgBeginRedelegateResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgBeginRedelegateResponse completion_time. + * @member {google.protobuf.ITimestamp|null|undefined} completion_time + * @memberof cosmos.staking.v1beta1.MsgBeginRedelegateResponse + * @instance + */ + MsgBeginRedelegateResponse.prototype.completion_time = null; + + /** + * Encodes the specified MsgBeginRedelegateResponse message. Does not implicitly {@link cosmos.staking.v1beta1.MsgBeginRedelegateResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.MsgBeginRedelegateResponse + * @static + * @param {cosmos.staking.v1beta1.IMsgBeginRedelegateResponse} message MsgBeginRedelegateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgBeginRedelegateResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.completion_time != null && Object.hasOwnProperty.call(message, "completion_time")) + $root.google.protobuf.Timestamp.encode(message.completion_time, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MsgBeginRedelegateResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.MsgBeginRedelegateResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.MsgBeginRedelegateResponse + * @static + * @param {cosmos.staking.v1beta1.IMsgBeginRedelegateResponse} message MsgBeginRedelegateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgBeginRedelegateResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgBeginRedelegateResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.MsgBeginRedelegateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.MsgBeginRedelegateResponse} MsgBeginRedelegateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgBeginRedelegateResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.MsgBeginRedelegateResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.completion_time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgBeginRedelegateResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.MsgBeginRedelegateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.MsgBeginRedelegateResponse} MsgBeginRedelegateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgBeginRedelegateResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgBeginRedelegateResponse message. + * @function verify + * @memberof cosmos.staking.v1beta1.MsgBeginRedelegateResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgBeginRedelegateResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.completion_time != null && message.hasOwnProperty("completion_time")) { + let error = $root.google.protobuf.Timestamp.verify(message.completion_time); + if (error) + return "completion_time." + error; + } + return null; + }; + + /** + * Creates a MsgBeginRedelegateResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.MsgBeginRedelegateResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.MsgBeginRedelegateResponse} MsgBeginRedelegateResponse + */ + MsgBeginRedelegateResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.MsgBeginRedelegateResponse) + return object; + let message = new $root.cosmos.staking.v1beta1.MsgBeginRedelegateResponse(); + if (object.completion_time != null) { + if (typeof object.completion_time !== "object") + throw TypeError(".cosmos.staking.v1beta1.MsgBeginRedelegateResponse.completion_time: object expected"); + message.completion_time = $root.google.protobuf.Timestamp.fromObject(object.completion_time); + } + return message; + }; + + /** + * Creates a plain object from a MsgBeginRedelegateResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.MsgBeginRedelegateResponse + * @static + * @param {cosmos.staking.v1beta1.MsgBeginRedelegateResponse} message MsgBeginRedelegateResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgBeginRedelegateResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.completion_time = null; + if (message.completion_time != null && message.hasOwnProperty("completion_time")) + object.completion_time = $root.google.protobuf.Timestamp.toObject(message.completion_time, options); + return object; + }; + + /** + * Converts this MsgBeginRedelegateResponse to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.MsgBeginRedelegateResponse + * @instance + * @returns {Object.} JSON object + */ + MsgBeginRedelegateResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgBeginRedelegateResponse; + })(); + + v1beta1.MsgUndelegate = (function() { + + /** + * Properties of a MsgUndelegate. + * @memberof cosmos.staking.v1beta1 + * @interface IMsgUndelegate + * @property {string|null} [delegator_address] MsgUndelegate delegator_address + * @property {string|null} [validator_address] MsgUndelegate validator_address + * @property {cosmos.base.v1beta1.ICoin|null} [amount] MsgUndelegate amount + */ + + /** + * Constructs a new MsgUndelegate. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a MsgUndelegate. + * @implements IMsgUndelegate + * @constructor + * @param {cosmos.staking.v1beta1.IMsgUndelegate=} [properties] Properties to set + */ + function MsgUndelegate(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgUndelegate delegator_address. + * @member {string} delegator_address + * @memberof cosmos.staking.v1beta1.MsgUndelegate + * @instance + */ + MsgUndelegate.prototype.delegator_address = ""; + + /** + * MsgUndelegate validator_address. + * @member {string} validator_address + * @memberof cosmos.staking.v1beta1.MsgUndelegate + * @instance + */ + MsgUndelegate.prototype.validator_address = ""; + + /** + * MsgUndelegate amount. + * @member {cosmos.base.v1beta1.ICoin|null|undefined} amount + * @memberof cosmos.staking.v1beta1.MsgUndelegate + * @instance + */ + MsgUndelegate.prototype.amount = null; + + /** + * Encodes the specified MsgUndelegate message. Does not implicitly {@link cosmos.staking.v1beta1.MsgUndelegate.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.MsgUndelegate + * @static + * @param {cosmos.staking.v1beta1.IMsgUndelegate} message MsgUndelegate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgUndelegate.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); + if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.validator_address); + if (message.amount != null && Object.hasOwnProperty.call(message, "amount")) + $root.cosmos.base.v1beta1.Coin.encode(message.amount, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MsgUndelegate message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.MsgUndelegate.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.MsgUndelegate + * @static + * @param {cosmos.staking.v1beta1.IMsgUndelegate} message MsgUndelegate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgUndelegate.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgUndelegate message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.MsgUndelegate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.MsgUndelegate} MsgUndelegate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgUndelegate.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.MsgUndelegate(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_address = reader.string(); + break; + case 2: + message.validator_address = reader.string(); + break; + case 3: + message.amount = $root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgUndelegate message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.MsgUndelegate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.MsgUndelegate} MsgUndelegate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgUndelegate.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgUndelegate message. + * @function verify + * @memberof cosmos.staking.v1beta1.MsgUndelegate + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgUndelegate.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + if (!$util.isString(message.delegator_address)) + return "delegator_address: string expected"; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + if (!$util.isString(message.validator_address)) + return "validator_address: string expected"; + if (message.amount != null && message.hasOwnProperty("amount")) { + let error = $root.cosmos.base.v1beta1.Coin.verify(message.amount); + if (error) + return "amount." + error; + } + return null; + }; + + /** + * Creates a MsgUndelegate message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.MsgUndelegate + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.MsgUndelegate} MsgUndelegate + */ + MsgUndelegate.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.MsgUndelegate) + return object; + let message = new $root.cosmos.staking.v1beta1.MsgUndelegate(); + if (object.delegator_address != null) + message.delegator_address = String(object.delegator_address); + if (object.validator_address != null) + message.validator_address = String(object.validator_address); + if (object.amount != null) { + if (typeof object.amount !== "object") + throw TypeError(".cosmos.staking.v1beta1.MsgUndelegate.amount: object expected"); + message.amount = $root.cosmos.base.v1beta1.Coin.fromObject(object.amount); + } + return message; + }; + + /** + * Creates a plain object from a MsgUndelegate message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.MsgUndelegate + * @static + * @param {cosmos.staking.v1beta1.MsgUndelegate} message MsgUndelegate + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgUndelegate.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.delegator_address = ""; + object.validator_address = ""; + object.amount = null; + } + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + object.delegator_address = message.delegator_address; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + object.validator_address = message.validator_address; + if (message.amount != null && message.hasOwnProperty("amount")) + object.amount = $root.cosmos.base.v1beta1.Coin.toObject(message.amount, options); + return object; + }; + + /** + * Converts this MsgUndelegate to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.MsgUndelegate + * @instance + * @returns {Object.} JSON object + */ + MsgUndelegate.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgUndelegate; + })(); + + v1beta1.MsgUndelegateResponse = (function() { + + /** + * Properties of a MsgUndelegateResponse. + * @memberof cosmos.staking.v1beta1 + * @interface IMsgUndelegateResponse + * @property {google.protobuf.ITimestamp|null} [completion_time] MsgUndelegateResponse completion_time + */ + + /** + * Constructs a new MsgUndelegateResponse. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a MsgUndelegateResponse. + * @implements IMsgUndelegateResponse + * @constructor + * @param {cosmos.staking.v1beta1.IMsgUndelegateResponse=} [properties] Properties to set + */ + function MsgUndelegateResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgUndelegateResponse completion_time. + * @member {google.protobuf.ITimestamp|null|undefined} completion_time + * @memberof cosmos.staking.v1beta1.MsgUndelegateResponse + * @instance + */ + MsgUndelegateResponse.prototype.completion_time = null; + + /** + * Encodes the specified MsgUndelegateResponse message. Does not implicitly {@link cosmos.staking.v1beta1.MsgUndelegateResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.MsgUndelegateResponse + * @static + * @param {cosmos.staking.v1beta1.IMsgUndelegateResponse} message MsgUndelegateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgUndelegateResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.completion_time != null && Object.hasOwnProperty.call(message, "completion_time")) + $root.google.protobuf.Timestamp.encode(message.completion_time, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MsgUndelegateResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.MsgUndelegateResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.MsgUndelegateResponse + * @static + * @param {cosmos.staking.v1beta1.IMsgUndelegateResponse} message MsgUndelegateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgUndelegateResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgUndelegateResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.MsgUndelegateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.MsgUndelegateResponse} MsgUndelegateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgUndelegateResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.MsgUndelegateResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.completion_time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgUndelegateResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.MsgUndelegateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.MsgUndelegateResponse} MsgUndelegateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgUndelegateResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgUndelegateResponse message. + * @function verify + * @memberof cosmos.staking.v1beta1.MsgUndelegateResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgUndelegateResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.completion_time != null && message.hasOwnProperty("completion_time")) { + let error = $root.google.protobuf.Timestamp.verify(message.completion_time); + if (error) + return "completion_time." + error; + } + return null; + }; + + /** + * Creates a MsgUndelegateResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.MsgUndelegateResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.MsgUndelegateResponse} MsgUndelegateResponse + */ + MsgUndelegateResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.MsgUndelegateResponse) + return object; + let message = new $root.cosmos.staking.v1beta1.MsgUndelegateResponse(); + if (object.completion_time != null) { + if (typeof object.completion_time !== "object") + throw TypeError(".cosmos.staking.v1beta1.MsgUndelegateResponse.completion_time: object expected"); + message.completion_time = $root.google.protobuf.Timestamp.fromObject(object.completion_time); + } + return message; + }; + + /** + * Creates a plain object from a MsgUndelegateResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.MsgUndelegateResponse + * @static + * @param {cosmos.staking.v1beta1.MsgUndelegateResponse} message MsgUndelegateResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgUndelegateResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.completion_time = null; + if (message.completion_time != null && message.hasOwnProperty("completion_time")) + object.completion_time = $root.google.protobuf.Timestamp.toObject(message.completion_time, options); + return object; + }; + + /** + * Converts this MsgUndelegateResponse to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.MsgUndelegateResponse + * @instance + * @returns {Object.} JSON object + */ + MsgUndelegateResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgUndelegateResponse; + })(); + + v1beta1.Query = (function() { + + /** + * Constructs a new Query service. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a Query + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Query(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Query.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Query; + + /** + * Callback as used by {@link cosmos.staking.v1beta1.Query#validators}. + * @memberof cosmos.staking.v1beta1.Query + * @typedef ValidatorsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.staking.v1beta1.QueryValidatorsResponse} [response] QueryValidatorsResponse + */ + + /** + * Calls Validators. + * @function validators + * @memberof cosmos.staking.v1beta1.Query + * @instance + * @param {cosmos.staking.v1beta1.IQueryValidatorsRequest} request QueryValidatorsRequest message or plain object + * @param {cosmos.staking.v1beta1.Query.ValidatorsCallback} callback Node-style callback called with the error, if any, and QueryValidatorsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.validators = function validators(request, callback) { + return this.rpcCall(validators, $root.cosmos.staking.v1beta1.QueryValidatorsRequest, $root.cosmos.staking.v1beta1.QueryValidatorsResponse, request, callback); + }, "name", { value: "Validators" }); + + /** + * Calls Validators. + * @function validators + * @memberof cosmos.staking.v1beta1.Query + * @instance + * @param {cosmos.staking.v1beta1.IQueryValidatorsRequest} request QueryValidatorsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.staking.v1beta1.Query#validator}. + * @memberof cosmos.staking.v1beta1.Query + * @typedef ValidatorCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.staking.v1beta1.QueryValidatorResponse} [response] QueryValidatorResponse + */ + + /** + * Calls Validator. + * @function validator + * @memberof cosmos.staking.v1beta1.Query + * @instance + * @param {cosmos.staking.v1beta1.IQueryValidatorRequest} request QueryValidatorRequest message or plain object + * @param {cosmos.staking.v1beta1.Query.ValidatorCallback} callback Node-style callback called with the error, if any, and QueryValidatorResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.validator = function validator(request, callback) { + return this.rpcCall(validator, $root.cosmos.staking.v1beta1.QueryValidatorRequest, $root.cosmos.staking.v1beta1.QueryValidatorResponse, request, callback); + }, "name", { value: "Validator" }); + + /** + * Calls Validator. + * @function validator + * @memberof cosmos.staking.v1beta1.Query + * @instance + * @param {cosmos.staking.v1beta1.IQueryValidatorRequest} request QueryValidatorRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.staking.v1beta1.Query#validatorDelegations}. + * @memberof cosmos.staking.v1beta1.Query + * @typedef ValidatorDelegationsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.staking.v1beta1.QueryValidatorDelegationsResponse} [response] QueryValidatorDelegationsResponse + */ + + /** + * Calls ValidatorDelegations. + * @function validatorDelegations + * @memberof cosmos.staking.v1beta1.Query + * @instance + * @param {cosmos.staking.v1beta1.IQueryValidatorDelegationsRequest} request QueryValidatorDelegationsRequest message or plain object + * @param {cosmos.staking.v1beta1.Query.ValidatorDelegationsCallback} callback Node-style callback called with the error, if any, and QueryValidatorDelegationsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.validatorDelegations = function validatorDelegations(request, callback) { + return this.rpcCall(validatorDelegations, $root.cosmos.staking.v1beta1.QueryValidatorDelegationsRequest, $root.cosmos.staking.v1beta1.QueryValidatorDelegationsResponse, request, callback); + }, "name", { value: "ValidatorDelegations" }); + + /** + * Calls ValidatorDelegations. + * @function validatorDelegations + * @memberof cosmos.staking.v1beta1.Query + * @instance + * @param {cosmos.staking.v1beta1.IQueryValidatorDelegationsRequest} request QueryValidatorDelegationsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.staking.v1beta1.Query#validatorUnbondingDelegations}. + * @memberof cosmos.staking.v1beta1.Query + * @typedef ValidatorUnbondingDelegationsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse} [response] QueryValidatorUnbondingDelegationsResponse + */ + + /** + * Calls ValidatorUnbondingDelegations. + * @function validatorUnbondingDelegations + * @memberof cosmos.staking.v1beta1.Query + * @instance + * @param {cosmos.staking.v1beta1.IQueryValidatorUnbondingDelegationsRequest} request QueryValidatorUnbondingDelegationsRequest message or plain object + * @param {cosmos.staking.v1beta1.Query.ValidatorUnbondingDelegationsCallback} callback Node-style callback called with the error, if any, and QueryValidatorUnbondingDelegationsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.validatorUnbondingDelegations = function validatorUnbondingDelegations(request, callback) { + return this.rpcCall(validatorUnbondingDelegations, $root.cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest, $root.cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse, request, callback); + }, "name", { value: "ValidatorUnbondingDelegations" }); + + /** + * Calls ValidatorUnbondingDelegations. + * @function validatorUnbondingDelegations + * @memberof cosmos.staking.v1beta1.Query + * @instance + * @param {cosmos.staking.v1beta1.IQueryValidatorUnbondingDelegationsRequest} request QueryValidatorUnbondingDelegationsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.staking.v1beta1.Query#delegation}. + * @memberof cosmos.staking.v1beta1.Query + * @typedef DelegationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.staking.v1beta1.QueryDelegationResponse} [response] QueryDelegationResponse + */ + + /** + * Calls Delegation. + * @function delegation + * @memberof cosmos.staking.v1beta1.Query + * @instance + * @param {cosmos.staking.v1beta1.IQueryDelegationRequest} request QueryDelegationRequest message or plain object + * @param {cosmos.staking.v1beta1.Query.DelegationCallback} callback Node-style callback called with the error, if any, and QueryDelegationResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.delegation = function delegation(request, callback) { + return this.rpcCall(delegation, $root.cosmos.staking.v1beta1.QueryDelegationRequest, $root.cosmos.staking.v1beta1.QueryDelegationResponse, request, callback); + }, "name", { value: "Delegation" }); + + /** + * Calls Delegation. + * @function delegation + * @memberof cosmos.staking.v1beta1.Query + * @instance + * @param {cosmos.staking.v1beta1.IQueryDelegationRequest} request QueryDelegationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.staking.v1beta1.Query#unbondingDelegation}. + * @memberof cosmos.staking.v1beta1.Query + * @typedef UnbondingDelegationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.staking.v1beta1.QueryUnbondingDelegationResponse} [response] QueryUnbondingDelegationResponse + */ + + /** + * Calls UnbondingDelegation. + * @function unbondingDelegation + * @memberof cosmos.staking.v1beta1.Query + * @instance + * @param {cosmos.staking.v1beta1.IQueryUnbondingDelegationRequest} request QueryUnbondingDelegationRequest message or plain object + * @param {cosmos.staking.v1beta1.Query.UnbondingDelegationCallback} callback Node-style callback called with the error, if any, and QueryUnbondingDelegationResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.unbondingDelegation = function unbondingDelegation(request, callback) { + return this.rpcCall(unbondingDelegation, $root.cosmos.staking.v1beta1.QueryUnbondingDelegationRequest, $root.cosmos.staking.v1beta1.QueryUnbondingDelegationResponse, request, callback); + }, "name", { value: "UnbondingDelegation" }); + + /** + * Calls UnbondingDelegation. + * @function unbondingDelegation + * @memberof cosmos.staking.v1beta1.Query + * @instance + * @param {cosmos.staking.v1beta1.IQueryUnbondingDelegationRequest} request QueryUnbondingDelegationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.staking.v1beta1.Query#delegatorDelegations}. + * @memberof cosmos.staking.v1beta1.Query + * @typedef DelegatorDelegationsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse} [response] QueryDelegatorDelegationsResponse + */ + + /** + * Calls DelegatorDelegations. + * @function delegatorDelegations + * @memberof cosmos.staking.v1beta1.Query + * @instance + * @param {cosmos.staking.v1beta1.IQueryDelegatorDelegationsRequest} request QueryDelegatorDelegationsRequest message or plain object + * @param {cosmos.staking.v1beta1.Query.DelegatorDelegationsCallback} callback Node-style callback called with the error, if any, and QueryDelegatorDelegationsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.delegatorDelegations = function delegatorDelegations(request, callback) { + return this.rpcCall(delegatorDelegations, $root.cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest, $root.cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse, request, callback); + }, "name", { value: "DelegatorDelegations" }); + + /** + * Calls DelegatorDelegations. + * @function delegatorDelegations + * @memberof cosmos.staking.v1beta1.Query + * @instance + * @param {cosmos.staking.v1beta1.IQueryDelegatorDelegationsRequest} request QueryDelegatorDelegationsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.staking.v1beta1.Query#delegatorUnbondingDelegations}. + * @memberof cosmos.staking.v1beta1.Query + * @typedef DelegatorUnbondingDelegationsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse} [response] QueryDelegatorUnbondingDelegationsResponse + */ + + /** + * Calls DelegatorUnbondingDelegations. + * @function delegatorUnbondingDelegations + * @memberof cosmos.staking.v1beta1.Query + * @instance + * @param {cosmos.staking.v1beta1.IQueryDelegatorUnbondingDelegationsRequest} request QueryDelegatorUnbondingDelegationsRequest message or plain object + * @param {cosmos.staking.v1beta1.Query.DelegatorUnbondingDelegationsCallback} callback Node-style callback called with the error, if any, and QueryDelegatorUnbondingDelegationsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.delegatorUnbondingDelegations = function delegatorUnbondingDelegations(request, callback) { + return this.rpcCall(delegatorUnbondingDelegations, $root.cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest, $root.cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse, request, callback); + }, "name", { value: "DelegatorUnbondingDelegations" }); + + /** + * Calls DelegatorUnbondingDelegations. + * @function delegatorUnbondingDelegations + * @memberof cosmos.staking.v1beta1.Query + * @instance + * @param {cosmos.staking.v1beta1.IQueryDelegatorUnbondingDelegationsRequest} request QueryDelegatorUnbondingDelegationsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.staking.v1beta1.Query#redelegations}. + * @memberof cosmos.staking.v1beta1.Query + * @typedef RedelegationsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.staking.v1beta1.QueryRedelegationsResponse} [response] QueryRedelegationsResponse + */ + + /** + * Calls Redelegations. + * @function redelegations + * @memberof cosmos.staking.v1beta1.Query + * @instance + * @param {cosmos.staking.v1beta1.IQueryRedelegationsRequest} request QueryRedelegationsRequest message or plain object + * @param {cosmos.staking.v1beta1.Query.RedelegationsCallback} callback Node-style callback called with the error, if any, and QueryRedelegationsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.redelegations = function redelegations(request, callback) { + return this.rpcCall(redelegations, $root.cosmos.staking.v1beta1.QueryRedelegationsRequest, $root.cosmos.staking.v1beta1.QueryRedelegationsResponse, request, callback); + }, "name", { value: "Redelegations" }); + + /** + * Calls Redelegations. + * @function redelegations + * @memberof cosmos.staking.v1beta1.Query + * @instance + * @param {cosmos.staking.v1beta1.IQueryRedelegationsRequest} request QueryRedelegationsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.staking.v1beta1.Query#delegatorValidators}. + * @memberof cosmos.staking.v1beta1.Query + * @typedef DelegatorValidatorsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse} [response] QueryDelegatorValidatorsResponse + */ + + /** + * Calls DelegatorValidators. + * @function delegatorValidators + * @memberof cosmos.staking.v1beta1.Query + * @instance + * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorsRequest} request QueryDelegatorValidatorsRequest message or plain object + * @param {cosmos.staking.v1beta1.Query.DelegatorValidatorsCallback} callback Node-style callback called with the error, if any, and QueryDelegatorValidatorsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.delegatorValidators = function delegatorValidators(request, callback) { + return this.rpcCall(delegatorValidators, $root.cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest, $root.cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse, request, callback); + }, "name", { value: "DelegatorValidators" }); + + /** + * Calls DelegatorValidators. + * @function delegatorValidators + * @memberof cosmos.staking.v1beta1.Query + * @instance + * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorsRequest} request QueryDelegatorValidatorsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.staking.v1beta1.Query#delegatorValidator}. + * @memberof cosmos.staking.v1beta1.Query + * @typedef DelegatorValidatorCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.staking.v1beta1.QueryDelegatorValidatorResponse} [response] QueryDelegatorValidatorResponse + */ + + /** + * Calls DelegatorValidator. + * @function delegatorValidator + * @memberof cosmos.staking.v1beta1.Query + * @instance + * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorRequest} request QueryDelegatorValidatorRequest message or plain object + * @param {cosmos.staking.v1beta1.Query.DelegatorValidatorCallback} callback Node-style callback called with the error, if any, and QueryDelegatorValidatorResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.delegatorValidator = function delegatorValidator(request, callback) { + return this.rpcCall(delegatorValidator, $root.cosmos.staking.v1beta1.QueryDelegatorValidatorRequest, $root.cosmos.staking.v1beta1.QueryDelegatorValidatorResponse, request, callback); + }, "name", { value: "DelegatorValidator" }); + + /** + * Calls DelegatorValidator. + * @function delegatorValidator + * @memberof cosmos.staking.v1beta1.Query + * @instance + * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorRequest} request QueryDelegatorValidatorRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.staking.v1beta1.Query#historicalInfo}. + * @memberof cosmos.staking.v1beta1.Query + * @typedef HistoricalInfoCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.staking.v1beta1.QueryHistoricalInfoResponse} [response] QueryHistoricalInfoResponse + */ + + /** + * Calls HistoricalInfo. + * @function historicalInfo + * @memberof cosmos.staking.v1beta1.Query + * @instance + * @param {cosmos.staking.v1beta1.IQueryHistoricalInfoRequest} request QueryHistoricalInfoRequest message or plain object + * @param {cosmos.staking.v1beta1.Query.HistoricalInfoCallback} callback Node-style callback called with the error, if any, and QueryHistoricalInfoResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.historicalInfo = function historicalInfo(request, callback) { + return this.rpcCall(historicalInfo, $root.cosmos.staking.v1beta1.QueryHistoricalInfoRequest, $root.cosmos.staking.v1beta1.QueryHistoricalInfoResponse, request, callback); + }, "name", { value: "HistoricalInfo" }); + + /** + * Calls HistoricalInfo. + * @function historicalInfo + * @memberof cosmos.staking.v1beta1.Query + * @instance + * @param {cosmos.staking.v1beta1.IQueryHistoricalInfoRequest} request QueryHistoricalInfoRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.staking.v1beta1.Query#pool}. + * @memberof cosmos.staking.v1beta1.Query + * @typedef PoolCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.staking.v1beta1.QueryPoolResponse} [response] QueryPoolResponse + */ + + /** + * Calls Pool. + * @function pool + * @memberof cosmos.staking.v1beta1.Query + * @instance + * @param {cosmos.staking.v1beta1.IQueryPoolRequest} request QueryPoolRequest message or plain object + * @param {cosmos.staking.v1beta1.Query.PoolCallback} callback Node-style callback called with the error, if any, and QueryPoolResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.pool = function pool(request, callback) { + return this.rpcCall(pool, $root.cosmos.staking.v1beta1.QueryPoolRequest, $root.cosmos.staking.v1beta1.QueryPoolResponse, request, callback); + }, "name", { value: "Pool" }); + + /** + * Calls Pool. + * @function pool + * @memberof cosmos.staking.v1beta1.Query + * @instance + * @param {cosmos.staking.v1beta1.IQueryPoolRequest} request QueryPoolRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.staking.v1beta1.Query#params}. + * @memberof cosmos.staking.v1beta1.Query + * @typedef ParamsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.staking.v1beta1.QueryParamsResponse} [response] QueryParamsResponse + */ + + /** + * Calls Params. + * @function params + * @memberof cosmos.staking.v1beta1.Query + * @instance + * @param {cosmos.staking.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object + * @param {cosmos.staking.v1beta1.Query.ParamsCallback} callback Node-style callback called with the error, if any, and QueryParamsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.params = function params(request, callback) { + return this.rpcCall(params, $root.cosmos.staking.v1beta1.QueryParamsRequest, $root.cosmos.staking.v1beta1.QueryParamsResponse, request, callback); + }, "name", { value: "Params" }); + + /** + * Calls Params. + * @function params + * @memberof cosmos.staking.v1beta1.Query + * @instance + * @param {cosmos.staking.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Query; + })(); + + v1beta1.QueryValidatorsRequest = (function() { + + /** + * Properties of a QueryValidatorsRequest. + * @memberof cosmos.staking.v1beta1 + * @interface IQueryValidatorsRequest + * @property {string|null} [status] QueryValidatorsRequest status + * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryValidatorsRequest pagination + */ + + /** + * Constructs a new QueryValidatorsRequest. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a QueryValidatorsRequest. + * @implements IQueryValidatorsRequest + * @constructor + * @param {cosmos.staking.v1beta1.IQueryValidatorsRequest=} [properties] Properties to set + */ + function QueryValidatorsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryValidatorsRequest status. + * @member {string} status + * @memberof cosmos.staking.v1beta1.QueryValidatorsRequest + * @instance + */ + QueryValidatorsRequest.prototype.status = ""; + + /** + * QueryValidatorsRequest pagination. + * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination + * @memberof cosmos.staking.v1beta1.QueryValidatorsRequest + * @instance + */ + QueryValidatorsRequest.prototype.pagination = null; + + /** + * Encodes the specified QueryValidatorsRequest message. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorsRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.QueryValidatorsRequest + * @static + * @param {cosmos.staking.v1beta1.IQueryValidatorsRequest} message QueryValidatorsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryValidatorsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.status); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryValidatorsRequest message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.QueryValidatorsRequest + * @static + * @param {cosmos.staking.v1beta1.IQueryValidatorsRequest} message QueryValidatorsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryValidatorsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryValidatorsRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.QueryValidatorsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.QueryValidatorsRequest} QueryValidatorsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryValidatorsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryValidatorsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.status = reader.string(); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryValidatorsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.QueryValidatorsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.QueryValidatorsRequest} QueryValidatorsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryValidatorsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryValidatorsRequest message. + * @function verify + * @memberof cosmos.staking.v1beta1.QueryValidatorsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryValidatorsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.status != null && message.hasOwnProperty("status")) + if (!$util.isString(message.status)) + return "status: string expected"; + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryValidatorsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.QueryValidatorsRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.QueryValidatorsRequest} QueryValidatorsRequest + */ + QueryValidatorsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.QueryValidatorsRequest) + return object; + let message = new $root.cosmos.staking.v1beta1.QueryValidatorsRequest(); + if (object.status != null) + message.status = String(object.status); + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.staking.v1beta1.QueryValidatorsRequest.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryValidatorsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.QueryValidatorsRequest + * @static + * @param {cosmos.staking.v1beta1.QueryValidatorsRequest} message QueryValidatorsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryValidatorsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.status = ""; + object.pagination = null; + } + if (message.status != null && message.hasOwnProperty("status")) + object.status = message.status; + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryValidatorsRequest to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.QueryValidatorsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryValidatorsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryValidatorsRequest; + })(); + + v1beta1.QueryValidatorsResponse = (function() { + + /** + * Properties of a QueryValidatorsResponse. + * @memberof cosmos.staking.v1beta1 + * @interface IQueryValidatorsResponse + * @property {Array.|null} [validators] QueryValidatorsResponse validators + * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryValidatorsResponse pagination + */ + + /** + * Constructs a new QueryValidatorsResponse. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a QueryValidatorsResponse. + * @implements IQueryValidatorsResponse + * @constructor + * @param {cosmos.staking.v1beta1.IQueryValidatorsResponse=} [properties] Properties to set + */ + function QueryValidatorsResponse(properties) { + this.validators = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryValidatorsResponse validators. + * @member {Array.} validators + * @memberof cosmos.staking.v1beta1.QueryValidatorsResponse + * @instance + */ + QueryValidatorsResponse.prototype.validators = $util.emptyArray; + + /** + * QueryValidatorsResponse pagination. + * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination + * @memberof cosmos.staking.v1beta1.QueryValidatorsResponse + * @instance + */ + QueryValidatorsResponse.prototype.pagination = null; + + /** + * Encodes the specified QueryValidatorsResponse message. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorsResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.QueryValidatorsResponse + * @static + * @param {cosmos.staking.v1beta1.IQueryValidatorsResponse} message QueryValidatorsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryValidatorsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.validators != null && message.validators.length) + for (let i = 0; i < message.validators.length; ++i) + $root.cosmos.staking.v1beta1.Validator.encode(message.validators[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryValidatorsResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.QueryValidatorsResponse + * @static + * @param {cosmos.staking.v1beta1.IQueryValidatorsResponse} message QueryValidatorsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryValidatorsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryValidatorsResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.QueryValidatorsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.QueryValidatorsResponse} QueryValidatorsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryValidatorsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryValidatorsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.validators && message.validators.length)) + message.validators = []; + message.validators.push($root.cosmos.staking.v1beta1.Validator.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryValidatorsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.QueryValidatorsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.QueryValidatorsResponse} QueryValidatorsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryValidatorsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryValidatorsResponse message. + * @function verify + * @memberof cosmos.staking.v1beta1.QueryValidatorsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryValidatorsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.validators != null && message.hasOwnProperty("validators")) { + if (!Array.isArray(message.validators)) + return "validators: array expected"; + for (let i = 0; i < message.validators.length; ++i) { + let error = $root.cosmos.staking.v1beta1.Validator.verify(message.validators[i]); + if (error) + return "validators." + error; + } + } + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryValidatorsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.QueryValidatorsResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.QueryValidatorsResponse} QueryValidatorsResponse + */ + QueryValidatorsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.QueryValidatorsResponse) + return object; + let message = new $root.cosmos.staking.v1beta1.QueryValidatorsResponse(); + if (object.validators) { + if (!Array.isArray(object.validators)) + throw TypeError(".cosmos.staking.v1beta1.QueryValidatorsResponse.validators: array expected"); + message.validators = []; + for (let i = 0; i < object.validators.length; ++i) { + if (typeof object.validators[i] !== "object") + throw TypeError(".cosmos.staking.v1beta1.QueryValidatorsResponse.validators: object expected"); + message.validators[i] = $root.cosmos.staking.v1beta1.Validator.fromObject(object.validators[i]); + } + } + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.staking.v1beta1.QueryValidatorsResponse.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryValidatorsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.QueryValidatorsResponse + * @static + * @param {cosmos.staking.v1beta1.QueryValidatorsResponse} message QueryValidatorsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryValidatorsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.validators = []; + if (options.defaults) + object.pagination = null; + if (message.validators && message.validators.length) { + object.validators = []; + for (let j = 0; j < message.validators.length; ++j) + object.validators[j] = $root.cosmos.staking.v1beta1.Validator.toObject(message.validators[j], options); + } + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryValidatorsResponse to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.QueryValidatorsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryValidatorsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryValidatorsResponse; + })(); + + v1beta1.QueryValidatorRequest = (function() { + + /** + * Properties of a QueryValidatorRequest. + * @memberof cosmos.staking.v1beta1 + * @interface IQueryValidatorRequest + * @property {string|null} [validator_addr] QueryValidatorRequest validator_addr + */ + + /** + * Constructs a new QueryValidatorRequest. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a QueryValidatorRequest. + * @implements IQueryValidatorRequest + * @constructor + * @param {cosmos.staking.v1beta1.IQueryValidatorRequest=} [properties] Properties to set + */ + function QueryValidatorRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryValidatorRequest validator_addr. + * @member {string} validator_addr + * @memberof cosmos.staking.v1beta1.QueryValidatorRequest + * @instance + */ + QueryValidatorRequest.prototype.validator_addr = ""; + + /** + * Encodes the specified QueryValidatorRequest message. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.QueryValidatorRequest + * @static + * @param {cosmos.staking.v1beta1.IQueryValidatorRequest} message QueryValidatorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryValidatorRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.validator_addr != null && Object.hasOwnProperty.call(message, "validator_addr")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.validator_addr); + return writer; + }; + + /** + * Encodes the specified QueryValidatorRequest message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.QueryValidatorRequest + * @static + * @param {cosmos.staking.v1beta1.IQueryValidatorRequest} message QueryValidatorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryValidatorRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryValidatorRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.QueryValidatorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.QueryValidatorRequest} QueryValidatorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryValidatorRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryValidatorRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_addr = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryValidatorRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.QueryValidatorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.QueryValidatorRequest} QueryValidatorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryValidatorRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryValidatorRequest message. + * @function verify + * @memberof cosmos.staking.v1beta1.QueryValidatorRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryValidatorRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.validator_addr != null && message.hasOwnProperty("validator_addr")) + if (!$util.isString(message.validator_addr)) + return "validator_addr: string expected"; + return null; + }; + + /** + * Creates a QueryValidatorRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.QueryValidatorRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.QueryValidatorRequest} QueryValidatorRequest + */ + QueryValidatorRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.QueryValidatorRequest) + return object; + let message = new $root.cosmos.staking.v1beta1.QueryValidatorRequest(); + if (object.validator_addr != null) + message.validator_addr = String(object.validator_addr); + return message; + }; + + /** + * Creates a plain object from a QueryValidatorRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.QueryValidatorRequest + * @static + * @param {cosmos.staking.v1beta1.QueryValidatorRequest} message QueryValidatorRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryValidatorRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.validator_addr = ""; + if (message.validator_addr != null && message.hasOwnProperty("validator_addr")) + object.validator_addr = message.validator_addr; + return object; + }; + + /** + * Converts this QueryValidatorRequest to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.QueryValidatorRequest + * @instance + * @returns {Object.} JSON object + */ + QueryValidatorRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryValidatorRequest; + })(); + + v1beta1.QueryValidatorResponse = (function() { + + /** + * Properties of a QueryValidatorResponse. + * @memberof cosmos.staking.v1beta1 + * @interface IQueryValidatorResponse + * @property {cosmos.staking.v1beta1.IValidator|null} [validator] QueryValidatorResponse validator + */ + + /** + * Constructs a new QueryValidatorResponse. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a QueryValidatorResponse. + * @implements IQueryValidatorResponse + * @constructor + * @param {cosmos.staking.v1beta1.IQueryValidatorResponse=} [properties] Properties to set + */ + function QueryValidatorResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryValidatorResponse validator. + * @member {cosmos.staking.v1beta1.IValidator|null|undefined} validator + * @memberof cosmos.staking.v1beta1.QueryValidatorResponse + * @instance + */ + QueryValidatorResponse.prototype.validator = null; + + /** + * Encodes the specified QueryValidatorResponse message. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.QueryValidatorResponse + * @static + * @param {cosmos.staking.v1beta1.IQueryValidatorResponse} message QueryValidatorResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryValidatorResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.validator != null && Object.hasOwnProperty.call(message, "validator")) + $root.cosmos.staking.v1beta1.Validator.encode(message.validator, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryValidatorResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.QueryValidatorResponse + * @static + * @param {cosmos.staking.v1beta1.IQueryValidatorResponse} message QueryValidatorResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryValidatorResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryValidatorResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.QueryValidatorResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.QueryValidatorResponse} QueryValidatorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryValidatorResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryValidatorResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator = $root.cosmos.staking.v1beta1.Validator.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryValidatorResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.QueryValidatorResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.QueryValidatorResponse} QueryValidatorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryValidatorResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryValidatorResponse message. + * @function verify + * @memberof cosmos.staking.v1beta1.QueryValidatorResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryValidatorResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.validator != null && message.hasOwnProperty("validator")) { + let error = $root.cosmos.staking.v1beta1.Validator.verify(message.validator); + if (error) + return "validator." + error; + } + return null; + }; + + /** + * Creates a QueryValidatorResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.QueryValidatorResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.QueryValidatorResponse} QueryValidatorResponse + */ + QueryValidatorResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.QueryValidatorResponse) + return object; + let message = new $root.cosmos.staking.v1beta1.QueryValidatorResponse(); + if (object.validator != null) { + if (typeof object.validator !== "object") + throw TypeError(".cosmos.staking.v1beta1.QueryValidatorResponse.validator: object expected"); + message.validator = $root.cosmos.staking.v1beta1.Validator.fromObject(object.validator); + } + return message; + }; + + /** + * Creates a plain object from a QueryValidatorResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.QueryValidatorResponse + * @static + * @param {cosmos.staking.v1beta1.QueryValidatorResponse} message QueryValidatorResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryValidatorResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.validator = null; + if (message.validator != null && message.hasOwnProperty("validator")) + object.validator = $root.cosmos.staking.v1beta1.Validator.toObject(message.validator, options); + return object; + }; + + /** + * Converts this QueryValidatorResponse to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.QueryValidatorResponse + * @instance + * @returns {Object.} JSON object + */ + QueryValidatorResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryValidatorResponse; + })(); + + v1beta1.QueryValidatorDelegationsRequest = (function() { + + /** + * Properties of a QueryValidatorDelegationsRequest. + * @memberof cosmos.staking.v1beta1 + * @interface IQueryValidatorDelegationsRequest + * @property {string|null} [validator_addr] QueryValidatorDelegationsRequest validator_addr + * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryValidatorDelegationsRequest pagination + */ + + /** + * Constructs a new QueryValidatorDelegationsRequest. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a QueryValidatorDelegationsRequest. + * @implements IQueryValidatorDelegationsRequest + * @constructor + * @param {cosmos.staking.v1beta1.IQueryValidatorDelegationsRequest=} [properties] Properties to set + */ + function QueryValidatorDelegationsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryValidatorDelegationsRequest validator_addr. + * @member {string} validator_addr + * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsRequest + * @instance + */ + QueryValidatorDelegationsRequest.prototype.validator_addr = ""; + + /** + * QueryValidatorDelegationsRequest pagination. + * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination + * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsRequest + * @instance + */ + QueryValidatorDelegationsRequest.prototype.pagination = null; + + /** + * Encodes the specified QueryValidatorDelegationsRequest message. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorDelegationsRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsRequest + * @static + * @param {cosmos.staking.v1beta1.IQueryValidatorDelegationsRequest} message QueryValidatorDelegationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryValidatorDelegationsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.validator_addr != null && Object.hasOwnProperty.call(message, "validator_addr")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.validator_addr); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryValidatorDelegationsRequest message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorDelegationsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsRequest + * @static + * @param {cosmos.staking.v1beta1.IQueryValidatorDelegationsRequest} message QueryValidatorDelegationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryValidatorDelegationsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryValidatorDelegationsRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.QueryValidatorDelegationsRequest} QueryValidatorDelegationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryValidatorDelegationsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryValidatorDelegationsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_addr = reader.string(); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryValidatorDelegationsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.QueryValidatorDelegationsRequest} QueryValidatorDelegationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryValidatorDelegationsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryValidatorDelegationsRequest message. + * @function verify + * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryValidatorDelegationsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.validator_addr != null && message.hasOwnProperty("validator_addr")) + if (!$util.isString(message.validator_addr)) + return "validator_addr: string expected"; + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryValidatorDelegationsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.QueryValidatorDelegationsRequest} QueryValidatorDelegationsRequest + */ + QueryValidatorDelegationsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.QueryValidatorDelegationsRequest) + return object; + let message = new $root.cosmos.staking.v1beta1.QueryValidatorDelegationsRequest(); + if (object.validator_addr != null) + message.validator_addr = String(object.validator_addr); + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.staking.v1beta1.QueryValidatorDelegationsRequest.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryValidatorDelegationsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsRequest + * @static + * @param {cosmos.staking.v1beta1.QueryValidatorDelegationsRequest} message QueryValidatorDelegationsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryValidatorDelegationsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.validator_addr = ""; + object.pagination = null; + } + if (message.validator_addr != null && message.hasOwnProperty("validator_addr")) + object.validator_addr = message.validator_addr; + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryValidatorDelegationsRequest to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryValidatorDelegationsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryValidatorDelegationsRequest; + })(); + + v1beta1.QueryValidatorDelegationsResponse = (function() { + + /** + * Properties of a QueryValidatorDelegationsResponse. + * @memberof cosmos.staking.v1beta1 + * @interface IQueryValidatorDelegationsResponse + * @property {Array.|null} [delegation_responses] QueryValidatorDelegationsResponse delegation_responses + * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryValidatorDelegationsResponse pagination + */ + + /** + * Constructs a new QueryValidatorDelegationsResponse. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a QueryValidatorDelegationsResponse. + * @implements IQueryValidatorDelegationsResponse + * @constructor + * @param {cosmos.staking.v1beta1.IQueryValidatorDelegationsResponse=} [properties] Properties to set + */ + function QueryValidatorDelegationsResponse(properties) { + this.delegation_responses = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryValidatorDelegationsResponse delegation_responses. + * @member {Array.} delegation_responses + * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsResponse + * @instance + */ + QueryValidatorDelegationsResponse.prototype.delegation_responses = $util.emptyArray; + + /** + * QueryValidatorDelegationsResponse pagination. + * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination + * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsResponse + * @instance + */ + QueryValidatorDelegationsResponse.prototype.pagination = null; + + /** + * Encodes the specified QueryValidatorDelegationsResponse message. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorDelegationsResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsResponse + * @static + * @param {cosmos.staking.v1beta1.IQueryValidatorDelegationsResponse} message QueryValidatorDelegationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryValidatorDelegationsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.delegation_responses != null && message.delegation_responses.length) + for (let i = 0; i < message.delegation_responses.length; ++i) + $root.cosmos.staking.v1beta1.DelegationResponse.encode(message.delegation_responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryValidatorDelegationsResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorDelegationsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsResponse + * @static + * @param {cosmos.staking.v1beta1.IQueryValidatorDelegationsResponse} message QueryValidatorDelegationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryValidatorDelegationsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryValidatorDelegationsResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.QueryValidatorDelegationsResponse} QueryValidatorDelegationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryValidatorDelegationsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryValidatorDelegationsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.delegation_responses && message.delegation_responses.length)) + message.delegation_responses = []; + message.delegation_responses.push($root.cosmos.staking.v1beta1.DelegationResponse.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryValidatorDelegationsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.QueryValidatorDelegationsResponse} QueryValidatorDelegationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryValidatorDelegationsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryValidatorDelegationsResponse message. + * @function verify + * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryValidatorDelegationsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.delegation_responses != null && message.hasOwnProperty("delegation_responses")) { + if (!Array.isArray(message.delegation_responses)) + return "delegation_responses: array expected"; + for (let i = 0; i < message.delegation_responses.length; ++i) { + let error = $root.cosmos.staking.v1beta1.DelegationResponse.verify(message.delegation_responses[i]); + if (error) + return "delegation_responses." + error; + } + } + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryValidatorDelegationsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.QueryValidatorDelegationsResponse} QueryValidatorDelegationsResponse + */ + QueryValidatorDelegationsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.QueryValidatorDelegationsResponse) + return object; + let message = new $root.cosmos.staking.v1beta1.QueryValidatorDelegationsResponse(); + if (object.delegation_responses) { + if (!Array.isArray(object.delegation_responses)) + throw TypeError(".cosmos.staking.v1beta1.QueryValidatorDelegationsResponse.delegation_responses: array expected"); + message.delegation_responses = []; + for (let i = 0; i < object.delegation_responses.length; ++i) { + if (typeof object.delegation_responses[i] !== "object") + throw TypeError(".cosmos.staking.v1beta1.QueryValidatorDelegationsResponse.delegation_responses: object expected"); + message.delegation_responses[i] = $root.cosmos.staking.v1beta1.DelegationResponse.fromObject(object.delegation_responses[i]); + } + } + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.staking.v1beta1.QueryValidatorDelegationsResponse.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryValidatorDelegationsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsResponse + * @static + * @param {cosmos.staking.v1beta1.QueryValidatorDelegationsResponse} message QueryValidatorDelegationsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryValidatorDelegationsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.delegation_responses = []; + if (options.defaults) + object.pagination = null; + if (message.delegation_responses && message.delegation_responses.length) { + object.delegation_responses = []; + for (let j = 0; j < message.delegation_responses.length; ++j) + object.delegation_responses[j] = $root.cosmos.staking.v1beta1.DelegationResponse.toObject(message.delegation_responses[j], options); + } + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryValidatorDelegationsResponse to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryValidatorDelegationsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryValidatorDelegationsResponse; + })(); + + v1beta1.QueryValidatorUnbondingDelegationsRequest = (function() { + + /** + * Properties of a QueryValidatorUnbondingDelegationsRequest. + * @memberof cosmos.staking.v1beta1 + * @interface IQueryValidatorUnbondingDelegationsRequest + * @property {string|null} [validator_addr] QueryValidatorUnbondingDelegationsRequest validator_addr + * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryValidatorUnbondingDelegationsRequest pagination + */ + + /** + * Constructs a new QueryValidatorUnbondingDelegationsRequest. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a QueryValidatorUnbondingDelegationsRequest. + * @implements IQueryValidatorUnbondingDelegationsRequest + * @constructor + * @param {cosmos.staking.v1beta1.IQueryValidatorUnbondingDelegationsRequest=} [properties] Properties to set + */ + function QueryValidatorUnbondingDelegationsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryValidatorUnbondingDelegationsRequest validator_addr. + * @member {string} validator_addr + * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest + * @instance + */ + QueryValidatorUnbondingDelegationsRequest.prototype.validator_addr = ""; + + /** + * QueryValidatorUnbondingDelegationsRequest pagination. + * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination + * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest + * @instance + */ + QueryValidatorUnbondingDelegationsRequest.prototype.pagination = null; + + /** + * Encodes the specified QueryValidatorUnbondingDelegationsRequest message. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest + * @static + * @param {cosmos.staking.v1beta1.IQueryValidatorUnbondingDelegationsRequest} message QueryValidatorUnbondingDelegationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryValidatorUnbondingDelegationsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.validator_addr != null && Object.hasOwnProperty.call(message, "validator_addr")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.validator_addr); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryValidatorUnbondingDelegationsRequest message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest + * @static + * @param {cosmos.staking.v1beta1.IQueryValidatorUnbondingDelegationsRequest} message QueryValidatorUnbondingDelegationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryValidatorUnbondingDelegationsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryValidatorUnbondingDelegationsRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest} QueryValidatorUnbondingDelegationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryValidatorUnbondingDelegationsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator_addr = reader.string(); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryValidatorUnbondingDelegationsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest} QueryValidatorUnbondingDelegationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryValidatorUnbondingDelegationsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryValidatorUnbondingDelegationsRequest message. + * @function verify + * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryValidatorUnbondingDelegationsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.validator_addr != null && message.hasOwnProperty("validator_addr")) + if (!$util.isString(message.validator_addr)) + return "validator_addr: string expected"; + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryValidatorUnbondingDelegationsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest} QueryValidatorUnbondingDelegationsRequest + */ + QueryValidatorUnbondingDelegationsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest) + return object; + let message = new $root.cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest(); + if (object.validator_addr != null) + message.validator_addr = String(object.validator_addr); + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryValidatorUnbondingDelegationsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest + * @static + * @param {cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest} message QueryValidatorUnbondingDelegationsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryValidatorUnbondingDelegationsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.validator_addr = ""; + object.pagination = null; + } + if (message.validator_addr != null && message.hasOwnProperty("validator_addr")) + object.validator_addr = message.validator_addr; + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryValidatorUnbondingDelegationsRequest to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryValidatorUnbondingDelegationsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryValidatorUnbondingDelegationsRequest; + })(); + + v1beta1.QueryValidatorUnbondingDelegationsResponse = (function() { + + /** + * Properties of a QueryValidatorUnbondingDelegationsResponse. + * @memberof cosmos.staking.v1beta1 + * @interface IQueryValidatorUnbondingDelegationsResponse + * @property {Array.|null} [unbonding_responses] QueryValidatorUnbondingDelegationsResponse unbonding_responses + * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryValidatorUnbondingDelegationsResponse pagination + */ + + /** + * Constructs a new QueryValidatorUnbondingDelegationsResponse. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a QueryValidatorUnbondingDelegationsResponse. + * @implements IQueryValidatorUnbondingDelegationsResponse + * @constructor + * @param {cosmos.staking.v1beta1.IQueryValidatorUnbondingDelegationsResponse=} [properties] Properties to set + */ + function QueryValidatorUnbondingDelegationsResponse(properties) { + this.unbonding_responses = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryValidatorUnbondingDelegationsResponse unbonding_responses. + * @member {Array.} unbonding_responses + * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse + * @instance + */ + QueryValidatorUnbondingDelegationsResponse.prototype.unbonding_responses = $util.emptyArray; + + /** + * QueryValidatorUnbondingDelegationsResponse pagination. + * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination + * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse + * @instance + */ + QueryValidatorUnbondingDelegationsResponse.prototype.pagination = null; + + /** + * Encodes the specified QueryValidatorUnbondingDelegationsResponse message. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse + * @static + * @param {cosmos.staking.v1beta1.IQueryValidatorUnbondingDelegationsResponse} message QueryValidatorUnbondingDelegationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryValidatorUnbondingDelegationsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.unbonding_responses != null && message.unbonding_responses.length) + for (let i = 0; i < message.unbonding_responses.length; ++i) + $root.cosmos.staking.v1beta1.UnbondingDelegation.encode(message.unbonding_responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryValidatorUnbondingDelegationsResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse + * @static + * @param {cosmos.staking.v1beta1.IQueryValidatorUnbondingDelegationsResponse} message QueryValidatorUnbondingDelegationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryValidatorUnbondingDelegationsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryValidatorUnbondingDelegationsResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse} QueryValidatorUnbondingDelegationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryValidatorUnbondingDelegationsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.unbonding_responses && message.unbonding_responses.length)) + message.unbonding_responses = []; + message.unbonding_responses.push($root.cosmos.staking.v1beta1.UnbondingDelegation.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryValidatorUnbondingDelegationsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse} QueryValidatorUnbondingDelegationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryValidatorUnbondingDelegationsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryValidatorUnbondingDelegationsResponse message. + * @function verify + * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryValidatorUnbondingDelegationsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.unbonding_responses != null && message.hasOwnProperty("unbonding_responses")) { + if (!Array.isArray(message.unbonding_responses)) + return "unbonding_responses: array expected"; + for (let i = 0; i < message.unbonding_responses.length; ++i) { + let error = $root.cosmos.staking.v1beta1.UnbondingDelegation.verify(message.unbonding_responses[i]); + if (error) + return "unbonding_responses." + error; + } + } + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryValidatorUnbondingDelegationsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse} QueryValidatorUnbondingDelegationsResponse + */ + QueryValidatorUnbondingDelegationsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse) + return object; + let message = new $root.cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse(); + if (object.unbonding_responses) { + if (!Array.isArray(object.unbonding_responses)) + throw TypeError(".cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse.unbonding_responses: array expected"); + message.unbonding_responses = []; + for (let i = 0; i < object.unbonding_responses.length; ++i) { + if (typeof object.unbonding_responses[i] !== "object") + throw TypeError(".cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse.unbonding_responses: object expected"); + message.unbonding_responses[i] = $root.cosmos.staking.v1beta1.UnbondingDelegation.fromObject(object.unbonding_responses[i]); + } + } + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryValidatorUnbondingDelegationsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse + * @static + * @param {cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse} message QueryValidatorUnbondingDelegationsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryValidatorUnbondingDelegationsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.unbonding_responses = []; + if (options.defaults) + object.pagination = null; + if (message.unbonding_responses && message.unbonding_responses.length) { + object.unbonding_responses = []; + for (let j = 0; j < message.unbonding_responses.length; ++j) + object.unbonding_responses[j] = $root.cosmos.staking.v1beta1.UnbondingDelegation.toObject(message.unbonding_responses[j], options); + } + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryValidatorUnbondingDelegationsResponse to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryValidatorUnbondingDelegationsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryValidatorUnbondingDelegationsResponse; + })(); + + v1beta1.QueryDelegationRequest = (function() { + + /** + * Properties of a QueryDelegationRequest. + * @memberof cosmos.staking.v1beta1 + * @interface IQueryDelegationRequest + * @property {string|null} [delegator_addr] QueryDelegationRequest delegator_addr + * @property {string|null} [validator_addr] QueryDelegationRequest validator_addr + */ + + /** + * Constructs a new QueryDelegationRequest. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a QueryDelegationRequest. + * @implements IQueryDelegationRequest + * @constructor + * @param {cosmos.staking.v1beta1.IQueryDelegationRequest=} [properties] Properties to set + */ + function QueryDelegationRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryDelegationRequest delegator_addr. + * @member {string} delegator_addr + * @memberof cosmos.staking.v1beta1.QueryDelegationRequest + * @instance + */ + QueryDelegationRequest.prototype.delegator_addr = ""; + + /** + * QueryDelegationRequest validator_addr. + * @member {string} validator_addr + * @memberof cosmos.staking.v1beta1.QueryDelegationRequest + * @instance + */ + QueryDelegationRequest.prototype.validator_addr = ""; + + /** + * Encodes the specified QueryDelegationRequest message. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegationRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.QueryDelegationRequest + * @static + * @param {cosmos.staking.v1beta1.IQueryDelegationRequest} message QueryDelegationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegationRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.delegator_addr != null && Object.hasOwnProperty.call(message, "delegator_addr")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_addr); + if (message.validator_addr != null && Object.hasOwnProperty.call(message, "validator_addr")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.validator_addr); + return writer; + }; + + /** + * Encodes the specified QueryDelegationRequest message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.QueryDelegationRequest + * @static + * @param {cosmos.staking.v1beta1.IQueryDelegationRequest} message QueryDelegationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryDelegationRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.QueryDelegationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.QueryDelegationRequest} QueryDelegationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegationRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryDelegationRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_addr = reader.string(); + break; + case 2: + message.validator_addr = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryDelegationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.QueryDelegationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.QueryDelegationRequest} QueryDelegationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryDelegationRequest message. + * @function verify + * @memberof cosmos.staking.v1beta1.QueryDelegationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryDelegationRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.delegator_addr != null && message.hasOwnProperty("delegator_addr")) + if (!$util.isString(message.delegator_addr)) + return "delegator_addr: string expected"; + if (message.validator_addr != null && message.hasOwnProperty("validator_addr")) + if (!$util.isString(message.validator_addr)) + return "validator_addr: string expected"; + return null; + }; + + /** + * Creates a QueryDelegationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.QueryDelegationRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.QueryDelegationRequest} QueryDelegationRequest + */ + QueryDelegationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.QueryDelegationRequest) + return object; + let message = new $root.cosmos.staking.v1beta1.QueryDelegationRequest(); + if (object.delegator_addr != null) + message.delegator_addr = String(object.delegator_addr); + if (object.validator_addr != null) + message.validator_addr = String(object.validator_addr); + return message; + }; + + /** + * Creates a plain object from a QueryDelegationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.QueryDelegationRequest + * @static + * @param {cosmos.staking.v1beta1.QueryDelegationRequest} message QueryDelegationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryDelegationRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.delegator_addr = ""; + object.validator_addr = ""; + } + if (message.delegator_addr != null && message.hasOwnProperty("delegator_addr")) + object.delegator_addr = message.delegator_addr; + if (message.validator_addr != null && message.hasOwnProperty("validator_addr")) + object.validator_addr = message.validator_addr; + return object; + }; + + /** + * Converts this QueryDelegationRequest to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.QueryDelegationRequest + * @instance + * @returns {Object.} JSON object + */ + QueryDelegationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryDelegationRequest; + })(); + + v1beta1.QueryDelegationResponse = (function() { + + /** + * Properties of a QueryDelegationResponse. + * @memberof cosmos.staking.v1beta1 + * @interface IQueryDelegationResponse + * @property {cosmos.staking.v1beta1.IDelegationResponse|null} [delegation_response] QueryDelegationResponse delegation_response + */ + + /** + * Constructs a new QueryDelegationResponse. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a QueryDelegationResponse. + * @implements IQueryDelegationResponse + * @constructor + * @param {cosmos.staking.v1beta1.IQueryDelegationResponse=} [properties] Properties to set + */ + function QueryDelegationResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryDelegationResponse delegation_response. + * @member {cosmos.staking.v1beta1.IDelegationResponse|null|undefined} delegation_response + * @memberof cosmos.staking.v1beta1.QueryDelegationResponse + * @instance + */ + QueryDelegationResponse.prototype.delegation_response = null; + + /** + * Encodes the specified QueryDelegationResponse message. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegationResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.QueryDelegationResponse + * @static + * @param {cosmos.staking.v1beta1.IQueryDelegationResponse} message QueryDelegationResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegationResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.delegation_response != null && Object.hasOwnProperty.call(message, "delegation_response")) + $root.cosmos.staking.v1beta1.DelegationResponse.encode(message.delegation_response, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryDelegationResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegationResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.QueryDelegationResponse + * @static + * @param {cosmos.staking.v1beta1.IQueryDelegationResponse} message QueryDelegationResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegationResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryDelegationResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.QueryDelegationResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.QueryDelegationResponse} QueryDelegationResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegationResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryDelegationResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegation_response = $root.cosmos.staking.v1beta1.DelegationResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryDelegationResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.QueryDelegationResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.QueryDelegationResponse} QueryDelegationResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegationResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryDelegationResponse message. + * @function verify + * @memberof cosmos.staking.v1beta1.QueryDelegationResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryDelegationResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.delegation_response != null && message.hasOwnProperty("delegation_response")) { + let error = $root.cosmos.staking.v1beta1.DelegationResponse.verify(message.delegation_response); + if (error) + return "delegation_response." + error; + } + return null; + }; + + /** + * Creates a QueryDelegationResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.QueryDelegationResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.QueryDelegationResponse} QueryDelegationResponse + */ + QueryDelegationResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.QueryDelegationResponse) + return object; + let message = new $root.cosmos.staking.v1beta1.QueryDelegationResponse(); + if (object.delegation_response != null) { + if (typeof object.delegation_response !== "object") + throw TypeError(".cosmos.staking.v1beta1.QueryDelegationResponse.delegation_response: object expected"); + message.delegation_response = $root.cosmos.staking.v1beta1.DelegationResponse.fromObject(object.delegation_response); + } + return message; + }; + + /** + * Creates a plain object from a QueryDelegationResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.QueryDelegationResponse + * @static + * @param {cosmos.staking.v1beta1.QueryDelegationResponse} message QueryDelegationResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryDelegationResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.delegation_response = null; + if (message.delegation_response != null && message.hasOwnProperty("delegation_response")) + object.delegation_response = $root.cosmos.staking.v1beta1.DelegationResponse.toObject(message.delegation_response, options); + return object; + }; + + /** + * Converts this QueryDelegationResponse to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.QueryDelegationResponse + * @instance + * @returns {Object.} JSON object + */ + QueryDelegationResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryDelegationResponse; + })(); + + v1beta1.QueryUnbondingDelegationRequest = (function() { + + /** + * Properties of a QueryUnbondingDelegationRequest. + * @memberof cosmos.staking.v1beta1 + * @interface IQueryUnbondingDelegationRequest + * @property {string|null} [delegator_addr] QueryUnbondingDelegationRequest delegator_addr + * @property {string|null} [validator_addr] QueryUnbondingDelegationRequest validator_addr + */ + + /** + * Constructs a new QueryUnbondingDelegationRequest. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a QueryUnbondingDelegationRequest. + * @implements IQueryUnbondingDelegationRequest + * @constructor + * @param {cosmos.staking.v1beta1.IQueryUnbondingDelegationRequest=} [properties] Properties to set + */ + function QueryUnbondingDelegationRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryUnbondingDelegationRequest delegator_addr. + * @member {string} delegator_addr + * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationRequest + * @instance + */ + QueryUnbondingDelegationRequest.prototype.delegator_addr = ""; + + /** + * QueryUnbondingDelegationRequest validator_addr. + * @member {string} validator_addr + * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationRequest + * @instance + */ + QueryUnbondingDelegationRequest.prototype.validator_addr = ""; + + /** + * Encodes the specified QueryUnbondingDelegationRequest message. Does not implicitly {@link cosmos.staking.v1beta1.QueryUnbondingDelegationRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationRequest + * @static + * @param {cosmos.staking.v1beta1.IQueryUnbondingDelegationRequest} message QueryUnbondingDelegationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryUnbondingDelegationRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.delegator_addr != null && Object.hasOwnProperty.call(message, "delegator_addr")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_addr); + if (message.validator_addr != null && Object.hasOwnProperty.call(message, "validator_addr")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.validator_addr); + return writer; + }; + + /** + * Encodes the specified QueryUnbondingDelegationRequest message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryUnbondingDelegationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationRequest + * @static + * @param {cosmos.staking.v1beta1.IQueryUnbondingDelegationRequest} message QueryUnbondingDelegationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryUnbondingDelegationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryUnbondingDelegationRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.QueryUnbondingDelegationRequest} QueryUnbondingDelegationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryUnbondingDelegationRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryUnbondingDelegationRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_addr = reader.string(); + break; + case 2: + message.validator_addr = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryUnbondingDelegationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.QueryUnbondingDelegationRequest} QueryUnbondingDelegationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryUnbondingDelegationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryUnbondingDelegationRequest message. + * @function verify + * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryUnbondingDelegationRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.delegator_addr != null && message.hasOwnProperty("delegator_addr")) + if (!$util.isString(message.delegator_addr)) + return "delegator_addr: string expected"; + if (message.validator_addr != null && message.hasOwnProperty("validator_addr")) + if (!$util.isString(message.validator_addr)) + return "validator_addr: string expected"; + return null; + }; + + /** + * Creates a QueryUnbondingDelegationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.QueryUnbondingDelegationRequest} QueryUnbondingDelegationRequest + */ + QueryUnbondingDelegationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.QueryUnbondingDelegationRequest) + return object; + let message = new $root.cosmos.staking.v1beta1.QueryUnbondingDelegationRequest(); + if (object.delegator_addr != null) + message.delegator_addr = String(object.delegator_addr); + if (object.validator_addr != null) + message.validator_addr = String(object.validator_addr); + return message; + }; + + /** + * Creates a plain object from a QueryUnbondingDelegationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationRequest + * @static + * @param {cosmos.staking.v1beta1.QueryUnbondingDelegationRequest} message QueryUnbondingDelegationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryUnbondingDelegationRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.delegator_addr = ""; + object.validator_addr = ""; + } + if (message.delegator_addr != null && message.hasOwnProperty("delegator_addr")) + object.delegator_addr = message.delegator_addr; + if (message.validator_addr != null && message.hasOwnProperty("validator_addr")) + object.validator_addr = message.validator_addr; + return object; + }; + + /** + * Converts this QueryUnbondingDelegationRequest to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationRequest + * @instance + * @returns {Object.} JSON object + */ + QueryUnbondingDelegationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryUnbondingDelegationRequest; + })(); + + v1beta1.QueryUnbondingDelegationResponse = (function() { + + /** + * Properties of a QueryUnbondingDelegationResponse. + * @memberof cosmos.staking.v1beta1 + * @interface IQueryUnbondingDelegationResponse + * @property {cosmos.staking.v1beta1.IUnbondingDelegation|null} [unbond] QueryUnbondingDelegationResponse unbond + */ + + /** + * Constructs a new QueryUnbondingDelegationResponse. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a QueryUnbondingDelegationResponse. + * @implements IQueryUnbondingDelegationResponse + * @constructor + * @param {cosmos.staking.v1beta1.IQueryUnbondingDelegationResponse=} [properties] Properties to set + */ + function QueryUnbondingDelegationResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryUnbondingDelegationResponse unbond. + * @member {cosmos.staking.v1beta1.IUnbondingDelegation|null|undefined} unbond + * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationResponse + * @instance + */ + QueryUnbondingDelegationResponse.prototype.unbond = null; + + /** + * Encodes the specified QueryUnbondingDelegationResponse message. Does not implicitly {@link cosmos.staking.v1beta1.QueryUnbondingDelegationResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationResponse + * @static + * @param {cosmos.staking.v1beta1.IQueryUnbondingDelegationResponse} message QueryUnbondingDelegationResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryUnbondingDelegationResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.unbond != null && Object.hasOwnProperty.call(message, "unbond")) + $root.cosmos.staking.v1beta1.UnbondingDelegation.encode(message.unbond, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryUnbondingDelegationResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryUnbondingDelegationResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationResponse + * @static + * @param {cosmos.staking.v1beta1.IQueryUnbondingDelegationResponse} message QueryUnbondingDelegationResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryUnbondingDelegationResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryUnbondingDelegationResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.QueryUnbondingDelegationResponse} QueryUnbondingDelegationResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryUnbondingDelegationResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryUnbondingDelegationResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.unbond = $root.cosmos.staking.v1beta1.UnbondingDelegation.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryUnbondingDelegationResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.QueryUnbondingDelegationResponse} QueryUnbondingDelegationResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryUnbondingDelegationResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryUnbondingDelegationResponse message. + * @function verify + * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryUnbondingDelegationResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.unbond != null && message.hasOwnProperty("unbond")) { + let error = $root.cosmos.staking.v1beta1.UnbondingDelegation.verify(message.unbond); + if (error) + return "unbond." + error; + } + return null; + }; + + /** + * Creates a QueryUnbondingDelegationResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.QueryUnbondingDelegationResponse} QueryUnbondingDelegationResponse + */ + QueryUnbondingDelegationResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.QueryUnbondingDelegationResponse) + return object; + let message = new $root.cosmos.staking.v1beta1.QueryUnbondingDelegationResponse(); + if (object.unbond != null) { + if (typeof object.unbond !== "object") + throw TypeError(".cosmos.staking.v1beta1.QueryUnbondingDelegationResponse.unbond: object expected"); + message.unbond = $root.cosmos.staking.v1beta1.UnbondingDelegation.fromObject(object.unbond); + } + return message; + }; + + /** + * Creates a plain object from a QueryUnbondingDelegationResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationResponse + * @static + * @param {cosmos.staking.v1beta1.QueryUnbondingDelegationResponse} message QueryUnbondingDelegationResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryUnbondingDelegationResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.unbond = null; + if (message.unbond != null && message.hasOwnProperty("unbond")) + object.unbond = $root.cosmos.staking.v1beta1.UnbondingDelegation.toObject(message.unbond, options); + return object; + }; + + /** + * Converts this QueryUnbondingDelegationResponse to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationResponse + * @instance + * @returns {Object.} JSON object + */ + QueryUnbondingDelegationResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryUnbondingDelegationResponse; + })(); + + v1beta1.QueryDelegatorDelegationsRequest = (function() { + + /** + * Properties of a QueryDelegatorDelegationsRequest. + * @memberof cosmos.staking.v1beta1 + * @interface IQueryDelegatorDelegationsRequest + * @property {string|null} [delegator_addr] QueryDelegatorDelegationsRequest delegator_addr + * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryDelegatorDelegationsRequest pagination + */ + + /** + * Constructs a new QueryDelegatorDelegationsRequest. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a QueryDelegatorDelegationsRequest. + * @implements IQueryDelegatorDelegationsRequest + * @constructor + * @param {cosmos.staking.v1beta1.IQueryDelegatorDelegationsRequest=} [properties] Properties to set + */ + function QueryDelegatorDelegationsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryDelegatorDelegationsRequest delegator_addr. + * @member {string} delegator_addr + * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest + * @instance + */ + QueryDelegatorDelegationsRequest.prototype.delegator_addr = ""; + + /** + * QueryDelegatorDelegationsRequest pagination. + * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination + * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest + * @instance + */ + QueryDelegatorDelegationsRequest.prototype.pagination = null; + + /** + * Encodes the specified QueryDelegatorDelegationsRequest message. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest + * @static + * @param {cosmos.staking.v1beta1.IQueryDelegatorDelegationsRequest} message QueryDelegatorDelegationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegatorDelegationsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.delegator_addr != null && Object.hasOwnProperty.call(message, "delegator_addr")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_addr); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryDelegatorDelegationsRequest message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest + * @static + * @param {cosmos.staking.v1beta1.IQueryDelegatorDelegationsRequest} message QueryDelegatorDelegationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegatorDelegationsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryDelegatorDelegationsRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest} QueryDelegatorDelegationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegatorDelegationsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_addr = reader.string(); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryDelegatorDelegationsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest} QueryDelegatorDelegationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegatorDelegationsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryDelegatorDelegationsRequest message. + * @function verify + * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryDelegatorDelegationsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.delegator_addr != null && message.hasOwnProperty("delegator_addr")) + if (!$util.isString(message.delegator_addr)) + return "delegator_addr: string expected"; + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryDelegatorDelegationsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest} QueryDelegatorDelegationsRequest + */ + QueryDelegatorDelegationsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest) + return object; + let message = new $root.cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest(); + if (object.delegator_addr != null) + message.delegator_addr = String(object.delegator_addr); + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryDelegatorDelegationsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest + * @static + * @param {cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest} message QueryDelegatorDelegationsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryDelegatorDelegationsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.delegator_addr = ""; + object.pagination = null; + } + if (message.delegator_addr != null && message.hasOwnProperty("delegator_addr")) + object.delegator_addr = message.delegator_addr; + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryDelegatorDelegationsRequest to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryDelegatorDelegationsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryDelegatorDelegationsRequest; + })(); + + v1beta1.QueryDelegatorDelegationsResponse = (function() { + + /** + * Properties of a QueryDelegatorDelegationsResponse. + * @memberof cosmos.staking.v1beta1 + * @interface IQueryDelegatorDelegationsResponse + * @property {Array.|null} [delegation_responses] QueryDelegatorDelegationsResponse delegation_responses + * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryDelegatorDelegationsResponse pagination + */ + + /** + * Constructs a new QueryDelegatorDelegationsResponse. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a QueryDelegatorDelegationsResponse. + * @implements IQueryDelegatorDelegationsResponse + * @constructor + * @param {cosmos.staking.v1beta1.IQueryDelegatorDelegationsResponse=} [properties] Properties to set + */ + function QueryDelegatorDelegationsResponse(properties) { + this.delegation_responses = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryDelegatorDelegationsResponse delegation_responses. + * @member {Array.} delegation_responses + * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse + * @instance + */ + QueryDelegatorDelegationsResponse.prototype.delegation_responses = $util.emptyArray; + + /** + * QueryDelegatorDelegationsResponse pagination. + * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination + * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse + * @instance + */ + QueryDelegatorDelegationsResponse.prototype.pagination = null; + + /** + * Encodes the specified QueryDelegatorDelegationsResponse message. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse + * @static + * @param {cosmos.staking.v1beta1.IQueryDelegatorDelegationsResponse} message QueryDelegatorDelegationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegatorDelegationsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.delegation_responses != null && message.delegation_responses.length) + for (let i = 0; i < message.delegation_responses.length; ++i) + $root.cosmos.staking.v1beta1.DelegationResponse.encode(message.delegation_responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryDelegatorDelegationsResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse + * @static + * @param {cosmos.staking.v1beta1.IQueryDelegatorDelegationsResponse} message QueryDelegatorDelegationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegatorDelegationsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryDelegatorDelegationsResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse} QueryDelegatorDelegationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegatorDelegationsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.delegation_responses && message.delegation_responses.length)) + message.delegation_responses = []; + message.delegation_responses.push($root.cosmos.staking.v1beta1.DelegationResponse.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryDelegatorDelegationsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse} QueryDelegatorDelegationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegatorDelegationsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryDelegatorDelegationsResponse message. + * @function verify + * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryDelegatorDelegationsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.delegation_responses != null && message.hasOwnProperty("delegation_responses")) { + if (!Array.isArray(message.delegation_responses)) + return "delegation_responses: array expected"; + for (let i = 0; i < message.delegation_responses.length; ++i) { + let error = $root.cosmos.staking.v1beta1.DelegationResponse.verify(message.delegation_responses[i]); + if (error) + return "delegation_responses." + error; + } + } + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryDelegatorDelegationsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse} QueryDelegatorDelegationsResponse + */ + QueryDelegatorDelegationsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse) + return object; + let message = new $root.cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse(); + if (object.delegation_responses) { + if (!Array.isArray(object.delegation_responses)) + throw TypeError(".cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse.delegation_responses: array expected"); + message.delegation_responses = []; + for (let i = 0; i < object.delegation_responses.length; ++i) { + if (typeof object.delegation_responses[i] !== "object") + throw TypeError(".cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse.delegation_responses: object expected"); + message.delegation_responses[i] = $root.cosmos.staking.v1beta1.DelegationResponse.fromObject(object.delegation_responses[i]); + } + } + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryDelegatorDelegationsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse + * @static + * @param {cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse} message QueryDelegatorDelegationsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryDelegatorDelegationsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.delegation_responses = []; + if (options.defaults) + object.pagination = null; + if (message.delegation_responses && message.delegation_responses.length) { + object.delegation_responses = []; + for (let j = 0; j < message.delegation_responses.length; ++j) + object.delegation_responses[j] = $root.cosmos.staking.v1beta1.DelegationResponse.toObject(message.delegation_responses[j], options); + } + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryDelegatorDelegationsResponse to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryDelegatorDelegationsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryDelegatorDelegationsResponse; + })(); + + v1beta1.QueryDelegatorUnbondingDelegationsRequest = (function() { + + /** + * Properties of a QueryDelegatorUnbondingDelegationsRequest. + * @memberof cosmos.staking.v1beta1 + * @interface IQueryDelegatorUnbondingDelegationsRequest + * @property {string|null} [delegator_addr] QueryDelegatorUnbondingDelegationsRequest delegator_addr + * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryDelegatorUnbondingDelegationsRequest pagination + */ + + /** + * Constructs a new QueryDelegatorUnbondingDelegationsRequest. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a QueryDelegatorUnbondingDelegationsRequest. + * @implements IQueryDelegatorUnbondingDelegationsRequest + * @constructor + * @param {cosmos.staking.v1beta1.IQueryDelegatorUnbondingDelegationsRequest=} [properties] Properties to set + */ + function QueryDelegatorUnbondingDelegationsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryDelegatorUnbondingDelegationsRequest delegator_addr. + * @member {string} delegator_addr + * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest + * @instance + */ + QueryDelegatorUnbondingDelegationsRequest.prototype.delegator_addr = ""; + + /** + * QueryDelegatorUnbondingDelegationsRequest pagination. + * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination + * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest + * @instance + */ + QueryDelegatorUnbondingDelegationsRequest.prototype.pagination = null; + + /** + * Encodes the specified QueryDelegatorUnbondingDelegationsRequest message. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest + * @static + * @param {cosmos.staking.v1beta1.IQueryDelegatorUnbondingDelegationsRequest} message QueryDelegatorUnbondingDelegationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegatorUnbondingDelegationsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.delegator_addr != null && Object.hasOwnProperty.call(message, "delegator_addr")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_addr); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryDelegatorUnbondingDelegationsRequest message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest + * @static + * @param {cosmos.staking.v1beta1.IQueryDelegatorUnbondingDelegationsRequest} message QueryDelegatorUnbondingDelegationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegatorUnbondingDelegationsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryDelegatorUnbondingDelegationsRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest} QueryDelegatorUnbondingDelegationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegatorUnbondingDelegationsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_addr = reader.string(); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryDelegatorUnbondingDelegationsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest} QueryDelegatorUnbondingDelegationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegatorUnbondingDelegationsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryDelegatorUnbondingDelegationsRequest message. + * @function verify + * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryDelegatorUnbondingDelegationsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.delegator_addr != null && message.hasOwnProperty("delegator_addr")) + if (!$util.isString(message.delegator_addr)) + return "delegator_addr: string expected"; + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryDelegatorUnbondingDelegationsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest} QueryDelegatorUnbondingDelegationsRequest + */ + QueryDelegatorUnbondingDelegationsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest) + return object; + let message = new $root.cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest(); + if (object.delegator_addr != null) + message.delegator_addr = String(object.delegator_addr); + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryDelegatorUnbondingDelegationsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest + * @static + * @param {cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest} message QueryDelegatorUnbondingDelegationsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryDelegatorUnbondingDelegationsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.delegator_addr = ""; + object.pagination = null; + } + if (message.delegator_addr != null && message.hasOwnProperty("delegator_addr")) + object.delegator_addr = message.delegator_addr; + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryDelegatorUnbondingDelegationsRequest to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryDelegatorUnbondingDelegationsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryDelegatorUnbondingDelegationsRequest; + })(); + + v1beta1.QueryDelegatorUnbondingDelegationsResponse = (function() { + + /** + * Properties of a QueryDelegatorUnbondingDelegationsResponse. + * @memberof cosmos.staking.v1beta1 + * @interface IQueryDelegatorUnbondingDelegationsResponse + * @property {Array.|null} [unbonding_responses] QueryDelegatorUnbondingDelegationsResponse unbonding_responses + * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryDelegatorUnbondingDelegationsResponse pagination + */ + + /** + * Constructs a new QueryDelegatorUnbondingDelegationsResponse. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a QueryDelegatorUnbondingDelegationsResponse. + * @implements IQueryDelegatorUnbondingDelegationsResponse + * @constructor + * @param {cosmos.staking.v1beta1.IQueryDelegatorUnbondingDelegationsResponse=} [properties] Properties to set + */ + function QueryDelegatorUnbondingDelegationsResponse(properties) { + this.unbonding_responses = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryDelegatorUnbondingDelegationsResponse unbonding_responses. + * @member {Array.} unbonding_responses + * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse + * @instance + */ + QueryDelegatorUnbondingDelegationsResponse.prototype.unbonding_responses = $util.emptyArray; + + /** + * QueryDelegatorUnbondingDelegationsResponse pagination. + * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination + * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse + * @instance + */ + QueryDelegatorUnbondingDelegationsResponse.prototype.pagination = null; + + /** + * Encodes the specified QueryDelegatorUnbondingDelegationsResponse message. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse + * @static + * @param {cosmos.staking.v1beta1.IQueryDelegatorUnbondingDelegationsResponse} message QueryDelegatorUnbondingDelegationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegatorUnbondingDelegationsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.unbonding_responses != null && message.unbonding_responses.length) + for (let i = 0; i < message.unbonding_responses.length; ++i) + $root.cosmos.staking.v1beta1.UnbondingDelegation.encode(message.unbonding_responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryDelegatorUnbondingDelegationsResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse + * @static + * @param {cosmos.staking.v1beta1.IQueryDelegatorUnbondingDelegationsResponse} message QueryDelegatorUnbondingDelegationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegatorUnbondingDelegationsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryDelegatorUnbondingDelegationsResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse} QueryDelegatorUnbondingDelegationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegatorUnbondingDelegationsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.unbonding_responses && message.unbonding_responses.length)) + message.unbonding_responses = []; + message.unbonding_responses.push($root.cosmos.staking.v1beta1.UnbondingDelegation.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryDelegatorUnbondingDelegationsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse} QueryDelegatorUnbondingDelegationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegatorUnbondingDelegationsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryDelegatorUnbondingDelegationsResponse message. + * @function verify + * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryDelegatorUnbondingDelegationsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.unbonding_responses != null && message.hasOwnProperty("unbonding_responses")) { + if (!Array.isArray(message.unbonding_responses)) + return "unbonding_responses: array expected"; + for (let i = 0; i < message.unbonding_responses.length; ++i) { + let error = $root.cosmos.staking.v1beta1.UnbondingDelegation.verify(message.unbonding_responses[i]); + if (error) + return "unbonding_responses." + error; + } + } + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryDelegatorUnbondingDelegationsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse} QueryDelegatorUnbondingDelegationsResponse + */ + QueryDelegatorUnbondingDelegationsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse) + return object; + let message = new $root.cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse(); + if (object.unbonding_responses) { + if (!Array.isArray(object.unbonding_responses)) + throw TypeError(".cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse.unbonding_responses: array expected"); + message.unbonding_responses = []; + for (let i = 0; i < object.unbonding_responses.length; ++i) { + if (typeof object.unbonding_responses[i] !== "object") + throw TypeError(".cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse.unbonding_responses: object expected"); + message.unbonding_responses[i] = $root.cosmos.staking.v1beta1.UnbondingDelegation.fromObject(object.unbonding_responses[i]); + } + } + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryDelegatorUnbondingDelegationsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse + * @static + * @param {cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse} message QueryDelegatorUnbondingDelegationsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryDelegatorUnbondingDelegationsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.unbonding_responses = []; + if (options.defaults) + object.pagination = null; + if (message.unbonding_responses && message.unbonding_responses.length) { + object.unbonding_responses = []; + for (let j = 0; j < message.unbonding_responses.length; ++j) + object.unbonding_responses[j] = $root.cosmos.staking.v1beta1.UnbondingDelegation.toObject(message.unbonding_responses[j], options); + } + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryDelegatorUnbondingDelegationsResponse to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryDelegatorUnbondingDelegationsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryDelegatorUnbondingDelegationsResponse; + })(); + + v1beta1.QueryRedelegationsRequest = (function() { + + /** + * Properties of a QueryRedelegationsRequest. + * @memberof cosmos.staking.v1beta1 + * @interface IQueryRedelegationsRequest + * @property {string|null} [delegator_addr] QueryRedelegationsRequest delegator_addr + * @property {string|null} [src_validator_addr] QueryRedelegationsRequest src_validator_addr + * @property {string|null} [dst_validator_addr] QueryRedelegationsRequest dst_validator_addr + * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryRedelegationsRequest pagination + */ + + /** + * Constructs a new QueryRedelegationsRequest. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a QueryRedelegationsRequest. + * @implements IQueryRedelegationsRequest + * @constructor + * @param {cosmos.staking.v1beta1.IQueryRedelegationsRequest=} [properties] Properties to set + */ + function QueryRedelegationsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryRedelegationsRequest delegator_addr. + * @member {string} delegator_addr + * @memberof cosmos.staking.v1beta1.QueryRedelegationsRequest + * @instance + */ + QueryRedelegationsRequest.prototype.delegator_addr = ""; + + /** + * QueryRedelegationsRequest src_validator_addr. + * @member {string} src_validator_addr + * @memberof cosmos.staking.v1beta1.QueryRedelegationsRequest + * @instance + */ + QueryRedelegationsRequest.prototype.src_validator_addr = ""; + + /** + * QueryRedelegationsRequest dst_validator_addr. + * @member {string} dst_validator_addr + * @memberof cosmos.staking.v1beta1.QueryRedelegationsRequest + * @instance + */ + QueryRedelegationsRequest.prototype.dst_validator_addr = ""; + + /** + * QueryRedelegationsRequest pagination. + * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination + * @memberof cosmos.staking.v1beta1.QueryRedelegationsRequest + * @instance + */ + QueryRedelegationsRequest.prototype.pagination = null; + + /** + * Encodes the specified QueryRedelegationsRequest message. Does not implicitly {@link cosmos.staking.v1beta1.QueryRedelegationsRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.QueryRedelegationsRequest + * @static + * @param {cosmos.staking.v1beta1.IQueryRedelegationsRequest} message QueryRedelegationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryRedelegationsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.delegator_addr != null && Object.hasOwnProperty.call(message, "delegator_addr")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_addr); + if (message.src_validator_addr != null && Object.hasOwnProperty.call(message, "src_validator_addr")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.src_validator_addr); + if (message.dst_validator_addr != null && Object.hasOwnProperty.call(message, "dst_validator_addr")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.dst_validator_addr); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryRedelegationsRequest message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryRedelegationsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.QueryRedelegationsRequest + * @static + * @param {cosmos.staking.v1beta1.IQueryRedelegationsRequest} message QueryRedelegationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryRedelegationsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryRedelegationsRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.QueryRedelegationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.QueryRedelegationsRequest} QueryRedelegationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryRedelegationsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryRedelegationsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_addr = reader.string(); + break; + case 2: + message.src_validator_addr = reader.string(); + break; + case 3: + message.dst_validator_addr = reader.string(); + break; + case 4: + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryRedelegationsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.QueryRedelegationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.QueryRedelegationsRequest} QueryRedelegationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryRedelegationsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryRedelegationsRequest message. + * @function verify + * @memberof cosmos.staking.v1beta1.QueryRedelegationsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryRedelegationsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.delegator_addr != null && message.hasOwnProperty("delegator_addr")) + if (!$util.isString(message.delegator_addr)) + return "delegator_addr: string expected"; + if (message.src_validator_addr != null && message.hasOwnProperty("src_validator_addr")) + if (!$util.isString(message.src_validator_addr)) + return "src_validator_addr: string expected"; + if (message.dst_validator_addr != null && message.hasOwnProperty("dst_validator_addr")) + if (!$util.isString(message.dst_validator_addr)) + return "dst_validator_addr: string expected"; + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryRedelegationsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.QueryRedelegationsRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.QueryRedelegationsRequest} QueryRedelegationsRequest + */ + QueryRedelegationsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.QueryRedelegationsRequest) + return object; + let message = new $root.cosmos.staking.v1beta1.QueryRedelegationsRequest(); + if (object.delegator_addr != null) + message.delegator_addr = String(object.delegator_addr); + if (object.src_validator_addr != null) + message.src_validator_addr = String(object.src_validator_addr); + if (object.dst_validator_addr != null) + message.dst_validator_addr = String(object.dst_validator_addr); + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.staking.v1beta1.QueryRedelegationsRequest.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryRedelegationsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.QueryRedelegationsRequest + * @static + * @param {cosmos.staking.v1beta1.QueryRedelegationsRequest} message QueryRedelegationsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryRedelegationsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.delegator_addr = ""; + object.src_validator_addr = ""; + object.dst_validator_addr = ""; + object.pagination = null; + } + if (message.delegator_addr != null && message.hasOwnProperty("delegator_addr")) + object.delegator_addr = message.delegator_addr; + if (message.src_validator_addr != null && message.hasOwnProperty("src_validator_addr")) + object.src_validator_addr = message.src_validator_addr; + if (message.dst_validator_addr != null && message.hasOwnProperty("dst_validator_addr")) + object.dst_validator_addr = message.dst_validator_addr; + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryRedelegationsRequest to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.QueryRedelegationsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryRedelegationsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryRedelegationsRequest; + })(); + + v1beta1.QueryRedelegationsResponse = (function() { + + /** + * Properties of a QueryRedelegationsResponse. + * @memberof cosmos.staking.v1beta1 + * @interface IQueryRedelegationsResponse + * @property {Array.|null} [redelegation_responses] QueryRedelegationsResponse redelegation_responses + * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryRedelegationsResponse pagination + */ + + /** + * Constructs a new QueryRedelegationsResponse. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a QueryRedelegationsResponse. + * @implements IQueryRedelegationsResponse + * @constructor + * @param {cosmos.staking.v1beta1.IQueryRedelegationsResponse=} [properties] Properties to set + */ + function QueryRedelegationsResponse(properties) { + this.redelegation_responses = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryRedelegationsResponse redelegation_responses. + * @member {Array.} redelegation_responses + * @memberof cosmos.staking.v1beta1.QueryRedelegationsResponse + * @instance + */ + QueryRedelegationsResponse.prototype.redelegation_responses = $util.emptyArray; + + /** + * QueryRedelegationsResponse pagination. + * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination + * @memberof cosmos.staking.v1beta1.QueryRedelegationsResponse + * @instance + */ + QueryRedelegationsResponse.prototype.pagination = null; + + /** + * Encodes the specified QueryRedelegationsResponse message. Does not implicitly {@link cosmos.staking.v1beta1.QueryRedelegationsResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.QueryRedelegationsResponse + * @static + * @param {cosmos.staking.v1beta1.IQueryRedelegationsResponse} message QueryRedelegationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryRedelegationsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.redelegation_responses != null && message.redelegation_responses.length) + for (let i = 0; i < message.redelegation_responses.length; ++i) + $root.cosmos.staking.v1beta1.RedelegationResponse.encode(message.redelegation_responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryRedelegationsResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryRedelegationsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.QueryRedelegationsResponse + * @static + * @param {cosmos.staking.v1beta1.IQueryRedelegationsResponse} message QueryRedelegationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryRedelegationsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryRedelegationsResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.QueryRedelegationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.QueryRedelegationsResponse} QueryRedelegationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryRedelegationsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryRedelegationsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.redelegation_responses && message.redelegation_responses.length)) + message.redelegation_responses = []; + message.redelegation_responses.push($root.cosmos.staking.v1beta1.RedelegationResponse.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryRedelegationsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.QueryRedelegationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.QueryRedelegationsResponse} QueryRedelegationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryRedelegationsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryRedelegationsResponse message. + * @function verify + * @memberof cosmos.staking.v1beta1.QueryRedelegationsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryRedelegationsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.redelegation_responses != null && message.hasOwnProperty("redelegation_responses")) { + if (!Array.isArray(message.redelegation_responses)) + return "redelegation_responses: array expected"; + for (let i = 0; i < message.redelegation_responses.length; ++i) { + let error = $root.cosmos.staking.v1beta1.RedelegationResponse.verify(message.redelegation_responses[i]); + if (error) + return "redelegation_responses." + error; + } + } + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryRedelegationsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.QueryRedelegationsResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.QueryRedelegationsResponse} QueryRedelegationsResponse + */ + QueryRedelegationsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.QueryRedelegationsResponse) + return object; + let message = new $root.cosmos.staking.v1beta1.QueryRedelegationsResponse(); + if (object.redelegation_responses) { + if (!Array.isArray(object.redelegation_responses)) + throw TypeError(".cosmos.staking.v1beta1.QueryRedelegationsResponse.redelegation_responses: array expected"); + message.redelegation_responses = []; + for (let i = 0; i < object.redelegation_responses.length; ++i) { + if (typeof object.redelegation_responses[i] !== "object") + throw TypeError(".cosmos.staking.v1beta1.QueryRedelegationsResponse.redelegation_responses: object expected"); + message.redelegation_responses[i] = $root.cosmos.staking.v1beta1.RedelegationResponse.fromObject(object.redelegation_responses[i]); + } + } + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.staking.v1beta1.QueryRedelegationsResponse.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryRedelegationsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.QueryRedelegationsResponse + * @static + * @param {cosmos.staking.v1beta1.QueryRedelegationsResponse} message QueryRedelegationsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryRedelegationsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.redelegation_responses = []; + if (options.defaults) + object.pagination = null; + if (message.redelegation_responses && message.redelegation_responses.length) { + object.redelegation_responses = []; + for (let j = 0; j < message.redelegation_responses.length; ++j) + object.redelegation_responses[j] = $root.cosmos.staking.v1beta1.RedelegationResponse.toObject(message.redelegation_responses[j], options); + } + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryRedelegationsResponse to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.QueryRedelegationsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryRedelegationsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryRedelegationsResponse; + })(); + + v1beta1.QueryDelegatorValidatorsRequest = (function() { + + /** + * Properties of a QueryDelegatorValidatorsRequest. + * @memberof cosmos.staking.v1beta1 + * @interface IQueryDelegatorValidatorsRequest + * @property {string|null} [delegator_addr] QueryDelegatorValidatorsRequest delegator_addr + * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryDelegatorValidatorsRequest pagination + */ + + /** + * Constructs a new QueryDelegatorValidatorsRequest. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a QueryDelegatorValidatorsRequest. + * @implements IQueryDelegatorValidatorsRequest + * @constructor + * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorsRequest=} [properties] Properties to set + */ + function QueryDelegatorValidatorsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryDelegatorValidatorsRequest delegator_addr. + * @member {string} delegator_addr + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest + * @instance + */ + QueryDelegatorValidatorsRequest.prototype.delegator_addr = ""; + + /** + * QueryDelegatorValidatorsRequest pagination. + * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest + * @instance + */ + QueryDelegatorValidatorsRequest.prototype.pagination = null; + + /** + * Encodes the specified QueryDelegatorValidatorsRequest message. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest + * @static + * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorsRequest} message QueryDelegatorValidatorsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegatorValidatorsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.delegator_addr != null && Object.hasOwnProperty.call(message, "delegator_addr")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_addr); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryDelegatorValidatorsRequest message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest + * @static + * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorsRequest} message QueryDelegatorValidatorsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegatorValidatorsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryDelegatorValidatorsRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest} QueryDelegatorValidatorsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegatorValidatorsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_addr = reader.string(); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryDelegatorValidatorsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest} QueryDelegatorValidatorsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegatorValidatorsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryDelegatorValidatorsRequest message. + * @function verify + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryDelegatorValidatorsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.delegator_addr != null && message.hasOwnProperty("delegator_addr")) + if (!$util.isString(message.delegator_addr)) + return "delegator_addr: string expected"; + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryDelegatorValidatorsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest} QueryDelegatorValidatorsRequest + */ + QueryDelegatorValidatorsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest) + return object; + let message = new $root.cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest(); + if (object.delegator_addr != null) + message.delegator_addr = String(object.delegator_addr); + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryDelegatorValidatorsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest + * @static + * @param {cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest} message QueryDelegatorValidatorsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryDelegatorValidatorsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.delegator_addr = ""; + object.pagination = null; + } + if (message.delegator_addr != null && message.hasOwnProperty("delegator_addr")) + object.delegator_addr = message.delegator_addr; + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryDelegatorValidatorsRequest to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryDelegatorValidatorsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryDelegatorValidatorsRequest; + })(); + + v1beta1.QueryDelegatorValidatorsResponse = (function() { + + /** + * Properties of a QueryDelegatorValidatorsResponse. + * @memberof cosmos.staking.v1beta1 + * @interface IQueryDelegatorValidatorsResponse + * @property {Array.|null} [validators] QueryDelegatorValidatorsResponse validators + * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryDelegatorValidatorsResponse pagination + */ + + /** + * Constructs a new QueryDelegatorValidatorsResponse. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a QueryDelegatorValidatorsResponse. + * @implements IQueryDelegatorValidatorsResponse + * @constructor + * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorsResponse=} [properties] Properties to set + */ + function QueryDelegatorValidatorsResponse(properties) { + this.validators = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryDelegatorValidatorsResponse validators. + * @member {Array.} validators + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse + * @instance + */ + QueryDelegatorValidatorsResponse.prototype.validators = $util.emptyArray; + + /** + * QueryDelegatorValidatorsResponse pagination. + * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse + * @instance + */ + QueryDelegatorValidatorsResponse.prototype.pagination = null; + + /** + * Encodes the specified QueryDelegatorValidatorsResponse message. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse + * @static + * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorsResponse} message QueryDelegatorValidatorsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegatorValidatorsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.validators != null && message.validators.length) + for (let i = 0; i < message.validators.length; ++i) + $root.cosmos.staking.v1beta1.Validator.encode(message.validators[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryDelegatorValidatorsResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse + * @static + * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorsResponse} message QueryDelegatorValidatorsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegatorValidatorsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryDelegatorValidatorsResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse} QueryDelegatorValidatorsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegatorValidatorsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.validators && message.validators.length)) + message.validators = []; + message.validators.push($root.cosmos.staking.v1beta1.Validator.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryDelegatorValidatorsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse} QueryDelegatorValidatorsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegatorValidatorsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryDelegatorValidatorsResponse message. + * @function verify + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryDelegatorValidatorsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.validators != null && message.hasOwnProperty("validators")) { + if (!Array.isArray(message.validators)) + return "validators: array expected"; + for (let i = 0; i < message.validators.length; ++i) { + let error = $root.cosmos.staking.v1beta1.Validator.verify(message.validators[i]); + if (error) + return "validators." + error; + } + } + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryDelegatorValidatorsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse} QueryDelegatorValidatorsResponse + */ + QueryDelegatorValidatorsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse) + return object; + let message = new $root.cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse(); + if (object.validators) { + if (!Array.isArray(object.validators)) + throw TypeError(".cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse.validators: array expected"); + message.validators = []; + for (let i = 0; i < object.validators.length; ++i) { + if (typeof object.validators[i] !== "object") + throw TypeError(".cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse.validators: object expected"); + message.validators[i] = $root.cosmos.staking.v1beta1.Validator.fromObject(object.validators[i]); + } + } + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryDelegatorValidatorsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse + * @static + * @param {cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse} message QueryDelegatorValidatorsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryDelegatorValidatorsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.validators = []; + if (options.defaults) + object.pagination = null; + if (message.validators && message.validators.length) { + object.validators = []; + for (let j = 0; j < message.validators.length; ++j) + object.validators[j] = $root.cosmos.staking.v1beta1.Validator.toObject(message.validators[j], options); + } + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryDelegatorValidatorsResponse to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryDelegatorValidatorsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryDelegatorValidatorsResponse; + })(); + + v1beta1.QueryDelegatorValidatorRequest = (function() { + + /** + * Properties of a QueryDelegatorValidatorRequest. + * @memberof cosmos.staking.v1beta1 + * @interface IQueryDelegatorValidatorRequest + * @property {string|null} [delegator_addr] QueryDelegatorValidatorRequest delegator_addr + * @property {string|null} [validator_addr] QueryDelegatorValidatorRequest validator_addr + */ + + /** + * Constructs a new QueryDelegatorValidatorRequest. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a QueryDelegatorValidatorRequest. + * @implements IQueryDelegatorValidatorRequest + * @constructor + * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorRequest=} [properties] Properties to set + */ + function QueryDelegatorValidatorRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryDelegatorValidatorRequest delegator_addr. + * @member {string} delegator_addr + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorRequest + * @instance + */ + QueryDelegatorValidatorRequest.prototype.delegator_addr = ""; + + /** + * QueryDelegatorValidatorRequest validator_addr. + * @member {string} validator_addr + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorRequest + * @instance + */ + QueryDelegatorValidatorRequest.prototype.validator_addr = ""; + + /** + * Encodes the specified QueryDelegatorValidatorRequest message. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorValidatorRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorRequest + * @static + * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorRequest} message QueryDelegatorValidatorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegatorValidatorRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.delegator_addr != null && Object.hasOwnProperty.call(message, "delegator_addr")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_addr); + if (message.validator_addr != null && Object.hasOwnProperty.call(message, "validator_addr")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.validator_addr); + return writer; + }; + + /** + * Encodes the specified QueryDelegatorValidatorRequest message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorValidatorRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorRequest + * @static + * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorRequest} message QueryDelegatorValidatorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegatorValidatorRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryDelegatorValidatorRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.QueryDelegatorValidatorRequest} QueryDelegatorValidatorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegatorValidatorRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryDelegatorValidatorRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_addr = reader.string(); + break; + case 2: + message.validator_addr = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryDelegatorValidatorRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.QueryDelegatorValidatorRequest} QueryDelegatorValidatorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegatorValidatorRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryDelegatorValidatorRequest message. + * @function verify + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryDelegatorValidatorRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.delegator_addr != null && message.hasOwnProperty("delegator_addr")) + if (!$util.isString(message.delegator_addr)) + return "delegator_addr: string expected"; + if (message.validator_addr != null && message.hasOwnProperty("validator_addr")) + if (!$util.isString(message.validator_addr)) + return "validator_addr: string expected"; + return null; + }; + + /** + * Creates a QueryDelegatorValidatorRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.QueryDelegatorValidatorRequest} QueryDelegatorValidatorRequest + */ + QueryDelegatorValidatorRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.QueryDelegatorValidatorRequest) + return object; + let message = new $root.cosmos.staking.v1beta1.QueryDelegatorValidatorRequest(); + if (object.delegator_addr != null) + message.delegator_addr = String(object.delegator_addr); + if (object.validator_addr != null) + message.validator_addr = String(object.validator_addr); + return message; + }; + + /** + * Creates a plain object from a QueryDelegatorValidatorRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorRequest + * @static + * @param {cosmos.staking.v1beta1.QueryDelegatorValidatorRequest} message QueryDelegatorValidatorRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryDelegatorValidatorRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.delegator_addr = ""; + object.validator_addr = ""; + } + if (message.delegator_addr != null && message.hasOwnProperty("delegator_addr")) + object.delegator_addr = message.delegator_addr; + if (message.validator_addr != null && message.hasOwnProperty("validator_addr")) + object.validator_addr = message.validator_addr; + return object; + }; + + /** + * Converts this QueryDelegatorValidatorRequest to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorRequest + * @instance + * @returns {Object.} JSON object + */ + QueryDelegatorValidatorRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryDelegatorValidatorRequest; + })(); + + v1beta1.QueryDelegatorValidatorResponse = (function() { + + /** + * Properties of a QueryDelegatorValidatorResponse. + * @memberof cosmos.staking.v1beta1 + * @interface IQueryDelegatorValidatorResponse + * @property {cosmos.staking.v1beta1.IValidator|null} [validator] QueryDelegatorValidatorResponse validator + */ + + /** + * Constructs a new QueryDelegatorValidatorResponse. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a QueryDelegatorValidatorResponse. + * @implements IQueryDelegatorValidatorResponse + * @constructor + * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorResponse=} [properties] Properties to set + */ + function QueryDelegatorValidatorResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryDelegatorValidatorResponse validator. + * @member {cosmos.staking.v1beta1.IValidator|null|undefined} validator + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorResponse + * @instance + */ + QueryDelegatorValidatorResponse.prototype.validator = null; + + /** + * Encodes the specified QueryDelegatorValidatorResponse message. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorValidatorResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorResponse + * @static + * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorResponse} message QueryDelegatorValidatorResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegatorValidatorResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.validator != null && Object.hasOwnProperty.call(message, "validator")) + $root.cosmos.staking.v1beta1.Validator.encode(message.validator, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryDelegatorValidatorResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorValidatorResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorResponse + * @static + * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorResponse} message QueryDelegatorValidatorResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDelegatorValidatorResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryDelegatorValidatorResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.QueryDelegatorValidatorResponse} QueryDelegatorValidatorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegatorValidatorResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryDelegatorValidatorResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator = $root.cosmos.staking.v1beta1.Validator.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryDelegatorValidatorResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.QueryDelegatorValidatorResponse} QueryDelegatorValidatorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDelegatorValidatorResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryDelegatorValidatorResponse message. + * @function verify + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryDelegatorValidatorResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.validator != null && message.hasOwnProperty("validator")) { + let error = $root.cosmos.staking.v1beta1.Validator.verify(message.validator); + if (error) + return "validator." + error; + } + return null; + }; + + /** + * Creates a QueryDelegatorValidatorResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.QueryDelegatorValidatorResponse} QueryDelegatorValidatorResponse + */ + QueryDelegatorValidatorResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.QueryDelegatorValidatorResponse) + return object; + let message = new $root.cosmos.staking.v1beta1.QueryDelegatorValidatorResponse(); + if (object.validator != null) { + if (typeof object.validator !== "object") + throw TypeError(".cosmos.staking.v1beta1.QueryDelegatorValidatorResponse.validator: object expected"); + message.validator = $root.cosmos.staking.v1beta1.Validator.fromObject(object.validator); + } + return message; + }; + + /** + * Creates a plain object from a QueryDelegatorValidatorResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorResponse + * @static + * @param {cosmos.staking.v1beta1.QueryDelegatorValidatorResponse} message QueryDelegatorValidatorResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryDelegatorValidatorResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.validator = null; + if (message.validator != null && message.hasOwnProperty("validator")) + object.validator = $root.cosmos.staking.v1beta1.Validator.toObject(message.validator, options); + return object; + }; + + /** + * Converts this QueryDelegatorValidatorResponse to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorResponse + * @instance + * @returns {Object.} JSON object + */ + QueryDelegatorValidatorResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryDelegatorValidatorResponse; + })(); + + v1beta1.QueryHistoricalInfoRequest = (function() { + + /** + * Properties of a QueryHistoricalInfoRequest. + * @memberof cosmos.staking.v1beta1 + * @interface IQueryHistoricalInfoRequest + * @property {Long|null} [height] QueryHistoricalInfoRequest height + */ + + /** + * Constructs a new QueryHistoricalInfoRequest. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a QueryHistoricalInfoRequest. + * @implements IQueryHistoricalInfoRequest + * @constructor + * @param {cosmos.staking.v1beta1.IQueryHistoricalInfoRequest=} [properties] Properties to set + */ + function QueryHistoricalInfoRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryHistoricalInfoRequest height. + * @member {Long} height + * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoRequest + * @instance + */ + QueryHistoricalInfoRequest.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Encodes the specified QueryHistoricalInfoRequest message. Does not implicitly {@link cosmos.staking.v1beta1.QueryHistoricalInfoRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoRequest + * @static + * @param {cosmos.staking.v1beta1.IQueryHistoricalInfoRequest} message QueryHistoricalInfoRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryHistoricalInfoRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.height); + return writer; + }; + + /** + * Encodes the specified QueryHistoricalInfoRequest message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryHistoricalInfoRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoRequest + * @static + * @param {cosmos.staking.v1beta1.IQueryHistoricalInfoRequest} message QueryHistoricalInfoRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryHistoricalInfoRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryHistoricalInfoRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.QueryHistoricalInfoRequest} QueryHistoricalInfoRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryHistoricalInfoRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryHistoricalInfoRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryHistoricalInfoRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.QueryHistoricalInfoRequest} QueryHistoricalInfoRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryHistoricalInfoRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryHistoricalInfoRequest message. + * @function verify + * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryHistoricalInfoRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) + return "height: integer|Long expected"; + return null; + }; + + /** + * Creates a QueryHistoricalInfoRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.QueryHistoricalInfoRequest} QueryHistoricalInfoRequest + */ + QueryHistoricalInfoRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.QueryHistoricalInfoRequest) + return object; + let message = new $root.cosmos.staking.v1beta1.QueryHistoricalInfoRequest(); + if (object.height != null) + if ($util.Long) + (message.height = $util.Long.fromValue(object.height)).unsigned = false; + else if (typeof object.height === "string") + message.height = parseInt(object.height, 10); + else if (typeof object.height === "number") + message.height = object.height; + else if (typeof object.height === "object") + message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a QueryHistoricalInfoRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoRequest + * @static + * @param {cosmos.staking.v1beta1.QueryHistoricalInfoRequest} message QueryHistoricalInfoRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryHistoricalInfoRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.height = options.longs === String ? "0" : 0; + if (message.height != null && message.hasOwnProperty("height")) + if (typeof message.height === "number") + object.height = options.longs === String ? String(message.height) : message.height; + else + object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; + return object; + }; + + /** + * Converts this QueryHistoricalInfoRequest to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoRequest + * @instance + * @returns {Object.} JSON object + */ + QueryHistoricalInfoRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryHistoricalInfoRequest; + })(); + + v1beta1.QueryHistoricalInfoResponse = (function() { + + /** + * Properties of a QueryHistoricalInfoResponse. + * @memberof cosmos.staking.v1beta1 + * @interface IQueryHistoricalInfoResponse + * @property {cosmos.staking.v1beta1.IHistoricalInfo|null} [hist] QueryHistoricalInfoResponse hist + */ + + /** + * Constructs a new QueryHistoricalInfoResponse. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a QueryHistoricalInfoResponse. + * @implements IQueryHistoricalInfoResponse + * @constructor + * @param {cosmos.staking.v1beta1.IQueryHistoricalInfoResponse=} [properties] Properties to set + */ + function QueryHistoricalInfoResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryHistoricalInfoResponse hist. + * @member {cosmos.staking.v1beta1.IHistoricalInfo|null|undefined} hist + * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoResponse + * @instance + */ + QueryHistoricalInfoResponse.prototype.hist = null; + + /** + * Encodes the specified QueryHistoricalInfoResponse message. Does not implicitly {@link cosmos.staking.v1beta1.QueryHistoricalInfoResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoResponse + * @static + * @param {cosmos.staking.v1beta1.IQueryHistoricalInfoResponse} message QueryHistoricalInfoResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryHistoricalInfoResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.hist != null && Object.hasOwnProperty.call(message, "hist")) + $root.cosmos.staking.v1beta1.HistoricalInfo.encode(message.hist, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryHistoricalInfoResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryHistoricalInfoResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoResponse + * @static + * @param {cosmos.staking.v1beta1.IQueryHistoricalInfoResponse} message QueryHistoricalInfoResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryHistoricalInfoResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryHistoricalInfoResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.QueryHistoricalInfoResponse} QueryHistoricalInfoResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryHistoricalInfoResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryHistoricalInfoResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hist = $root.cosmos.staking.v1beta1.HistoricalInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryHistoricalInfoResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.QueryHistoricalInfoResponse} QueryHistoricalInfoResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryHistoricalInfoResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryHistoricalInfoResponse message. + * @function verify + * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryHistoricalInfoResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.hist != null && message.hasOwnProperty("hist")) { + let error = $root.cosmos.staking.v1beta1.HistoricalInfo.verify(message.hist); + if (error) + return "hist." + error; + } + return null; + }; + + /** + * Creates a QueryHistoricalInfoResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.QueryHistoricalInfoResponse} QueryHistoricalInfoResponse + */ + QueryHistoricalInfoResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.QueryHistoricalInfoResponse) + return object; + let message = new $root.cosmos.staking.v1beta1.QueryHistoricalInfoResponse(); + if (object.hist != null) { + if (typeof object.hist !== "object") + throw TypeError(".cosmos.staking.v1beta1.QueryHistoricalInfoResponse.hist: object expected"); + message.hist = $root.cosmos.staking.v1beta1.HistoricalInfo.fromObject(object.hist); + } + return message; + }; + + /** + * Creates a plain object from a QueryHistoricalInfoResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoResponse + * @static + * @param {cosmos.staking.v1beta1.QueryHistoricalInfoResponse} message QueryHistoricalInfoResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryHistoricalInfoResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.hist = null; + if (message.hist != null && message.hasOwnProperty("hist")) + object.hist = $root.cosmos.staking.v1beta1.HistoricalInfo.toObject(message.hist, options); + return object; + }; + + /** + * Converts this QueryHistoricalInfoResponse to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoResponse + * @instance + * @returns {Object.} JSON object + */ + QueryHistoricalInfoResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryHistoricalInfoResponse; + })(); + + v1beta1.QueryPoolRequest = (function() { + + /** + * Properties of a QueryPoolRequest. + * @memberof cosmos.staking.v1beta1 + * @interface IQueryPoolRequest + */ + + /** + * Constructs a new QueryPoolRequest. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a QueryPoolRequest. + * @implements IQueryPoolRequest + * @constructor + * @param {cosmos.staking.v1beta1.IQueryPoolRequest=} [properties] Properties to set + */ + function QueryPoolRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified QueryPoolRequest message. Does not implicitly {@link cosmos.staking.v1beta1.QueryPoolRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.QueryPoolRequest + * @static + * @param {cosmos.staking.v1beta1.IQueryPoolRequest} message QueryPoolRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryPoolRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified QueryPoolRequest message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryPoolRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.QueryPoolRequest + * @static + * @param {cosmos.staking.v1beta1.IQueryPoolRequest} message QueryPoolRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryPoolRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryPoolRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.QueryPoolRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.QueryPoolRequest} QueryPoolRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryPoolRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryPoolRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryPoolRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.QueryPoolRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.QueryPoolRequest} QueryPoolRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryPoolRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryPoolRequest message. + * @function verify + * @memberof cosmos.staking.v1beta1.QueryPoolRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryPoolRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a QueryPoolRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.QueryPoolRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.QueryPoolRequest} QueryPoolRequest + */ + QueryPoolRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.QueryPoolRequest) + return object; + return new $root.cosmos.staking.v1beta1.QueryPoolRequest(); + }; + + /** + * Creates a plain object from a QueryPoolRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.QueryPoolRequest + * @static + * @param {cosmos.staking.v1beta1.QueryPoolRequest} message QueryPoolRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryPoolRequest.toObject = function toObject() { + return {}; + }; + + /** + * Converts this QueryPoolRequest to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.QueryPoolRequest + * @instance + * @returns {Object.} JSON object + */ + QueryPoolRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryPoolRequest; + })(); + + v1beta1.QueryPoolResponse = (function() { + + /** + * Properties of a QueryPoolResponse. + * @memberof cosmos.staking.v1beta1 + * @interface IQueryPoolResponse + * @property {cosmos.staking.v1beta1.IPool|null} [pool] QueryPoolResponse pool + */ + + /** + * Constructs a new QueryPoolResponse. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a QueryPoolResponse. + * @implements IQueryPoolResponse + * @constructor + * @param {cosmos.staking.v1beta1.IQueryPoolResponse=} [properties] Properties to set + */ + function QueryPoolResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryPoolResponse pool. + * @member {cosmos.staking.v1beta1.IPool|null|undefined} pool + * @memberof cosmos.staking.v1beta1.QueryPoolResponse + * @instance + */ + QueryPoolResponse.prototype.pool = null; + + /** + * Encodes the specified QueryPoolResponse message. Does not implicitly {@link cosmos.staking.v1beta1.QueryPoolResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.QueryPoolResponse + * @static + * @param {cosmos.staking.v1beta1.IQueryPoolResponse} message QueryPoolResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryPoolResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pool != null && Object.hasOwnProperty.call(message, "pool")) + $root.cosmos.staking.v1beta1.Pool.encode(message.pool, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryPoolResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryPoolResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.QueryPoolResponse + * @static + * @param {cosmos.staking.v1beta1.IQueryPoolResponse} message QueryPoolResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryPoolResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryPoolResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.QueryPoolResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.QueryPoolResponse} QueryPoolResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryPoolResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryPoolResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool = $root.cosmos.staking.v1beta1.Pool.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryPoolResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.QueryPoolResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.QueryPoolResponse} QueryPoolResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryPoolResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryPoolResponse message. + * @function verify + * @memberof cosmos.staking.v1beta1.QueryPoolResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryPoolResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pool != null && message.hasOwnProperty("pool")) { + let error = $root.cosmos.staking.v1beta1.Pool.verify(message.pool); + if (error) + return "pool." + error; + } + return null; + }; + + /** + * Creates a QueryPoolResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.QueryPoolResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.QueryPoolResponse} QueryPoolResponse + */ + QueryPoolResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.QueryPoolResponse) + return object; + let message = new $root.cosmos.staking.v1beta1.QueryPoolResponse(); + if (object.pool != null) { + if (typeof object.pool !== "object") + throw TypeError(".cosmos.staking.v1beta1.QueryPoolResponse.pool: object expected"); + message.pool = $root.cosmos.staking.v1beta1.Pool.fromObject(object.pool); + } + return message; + }; + + /** + * Creates a plain object from a QueryPoolResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.QueryPoolResponse + * @static + * @param {cosmos.staking.v1beta1.QueryPoolResponse} message QueryPoolResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryPoolResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.pool = null; + if (message.pool != null && message.hasOwnProperty("pool")) + object.pool = $root.cosmos.staking.v1beta1.Pool.toObject(message.pool, options); + return object; + }; + + /** + * Converts this QueryPoolResponse to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.QueryPoolResponse + * @instance + * @returns {Object.} JSON object + */ + QueryPoolResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryPoolResponse; + })(); + + v1beta1.QueryParamsRequest = (function() { + + /** + * Properties of a QueryParamsRequest. + * @memberof cosmos.staking.v1beta1 + * @interface IQueryParamsRequest + */ + + /** + * Constructs a new QueryParamsRequest. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a QueryParamsRequest. + * @implements IQueryParamsRequest + * @constructor + * @param {cosmos.staking.v1beta1.IQueryParamsRequest=} [properties] Properties to set + */ + function QueryParamsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified QueryParamsRequest message. Does not implicitly {@link cosmos.staking.v1beta1.QueryParamsRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.QueryParamsRequest + * @static + * @param {cosmos.staking.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified QueryParamsRequest message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryParamsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.QueryParamsRequest + * @static + * @param {cosmos.staking.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryParamsRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.QueryParamsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.QueryParamsRequest} QueryParamsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryParamsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryParamsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.QueryParamsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.QueryParamsRequest} QueryParamsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryParamsRequest message. + * @function verify + * @memberof cosmos.staking.v1beta1.QueryParamsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryParamsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a QueryParamsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.QueryParamsRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.QueryParamsRequest} QueryParamsRequest + */ + QueryParamsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.QueryParamsRequest) + return object; + return new $root.cosmos.staking.v1beta1.QueryParamsRequest(); + }; + + /** + * Creates a plain object from a QueryParamsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.QueryParamsRequest + * @static + * @param {cosmos.staking.v1beta1.QueryParamsRequest} message QueryParamsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryParamsRequest.toObject = function toObject() { + return {}; + }; + + /** + * Converts this QueryParamsRequest to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.QueryParamsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryParamsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryParamsRequest; + })(); + + v1beta1.QueryParamsResponse = (function() { + + /** + * Properties of a QueryParamsResponse. + * @memberof cosmos.staking.v1beta1 + * @interface IQueryParamsResponse + * @property {cosmos.staking.v1beta1.IParams|null} [params] QueryParamsResponse params + */ + + /** + * Constructs a new QueryParamsResponse. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a QueryParamsResponse. + * @implements IQueryParamsResponse + * @constructor + * @param {cosmos.staking.v1beta1.IQueryParamsResponse=} [properties] Properties to set + */ + function QueryParamsResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryParamsResponse params. + * @member {cosmos.staking.v1beta1.IParams|null|undefined} params + * @memberof cosmos.staking.v1beta1.QueryParamsResponse + * @instance + */ + QueryParamsResponse.prototype.params = null; + + /** + * Encodes the specified QueryParamsResponse message. Does not implicitly {@link cosmos.staking.v1beta1.QueryParamsResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.QueryParamsResponse + * @static + * @param {cosmos.staking.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.params != null && Object.hasOwnProperty.call(message, "params")) + $root.cosmos.staking.v1beta1.Params.encode(message.params, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryParamsResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryParamsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.QueryParamsResponse + * @static + * @param {cosmos.staking.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryParamsResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.QueryParamsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.QueryParamsResponse} QueryParamsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryParamsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = $root.cosmos.staking.v1beta1.Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryParamsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.QueryParamsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.QueryParamsResponse} QueryParamsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryParamsResponse message. + * @function verify + * @memberof cosmos.staking.v1beta1.QueryParamsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryParamsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.params != null && message.hasOwnProperty("params")) { + let error = $root.cosmos.staking.v1beta1.Params.verify(message.params); + if (error) + return "params." + error; + } + return null; + }; + + /** + * Creates a QueryParamsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.QueryParamsResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.QueryParamsResponse} QueryParamsResponse + */ + QueryParamsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.QueryParamsResponse) + return object; + let message = new $root.cosmos.staking.v1beta1.QueryParamsResponse(); + if (object.params != null) { + if (typeof object.params !== "object") + throw TypeError(".cosmos.staking.v1beta1.QueryParamsResponse.params: object expected"); + message.params = $root.cosmos.staking.v1beta1.Params.fromObject(object.params); + } + return message; + }; + + /** + * Creates a plain object from a QueryParamsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.QueryParamsResponse + * @static + * @param {cosmos.staking.v1beta1.QueryParamsResponse} message QueryParamsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryParamsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.params = null; + if (message.params != null && message.hasOwnProperty("params")) + object.params = $root.cosmos.staking.v1beta1.Params.toObject(message.params, options); + return object; + }; + + /** + * Converts this QueryParamsResponse to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.QueryParamsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryParamsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryParamsResponse; + })(); + + v1beta1.GenesisState = (function() { + + /** + * Properties of a GenesisState. + * @memberof cosmos.staking.v1beta1 + * @interface IGenesisState + * @property {cosmos.staking.v1beta1.IParams|null} [params] GenesisState params + * @property {Uint8Array|null} [last_total_power] GenesisState last_total_power + * @property {Array.|null} [last_validator_powers] GenesisState last_validator_powers + * @property {Array.|null} [validators] GenesisState validators + * @property {Array.|null} [delegations] GenesisState delegations + * @property {Array.|null} [unbonding_delegations] GenesisState unbonding_delegations + * @property {Array.|null} [redelegations] GenesisState redelegations + * @property {boolean|null} [exported] GenesisState exported + */ + + /** + * Constructs a new GenesisState. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a GenesisState. + * @implements IGenesisState + * @constructor + * @param {cosmos.staking.v1beta1.IGenesisState=} [properties] Properties to set + */ + function GenesisState(properties) { + this.last_validator_powers = []; + this.validators = []; + this.delegations = []; + this.unbonding_delegations = []; + this.redelegations = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenesisState params. + * @member {cosmos.staking.v1beta1.IParams|null|undefined} params + * @memberof cosmos.staking.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.params = null; + + /** + * GenesisState last_total_power. + * @member {Uint8Array} last_total_power + * @memberof cosmos.staking.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.last_total_power = $util.newBuffer([]); + + /** + * GenesisState last_validator_powers. + * @member {Array.} last_validator_powers + * @memberof cosmos.staking.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.last_validator_powers = $util.emptyArray; + + /** + * GenesisState validators. + * @member {Array.} validators + * @memberof cosmos.staking.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.validators = $util.emptyArray; + + /** + * GenesisState delegations. + * @member {Array.} delegations + * @memberof cosmos.staking.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.delegations = $util.emptyArray; + + /** + * GenesisState unbonding_delegations. + * @member {Array.} unbonding_delegations + * @memberof cosmos.staking.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.unbonding_delegations = $util.emptyArray; + + /** + * GenesisState redelegations. + * @member {Array.} redelegations + * @memberof cosmos.staking.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.redelegations = $util.emptyArray; + + /** + * GenesisState exported. + * @member {boolean} exported + * @memberof cosmos.staking.v1beta1.GenesisState + * @instance + */ + GenesisState.prototype.exported = false; + + /** + * Encodes the specified GenesisState message. Does not implicitly {@link cosmos.staking.v1beta1.GenesisState.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.GenesisState + * @static + * @param {cosmos.staking.v1beta1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.params != null && Object.hasOwnProperty.call(message, "params")) + $root.cosmos.staking.v1beta1.Params.encode(message.params, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.last_total_power != null && Object.hasOwnProperty.call(message, "last_total_power")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.last_total_power); + if (message.last_validator_powers != null && message.last_validator_powers.length) + for (let i = 0; i < message.last_validator_powers.length; ++i) + $root.cosmos.staking.v1beta1.LastValidatorPower.encode(message.last_validator_powers[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.validators != null && message.validators.length) + for (let i = 0; i < message.validators.length; ++i) + $root.cosmos.staking.v1beta1.Validator.encode(message.validators[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.delegations != null && message.delegations.length) + for (let i = 0; i < message.delegations.length; ++i) + $root.cosmos.staking.v1beta1.Delegation.encode(message.delegations[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.unbonding_delegations != null && message.unbonding_delegations.length) + for (let i = 0; i < message.unbonding_delegations.length; ++i) + $root.cosmos.staking.v1beta1.UnbondingDelegation.encode(message.unbonding_delegations[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.redelegations != null && message.redelegations.length) + for (let i = 0; i < message.redelegations.length; ++i) + $root.cosmos.staking.v1beta1.Redelegation.encode(message.redelegations[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.exported != null && Object.hasOwnProperty.call(message, "exported")) + writer.uint32(/* id 8, wireType 0 =*/64).bool(message.exported); + return writer; + }; + + /** + * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.GenesisState.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.GenesisState + * @static + * @param {cosmos.staking.v1beta1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.GenesisState(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = $root.cosmos.staking.v1beta1.Params.decode(reader, reader.uint32()); + break; + case 2: + message.last_total_power = reader.bytes(); + break; + case 3: + if (!(message.last_validator_powers && message.last_validator_powers.length)) + message.last_validator_powers = []; + message.last_validator_powers.push($root.cosmos.staking.v1beta1.LastValidatorPower.decode(reader, reader.uint32())); + break; + case 4: + if (!(message.validators && message.validators.length)) + message.validators = []; + message.validators.push($root.cosmos.staking.v1beta1.Validator.decode(reader, reader.uint32())); + break; + case 5: + if (!(message.delegations && message.delegations.length)) + message.delegations = []; + message.delegations.push($root.cosmos.staking.v1beta1.Delegation.decode(reader, reader.uint32())); + break; + case 6: + if (!(message.unbonding_delegations && message.unbonding_delegations.length)) + message.unbonding_delegations = []; + message.unbonding_delegations.push($root.cosmos.staking.v1beta1.UnbondingDelegation.decode(reader, reader.uint32())); + break; + case 7: + if (!(message.redelegations && message.redelegations.length)) + message.redelegations = []; + message.redelegations.push($root.cosmos.staking.v1beta1.Redelegation.decode(reader, reader.uint32())); + break; + case 8: + message.exported = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenesisState message. + * @function verify + * @memberof cosmos.staking.v1beta1.GenesisState + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenesisState.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.params != null && message.hasOwnProperty("params")) { + let error = $root.cosmos.staking.v1beta1.Params.verify(message.params); + if (error) + return "params." + error; + } + if (message.last_total_power != null && message.hasOwnProperty("last_total_power")) + if (!(message.last_total_power && typeof message.last_total_power.length === "number" || $util.isString(message.last_total_power))) + return "last_total_power: buffer expected"; + if (message.last_validator_powers != null && message.hasOwnProperty("last_validator_powers")) { + if (!Array.isArray(message.last_validator_powers)) + return "last_validator_powers: array expected"; + for (let i = 0; i < message.last_validator_powers.length; ++i) { + let error = $root.cosmos.staking.v1beta1.LastValidatorPower.verify(message.last_validator_powers[i]); + if (error) + return "last_validator_powers." + error; + } + } + if (message.validators != null && message.hasOwnProperty("validators")) { + if (!Array.isArray(message.validators)) + return "validators: array expected"; + for (let i = 0; i < message.validators.length; ++i) { + let error = $root.cosmos.staking.v1beta1.Validator.verify(message.validators[i]); + if (error) + return "validators." + error; + } + } + if (message.delegations != null && message.hasOwnProperty("delegations")) { + if (!Array.isArray(message.delegations)) + return "delegations: array expected"; + for (let i = 0; i < message.delegations.length; ++i) { + let error = $root.cosmos.staking.v1beta1.Delegation.verify(message.delegations[i]); + if (error) + return "delegations." + error; + } + } + if (message.unbonding_delegations != null && message.hasOwnProperty("unbonding_delegations")) { + if (!Array.isArray(message.unbonding_delegations)) + return "unbonding_delegations: array expected"; + for (let i = 0; i < message.unbonding_delegations.length; ++i) { + let error = $root.cosmos.staking.v1beta1.UnbondingDelegation.verify(message.unbonding_delegations[i]); + if (error) + return "unbonding_delegations." + error; + } + } + if (message.redelegations != null && message.hasOwnProperty("redelegations")) { + if (!Array.isArray(message.redelegations)) + return "redelegations: array expected"; + for (let i = 0; i < message.redelegations.length; ++i) { + let error = $root.cosmos.staking.v1beta1.Redelegation.verify(message.redelegations[i]); + if (error) + return "redelegations." + error; + } + } + if (message.exported != null && message.hasOwnProperty("exported")) + if (typeof message.exported !== "boolean") + return "exported: boolean expected"; + return null; + }; + + /** + * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.GenesisState + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.GenesisState} GenesisState + */ + GenesisState.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.GenesisState) + return object; + let message = new $root.cosmos.staking.v1beta1.GenesisState(); + if (object.params != null) { + if (typeof object.params !== "object") + throw TypeError(".cosmos.staking.v1beta1.GenesisState.params: object expected"); + message.params = $root.cosmos.staking.v1beta1.Params.fromObject(object.params); + } + if (object.last_total_power != null) + if (typeof object.last_total_power === "string") + $util.base64.decode(object.last_total_power, message.last_total_power = $util.newBuffer($util.base64.length(object.last_total_power)), 0); + else if (object.last_total_power.length) + message.last_total_power = object.last_total_power; + if (object.last_validator_powers) { + if (!Array.isArray(object.last_validator_powers)) + throw TypeError(".cosmos.staking.v1beta1.GenesisState.last_validator_powers: array expected"); + message.last_validator_powers = []; + for (let i = 0; i < object.last_validator_powers.length; ++i) { + if (typeof object.last_validator_powers[i] !== "object") + throw TypeError(".cosmos.staking.v1beta1.GenesisState.last_validator_powers: object expected"); + message.last_validator_powers[i] = $root.cosmos.staking.v1beta1.LastValidatorPower.fromObject(object.last_validator_powers[i]); + } + } + if (object.validators) { + if (!Array.isArray(object.validators)) + throw TypeError(".cosmos.staking.v1beta1.GenesisState.validators: array expected"); + message.validators = []; + for (let i = 0; i < object.validators.length; ++i) { + if (typeof object.validators[i] !== "object") + throw TypeError(".cosmos.staking.v1beta1.GenesisState.validators: object expected"); + message.validators[i] = $root.cosmos.staking.v1beta1.Validator.fromObject(object.validators[i]); + } + } + if (object.delegations) { + if (!Array.isArray(object.delegations)) + throw TypeError(".cosmos.staking.v1beta1.GenesisState.delegations: array expected"); + message.delegations = []; + for (let i = 0; i < object.delegations.length; ++i) { + if (typeof object.delegations[i] !== "object") + throw TypeError(".cosmos.staking.v1beta1.GenesisState.delegations: object expected"); + message.delegations[i] = $root.cosmos.staking.v1beta1.Delegation.fromObject(object.delegations[i]); + } + } + if (object.unbonding_delegations) { + if (!Array.isArray(object.unbonding_delegations)) + throw TypeError(".cosmos.staking.v1beta1.GenesisState.unbonding_delegations: array expected"); + message.unbonding_delegations = []; + for (let i = 0; i < object.unbonding_delegations.length; ++i) { + if (typeof object.unbonding_delegations[i] !== "object") + throw TypeError(".cosmos.staking.v1beta1.GenesisState.unbonding_delegations: object expected"); + message.unbonding_delegations[i] = $root.cosmos.staking.v1beta1.UnbondingDelegation.fromObject(object.unbonding_delegations[i]); + } + } + if (object.redelegations) { + if (!Array.isArray(object.redelegations)) + throw TypeError(".cosmos.staking.v1beta1.GenesisState.redelegations: array expected"); + message.redelegations = []; + for (let i = 0; i < object.redelegations.length; ++i) { + if (typeof object.redelegations[i] !== "object") + throw TypeError(".cosmos.staking.v1beta1.GenesisState.redelegations: object expected"); + message.redelegations[i] = $root.cosmos.staking.v1beta1.Redelegation.fromObject(object.redelegations[i]); + } + } + if (object.exported != null) + message.exported = Boolean(object.exported); + return message; + }; + + /** + * Creates a plain object from a GenesisState message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.GenesisState + * @static + * @param {cosmos.staking.v1beta1.GenesisState} message GenesisState + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenesisState.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) { + object.last_validator_powers = []; + object.validators = []; + object.delegations = []; + object.unbonding_delegations = []; + object.redelegations = []; + } + if (options.defaults) { + object.params = null; + if (options.bytes === String) + object.last_total_power = ""; + else { + object.last_total_power = []; + if (options.bytes !== Array) + object.last_total_power = $util.newBuffer(object.last_total_power); + } + object.exported = false; + } + if (message.params != null && message.hasOwnProperty("params")) + object.params = $root.cosmos.staking.v1beta1.Params.toObject(message.params, options); + if (message.last_total_power != null && message.hasOwnProperty("last_total_power")) + object.last_total_power = options.bytes === String ? $util.base64.encode(message.last_total_power, 0, message.last_total_power.length) : options.bytes === Array ? Array.prototype.slice.call(message.last_total_power) : message.last_total_power; + if (message.last_validator_powers && message.last_validator_powers.length) { + object.last_validator_powers = []; + for (let j = 0; j < message.last_validator_powers.length; ++j) + object.last_validator_powers[j] = $root.cosmos.staking.v1beta1.LastValidatorPower.toObject(message.last_validator_powers[j], options); + } + if (message.validators && message.validators.length) { + object.validators = []; + for (let j = 0; j < message.validators.length; ++j) + object.validators[j] = $root.cosmos.staking.v1beta1.Validator.toObject(message.validators[j], options); + } + if (message.delegations && message.delegations.length) { + object.delegations = []; + for (let j = 0; j < message.delegations.length; ++j) + object.delegations[j] = $root.cosmos.staking.v1beta1.Delegation.toObject(message.delegations[j], options); + } + if (message.unbonding_delegations && message.unbonding_delegations.length) { + object.unbonding_delegations = []; + for (let j = 0; j < message.unbonding_delegations.length; ++j) + object.unbonding_delegations[j] = $root.cosmos.staking.v1beta1.UnbondingDelegation.toObject(message.unbonding_delegations[j], options); + } + if (message.redelegations && message.redelegations.length) { + object.redelegations = []; + for (let j = 0; j < message.redelegations.length; ++j) + object.redelegations[j] = $root.cosmos.staking.v1beta1.Redelegation.toObject(message.redelegations[j], options); + } + if (message.exported != null && message.hasOwnProperty("exported")) + object.exported = message.exported; + return object; + }; + + /** + * Converts this GenesisState to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.GenesisState + * @instance + * @returns {Object.} JSON object + */ + GenesisState.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenesisState; + })(); + + v1beta1.LastValidatorPower = (function() { + + /** + * Properties of a LastValidatorPower. + * @memberof cosmos.staking.v1beta1 + * @interface ILastValidatorPower + * @property {string|null} [address] LastValidatorPower address + * @property {Long|null} [power] LastValidatorPower power + */ + + /** + * Constructs a new LastValidatorPower. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a LastValidatorPower. + * @implements ILastValidatorPower + * @constructor + * @param {cosmos.staking.v1beta1.ILastValidatorPower=} [properties] Properties to set + */ + function LastValidatorPower(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LastValidatorPower address. + * @member {string} address + * @memberof cosmos.staking.v1beta1.LastValidatorPower + * @instance + */ + LastValidatorPower.prototype.address = ""; + + /** + * LastValidatorPower power. + * @member {Long} power + * @memberof cosmos.staking.v1beta1.LastValidatorPower + * @instance + */ + LastValidatorPower.prototype.power = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Encodes the specified LastValidatorPower message. Does not implicitly {@link cosmos.staking.v1beta1.LastValidatorPower.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.LastValidatorPower + * @static + * @param {cosmos.staking.v1beta1.ILastValidatorPower} message LastValidatorPower message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LastValidatorPower.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.address != null && Object.hasOwnProperty.call(message, "address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.address); + if (message.power != null && Object.hasOwnProperty.call(message, "power")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.power); + return writer; + }; + + /** + * Encodes the specified LastValidatorPower message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.LastValidatorPower.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.LastValidatorPower + * @static + * @param {cosmos.staking.v1beta1.ILastValidatorPower} message LastValidatorPower message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LastValidatorPower.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LastValidatorPower message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.LastValidatorPower + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.LastValidatorPower} LastValidatorPower + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LastValidatorPower.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.LastValidatorPower(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.power = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LastValidatorPower message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.LastValidatorPower + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.LastValidatorPower} LastValidatorPower + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LastValidatorPower.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LastValidatorPower message. + * @function verify + * @memberof cosmos.staking.v1beta1.LastValidatorPower + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LastValidatorPower.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.address != null && message.hasOwnProperty("address")) + if (!$util.isString(message.address)) + return "address: string expected"; + if (message.power != null && message.hasOwnProperty("power")) + if (!$util.isInteger(message.power) && !(message.power && $util.isInteger(message.power.low) && $util.isInteger(message.power.high))) + return "power: integer|Long expected"; + return null; + }; + + /** + * Creates a LastValidatorPower message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.LastValidatorPower + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.LastValidatorPower} LastValidatorPower + */ + LastValidatorPower.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.LastValidatorPower) + return object; + let message = new $root.cosmos.staking.v1beta1.LastValidatorPower(); + if (object.address != null) + message.address = String(object.address); + if (object.power != null) + if ($util.Long) + (message.power = $util.Long.fromValue(object.power)).unsigned = false; + else if (typeof object.power === "string") + message.power = parseInt(object.power, 10); + else if (typeof object.power === "number") + message.power = object.power; + else if (typeof object.power === "object") + message.power = new $util.LongBits(object.power.low >>> 0, object.power.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a LastValidatorPower message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.LastValidatorPower + * @static + * @param {cosmos.staking.v1beta1.LastValidatorPower} message LastValidatorPower + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LastValidatorPower.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.address = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.power = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.power = options.longs === String ? "0" : 0; + } + if (message.address != null && message.hasOwnProperty("address")) + object.address = message.address; + if (message.power != null && message.hasOwnProperty("power")) + if (typeof message.power === "number") + object.power = options.longs === String ? String(message.power) : message.power; + else + object.power = options.longs === String ? $util.Long.prototype.toString.call(message.power) : options.longs === Number ? new $util.LongBits(message.power.low >>> 0, message.power.high >>> 0).toNumber() : message.power; + return object; + }; + + /** + * Converts this LastValidatorPower to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.LastValidatorPower + * @instance + * @returns {Object.} JSON object + */ + LastValidatorPower.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return LastValidatorPower; + })(); + + v1beta1.HistoricalInfo = (function() { + + /** + * Properties of a HistoricalInfo. + * @memberof cosmos.staking.v1beta1 + * @interface IHistoricalInfo + * @property {tendermint.types.IHeader|null} [header] HistoricalInfo header + * @property {Array.|null} [valset] HistoricalInfo valset + */ + + /** + * Constructs a new HistoricalInfo. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a HistoricalInfo. + * @implements IHistoricalInfo + * @constructor + * @param {cosmos.staking.v1beta1.IHistoricalInfo=} [properties] Properties to set + */ + function HistoricalInfo(properties) { + this.valset = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HistoricalInfo header. + * @member {tendermint.types.IHeader|null|undefined} header + * @memberof cosmos.staking.v1beta1.HistoricalInfo + * @instance + */ + HistoricalInfo.prototype.header = null; + + /** + * HistoricalInfo valset. + * @member {Array.} valset + * @memberof cosmos.staking.v1beta1.HistoricalInfo + * @instance + */ + HistoricalInfo.prototype.valset = $util.emptyArray; + + /** + * Encodes the specified HistoricalInfo message. Does not implicitly {@link cosmos.staking.v1beta1.HistoricalInfo.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.HistoricalInfo + * @static + * @param {cosmos.staking.v1beta1.IHistoricalInfo} message HistoricalInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HistoricalInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.header != null && Object.hasOwnProperty.call(message, "header")) + $root.tendermint.types.Header.encode(message.header, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.valset != null && message.valset.length) + for (let i = 0; i < message.valset.length; ++i) + $root.cosmos.staking.v1beta1.Validator.encode(message.valset[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified HistoricalInfo message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.HistoricalInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.HistoricalInfo + * @static + * @param {cosmos.staking.v1beta1.IHistoricalInfo} message HistoricalInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HistoricalInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HistoricalInfo message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.HistoricalInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.HistoricalInfo} HistoricalInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HistoricalInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.HistoricalInfo(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.header = $root.tendermint.types.Header.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.valset && message.valset.length)) + message.valset = []; + message.valset.push($root.cosmos.staking.v1beta1.Validator.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HistoricalInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.HistoricalInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.HistoricalInfo} HistoricalInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HistoricalInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HistoricalInfo message. + * @function verify + * @memberof cosmos.staking.v1beta1.HistoricalInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HistoricalInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.header != null && message.hasOwnProperty("header")) { + let error = $root.tendermint.types.Header.verify(message.header); + if (error) + return "header." + error; + } + if (message.valset != null && message.hasOwnProperty("valset")) { + if (!Array.isArray(message.valset)) + return "valset: array expected"; + for (let i = 0; i < message.valset.length; ++i) { + let error = $root.cosmos.staking.v1beta1.Validator.verify(message.valset[i]); + if (error) + return "valset." + error; + } + } + return null; + }; + + /** + * Creates a HistoricalInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.HistoricalInfo + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.HistoricalInfo} HistoricalInfo + */ + HistoricalInfo.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.HistoricalInfo) + return object; + let message = new $root.cosmos.staking.v1beta1.HistoricalInfo(); + if (object.header != null) { + if (typeof object.header !== "object") + throw TypeError(".cosmos.staking.v1beta1.HistoricalInfo.header: object expected"); + message.header = $root.tendermint.types.Header.fromObject(object.header); + } + if (object.valset) { + if (!Array.isArray(object.valset)) + throw TypeError(".cosmos.staking.v1beta1.HistoricalInfo.valset: array expected"); + message.valset = []; + for (let i = 0; i < object.valset.length; ++i) { + if (typeof object.valset[i] !== "object") + throw TypeError(".cosmos.staking.v1beta1.HistoricalInfo.valset: object expected"); + message.valset[i] = $root.cosmos.staking.v1beta1.Validator.fromObject(object.valset[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a HistoricalInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.HistoricalInfo + * @static + * @param {cosmos.staking.v1beta1.HistoricalInfo} message HistoricalInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HistoricalInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.valset = []; + if (options.defaults) + object.header = null; + if (message.header != null && message.hasOwnProperty("header")) + object.header = $root.tendermint.types.Header.toObject(message.header, options); + if (message.valset && message.valset.length) { + object.valset = []; + for (let j = 0; j < message.valset.length; ++j) + object.valset[j] = $root.cosmos.staking.v1beta1.Validator.toObject(message.valset[j], options); + } + return object; + }; + + /** + * Converts this HistoricalInfo to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.HistoricalInfo + * @instance + * @returns {Object.} JSON object + */ + HistoricalInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return HistoricalInfo; + })(); + + v1beta1.CommissionRates = (function() { + + /** + * Properties of a CommissionRates. + * @memberof cosmos.staking.v1beta1 + * @interface ICommissionRates + * @property {string|null} [rate] CommissionRates rate + * @property {string|null} [max_rate] CommissionRates max_rate + * @property {string|null} [max_change_rate] CommissionRates max_change_rate + */ + + /** + * Constructs a new CommissionRates. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a CommissionRates. + * @implements ICommissionRates + * @constructor + * @param {cosmos.staking.v1beta1.ICommissionRates=} [properties] Properties to set + */ + function CommissionRates(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CommissionRates rate. + * @member {string} rate + * @memberof cosmos.staking.v1beta1.CommissionRates + * @instance + */ + CommissionRates.prototype.rate = ""; + + /** + * CommissionRates max_rate. + * @member {string} max_rate + * @memberof cosmos.staking.v1beta1.CommissionRates + * @instance + */ + CommissionRates.prototype.max_rate = ""; + + /** + * CommissionRates max_change_rate. + * @member {string} max_change_rate + * @memberof cosmos.staking.v1beta1.CommissionRates + * @instance + */ + CommissionRates.prototype.max_change_rate = ""; + + /** + * Encodes the specified CommissionRates message. Does not implicitly {@link cosmos.staking.v1beta1.CommissionRates.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.CommissionRates + * @static + * @param {cosmos.staking.v1beta1.ICommissionRates} message CommissionRates message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommissionRates.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rate != null && Object.hasOwnProperty.call(message, "rate")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.rate); + if (message.max_rate != null && Object.hasOwnProperty.call(message, "max_rate")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.max_rate); + if (message.max_change_rate != null && Object.hasOwnProperty.call(message, "max_change_rate")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.max_change_rate); + return writer; + }; + + /** + * Encodes the specified CommissionRates message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.CommissionRates.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.CommissionRates + * @static + * @param {cosmos.staking.v1beta1.ICommissionRates} message CommissionRates message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommissionRates.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CommissionRates message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.CommissionRates + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.CommissionRates} CommissionRates + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommissionRates.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.CommissionRates(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rate = reader.string(); + break; + case 2: + message.max_rate = reader.string(); + break; + case 3: + message.max_change_rate = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CommissionRates message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.CommissionRates + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.CommissionRates} CommissionRates + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommissionRates.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CommissionRates message. + * @function verify + * @memberof cosmos.staking.v1beta1.CommissionRates + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CommissionRates.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rate != null && message.hasOwnProperty("rate")) + if (!$util.isString(message.rate)) + return "rate: string expected"; + if (message.max_rate != null && message.hasOwnProperty("max_rate")) + if (!$util.isString(message.max_rate)) + return "max_rate: string expected"; + if (message.max_change_rate != null && message.hasOwnProperty("max_change_rate")) + if (!$util.isString(message.max_change_rate)) + return "max_change_rate: string expected"; + return null; + }; + + /** + * Creates a CommissionRates message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.CommissionRates + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.CommissionRates} CommissionRates + */ + CommissionRates.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.CommissionRates) + return object; + let message = new $root.cosmos.staking.v1beta1.CommissionRates(); + if (object.rate != null) + message.rate = String(object.rate); + if (object.max_rate != null) + message.max_rate = String(object.max_rate); + if (object.max_change_rate != null) + message.max_change_rate = String(object.max_change_rate); + return message; + }; + + /** + * Creates a plain object from a CommissionRates message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.CommissionRates + * @static + * @param {cosmos.staking.v1beta1.CommissionRates} message CommissionRates + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CommissionRates.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.rate = ""; + object.max_rate = ""; + object.max_change_rate = ""; + } + if (message.rate != null && message.hasOwnProperty("rate")) + object.rate = message.rate; + if (message.max_rate != null && message.hasOwnProperty("max_rate")) + object.max_rate = message.max_rate; + if (message.max_change_rate != null && message.hasOwnProperty("max_change_rate")) + object.max_change_rate = message.max_change_rate; + return object; + }; + + /** + * Converts this CommissionRates to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.CommissionRates + * @instance + * @returns {Object.} JSON object + */ + CommissionRates.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CommissionRates; + })(); + + v1beta1.Commission = (function() { + + /** + * Properties of a Commission. + * @memberof cosmos.staking.v1beta1 + * @interface ICommission + * @property {cosmos.staking.v1beta1.ICommissionRates|null} [commission_rates] Commission commission_rates + * @property {google.protobuf.ITimestamp|null} [update_time] Commission update_time + */ + + /** + * Constructs a new Commission. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a Commission. + * @implements ICommission + * @constructor + * @param {cosmos.staking.v1beta1.ICommission=} [properties] Properties to set + */ + function Commission(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Commission commission_rates. + * @member {cosmos.staking.v1beta1.ICommissionRates|null|undefined} commission_rates + * @memberof cosmos.staking.v1beta1.Commission + * @instance + */ + Commission.prototype.commission_rates = null; + + /** + * Commission update_time. + * @member {google.protobuf.ITimestamp|null|undefined} update_time + * @memberof cosmos.staking.v1beta1.Commission + * @instance + */ + Commission.prototype.update_time = null; + + /** + * Encodes the specified Commission message. Does not implicitly {@link cosmos.staking.v1beta1.Commission.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.Commission + * @static + * @param {cosmos.staking.v1beta1.ICommission} message Commission message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Commission.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commission_rates != null && Object.hasOwnProperty.call(message, "commission_rates")) + $root.cosmos.staking.v1beta1.CommissionRates.encode(message.commission_rates, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.update_time != null && Object.hasOwnProperty.call(message, "update_time")) + $root.google.protobuf.Timestamp.encode(message.update_time, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Commission message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.Commission.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.Commission + * @static + * @param {cosmos.staking.v1beta1.ICommission} message Commission message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Commission.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Commission message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.Commission + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.Commission} Commission + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Commission.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.Commission(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commission_rates = $root.cosmos.staking.v1beta1.CommissionRates.decode(reader, reader.uint32()); + break; + case 2: + message.update_time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Commission message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.Commission + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.Commission} Commission + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Commission.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Commission message. + * @function verify + * @memberof cosmos.staking.v1beta1.Commission + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Commission.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.commission_rates != null && message.hasOwnProperty("commission_rates")) { + let error = $root.cosmos.staking.v1beta1.CommissionRates.verify(message.commission_rates); + if (error) + return "commission_rates." + error; + } + if (message.update_time != null && message.hasOwnProperty("update_time")) { + let error = $root.google.protobuf.Timestamp.verify(message.update_time); + if (error) + return "update_time." + error; + } + return null; + }; + + /** + * Creates a Commission message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.Commission + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.Commission} Commission + */ + Commission.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.Commission) + return object; + let message = new $root.cosmos.staking.v1beta1.Commission(); + if (object.commission_rates != null) { + if (typeof object.commission_rates !== "object") + throw TypeError(".cosmos.staking.v1beta1.Commission.commission_rates: object expected"); + message.commission_rates = $root.cosmos.staking.v1beta1.CommissionRates.fromObject(object.commission_rates); + } + if (object.update_time != null) { + if (typeof object.update_time !== "object") + throw TypeError(".cosmos.staking.v1beta1.Commission.update_time: object expected"); + message.update_time = $root.google.protobuf.Timestamp.fromObject(object.update_time); + } + return message; + }; + + /** + * Creates a plain object from a Commission message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.Commission + * @static + * @param {cosmos.staking.v1beta1.Commission} message Commission + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Commission.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.commission_rates = null; + object.update_time = null; + } + if (message.commission_rates != null && message.hasOwnProperty("commission_rates")) + object.commission_rates = $root.cosmos.staking.v1beta1.CommissionRates.toObject(message.commission_rates, options); + if (message.update_time != null && message.hasOwnProperty("update_time")) + object.update_time = $root.google.protobuf.Timestamp.toObject(message.update_time, options); + return object; + }; + + /** + * Converts this Commission to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.Commission + * @instance + * @returns {Object.} JSON object + */ + Commission.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Commission; + })(); + + v1beta1.Description = (function() { + + /** + * Properties of a Description. + * @memberof cosmos.staking.v1beta1 + * @interface IDescription + * @property {string|null} [moniker] Description moniker + * @property {string|null} [identity] Description identity + * @property {string|null} [website] Description website + * @property {string|null} [security_contact] Description security_contact + * @property {string|null} [details] Description details + */ + + /** + * Constructs a new Description. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a Description. + * @implements IDescription + * @constructor + * @param {cosmos.staking.v1beta1.IDescription=} [properties] Properties to set + */ + function Description(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Description moniker. + * @member {string} moniker + * @memberof cosmos.staking.v1beta1.Description + * @instance + */ + Description.prototype.moniker = ""; + + /** + * Description identity. + * @member {string} identity + * @memberof cosmos.staking.v1beta1.Description + * @instance + */ + Description.prototype.identity = ""; + + /** + * Description website. + * @member {string} website + * @memberof cosmos.staking.v1beta1.Description + * @instance + */ + Description.prototype.website = ""; + + /** + * Description security_contact. + * @member {string} security_contact + * @memberof cosmos.staking.v1beta1.Description + * @instance + */ + Description.prototype.security_contact = ""; + + /** + * Description details. + * @member {string} details + * @memberof cosmos.staking.v1beta1.Description + * @instance + */ + Description.prototype.details = ""; + + /** + * Encodes the specified Description message. Does not implicitly {@link cosmos.staking.v1beta1.Description.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.Description + * @static + * @param {cosmos.staking.v1beta1.IDescription} message Description message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Description.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.moniker != null && Object.hasOwnProperty.call(message, "moniker")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.moniker); + if (message.identity != null && Object.hasOwnProperty.call(message, "identity")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.identity); + if (message.website != null && Object.hasOwnProperty.call(message, "website")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.website); + if (message.security_contact != null && Object.hasOwnProperty.call(message, "security_contact")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.security_contact); + if (message.details != null && Object.hasOwnProperty.call(message, "details")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.details); + return writer; + }; + + /** + * Encodes the specified Description message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.Description.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.Description + * @static + * @param {cosmos.staking.v1beta1.IDescription} message Description message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Description.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Description message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.Description + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.Description} Description + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Description.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.Description(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.moniker = reader.string(); + break; + case 2: + message.identity = reader.string(); + break; + case 3: + message.website = reader.string(); + break; + case 4: + message.security_contact = reader.string(); + break; + case 5: + message.details = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Description message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.Description + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.Description} Description + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Description.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Description message. + * @function verify + * @memberof cosmos.staking.v1beta1.Description + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Description.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.moniker != null && message.hasOwnProperty("moniker")) + if (!$util.isString(message.moniker)) + return "moniker: string expected"; + if (message.identity != null && message.hasOwnProperty("identity")) + if (!$util.isString(message.identity)) + return "identity: string expected"; + if (message.website != null && message.hasOwnProperty("website")) + if (!$util.isString(message.website)) + return "website: string expected"; + if (message.security_contact != null && message.hasOwnProperty("security_contact")) + if (!$util.isString(message.security_contact)) + return "security_contact: string expected"; + if (message.details != null && message.hasOwnProperty("details")) + if (!$util.isString(message.details)) + return "details: string expected"; + return null; + }; + + /** + * Creates a Description message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.Description + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.Description} Description + */ + Description.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.Description) + return object; + let message = new $root.cosmos.staking.v1beta1.Description(); + if (object.moniker != null) + message.moniker = String(object.moniker); + if (object.identity != null) + message.identity = String(object.identity); + if (object.website != null) + message.website = String(object.website); + if (object.security_contact != null) + message.security_contact = String(object.security_contact); + if (object.details != null) + message.details = String(object.details); + return message; + }; + + /** + * Creates a plain object from a Description message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.Description + * @static + * @param {cosmos.staking.v1beta1.Description} message Description + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Description.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.moniker = ""; + object.identity = ""; + object.website = ""; + object.security_contact = ""; + object.details = ""; + } + if (message.moniker != null && message.hasOwnProperty("moniker")) + object.moniker = message.moniker; + if (message.identity != null && message.hasOwnProperty("identity")) + object.identity = message.identity; + if (message.website != null && message.hasOwnProperty("website")) + object.website = message.website; + if (message.security_contact != null && message.hasOwnProperty("security_contact")) + object.security_contact = message.security_contact; + if (message.details != null && message.hasOwnProperty("details")) + object.details = message.details; + return object; + }; + + /** + * Converts this Description to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.Description + * @instance + * @returns {Object.} JSON object + */ + Description.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Description; + })(); + + v1beta1.Validator = (function() { + + /** + * Properties of a Validator. + * @memberof cosmos.staking.v1beta1 + * @interface IValidator + * @property {string|null} [operator_address] Validator operator_address + * @property {google.protobuf.IAny|null} [consensus_pubkey] Validator consensus_pubkey + * @property {boolean|null} [jailed] Validator jailed + * @property {cosmos.staking.v1beta1.BondStatus|null} [status] Validator status + * @property {string|null} [tokens] Validator tokens + * @property {string|null} [delegator_shares] Validator delegator_shares + * @property {cosmos.staking.v1beta1.IDescription|null} [description] Validator description + * @property {Long|null} [unbonding_height] Validator unbonding_height + * @property {google.protobuf.ITimestamp|null} [unbonding_time] Validator unbonding_time + * @property {cosmos.staking.v1beta1.ICommission|null} [commission] Validator commission + * @property {string|null} [min_self_delegation] Validator min_self_delegation + */ + + /** + * Constructs a new Validator. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a Validator. + * @implements IValidator + * @constructor + * @param {cosmos.staking.v1beta1.IValidator=} [properties] Properties to set + */ + function Validator(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Validator operator_address. + * @member {string} operator_address + * @memberof cosmos.staking.v1beta1.Validator + * @instance + */ + Validator.prototype.operator_address = ""; + + /** + * Validator consensus_pubkey. + * @member {google.protobuf.IAny|null|undefined} consensus_pubkey + * @memberof cosmos.staking.v1beta1.Validator + * @instance + */ + Validator.prototype.consensus_pubkey = null; + + /** + * Validator jailed. + * @member {boolean} jailed + * @memberof cosmos.staking.v1beta1.Validator + * @instance + */ + Validator.prototype.jailed = false; + + /** + * Validator status. + * @member {cosmos.staking.v1beta1.BondStatus} status + * @memberof cosmos.staking.v1beta1.Validator + * @instance + */ + Validator.prototype.status = 0; + + /** + * Validator tokens. + * @member {string} tokens + * @memberof cosmos.staking.v1beta1.Validator + * @instance + */ + Validator.prototype.tokens = ""; + + /** + * Validator delegator_shares. + * @member {string} delegator_shares + * @memberof cosmos.staking.v1beta1.Validator + * @instance + */ + Validator.prototype.delegator_shares = ""; + + /** + * Validator description. + * @member {cosmos.staking.v1beta1.IDescription|null|undefined} description + * @memberof cosmos.staking.v1beta1.Validator + * @instance + */ + Validator.prototype.description = null; + + /** + * Validator unbonding_height. + * @member {Long} unbonding_height + * @memberof cosmos.staking.v1beta1.Validator + * @instance + */ + Validator.prototype.unbonding_height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Validator unbonding_time. + * @member {google.protobuf.ITimestamp|null|undefined} unbonding_time + * @memberof cosmos.staking.v1beta1.Validator + * @instance + */ + Validator.prototype.unbonding_time = null; + + /** + * Validator commission. + * @member {cosmos.staking.v1beta1.ICommission|null|undefined} commission + * @memberof cosmos.staking.v1beta1.Validator + * @instance + */ + Validator.prototype.commission = null; + + /** + * Validator min_self_delegation. + * @member {string} min_self_delegation + * @memberof cosmos.staking.v1beta1.Validator + * @instance + */ + Validator.prototype.min_self_delegation = ""; + + /** + * Encodes the specified Validator message. Does not implicitly {@link cosmos.staking.v1beta1.Validator.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.Validator + * @static + * @param {cosmos.staking.v1beta1.IValidator} message Validator message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Validator.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.operator_address != null && Object.hasOwnProperty.call(message, "operator_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.operator_address); + if (message.consensus_pubkey != null && Object.hasOwnProperty.call(message, "consensus_pubkey")) + $root.google.protobuf.Any.encode(message.consensus_pubkey, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.jailed != null && Object.hasOwnProperty.call(message, "jailed")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.jailed); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.status); + if (message.tokens != null && Object.hasOwnProperty.call(message, "tokens")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.tokens); + if (message.delegator_shares != null && Object.hasOwnProperty.call(message, "delegator_shares")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.delegator_shares); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + $root.cosmos.staking.v1beta1.Description.encode(message.description, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.unbonding_height != null && Object.hasOwnProperty.call(message, "unbonding_height")) + writer.uint32(/* id 8, wireType 0 =*/64).int64(message.unbonding_height); + if (message.unbonding_time != null && Object.hasOwnProperty.call(message, "unbonding_time")) + $root.google.protobuf.Timestamp.encode(message.unbonding_time, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.commission != null && Object.hasOwnProperty.call(message, "commission")) + $root.cosmos.staking.v1beta1.Commission.encode(message.commission, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.min_self_delegation != null && Object.hasOwnProperty.call(message, "min_self_delegation")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.min_self_delegation); + return writer; + }; + + /** + * Encodes the specified Validator message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.Validator.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.Validator + * @static + * @param {cosmos.staking.v1beta1.IValidator} message Validator message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Validator.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Validator message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.Validator + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.Validator} Validator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Validator.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.Validator(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.operator_address = reader.string(); + break; + case 2: + message.consensus_pubkey = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 3: + message.jailed = reader.bool(); + break; + case 4: + message.status = reader.int32(); + break; + case 5: + message.tokens = reader.string(); + break; + case 6: + message.delegator_shares = reader.string(); + break; + case 7: + message.description = $root.cosmos.staking.v1beta1.Description.decode(reader, reader.uint32()); + break; + case 8: + message.unbonding_height = reader.int64(); + break; + case 9: + message.unbonding_time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 10: + message.commission = $root.cosmos.staking.v1beta1.Commission.decode(reader, reader.uint32()); + break; + case 11: + message.min_self_delegation = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Validator message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.Validator + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.Validator} Validator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Validator.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Validator message. + * @function verify + * @memberof cosmos.staking.v1beta1.Validator + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Validator.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.operator_address != null && message.hasOwnProperty("operator_address")) + if (!$util.isString(message.operator_address)) + return "operator_address: string expected"; + if (message.consensus_pubkey != null && message.hasOwnProperty("consensus_pubkey")) { + let error = $root.google.protobuf.Any.verify(message.consensus_pubkey); + if (error) + return "consensus_pubkey." + error; + } + if (message.jailed != null && message.hasOwnProperty("jailed")) + if (typeof message.jailed !== "boolean") + return "jailed: boolean expected"; + if (message.status != null && message.hasOwnProperty("status")) + switch (message.status) { + default: + return "status: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.tokens != null && message.hasOwnProperty("tokens")) + if (!$util.isString(message.tokens)) + return "tokens: string expected"; + if (message.delegator_shares != null && message.hasOwnProperty("delegator_shares")) + if (!$util.isString(message.delegator_shares)) + return "delegator_shares: string expected"; + if (message.description != null && message.hasOwnProperty("description")) { + let error = $root.cosmos.staking.v1beta1.Description.verify(message.description); + if (error) + return "description." + error; + } + if (message.unbonding_height != null && message.hasOwnProperty("unbonding_height")) + if (!$util.isInteger(message.unbonding_height) && !(message.unbonding_height && $util.isInteger(message.unbonding_height.low) && $util.isInteger(message.unbonding_height.high))) + return "unbonding_height: integer|Long expected"; + if (message.unbonding_time != null && message.hasOwnProperty("unbonding_time")) { + let error = $root.google.protobuf.Timestamp.verify(message.unbonding_time); + if (error) + return "unbonding_time." + error; + } + if (message.commission != null && message.hasOwnProperty("commission")) { + let error = $root.cosmos.staking.v1beta1.Commission.verify(message.commission); + if (error) + return "commission." + error; + } + if (message.min_self_delegation != null && message.hasOwnProperty("min_self_delegation")) + if (!$util.isString(message.min_self_delegation)) + return "min_self_delegation: string expected"; + return null; + }; + + /** + * Creates a Validator message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.Validator + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.Validator} Validator + */ + Validator.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.Validator) + return object; + let message = new $root.cosmos.staking.v1beta1.Validator(); + if (object.operator_address != null) + message.operator_address = String(object.operator_address); + if (object.consensus_pubkey != null) { + if (typeof object.consensus_pubkey !== "object") + throw TypeError(".cosmos.staking.v1beta1.Validator.consensus_pubkey: object expected"); + message.consensus_pubkey = $root.google.protobuf.Any.fromObject(object.consensus_pubkey); + } + if (object.jailed != null) + message.jailed = Boolean(object.jailed); + switch (object.status) { + case "BOND_STATUS_UNSPECIFIED": + case 0: + message.status = 0; + break; + case "BOND_STATUS_UNBONDED": + case 1: + message.status = 1; + break; + case "BOND_STATUS_UNBONDING": + case 2: + message.status = 2; + break; + case "BOND_STATUS_BONDED": + case 3: + message.status = 3; + break; + } + if (object.tokens != null) + message.tokens = String(object.tokens); + if (object.delegator_shares != null) + message.delegator_shares = String(object.delegator_shares); + if (object.description != null) { + if (typeof object.description !== "object") + throw TypeError(".cosmos.staking.v1beta1.Validator.description: object expected"); + message.description = $root.cosmos.staking.v1beta1.Description.fromObject(object.description); + } + if (object.unbonding_height != null) + if ($util.Long) + (message.unbonding_height = $util.Long.fromValue(object.unbonding_height)).unsigned = false; + else if (typeof object.unbonding_height === "string") + message.unbonding_height = parseInt(object.unbonding_height, 10); + else if (typeof object.unbonding_height === "number") + message.unbonding_height = object.unbonding_height; + else if (typeof object.unbonding_height === "object") + message.unbonding_height = new $util.LongBits(object.unbonding_height.low >>> 0, object.unbonding_height.high >>> 0).toNumber(); + if (object.unbonding_time != null) { + if (typeof object.unbonding_time !== "object") + throw TypeError(".cosmos.staking.v1beta1.Validator.unbonding_time: object expected"); + message.unbonding_time = $root.google.protobuf.Timestamp.fromObject(object.unbonding_time); + } + if (object.commission != null) { + if (typeof object.commission !== "object") + throw TypeError(".cosmos.staking.v1beta1.Validator.commission: object expected"); + message.commission = $root.cosmos.staking.v1beta1.Commission.fromObject(object.commission); + } + if (object.min_self_delegation != null) + message.min_self_delegation = String(object.min_self_delegation); + return message; + }; + + /** + * Creates a plain object from a Validator message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.Validator + * @static + * @param {cosmos.staking.v1beta1.Validator} message Validator + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Validator.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.operator_address = ""; + object.consensus_pubkey = null; + object.jailed = false; + object.status = options.enums === String ? "BOND_STATUS_UNSPECIFIED" : 0; + object.tokens = ""; + object.delegator_shares = ""; + object.description = null; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.unbonding_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.unbonding_height = options.longs === String ? "0" : 0; + object.unbonding_time = null; + object.commission = null; + object.min_self_delegation = ""; + } + if (message.operator_address != null && message.hasOwnProperty("operator_address")) + object.operator_address = message.operator_address; + if (message.consensus_pubkey != null && message.hasOwnProperty("consensus_pubkey")) + object.consensus_pubkey = $root.google.protobuf.Any.toObject(message.consensus_pubkey, options); + if (message.jailed != null && message.hasOwnProperty("jailed")) + object.jailed = message.jailed; + if (message.status != null && message.hasOwnProperty("status")) + object.status = options.enums === String ? $root.cosmos.staking.v1beta1.BondStatus[message.status] : message.status; + if (message.tokens != null && message.hasOwnProperty("tokens")) + object.tokens = message.tokens; + if (message.delegator_shares != null && message.hasOwnProperty("delegator_shares")) + object.delegator_shares = message.delegator_shares; + if (message.description != null && message.hasOwnProperty("description")) + object.description = $root.cosmos.staking.v1beta1.Description.toObject(message.description, options); + if (message.unbonding_height != null && message.hasOwnProperty("unbonding_height")) + if (typeof message.unbonding_height === "number") + object.unbonding_height = options.longs === String ? String(message.unbonding_height) : message.unbonding_height; + else + object.unbonding_height = options.longs === String ? $util.Long.prototype.toString.call(message.unbonding_height) : options.longs === Number ? new $util.LongBits(message.unbonding_height.low >>> 0, message.unbonding_height.high >>> 0).toNumber() : message.unbonding_height; + if (message.unbonding_time != null && message.hasOwnProperty("unbonding_time")) + object.unbonding_time = $root.google.protobuf.Timestamp.toObject(message.unbonding_time, options); + if (message.commission != null && message.hasOwnProperty("commission")) + object.commission = $root.cosmos.staking.v1beta1.Commission.toObject(message.commission, options); + if (message.min_self_delegation != null && message.hasOwnProperty("min_self_delegation")) + object.min_self_delegation = message.min_self_delegation; + return object; + }; + + /** + * Converts this Validator to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.Validator + * @instance + * @returns {Object.} JSON object + */ + Validator.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Validator; + })(); + + /** + * BondStatus enum. + * @name cosmos.staking.v1beta1.BondStatus + * @enum {number} + * @property {number} BOND_STATUS_UNSPECIFIED=0 BOND_STATUS_UNSPECIFIED value + * @property {number} BOND_STATUS_UNBONDED=1 BOND_STATUS_UNBONDED value + * @property {number} BOND_STATUS_UNBONDING=2 BOND_STATUS_UNBONDING value + * @property {number} BOND_STATUS_BONDED=3 BOND_STATUS_BONDED value + */ + v1beta1.BondStatus = (function() { + const valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "BOND_STATUS_UNSPECIFIED"] = 0; + values[valuesById[1] = "BOND_STATUS_UNBONDED"] = 1; + values[valuesById[2] = "BOND_STATUS_UNBONDING"] = 2; + values[valuesById[3] = "BOND_STATUS_BONDED"] = 3; + return values; + })(); + + v1beta1.ValAddresses = (function() { + + /** + * Properties of a ValAddresses. + * @memberof cosmos.staking.v1beta1 + * @interface IValAddresses + * @property {Array.|null} [addresses] ValAddresses addresses + */ + + /** + * Constructs a new ValAddresses. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a ValAddresses. + * @implements IValAddresses + * @constructor + * @param {cosmos.staking.v1beta1.IValAddresses=} [properties] Properties to set + */ + function ValAddresses(properties) { + this.addresses = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ValAddresses addresses. + * @member {Array.} addresses + * @memberof cosmos.staking.v1beta1.ValAddresses + * @instance + */ + ValAddresses.prototype.addresses = $util.emptyArray; + + /** + * Encodes the specified ValAddresses message. Does not implicitly {@link cosmos.staking.v1beta1.ValAddresses.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.ValAddresses + * @static + * @param {cosmos.staking.v1beta1.IValAddresses} message ValAddresses message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValAddresses.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.addresses != null && message.addresses.length) + for (let i = 0; i < message.addresses.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.addresses[i]); + return writer; + }; + + /** + * Encodes the specified ValAddresses message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.ValAddresses.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.ValAddresses + * @static + * @param {cosmos.staking.v1beta1.IValAddresses} message ValAddresses message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValAddresses.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ValAddresses message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.ValAddresses + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.ValAddresses} ValAddresses + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValAddresses.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.ValAddresses(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.addresses && message.addresses.length)) + message.addresses = []; + message.addresses.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ValAddresses message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.ValAddresses + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.ValAddresses} ValAddresses + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValAddresses.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ValAddresses message. + * @function verify + * @memberof cosmos.staking.v1beta1.ValAddresses + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ValAddresses.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.addresses != null && message.hasOwnProperty("addresses")) { + if (!Array.isArray(message.addresses)) + return "addresses: array expected"; + for (let i = 0; i < message.addresses.length; ++i) + if (!$util.isString(message.addresses[i])) + return "addresses: string[] expected"; + } + return null; + }; + + /** + * Creates a ValAddresses message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.ValAddresses + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.ValAddresses} ValAddresses + */ + ValAddresses.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.ValAddresses) + return object; + let message = new $root.cosmos.staking.v1beta1.ValAddresses(); + if (object.addresses) { + if (!Array.isArray(object.addresses)) + throw TypeError(".cosmos.staking.v1beta1.ValAddresses.addresses: array expected"); + message.addresses = []; + for (let i = 0; i < object.addresses.length; ++i) + message.addresses[i] = String(object.addresses[i]); + } + return message; + }; + + /** + * Creates a plain object from a ValAddresses message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.ValAddresses + * @static + * @param {cosmos.staking.v1beta1.ValAddresses} message ValAddresses + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ValAddresses.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.addresses = []; + if (message.addresses && message.addresses.length) { + object.addresses = []; + for (let j = 0; j < message.addresses.length; ++j) + object.addresses[j] = message.addresses[j]; + } + return object; + }; + + /** + * Converts this ValAddresses to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.ValAddresses + * @instance + * @returns {Object.} JSON object + */ + ValAddresses.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ValAddresses; + })(); + + v1beta1.DVPair = (function() { + + /** + * Properties of a DVPair. + * @memberof cosmos.staking.v1beta1 + * @interface IDVPair + * @property {string|null} [delegator_address] DVPair delegator_address + * @property {string|null} [validator_address] DVPair validator_address + */ + + /** + * Constructs a new DVPair. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a DVPair. + * @implements IDVPair + * @constructor + * @param {cosmos.staking.v1beta1.IDVPair=} [properties] Properties to set + */ + function DVPair(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DVPair delegator_address. + * @member {string} delegator_address + * @memberof cosmos.staking.v1beta1.DVPair + * @instance + */ + DVPair.prototype.delegator_address = ""; + + /** + * DVPair validator_address. + * @member {string} validator_address + * @memberof cosmos.staking.v1beta1.DVPair + * @instance + */ + DVPair.prototype.validator_address = ""; + + /** + * Encodes the specified DVPair message. Does not implicitly {@link cosmos.staking.v1beta1.DVPair.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.DVPair + * @static + * @param {cosmos.staking.v1beta1.IDVPair} message DVPair message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DVPair.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); + if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.validator_address); + return writer; + }; + + /** + * Encodes the specified DVPair message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.DVPair.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.DVPair + * @static + * @param {cosmos.staking.v1beta1.IDVPair} message DVPair message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DVPair.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DVPair message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.DVPair + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.DVPair} DVPair + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DVPair.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.DVPair(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_address = reader.string(); + break; + case 2: + message.validator_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DVPair message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.DVPair + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.DVPair} DVPair + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DVPair.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DVPair message. + * @function verify + * @memberof cosmos.staking.v1beta1.DVPair + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DVPair.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + if (!$util.isString(message.delegator_address)) + return "delegator_address: string expected"; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + if (!$util.isString(message.validator_address)) + return "validator_address: string expected"; + return null; + }; + + /** + * Creates a DVPair message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.DVPair + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.DVPair} DVPair + */ + DVPair.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.DVPair) + return object; + let message = new $root.cosmos.staking.v1beta1.DVPair(); + if (object.delegator_address != null) + message.delegator_address = String(object.delegator_address); + if (object.validator_address != null) + message.validator_address = String(object.validator_address); + return message; + }; + + /** + * Creates a plain object from a DVPair message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.DVPair + * @static + * @param {cosmos.staking.v1beta1.DVPair} message DVPair + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DVPair.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.delegator_address = ""; + object.validator_address = ""; + } + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + object.delegator_address = message.delegator_address; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + object.validator_address = message.validator_address; + return object; + }; + + /** + * Converts this DVPair to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.DVPair + * @instance + * @returns {Object.} JSON object + */ + DVPair.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DVPair; + })(); + + v1beta1.DVPairs = (function() { + + /** + * Properties of a DVPairs. + * @memberof cosmos.staking.v1beta1 + * @interface IDVPairs + * @property {Array.|null} [pairs] DVPairs pairs + */ + + /** + * Constructs a new DVPairs. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a DVPairs. + * @implements IDVPairs + * @constructor + * @param {cosmos.staking.v1beta1.IDVPairs=} [properties] Properties to set + */ + function DVPairs(properties) { + this.pairs = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DVPairs pairs. + * @member {Array.} pairs + * @memberof cosmos.staking.v1beta1.DVPairs + * @instance + */ + DVPairs.prototype.pairs = $util.emptyArray; + + /** + * Encodes the specified DVPairs message. Does not implicitly {@link cosmos.staking.v1beta1.DVPairs.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.DVPairs + * @static + * @param {cosmos.staking.v1beta1.IDVPairs} message DVPairs message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DVPairs.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pairs != null && message.pairs.length) + for (let i = 0; i < message.pairs.length; ++i) + $root.cosmos.staking.v1beta1.DVPair.encode(message.pairs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DVPairs message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.DVPairs.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.DVPairs + * @static + * @param {cosmos.staking.v1beta1.IDVPairs} message DVPairs message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DVPairs.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DVPairs message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.DVPairs + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.DVPairs} DVPairs + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DVPairs.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.DVPairs(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.pairs && message.pairs.length)) + message.pairs = []; + message.pairs.push($root.cosmos.staking.v1beta1.DVPair.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DVPairs message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.DVPairs + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.DVPairs} DVPairs + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DVPairs.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DVPairs message. + * @function verify + * @memberof cosmos.staking.v1beta1.DVPairs + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DVPairs.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pairs != null && message.hasOwnProperty("pairs")) { + if (!Array.isArray(message.pairs)) + return "pairs: array expected"; + for (let i = 0; i < message.pairs.length; ++i) { + let error = $root.cosmos.staking.v1beta1.DVPair.verify(message.pairs[i]); + if (error) + return "pairs." + error; + } + } + return null; + }; + + /** + * Creates a DVPairs message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.DVPairs + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.DVPairs} DVPairs + */ + DVPairs.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.DVPairs) + return object; + let message = new $root.cosmos.staking.v1beta1.DVPairs(); + if (object.pairs) { + if (!Array.isArray(object.pairs)) + throw TypeError(".cosmos.staking.v1beta1.DVPairs.pairs: array expected"); + message.pairs = []; + for (let i = 0; i < object.pairs.length; ++i) { + if (typeof object.pairs[i] !== "object") + throw TypeError(".cosmos.staking.v1beta1.DVPairs.pairs: object expected"); + message.pairs[i] = $root.cosmos.staking.v1beta1.DVPair.fromObject(object.pairs[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a DVPairs message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.DVPairs + * @static + * @param {cosmos.staking.v1beta1.DVPairs} message DVPairs + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DVPairs.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.pairs = []; + if (message.pairs && message.pairs.length) { + object.pairs = []; + for (let j = 0; j < message.pairs.length; ++j) + object.pairs[j] = $root.cosmos.staking.v1beta1.DVPair.toObject(message.pairs[j], options); + } + return object; + }; + + /** + * Converts this DVPairs to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.DVPairs + * @instance + * @returns {Object.} JSON object + */ + DVPairs.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DVPairs; + })(); + + v1beta1.DVVTriplet = (function() { + + /** + * Properties of a DVVTriplet. + * @memberof cosmos.staking.v1beta1 + * @interface IDVVTriplet + * @property {string|null} [delegator_address] DVVTriplet delegator_address + * @property {string|null} [validator_src_address] DVVTriplet validator_src_address + * @property {string|null} [validator_dst_address] DVVTriplet validator_dst_address + */ + + /** + * Constructs a new DVVTriplet. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a DVVTriplet. + * @implements IDVVTriplet + * @constructor + * @param {cosmos.staking.v1beta1.IDVVTriplet=} [properties] Properties to set + */ + function DVVTriplet(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DVVTriplet delegator_address. + * @member {string} delegator_address + * @memberof cosmos.staking.v1beta1.DVVTriplet + * @instance + */ + DVVTriplet.prototype.delegator_address = ""; + + /** + * DVVTriplet validator_src_address. + * @member {string} validator_src_address + * @memberof cosmos.staking.v1beta1.DVVTriplet + * @instance + */ + DVVTriplet.prototype.validator_src_address = ""; + + /** + * DVVTriplet validator_dst_address. + * @member {string} validator_dst_address + * @memberof cosmos.staking.v1beta1.DVVTriplet + * @instance + */ + DVVTriplet.prototype.validator_dst_address = ""; + + /** + * Encodes the specified DVVTriplet message. Does not implicitly {@link cosmos.staking.v1beta1.DVVTriplet.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.DVVTriplet + * @static + * @param {cosmos.staking.v1beta1.IDVVTriplet} message DVVTriplet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DVVTriplet.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); + if (message.validator_src_address != null && Object.hasOwnProperty.call(message, "validator_src_address")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.validator_src_address); + if (message.validator_dst_address != null && Object.hasOwnProperty.call(message, "validator_dst_address")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.validator_dst_address); + return writer; + }; + + /** + * Encodes the specified DVVTriplet message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.DVVTriplet.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.DVVTriplet + * @static + * @param {cosmos.staking.v1beta1.IDVVTriplet} message DVVTriplet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DVVTriplet.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DVVTriplet message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.DVVTriplet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.DVVTriplet} DVVTriplet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DVVTriplet.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.DVVTriplet(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_address = reader.string(); + break; + case 2: + message.validator_src_address = reader.string(); + break; + case 3: + message.validator_dst_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DVVTriplet message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.DVVTriplet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.DVVTriplet} DVVTriplet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DVVTriplet.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DVVTriplet message. + * @function verify + * @memberof cosmos.staking.v1beta1.DVVTriplet + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DVVTriplet.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + if (!$util.isString(message.delegator_address)) + return "delegator_address: string expected"; + if (message.validator_src_address != null && message.hasOwnProperty("validator_src_address")) + if (!$util.isString(message.validator_src_address)) + return "validator_src_address: string expected"; + if (message.validator_dst_address != null && message.hasOwnProperty("validator_dst_address")) + if (!$util.isString(message.validator_dst_address)) + return "validator_dst_address: string expected"; + return null; + }; + + /** + * Creates a DVVTriplet message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.DVVTriplet + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.DVVTriplet} DVVTriplet + */ + DVVTriplet.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.DVVTriplet) + return object; + let message = new $root.cosmos.staking.v1beta1.DVVTriplet(); + if (object.delegator_address != null) + message.delegator_address = String(object.delegator_address); + if (object.validator_src_address != null) + message.validator_src_address = String(object.validator_src_address); + if (object.validator_dst_address != null) + message.validator_dst_address = String(object.validator_dst_address); + return message; + }; + + /** + * Creates a plain object from a DVVTriplet message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.DVVTriplet + * @static + * @param {cosmos.staking.v1beta1.DVVTriplet} message DVVTriplet + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DVVTriplet.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.delegator_address = ""; + object.validator_src_address = ""; + object.validator_dst_address = ""; + } + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + object.delegator_address = message.delegator_address; + if (message.validator_src_address != null && message.hasOwnProperty("validator_src_address")) + object.validator_src_address = message.validator_src_address; + if (message.validator_dst_address != null && message.hasOwnProperty("validator_dst_address")) + object.validator_dst_address = message.validator_dst_address; + return object; + }; + + /** + * Converts this DVVTriplet to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.DVVTriplet + * @instance + * @returns {Object.} JSON object + */ + DVVTriplet.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DVVTriplet; + })(); + + v1beta1.DVVTriplets = (function() { + + /** + * Properties of a DVVTriplets. + * @memberof cosmos.staking.v1beta1 + * @interface IDVVTriplets + * @property {Array.|null} [triplets] DVVTriplets triplets + */ + + /** + * Constructs a new DVVTriplets. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a DVVTriplets. + * @implements IDVVTriplets + * @constructor + * @param {cosmos.staking.v1beta1.IDVVTriplets=} [properties] Properties to set + */ + function DVVTriplets(properties) { + this.triplets = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DVVTriplets triplets. + * @member {Array.} triplets + * @memberof cosmos.staking.v1beta1.DVVTriplets + * @instance + */ + DVVTriplets.prototype.triplets = $util.emptyArray; + + /** + * Encodes the specified DVVTriplets message. Does not implicitly {@link cosmos.staking.v1beta1.DVVTriplets.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.DVVTriplets + * @static + * @param {cosmos.staking.v1beta1.IDVVTriplets} message DVVTriplets message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DVVTriplets.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.triplets != null && message.triplets.length) + for (let i = 0; i < message.triplets.length; ++i) + $root.cosmos.staking.v1beta1.DVVTriplet.encode(message.triplets[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DVVTriplets message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.DVVTriplets.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.DVVTriplets + * @static + * @param {cosmos.staking.v1beta1.IDVVTriplets} message DVVTriplets message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DVVTriplets.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DVVTriplets message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.DVVTriplets + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.DVVTriplets} DVVTriplets + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DVVTriplets.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.DVVTriplets(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.triplets && message.triplets.length)) + message.triplets = []; + message.triplets.push($root.cosmos.staking.v1beta1.DVVTriplet.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DVVTriplets message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.DVVTriplets + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.DVVTriplets} DVVTriplets + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DVVTriplets.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DVVTriplets message. + * @function verify + * @memberof cosmos.staking.v1beta1.DVVTriplets + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DVVTriplets.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.triplets != null && message.hasOwnProperty("triplets")) { + if (!Array.isArray(message.triplets)) + return "triplets: array expected"; + for (let i = 0; i < message.triplets.length; ++i) { + let error = $root.cosmos.staking.v1beta1.DVVTriplet.verify(message.triplets[i]); + if (error) + return "triplets." + error; + } + } + return null; + }; + + /** + * Creates a DVVTriplets message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.DVVTriplets + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.DVVTriplets} DVVTriplets + */ + DVVTriplets.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.DVVTriplets) + return object; + let message = new $root.cosmos.staking.v1beta1.DVVTriplets(); + if (object.triplets) { + if (!Array.isArray(object.triplets)) + throw TypeError(".cosmos.staking.v1beta1.DVVTriplets.triplets: array expected"); + message.triplets = []; + for (let i = 0; i < object.triplets.length; ++i) { + if (typeof object.triplets[i] !== "object") + throw TypeError(".cosmos.staking.v1beta1.DVVTriplets.triplets: object expected"); + message.triplets[i] = $root.cosmos.staking.v1beta1.DVVTriplet.fromObject(object.triplets[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a DVVTriplets message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.DVVTriplets + * @static + * @param {cosmos.staking.v1beta1.DVVTriplets} message DVVTriplets + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DVVTriplets.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.triplets = []; + if (message.triplets && message.triplets.length) { + object.triplets = []; + for (let j = 0; j < message.triplets.length; ++j) + object.triplets[j] = $root.cosmos.staking.v1beta1.DVVTriplet.toObject(message.triplets[j], options); + } + return object; + }; + + /** + * Converts this DVVTriplets to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.DVVTriplets + * @instance + * @returns {Object.} JSON object + */ + DVVTriplets.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DVVTriplets; + })(); + + v1beta1.Delegation = (function() { + + /** + * Properties of a Delegation. + * @memberof cosmos.staking.v1beta1 + * @interface IDelegation + * @property {string|null} [delegator_address] Delegation delegator_address + * @property {string|null} [validator_address] Delegation validator_address + * @property {string|null} [shares] Delegation shares + */ + + /** + * Constructs a new Delegation. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a Delegation. + * @implements IDelegation + * @constructor + * @param {cosmos.staking.v1beta1.IDelegation=} [properties] Properties to set + */ + function Delegation(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Delegation delegator_address. + * @member {string} delegator_address + * @memberof cosmos.staking.v1beta1.Delegation + * @instance + */ + Delegation.prototype.delegator_address = ""; + + /** + * Delegation validator_address. + * @member {string} validator_address + * @memberof cosmos.staking.v1beta1.Delegation + * @instance + */ + Delegation.prototype.validator_address = ""; + + /** + * Delegation shares. + * @member {string} shares + * @memberof cosmos.staking.v1beta1.Delegation + * @instance + */ + Delegation.prototype.shares = ""; + + /** + * Encodes the specified Delegation message. Does not implicitly {@link cosmos.staking.v1beta1.Delegation.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.Delegation + * @static + * @param {cosmos.staking.v1beta1.IDelegation} message Delegation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Delegation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); + if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.validator_address); + if (message.shares != null && Object.hasOwnProperty.call(message, "shares")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.shares); + return writer; + }; + + /** + * Encodes the specified Delegation message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.Delegation.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.Delegation + * @static + * @param {cosmos.staking.v1beta1.IDelegation} message Delegation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Delegation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Delegation message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.Delegation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.Delegation} Delegation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Delegation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.Delegation(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_address = reader.string(); + break; + case 2: + message.validator_address = reader.string(); + break; + case 3: + message.shares = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Delegation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.Delegation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.Delegation} Delegation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Delegation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Delegation message. + * @function verify + * @memberof cosmos.staking.v1beta1.Delegation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Delegation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + if (!$util.isString(message.delegator_address)) + return "delegator_address: string expected"; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + if (!$util.isString(message.validator_address)) + return "validator_address: string expected"; + if (message.shares != null && message.hasOwnProperty("shares")) + if (!$util.isString(message.shares)) + return "shares: string expected"; + return null; + }; + + /** + * Creates a Delegation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.Delegation + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.Delegation} Delegation + */ + Delegation.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.Delegation) + return object; + let message = new $root.cosmos.staking.v1beta1.Delegation(); + if (object.delegator_address != null) + message.delegator_address = String(object.delegator_address); + if (object.validator_address != null) + message.validator_address = String(object.validator_address); + if (object.shares != null) + message.shares = String(object.shares); + return message; + }; + + /** + * Creates a plain object from a Delegation message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.Delegation + * @static + * @param {cosmos.staking.v1beta1.Delegation} message Delegation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Delegation.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.delegator_address = ""; + object.validator_address = ""; + object.shares = ""; + } + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + object.delegator_address = message.delegator_address; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + object.validator_address = message.validator_address; + if (message.shares != null && message.hasOwnProperty("shares")) + object.shares = message.shares; + return object; + }; + + /** + * Converts this Delegation to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.Delegation + * @instance + * @returns {Object.} JSON object + */ + Delegation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Delegation; + })(); + + v1beta1.UnbondingDelegation = (function() { + + /** + * Properties of an UnbondingDelegation. + * @memberof cosmos.staking.v1beta1 + * @interface IUnbondingDelegation + * @property {string|null} [delegator_address] UnbondingDelegation delegator_address + * @property {string|null} [validator_address] UnbondingDelegation validator_address + * @property {Array.|null} [entries] UnbondingDelegation entries + */ + + /** + * Constructs a new UnbondingDelegation. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents an UnbondingDelegation. + * @implements IUnbondingDelegation + * @constructor + * @param {cosmos.staking.v1beta1.IUnbondingDelegation=} [properties] Properties to set + */ + function UnbondingDelegation(properties) { + this.entries = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UnbondingDelegation delegator_address. + * @member {string} delegator_address + * @memberof cosmos.staking.v1beta1.UnbondingDelegation + * @instance + */ + UnbondingDelegation.prototype.delegator_address = ""; + + /** + * UnbondingDelegation validator_address. + * @member {string} validator_address + * @memberof cosmos.staking.v1beta1.UnbondingDelegation + * @instance + */ + UnbondingDelegation.prototype.validator_address = ""; + + /** + * UnbondingDelegation entries. + * @member {Array.} entries + * @memberof cosmos.staking.v1beta1.UnbondingDelegation + * @instance + */ + UnbondingDelegation.prototype.entries = $util.emptyArray; + + /** + * Encodes the specified UnbondingDelegation message. Does not implicitly {@link cosmos.staking.v1beta1.UnbondingDelegation.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.UnbondingDelegation + * @static + * @param {cosmos.staking.v1beta1.IUnbondingDelegation} message UnbondingDelegation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UnbondingDelegation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); + if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.validator_address); + if (message.entries != null && message.entries.length) + for (let i = 0; i < message.entries.length; ++i) + $root.cosmos.staking.v1beta1.UnbondingDelegationEntry.encode(message.entries[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UnbondingDelegation message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.UnbondingDelegation.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.UnbondingDelegation + * @static + * @param {cosmos.staking.v1beta1.IUnbondingDelegation} message UnbondingDelegation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UnbondingDelegation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UnbondingDelegation message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.UnbondingDelegation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.UnbondingDelegation} UnbondingDelegation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UnbondingDelegation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.UnbondingDelegation(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_address = reader.string(); + break; + case 2: + message.validator_address = reader.string(); + break; + case 3: + if (!(message.entries && message.entries.length)) + message.entries = []; + message.entries.push($root.cosmos.staking.v1beta1.UnbondingDelegationEntry.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UnbondingDelegation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.UnbondingDelegation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.UnbondingDelegation} UnbondingDelegation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UnbondingDelegation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UnbondingDelegation message. + * @function verify + * @memberof cosmos.staking.v1beta1.UnbondingDelegation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UnbondingDelegation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + if (!$util.isString(message.delegator_address)) + return "delegator_address: string expected"; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + if (!$util.isString(message.validator_address)) + return "validator_address: string expected"; + if (message.entries != null && message.hasOwnProperty("entries")) { + if (!Array.isArray(message.entries)) + return "entries: array expected"; + for (let i = 0; i < message.entries.length; ++i) { + let error = $root.cosmos.staking.v1beta1.UnbondingDelegationEntry.verify(message.entries[i]); + if (error) + return "entries." + error; + } + } + return null; + }; + + /** + * Creates an UnbondingDelegation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.UnbondingDelegation + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.UnbondingDelegation} UnbondingDelegation + */ + UnbondingDelegation.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.UnbondingDelegation) + return object; + let message = new $root.cosmos.staking.v1beta1.UnbondingDelegation(); + if (object.delegator_address != null) + message.delegator_address = String(object.delegator_address); + if (object.validator_address != null) + message.validator_address = String(object.validator_address); + if (object.entries) { + if (!Array.isArray(object.entries)) + throw TypeError(".cosmos.staking.v1beta1.UnbondingDelegation.entries: array expected"); + message.entries = []; + for (let i = 0; i < object.entries.length; ++i) { + if (typeof object.entries[i] !== "object") + throw TypeError(".cosmos.staking.v1beta1.UnbondingDelegation.entries: object expected"); + message.entries[i] = $root.cosmos.staking.v1beta1.UnbondingDelegationEntry.fromObject(object.entries[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an UnbondingDelegation message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.UnbondingDelegation + * @static + * @param {cosmos.staking.v1beta1.UnbondingDelegation} message UnbondingDelegation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UnbondingDelegation.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.entries = []; + if (options.defaults) { + object.delegator_address = ""; + object.validator_address = ""; + } + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + object.delegator_address = message.delegator_address; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + object.validator_address = message.validator_address; + if (message.entries && message.entries.length) { + object.entries = []; + for (let j = 0; j < message.entries.length; ++j) + object.entries[j] = $root.cosmos.staking.v1beta1.UnbondingDelegationEntry.toObject(message.entries[j], options); + } + return object; + }; + + /** + * Converts this UnbondingDelegation to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.UnbondingDelegation + * @instance + * @returns {Object.} JSON object + */ + UnbondingDelegation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UnbondingDelegation; + })(); + + v1beta1.UnbondingDelegationEntry = (function() { + + /** + * Properties of an UnbondingDelegationEntry. + * @memberof cosmos.staking.v1beta1 + * @interface IUnbondingDelegationEntry + * @property {Long|null} [creation_height] UnbondingDelegationEntry creation_height + * @property {google.protobuf.ITimestamp|null} [completion_time] UnbondingDelegationEntry completion_time + * @property {string|null} [initial_balance] UnbondingDelegationEntry initial_balance + * @property {string|null} [balance] UnbondingDelegationEntry balance + */ + + /** + * Constructs a new UnbondingDelegationEntry. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents an UnbondingDelegationEntry. + * @implements IUnbondingDelegationEntry + * @constructor + * @param {cosmos.staking.v1beta1.IUnbondingDelegationEntry=} [properties] Properties to set + */ + function UnbondingDelegationEntry(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UnbondingDelegationEntry creation_height. + * @member {Long} creation_height + * @memberof cosmos.staking.v1beta1.UnbondingDelegationEntry + * @instance + */ + UnbondingDelegationEntry.prototype.creation_height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * UnbondingDelegationEntry completion_time. + * @member {google.protobuf.ITimestamp|null|undefined} completion_time + * @memberof cosmos.staking.v1beta1.UnbondingDelegationEntry + * @instance + */ + UnbondingDelegationEntry.prototype.completion_time = null; + + /** + * UnbondingDelegationEntry initial_balance. + * @member {string} initial_balance + * @memberof cosmos.staking.v1beta1.UnbondingDelegationEntry + * @instance + */ + UnbondingDelegationEntry.prototype.initial_balance = ""; + + /** + * UnbondingDelegationEntry balance. + * @member {string} balance + * @memberof cosmos.staking.v1beta1.UnbondingDelegationEntry + * @instance + */ + UnbondingDelegationEntry.prototype.balance = ""; + + /** + * Encodes the specified UnbondingDelegationEntry message. Does not implicitly {@link cosmos.staking.v1beta1.UnbondingDelegationEntry.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.UnbondingDelegationEntry + * @static + * @param {cosmos.staking.v1beta1.IUnbondingDelegationEntry} message UnbondingDelegationEntry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UnbondingDelegationEntry.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.creation_height != null && Object.hasOwnProperty.call(message, "creation_height")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.creation_height); + if (message.completion_time != null && Object.hasOwnProperty.call(message, "completion_time")) + $root.google.protobuf.Timestamp.encode(message.completion_time, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.initial_balance != null && Object.hasOwnProperty.call(message, "initial_balance")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.initial_balance); + if (message.balance != null && Object.hasOwnProperty.call(message, "balance")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.balance); + return writer; + }; + + /** + * Encodes the specified UnbondingDelegationEntry message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.UnbondingDelegationEntry.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.UnbondingDelegationEntry + * @static + * @param {cosmos.staking.v1beta1.IUnbondingDelegationEntry} message UnbondingDelegationEntry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UnbondingDelegationEntry.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UnbondingDelegationEntry message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.UnbondingDelegationEntry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.UnbondingDelegationEntry} UnbondingDelegationEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UnbondingDelegationEntry.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.UnbondingDelegationEntry(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creation_height = reader.int64(); + break; + case 2: + message.completion_time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.initial_balance = reader.string(); + break; + case 4: + message.balance = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UnbondingDelegationEntry message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.UnbondingDelegationEntry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.UnbondingDelegationEntry} UnbondingDelegationEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UnbondingDelegationEntry.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UnbondingDelegationEntry message. + * @function verify + * @memberof cosmos.staking.v1beta1.UnbondingDelegationEntry + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UnbondingDelegationEntry.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.creation_height != null && message.hasOwnProperty("creation_height")) + if (!$util.isInteger(message.creation_height) && !(message.creation_height && $util.isInteger(message.creation_height.low) && $util.isInteger(message.creation_height.high))) + return "creation_height: integer|Long expected"; + if (message.completion_time != null && message.hasOwnProperty("completion_time")) { + let error = $root.google.protobuf.Timestamp.verify(message.completion_time); + if (error) + return "completion_time." + error; + } + if (message.initial_balance != null && message.hasOwnProperty("initial_balance")) + if (!$util.isString(message.initial_balance)) + return "initial_balance: string expected"; + if (message.balance != null && message.hasOwnProperty("balance")) + if (!$util.isString(message.balance)) + return "balance: string expected"; + return null; + }; + + /** + * Creates an UnbondingDelegationEntry message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.UnbondingDelegationEntry + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.UnbondingDelegationEntry} UnbondingDelegationEntry + */ + UnbondingDelegationEntry.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.UnbondingDelegationEntry) + return object; + let message = new $root.cosmos.staking.v1beta1.UnbondingDelegationEntry(); + if (object.creation_height != null) + if ($util.Long) + (message.creation_height = $util.Long.fromValue(object.creation_height)).unsigned = false; + else if (typeof object.creation_height === "string") + message.creation_height = parseInt(object.creation_height, 10); + else if (typeof object.creation_height === "number") + message.creation_height = object.creation_height; + else if (typeof object.creation_height === "object") + message.creation_height = new $util.LongBits(object.creation_height.low >>> 0, object.creation_height.high >>> 0).toNumber(); + if (object.completion_time != null) { + if (typeof object.completion_time !== "object") + throw TypeError(".cosmos.staking.v1beta1.UnbondingDelegationEntry.completion_time: object expected"); + message.completion_time = $root.google.protobuf.Timestamp.fromObject(object.completion_time); + } + if (object.initial_balance != null) + message.initial_balance = String(object.initial_balance); + if (object.balance != null) + message.balance = String(object.balance); + return message; + }; + + /** + * Creates a plain object from an UnbondingDelegationEntry message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.UnbondingDelegationEntry + * @static + * @param {cosmos.staking.v1beta1.UnbondingDelegationEntry} message UnbondingDelegationEntry + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UnbondingDelegationEntry.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.creation_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.creation_height = options.longs === String ? "0" : 0; + object.completion_time = null; + object.initial_balance = ""; + object.balance = ""; + } + if (message.creation_height != null && message.hasOwnProperty("creation_height")) + if (typeof message.creation_height === "number") + object.creation_height = options.longs === String ? String(message.creation_height) : message.creation_height; + else + object.creation_height = options.longs === String ? $util.Long.prototype.toString.call(message.creation_height) : options.longs === Number ? new $util.LongBits(message.creation_height.low >>> 0, message.creation_height.high >>> 0).toNumber() : message.creation_height; + if (message.completion_time != null && message.hasOwnProperty("completion_time")) + object.completion_time = $root.google.protobuf.Timestamp.toObject(message.completion_time, options); + if (message.initial_balance != null && message.hasOwnProperty("initial_balance")) + object.initial_balance = message.initial_balance; + if (message.balance != null && message.hasOwnProperty("balance")) + object.balance = message.balance; + return object; + }; + + /** + * Converts this UnbondingDelegationEntry to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.UnbondingDelegationEntry + * @instance + * @returns {Object.} JSON object + */ + UnbondingDelegationEntry.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UnbondingDelegationEntry; + })(); + + v1beta1.RedelegationEntry = (function() { + + /** + * Properties of a RedelegationEntry. + * @memberof cosmos.staking.v1beta1 + * @interface IRedelegationEntry + * @property {Long|null} [creation_height] RedelegationEntry creation_height + * @property {google.protobuf.ITimestamp|null} [completion_time] RedelegationEntry completion_time + * @property {string|null} [initial_balance] RedelegationEntry initial_balance + * @property {string|null} [shares_dst] RedelegationEntry shares_dst + */ + + /** + * Constructs a new RedelegationEntry. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a RedelegationEntry. + * @implements IRedelegationEntry + * @constructor + * @param {cosmos.staking.v1beta1.IRedelegationEntry=} [properties] Properties to set + */ + function RedelegationEntry(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RedelegationEntry creation_height. + * @member {Long} creation_height + * @memberof cosmos.staking.v1beta1.RedelegationEntry + * @instance + */ + RedelegationEntry.prototype.creation_height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * RedelegationEntry completion_time. + * @member {google.protobuf.ITimestamp|null|undefined} completion_time + * @memberof cosmos.staking.v1beta1.RedelegationEntry + * @instance + */ + RedelegationEntry.prototype.completion_time = null; + + /** + * RedelegationEntry initial_balance. + * @member {string} initial_balance + * @memberof cosmos.staking.v1beta1.RedelegationEntry + * @instance + */ + RedelegationEntry.prototype.initial_balance = ""; + + /** + * RedelegationEntry shares_dst. + * @member {string} shares_dst + * @memberof cosmos.staking.v1beta1.RedelegationEntry + * @instance + */ + RedelegationEntry.prototype.shares_dst = ""; + + /** + * Encodes the specified RedelegationEntry message. Does not implicitly {@link cosmos.staking.v1beta1.RedelegationEntry.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.RedelegationEntry + * @static + * @param {cosmos.staking.v1beta1.IRedelegationEntry} message RedelegationEntry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RedelegationEntry.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.creation_height != null && Object.hasOwnProperty.call(message, "creation_height")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.creation_height); + if (message.completion_time != null && Object.hasOwnProperty.call(message, "completion_time")) + $root.google.protobuf.Timestamp.encode(message.completion_time, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.initial_balance != null && Object.hasOwnProperty.call(message, "initial_balance")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.initial_balance); + if (message.shares_dst != null && Object.hasOwnProperty.call(message, "shares_dst")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.shares_dst); + return writer; + }; + + /** + * Encodes the specified RedelegationEntry message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.RedelegationEntry.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.RedelegationEntry + * @static + * @param {cosmos.staking.v1beta1.IRedelegationEntry} message RedelegationEntry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RedelegationEntry.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RedelegationEntry message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.RedelegationEntry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.RedelegationEntry} RedelegationEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RedelegationEntry.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.RedelegationEntry(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creation_height = reader.int64(); + break; + case 2: + message.completion_time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.initial_balance = reader.string(); + break; + case 4: + message.shares_dst = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RedelegationEntry message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.RedelegationEntry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.RedelegationEntry} RedelegationEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RedelegationEntry.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RedelegationEntry message. + * @function verify + * @memberof cosmos.staking.v1beta1.RedelegationEntry + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RedelegationEntry.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.creation_height != null && message.hasOwnProperty("creation_height")) + if (!$util.isInteger(message.creation_height) && !(message.creation_height && $util.isInteger(message.creation_height.low) && $util.isInteger(message.creation_height.high))) + return "creation_height: integer|Long expected"; + if (message.completion_time != null && message.hasOwnProperty("completion_time")) { + let error = $root.google.protobuf.Timestamp.verify(message.completion_time); + if (error) + return "completion_time." + error; + } + if (message.initial_balance != null && message.hasOwnProperty("initial_balance")) + if (!$util.isString(message.initial_balance)) + return "initial_balance: string expected"; + if (message.shares_dst != null && message.hasOwnProperty("shares_dst")) + if (!$util.isString(message.shares_dst)) + return "shares_dst: string expected"; + return null; + }; + + /** + * Creates a RedelegationEntry message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.RedelegationEntry + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.RedelegationEntry} RedelegationEntry + */ + RedelegationEntry.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.RedelegationEntry) + return object; + let message = new $root.cosmos.staking.v1beta1.RedelegationEntry(); + if (object.creation_height != null) + if ($util.Long) + (message.creation_height = $util.Long.fromValue(object.creation_height)).unsigned = false; + else if (typeof object.creation_height === "string") + message.creation_height = parseInt(object.creation_height, 10); + else if (typeof object.creation_height === "number") + message.creation_height = object.creation_height; + else if (typeof object.creation_height === "object") + message.creation_height = new $util.LongBits(object.creation_height.low >>> 0, object.creation_height.high >>> 0).toNumber(); + if (object.completion_time != null) { + if (typeof object.completion_time !== "object") + throw TypeError(".cosmos.staking.v1beta1.RedelegationEntry.completion_time: object expected"); + message.completion_time = $root.google.protobuf.Timestamp.fromObject(object.completion_time); + } + if (object.initial_balance != null) + message.initial_balance = String(object.initial_balance); + if (object.shares_dst != null) + message.shares_dst = String(object.shares_dst); + return message; + }; + + /** + * Creates a plain object from a RedelegationEntry message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.RedelegationEntry + * @static + * @param {cosmos.staking.v1beta1.RedelegationEntry} message RedelegationEntry + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RedelegationEntry.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.creation_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.creation_height = options.longs === String ? "0" : 0; + object.completion_time = null; + object.initial_balance = ""; + object.shares_dst = ""; + } + if (message.creation_height != null && message.hasOwnProperty("creation_height")) + if (typeof message.creation_height === "number") + object.creation_height = options.longs === String ? String(message.creation_height) : message.creation_height; + else + object.creation_height = options.longs === String ? $util.Long.prototype.toString.call(message.creation_height) : options.longs === Number ? new $util.LongBits(message.creation_height.low >>> 0, message.creation_height.high >>> 0).toNumber() : message.creation_height; + if (message.completion_time != null && message.hasOwnProperty("completion_time")) + object.completion_time = $root.google.protobuf.Timestamp.toObject(message.completion_time, options); + if (message.initial_balance != null && message.hasOwnProperty("initial_balance")) + object.initial_balance = message.initial_balance; + if (message.shares_dst != null && message.hasOwnProperty("shares_dst")) + object.shares_dst = message.shares_dst; + return object; + }; + + /** + * Converts this RedelegationEntry to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.RedelegationEntry + * @instance + * @returns {Object.} JSON object + */ + RedelegationEntry.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RedelegationEntry; + })(); + + v1beta1.Redelegation = (function() { + + /** + * Properties of a Redelegation. + * @memberof cosmos.staking.v1beta1 + * @interface IRedelegation + * @property {string|null} [delegator_address] Redelegation delegator_address + * @property {string|null} [validator_src_address] Redelegation validator_src_address + * @property {string|null} [validator_dst_address] Redelegation validator_dst_address + * @property {Array.|null} [entries] Redelegation entries + */ + + /** + * Constructs a new Redelegation. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a Redelegation. + * @implements IRedelegation + * @constructor + * @param {cosmos.staking.v1beta1.IRedelegation=} [properties] Properties to set + */ + function Redelegation(properties) { + this.entries = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Redelegation delegator_address. + * @member {string} delegator_address + * @memberof cosmos.staking.v1beta1.Redelegation + * @instance + */ + Redelegation.prototype.delegator_address = ""; + + /** + * Redelegation validator_src_address. + * @member {string} validator_src_address + * @memberof cosmos.staking.v1beta1.Redelegation + * @instance + */ + Redelegation.prototype.validator_src_address = ""; + + /** + * Redelegation validator_dst_address. + * @member {string} validator_dst_address + * @memberof cosmos.staking.v1beta1.Redelegation + * @instance + */ + Redelegation.prototype.validator_dst_address = ""; + + /** + * Redelegation entries. + * @member {Array.} entries + * @memberof cosmos.staking.v1beta1.Redelegation + * @instance + */ + Redelegation.prototype.entries = $util.emptyArray; + + /** + * Encodes the specified Redelegation message. Does not implicitly {@link cosmos.staking.v1beta1.Redelegation.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.Redelegation + * @static + * @param {cosmos.staking.v1beta1.IRedelegation} message Redelegation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Redelegation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); + if (message.validator_src_address != null && Object.hasOwnProperty.call(message, "validator_src_address")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.validator_src_address); + if (message.validator_dst_address != null && Object.hasOwnProperty.call(message, "validator_dst_address")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.validator_dst_address); + if (message.entries != null && message.entries.length) + for (let i = 0; i < message.entries.length; ++i) + $root.cosmos.staking.v1beta1.RedelegationEntry.encode(message.entries[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Redelegation message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.Redelegation.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.Redelegation + * @static + * @param {cosmos.staking.v1beta1.IRedelegation} message Redelegation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Redelegation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Redelegation message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.Redelegation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.Redelegation} Redelegation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Redelegation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.Redelegation(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegator_address = reader.string(); + break; + case 2: + message.validator_src_address = reader.string(); + break; + case 3: + message.validator_dst_address = reader.string(); + break; + case 4: + if (!(message.entries && message.entries.length)) + message.entries = []; + message.entries.push($root.cosmos.staking.v1beta1.RedelegationEntry.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Redelegation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.Redelegation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.Redelegation} Redelegation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Redelegation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Redelegation message. + * @function verify + * @memberof cosmos.staking.v1beta1.Redelegation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Redelegation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + if (!$util.isString(message.delegator_address)) + return "delegator_address: string expected"; + if (message.validator_src_address != null && message.hasOwnProperty("validator_src_address")) + if (!$util.isString(message.validator_src_address)) + return "validator_src_address: string expected"; + if (message.validator_dst_address != null && message.hasOwnProperty("validator_dst_address")) + if (!$util.isString(message.validator_dst_address)) + return "validator_dst_address: string expected"; + if (message.entries != null && message.hasOwnProperty("entries")) { + if (!Array.isArray(message.entries)) + return "entries: array expected"; + for (let i = 0; i < message.entries.length; ++i) { + let error = $root.cosmos.staking.v1beta1.RedelegationEntry.verify(message.entries[i]); + if (error) + return "entries." + error; + } + } + return null; + }; + + /** + * Creates a Redelegation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.Redelegation + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.Redelegation} Redelegation + */ + Redelegation.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.Redelegation) + return object; + let message = new $root.cosmos.staking.v1beta1.Redelegation(); + if (object.delegator_address != null) + message.delegator_address = String(object.delegator_address); + if (object.validator_src_address != null) + message.validator_src_address = String(object.validator_src_address); + if (object.validator_dst_address != null) + message.validator_dst_address = String(object.validator_dst_address); + if (object.entries) { + if (!Array.isArray(object.entries)) + throw TypeError(".cosmos.staking.v1beta1.Redelegation.entries: array expected"); + message.entries = []; + for (let i = 0; i < object.entries.length; ++i) { + if (typeof object.entries[i] !== "object") + throw TypeError(".cosmos.staking.v1beta1.Redelegation.entries: object expected"); + message.entries[i] = $root.cosmos.staking.v1beta1.RedelegationEntry.fromObject(object.entries[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Redelegation message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.Redelegation + * @static + * @param {cosmos.staking.v1beta1.Redelegation} message Redelegation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Redelegation.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.entries = []; + if (options.defaults) { + object.delegator_address = ""; + object.validator_src_address = ""; + object.validator_dst_address = ""; + } + if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) + object.delegator_address = message.delegator_address; + if (message.validator_src_address != null && message.hasOwnProperty("validator_src_address")) + object.validator_src_address = message.validator_src_address; + if (message.validator_dst_address != null && message.hasOwnProperty("validator_dst_address")) + object.validator_dst_address = message.validator_dst_address; + if (message.entries && message.entries.length) { + object.entries = []; + for (let j = 0; j < message.entries.length; ++j) + object.entries[j] = $root.cosmos.staking.v1beta1.RedelegationEntry.toObject(message.entries[j], options); + } + return object; + }; + + /** + * Converts this Redelegation to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.Redelegation + * @instance + * @returns {Object.} JSON object + */ + Redelegation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Redelegation; + })(); + + v1beta1.Params = (function() { + + /** + * Properties of a Params. + * @memberof cosmos.staking.v1beta1 + * @interface IParams + * @property {google.protobuf.IDuration|null} [unbonding_time] Params unbonding_time + * @property {number|null} [max_validators] Params max_validators + * @property {number|null} [max_entries] Params max_entries + * @property {number|null} [historical_entries] Params historical_entries + * @property {string|null} [bond_denom] Params bond_denom + */ + + /** + * Constructs a new Params. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a Params. + * @implements IParams + * @constructor + * @param {cosmos.staking.v1beta1.IParams=} [properties] Properties to set + */ + function Params(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Params unbonding_time. + * @member {google.protobuf.IDuration|null|undefined} unbonding_time + * @memberof cosmos.staking.v1beta1.Params + * @instance + */ + Params.prototype.unbonding_time = null; + + /** + * Params max_validators. + * @member {number} max_validators + * @memberof cosmos.staking.v1beta1.Params + * @instance + */ + Params.prototype.max_validators = 0; + + /** + * Params max_entries. + * @member {number} max_entries + * @memberof cosmos.staking.v1beta1.Params + * @instance + */ + Params.prototype.max_entries = 0; + + /** + * Params historical_entries. + * @member {number} historical_entries + * @memberof cosmos.staking.v1beta1.Params + * @instance + */ + Params.prototype.historical_entries = 0; + + /** + * Params bond_denom. + * @member {string} bond_denom + * @memberof cosmos.staking.v1beta1.Params + * @instance + */ + Params.prototype.bond_denom = ""; + + /** + * Encodes the specified Params message. Does not implicitly {@link cosmos.staking.v1beta1.Params.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.Params + * @static + * @param {cosmos.staking.v1beta1.IParams} message Params message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Params.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.unbonding_time != null && Object.hasOwnProperty.call(message, "unbonding_time")) + $root.google.protobuf.Duration.encode(message.unbonding_time, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.max_validators != null && Object.hasOwnProperty.call(message, "max_validators")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.max_validators); + if (message.max_entries != null && Object.hasOwnProperty.call(message, "max_entries")) + writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.max_entries); + if (message.historical_entries != null && Object.hasOwnProperty.call(message, "historical_entries")) + writer.uint32(/* id 4, wireType 0 =*/32).uint32(message.historical_entries); + if (message.bond_denom != null && Object.hasOwnProperty.call(message, "bond_denom")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.bond_denom); + return writer; + }; + + /** + * Encodes the specified Params message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.Params.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.Params + * @static + * @param {cosmos.staking.v1beta1.IParams} message Params message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Params.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Params message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.Params + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.Params} Params + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Params.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.Params(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.unbonding_time = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + case 2: + message.max_validators = reader.uint32(); + break; + case 3: + message.max_entries = reader.uint32(); + break; + case 4: + message.historical_entries = reader.uint32(); + break; + case 5: + message.bond_denom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Params message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.Params + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.Params} Params + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Params.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Params message. + * @function verify + * @memberof cosmos.staking.v1beta1.Params + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Params.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.unbonding_time != null && message.hasOwnProperty("unbonding_time")) { + let error = $root.google.protobuf.Duration.verify(message.unbonding_time); + if (error) + return "unbonding_time." + error; + } + if (message.max_validators != null && message.hasOwnProperty("max_validators")) + if (!$util.isInteger(message.max_validators)) + return "max_validators: integer expected"; + if (message.max_entries != null && message.hasOwnProperty("max_entries")) + if (!$util.isInteger(message.max_entries)) + return "max_entries: integer expected"; + if (message.historical_entries != null && message.hasOwnProperty("historical_entries")) + if (!$util.isInteger(message.historical_entries)) + return "historical_entries: integer expected"; + if (message.bond_denom != null && message.hasOwnProperty("bond_denom")) + if (!$util.isString(message.bond_denom)) + return "bond_denom: string expected"; + return null; + }; + + /** + * Creates a Params message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.Params + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.Params} Params + */ + Params.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.Params) + return object; + let message = new $root.cosmos.staking.v1beta1.Params(); + if (object.unbonding_time != null) { + if (typeof object.unbonding_time !== "object") + throw TypeError(".cosmos.staking.v1beta1.Params.unbonding_time: object expected"); + message.unbonding_time = $root.google.protobuf.Duration.fromObject(object.unbonding_time); + } + if (object.max_validators != null) + message.max_validators = object.max_validators >>> 0; + if (object.max_entries != null) + message.max_entries = object.max_entries >>> 0; + if (object.historical_entries != null) + message.historical_entries = object.historical_entries >>> 0; + if (object.bond_denom != null) + message.bond_denom = String(object.bond_denom); + return message; + }; + + /** + * Creates a plain object from a Params message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.Params + * @static + * @param {cosmos.staking.v1beta1.Params} message Params + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Params.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.unbonding_time = null; + object.max_validators = 0; + object.max_entries = 0; + object.historical_entries = 0; + object.bond_denom = ""; + } + if (message.unbonding_time != null && message.hasOwnProperty("unbonding_time")) + object.unbonding_time = $root.google.protobuf.Duration.toObject(message.unbonding_time, options); + if (message.max_validators != null && message.hasOwnProperty("max_validators")) + object.max_validators = message.max_validators; + if (message.max_entries != null && message.hasOwnProperty("max_entries")) + object.max_entries = message.max_entries; + if (message.historical_entries != null && message.hasOwnProperty("historical_entries")) + object.historical_entries = message.historical_entries; + if (message.bond_denom != null && message.hasOwnProperty("bond_denom")) + object.bond_denom = message.bond_denom; + return object; + }; + + /** + * Converts this Params to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.Params + * @instance + * @returns {Object.} JSON object + */ + Params.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Params; + })(); + + v1beta1.DelegationResponse = (function() { + + /** + * Properties of a DelegationResponse. + * @memberof cosmos.staking.v1beta1 + * @interface IDelegationResponse + * @property {cosmos.staking.v1beta1.IDelegation|null} [delegation] DelegationResponse delegation + * @property {cosmos.base.v1beta1.ICoin|null} [balance] DelegationResponse balance + */ + + /** + * Constructs a new DelegationResponse. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a DelegationResponse. + * @implements IDelegationResponse + * @constructor + * @param {cosmos.staking.v1beta1.IDelegationResponse=} [properties] Properties to set + */ + function DelegationResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DelegationResponse delegation. + * @member {cosmos.staking.v1beta1.IDelegation|null|undefined} delegation + * @memberof cosmos.staking.v1beta1.DelegationResponse + * @instance + */ + DelegationResponse.prototype.delegation = null; + + /** + * DelegationResponse balance. + * @member {cosmos.base.v1beta1.ICoin|null|undefined} balance + * @memberof cosmos.staking.v1beta1.DelegationResponse + * @instance + */ + DelegationResponse.prototype.balance = null; + + /** + * Encodes the specified DelegationResponse message. Does not implicitly {@link cosmos.staking.v1beta1.DelegationResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.DelegationResponse + * @static + * @param {cosmos.staking.v1beta1.IDelegationResponse} message DelegationResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DelegationResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.delegation != null && Object.hasOwnProperty.call(message, "delegation")) + $root.cosmos.staking.v1beta1.Delegation.encode(message.delegation, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.balance != null && Object.hasOwnProperty.call(message, "balance")) + $root.cosmos.base.v1beta1.Coin.encode(message.balance, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DelegationResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.DelegationResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.DelegationResponse + * @static + * @param {cosmos.staking.v1beta1.IDelegationResponse} message DelegationResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DelegationResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DelegationResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.DelegationResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.DelegationResponse} DelegationResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DelegationResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.DelegationResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegation = $root.cosmos.staking.v1beta1.Delegation.decode(reader, reader.uint32()); + break; + case 2: + message.balance = $root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DelegationResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.DelegationResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.DelegationResponse} DelegationResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DelegationResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DelegationResponse message. + * @function verify + * @memberof cosmos.staking.v1beta1.DelegationResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DelegationResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.delegation != null && message.hasOwnProperty("delegation")) { + let error = $root.cosmos.staking.v1beta1.Delegation.verify(message.delegation); + if (error) + return "delegation." + error; + } + if (message.balance != null && message.hasOwnProperty("balance")) { + let error = $root.cosmos.base.v1beta1.Coin.verify(message.balance); + if (error) + return "balance." + error; + } + return null; + }; + + /** + * Creates a DelegationResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.DelegationResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.DelegationResponse} DelegationResponse + */ + DelegationResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.DelegationResponse) + return object; + let message = new $root.cosmos.staking.v1beta1.DelegationResponse(); + if (object.delegation != null) { + if (typeof object.delegation !== "object") + throw TypeError(".cosmos.staking.v1beta1.DelegationResponse.delegation: object expected"); + message.delegation = $root.cosmos.staking.v1beta1.Delegation.fromObject(object.delegation); + } + if (object.balance != null) { + if (typeof object.balance !== "object") + throw TypeError(".cosmos.staking.v1beta1.DelegationResponse.balance: object expected"); + message.balance = $root.cosmos.base.v1beta1.Coin.fromObject(object.balance); + } + return message; + }; + + /** + * Creates a plain object from a DelegationResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.DelegationResponse + * @static + * @param {cosmos.staking.v1beta1.DelegationResponse} message DelegationResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DelegationResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.delegation = null; + object.balance = null; + } + if (message.delegation != null && message.hasOwnProperty("delegation")) + object.delegation = $root.cosmos.staking.v1beta1.Delegation.toObject(message.delegation, options); + if (message.balance != null && message.hasOwnProperty("balance")) + object.balance = $root.cosmos.base.v1beta1.Coin.toObject(message.balance, options); + return object; + }; + + /** + * Converts this DelegationResponse to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.DelegationResponse + * @instance + * @returns {Object.} JSON object + */ + DelegationResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DelegationResponse; + })(); + + v1beta1.RedelegationEntryResponse = (function() { + + /** + * Properties of a RedelegationEntryResponse. + * @memberof cosmos.staking.v1beta1 + * @interface IRedelegationEntryResponse + * @property {cosmos.staking.v1beta1.IRedelegationEntry|null} [redelegation_entry] RedelegationEntryResponse redelegation_entry + * @property {string|null} [balance] RedelegationEntryResponse balance + */ + + /** + * Constructs a new RedelegationEntryResponse. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a RedelegationEntryResponse. + * @implements IRedelegationEntryResponse + * @constructor + * @param {cosmos.staking.v1beta1.IRedelegationEntryResponse=} [properties] Properties to set + */ + function RedelegationEntryResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RedelegationEntryResponse redelegation_entry. + * @member {cosmos.staking.v1beta1.IRedelegationEntry|null|undefined} redelegation_entry + * @memberof cosmos.staking.v1beta1.RedelegationEntryResponse + * @instance + */ + RedelegationEntryResponse.prototype.redelegation_entry = null; + + /** + * RedelegationEntryResponse balance. + * @member {string} balance + * @memberof cosmos.staking.v1beta1.RedelegationEntryResponse + * @instance + */ + RedelegationEntryResponse.prototype.balance = ""; + + /** + * Encodes the specified RedelegationEntryResponse message. Does not implicitly {@link cosmos.staking.v1beta1.RedelegationEntryResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.RedelegationEntryResponse + * @static + * @param {cosmos.staking.v1beta1.IRedelegationEntryResponse} message RedelegationEntryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RedelegationEntryResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.redelegation_entry != null && Object.hasOwnProperty.call(message, "redelegation_entry")) + $root.cosmos.staking.v1beta1.RedelegationEntry.encode(message.redelegation_entry, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.balance != null && Object.hasOwnProperty.call(message, "balance")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.balance); + return writer; + }; + + /** + * Encodes the specified RedelegationEntryResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.RedelegationEntryResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.RedelegationEntryResponse + * @static + * @param {cosmos.staking.v1beta1.IRedelegationEntryResponse} message RedelegationEntryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RedelegationEntryResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RedelegationEntryResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.RedelegationEntryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.RedelegationEntryResponse} RedelegationEntryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RedelegationEntryResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.RedelegationEntryResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.redelegation_entry = $root.cosmos.staking.v1beta1.RedelegationEntry.decode(reader, reader.uint32()); + break; + case 4: + message.balance = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RedelegationEntryResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.RedelegationEntryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.RedelegationEntryResponse} RedelegationEntryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RedelegationEntryResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RedelegationEntryResponse message. + * @function verify + * @memberof cosmos.staking.v1beta1.RedelegationEntryResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RedelegationEntryResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.redelegation_entry != null && message.hasOwnProperty("redelegation_entry")) { + let error = $root.cosmos.staking.v1beta1.RedelegationEntry.verify(message.redelegation_entry); + if (error) + return "redelegation_entry." + error; + } + if (message.balance != null && message.hasOwnProperty("balance")) + if (!$util.isString(message.balance)) + return "balance: string expected"; + return null; + }; + + /** + * Creates a RedelegationEntryResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.RedelegationEntryResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.RedelegationEntryResponse} RedelegationEntryResponse + */ + RedelegationEntryResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.RedelegationEntryResponse) + return object; + let message = new $root.cosmos.staking.v1beta1.RedelegationEntryResponse(); + if (object.redelegation_entry != null) { + if (typeof object.redelegation_entry !== "object") + throw TypeError(".cosmos.staking.v1beta1.RedelegationEntryResponse.redelegation_entry: object expected"); + message.redelegation_entry = $root.cosmos.staking.v1beta1.RedelegationEntry.fromObject(object.redelegation_entry); + } + if (object.balance != null) + message.balance = String(object.balance); + return message; + }; + + /** + * Creates a plain object from a RedelegationEntryResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.RedelegationEntryResponse + * @static + * @param {cosmos.staking.v1beta1.RedelegationEntryResponse} message RedelegationEntryResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RedelegationEntryResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.redelegation_entry = null; + object.balance = ""; + } + if (message.redelegation_entry != null && message.hasOwnProperty("redelegation_entry")) + object.redelegation_entry = $root.cosmos.staking.v1beta1.RedelegationEntry.toObject(message.redelegation_entry, options); + if (message.balance != null && message.hasOwnProperty("balance")) + object.balance = message.balance; + return object; + }; + + /** + * Converts this RedelegationEntryResponse to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.RedelegationEntryResponse + * @instance + * @returns {Object.} JSON object + */ + RedelegationEntryResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RedelegationEntryResponse; + })(); + + v1beta1.RedelegationResponse = (function() { + + /** + * Properties of a RedelegationResponse. + * @memberof cosmos.staking.v1beta1 + * @interface IRedelegationResponse + * @property {cosmos.staking.v1beta1.IRedelegation|null} [redelegation] RedelegationResponse redelegation + * @property {Array.|null} [entries] RedelegationResponse entries + */ + + /** + * Constructs a new RedelegationResponse. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a RedelegationResponse. + * @implements IRedelegationResponse + * @constructor + * @param {cosmos.staking.v1beta1.IRedelegationResponse=} [properties] Properties to set + */ + function RedelegationResponse(properties) { + this.entries = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RedelegationResponse redelegation. + * @member {cosmos.staking.v1beta1.IRedelegation|null|undefined} redelegation + * @memberof cosmos.staking.v1beta1.RedelegationResponse + * @instance + */ + RedelegationResponse.prototype.redelegation = null; + + /** + * RedelegationResponse entries. + * @member {Array.} entries + * @memberof cosmos.staking.v1beta1.RedelegationResponse + * @instance + */ + RedelegationResponse.prototype.entries = $util.emptyArray; + + /** + * Encodes the specified RedelegationResponse message. Does not implicitly {@link cosmos.staking.v1beta1.RedelegationResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.RedelegationResponse + * @static + * @param {cosmos.staking.v1beta1.IRedelegationResponse} message RedelegationResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RedelegationResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.redelegation != null && Object.hasOwnProperty.call(message, "redelegation")) + $root.cosmos.staking.v1beta1.Redelegation.encode(message.redelegation, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.entries != null && message.entries.length) + for (let i = 0; i < message.entries.length; ++i) + $root.cosmos.staking.v1beta1.RedelegationEntryResponse.encode(message.entries[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified RedelegationResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.RedelegationResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.RedelegationResponse + * @static + * @param {cosmos.staking.v1beta1.IRedelegationResponse} message RedelegationResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RedelegationResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RedelegationResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.RedelegationResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.RedelegationResponse} RedelegationResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RedelegationResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.RedelegationResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.redelegation = $root.cosmos.staking.v1beta1.Redelegation.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.entries && message.entries.length)) + message.entries = []; + message.entries.push($root.cosmos.staking.v1beta1.RedelegationEntryResponse.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RedelegationResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.RedelegationResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.RedelegationResponse} RedelegationResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RedelegationResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RedelegationResponse message. + * @function verify + * @memberof cosmos.staking.v1beta1.RedelegationResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RedelegationResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.redelegation != null && message.hasOwnProperty("redelegation")) { + let error = $root.cosmos.staking.v1beta1.Redelegation.verify(message.redelegation); + if (error) + return "redelegation." + error; + } + if (message.entries != null && message.hasOwnProperty("entries")) { + if (!Array.isArray(message.entries)) + return "entries: array expected"; + for (let i = 0; i < message.entries.length; ++i) { + let error = $root.cosmos.staking.v1beta1.RedelegationEntryResponse.verify(message.entries[i]); + if (error) + return "entries." + error; + } + } + return null; + }; + + /** + * Creates a RedelegationResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.RedelegationResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.RedelegationResponse} RedelegationResponse + */ + RedelegationResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.RedelegationResponse) + return object; + let message = new $root.cosmos.staking.v1beta1.RedelegationResponse(); + if (object.redelegation != null) { + if (typeof object.redelegation !== "object") + throw TypeError(".cosmos.staking.v1beta1.RedelegationResponse.redelegation: object expected"); + message.redelegation = $root.cosmos.staking.v1beta1.Redelegation.fromObject(object.redelegation); + } + if (object.entries) { + if (!Array.isArray(object.entries)) + throw TypeError(".cosmos.staking.v1beta1.RedelegationResponse.entries: array expected"); + message.entries = []; + for (let i = 0; i < object.entries.length; ++i) { + if (typeof object.entries[i] !== "object") + throw TypeError(".cosmos.staking.v1beta1.RedelegationResponse.entries: object expected"); + message.entries[i] = $root.cosmos.staking.v1beta1.RedelegationEntryResponse.fromObject(object.entries[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a RedelegationResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.RedelegationResponse + * @static + * @param {cosmos.staking.v1beta1.RedelegationResponse} message RedelegationResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RedelegationResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.entries = []; + if (options.defaults) + object.redelegation = null; + if (message.redelegation != null && message.hasOwnProperty("redelegation")) + object.redelegation = $root.cosmos.staking.v1beta1.Redelegation.toObject(message.redelegation, options); + if (message.entries && message.entries.length) { + object.entries = []; + for (let j = 0; j < message.entries.length; ++j) + object.entries[j] = $root.cosmos.staking.v1beta1.RedelegationEntryResponse.toObject(message.entries[j], options); + } + return object; + }; + + /** + * Converts this RedelegationResponse to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.RedelegationResponse + * @instance + * @returns {Object.} JSON object + */ + RedelegationResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RedelegationResponse; + })(); + + v1beta1.Pool = (function() { + + /** + * Properties of a Pool. + * @memberof cosmos.staking.v1beta1 + * @interface IPool + * @property {string|null} [not_bonded_tokens] Pool not_bonded_tokens + * @property {string|null} [bonded_tokens] Pool bonded_tokens + */ + + /** + * Constructs a new Pool. + * @memberof cosmos.staking.v1beta1 + * @classdesc Represents a Pool. + * @implements IPool + * @constructor + * @param {cosmos.staking.v1beta1.IPool=} [properties] Properties to set + */ + function Pool(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Pool not_bonded_tokens. + * @member {string} not_bonded_tokens + * @memberof cosmos.staking.v1beta1.Pool + * @instance + */ + Pool.prototype.not_bonded_tokens = ""; + + /** + * Pool bonded_tokens. + * @member {string} bonded_tokens + * @memberof cosmos.staking.v1beta1.Pool + * @instance + */ + Pool.prototype.bonded_tokens = ""; + + /** + * Encodes the specified Pool message. Does not implicitly {@link cosmos.staking.v1beta1.Pool.verify|verify} messages. + * @function encode + * @memberof cosmos.staking.v1beta1.Pool + * @static + * @param {cosmos.staking.v1beta1.IPool} message Pool message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Pool.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.not_bonded_tokens != null && Object.hasOwnProperty.call(message, "not_bonded_tokens")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.not_bonded_tokens); + if (message.bonded_tokens != null && Object.hasOwnProperty.call(message, "bonded_tokens")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.bonded_tokens); + return writer; + }; + + /** + * Encodes the specified Pool message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.Pool.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.staking.v1beta1.Pool + * @static + * @param {cosmos.staking.v1beta1.IPool} message Pool message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Pool.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Pool message from the specified reader or buffer. + * @function decode + * @memberof cosmos.staking.v1beta1.Pool + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.staking.v1beta1.Pool} Pool + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Pool.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.Pool(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.not_bonded_tokens = reader.string(); + break; + case 2: + message.bonded_tokens = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Pool message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.staking.v1beta1.Pool + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.staking.v1beta1.Pool} Pool + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Pool.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Pool message. + * @function verify + * @memberof cosmos.staking.v1beta1.Pool + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Pool.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.not_bonded_tokens != null && message.hasOwnProperty("not_bonded_tokens")) + if (!$util.isString(message.not_bonded_tokens)) + return "not_bonded_tokens: string expected"; + if (message.bonded_tokens != null && message.hasOwnProperty("bonded_tokens")) + if (!$util.isString(message.bonded_tokens)) + return "bonded_tokens: string expected"; + return null; + }; + + /** + * Creates a Pool message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.staking.v1beta1.Pool + * @static + * @param {Object.} object Plain object + * @returns {cosmos.staking.v1beta1.Pool} Pool + */ + Pool.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.staking.v1beta1.Pool) + return object; + let message = new $root.cosmos.staking.v1beta1.Pool(); + if (object.not_bonded_tokens != null) + message.not_bonded_tokens = String(object.not_bonded_tokens); + if (object.bonded_tokens != null) + message.bonded_tokens = String(object.bonded_tokens); + return message; + }; + + /** + * Creates a plain object from a Pool message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.staking.v1beta1.Pool + * @static + * @param {cosmos.staking.v1beta1.Pool} message Pool + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Pool.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.not_bonded_tokens = ""; + object.bonded_tokens = ""; + } + if (message.not_bonded_tokens != null && message.hasOwnProperty("not_bonded_tokens")) + object.not_bonded_tokens = message.not_bonded_tokens; + if (message.bonded_tokens != null && message.hasOwnProperty("bonded_tokens")) + object.bonded_tokens = message.bonded_tokens; + return object; + }; + + /** + * Converts this Pool to JSON. + * @function toJSON + * @memberof cosmos.staking.v1beta1.Pool + * @instance + * @returns {Object.} JSON object + */ + Pool.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Pool; + })(); + + return v1beta1; + })(); + + return staking; + })(); + + cosmos.tx = (function() { + + /** + * Namespace tx. + * @memberof cosmos + * @namespace + */ + const tx = {}; + + tx.signing = (function() { + + /** + * Namespace signing. + * @memberof cosmos.tx + * @namespace + */ + const signing = {}; + + signing.v1beta1 = (function() { + + /** + * Namespace v1beta1. + * @memberof cosmos.tx.signing + * @namespace + */ + const v1beta1 = {}; + + /** + * SignMode enum. + * @name cosmos.tx.signing.v1beta1.SignMode + * @enum {number} + * @property {number} SIGN_MODE_UNSPECIFIED=0 SIGN_MODE_UNSPECIFIED value + * @property {number} SIGN_MODE_DIRECT=1 SIGN_MODE_DIRECT value + * @property {number} SIGN_MODE_TEXTUAL=2 SIGN_MODE_TEXTUAL value + * @property {number} SIGN_MODE_LEGACY_AMINO_JSON=127 SIGN_MODE_LEGACY_AMINO_JSON value + */ + v1beta1.SignMode = (function() { + const valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SIGN_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SIGN_MODE_DIRECT"] = 1; + values[valuesById[2] = "SIGN_MODE_TEXTUAL"] = 2; + values[valuesById[127] = "SIGN_MODE_LEGACY_AMINO_JSON"] = 127; + return values; + })(); + + v1beta1.SignatureDescriptors = (function() { + + /** + * Properties of a SignatureDescriptors. + * @memberof cosmos.tx.signing.v1beta1 + * @interface ISignatureDescriptors + * @property {Array.|null} [signatures] SignatureDescriptors signatures + */ + + /** + * Constructs a new SignatureDescriptors. + * @memberof cosmos.tx.signing.v1beta1 + * @classdesc Represents a SignatureDescriptors. + * @implements ISignatureDescriptors + * @constructor + * @param {cosmos.tx.signing.v1beta1.ISignatureDescriptors=} [properties] Properties to set + */ + function SignatureDescriptors(properties) { + this.signatures = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SignatureDescriptors signatures. + * @member {Array.} signatures + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptors + * @instance + */ + SignatureDescriptors.prototype.signatures = $util.emptyArray; + + /** + * Encodes the specified SignatureDescriptors message. Does not implicitly {@link cosmos.tx.signing.v1beta1.SignatureDescriptors.verify|verify} messages. + * @function encode + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptors + * @static + * @param {cosmos.tx.signing.v1beta1.ISignatureDescriptors} message SignatureDescriptors message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SignatureDescriptors.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.signatures != null && message.signatures.length) + for (let i = 0; i < message.signatures.length; ++i) + $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.encode(message.signatures[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SignatureDescriptors message, length delimited. Does not implicitly {@link cosmos.tx.signing.v1beta1.SignatureDescriptors.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptors + * @static + * @param {cosmos.tx.signing.v1beta1.ISignatureDescriptors} message SignatureDescriptors message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SignatureDescriptors.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SignatureDescriptors message from the specified reader or buffer. + * @function decode + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptors + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.tx.signing.v1beta1.SignatureDescriptors} SignatureDescriptors + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SignatureDescriptors.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.signing.v1beta1.SignatureDescriptors(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.signatures && message.signatures.length)) + message.signatures = []; + message.signatures.push($root.cosmos.tx.signing.v1beta1.SignatureDescriptor.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SignatureDescriptors message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptors + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.tx.signing.v1beta1.SignatureDescriptors} SignatureDescriptors + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SignatureDescriptors.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SignatureDescriptors message. + * @function verify + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptors + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SignatureDescriptors.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.signatures != null && message.hasOwnProperty("signatures")) { + if (!Array.isArray(message.signatures)) + return "signatures: array expected"; + for (let i = 0; i < message.signatures.length; ++i) { + let error = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.verify(message.signatures[i]); + if (error) + return "signatures." + error; + } + } + return null; + }; + + /** + * Creates a SignatureDescriptors message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptors + * @static + * @param {Object.} object Plain object + * @returns {cosmos.tx.signing.v1beta1.SignatureDescriptors} SignatureDescriptors + */ + SignatureDescriptors.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.tx.signing.v1beta1.SignatureDescriptors) + return object; + let message = new $root.cosmos.tx.signing.v1beta1.SignatureDescriptors(); + if (object.signatures) { + if (!Array.isArray(object.signatures)) + throw TypeError(".cosmos.tx.signing.v1beta1.SignatureDescriptors.signatures: array expected"); + message.signatures = []; + for (let i = 0; i < object.signatures.length; ++i) { + if (typeof object.signatures[i] !== "object") + throw TypeError(".cosmos.tx.signing.v1beta1.SignatureDescriptors.signatures: object expected"); + message.signatures[i] = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.fromObject(object.signatures[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SignatureDescriptors message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptors + * @static + * @param {cosmos.tx.signing.v1beta1.SignatureDescriptors} message SignatureDescriptors + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SignatureDescriptors.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.signatures = []; + if (message.signatures && message.signatures.length) { + object.signatures = []; + for (let j = 0; j < message.signatures.length; ++j) + object.signatures[j] = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.toObject(message.signatures[j], options); + } + return object; + }; + + /** + * Converts this SignatureDescriptors to JSON. + * @function toJSON + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptors + * @instance + * @returns {Object.} JSON object + */ + SignatureDescriptors.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SignatureDescriptors; + })(); + + v1beta1.SignatureDescriptor = (function() { + + /** + * Properties of a SignatureDescriptor. + * @memberof cosmos.tx.signing.v1beta1 + * @interface ISignatureDescriptor + * @property {google.protobuf.IAny|null} [public_key] SignatureDescriptor public_key + * @property {cosmos.tx.signing.v1beta1.SignatureDescriptor.IData|null} [data] SignatureDescriptor data + * @property {Long|null} [sequence] SignatureDescriptor sequence + */ + + /** + * Constructs a new SignatureDescriptor. + * @memberof cosmos.tx.signing.v1beta1 + * @classdesc Represents a SignatureDescriptor. + * @implements ISignatureDescriptor + * @constructor + * @param {cosmos.tx.signing.v1beta1.ISignatureDescriptor=} [properties] Properties to set + */ + function SignatureDescriptor(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SignatureDescriptor public_key. + * @member {google.protobuf.IAny|null|undefined} public_key + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor + * @instance + */ + SignatureDescriptor.prototype.public_key = null; + + /** + * SignatureDescriptor data. + * @member {cosmos.tx.signing.v1beta1.SignatureDescriptor.IData|null|undefined} data + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor + * @instance + */ + SignatureDescriptor.prototype.data = null; + + /** + * SignatureDescriptor sequence. + * @member {Long} sequence + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor + * @instance + */ + SignatureDescriptor.prototype.sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified SignatureDescriptor message. Does not implicitly {@link cosmos.tx.signing.v1beta1.SignatureDescriptor.verify|verify} messages. + * @function encode + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor + * @static + * @param {cosmos.tx.signing.v1beta1.ISignatureDescriptor} message SignatureDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SignatureDescriptor.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.public_key != null && Object.hasOwnProperty.call(message, "public_key")) + $root.google.protobuf.Any.encode(message.public_key, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.data != null && Object.hasOwnProperty.call(message, "data")) + $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.encode(message.data, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.sequence != null && Object.hasOwnProperty.call(message, "sequence")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.sequence); + return writer; + }; + + /** + * Encodes the specified SignatureDescriptor message, length delimited. Does not implicitly {@link cosmos.tx.signing.v1beta1.SignatureDescriptor.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor + * @static + * @param {cosmos.tx.signing.v1beta1.ISignatureDescriptor} message SignatureDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SignatureDescriptor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SignatureDescriptor message from the specified reader or buffer. + * @function decode + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.tx.signing.v1beta1.SignatureDescriptor} SignatureDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SignatureDescriptor.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.signing.v1beta1.SignatureDescriptor(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.public_key = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 2: + message.data = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.decode(reader, reader.uint32()); + break; + case 3: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SignatureDescriptor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.tx.signing.v1beta1.SignatureDescriptor} SignatureDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SignatureDescriptor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SignatureDescriptor message. + * @function verify + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SignatureDescriptor.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.public_key != null && message.hasOwnProperty("public_key")) { + let error = $root.google.protobuf.Any.verify(message.public_key); + if (error) + return "public_key." + error; + } + if (message.data != null && message.hasOwnProperty("data")) { + let error = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.verify(message.data); + if (error) + return "data." + error; + } + if (message.sequence != null && message.hasOwnProperty("sequence")) + if (!$util.isInteger(message.sequence) && !(message.sequence && $util.isInteger(message.sequence.low) && $util.isInteger(message.sequence.high))) + return "sequence: integer|Long expected"; + return null; + }; + + /** + * Creates a SignatureDescriptor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor + * @static + * @param {Object.} object Plain object + * @returns {cosmos.tx.signing.v1beta1.SignatureDescriptor} SignatureDescriptor + */ + SignatureDescriptor.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.tx.signing.v1beta1.SignatureDescriptor) + return object; + let message = new $root.cosmos.tx.signing.v1beta1.SignatureDescriptor(); + if (object.public_key != null) { + if (typeof object.public_key !== "object") + throw TypeError(".cosmos.tx.signing.v1beta1.SignatureDescriptor.public_key: object expected"); + message.public_key = $root.google.protobuf.Any.fromObject(object.public_key); + } + if (object.data != null) { + if (typeof object.data !== "object") + throw TypeError(".cosmos.tx.signing.v1beta1.SignatureDescriptor.data: object expected"); + message.data = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.fromObject(object.data); + } + if (object.sequence != null) + if ($util.Long) + (message.sequence = $util.Long.fromValue(object.sequence)).unsigned = true; + else if (typeof object.sequence === "string") + message.sequence = parseInt(object.sequence, 10); + else if (typeof object.sequence === "number") + message.sequence = object.sequence; + else if (typeof object.sequence === "object") + message.sequence = new $util.LongBits(object.sequence.low >>> 0, object.sequence.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a SignatureDescriptor message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor + * @static + * @param {cosmos.tx.signing.v1beta1.SignatureDescriptor} message SignatureDescriptor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SignatureDescriptor.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.public_key = null; + object.data = null; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.sequence = options.longs === String ? "0" : 0; + } + if (message.public_key != null && message.hasOwnProperty("public_key")) + object.public_key = $root.google.protobuf.Any.toObject(message.public_key, options); + if (message.data != null && message.hasOwnProperty("data")) + object.data = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.toObject(message.data, options); + if (message.sequence != null && message.hasOwnProperty("sequence")) + if (typeof message.sequence === "number") + object.sequence = options.longs === String ? String(message.sequence) : message.sequence; + else + object.sequence = options.longs === String ? $util.Long.prototype.toString.call(message.sequence) : options.longs === Number ? new $util.LongBits(message.sequence.low >>> 0, message.sequence.high >>> 0).toNumber(true) : message.sequence; + return object; + }; + + /** + * Converts this SignatureDescriptor to JSON. + * @function toJSON + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor + * @instance + * @returns {Object.} JSON object + */ + SignatureDescriptor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + SignatureDescriptor.Data = (function() { + + /** + * Properties of a Data. + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor + * @interface IData + * @property {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.ISingle|null} [single] Data single + * @property {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.IMulti|null} [multi] Data multi + */ + + /** + * Constructs a new Data. + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor + * @classdesc Represents a Data. + * @implements IData + * @constructor + * @param {cosmos.tx.signing.v1beta1.SignatureDescriptor.IData=} [properties] Properties to set + */ + function Data(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Data single. + * @member {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.ISingle|null|undefined} single + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data + * @instance + */ + Data.prototype.single = null; + + /** + * Data multi. + * @member {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.IMulti|null|undefined} multi + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data + * @instance + */ + Data.prototype.multi = null; + + // OneOf field names bound to virtual getters and setters + let $oneOfFields; + + /** + * Data sum. + * @member {"single"|"multi"|undefined} sum + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data + * @instance + */ + Object.defineProperty(Data.prototype, "sum", { + get: $util.oneOfGetter($oneOfFields = ["single", "multi"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Encodes the specified Data message. Does not implicitly {@link cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.verify|verify} messages. + * @function encode + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data + * @static + * @param {cosmos.tx.signing.v1beta1.SignatureDescriptor.IData} message Data message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Data.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.single != null && Object.hasOwnProperty.call(message, "single")) + $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single.encode(message.single, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.multi != null && Object.hasOwnProperty.call(message, "multi")) + $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi.encode(message.multi, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Data message, length delimited. Does not implicitly {@link cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data + * @static + * @param {cosmos.tx.signing.v1beta1.SignatureDescriptor.IData} message Data message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Data.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Data message from the specified reader or buffer. + * @function decode + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data} Data + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Data.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.single = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single.decode(reader, reader.uint32()); + break; + case 2: + message.multi = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Data message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data} Data + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Data.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Data message. + * @function verify + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Data.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + let properties = {}; + if (message.single != null && message.hasOwnProperty("single")) { + properties.sum = 1; + { + let error = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single.verify(message.single); + if (error) + return "single." + error; + } + } + if (message.multi != null && message.hasOwnProperty("multi")) { + if (properties.sum === 1) + return "sum: multiple values"; + properties.sum = 1; + { + let error = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi.verify(message.multi); + if (error) + return "multi." + error; + } + } + return null; + }; + + /** + * Creates a Data message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data + * @static + * @param {Object.} object Plain object + * @returns {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data} Data + */ + Data.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data) + return object; + let message = new $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data(); + if (object.single != null) { + if (typeof object.single !== "object") + throw TypeError(".cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.single: object expected"); + message.single = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single.fromObject(object.single); + } + if (object.multi != null) { + if (typeof object.multi !== "object") + throw TypeError(".cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.multi: object expected"); + message.multi = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi.fromObject(object.multi); + } + return message; + }; + + /** + * Creates a plain object from a Data message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data + * @static + * @param {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data} message Data + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Data.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (message.single != null && message.hasOwnProperty("single")) { + object.single = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single.toObject(message.single, options); + if (options.oneofs) + object.sum = "single"; + } + if (message.multi != null && message.hasOwnProperty("multi")) { + object.multi = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi.toObject(message.multi, options); + if (options.oneofs) + object.sum = "multi"; + } + return object; + }; + + /** + * Converts this Data to JSON. + * @function toJSON + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data + * @instance + * @returns {Object.} JSON object + */ + Data.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Data.Single = (function() { + + /** + * Properties of a Single. + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data + * @interface ISingle + * @property {cosmos.tx.signing.v1beta1.SignMode|null} [mode] Single mode + * @property {Uint8Array|null} [signature] Single signature + */ + + /** + * Constructs a new Single. + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data + * @classdesc Represents a Single. + * @implements ISingle + * @constructor + * @param {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.ISingle=} [properties] Properties to set + */ + function Single(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Single mode. + * @member {cosmos.tx.signing.v1beta1.SignMode} mode + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single + * @instance + */ + Single.prototype.mode = 0; + + /** + * Single signature. + * @member {Uint8Array} signature + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single + * @instance + */ + Single.prototype.signature = $util.newBuffer([]); + + /** + * Encodes the specified Single message. Does not implicitly {@link cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single.verify|verify} messages. + * @function encode + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single + * @static + * @param {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.ISingle} message Single message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Single.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mode); + if (message.signature != null && Object.hasOwnProperty.call(message, "signature")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.signature); + return writer; + }; + + /** + * Encodes the specified Single message, length delimited. Does not implicitly {@link cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single + * @static + * @param {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.ISingle} message Single message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Single.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Single message from the specified reader or buffer. + * @function decode + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single} Single + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Single.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mode = reader.int32(); + break; + case 2: + message.signature = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Single message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single} Single + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Single.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Single message. + * @function verify + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Single.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mode != null && message.hasOwnProperty("mode")) + switch (message.mode) { + default: + return "mode: enum value expected"; + case 0: + case 1: + case 2: + case 127: + break; + } + if (message.signature != null && message.hasOwnProperty("signature")) + if (!(message.signature && typeof message.signature.length === "number" || $util.isString(message.signature))) + return "signature: buffer expected"; + return null; + }; + + /** + * Creates a Single message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single + * @static + * @param {Object.} object Plain object + * @returns {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single} Single + */ + Single.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single) + return object; + let message = new $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single(); + switch (object.mode) { + case "SIGN_MODE_UNSPECIFIED": + case 0: + message.mode = 0; + break; + case "SIGN_MODE_DIRECT": + case 1: + message.mode = 1; + break; + case "SIGN_MODE_TEXTUAL": + case 2: + message.mode = 2; + break; + case "SIGN_MODE_LEGACY_AMINO_JSON": + case 127: + message.mode = 127; + break; + } + if (object.signature != null) + if (typeof object.signature === "string") + $util.base64.decode(object.signature, message.signature = $util.newBuffer($util.base64.length(object.signature)), 0); + else if (object.signature.length) + message.signature = object.signature; + return message; + }; + + /** + * Creates a plain object from a Single message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single + * @static + * @param {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single} message Single + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Single.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.mode = options.enums === String ? "SIGN_MODE_UNSPECIFIED" : 0; + if (options.bytes === String) + object.signature = ""; + else { + object.signature = []; + if (options.bytes !== Array) + object.signature = $util.newBuffer(object.signature); + } + } + if (message.mode != null && message.hasOwnProperty("mode")) + object.mode = options.enums === String ? $root.cosmos.tx.signing.v1beta1.SignMode[message.mode] : message.mode; + if (message.signature != null && message.hasOwnProperty("signature")) + object.signature = options.bytes === String ? $util.base64.encode(message.signature, 0, message.signature.length) : options.bytes === Array ? Array.prototype.slice.call(message.signature) : message.signature; + return object; + }; + + /** + * Converts this Single to JSON. + * @function toJSON + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single + * @instance + * @returns {Object.} JSON object + */ + Single.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Single; + })(); + + Data.Multi = (function() { + + /** + * Properties of a Multi. + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data + * @interface IMulti + * @property {cosmos.crypto.multisig.v1beta1.ICompactBitArray|null} [bitarray] Multi bitarray + * @property {Array.|null} [signatures] Multi signatures + */ + + /** + * Constructs a new Multi. + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data + * @classdesc Represents a Multi. + * @implements IMulti + * @constructor + * @param {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.IMulti=} [properties] Properties to set + */ + function Multi(properties) { + this.signatures = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Multi bitarray. + * @member {cosmos.crypto.multisig.v1beta1.ICompactBitArray|null|undefined} bitarray + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi + * @instance + */ + Multi.prototype.bitarray = null; + + /** + * Multi signatures. + * @member {Array.} signatures + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi + * @instance + */ + Multi.prototype.signatures = $util.emptyArray; + + /** + * Encodes the specified Multi message. Does not implicitly {@link cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi.verify|verify} messages. + * @function encode + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi + * @static + * @param {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.IMulti} message Multi message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Multi.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.bitarray != null && Object.hasOwnProperty.call(message, "bitarray")) + $root.cosmos.crypto.multisig.v1beta1.CompactBitArray.encode(message.bitarray, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.signatures != null && message.signatures.length) + for (let i = 0; i < message.signatures.length; ++i) + $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.encode(message.signatures[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Multi message, length delimited. Does not implicitly {@link cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi + * @static + * @param {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.IMulti} message Multi message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Multi.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Multi message from the specified reader or buffer. + * @function decode + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi} Multi + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Multi.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bitarray = $root.cosmos.crypto.multisig.v1beta1.CompactBitArray.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.signatures && message.signatures.length)) + message.signatures = []; + message.signatures.push($root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Multi message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi} Multi + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Multi.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Multi message. + * @function verify + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Multi.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.bitarray != null && message.hasOwnProperty("bitarray")) { + let error = $root.cosmos.crypto.multisig.v1beta1.CompactBitArray.verify(message.bitarray); + if (error) + return "bitarray." + error; + } + if (message.signatures != null && message.hasOwnProperty("signatures")) { + if (!Array.isArray(message.signatures)) + return "signatures: array expected"; + for (let i = 0; i < message.signatures.length; ++i) { + let error = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.verify(message.signatures[i]); + if (error) + return "signatures." + error; + } + } + return null; + }; + + /** + * Creates a Multi message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi + * @static + * @param {Object.} object Plain object + * @returns {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi} Multi + */ + Multi.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi) + return object; + let message = new $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi(); + if (object.bitarray != null) { + if (typeof object.bitarray !== "object") + throw TypeError(".cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi.bitarray: object expected"); + message.bitarray = $root.cosmos.crypto.multisig.v1beta1.CompactBitArray.fromObject(object.bitarray); + } + if (object.signatures) { + if (!Array.isArray(object.signatures)) + throw TypeError(".cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi.signatures: array expected"); + message.signatures = []; + for (let i = 0; i < object.signatures.length; ++i) { + if (typeof object.signatures[i] !== "object") + throw TypeError(".cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi.signatures: object expected"); + message.signatures[i] = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.fromObject(object.signatures[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Multi message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi + * @static + * @param {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi} message Multi + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Multi.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.signatures = []; + if (options.defaults) + object.bitarray = null; + if (message.bitarray != null && message.hasOwnProperty("bitarray")) + object.bitarray = $root.cosmos.crypto.multisig.v1beta1.CompactBitArray.toObject(message.bitarray, options); + if (message.signatures && message.signatures.length) { + object.signatures = []; + for (let j = 0; j < message.signatures.length; ++j) + object.signatures[j] = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.toObject(message.signatures[j], options); + } + return object; + }; + + /** + * Converts this Multi to JSON. + * @function toJSON + * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi + * @instance + * @returns {Object.} JSON object + */ + Multi.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Multi; + })(); + + return Data; + })(); + + return SignatureDescriptor; + })(); + + return v1beta1; + })(); + + return signing; + })(); + + tx.v1beta1 = (function() { + + /** + * Namespace v1beta1. + * @memberof cosmos.tx + * @namespace + */ + const v1beta1 = {}; + + v1beta1.Tx = (function() { + + /** + * Properties of a Tx. + * @memberof cosmos.tx.v1beta1 + * @interface ITx + * @property {cosmos.tx.v1beta1.ITxBody|null} [body] Tx body + * @property {cosmos.tx.v1beta1.IAuthInfo|null} [auth_info] Tx auth_info + * @property {Array.|null} [signatures] Tx signatures + */ + + /** + * Constructs a new Tx. + * @memberof cosmos.tx.v1beta1 + * @classdesc Represents a Tx. + * @implements ITx + * @constructor + * @param {cosmos.tx.v1beta1.ITx=} [properties] Properties to set + */ + function Tx(properties) { + this.signatures = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Tx body. + * @member {cosmos.tx.v1beta1.ITxBody|null|undefined} body + * @memberof cosmos.tx.v1beta1.Tx + * @instance + */ + Tx.prototype.body = null; + + /** + * Tx auth_info. + * @member {cosmos.tx.v1beta1.IAuthInfo|null|undefined} auth_info + * @memberof cosmos.tx.v1beta1.Tx + * @instance + */ + Tx.prototype.auth_info = null; + + /** + * Tx signatures. + * @member {Array.} signatures + * @memberof cosmos.tx.v1beta1.Tx + * @instance + */ + Tx.prototype.signatures = $util.emptyArray; + + /** + * Encodes the specified Tx message. Does not implicitly {@link cosmos.tx.v1beta1.Tx.verify|verify} messages. + * @function encode + * @memberof cosmos.tx.v1beta1.Tx + * @static + * @param {cosmos.tx.v1beta1.ITx} message Tx message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Tx.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.cosmos.tx.v1beta1.TxBody.encode(message.body, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.auth_info != null && Object.hasOwnProperty.call(message, "auth_info")) + $root.cosmos.tx.v1beta1.AuthInfo.encode(message.auth_info, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.signatures != null && message.signatures.length) + for (let i = 0; i < message.signatures.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.signatures[i]); + return writer; + }; + + /** + * Encodes the specified Tx message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.Tx.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.tx.v1beta1.Tx + * @static + * @param {cosmos.tx.v1beta1.ITx} message Tx message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Tx.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Tx message from the specified reader or buffer. + * @function decode + * @memberof cosmos.tx.v1beta1.Tx + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.tx.v1beta1.Tx} Tx + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Tx.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.Tx(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.body = $root.cosmos.tx.v1beta1.TxBody.decode(reader, reader.uint32()); + break; + case 2: + message.auth_info = $root.cosmos.tx.v1beta1.AuthInfo.decode(reader, reader.uint32()); + break; + case 3: + if (!(message.signatures && message.signatures.length)) + message.signatures = []; + message.signatures.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Tx message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.tx.v1beta1.Tx + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.tx.v1beta1.Tx} Tx + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Tx.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Tx message. + * @function verify + * @memberof cosmos.tx.v1beta1.Tx + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Tx.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.body != null && message.hasOwnProperty("body")) { + let error = $root.cosmos.tx.v1beta1.TxBody.verify(message.body); + if (error) + return "body." + error; + } + if (message.auth_info != null && message.hasOwnProperty("auth_info")) { + let error = $root.cosmos.tx.v1beta1.AuthInfo.verify(message.auth_info); + if (error) + return "auth_info." + error; + } + if (message.signatures != null && message.hasOwnProperty("signatures")) { + if (!Array.isArray(message.signatures)) + return "signatures: array expected"; + for (let i = 0; i < message.signatures.length; ++i) + if (!(message.signatures[i] && typeof message.signatures[i].length === "number" || $util.isString(message.signatures[i]))) + return "signatures: buffer[] expected"; + } + return null; + }; + + /** + * Creates a Tx message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.tx.v1beta1.Tx + * @static + * @param {Object.} object Plain object + * @returns {cosmos.tx.v1beta1.Tx} Tx + */ + Tx.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.tx.v1beta1.Tx) + return object; + let message = new $root.cosmos.tx.v1beta1.Tx(); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".cosmos.tx.v1beta1.Tx.body: object expected"); + message.body = $root.cosmos.tx.v1beta1.TxBody.fromObject(object.body); + } + if (object.auth_info != null) { + if (typeof object.auth_info !== "object") + throw TypeError(".cosmos.tx.v1beta1.Tx.auth_info: object expected"); + message.auth_info = $root.cosmos.tx.v1beta1.AuthInfo.fromObject(object.auth_info); + } + if (object.signatures) { + if (!Array.isArray(object.signatures)) + throw TypeError(".cosmos.tx.v1beta1.Tx.signatures: array expected"); + message.signatures = []; + for (let i = 0; i < object.signatures.length; ++i) + if (typeof object.signatures[i] === "string") + $util.base64.decode(object.signatures[i], message.signatures[i] = $util.newBuffer($util.base64.length(object.signatures[i])), 0); + else if (object.signatures[i].length) + message.signatures[i] = object.signatures[i]; + } + return message; + }; + + /** + * Creates a plain object from a Tx message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.tx.v1beta1.Tx + * @static + * @param {cosmos.tx.v1beta1.Tx} message Tx + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Tx.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.signatures = []; + if (options.defaults) { + object.body = null; + object.auth_info = null; + } + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.cosmos.tx.v1beta1.TxBody.toObject(message.body, options); + if (message.auth_info != null && message.hasOwnProperty("auth_info")) + object.auth_info = $root.cosmos.tx.v1beta1.AuthInfo.toObject(message.auth_info, options); + if (message.signatures && message.signatures.length) { + object.signatures = []; + for (let j = 0; j < message.signatures.length; ++j) + object.signatures[j] = options.bytes === String ? $util.base64.encode(message.signatures[j], 0, message.signatures[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.signatures[j]) : message.signatures[j]; + } + return object; + }; + + /** + * Converts this Tx to JSON. + * @function toJSON + * @memberof cosmos.tx.v1beta1.Tx + * @instance + * @returns {Object.} JSON object + */ + Tx.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Tx; + })(); + + v1beta1.TxRaw = (function() { + + /** + * Properties of a TxRaw. + * @memberof cosmos.tx.v1beta1 + * @interface ITxRaw + * @property {Uint8Array|null} [body_bytes] TxRaw body_bytes + * @property {Uint8Array|null} [auth_info_bytes] TxRaw auth_info_bytes + * @property {Array.|null} [signatures] TxRaw signatures + */ + + /** + * Constructs a new TxRaw. + * @memberof cosmos.tx.v1beta1 + * @classdesc Represents a TxRaw. + * @implements ITxRaw + * @constructor + * @param {cosmos.tx.v1beta1.ITxRaw=} [properties] Properties to set + */ + function TxRaw(properties) { + this.signatures = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TxRaw body_bytes. + * @member {Uint8Array} body_bytes + * @memberof cosmos.tx.v1beta1.TxRaw + * @instance + */ + TxRaw.prototype.body_bytes = $util.newBuffer([]); + + /** + * TxRaw auth_info_bytes. + * @member {Uint8Array} auth_info_bytes + * @memberof cosmos.tx.v1beta1.TxRaw + * @instance + */ + TxRaw.prototype.auth_info_bytes = $util.newBuffer([]); + + /** + * TxRaw signatures. + * @member {Array.} signatures + * @memberof cosmos.tx.v1beta1.TxRaw + * @instance + */ + TxRaw.prototype.signatures = $util.emptyArray; + + /** + * Encodes the specified TxRaw message. Does not implicitly {@link cosmos.tx.v1beta1.TxRaw.verify|verify} messages. + * @function encode + * @memberof cosmos.tx.v1beta1.TxRaw + * @static + * @param {cosmos.tx.v1beta1.ITxRaw} message TxRaw message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TxRaw.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.body_bytes != null && Object.hasOwnProperty.call(message, "body_bytes")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.body_bytes); + if (message.auth_info_bytes != null && Object.hasOwnProperty.call(message, "auth_info_bytes")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.auth_info_bytes); + if (message.signatures != null && message.signatures.length) + for (let i = 0; i < message.signatures.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.signatures[i]); + return writer; + }; + + /** + * Encodes the specified TxRaw message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.TxRaw.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.tx.v1beta1.TxRaw + * @static + * @param {cosmos.tx.v1beta1.ITxRaw} message TxRaw message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TxRaw.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TxRaw message from the specified reader or buffer. + * @function decode + * @memberof cosmos.tx.v1beta1.TxRaw + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.tx.v1beta1.TxRaw} TxRaw + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TxRaw.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.TxRaw(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.body_bytes = reader.bytes(); + break; + case 2: + message.auth_info_bytes = reader.bytes(); + break; + case 3: + if (!(message.signatures && message.signatures.length)) + message.signatures = []; + message.signatures.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TxRaw message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.tx.v1beta1.TxRaw + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.tx.v1beta1.TxRaw} TxRaw + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TxRaw.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TxRaw message. + * @function verify + * @memberof cosmos.tx.v1beta1.TxRaw + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TxRaw.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.body_bytes != null && message.hasOwnProperty("body_bytes")) + if (!(message.body_bytes && typeof message.body_bytes.length === "number" || $util.isString(message.body_bytes))) + return "body_bytes: buffer expected"; + if (message.auth_info_bytes != null && message.hasOwnProperty("auth_info_bytes")) + if (!(message.auth_info_bytes && typeof message.auth_info_bytes.length === "number" || $util.isString(message.auth_info_bytes))) + return "auth_info_bytes: buffer expected"; + if (message.signatures != null && message.hasOwnProperty("signatures")) { + if (!Array.isArray(message.signatures)) + return "signatures: array expected"; + for (let i = 0; i < message.signatures.length; ++i) + if (!(message.signatures[i] && typeof message.signatures[i].length === "number" || $util.isString(message.signatures[i]))) + return "signatures: buffer[] expected"; + } + return null; + }; + + /** + * Creates a TxRaw message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.tx.v1beta1.TxRaw + * @static + * @param {Object.} object Plain object + * @returns {cosmos.tx.v1beta1.TxRaw} TxRaw + */ + TxRaw.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.tx.v1beta1.TxRaw) + return object; + let message = new $root.cosmos.tx.v1beta1.TxRaw(); + if (object.body_bytes != null) + if (typeof object.body_bytes === "string") + $util.base64.decode(object.body_bytes, message.body_bytes = $util.newBuffer($util.base64.length(object.body_bytes)), 0); + else if (object.body_bytes.length) + message.body_bytes = object.body_bytes; + if (object.auth_info_bytes != null) + if (typeof object.auth_info_bytes === "string") + $util.base64.decode(object.auth_info_bytes, message.auth_info_bytes = $util.newBuffer($util.base64.length(object.auth_info_bytes)), 0); + else if (object.auth_info_bytes.length) + message.auth_info_bytes = object.auth_info_bytes; + if (object.signatures) { + if (!Array.isArray(object.signatures)) + throw TypeError(".cosmos.tx.v1beta1.TxRaw.signatures: array expected"); + message.signatures = []; + for (let i = 0; i < object.signatures.length; ++i) + if (typeof object.signatures[i] === "string") + $util.base64.decode(object.signatures[i], message.signatures[i] = $util.newBuffer($util.base64.length(object.signatures[i])), 0); + else if (object.signatures[i].length) + message.signatures[i] = object.signatures[i]; + } + return message; + }; + + /** + * Creates a plain object from a TxRaw message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.tx.v1beta1.TxRaw + * @static + * @param {cosmos.tx.v1beta1.TxRaw} message TxRaw + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TxRaw.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.signatures = []; + if (options.defaults) { + if (options.bytes === String) + object.body_bytes = ""; + else { + object.body_bytes = []; + if (options.bytes !== Array) + object.body_bytes = $util.newBuffer(object.body_bytes); + } + if (options.bytes === String) + object.auth_info_bytes = ""; + else { + object.auth_info_bytes = []; + if (options.bytes !== Array) + object.auth_info_bytes = $util.newBuffer(object.auth_info_bytes); + } + } + if (message.body_bytes != null && message.hasOwnProperty("body_bytes")) + object.body_bytes = options.bytes === String ? $util.base64.encode(message.body_bytes, 0, message.body_bytes.length) : options.bytes === Array ? Array.prototype.slice.call(message.body_bytes) : message.body_bytes; + if (message.auth_info_bytes != null && message.hasOwnProperty("auth_info_bytes")) + object.auth_info_bytes = options.bytes === String ? $util.base64.encode(message.auth_info_bytes, 0, message.auth_info_bytes.length) : options.bytes === Array ? Array.prototype.slice.call(message.auth_info_bytes) : message.auth_info_bytes; + if (message.signatures && message.signatures.length) { + object.signatures = []; + for (let j = 0; j < message.signatures.length; ++j) + object.signatures[j] = options.bytes === String ? $util.base64.encode(message.signatures[j], 0, message.signatures[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.signatures[j]) : message.signatures[j]; + } + return object; + }; + + /** + * Converts this TxRaw to JSON. + * @function toJSON + * @memberof cosmos.tx.v1beta1.TxRaw + * @instance + * @returns {Object.} JSON object + */ + TxRaw.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TxRaw; + })(); + + v1beta1.SignDoc = (function() { + + /** + * Properties of a SignDoc. + * @memberof cosmos.tx.v1beta1 + * @interface ISignDoc + * @property {Uint8Array|null} [body_bytes] SignDoc body_bytes + * @property {Uint8Array|null} [auth_info_bytes] SignDoc auth_info_bytes + * @property {string|null} [chain_id] SignDoc chain_id + * @property {Long|null} [account_number] SignDoc account_number + */ + + /** + * Constructs a new SignDoc. + * @memberof cosmos.tx.v1beta1 + * @classdesc Represents a SignDoc. + * @implements ISignDoc + * @constructor + * @param {cosmos.tx.v1beta1.ISignDoc=} [properties] Properties to set + */ + function SignDoc(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SignDoc body_bytes. + * @member {Uint8Array} body_bytes + * @memberof cosmos.tx.v1beta1.SignDoc + * @instance + */ + SignDoc.prototype.body_bytes = $util.newBuffer([]); + + /** + * SignDoc auth_info_bytes. + * @member {Uint8Array} auth_info_bytes + * @memberof cosmos.tx.v1beta1.SignDoc + * @instance + */ + SignDoc.prototype.auth_info_bytes = $util.newBuffer([]); + + /** + * SignDoc chain_id. + * @member {string} chain_id + * @memberof cosmos.tx.v1beta1.SignDoc + * @instance + */ + SignDoc.prototype.chain_id = ""; + + /** + * SignDoc account_number. + * @member {Long} account_number + * @memberof cosmos.tx.v1beta1.SignDoc + * @instance + */ + SignDoc.prototype.account_number = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified SignDoc message. Does not implicitly {@link cosmos.tx.v1beta1.SignDoc.verify|verify} messages. + * @function encode + * @memberof cosmos.tx.v1beta1.SignDoc + * @static + * @param {cosmos.tx.v1beta1.ISignDoc} message SignDoc message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SignDoc.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.body_bytes != null && Object.hasOwnProperty.call(message, "body_bytes")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.body_bytes); + if (message.auth_info_bytes != null && Object.hasOwnProperty.call(message, "auth_info_bytes")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.auth_info_bytes); + if (message.chain_id != null && Object.hasOwnProperty.call(message, "chain_id")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.chain_id); + if (message.account_number != null && Object.hasOwnProperty.call(message, "account_number")) + writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.account_number); + return writer; + }; + + /** + * Encodes the specified SignDoc message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.SignDoc.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.tx.v1beta1.SignDoc + * @static + * @param {cosmos.tx.v1beta1.ISignDoc} message SignDoc message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SignDoc.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SignDoc message from the specified reader or buffer. + * @function decode + * @memberof cosmos.tx.v1beta1.SignDoc + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.tx.v1beta1.SignDoc} SignDoc + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SignDoc.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.SignDoc(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.body_bytes = reader.bytes(); + break; + case 2: + message.auth_info_bytes = reader.bytes(); + break; + case 3: + message.chain_id = reader.string(); + break; + case 4: + message.account_number = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SignDoc message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.tx.v1beta1.SignDoc + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.tx.v1beta1.SignDoc} SignDoc + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SignDoc.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SignDoc message. + * @function verify + * @memberof cosmos.tx.v1beta1.SignDoc + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SignDoc.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.body_bytes != null && message.hasOwnProperty("body_bytes")) + if (!(message.body_bytes && typeof message.body_bytes.length === "number" || $util.isString(message.body_bytes))) + return "body_bytes: buffer expected"; + if (message.auth_info_bytes != null && message.hasOwnProperty("auth_info_bytes")) + if (!(message.auth_info_bytes && typeof message.auth_info_bytes.length === "number" || $util.isString(message.auth_info_bytes))) + return "auth_info_bytes: buffer expected"; + if (message.chain_id != null && message.hasOwnProperty("chain_id")) + if (!$util.isString(message.chain_id)) + return "chain_id: string expected"; + if (message.account_number != null && message.hasOwnProperty("account_number")) + if (!$util.isInteger(message.account_number) && !(message.account_number && $util.isInteger(message.account_number.low) && $util.isInteger(message.account_number.high))) + return "account_number: integer|Long expected"; + return null; + }; + + /** + * Creates a SignDoc message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.tx.v1beta1.SignDoc + * @static + * @param {Object.} object Plain object + * @returns {cosmos.tx.v1beta1.SignDoc} SignDoc + */ + SignDoc.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.tx.v1beta1.SignDoc) + return object; + let message = new $root.cosmos.tx.v1beta1.SignDoc(); + if (object.body_bytes != null) + if (typeof object.body_bytes === "string") + $util.base64.decode(object.body_bytes, message.body_bytes = $util.newBuffer($util.base64.length(object.body_bytes)), 0); + else if (object.body_bytes.length) + message.body_bytes = object.body_bytes; + if (object.auth_info_bytes != null) + if (typeof object.auth_info_bytes === "string") + $util.base64.decode(object.auth_info_bytes, message.auth_info_bytes = $util.newBuffer($util.base64.length(object.auth_info_bytes)), 0); + else if (object.auth_info_bytes.length) + message.auth_info_bytes = object.auth_info_bytes; + if (object.chain_id != null) + message.chain_id = String(object.chain_id); + if (object.account_number != null) + if ($util.Long) + (message.account_number = $util.Long.fromValue(object.account_number)).unsigned = true; + else if (typeof object.account_number === "string") + message.account_number = parseInt(object.account_number, 10); + else if (typeof object.account_number === "number") + message.account_number = object.account_number; + else if (typeof object.account_number === "object") + message.account_number = new $util.LongBits(object.account_number.low >>> 0, object.account_number.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a SignDoc message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.tx.v1beta1.SignDoc + * @static + * @param {cosmos.tx.v1beta1.SignDoc} message SignDoc + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SignDoc.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if (options.bytes === String) + object.body_bytes = ""; + else { + object.body_bytes = []; + if (options.bytes !== Array) + object.body_bytes = $util.newBuffer(object.body_bytes); + } + if (options.bytes === String) + object.auth_info_bytes = ""; + else { + object.auth_info_bytes = []; + if (options.bytes !== Array) + object.auth_info_bytes = $util.newBuffer(object.auth_info_bytes); + } + object.chain_id = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.account_number = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.account_number = options.longs === String ? "0" : 0; + } + if (message.body_bytes != null && message.hasOwnProperty("body_bytes")) + object.body_bytes = options.bytes === String ? $util.base64.encode(message.body_bytes, 0, message.body_bytes.length) : options.bytes === Array ? Array.prototype.slice.call(message.body_bytes) : message.body_bytes; + if (message.auth_info_bytes != null && message.hasOwnProperty("auth_info_bytes")) + object.auth_info_bytes = options.bytes === String ? $util.base64.encode(message.auth_info_bytes, 0, message.auth_info_bytes.length) : options.bytes === Array ? Array.prototype.slice.call(message.auth_info_bytes) : message.auth_info_bytes; + if (message.chain_id != null && message.hasOwnProperty("chain_id")) + object.chain_id = message.chain_id; + if (message.account_number != null && message.hasOwnProperty("account_number")) + if (typeof message.account_number === "number") + object.account_number = options.longs === String ? String(message.account_number) : message.account_number; + else + object.account_number = options.longs === String ? $util.Long.prototype.toString.call(message.account_number) : options.longs === Number ? new $util.LongBits(message.account_number.low >>> 0, message.account_number.high >>> 0).toNumber(true) : message.account_number; + return object; + }; + + /** + * Converts this SignDoc to JSON. + * @function toJSON + * @memberof cosmos.tx.v1beta1.SignDoc + * @instance + * @returns {Object.} JSON object + */ + SignDoc.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SignDoc; + })(); + + v1beta1.TxBody = (function() { + + /** + * Properties of a TxBody. + * @memberof cosmos.tx.v1beta1 + * @interface ITxBody + * @property {Array.|null} [messages] TxBody messages + * @property {string|null} [memo] TxBody memo + * @property {Long|null} [timeout_height] TxBody timeout_height + * @property {Array.|null} [extension_options] TxBody extension_options + * @property {Array.|null} [non_critical_extension_options] TxBody non_critical_extension_options + */ + + /** + * Constructs a new TxBody. + * @memberof cosmos.tx.v1beta1 + * @classdesc Represents a TxBody. + * @implements ITxBody + * @constructor + * @param {cosmos.tx.v1beta1.ITxBody=} [properties] Properties to set + */ + function TxBody(properties) { + this.messages = []; + this.extension_options = []; + this.non_critical_extension_options = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TxBody messages. + * @member {Array.} messages + * @memberof cosmos.tx.v1beta1.TxBody + * @instance + */ + TxBody.prototype.messages = $util.emptyArray; + + /** + * TxBody memo. + * @member {string} memo + * @memberof cosmos.tx.v1beta1.TxBody + * @instance + */ + TxBody.prototype.memo = ""; + + /** + * TxBody timeout_height. + * @member {Long} timeout_height + * @memberof cosmos.tx.v1beta1.TxBody + * @instance + */ + TxBody.prototype.timeout_height = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * TxBody extension_options. + * @member {Array.} extension_options + * @memberof cosmos.tx.v1beta1.TxBody + * @instance + */ + TxBody.prototype.extension_options = $util.emptyArray; + + /** + * TxBody non_critical_extension_options. + * @member {Array.} non_critical_extension_options + * @memberof cosmos.tx.v1beta1.TxBody + * @instance + */ + TxBody.prototype.non_critical_extension_options = $util.emptyArray; + + /** + * Encodes the specified TxBody message. Does not implicitly {@link cosmos.tx.v1beta1.TxBody.verify|verify} messages. + * @function encode + * @memberof cosmos.tx.v1beta1.TxBody + * @static + * @param {cosmos.tx.v1beta1.ITxBody} message TxBody message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TxBody.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.messages != null && message.messages.length) + for (let i = 0; i < message.messages.length; ++i) + $root.google.protobuf.Any.encode(message.messages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.memo != null && Object.hasOwnProperty.call(message, "memo")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.memo); + if (message.timeout_height != null && Object.hasOwnProperty.call(message, "timeout_height")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.timeout_height); + if (message.extension_options != null && message.extension_options.length) + for (let i = 0; i < message.extension_options.length; ++i) + $root.google.protobuf.Any.encode(message.extension_options[i], writer.uint32(/* id 1023, wireType 2 =*/8186).fork()).ldelim(); + if (message.non_critical_extension_options != null && message.non_critical_extension_options.length) + for (let i = 0; i < message.non_critical_extension_options.length; ++i) + $root.google.protobuf.Any.encode(message.non_critical_extension_options[i], writer.uint32(/* id 2047, wireType 2 =*/16378).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TxBody message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.TxBody.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.tx.v1beta1.TxBody + * @static + * @param {cosmos.tx.v1beta1.ITxBody} message TxBody message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TxBody.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TxBody message from the specified reader or buffer. + * @function decode + * @memberof cosmos.tx.v1beta1.TxBody + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.tx.v1beta1.TxBody} TxBody + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TxBody.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.TxBody(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.messages && message.messages.length)) + message.messages = []; + message.messages.push($root.google.protobuf.Any.decode(reader, reader.uint32())); + break; + case 2: + message.memo = reader.string(); + break; + case 3: + message.timeout_height = reader.uint64(); + break; + case 1023: + if (!(message.extension_options && message.extension_options.length)) + message.extension_options = []; + message.extension_options.push($root.google.protobuf.Any.decode(reader, reader.uint32())); + break; + case 2047: + if (!(message.non_critical_extension_options && message.non_critical_extension_options.length)) + message.non_critical_extension_options = []; + message.non_critical_extension_options.push($root.google.protobuf.Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TxBody message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.tx.v1beta1.TxBody + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.tx.v1beta1.TxBody} TxBody + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TxBody.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TxBody message. + * @function verify + * @memberof cosmos.tx.v1beta1.TxBody + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TxBody.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.messages != null && message.hasOwnProperty("messages")) { + if (!Array.isArray(message.messages)) + return "messages: array expected"; + for (let i = 0; i < message.messages.length; ++i) { + let error = $root.google.protobuf.Any.verify(message.messages[i]); + if (error) + return "messages." + error; + } + } + if (message.memo != null && message.hasOwnProperty("memo")) + if (!$util.isString(message.memo)) + return "memo: string expected"; + if (message.timeout_height != null && message.hasOwnProperty("timeout_height")) + if (!$util.isInteger(message.timeout_height) && !(message.timeout_height && $util.isInteger(message.timeout_height.low) && $util.isInteger(message.timeout_height.high))) + return "timeout_height: integer|Long expected"; + if (message.extension_options != null && message.hasOwnProperty("extension_options")) { + if (!Array.isArray(message.extension_options)) + return "extension_options: array expected"; + for (let i = 0; i < message.extension_options.length; ++i) { + let error = $root.google.protobuf.Any.verify(message.extension_options[i]); + if (error) + return "extension_options." + error; + } + } + if (message.non_critical_extension_options != null && message.hasOwnProperty("non_critical_extension_options")) { + if (!Array.isArray(message.non_critical_extension_options)) + return "non_critical_extension_options: array expected"; + for (let i = 0; i < message.non_critical_extension_options.length; ++i) { + let error = $root.google.protobuf.Any.verify(message.non_critical_extension_options[i]); + if (error) + return "non_critical_extension_options." + error; + } + } + return null; + }; + + /** + * Creates a TxBody message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.tx.v1beta1.TxBody + * @static + * @param {Object.} object Plain object + * @returns {cosmos.tx.v1beta1.TxBody} TxBody + */ + TxBody.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.tx.v1beta1.TxBody) + return object; + let message = new $root.cosmos.tx.v1beta1.TxBody(); + if (object.messages) { + if (!Array.isArray(object.messages)) + throw TypeError(".cosmos.tx.v1beta1.TxBody.messages: array expected"); + message.messages = []; + for (let i = 0; i < object.messages.length; ++i) { + if (typeof object.messages[i] !== "object") + throw TypeError(".cosmos.tx.v1beta1.TxBody.messages: object expected"); + message.messages[i] = $root.google.protobuf.Any.fromObject(object.messages[i]); + } + } + if (object.memo != null) + message.memo = String(object.memo); + if (object.timeout_height != null) + if ($util.Long) + (message.timeout_height = $util.Long.fromValue(object.timeout_height)).unsigned = true; + else if (typeof object.timeout_height === "string") + message.timeout_height = parseInt(object.timeout_height, 10); + else if (typeof object.timeout_height === "number") + message.timeout_height = object.timeout_height; + else if (typeof object.timeout_height === "object") + message.timeout_height = new $util.LongBits(object.timeout_height.low >>> 0, object.timeout_height.high >>> 0).toNumber(true); + if (object.extension_options) { + if (!Array.isArray(object.extension_options)) + throw TypeError(".cosmos.tx.v1beta1.TxBody.extension_options: array expected"); + message.extension_options = []; + for (let i = 0; i < object.extension_options.length; ++i) { + if (typeof object.extension_options[i] !== "object") + throw TypeError(".cosmos.tx.v1beta1.TxBody.extension_options: object expected"); + message.extension_options[i] = $root.google.protobuf.Any.fromObject(object.extension_options[i]); + } + } + if (object.non_critical_extension_options) { + if (!Array.isArray(object.non_critical_extension_options)) + throw TypeError(".cosmos.tx.v1beta1.TxBody.non_critical_extension_options: array expected"); + message.non_critical_extension_options = []; + for (let i = 0; i < object.non_critical_extension_options.length; ++i) { + if (typeof object.non_critical_extension_options[i] !== "object") + throw TypeError(".cosmos.tx.v1beta1.TxBody.non_critical_extension_options: object expected"); + message.non_critical_extension_options[i] = $root.google.protobuf.Any.fromObject(object.non_critical_extension_options[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a TxBody message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.tx.v1beta1.TxBody + * @static + * @param {cosmos.tx.v1beta1.TxBody} message TxBody + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TxBody.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) { + object.messages = []; + object.extension_options = []; + object.non_critical_extension_options = []; + } + if (options.defaults) { + object.memo = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.timeout_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.timeout_height = options.longs === String ? "0" : 0; + } + if (message.messages && message.messages.length) { + object.messages = []; + for (let j = 0; j < message.messages.length; ++j) + object.messages[j] = $root.google.protobuf.Any.toObject(message.messages[j], options); + } + if (message.memo != null && message.hasOwnProperty("memo")) + object.memo = message.memo; + if (message.timeout_height != null && message.hasOwnProperty("timeout_height")) + if (typeof message.timeout_height === "number") + object.timeout_height = options.longs === String ? String(message.timeout_height) : message.timeout_height; + else + object.timeout_height = options.longs === String ? $util.Long.prototype.toString.call(message.timeout_height) : options.longs === Number ? new $util.LongBits(message.timeout_height.low >>> 0, message.timeout_height.high >>> 0).toNumber(true) : message.timeout_height; + if (message.extension_options && message.extension_options.length) { + object.extension_options = []; + for (let j = 0; j < message.extension_options.length; ++j) + object.extension_options[j] = $root.google.protobuf.Any.toObject(message.extension_options[j], options); + } + if (message.non_critical_extension_options && message.non_critical_extension_options.length) { + object.non_critical_extension_options = []; + for (let j = 0; j < message.non_critical_extension_options.length; ++j) + object.non_critical_extension_options[j] = $root.google.protobuf.Any.toObject(message.non_critical_extension_options[j], options); + } + return object; + }; + + /** + * Converts this TxBody to JSON. + * @function toJSON + * @memberof cosmos.tx.v1beta1.TxBody + * @instance + * @returns {Object.} JSON object + */ + TxBody.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TxBody; + })(); + + v1beta1.AuthInfo = (function() { + + /** + * Properties of an AuthInfo. + * @memberof cosmos.tx.v1beta1 + * @interface IAuthInfo + * @property {Array.|null} [signer_infos] AuthInfo signer_infos + * @property {cosmos.tx.v1beta1.IFee|null} [fee] AuthInfo fee + */ + + /** + * Constructs a new AuthInfo. + * @memberof cosmos.tx.v1beta1 + * @classdesc Represents an AuthInfo. + * @implements IAuthInfo + * @constructor + * @param {cosmos.tx.v1beta1.IAuthInfo=} [properties] Properties to set + */ + function AuthInfo(properties) { + this.signer_infos = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AuthInfo signer_infos. + * @member {Array.} signer_infos + * @memberof cosmos.tx.v1beta1.AuthInfo + * @instance + */ + AuthInfo.prototype.signer_infos = $util.emptyArray; + + /** + * AuthInfo fee. + * @member {cosmos.tx.v1beta1.IFee|null|undefined} fee + * @memberof cosmos.tx.v1beta1.AuthInfo + * @instance + */ + AuthInfo.prototype.fee = null; + + /** + * Encodes the specified AuthInfo message. Does not implicitly {@link cosmos.tx.v1beta1.AuthInfo.verify|verify} messages. + * @function encode + * @memberof cosmos.tx.v1beta1.AuthInfo + * @static + * @param {cosmos.tx.v1beta1.IAuthInfo} message AuthInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AuthInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.signer_infos != null && message.signer_infos.length) + for (let i = 0; i < message.signer_infos.length; ++i) + $root.cosmos.tx.v1beta1.SignerInfo.encode(message.signer_infos[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.fee != null && Object.hasOwnProperty.call(message, "fee")) + $root.cosmos.tx.v1beta1.Fee.encode(message.fee, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified AuthInfo message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.AuthInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.tx.v1beta1.AuthInfo + * @static + * @param {cosmos.tx.v1beta1.IAuthInfo} message AuthInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AuthInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AuthInfo message from the specified reader or buffer. + * @function decode + * @memberof cosmos.tx.v1beta1.AuthInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.tx.v1beta1.AuthInfo} AuthInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AuthInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.AuthInfo(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.signer_infos && message.signer_infos.length)) + message.signer_infos = []; + message.signer_infos.push($root.cosmos.tx.v1beta1.SignerInfo.decode(reader, reader.uint32())); + break; + case 2: + message.fee = $root.cosmos.tx.v1beta1.Fee.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AuthInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.tx.v1beta1.AuthInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.tx.v1beta1.AuthInfo} AuthInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AuthInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AuthInfo message. + * @function verify + * @memberof cosmos.tx.v1beta1.AuthInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AuthInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.signer_infos != null && message.hasOwnProperty("signer_infos")) { + if (!Array.isArray(message.signer_infos)) + return "signer_infos: array expected"; + for (let i = 0; i < message.signer_infos.length; ++i) { + let error = $root.cosmos.tx.v1beta1.SignerInfo.verify(message.signer_infos[i]); + if (error) + return "signer_infos." + error; + } + } + if (message.fee != null && message.hasOwnProperty("fee")) { + let error = $root.cosmos.tx.v1beta1.Fee.verify(message.fee); + if (error) + return "fee." + error; + } + return null; + }; + + /** + * Creates an AuthInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.tx.v1beta1.AuthInfo + * @static + * @param {Object.} object Plain object + * @returns {cosmos.tx.v1beta1.AuthInfo} AuthInfo + */ + AuthInfo.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.tx.v1beta1.AuthInfo) + return object; + let message = new $root.cosmos.tx.v1beta1.AuthInfo(); + if (object.signer_infos) { + if (!Array.isArray(object.signer_infos)) + throw TypeError(".cosmos.tx.v1beta1.AuthInfo.signer_infos: array expected"); + message.signer_infos = []; + for (let i = 0; i < object.signer_infos.length; ++i) { + if (typeof object.signer_infos[i] !== "object") + throw TypeError(".cosmos.tx.v1beta1.AuthInfo.signer_infos: object expected"); + message.signer_infos[i] = $root.cosmos.tx.v1beta1.SignerInfo.fromObject(object.signer_infos[i]); + } + } + if (object.fee != null) { + if (typeof object.fee !== "object") + throw TypeError(".cosmos.tx.v1beta1.AuthInfo.fee: object expected"); + message.fee = $root.cosmos.tx.v1beta1.Fee.fromObject(object.fee); + } + return message; + }; + + /** + * Creates a plain object from an AuthInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.tx.v1beta1.AuthInfo + * @static + * @param {cosmos.tx.v1beta1.AuthInfo} message AuthInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AuthInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.signer_infos = []; + if (options.defaults) + object.fee = null; + if (message.signer_infos && message.signer_infos.length) { + object.signer_infos = []; + for (let j = 0; j < message.signer_infos.length; ++j) + object.signer_infos[j] = $root.cosmos.tx.v1beta1.SignerInfo.toObject(message.signer_infos[j], options); + } + if (message.fee != null && message.hasOwnProperty("fee")) + object.fee = $root.cosmos.tx.v1beta1.Fee.toObject(message.fee, options); + return object; + }; + + /** + * Converts this AuthInfo to JSON. + * @function toJSON + * @memberof cosmos.tx.v1beta1.AuthInfo + * @instance + * @returns {Object.} JSON object + */ + AuthInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AuthInfo; + })(); + + v1beta1.SignerInfo = (function() { + + /** + * Properties of a SignerInfo. + * @memberof cosmos.tx.v1beta1 + * @interface ISignerInfo + * @property {google.protobuf.IAny|null} [public_key] SignerInfo public_key + * @property {cosmos.tx.v1beta1.IModeInfo|null} [mode_info] SignerInfo mode_info + * @property {Long|null} [sequence] SignerInfo sequence + */ + + /** + * Constructs a new SignerInfo. + * @memberof cosmos.tx.v1beta1 + * @classdesc Represents a SignerInfo. + * @implements ISignerInfo + * @constructor + * @param {cosmos.tx.v1beta1.ISignerInfo=} [properties] Properties to set + */ + function SignerInfo(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SignerInfo public_key. + * @member {google.protobuf.IAny|null|undefined} public_key + * @memberof cosmos.tx.v1beta1.SignerInfo + * @instance + */ + SignerInfo.prototype.public_key = null; + + /** + * SignerInfo mode_info. + * @member {cosmos.tx.v1beta1.IModeInfo|null|undefined} mode_info + * @memberof cosmos.tx.v1beta1.SignerInfo + * @instance + */ + SignerInfo.prototype.mode_info = null; + + /** + * SignerInfo sequence. + * @member {Long} sequence + * @memberof cosmos.tx.v1beta1.SignerInfo + * @instance + */ + SignerInfo.prototype.sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified SignerInfo message. Does not implicitly {@link cosmos.tx.v1beta1.SignerInfo.verify|verify} messages. + * @function encode + * @memberof cosmos.tx.v1beta1.SignerInfo + * @static + * @param {cosmos.tx.v1beta1.ISignerInfo} message SignerInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SignerInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.public_key != null && Object.hasOwnProperty.call(message, "public_key")) + $root.google.protobuf.Any.encode(message.public_key, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.mode_info != null && Object.hasOwnProperty.call(message, "mode_info")) + $root.cosmos.tx.v1beta1.ModeInfo.encode(message.mode_info, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.sequence != null && Object.hasOwnProperty.call(message, "sequence")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.sequence); + return writer; + }; + + /** + * Encodes the specified SignerInfo message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.SignerInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.tx.v1beta1.SignerInfo + * @static + * @param {cosmos.tx.v1beta1.ISignerInfo} message SignerInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SignerInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SignerInfo message from the specified reader or buffer. + * @function decode + * @memberof cosmos.tx.v1beta1.SignerInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.tx.v1beta1.SignerInfo} SignerInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SignerInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.SignerInfo(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.public_key = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 2: + message.mode_info = $root.cosmos.tx.v1beta1.ModeInfo.decode(reader, reader.uint32()); + break; + case 3: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SignerInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.tx.v1beta1.SignerInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.tx.v1beta1.SignerInfo} SignerInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SignerInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SignerInfo message. + * @function verify + * @memberof cosmos.tx.v1beta1.SignerInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SignerInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.public_key != null && message.hasOwnProperty("public_key")) { + let error = $root.google.protobuf.Any.verify(message.public_key); + if (error) + return "public_key." + error; + } + if (message.mode_info != null && message.hasOwnProperty("mode_info")) { + let error = $root.cosmos.tx.v1beta1.ModeInfo.verify(message.mode_info); + if (error) + return "mode_info." + error; + } + if (message.sequence != null && message.hasOwnProperty("sequence")) + if (!$util.isInteger(message.sequence) && !(message.sequence && $util.isInteger(message.sequence.low) && $util.isInteger(message.sequence.high))) + return "sequence: integer|Long expected"; + return null; + }; + + /** + * Creates a SignerInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.tx.v1beta1.SignerInfo + * @static + * @param {Object.} object Plain object + * @returns {cosmos.tx.v1beta1.SignerInfo} SignerInfo + */ + SignerInfo.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.tx.v1beta1.SignerInfo) + return object; + let message = new $root.cosmos.tx.v1beta1.SignerInfo(); + if (object.public_key != null) { + if (typeof object.public_key !== "object") + throw TypeError(".cosmos.tx.v1beta1.SignerInfo.public_key: object expected"); + message.public_key = $root.google.protobuf.Any.fromObject(object.public_key); + } + if (object.mode_info != null) { + if (typeof object.mode_info !== "object") + throw TypeError(".cosmos.tx.v1beta1.SignerInfo.mode_info: object expected"); + message.mode_info = $root.cosmos.tx.v1beta1.ModeInfo.fromObject(object.mode_info); + } + if (object.sequence != null) + if ($util.Long) + (message.sequence = $util.Long.fromValue(object.sequence)).unsigned = true; + else if (typeof object.sequence === "string") + message.sequence = parseInt(object.sequence, 10); + else if (typeof object.sequence === "number") + message.sequence = object.sequence; + else if (typeof object.sequence === "object") + message.sequence = new $util.LongBits(object.sequence.low >>> 0, object.sequence.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a SignerInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.tx.v1beta1.SignerInfo + * @static + * @param {cosmos.tx.v1beta1.SignerInfo} message SignerInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SignerInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.public_key = null; + object.mode_info = null; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.sequence = options.longs === String ? "0" : 0; + } + if (message.public_key != null && message.hasOwnProperty("public_key")) + object.public_key = $root.google.protobuf.Any.toObject(message.public_key, options); + if (message.mode_info != null && message.hasOwnProperty("mode_info")) + object.mode_info = $root.cosmos.tx.v1beta1.ModeInfo.toObject(message.mode_info, options); + if (message.sequence != null && message.hasOwnProperty("sequence")) + if (typeof message.sequence === "number") + object.sequence = options.longs === String ? String(message.sequence) : message.sequence; + else + object.sequence = options.longs === String ? $util.Long.prototype.toString.call(message.sequence) : options.longs === Number ? new $util.LongBits(message.sequence.low >>> 0, message.sequence.high >>> 0).toNumber(true) : message.sequence; + return object; + }; + + /** + * Converts this SignerInfo to JSON. + * @function toJSON + * @memberof cosmos.tx.v1beta1.SignerInfo + * @instance + * @returns {Object.} JSON object + */ + SignerInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SignerInfo; + })(); + + v1beta1.ModeInfo = (function() { + + /** + * Properties of a ModeInfo. + * @memberof cosmos.tx.v1beta1 + * @interface IModeInfo + * @property {cosmos.tx.v1beta1.ModeInfo.ISingle|null} [single] ModeInfo single + * @property {cosmos.tx.v1beta1.ModeInfo.IMulti|null} [multi] ModeInfo multi + */ + + /** + * Constructs a new ModeInfo. + * @memberof cosmos.tx.v1beta1 + * @classdesc Represents a ModeInfo. + * @implements IModeInfo + * @constructor + * @param {cosmos.tx.v1beta1.IModeInfo=} [properties] Properties to set + */ + function ModeInfo(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ModeInfo single. + * @member {cosmos.tx.v1beta1.ModeInfo.ISingle|null|undefined} single + * @memberof cosmos.tx.v1beta1.ModeInfo + * @instance + */ + ModeInfo.prototype.single = null; + + /** + * ModeInfo multi. + * @member {cosmos.tx.v1beta1.ModeInfo.IMulti|null|undefined} multi + * @memberof cosmos.tx.v1beta1.ModeInfo + * @instance + */ + ModeInfo.prototype.multi = null; + + // OneOf field names bound to virtual getters and setters + let $oneOfFields; + + /** + * ModeInfo sum. + * @member {"single"|"multi"|undefined} sum + * @memberof cosmos.tx.v1beta1.ModeInfo + * @instance + */ + Object.defineProperty(ModeInfo.prototype, "sum", { + get: $util.oneOfGetter($oneOfFields = ["single", "multi"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Encodes the specified ModeInfo message. Does not implicitly {@link cosmos.tx.v1beta1.ModeInfo.verify|verify} messages. + * @function encode + * @memberof cosmos.tx.v1beta1.ModeInfo + * @static + * @param {cosmos.tx.v1beta1.IModeInfo} message ModeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ModeInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.single != null && Object.hasOwnProperty.call(message, "single")) + $root.cosmos.tx.v1beta1.ModeInfo.Single.encode(message.single, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.multi != null && Object.hasOwnProperty.call(message, "multi")) + $root.cosmos.tx.v1beta1.ModeInfo.Multi.encode(message.multi, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ModeInfo message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.ModeInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.tx.v1beta1.ModeInfo + * @static + * @param {cosmos.tx.v1beta1.IModeInfo} message ModeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ModeInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ModeInfo message from the specified reader or buffer. + * @function decode + * @memberof cosmos.tx.v1beta1.ModeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.tx.v1beta1.ModeInfo} ModeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ModeInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.ModeInfo(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.single = $root.cosmos.tx.v1beta1.ModeInfo.Single.decode(reader, reader.uint32()); + break; + case 2: + message.multi = $root.cosmos.tx.v1beta1.ModeInfo.Multi.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ModeInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.tx.v1beta1.ModeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.tx.v1beta1.ModeInfo} ModeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ModeInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ModeInfo message. + * @function verify + * @memberof cosmos.tx.v1beta1.ModeInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ModeInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + let properties = {}; + if (message.single != null && message.hasOwnProperty("single")) { + properties.sum = 1; + { + let error = $root.cosmos.tx.v1beta1.ModeInfo.Single.verify(message.single); + if (error) + return "single." + error; + } + } + if (message.multi != null && message.hasOwnProperty("multi")) { + if (properties.sum === 1) + return "sum: multiple values"; + properties.sum = 1; + { + let error = $root.cosmos.tx.v1beta1.ModeInfo.Multi.verify(message.multi); + if (error) + return "multi." + error; + } + } + return null; + }; + + /** + * Creates a ModeInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.tx.v1beta1.ModeInfo + * @static + * @param {Object.} object Plain object + * @returns {cosmos.tx.v1beta1.ModeInfo} ModeInfo + */ + ModeInfo.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.tx.v1beta1.ModeInfo) + return object; + let message = new $root.cosmos.tx.v1beta1.ModeInfo(); + if (object.single != null) { + if (typeof object.single !== "object") + throw TypeError(".cosmos.tx.v1beta1.ModeInfo.single: object expected"); + message.single = $root.cosmos.tx.v1beta1.ModeInfo.Single.fromObject(object.single); + } + if (object.multi != null) { + if (typeof object.multi !== "object") + throw TypeError(".cosmos.tx.v1beta1.ModeInfo.multi: object expected"); + message.multi = $root.cosmos.tx.v1beta1.ModeInfo.Multi.fromObject(object.multi); + } + return message; + }; + + /** + * Creates a plain object from a ModeInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.tx.v1beta1.ModeInfo + * @static + * @param {cosmos.tx.v1beta1.ModeInfo} message ModeInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ModeInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (message.single != null && message.hasOwnProperty("single")) { + object.single = $root.cosmos.tx.v1beta1.ModeInfo.Single.toObject(message.single, options); + if (options.oneofs) + object.sum = "single"; + } + if (message.multi != null && message.hasOwnProperty("multi")) { + object.multi = $root.cosmos.tx.v1beta1.ModeInfo.Multi.toObject(message.multi, options); + if (options.oneofs) + object.sum = "multi"; + } + return object; + }; + + /** + * Converts this ModeInfo to JSON. + * @function toJSON + * @memberof cosmos.tx.v1beta1.ModeInfo + * @instance + * @returns {Object.} JSON object + */ + ModeInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + ModeInfo.Single = (function() { + + /** + * Properties of a Single. + * @memberof cosmos.tx.v1beta1.ModeInfo + * @interface ISingle + * @property {cosmos.tx.signing.v1beta1.SignMode|null} [mode] Single mode + */ + + /** + * Constructs a new Single. + * @memberof cosmos.tx.v1beta1.ModeInfo + * @classdesc Represents a Single. + * @implements ISingle + * @constructor + * @param {cosmos.tx.v1beta1.ModeInfo.ISingle=} [properties] Properties to set + */ + function Single(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Single mode. + * @member {cosmos.tx.signing.v1beta1.SignMode} mode + * @memberof cosmos.tx.v1beta1.ModeInfo.Single + * @instance + */ + Single.prototype.mode = 0; + + /** + * Encodes the specified Single message. Does not implicitly {@link cosmos.tx.v1beta1.ModeInfo.Single.verify|verify} messages. + * @function encode + * @memberof cosmos.tx.v1beta1.ModeInfo.Single + * @static + * @param {cosmos.tx.v1beta1.ModeInfo.ISingle} message Single message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Single.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mode); + return writer; + }; + + /** + * Encodes the specified Single message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.ModeInfo.Single.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.tx.v1beta1.ModeInfo.Single + * @static + * @param {cosmos.tx.v1beta1.ModeInfo.ISingle} message Single message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Single.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Single message from the specified reader or buffer. + * @function decode + * @memberof cosmos.tx.v1beta1.ModeInfo.Single + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.tx.v1beta1.ModeInfo.Single} Single + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Single.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.ModeInfo.Single(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mode = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Single message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.tx.v1beta1.ModeInfo.Single + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.tx.v1beta1.ModeInfo.Single} Single + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Single.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Single message. + * @function verify + * @memberof cosmos.tx.v1beta1.ModeInfo.Single + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Single.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mode != null && message.hasOwnProperty("mode")) + switch (message.mode) { + default: + return "mode: enum value expected"; + case 0: + case 1: + case 2: + case 127: + break; + } + return null; + }; + + /** + * Creates a Single message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.tx.v1beta1.ModeInfo.Single + * @static + * @param {Object.} object Plain object + * @returns {cosmos.tx.v1beta1.ModeInfo.Single} Single + */ + Single.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.tx.v1beta1.ModeInfo.Single) + return object; + let message = new $root.cosmos.tx.v1beta1.ModeInfo.Single(); + switch (object.mode) { + case "SIGN_MODE_UNSPECIFIED": + case 0: + message.mode = 0; + break; + case "SIGN_MODE_DIRECT": + case 1: + message.mode = 1; + break; + case "SIGN_MODE_TEXTUAL": + case 2: + message.mode = 2; + break; + case "SIGN_MODE_LEGACY_AMINO_JSON": + case 127: + message.mode = 127; + break; + } + return message; + }; + + /** + * Creates a plain object from a Single message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.tx.v1beta1.ModeInfo.Single + * @static + * @param {cosmos.tx.v1beta1.ModeInfo.Single} message Single + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Single.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.mode = options.enums === String ? "SIGN_MODE_UNSPECIFIED" : 0; + if (message.mode != null && message.hasOwnProperty("mode")) + object.mode = options.enums === String ? $root.cosmos.tx.signing.v1beta1.SignMode[message.mode] : message.mode; + return object; + }; + + /** + * Converts this Single to JSON. + * @function toJSON + * @memberof cosmos.tx.v1beta1.ModeInfo.Single + * @instance + * @returns {Object.} JSON object + */ + Single.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Single; + })(); + + ModeInfo.Multi = (function() { + + /** + * Properties of a Multi. + * @memberof cosmos.tx.v1beta1.ModeInfo + * @interface IMulti + * @property {cosmos.crypto.multisig.v1beta1.ICompactBitArray|null} [bitarray] Multi bitarray + * @property {Array.|null} [mode_infos] Multi mode_infos + */ + + /** + * Constructs a new Multi. + * @memberof cosmos.tx.v1beta1.ModeInfo + * @classdesc Represents a Multi. + * @implements IMulti + * @constructor + * @param {cosmos.tx.v1beta1.ModeInfo.IMulti=} [properties] Properties to set + */ + function Multi(properties) { + this.mode_infos = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Multi bitarray. + * @member {cosmos.crypto.multisig.v1beta1.ICompactBitArray|null|undefined} bitarray + * @memberof cosmos.tx.v1beta1.ModeInfo.Multi + * @instance + */ + Multi.prototype.bitarray = null; + + /** + * Multi mode_infos. + * @member {Array.} mode_infos + * @memberof cosmos.tx.v1beta1.ModeInfo.Multi + * @instance + */ + Multi.prototype.mode_infos = $util.emptyArray; + + /** + * Encodes the specified Multi message. Does not implicitly {@link cosmos.tx.v1beta1.ModeInfo.Multi.verify|verify} messages. + * @function encode + * @memberof cosmos.tx.v1beta1.ModeInfo.Multi + * @static + * @param {cosmos.tx.v1beta1.ModeInfo.IMulti} message Multi message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Multi.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.bitarray != null && Object.hasOwnProperty.call(message, "bitarray")) + $root.cosmos.crypto.multisig.v1beta1.CompactBitArray.encode(message.bitarray, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.mode_infos != null && message.mode_infos.length) + for (let i = 0; i < message.mode_infos.length; ++i) + $root.cosmos.tx.v1beta1.ModeInfo.encode(message.mode_infos[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Multi message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.ModeInfo.Multi.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.tx.v1beta1.ModeInfo.Multi + * @static + * @param {cosmos.tx.v1beta1.ModeInfo.IMulti} message Multi message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Multi.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Multi message from the specified reader or buffer. + * @function decode + * @memberof cosmos.tx.v1beta1.ModeInfo.Multi + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.tx.v1beta1.ModeInfo.Multi} Multi + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Multi.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.ModeInfo.Multi(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bitarray = $root.cosmos.crypto.multisig.v1beta1.CompactBitArray.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.mode_infos && message.mode_infos.length)) + message.mode_infos = []; + message.mode_infos.push($root.cosmos.tx.v1beta1.ModeInfo.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Multi message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.tx.v1beta1.ModeInfo.Multi + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.tx.v1beta1.ModeInfo.Multi} Multi + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Multi.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Multi message. + * @function verify + * @memberof cosmos.tx.v1beta1.ModeInfo.Multi + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Multi.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.bitarray != null && message.hasOwnProperty("bitarray")) { + let error = $root.cosmos.crypto.multisig.v1beta1.CompactBitArray.verify(message.bitarray); + if (error) + return "bitarray." + error; + } + if (message.mode_infos != null && message.hasOwnProperty("mode_infos")) { + if (!Array.isArray(message.mode_infos)) + return "mode_infos: array expected"; + for (let i = 0; i < message.mode_infos.length; ++i) { + let error = $root.cosmos.tx.v1beta1.ModeInfo.verify(message.mode_infos[i]); + if (error) + return "mode_infos." + error; + } + } + return null; + }; + + /** + * Creates a Multi message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.tx.v1beta1.ModeInfo.Multi + * @static + * @param {Object.} object Plain object + * @returns {cosmos.tx.v1beta1.ModeInfo.Multi} Multi + */ + Multi.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.tx.v1beta1.ModeInfo.Multi) + return object; + let message = new $root.cosmos.tx.v1beta1.ModeInfo.Multi(); + if (object.bitarray != null) { + if (typeof object.bitarray !== "object") + throw TypeError(".cosmos.tx.v1beta1.ModeInfo.Multi.bitarray: object expected"); + message.bitarray = $root.cosmos.crypto.multisig.v1beta1.CompactBitArray.fromObject(object.bitarray); + } + if (object.mode_infos) { + if (!Array.isArray(object.mode_infos)) + throw TypeError(".cosmos.tx.v1beta1.ModeInfo.Multi.mode_infos: array expected"); + message.mode_infos = []; + for (let i = 0; i < object.mode_infos.length; ++i) { + if (typeof object.mode_infos[i] !== "object") + throw TypeError(".cosmos.tx.v1beta1.ModeInfo.Multi.mode_infos: object expected"); + message.mode_infos[i] = $root.cosmos.tx.v1beta1.ModeInfo.fromObject(object.mode_infos[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Multi message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.tx.v1beta1.ModeInfo.Multi + * @static + * @param {cosmos.tx.v1beta1.ModeInfo.Multi} message Multi + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Multi.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.mode_infos = []; + if (options.defaults) + object.bitarray = null; + if (message.bitarray != null && message.hasOwnProperty("bitarray")) + object.bitarray = $root.cosmos.crypto.multisig.v1beta1.CompactBitArray.toObject(message.bitarray, options); + if (message.mode_infos && message.mode_infos.length) { + object.mode_infos = []; + for (let j = 0; j < message.mode_infos.length; ++j) + object.mode_infos[j] = $root.cosmos.tx.v1beta1.ModeInfo.toObject(message.mode_infos[j], options); + } + return object; + }; + + /** + * Converts this Multi to JSON. + * @function toJSON + * @memberof cosmos.tx.v1beta1.ModeInfo.Multi + * @instance + * @returns {Object.} JSON object + */ + Multi.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Multi; + })(); + + return ModeInfo; + })(); + + v1beta1.Fee = (function() { + + /** + * Properties of a Fee. + * @memberof cosmos.tx.v1beta1 + * @interface IFee + * @property {Array.|null} [amount] Fee amount + * @property {Long|null} [gas_limit] Fee gas_limit + * @property {string|null} [payer] Fee payer + * @property {string|null} [granter] Fee granter + */ + + /** + * Constructs a new Fee. + * @memberof cosmos.tx.v1beta1 + * @classdesc Represents a Fee. + * @implements IFee + * @constructor + * @param {cosmos.tx.v1beta1.IFee=} [properties] Properties to set + */ + function Fee(properties) { + this.amount = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Fee amount. + * @member {Array.} amount + * @memberof cosmos.tx.v1beta1.Fee + * @instance + */ + Fee.prototype.amount = $util.emptyArray; + + /** + * Fee gas_limit. + * @member {Long} gas_limit + * @memberof cosmos.tx.v1beta1.Fee + * @instance + */ + Fee.prototype.gas_limit = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Fee payer. + * @member {string} payer + * @memberof cosmos.tx.v1beta1.Fee + * @instance + */ + Fee.prototype.payer = ""; + + /** + * Fee granter. + * @member {string} granter + * @memberof cosmos.tx.v1beta1.Fee + * @instance + */ + Fee.prototype.granter = ""; + + /** + * Encodes the specified Fee message. Does not implicitly {@link cosmos.tx.v1beta1.Fee.verify|verify} messages. + * @function encode + * @memberof cosmos.tx.v1beta1.Fee + * @static + * @param {cosmos.tx.v1beta1.IFee} message Fee message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Fee.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.amount != null && message.amount.length) + for (let i = 0; i < message.amount.length; ++i) + $root.cosmos.base.v1beta1.Coin.encode(message.amount[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.gas_limit != null && Object.hasOwnProperty.call(message, "gas_limit")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.gas_limit); + if (message.payer != null && Object.hasOwnProperty.call(message, "payer")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.payer); + if (message.granter != null && Object.hasOwnProperty.call(message, "granter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.granter); + return writer; + }; + + /** + * Encodes the specified Fee message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.Fee.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.tx.v1beta1.Fee + * @static + * @param {cosmos.tx.v1beta1.IFee} message Fee message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Fee.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Fee message from the specified reader or buffer. + * @function decode + * @memberof cosmos.tx.v1beta1.Fee + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.tx.v1beta1.Fee} Fee + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Fee.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.Fee(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.amount && message.amount.length)) + message.amount = []; + message.amount.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); + break; + case 2: + message.gas_limit = 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; + }; + + /** + * Decodes a Fee message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.tx.v1beta1.Fee + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.tx.v1beta1.Fee} Fee + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Fee.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Fee message. + * @function verify + * @memberof cosmos.tx.v1beta1.Fee + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Fee.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.amount != null && message.hasOwnProperty("amount")) { + if (!Array.isArray(message.amount)) + return "amount: array expected"; + for (let i = 0; i < message.amount.length; ++i) { + let error = $root.cosmos.base.v1beta1.Coin.verify(message.amount[i]); + if (error) + return "amount." + error; + } + } + if (message.gas_limit != null && message.hasOwnProperty("gas_limit")) + if (!$util.isInteger(message.gas_limit) && !(message.gas_limit && $util.isInteger(message.gas_limit.low) && $util.isInteger(message.gas_limit.high))) + return "gas_limit: integer|Long expected"; + if (message.payer != null && message.hasOwnProperty("payer")) + if (!$util.isString(message.payer)) + return "payer: string expected"; + if (message.granter != null && message.hasOwnProperty("granter")) + if (!$util.isString(message.granter)) + return "granter: string expected"; + return null; + }; + + /** + * Creates a Fee message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.tx.v1beta1.Fee + * @static + * @param {Object.} object Plain object + * @returns {cosmos.tx.v1beta1.Fee} Fee + */ + Fee.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.tx.v1beta1.Fee) + return object; + let message = new $root.cosmos.tx.v1beta1.Fee(); + if (object.amount) { + if (!Array.isArray(object.amount)) + throw TypeError(".cosmos.tx.v1beta1.Fee.amount: array expected"); + message.amount = []; + for (let i = 0; i < object.amount.length; ++i) { + if (typeof object.amount[i] !== "object") + throw TypeError(".cosmos.tx.v1beta1.Fee.amount: object expected"); + message.amount[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.amount[i]); + } + } + if (object.gas_limit != null) + if ($util.Long) + (message.gas_limit = $util.Long.fromValue(object.gas_limit)).unsigned = true; + else if (typeof object.gas_limit === "string") + message.gas_limit = parseInt(object.gas_limit, 10); + else if (typeof object.gas_limit === "number") + message.gas_limit = object.gas_limit; + else if (typeof object.gas_limit === "object") + message.gas_limit = new $util.LongBits(object.gas_limit.low >>> 0, object.gas_limit.high >>> 0).toNumber(true); + if (object.payer != null) + message.payer = String(object.payer); + if (object.granter != null) + message.granter = String(object.granter); + return message; + }; + + /** + * Creates a plain object from a Fee message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.tx.v1beta1.Fee + * @static + * @param {cosmos.tx.v1beta1.Fee} message Fee + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Fee.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.amount = []; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.gas_limit = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.gas_limit = options.longs === String ? "0" : 0; + object.payer = ""; + object.granter = ""; + } + if (message.amount && message.amount.length) { + object.amount = []; + for (let j = 0; j < message.amount.length; ++j) + object.amount[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.amount[j], options); + } + if (message.gas_limit != null && message.hasOwnProperty("gas_limit")) + if (typeof message.gas_limit === "number") + object.gas_limit = options.longs === String ? String(message.gas_limit) : message.gas_limit; + else + object.gas_limit = options.longs === String ? $util.Long.prototype.toString.call(message.gas_limit) : options.longs === Number ? new $util.LongBits(message.gas_limit.low >>> 0, message.gas_limit.high >>> 0).toNumber(true) : message.gas_limit; + if (message.payer != null && message.hasOwnProperty("payer")) + object.payer = message.payer; + if (message.granter != null && message.hasOwnProperty("granter")) + object.granter = message.granter; + return object; + }; + + /** + * Converts this Fee to JSON. + * @function toJSON + * @memberof cosmos.tx.v1beta1.Fee + * @instance + * @returns {Object.} JSON object + */ + Fee.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Fee; + })(); + + v1beta1.Service = (function() { + + /** + * Constructs a new Service service. + * @memberof cosmos.tx.v1beta1 + * @classdesc Represents a Service + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Service(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Service.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Service; + + /** + * Callback as used by {@link cosmos.tx.v1beta1.Service#simulate}. + * @memberof cosmos.tx.v1beta1.Service + * @typedef SimulateCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.tx.v1beta1.SimulateResponse} [response] SimulateResponse + */ + + /** + * Calls Simulate. + * @function simulate + * @memberof cosmos.tx.v1beta1.Service + * @instance + * @param {cosmos.tx.v1beta1.ISimulateRequest} request SimulateRequest message or plain object + * @param {cosmos.tx.v1beta1.Service.SimulateCallback} callback Node-style callback called with the error, if any, and SimulateResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Service.prototype.simulate = function simulate(request, callback) { + return this.rpcCall(simulate, $root.cosmos.tx.v1beta1.SimulateRequest, $root.cosmos.tx.v1beta1.SimulateResponse, request, callback); + }, "name", { value: "Simulate" }); + + /** + * Calls Simulate. + * @function simulate + * @memberof cosmos.tx.v1beta1.Service + * @instance + * @param {cosmos.tx.v1beta1.ISimulateRequest} request SimulateRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.tx.v1beta1.Service#getTx}. + * @memberof cosmos.tx.v1beta1.Service + * @typedef GetTxCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.tx.v1beta1.GetTxResponse} [response] GetTxResponse + */ + + /** + * Calls GetTx. + * @function getTx + * @memberof cosmos.tx.v1beta1.Service + * @instance + * @param {cosmos.tx.v1beta1.IGetTxRequest} request GetTxRequest message or plain object + * @param {cosmos.tx.v1beta1.Service.GetTxCallback} callback Node-style callback called with the error, if any, and GetTxResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Service.prototype.getTx = function getTx(request, callback) { + return this.rpcCall(getTx, $root.cosmos.tx.v1beta1.GetTxRequest, $root.cosmos.tx.v1beta1.GetTxResponse, request, callback); + }, "name", { value: "GetTx" }); + + /** + * Calls GetTx. + * @function getTx + * @memberof cosmos.tx.v1beta1.Service + * @instance + * @param {cosmos.tx.v1beta1.IGetTxRequest} request GetTxRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.tx.v1beta1.Service#broadcastTx}. + * @memberof cosmos.tx.v1beta1.Service + * @typedef BroadcastTxCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.tx.v1beta1.BroadcastTxResponse} [response] BroadcastTxResponse + */ + + /** + * Calls BroadcastTx. + * @function broadcastTx + * @memberof cosmos.tx.v1beta1.Service + * @instance + * @param {cosmos.tx.v1beta1.IBroadcastTxRequest} request BroadcastTxRequest message or plain object + * @param {cosmos.tx.v1beta1.Service.BroadcastTxCallback} callback Node-style callback called with the error, if any, and BroadcastTxResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Service.prototype.broadcastTx = function broadcastTx(request, callback) { + return this.rpcCall(broadcastTx, $root.cosmos.tx.v1beta1.BroadcastTxRequest, $root.cosmos.tx.v1beta1.BroadcastTxResponse, request, callback); + }, "name", { value: "BroadcastTx" }); + + /** + * Calls BroadcastTx. + * @function broadcastTx + * @memberof cosmos.tx.v1beta1.Service + * @instance + * @param {cosmos.tx.v1beta1.IBroadcastTxRequest} request BroadcastTxRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.tx.v1beta1.Service#getTxsEvent}. + * @memberof cosmos.tx.v1beta1.Service + * @typedef GetTxsEventCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.tx.v1beta1.GetTxsEventResponse} [response] GetTxsEventResponse + */ + + /** + * Calls GetTxsEvent. + * @function getTxsEvent + * @memberof cosmos.tx.v1beta1.Service + * @instance + * @param {cosmos.tx.v1beta1.IGetTxsEventRequest} request GetTxsEventRequest message or plain object + * @param {cosmos.tx.v1beta1.Service.GetTxsEventCallback} callback Node-style callback called with the error, if any, and GetTxsEventResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Service.prototype.getTxsEvent = function getTxsEvent(request, callback) { + return this.rpcCall(getTxsEvent, $root.cosmos.tx.v1beta1.GetTxsEventRequest, $root.cosmos.tx.v1beta1.GetTxsEventResponse, request, callback); + }, "name", { value: "GetTxsEvent" }); + + /** + * Calls GetTxsEvent. + * @function getTxsEvent + * @memberof cosmos.tx.v1beta1.Service + * @instance + * @param {cosmos.tx.v1beta1.IGetTxsEventRequest} request GetTxsEventRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Service; + })(); + + v1beta1.GetTxsEventRequest = (function() { + + /** + * Properties of a GetTxsEventRequest. + * @memberof cosmos.tx.v1beta1 + * @interface IGetTxsEventRequest + * @property {Array.|null} [events] GetTxsEventRequest events + * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] GetTxsEventRequest pagination + */ + + /** + * Constructs a new GetTxsEventRequest. + * @memberof cosmos.tx.v1beta1 + * @classdesc Represents a GetTxsEventRequest. + * @implements IGetTxsEventRequest + * @constructor + * @param {cosmos.tx.v1beta1.IGetTxsEventRequest=} [properties] Properties to set + */ + function GetTxsEventRequest(properties) { + this.events = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetTxsEventRequest events. + * @member {Array.} events + * @memberof cosmos.tx.v1beta1.GetTxsEventRequest + * @instance + */ + GetTxsEventRequest.prototype.events = $util.emptyArray; + + /** + * GetTxsEventRequest pagination. + * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination + * @memberof cosmos.tx.v1beta1.GetTxsEventRequest + * @instance + */ + GetTxsEventRequest.prototype.pagination = null; + + /** + * Encodes the specified GetTxsEventRequest message. Does not implicitly {@link cosmos.tx.v1beta1.GetTxsEventRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.tx.v1beta1.GetTxsEventRequest + * @static + * @param {cosmos.tx.v1beta1.IGetTxsEventRequest} message GetTxsEventRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetTxsEventRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.events != null && message.events.length) + for (let i = 0; i < message.events.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.events[i]); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetTxsEventRequest message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.GetTxsEventRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.tx.v1beta1.GetTxsEventRequest + * @static + * @param {cosmos.tx.v1beta1.IGetTxsEventRequest} message GetTxsEventRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetTxsEventRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetTxsEventRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.tx.v1beta1.GetTxsEventRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.tx.v1beta1.GetTxsEventRequest} GetTxsEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetTxsEventRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.GetTxsEventRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.events && message.events.length)) + message.events = []; + message.events.push(reader.string()); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetTxsEventRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.tx.v1beta1.GetTxsEventRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.tx.v1beta1.GetTxsEventRequest} GetTxsEventRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetTxsEventRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetTxsEventRequest message. + * @function verify + * @memberof cosmos.tx.v1beta1.GetTxsEventRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetTxsEventRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.events != null && message.hasOwnProperty("events")) { + if (!Array.isArray(message.events)) + return "events: array expected"; + for (let i = 0; i < message.events.length; ++i) + if (!$util.isString(message.events[i])) + return "events: string[] expected"; + } + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a GetTxsEventRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.tx.v1beta1.GetTxsEventRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.tx.v1beta1.GetTxsEventRequest} GetTxsEventRequest + */ + GetTxsEventRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.tx.v1beta1.GetTxsEventRequest) + return object; + let message = new $root.cosmos.tx.v1beta1.GetTxsEventRequest(); + if (object.events) { + if (!Array.isArray(object.events)) + throw TypeError(".cosmos.tx.v1beta1.GetTxsEventRequest.events: array expected"); + message.events = []; + for (let i = 0; i < object.events.length; ++i) + message.events[i] = String(object.events[i]); + } + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.tx.v1beta1.GetTxsEventRequest.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a GetTxsEventRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.tx.v1beta1.GetTxsEventRequest + * @static + * @param {cosmos.tx.v1beta1.GetTxsEventRequest} message GetTxsEventRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetTxsEventRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.events = []; + if (options.defaults) + object.pagination = null; + if (message.events && message.events.length) { + object.events = []; + for (let j = 0; j < message.events.length; ++j) + object.events[j] = message.events[j]; + } + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this GetTxsEventRequest to JSON. + * @function toJSON + * @memberof cosmos.tx.v1beta1.GetTxsEventRequest + * @instance + * @returns {Object.} JSON object + */ + GetTxsEventRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetTxsEventRequest; + })(); + + v1beta1.GetTxsEventResponse = (function() { + + /** + * Properties of a GetTxsEventResponse. + * @memberof cosmos.tx.v1beta1 + * @interface IGetTxsEventResponse + * @property {Array.|null} [txs] GetTxsEventResponse txs + * @property {Array.|null} [tx_responses] GetTxsEventResponse tx_responses + * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] GetTxsEventResponse pagination + */ + + /** + * Constructs a new GetTxsEventResponse. + * @memberof cosmos.tx.v1beta1 + * @classdesc Represents a GetTxsEventResponse. + * @implements IGetTxsEventResponse + * @constructor + * @param {cosmos.tx.v1beta1.IGetTxsEventResponse=} [properties] Properties to set + */ + function GetTxsEventResponse(properties) { + this.txs = []; + this.tx_responses = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetTxsEventResponse txs. + * @member {Array.} txs + * @memberof cosmos.tx.v1beta1.GetTxsEventResponse + * @instance + */ + GetTxsEventResponse.prototype.txs = $util.emptyArray; + + /** + * GetTxsEventResponse tx_responses. + * @member {Array.} tx_responses + * @memberof cosmos.tx.v1beta1.GetTxsEventResponse + * @instance + */ + GetTxsEventResponse.prototype.tx_responses = $util.emptyArray; + + /** + * GetTxsEventResponse pagination. + * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination + * @memberof cosmos.tx.v1beta1.GetTxsEventResponse + * @instance + */ + GetTxsEventResponse.prototype.pagination = null; + + /** + * Encodes the specified GetTxsEventResponse message. Does not implicitly {@link cosmos.tx.v1beta1.GetTxsEventResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.tx.v1beta1.GetTxsEventResponse + * @static + * @param {cosmos.tx.v1beta1.IGetTxsEventResponse} message GetTxsEventResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetTxsEventResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.txs != null && message.txs.length) + for (let i = 0; i < message.txs.length; ++i) + $root.cosmos.tx.v1beta1.Tx.encode(message.txs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.tx_responses != null && message.tx_responses.length) + for (let i = 0; i < message.tx_responses.length; ++i) + $root.cosmos.base.abci.v1beta1.TxResponse.encode(message.tx_responses[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetTxsEventResponse message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.GetTxsEventResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.tx.v1beta1.GetTxsEventResponse + * @static + * @param {cosmos.tx.v1beta1.IGetTxsEventResponse} message GetTxsEventResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetTxsEventResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetTxsEventResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.tx.v1beta1.GetTxsEventResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.tx.v1beta1.GetTxsEventResponse} GetTxsEventResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetTxsEventResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.GetTxsEventResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.txs && message.txs.length)) + message.txs = []; + message.txs.push($root.cosmos.tx.v1beta1.Tx.decode(reader, reader.uint32())); + break; + case 2: + if (!(message.tx_responses && message.tx_responses.length)) + message.tx_responses = []; + message.tx_responses.push($root.cosmos.base.abci.v1beta1.TxResponse.decode(reader, reader.uint32())); + break; + case 3: + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetTxsEventResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.tx.v1beta1.GetTxsEventResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.tx.v1beta1.GetTxsEventResponse} GetTxsEventResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetTxsEventResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetTxsEventResponse message. + * @function verify + * @memberof cosmos.tx.v1beta1.GetTxsEventResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetTxsEventResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.txs != null && message.hasOwnProperty("txs")) { + if (!Array.isArray(message.txs)) + return "txs: array expected"; + for (let i = 0; i < message.txs.length; ++i) { + let error = $root.cosmos.tx.v1beta1.Tx.verify(message.txs[i]); + if (error) + return "txs." + error; + } + } + if (message.tx_responses != null && message.hasOwnProperty("tx_responses")) { + if (!Array.isArray(message.tx_responses)) + return "tx_responses: array expected"; + for (let i = 0; i < message.tx_responses.length; ++i) { + let error = $root.cosmos.base.abci.v1beta1.TxResponse.verify(message.tx_responses[i]); + if (error) + return "tx_responses." + error; + } + } + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a GetTxsEventResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.tx.v1beta1.GetTxsEventResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.tx.v1beta1.GetTxsEventResponse} GetTxsEventResponse + */ + GetTxsEventResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.tx.v1beta1.GetTxsEventResponse) + return object; + let message = new $root.cosmos.tx.v1beta1.GetTxsEventResponse(); + if (object.txs) { + if (!Array.isArray(object.txs)) + throw TypeError(".cosmos.tx.v1beta1.GetTxsEventResponse.txs: array expected"); + message.txs = []; + for (let i = 0; i < object.txs.length; ++i) { + if (typeof object.txs[i] !== "object") + throw TypeError(".cosmos.tx.v1beta1.GetTxsEventResponse.txs: object expected"); + message.txs[i] = $root.cosmos.tx.v1beta1.Tx.fromObject(object.txs[i]); + } + } + if (object.tx_responses) { + if (!Array.isArray(object.tx_responses)) + throw TypeError(".cosmos.tx.v1beta1.GetTxsEventResponse.tx_responses: array expected"); + message.tx_responses = []; + for (let i = 0; i < object.tx_responses.length; ++i) { + if (typeof object.tx_responses[i] !== "object") + throw TypeError(".cosmos.tx.v1beta1.GetTxsEventResponse.tx_responses: object expected"); + message.tx_responses[i] = $root.cosmos.base.abci.v1beta1.TxResponse.fromObject(object.tx_responses[i]); + } + } + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".cosmos.tx.v1beta1.GetTxsEventResponse.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a GetTxsEventResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.tx.v1beta1.GetTxsEventResponse + * @static + * @param {cosmos.tx.v1beta1.GetTxsEventResponse} message GetTxsEventResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetTxsEventResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) { + object.txs = []; + object.tx_responses = []; + } + if (options.defaults) + object.pagination = null; + if (message.txs && message.txs.length) { + object.txs = []; + for (let j = 0; j < message.txs.length; ++j) + object.txs[j] = $root.cosmos.tx.v1beta1.Tx.toObject(message.txs[j], options); + } + if (message.tx_responses && message.tx_responses.length) { + object.tx_responses = []; + for (let j = 0; j < message.tx_responses.length; ++j) + object.tx_responses[j] = $root.cosmos.base.abci.v1beta1.TxResponse.toObject(message.tx_responses[j], options); + } + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this GetTxsEventResponse to JSON. + * @function toJSON + * @memberof cosmos.tx.v1beta1.GetTxsEventResponse + * @instance + * @returns {Object.} JSON object + */ + GetTxsEventResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetTxsEventResponse; + })(); + + v1beta1.BroadcastTxRequest = (function() { + + /** + * Properties of a BroadcastTxRequest. + * @memberof cosmos.tx.v1beta1 + * @interface IBroadcastTxRequest + * @property {Uint8Array|null} [tx_bytes] BroadcastTxRequest tx_bytes + * @property {cosmos.tx.v1beta1.BroadcastMode|null} [mode] BroadcastTxRequest mode + */ + + /** + * Constructs a new BroadcastTxRequest. + * @memberof cosmos.tx.v1beta1 + * @classdesc Represents a BroadcastTxRequest. + * @implements IBroadcastTxRequest + * @constructor + * @param {cosmos.tx.v1beta1.IBroadcastTxRequest=} [properties] Properties to set + */ + function BroadcastTxRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BroadcastTxRequest tx_bytes. + * @member {Uint8Array} tx_bytes + * @memberof cosmos.tx.v1beta1.BroadcastTxRequest + * @instance + */ + BroadcastTxRequest.prototype.tx_bytes = $util.newBuffer([]); + + /** + * BroadcastTxRequest mode. + * @member {cosmos.tx.v1beta1.BroadcastMode} mode + * @memberof cosmos.tx.v1beta1.BroadcastTxRequest + * @instance + */ + BroadcastTxRequest.prototype.mode = 0; + + /** + * Encodes the specified BroadcastTxRequest message. Does not implicitly {@link cosmos.tx.v1beta1.BroadcastTxRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.tx.v1beta1.BroadcastTxRequest + * @static + * @param {cosmos.tx.v1beta1.IBroadcastTxRequest} message BroadcastTxRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BroadcastTxRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.tx_bytes != null && Object.hasOwnProperty.call(message, "tx_bytes")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.tx_bytes); + if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.mode); + return writer; + }; + + /** + * Encodes the specified BroadcastTxRequest message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.BroadcastTxRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.tx.v1beta1.BroadcastTxRequest + * @static + * @param {cosmos.tx.v1beta1.IBroadcastTxRequest} message BroadcastTxRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BroadcastTxRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BroadcastTxRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.tx.v1beta1.BroadcastTxRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.tx.v1beta1.BroadcastTxRequest} BroadcastTxRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BroadcastTxRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.BroadcastTxRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx_bytes = reader.bytes(); + break; + case 2: + message.mode = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BroadcastTxRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.tx.v1beta1.BroadcastTxRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.tx.v1beta1.BroadcastTxRequest} BroadcastTxRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BroadcastTxRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BroadcastTxRequest message. + * @function verify + * @memberof cosmos.tx.v1beta1.BroadcastTxRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BroadcastTxRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.tx_bytes != null && message.hasOwnProperty("tx_bytes")) + if (!(message.tx_bytes && typeof message.tx_bytes.length === "number" || $util.isString(message.tx_bytes))) + return "tx_bytes: buffer expected"; + if (message.mode != null && message.hasOwnProperty("mode")) + switch (message.mode) { + default: + return "mode: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates a BroadcastTxRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.tx.v1beta1.BroadcastTxRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.tx.v1beta1.BroadcastTxRequest} BroadcastTxRequest + */ + BroadcastTxRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.tx.v1beta1.BroadcastTxRequest) + return object; + let message = new $root.cosmos.tx.v1beta1.BroadcastTxRequest(); + if (object.tx_bytes != null) + if (typeof object.tx_bytes === "string") + $util.base64.decode(object.tx_bytes, message.tx_bytes = $util.newBuffer($util.base64.length(object.tx_bytes)), 0); + else if (object.tx_bytes.length) + message.tx_bytes = object.tx_bytes; + switch (object.mode) { + case "BROADCAST_MODE_UNSPECIFIED": + case 0: + message.mode = 0; + break; + case "BROADCAST_MODE_BLOCK": + case 1: + message.mode = 1; + break; + case "BROADCAST_MODE_SYNC": + case 2: + message.mode = 2; + break; + case "BROADCAST_MODE_ASYNC": + case 3: + message.mode = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a BroadcastTxRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.tx.v1beta1.BroadcastTxRequest + * @static + * @param {cosmos.tx.v1beta1.BroadcastTxRequest} message BroadcastTxRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BroadcastTxRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if (options.bytes === String) + object.tx_bytes = ""; + else { + object.tx_bytes = []; + if (options.bytes !== Array) + object.tx_bytes = $util.newBuffer(object.tx_bytes); + } + object.mode = options.enums === String ? "BROADCAST_MODE_UNSPECIFIED" : 0; + } + if (message.tx_bytes != null && message.hasOwnProperty("tx_bytes")) + object.tx_bytes = options.bytes === String ? $util.base64.encode(message.tx_bytes, 0, message.tx_bytes.length) : options.bytes === Array ? Array.prototype.slice.call(message.tx_bytes) : message.tx_bytes; + if (message.mode != null && message.hasOwnProperty("mode")) + object.mode = options.enums === String ? $root.cosmos.tx.v1beta1.BroadcastMode[message.mode] : message.mode; + return object; + }; + + /** + * Converts this BroadcastTxRequest to JSON. + * @function toJSON + * @memberof cosmos.tx.v1beta1.BroadcastTxRequest + * @instance + * @returns {Object.} JSON object + */ + BroadcastTxRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BroadcastTxRequest; + })(); + + /** + * BroadcastMode enum. + * @name cosmos.tx.v1beta1.BroadcastMode + * @enum {number} + * @property {number} BROADCAST_MODE_UNSPECIFIED=0 BROADCAST_MODE_UNSPECIFIED value + * @property {number} BROADCAST_MODE_BLOCK=1 BROADCAST_MODE_BLOCK value + * @property {number} BROADCAST_MODE_SYNC=2 BROADCAST_MODE_SYNC value + * @property {number} BROADCAST_MODE_ASYNC=3 BROADCAST_MODE_ASYNC value + */ + v1beta1.BroadcastMode = (function() { + const valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "BROADCAST_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "BROADCAST_MODE_BLOCK"] = 1; + values[valuesById[2] = "BROADCAST_MODE_SYNC"] = 2; + values[valuesById[3] = "BROADCAST_MODE_ASYNC"] = 3; + return values; + })(); + + v1beta1.BroadcastTxResponse = (function() { + + /** + * Properties of a BroadcastTxResponse. + * @memberof cosmos.tx.v1beta1 + * @interface IBroadcastTxResponse + * @property {cosmos.base.abci.v1beta1.ITxResponse|null} [tx_response] BroadcastTxResponse tx_response + */ + + /** + * Constructs a new BroadcastTxResponse. + * @memberof cosmos.tx.v1beta1 + * @classdesc Represents a BroadcastTxResponse. + * @implements IBroadcastTxResponse + * @constructor + * @param {cosmos.tx.v1beta1.IBroadcastTxResponse=} [properties] Properties to set + */ + function BroadcastTxResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BroadcastTxResponse tx_response. + * @member {cosmos.base.abci.v1beta1.ITxResponse|null|undefined} tx_response + * @memberof cosmos.tx.v1beta1.BroadcastTxResponse + * @instance + */ + BroadcastTxResponse.prototype.tx_response = null; + + /** + * Encodes the specified BroadcastTxResponse message. Does not implicitly {@link cosmos.tx.v1beta1.BroadcastTxResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.tx.v1beta1.BroadcastTxResponse + * @static + * @param {cosmos.tx.v1beta1.IBroadcastTxResponse} message BroadcastTxResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BroadcastTxResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.tx_response != null && Object.hasOwnProperty.call(message, "tx_response")) + $root.cosmos.base.abci.v1beta1.TxResponse.encode(message.tx_response, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BroadcastTxResponse message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.BroadcastTxResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.tx.v1beta1.BroadcastTxResponse + * @static + * @param {cosmos.tx.v1beta1.IBroadcastTxResponse} message BroadcastTxResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BroadcastTxResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BroadcastTxResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.tx.v1beta1.BroadcastTxResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.tx.v1beta1.BroadcastTxResponse} BroadcastTxResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BroadcastTxResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.BroadcastTxResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx_response = $root.cosmos.base.abci.v1beta1.TxResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BroadcastTxResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.tx.v1beta1.BroadcastTxResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.tx.v1beta1.BroadcastTxResponse} BroadcastTxResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BroadcastTxResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BroadcastTxResponse message. + * @function verify + * @memberof cosmos.tx.v1beta1.BroadcastTxResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BroadcastTxResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.tx_response != null && message.hasOwnProperty("tx_response")) { + let error = $root.cosmos.base.abci.v1beta1.TxResponse.verify(message.tx_response); + if (error) + return "tx_response." + error; + } + return null; + }; + + /** + * Creates a BroadcastTxResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.tx.v1beta1.BroadcastTxResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.tx.v1beta1.BroadcastTxResponse} BroadcastTxResponse + */ + BroadcastTxResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.tx.v1beta1.BroadcastTxResponse) + return object; + let message = new $root.cosmos.tx.v1beta1.BroadcastTxResponse(); + if (object.tx_response != null) { + if (typeof object.tx_response !== "object") + throw TypeError(".cosmos.tx.v1beta1.BroadcastTxResponse.tx_response: object expected"); + message.tx_response = $root.cosmos.base.abci.v1beta1.TxResponse.fromObject(object.tx_response); + } + return message; + }; + + /** + * Creates a plain object from a BroadcastTxResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.tx.v1beta1.BroadcastTxResponse + * @static + * @param {cosmos.tx.v1beta1.BroadcastTxResponse} message BroadcastTxResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BroadcastTxResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.tx_response = null; + if (message.tx_response != null && message.hasOwnProperty("tx_response")) + object.tx_response = $root.cosmos.base.abci.v1beta1.TxResponse.toObject(message.tx_response, options); + return object; + }; + + /** + * Converts this BroadcastTxResponse to JSON. + * @function toJSON + * @memberof cosmos.tx.v1beta1.BroadcastTxResponse + * @instance + * @returns {Object.} JSON object + */ + BroadcastTxResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BroadcastTxResponse; + })(); + + v1beta1.SimulateRequest = (function() { + + /** + * Properties of a SimulateRequest. + * @memberof cosmos.tx.v1beta1 + * @interface ISimulateRequest + * @property {cosmos.tx.v1beta1.ITx|null} [tx] SimulateRequest tx + */ + + /** + * Constructs a new SimulateRequest. + * @memberof cosmos.tx.v1beta1 + * @classdesc Represents a SimulateRequest. + * @implements ISimulateRequest + * @constructor + * @param {cosmos.tx.v1beta1.ISimulateRequest=} [properties] Properties to set + */ + function SimulateRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SimulateRequest tx. + * @member {cosmos.tx.v1beta1.ITx|null|undefined} tx + * @memberof cosmos.tx.v1beta1.SimulateRequest + * @instance + */ + SimulateRequest.prototype.tx = null; + + /** + * Encodes the specified SimulateRequest message. Does not implicitly {@link cosmos.tx.v1beta1.SimulateRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.tx.v1beta1.SimulateRequest + * @static + * @param {cosmos.tx.v1beta1.ISimulateRequest} message SimulateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SimulateRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.tx != null && Object.hasOwnProperty.call(message, "tx")) + $root.cosmos.tx.v1beta1.Tx.encode(message.tx, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SimulateRequest message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.SimulateRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.tx.v1beta1.SimulateRequest + * @static + * @param {cosmos.tx.v1beta1.ISimulateRequest} message SimulateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SimulateRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SimulateRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.tx.v1beta1.SimulateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.tx.v1beta1.SimulateRequest} SimulateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SimulateRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.SimulateRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx = $root.cosmos.tx.v1beta1.Tx.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SimulateRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.tx.v1beta1.SimulateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.tx.v1beta1.SimulateRequest} SimulateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SimulateRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SimulateRequest message. + * @function verify + * @memberof cosmos.tx.v1beta1.SimulateRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SimulateRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.tx != null && message.hasOwnProperty("tx")) { + let error = $root.cosmos.tx.v1beta1.Tx.verify(message.tx); + if (error) + return "tx." + error; + } + return null; + }; + + /** + * Creates a SimulateRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.tx.v1beta1.SimulateRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.tx.v1beta1.SimulateRequest} SimulateRequest + */ + SimulateRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.tx.v1beta1.SimulateRequest) + return object; + let message = new $root.cosmos.tx.v1beta1.SimulateRequest(); + if (object.tx != null) { + if (typeof object.tx !== "object") + throw TypeError(".cosmos.tx.v1beta1.SimulateRequest.tx: object expected"); + message.tx = $root.cosmos.tx.v1beta1.Tx.fromObject(object.tx); + } + return message; + }; + + /** + * Creates a plain object from a SimulateRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.tx.v1beta1.SimulateRequest + * @static + * @param {cosmos.tx.v1beta1.SimulateRequest} message SimulateRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SimulateRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.tx = null; + if (message.tx != null && message.hasOwnProperty("tx")) + object.tx = $root.cosmos.tx.v1beta1.Tx.toObject(message.tx, options); + return object; + }; + + /** + * Converts this SimulateRequest to JSON. + * @function toJSON + * @memberof cosmos.tx.v1beta1.SimulateRequest + * @instance + * @returns {Object.} JSON object + */ + SimulateRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SimulateRequest; + })(); + + v1beta1.SimulateResponse = (function() { + + /** + * Properties of a SimulateResponse. + * @memberof cosmos.tx.v1beta1 + * @interface ISimulateResponse + * @property {cosmos.base.abci.v1beta1.IGasInfo|null} [gas_info] SimulateResponse gas_info + * @property {cosmos.base.abci.v1beta1.IResult|null} [result] SimulateResponse result + */ + + /** + * Constructs a new SimulateResponse. + * @memberof cosmos.tx.v1beta1 + * @classdesc Represents a SimulateResponse. + * @implements ISimulateResponse + * @constructor + * @param {cosmos.tx.v1beta1.ISimulateResponse=} [properties] Properties to set + */ + function SimulateResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SimulateResponse gas_info. + * @member {cosmos.base.abci.v1beta1.IGasInfo|null|undefined} gas_info + * @memberof cosmos.tx.v1beta1.SimulateResponse + * @instance + */ + SimulateResponse.prototype.gas_info = null; + + /** + * SimulateResponse result. + * @member {cosmos.base.abci.v1beta1.IResult|null|undefined} result + * @memberof cosmos.tx.v1beta1.SimulateResponse + * @instance + */ + SimulateResponse.prototype.result = null; + + /** + * Encodes the specified SimulateResponse message. Does not implicitly {@link cosmos.tx.v1beta1.SimulateResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.tx.v1beta1.SimulateResponse + * @static + * @param {cosmos.tx.v1beta1.ISimulateResponse} message SimulateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SimulateResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gas_info != null && Object.hasOwnProperty.call(message, "gas_info")) + $root.cosmos.base.abci.v1beta1.GasInfo.encode(message.gas_info, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.result != null && Object.hasOwnProperty.call(message, "result")) + $root.cosmos.base.abci.v1beta1.Result.encode(message.result, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SimulateResponse message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.SimulateResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.tx.v1beta1.SimulateResponse + * @static + * @param {cosmos.tx.v1beta1.ISimulateResponse} message SimulateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SimulateResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SimulateResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.tx.v1beta1.SimulateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.tx.v1beta1.SimulateResponse} SimulateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SimulateResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.SimulateResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gas_info = $root.cosmos.base.abci.v1beta1.GasInfo.decode(reader, reader.uint32()); + break; + case 2: + message.result = $root.cosmos.base.abci.v1beta1.Result.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SimulateResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.tx.v1beta1.SimulateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.tx.v1beta1.SimulateResponse} SimulateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SimulateResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SimulateResponse message. + * @function verify + * @memberof cosmos.tx.v1beta1.SimulateResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SimulateResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.gas_info != null && message.hasOwnProperty("gas_info")) { + let error = $root.cosmos.base.abci.v1beta1.GasInfo.verify(message.gas_info); + if (error) + return "gas_info." + error; + } + if (message.result != null && message.hasOwnProperty("result")) { + let error = $root.cosmos.base.abci.v1beta1.Result.verify(message.result); + if (error) + return "result." + error; + } + return null; + }; + + /** + * Creates a SimulateResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.tx.v1beta1.SimulateResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.tx.v1beta1.SimulateResponse} SimulateResponse + */ + SimulateResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.tx.v1beta1.SimulateResponse) + return object; + let message = new $root.cosmos.tx.v1beta1.SimulateResponse(); + if (object.gas_info != null) { + if (typeof object.gas_info !== "object") + throw TypeError(".cosmos.tx.v1beta1.SimulateResponse.gas_info: object expected"); + message.gas_info = $root.cosmos.base.abci.v1beta1.GasInfo.fromObject(object.gas_info); + } + if (object.result != null) { + if (typeof object.result !== "object") + throw TypeError(".cosmos.tx.v1beta1.SimulateResponse.result: object expected"); + message.result = $root.cosmos.base.abci.v1beta1.Result.fromObject(object.result); + } + return message; + }; + + /** + * Creates a plain object from a SimulateResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.tx.v1beta1.SimulateResponse + * @static + * @param {cosmos.tx.v1beta1.SimulateResponse} message SimulateResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SimulateResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.gas_info = null; + object.result = null; + } + if (message.gas_info != null && message.hasOwnProperty("gas_info")) + object.gas_info = $root.cosmos.base.abci.v1beta1.GasInfo.toObject(message.gas_info, options); + if (message.result != null && message.hasOwnProperty("result")) + object.result = $root.cosmos.base.abci.v1beta1.Result.toObject(message.result, options); + return object; + }; + + /** + * Converts this SimulateResponse to JSON. + * @function toJSON + * @memberof cosmos.tx.v1beta1.SimulateResponse + * @instance + * @returns {Object.} JSON object + */ + SimulateResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SimulateResponse; + })(); + + v1beta1.GetTxRequest = (function() { + + /** + * Properties of a GetTxRequest. + * @memberof cosmos.tx.v1beta1 + * @interface IGetTxRequest + * @property {string|null} [hash] GetTxRequest hash + */ + + /** + * Constructs a new GetTxRequest. + * @memberof cosmos.tx.v1beta1 + * @classdesc Represents a GetTxRequest. + * @implements IGetTxRequest + * @constructor + * @param {cosmos.tx.v1beta1.IGetTxRequest=} [properties] Properties to set + */ + function GetTxRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetTxRequest hash. + * @member {string} hash + * @memberof cosmos.tx.v1beta1.GetTxRequest + * @instance + */ + GetTxRequest.prototype.hash = ""; + + /** + * Encodes the specified GetTxRequest message. Does not implicitly {@link cosmos.tx.v1beta1.GetTxRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.tx.v1beta1.GetTxRequest + * @static + * @param {cosmos.tx.v1beta1.IGetTxRequest} message GetTxRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetTxRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.hash != null && Object.hasOwnProperty.call(message, "hash")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.hash); + return writer; + }; + + /** + * Encodes the specified GetTxRequest message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.GetTxRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.tx.v1beta1.GetTxRequest + * @static + * @param {cosmos.tx.v1beta1.IGetTxRequest} message GetTxRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetTxRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetTxRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.tx.v1beta1.GetTxRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.tx.v1beta1.GetTxRequest} GetTxRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetTxRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.GetTxRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetTxRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.tx.v1beta1.GetTxRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.tx.v1beta1.GetTxRequest} GetTxRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetTxRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetTxRequest message. + * @function verify + * @memberof cosmos.tx.v1beta1.GetTxRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetTxRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.hash != null && message.hasOwnProperty("hash")) + if (!$util.isString(message.hash)) + return "hash: string expected"; + return null; + }; + + /** + * Creates a GetTxRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.tx.v1beta1.GetTxRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.tx.v1beta1.GetTxRequest} GetTxRequest + */ + GetTxRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.tx.v1beta1.GetTxRequest) + return object; + let message = new $root.cosmos.tx.v1beta1.GetTxRequest(); + if (object.hash != null) + message.hash = String(object.hash); + return message; + }; + + /** + * Creates a plain object from a GetTxRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.tx.v1beta1.GetTxRequest + * @static + * @param {cosmos.tx.v1beta1.GetTxRequest} message GetTxRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetTxRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.hash = ""; + if (message.hash != null && message.hasOwnProperty("hash")) + object.hash = message.hash; + return object; + }; + + /** + * Converts this GetTxRequest to JSON. + * @function toJSON + * @memberof cosmos.tx.v1beta1.GetTxRequest + * @instance + * @returns {Object.} JSON object + */ + GetTxRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetTxRequest; + })(); + + v1beta1.GetTxResponse = (function() { + + /** + * Properties of a GetTxResponse. + * @memberof cosmos.tx.v1beta1 + * @interface IGetTxResponse + * @property {cosmos.tx.v1beta1.ITx|null} [tx] GetTxResponse tx + * @property {cosmos.base.abci.v1beta1.ITxResponse|null} [tx_response] GetTxResponse tx_response + */ + + /** + * Constructs a new GetTxResponse. + * @memberof cosmos.tx.v1beta1 + * @classdesc Represents a GetTxResponse. + * @implements IGetTxResponse + * @constructor + * @param {cosmos.tx.v1beta1.IGetTxResponse=} [properties] Properties to set + */ + function GetTxResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetTxResponse tx. + * @member {cosmos.tx.v1beta1.ITx|null|undefined} tx + * @memberof cosmos.tx.v1beta1.GetTxResponse + * @instance + */ + GetTxResponse.prototype.tx = null; + + /** + * GetTxResponse tx_response. + * @member {cosmos.base.abci.v1beta1.ITxResponse|null|undefined} tx_response + * @memberof cosmos.tx.v1beta1.GetTxResponse + * @instance + */ + GetTxResponse.prototype.tx_response = null; + + /** + * Encodes the specified GetTxResponse message. Does not implicitly {@link cosmos.tx.v1beta1.GetTxResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.tx.v1beta1.GetTxResponse + * @static + * @param {cosmos.tx.v1beta1.IGetTxResponse} message GetTxResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetTxResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.tx != null && Object.hasOwnProperty.call(message, "tx")) + $root.cosmos.tx.v1beta1.Tx.encode(message.tx, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.tx_response != null && Object.hasOwnProperty.call(message, "tx_response")) + $root.cosmos.base.abci.v1beta1.TxResponse.encode(message.tx_response, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetTxResponse message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.GetTxResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.tx.v1beta1.GetTxResponse + * @static + * @param {cosmos.tx.v1beta1.IGetTxResponse} message GetTxResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetTxResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetTxResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.tx.v1beta1.GetTxResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.tx.v1beta1.GetTxResponse} GetTxResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetTxResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.GetTxResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx = $root.cosmos.tx.v1beta1.Tx.decode(reader, reader.uint32()); + break; + case 2: + message.tx_response = $root.cosmos.base.abci.v1beta1.TxResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetTxResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.tx.v1beta1.GetTxResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.tx.v1beta1.GetTxResponse} GetTxResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetTxResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetTxResponse message. + * @function verify + * @memberof cosmos.tx.v1beta1.GetTxResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetTxResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.tx != null && message.hasOwnProperty("tx")) { + let error = $root.cosmos.tx.v1beta1.Tx.verify(message.tx); + if (error) + return "tx." + error; + } + if (message.tx_response != null && message.hasOwnProperty("tx_response")) { + let error = $root.cosmos.base.abci.v1beta1.TxResponse.verify(message.tx_response); + if (error) + return "tx_response." + error; + } + return null; + }; + + /** + * Creates a GetTxResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.tx.v1beta1.GetTxResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.tx.v1beta1.GetTxResponse} GetTxResponse + */ + GetTxResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.tx.v1beta1.GetTxResponse) + return object; + let message = new $root.cosmos.tx.v1beta1.GetTxResponse(); + if (object.tx != null) { + if (typeof object.tx !== "object") + throw TypeError(".cosmos.tx.v1beta1.GetTxResponse.tx: object expected"); + message.tx = $root.cosmos.tx.v1beta1.Tx.fromObject(object.tx); + } + if (object.tx_response != null) { + if (typeof object.tx_response !== "object") + throw TypeError(".cosmos.tx.v1beta1.GetTxResponse.tx_response: object expected"); + message.tx_response = $root.cosmos.base.abci.v1beta1.TxResponse.fromObject(object.tx_response); + } + return message; + }; + + /** + * Creates a plain object from a GetTxResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.tx.v1beta1.GetTxResponse + * @static + * @param {cosmos.tx.v1beta1.GetTxResponse} message GetTxResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetTxResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.tx = null; + object.tx_response = null; + } + if (message.tx != null && message.hasOwnProperty("tx")) + object.tx = $root.cosmos.tx.v1beta1.Tx.toObject(message.tx, options); + if (message.tx_response != null && message.hasOwnProperty("tx_response")) + object.tx_response = $root.cosmos.base.abci.v1beta1.TxResponse.toObject(message.tx_response, options); + return object; + }; + + /** + * Converts this GetTxResponse to JSON. + * @function toJSON + * @memberof cosmos.tx.v1beta1.GetTxResponse + * @instance + * @returns {Object.} JSON object + */ + GetTxResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetTxResponse; + })(); + + return v1beta1; + })(); + + return tx; + })(); + + cosmos.upgrade = (function() { + + /** + * Namespace upgrade. + * @memberof cosmos + * @namespace + */ + const upgrade = {}; + + upgrade.v1beta1 = (function() { + + /** + * Namespace v1beta1. + * @memberof cosmos.upgrade + * @namespace + */ + const v1beta1 = {}; + + v1beta1.Plan = (function() { + + /** + * Properties of a Plan. + * @memberof cosmos.upgrade.v1beta1 + * @interface IPlan + * @property {string|null} [name] Plan name + * @property {google.protobuf.ITimestamp|null} [time] Plan time + * @property {Long|null} [height] Plan height + * @property {string|null} [info] Plan info + * @property {google.protobuf.IAny|null} [upgraded_client_state] Plan upgraded_client_state + */ + + /** + * Constructs a new Plan. + * @memberof cosmos.upgrade.v1beta1 + * @classdesc Represents a Plan. + * @implements IPlan + * @constructor + * @param {cosmos.upgrade.v1beta1.IPlan=} [properties] Properties to set + */ + function Plan(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Plan name. + * @member {string} name + * @memberof cosmos.upgrade.v1beta1.Plan + * @instance + */ + Plan.prototype.name = ""; + + /** + * Plan time. + * @member {google.protobuf.ITimestamp|null|undefined} time + * @memberof cosmos.upgrade.v1beta1.Plan + * @instance + */ + Plan.prototype.time = null; + + /** + * Plan height. + * @member {Long} height + * @memberof cosmos.upgrade.v1beta1.Plan + * @instance + */ + Plan.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Plan info. + * @member {string} info + * @memberof cosmos.upgrade.v1beta1.Plan + * @instance + */ + Plan.prototype.info = ""; + + /** + * Plan upgraded_client_state. + * @member {google.protobuf.IAny|null|undefined} upgraded_client_state + * @memberof cosmos.upgrade.v1beta1.Plan + * @instance + */ + Plan.prototype.upgraded_client_state = null; + + /** + * Encodes the specified Plan message. Does not implicitly {@link cosmos.upgrade.v1beta1.Plan.verify|verify} messages. + * @function encode + * @memberof cosmos.upgrade.v1beta1.Plan + * @static + * @param {cosmos.upgrade.v1beta1.IPlan} message Plan message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Plan.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.time != null && Object.hasOwnProperty.call(message, "time")) + $root.google.protobuf.Timestamp.encode(message.time, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.height); + if (message.info != null && Object.hasOwnProperty.call(message, "info")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.info); + if (message.upgraded_client_state != null && Object.hasOwnProperty.call(message, "upgraded_client_state")) + $root.google.protobuf.Any.encode(message.upgraded_client_state, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Plan message, length delimited. Does not implicitly {@link cosmos.upgrade.v1beta1.Plan.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.upgrade.v1beta1.Plan + * @static + * @param {cosmos.upgrade.v1beta1.IPlan} message Plan message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Plan.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Plan message from the specified reader or buffer. + * @function decode + * @memberof cosmos.upgrade.v1beta1.Plan + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.upgrade.v1beta1.Plan} Plan + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Plan.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.upgrade.v1beta1.Plan(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.height = reader.int64(); + break; + case 4: + message.info = reader.string(); + break; + case 5: + message.upgraded_client_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Plan message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.upgrade.v1beta1.Plan + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.upgrade.v1beta1.Plan} Plan + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Plan.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Plan message. + * @function verify + * @memberof cosmos.upgrade.v1beta1.Plan + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Plan.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.time != null && message.hasOwnProperty("time")) { + let error = $root.google.protobuf.Timestamp.verify(message.time); + if (error) + return "time." + error; + } + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) + return "height: integer|Long expected"; + if (message.info != null && message.hasOwnProperty("info")) + if (!$util.isString(message.info)) + return "info: string expected"; + if (message.upgraded_client_state != null && message.hasOwnProperty("upgraded_client_state")) { + let error = $root.google.protobuf.Any.verify(message.upgraded_client_state); + if (error) + return "upgraded_client_state." + error; + } + return null; + }; + + /** + * Creates a Plan message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.upgrade.v1beta1.Plan + * @static + * @param {Object.} object Plain object + * @returns {cosmos.upgrade.v1beta1.Plan} Plan + */ + Plan.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.upgrade.v1beta1.Plan) + return object; + let message = new $root.cosmos.upgrade.v1beta1.Plan(); + if (object.name != null) + message.name = String(object.name); + if (object.time != null) { + if (typeof object.time !== "object") + throw TypeError(".cosmos.upgrade.v1beta1.Plan.time: object expected"); + message.time = $root.google.protobuf.Timestamp.fromObject(object.time); + } + if (object.height != null) + if ($util.Long) + (message.height = $util.Long.fromValue(object.height)).unsigned = false; + else if (typeof object.height === "string") + message.height = parseInt(object.height, 10); + else if (typeof object.height === "number") + message.height = object.height; + else if (typeof object.height === "object") + message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); + if (object.info != null) + message.info = String(object.info); + if (object.upgraded_client_state != null) { + if (typeof object.upgraded_client_state !== "object") + throw TypeError(".cosmos.upgrade.v1beta1.Plan.upgraded_client_state: object expected"); + message.upgraded_client_state = $root.google.protobuf.Any.fromObject(object.upgraded_client_state); + } + return message; + }; + + /** + * Creates a plain object from a Plan message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.upgrade.v1beta1.Plan + * @static + * @param {cosmos.upgrade.v1beta1.Plan} message Plan + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Plan.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.name = ""; + object.time = null; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.height = options.longs === String ? "0" : 0; + object.info = ""; + object.upgraded_client_state = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.time != null && message.hasOwnProperty("time")) + object.time = $root.google.protobuf.Timestamp.toObject(message.time, options); + if (message.height != null && message.hasOwnProperty("height")) + if (typeof message.height === "number") + object.height = options.longs === String ? String(message.height) : message.height; + else + object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; + if (message.info != null && message.hasOwnProperty("info")) + object.info = message.info; + if (message.upgraded_client_state != null && message.hasOwnProperty("upgraded_client_state")) + object.upgraded_client_state = $root.google.protobuf.Any.toObject(message.upgraded_client_state, options); + return object; + }; + + /** + * Converts this Plan to JSON. + * @function toJSON + * @memberof cosmos.upgrade.v1beta1.Plan + * @instance + * @returns {Object.} JSON object + */ + Plan.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Plan; + })(); + + v1beta1.SoftwareUpgradeProposal = (function() { + + /** + * Properties of a SoftwareUpgradeProposal. + * @memberof cosmos.upgrade.v1beta1 + * @interface ISoftwareUpgradeProposal + * @property {string|null} [title] SoftwareUpgradeProposal title + * @property {string|null} [description] SoftwareUpgradeProposal description + * @property {cosmos.upgrade.v1beta1.IPlan|null} [plan] SoftwareUpgradeProposal plan + */ + + /** + * Constructs a new SoftwareUpgradeProposal. + * @memberof cosmos.upgrade.v1beta1 + * @classdesc Represents a SoftwareUpgradeProposal. + * @implements ISoftwareUpgradeProposal + * @constructor + * @param {cosmos.upgrade.v1beta1.ISoftwareUpgradeProposal=} [properties] Properties to set + */ + function SoftwareUpgradeProposal(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SoftwareUpgradeProposal title. + * @member {string} title + * @memberof cosmos.upgrade.v1beta1.SoftwareUpgradeProposal + * @instance + */ + SoftwareUpgradeProposal.prototype.title = ""; + + /** + * SoftwareUpgradeProposal description. + * @member {string} description + * @memberof cosmos.upgrade.v1beta1.SoftwareUpgradeProposal + * @instance + */ + SoftwareUpgradeProposal.prototype.description = ""; + + /** + * SoftwareUpgradeProposal plan. + * @member {cosmos.upgrade.v1beta1.IPlan|null|undefined} plan + * @memberof cosmos.upgrade.v1beta1.SoftwareUpgradeProposal + * @instance + */ + SoftwareUpgradeProposal.prototype.plan = null; + + /** + * Encodes the specified SoftwareUpgradeProposal message. Does not implicitly {@link cosmos.upgrade.v1beta1.SoftwareUpgradeProposal.verify|verify} messages. + * @function encode + * @memberof cosmos.upgrade.v1beta1.SoftwareUpgradeProposal + * @static + * @param {cosmos.upgrade.v1beta1.ISoftwareUpgradeProposal} message SoftwareUpgradeProposal message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SoftwareUpgradeProposal.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.plan != null && Object.hasOwnProperty.call(message, "plan")) + $root.cosmos.upgrade.v1beta1.Plan.encode(message.plan, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SoftwareUpgradeProposal message, length delimited. Does not implicitly {@link cosmos.upgrade.v1beta1.SoftwareUpgradeProposal.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.upgrade.v1beta1.SoftwareUpgradeProposal + * @static + * @param {cosmos.upgrade.v1beta1.ISoftwareUpgradeProposal} message SoftwareUpgradeProposal message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SoftwareUpgradeProposal.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SoftwareUpgradeProposal message from the specified reader or buffer. + * @function decode + * @memberof cosmos.upgrade.v1beta1.SoftwareUpgradeProposal + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.upgrade.v1beta1.SoftwareUpgradeProposal} SoftwareUpgradeProposal + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SoftwareUpgradeProposal.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.upgrade.v1beta1.SoftwareUpgradeProposal(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.plan = $root.cosmos.upgrade.v1beta1.Plan.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SoftwareUpgradeProposal message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.upgrade.v1beta1.SoftwareUpgradeProposal + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.upgrade.v1beta1.SoftwareUpgradeProposal} SoftwareUpgradeProposal + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SoftwareUpgradeProposal.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SoftwareUpgradeProposal message. + * @function verify + * @memberof cosmos.upgrade.v1beta1.SoftwareUpgradeProposal + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SoftwareUpgradeProposal.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.plan != null && message.hasOwnProperty("plan")) { + let error = $root.cosmos.upgrade.v1beta1.Plan.verify(message.plan); + if (error) + return "plan." + error; + } + return null; + }; + + /** + * Creates a SoftwareUpgradeProposal message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.upgrade.v1beta1.SoftwareUpgradeProposal + * @static + * @param {Object.} object Plain object + * @returns {cosmos.upgrade.v1beta1.SoftwareUpgradeProposal} SoftwareUpgradeProposal + */ + SoftwareUpgradeProposal.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.upgrade.v1beta1.SoftwareUpgradeProposal) + return object; + let message = new $root.cosmos.upgrade.v1beta1.SoftwareUpgradeProposal(); + if (object.title != null) + message.title = String(object.title); + if (object.description != null) + message.description = String(object.description); + if (object.plan != null) { + if (typeof object.plan !== "object") + throw TypeError(".cosmos.upgrade.v1beta1.SoftwareUpgradeProposal.plan: object expected"); + message.plan = $root.cosmos.upgrade.v1beta1.Plan.fromObject(object.plan); + } + return message; + }; + + /** + * Creates a plain object from a SoftwareUpgradeProposal message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.upgrade.v1beta1.SoftwareUpgradeProposal + * @static + * @param {cosmos.upgrade.v1beta1.SoftwareUpgradeProposal} message SoftwareUpgradeProposal + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SoftwareUpgradeProposal.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.title = ""; + object.description = ""; + object.plan = null; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.plan != null && message.hasOwnProperty("plan")) + object.plan = $root.cosmos.upgrade.v1beta1.Plan.toObject(message.plan, options); + return object; + }; + + /** + * Converts this SoftwareUpgradeProposal to JSON. + * @function toJSON + * @memberof cosmos.upgrade.v1beta1.SoftwareUpgradeProposal + * @instance + * @returns {Object.} JSON object + */ + SoftwareUpgradeProposal.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SoftwareUpgradeProposal; + })(); + + v1beta1.CancelSoftwareUpgradeProposal = (function() { + + /** + * Properties of a CancelSoftwareUpgradeProposal. + * @memberof cosmos.upgrade.v1beta1 + * @interface ICancelSoftwareUpgradeProposal + * @property {string|null} [title] CancelSoftwareUpgradeProposal title + * @property {string|null} [description] CancelSoftwareUpgradeProposal description + */ + + /** + * Constructs a new CancelSoftwareUpgradeProposal. + * @memberof cosmos.upgrade.v1beta1 + * @classdesc Represents a CancelSoftwareUpgradeProposal. + * @implements ICancelSoftwareUpgradeProposal + * @constructor + * @param {cosmos.upgrade.v1beta1.ICancelSoftwareUpgradeProposal=} [properties] Properties to set + */ + function CancelSoftwareUpgradeProposal(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CancelSoftwareUpgradeProposal title. + * @member {string} title + * @memberof cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal + * @instance + */ + CancelSoftwareUpgradeProposal.prototype.title = ""; + + /** + * CancelSoftwareUpgradeProposal description. + * @member {string} description + * @memberof cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal + * @instance + */ + CancelSoftwareUpgradeProposal.prototype.description = ""; + + /** + * Encodes the specified CancelSoftwareUpgradeProposal message. Does not implicitly {@link cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal.verify|verify} messages. + * @function encode + * @memberof cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal + * @static + * @param {cosmos.upgrade.v1beta1.ICancelSoftwareUpgradeProposal} message CancelSoftwareUpgradeProposal message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CancelSoftwareUpgradeProposal.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + return writer; + }; + + /** + * Encodes the specified CancelSoftwareUpgradeProposal message, length delimited. Does not implicitly {@link cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal + * @static + * @param {cosmos.upgrade.v1beta1.ICancelSoftwareUpgradeProposal} message CancelSoftwareUpgradeProposal message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CancelSoftwareUpgradeProposal.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CancelSoftwareUpgradeProposal message from the specified reader or buffer. + * @function decode + * @memberof cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal} CancelSoftwareUpgradeProposal + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CancelSoftwareUpgradeProposal.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal(); + while (reader.pos < end) { + let 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; + }; + + /** + * Decodes a CancelSoftwareUpgradeProposal message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal} CancelSoftwareUpgradeProposal + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CancelSoftwareUpgradeProposal.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CancelSoftwareUpgradeProposal message. + * @function verify + * @memberof cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CancelSoftwareUpgradeProposal.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + return null; + }; + + /** + * Creates a CancelSoftwareUpgradeProposal message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal + * @static + * @param {Object.} object Plain object + * @returns {cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal} CancelSoftwareUpgradeProposal + */ + CancelSoftwareUpgradeProposal.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal) + return object; + let message = new $root.cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal(); + if (object.title != null) + message.title = String(object.title); + if (object.description != null) + message.description = String(object.description); + return message; + }; + + /** + * Creates a plain object from a CancelSoftwareUpgradeProposal message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal + * @static + * @param {cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal} message CancelSoftwareUpgradeProposal + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CancelSoftwareUpgradeProposal.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.title = ""; + object.description = ""; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + return object; + }; + + /** + * Converts this CancelSoftwareUpgradeProposal to JSON. + * @function toJSON + * @memberof cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal + * @instance + * @returns {Object.} JSON object + */ + CancelSoftwareUpgradeProposal.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CancelSoftwareUpgradeProposal; + })(); + + v1beta1.Query = (function() { + + /** + * Constructs a new Query service. + * @memberof cosmos.upgrade.v1beta1 + * @classdesc Represents a Query + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Query(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Query.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Query; + + /** + * Callback as used by {@link cosmos.upgrade.v1beta1.Query#currentPlan}. + * @memberof cosmos.upgrade.v1beta1.Query + * @typedef CurrentPlanCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.upgrade.v1beta1.QueryCurrentPlanResponse} [response] QueryCurrentPlanResponse + */ + + /** + * Calls CurrentPlan. + * @function currentPlan + * @memberof cosmos.upgrade.v1beta1.Query + * @instance + * @param {cosmos.upgrade.v1beta1.IQueryCurrentPlanRequest} request QueryCurrentPlanRequest message or plain object + * @param {cosmos.upgrade.v1beta1.Query.CurrentPlanCallback} callback Node-style callback called with the error, if any, and QueryCurrentPlanResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.currentPlan = function currentPlan(request, callback) { + return this.rpcCall(currentPlan, $root.cosmos.upgrade.v1beta1.QueryCurrentPlanRequest, $root.cosmos.upgrade.v1beta1.QueryCurrentPlanResponse, request, callback); + }, "name", { value: "CurrentPlan" }); + + /** + * Calls CurrentPlan. + * @function currentPlan + * @memberof cosmos.upgrade.v1beta1.Query + * @instance + * @param {cosmos.upgrade.v1beta1.IQueryCurrentPlanRequest} request QueryCurrentPlanRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.upgrade.v1beta1.Query#appliedPlan}. + * @memberof cosmos.upgrade.v1beta1.Query + * @typedef AppliedPlanCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.upgrade.v1beta1.QueryAppliedPlanResponse} [response] QueryAppliedPlanResponse + */ + + /** + * Calls AppliedPlan. + * @function appliedPlan + * @memberof cosmos.upgrade.v1beta1.Query + * @instance + * @param {cosmos.upgrade.v1beta1.IQueryAppliedPlanRequest} request QueryAppliedPlanRequest message or plain object + * @param {cosmos.upgrade.v1beta1.Query.AppliedPlanCallback} callback Node-style callback called with the error, if any, and QueryAppliedPlanResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.appliedPlan = function appliedPlan(request, callback) { + return this.rpcCall(appliedPlan, $root.cosmos.upgrade.v1beta1.QueryAppliedPlanRequest, $root.cosmos.upgrade.v1beta1.QueryAppliedPlanResponse, request, callback); + }, "name", { value: "AppliedPlan" }); + + /** + * Calls AppliedPlan. + * @function appliedPlan + * @memberof cosmos.upgrade.v1beta1.Query + * @instance + * @param {cosmos.upgrade.v1beta1.IQueryAppliedPlanRequest} request QueryAppliedPlanRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link cosmos.upgrade.v1beta1.Query#upgradedConsensusState}. + * @memberof cosmos.upgrade.v1beta1.Query + * @typedef UpgradedConsensusStateCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse} [response] QueryUpgradedConsensusStateResponse + */ + + /** + * Calls UpgradedConsensusState. + * @function upgradedConsensusState + * @memberof cosmos.upgrade.v1beta1.Query + * @instance + * @param {cosmos.upgrade.v1beta1.IQueryUpgradedConsensusStateRequest} request QueryUpgradedConsensusStateRequest message or plain object + * @param {cosmos.upgrade.v1beta1.Query.UpgradedConsensusStateCallback} callback Node-style callback called with the error, if any, and QueryUpgradedConsensusStateResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.upgradedConsensusState = function upgradedConsensusState(request, callback) { + return this.rpcCall(upgradedConsensusState, $root.cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest, $root.cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse, request, callback); + }, "name", { value: "UpgradedConsensusState" }); + + /** + * Calls UpgradedConsensusState. + * @function upgradedConsensusState + * @memberof cosmos.upgrade.v1beta1.Query + * @instance + * @param {cosmos.upgrade.v1beta1.IQueryUpgradedConsensusStateRequest} request QueryUpgradedConsensusStateRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Query; + })(); + + v1beta1.QueryCurrentPlanRequest = (function() { + + /** + * Properties of a QueryCurrentPlanRequest. + * @memberof cosmos.upgrade.v1beta1 + * @interface IQueryCurrentPlanRequest + */ + + /** + * Constructs a new QueryCurrentPlanRequest. + * @memberof cosmos.upgrade.v1beta1 + * @classdesc Represents a QueryCurrentPlanRequest. + * @implements IQueryCurrentPlanRequest + * @constructor + * @param {cosmos.upgrade.v1beta1.IQueryCurrentPlanRequest=} [properties] Properties to set + */ + function QueryCurrentPlanRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified QueryCurrentPlanRequest message. Does not implicitly {@link cosmos.upgrade.v1beta1.QueryCurrentPlanRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanRequest + * @static + * @param {cosmos.upgrade.v1beta1.IQueryCurrentPlanRequest} message QueryCurrentPlanRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryCurrentPlanRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified QueryCurrentPlanRequest message, length delimited. Does not implicitly {@link cosmos.upgrade.v1beta1.QueryCurrentPlanRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanRequest + * @static + * @param {cosmos.upgrade.v1beta1.IQueryCurrentPlanRequest} message QueryCurrentPlanRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryCurrentPlanRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryCurrentPlanRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.upgrade.v1beta1.QueryCurrentPlanRequest} QueryCurrentPlanRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryCurrentPlanRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.upgrade.v1beta1.QueryCurrentPlanRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryCurrentPlanRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.upgrade.v1beta1.QueryCurrentPlanRequest} QueryCurrentPlanRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryCurrentPlanRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryCurrentPlanRequest message. + * @function verify + * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryCurrentPlanRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a QueryCurrentPlanRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.upgrade.v1beta1.QueryCurrentPlanRequest} QueryCurrentPlanRequest + */ + QueryCurrentPlanRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.upgrade.v1beta1.QueryCurrentPlanRequest) + return object; + return new $root.cosmos.upgrade.v1beta1.QueryCurrentPlanRequest(); + }; + + /** + * Creates a plain object from a QueryCurrentPlanRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanRequest + * @static + * @param {cosmos.upgrade.v1beta1.QueryCurrentPlanRequest} message QueryCurrentPlanRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryCurrentPlanRequest.toObject = function toObject() { + return {}; + }; + + /** + * Converts this QueryCurrentPlanRequest to JSON. + * @function toJSON + * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanRequest + * @instance + * @returns {Object.} JSON object + */ + QueryCurrentPlanRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryCurrentPlanRequest; + })(); + + v1beta1.QueryCurrentPlanResponse = (function() { + + /** + * Properties of a QueryCurrentPlanResponse. + * @memberof cosmos.upgrade.v1beta1 + * @interface IQueryCurrentPlanResponse + * @property {cosmos.upgrade.v1beta1.IPlan|null} [plan] QueryCurrentPlanResponse plan + */ + + /** + * Constructs a new QueryCurrentPlanResponse. + * @memberof cosmos.upgrade.v1beta1 + * @classdesc Represents a QueryCurrentPlanResponse. + * @implements IQueryCurrentPlanResponse + * @constructor + * @param {cosmos.upgrade.v1beta1.IQueryCurrentPlanResponse=} [properties] Properties to set + */ + function QueryCurrentPlanResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryCurrentPlanResponse plan. + * @member {cosmos.upgrade.v1beta1.IPlan|null|undefined} plan + * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanResponse + * @instance + */ + QueryCurrentPlanResponse.prototype.plan = null; + + /** + * Encodes the specified QueryCurrentPlanResponse message. Does not implicitly {@link cosmos.upgrade.v1beta1.QueryCurrentPlanResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanResponse + * @static + * @param {cosmos.upgrade.v1beta1.IQueryCurrentPlanResponse} message QueryCurrentPlanResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryCurrentPlanResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.plan != null && Object.hasOwnProperty.call(message, "plan")) + $root.cosmos.upgrade.v1beta1.Plan.encode(message.plan, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryCurrentPlanResponse message, length delimited. Does not implicitly {@link cosmos.upgrade.v1beta1.QueryCurrentPlanResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanResponse + * @static + * @param {cosmos.upgrade.v1beta1.IQueryCurrentPlanResponse} message QueryCurrentPlanResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryCurrentPlanResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryCurrentPlanResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.upgrade.v1beta1.QueryCurrentPlanResponse} QueryCurrentPlanResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryCurrentPlanResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.upgrade.v1beta1.QueryCurrentPlanResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.plan = $root.cosmos.upgrade.v1beta1.Plan.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryCurrentPlanResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.upgrade.v1beta1.QueryCurrentPlanResponse} QueryCurrentPlanResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryCurrentPlanResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryCurrentPlanResponse message. + * @function verify + * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryCurrentPlanResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.plan != null && message.hasOwnProperty("plan")) { + let error = $root.cosmos.upgrade.v1beta1.Plan.verify(message.plan); + if (error) + return "plan." + error; + } + return null; + }; + + /** + * Creates a QueryCurrentPlanResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.upgrade.v1beta1.QueryCurrentPlanResponse} QueryCurrentPlanResponse + */ + QueryCurrentPlanResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.upgrade.v1beta1.QueryCurrentPlanResponse) + return object; + let message = new $root.cosmos.upgrade.v1beta1.QueryCurrentPlanResponse(); + if (object.plan != null) { + if (typeof object.plan !== "object") + throw TypeError(".cosmos.upgrade.v1beta1.QueryCurrentPlanResponse.plan: object expected"); + message.plan = $root.cosmos.upgrade.v1beta1.Plan.fromObject(object.plan); + } + return message; + }; + + /** + * Creates a plain object from a QueryCurrentPlanResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanResponse + * @static + * @param {cosmos.upgrade.v1beta1.QueryCurrentPlanResponse} message QueryCurrentPlanResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryCurrentPlanResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.plan = null; + if (message.plan != null && message.hasOwnProperty("plan")) + object.plan = $root.cosmos.upgrade.v1beta1.Plan.toObject(message.plan, options); + return object; + }; + + /** + * Converts this QueryCurrentPlanResponse to JSON. + * @function toJSON + * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanResponse + * @instance + * @returns {Object.} JSON object + */ + QueryCurrentPlanResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryCurrentPlanResponse; + })(); + + v1beta1.QueryAppliedPlanRequest = (function() { + + /** + * Properties of a QueryAppliedPlanRequest. + * @memberof cosmos.upgrade.v1beta1 + * @interface IQueryAppliedPlanRequest + * @property {string|null} [name] QueryAppliedPlanRequest name + */ + + /** + * Constructs a new QueryAppliedPlanRequest. + * @memberof cosmos.upgrade.v1beta1 + * @classdesc Represents a QueryAppliedPlanRequest. + * @implements IQueryAppliedPlanRequest + * @constructor + * @param {cosmos.upgrade.v1beta1.IQueryAppliedPlanRequest=} [properties] Properties to set + */ + function QueryAppliedPlanRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryAppliedPlanRequest name. + * @member {string} name + * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanRequest + * @instance + */ + QueryAppliedPlanRequest.prototype.name = ""; + + /** + * Encodes the specified QueryAppliedPlanRequest message. Does not implicitly {@link cosmos.upgrade.v1beta1.QueryAppliedPlanRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanRequest + * @static + * @param {cosmos.upgrade.v1beta1.IQueryAppliedPlanRequest} message QueryAppliedPlanRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryAppliedPlanRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified QueryAppliedPlanRequest message, length delimited. Does not implicitly {@link cosmos.upgrade.v1beta1.QueryAppliedPlanRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanRequest + * @static + * @param {cosmos.upgrade.v1beta1.IQueryAppliedPlanRequest} message QueryAppliedPlanRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryAppliedPlanRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryAppliedPlanRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.upgrade.v1beta1.QueryAppliedPlanRequest} QueryAppliedPlanRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryAppliedPlanRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.upgrade.v1beta1.QueryAppliedPlanRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryAppliedPlanRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.upgrade.v1beta1.QueryAppliedPlanRequest} QueryAppliedPlanRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryAppliedPlanRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryAppliedPlanRequest message. + * @function verify + * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryAppliedPlanRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a QueryAppliedPlanRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.upgrade.v1beta1.QueryAppliedPlanRequest} QueryAppliedPlanRequest + */ + QueryAppliedPlanRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.upgrade.v1beta1.QueryAppliedPlanRequest) + return object; + let message = new $root.cosmos.upgrade.v1beta1.QueryAppliedPlanRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a QueryAppliedPlanRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanRequest + * @static + * @param {cosmos.upgrade.v1beta1.QueryAppliedPlanRequest} message QueryAppliedPlanRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryAppliedPlanRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this QueryAppliedPlanRequest to JSON. + * @function toJSON + * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanRequest + * @instance + * @returns {Object.} JSON object + */ + QueryAppliedPlanRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryAppliedPlanRequest; + })(); + + v1beta1.QueryAppliedPlanResponse = (function() { + + /** + * Properties of a QueryAppliedPlanResponse. + * @memberof cosmos.upgrade.v1beta1 + * @interface IQueryAppliedPlanResponse + * @property {Long|null} [height] QueryAppliedPlanResponse height + */ + + /** + * Constructs a new QueryAppliedPlanResponse. + * @memberof cosmos.upgrade.v1beta1 + * @classdesc Represents a QueryAppliedPlanResponse. + * @implements IQueryAppliedPlanResponse + * @constructor + * @param {cosmos.upgrade.v1beta1.IQueryAppliedPlanResponse=} [properties] Properties to set + */ + function QueryAppliedPlanResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryAppliedPlanResponse height. + * @member {Long} height + * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanResponse + * @instance + */ + QueryAppliedPlanResponse.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Encodes the specified QueryAppliedPlanResponse message. Does not implicitly {@link cosmos.upgrade.v1beta1.QueryAppliedPlanResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanResponse + * @static + * @param {cosmos.upgrade.v1beta1.IQueryAppliedPlanResponse} message QueryAppliedPlanResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryAppliedPlanResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.height); + return writer; + }; + + /** + * Encodes the specified QueryAppliedPlanResponse message, length delimited. Does not implicitly {@link cosmos.upgrade.v1beta1.QueryAppliedPlanResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanResponse + * @static + * @param {cosmos.upgrade.v1beta1.IQueryAppliedPlanResponse} message QueryAppliedPlanResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryAppliedPlanResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryAppliedPlanResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.upgrade.v1beta1.QueryAppliedPlanResponse} QueryAppliedPlanResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryAppliedPlanResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.upgrade.v1beta1.QueryAppliedPlanResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryAppliedPlanResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.upgrade.v1beta1.QueryAppliedPlanResponse} QueryAppliedPlanResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryAppliedPlanResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryAppliedPlanResponse message. + * @function verify + * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryAppliedPlanResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) + return "height: integer|Long expected"; + return null; + }; + + /** + * Creates a QueryAppliedPlanResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.upgrade.v1beta1.QueryAppliedPlanResponse} QueryAppliedPlanResponse + */ + QueryAppliedPlanResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.upgrade.v1beta1.QueryAppliedPlanResponse) + return object; + let message = new $root.cosmos.upgrade.v1beta1.QueryAppliedPlanResponse(); + if (object.height != null) + if ($util.Long) + (message.height = $util.Long.fromValue(object.height)).unsigned = false; + else if (typeof object.height === "string") + message.height = parseInt(object.height, 10); + else if (typeof object.height === "number") + message.height = object.height; + else if (typeof object.height === "object") + message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a QueryAppliedPlanResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanResponse + * @static + * @param {cosmos.upgrade.v1beta1.QueryAppliedPlanResponse} message QueryAppliedPlanResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryAppliedPlanResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.height = options.longs === String ? "0" : 0; + if (message.height != null && message.hasOwnProperty("height")) + if (typeof message.height === "number") + object.height = options.longs === String ? String(message.height) : message.height; + else + object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; + return object; + }; + + /** + * Converts this QueryAppliedPlanResponse to JSON. + * @function toJSON + * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanResponse + * @instance + * @returns {Object.} JSON object + */ + QueryAppliedPlanResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryAppliedPlanResponse; + })(); + + v1beta1.QueryUpgradedConsensusStateRequest = (function() { + + /** + * Properties of a QueryUpgradedConsensusStateRequest. + * @memberof cosmos.upgrade.v1beta1 + * @interface IQueryUpgradedConsensusStateRequest + * @property {Long|null} [last_height] QueryUpgradedConsensusStateRequest last_height + */ + + /** + * Constructs a new QueryUpgradedConsensusStateRequest. + * @memberof cosmos.upgrade.v1beta1 + * @classdesc Represents a QueryUpgradedConsensusStateRequest. + * @implements IQueryUpgradedConsensusStateRequest + * @constructor + * @param {cosmos.upgrade.v1beta1.IQueryUpgradedConsensusStateRequest=} [properties] Properties to set + */ + function QueryUpgradedConsensusStateRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryUpgradedConsensusStateRequest last_height. + * @member {Long} last_height + * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest + * @instance + */ + QueryUpgradedConsensusStateRequest.prototype.last_height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Encodes the specified QueryUpgradedConsensusStateRequest message. Does not implicitly {@link cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest.verify|verify} messages. + * @function encode + * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest + * @static + * @param {cosmos.upgrade.v1beta1.IQueryUpgradedConsensusStateRequest} message QueryUpgradedConsensusStateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryUpgradedConsensusStateRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.last_height != null && Object.hasOwnProperty.call(message, "last_height")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.last_height); + return writer; + }; + + /** + * Encodes the specified QueryUpgradedConsensusStateRequest message, length delimited. Does not implicitly {@link cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest + * @static + * @param {cosmos.upgrade.v1beta1.IQueryUpgradedConsensusStateRequest} message QueryUpgradedConsensusStateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryUpgradedConsensusStateRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryUpgradedConsensusStateRequest message from the specified reader or buffer. + * @function decode + * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest} QueryUpgradedConsensusStateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryUpgradedConsensusStateRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.last_height = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryUpgradedConsensusStateRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest} QueryUpgradedConsensusStateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryUpgradedConsensusStateRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryUpgradedConsensusStateRequest message. + * @function verify + * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryUpgradedConsensusStateRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.last_height != null && message.hasOwnProperty("last_height")) + if (!$util.isInteger(message.last_height) && !(message.last_height && $util.isInteger(message.last_height.low) && $util.isInteger(message.last_height.high))) + return "last_height: integer|Long expected"; + return null; + }; + + /** + * Creates a QueryUpgradedConsensusStateRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest + * @static + * @param {Object.} object Plain object + * @returns {cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest} QueryUpgradedConsensusStateRequest + */ + QueryUpgradedConsensusStateRequest.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest) + return object; + let message = new $root.cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest(); + if (object.last_height != null) + if ($util.Long) + (message.last_height = $util.Long.fromValue(object.last_height)).unsigned = false; + else if (typeof object.last_height === "string") + message.last_height = parseInt(object.last_height, 10); + else if (typeof object.last_height === "number") + message.last_height = object.last_height; + else if (typeof object.last_height === "object") + message.last_height = new $util.LongBits(object.last_height.low >>> 0, object.last_height.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a QueryUpgradedConsensusStateRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest + * @static + * @param {cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest} message QueryUpgradedConsensusStateRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryUpgradedConsensusStateRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.last_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.last_height = options.longs === String ? "0" : 0; + if (message.last_height != null && message.hasOwnProperty("last_height")) + if (typeof message.last_height === "number") + object.last_height = options.longs === String ? String(message.last_height) : message.last_height; + else + object.last_height = options.longs === String ? $util.Long.prototype.toString.call(message.last_height) : options.longs === Number ? new $util.LongBits(message.last_height.low >>> 0, message.last_height.high >>> 0).toNumber() : message.last_height; + return object; + }; + + /** + * Converts this QueryUpgradedConsensusStateRequest to JSON. + * @function toJSON + * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest + * @instance + * @returns {Object.} JSON object + */ + QueryUpgradedConsensusStateRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryUpgradedConsensusStateRequest; + })(); + + v1beta1.QueryUpgradedConsensusStateResponse = (function() { + + /** + * Properties of a QueryUpgradedConsensusStateResponse. + * @memberof cosmos.upgrade.v1beta1 + * @interface IQueryUpgradedConsensusStateResponse + * @property {google.protobuf.IAny|null} [upgraded_consensus_state] QueryUpgradedConsensusStateResponse upgraded_consensus_state + */ + + /** + * Constructs a new QueryUpgradedConsensusStateResponse. + * @memberof cosmos.upgrade.v1beta1 + * @classdesc Represents a QueryUpgradedConsensusStateResponse. + * @implements IQueryUpgradedConsensusStateResponse + * @constructor + * @param {cosmos.upgrade.v1beta1.IQueryUpgradedConsensusStateResponse=} [properties] Properties to set + */ + function QueryUpgradedConsensusStateResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryUpgradedConsensusStateResponse upgraded_consensus_state. + * @member {google.protobuf.IAny|null|undefined} upgraded_consensus_state + * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse + * @instance + */ + QueryUpgradedConsensusStateResponse.prototype.upgraded_consensus_state = null; + + /** + * Encodes the specified QueryUpgradedConsensusStateResponse message. Does not implicitly {@link cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse + * @static + * @param {cosmos.upgrade.v1beta1.IQueryUpgradedConsensusStateResponse} message QueryUpgradedConsensusStateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryUpgradedConsensusStateResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.upgraded_consensus_state != null && Object.hasOwnProperty.call(message, "upgraded_consensus_state")) + $root.google.protobuf.Any.encode(message.upgraded_consensus_state, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryUpgradedConsensusStateResponse message, length delimited. Does not implicitly {@link cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse + * @static + * @param {cosmos.upgrade.v1beta1.IQueryUpgradedConsensusStateResponse} message QueryUpgradedConsensusStateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryUpgradedConsensusStateResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryUpgradedConsensusStateResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse} QueryUpgradedConsensusStateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryUpgradedConsensusStateResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.upgraded_consensus_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryUpgradedConsensusStateResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse} QueryUpgradedConsensusStateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryUpgradedConsensusStateResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryUpgradedConsensusStateResponse message. + * @function verify + * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryUpgradedConsensusStateResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.upgraded_consensus_state != null && message.hasOwnProperty("upgraded_consensus_state")) { + let error = $root.google.protobuf.Any.verify(message.upgraded_consensus_state); + if (error) + return "upgraded_consensus_state." + error; + } + return null; + }; + + /** + * Creates a QueryUpgradedConsensusStateResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse} QueryUpgradedConsensusStateResponse + */ + QueryUpgradedConsensusStateResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse) + return object; + let message = new $root.cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse(); + if (object.upgraded_consensus_state != null) { + if (typeof object.upgraded_consensus_state !== "object") + throw TypeError(".cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse.upgraded_consensus_state: object expected"); + message.upgraded_consensus_state = $root.google.protobuf.Any.fromObject(object.upgraded_consensus_state); + } + return message; + }; + + /** + * Creates a plain object from a QueryUpgradedConsensusStateResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse + * @static + * @param {cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse} message QueryUpgradedConsensusStateResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryUpgradedConsensusStateResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.upgraded_consensus_state = null; + if (message.upgraded_consensus_state != null && message.hasOwnProperty("upgraded_consensus_state")) + object.upgraded_consensus_state = $root.google.protobuf.Any.toObject(message.upgraded_consensus_state, options); + return object; + }; + + /** + * Converts this QueryUpgradedConsensusStateResponse to JSON. + * @function toJSON + * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse + * @instance + * @returns {Object.} JSON object + */ + QueryUpgradedConsensusStateResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryUpgradedConsensusStateResponse; + })(); + + return v1beta1; + })(); + + return upgrade; + })(); + + cosmos.vesting = (function() { + + /** + * Namespace vesting. + * @memberof cosmos + * @namespace + */ + const vesting = {}; + + vesting.v1beta1 = (function() { + + /** + * Namespace v1beta1. + * @memberof cosmos.vesting + * @namespace + */ + const v1beta1 = {}; + + v1beta1.Msg = (function() { + + /** + * Constructs a new Msg service. + * @memberof cosmos.vesting.v1beta1 + * @classdesc Represents a Msg + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Msg(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Msg.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Msg; + + /** + * Callback as used by {@link cosmos.vesting.v1beta1.Msg#createVestingAccount}. + * @memberof cosmos.vesting.v1beta1.Msg + * @typedef CreateVestingAccountCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse} [response] MsgCreateVestingAccountResponse + */ + + /** + * Calls CreateVestingAccount. + * @function createVestingAccount + * @memberof cosmos.vesting.v1beta1.Msg + * @instance + * @param {cosmos.vesting.v1beta1.IMsgCreateVestingAccount} request MsgCreateVestingAccount message or plain object + * @param {cosmos.vesting.v1beta1.Msg.CreateVestingAccountCallback} callback Node-style callback called with the error, if any, and MsgCreateVestingAccountResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.createVestingAccount = function createVestingAccount(request, callback) { + return this.rpcCall(createVestingAccount, $root.cosmos.vesting.v1beta1.MsgCreateVestingAccount, $root.cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse, request, callback); + }, "name", { value: "CreateVestingAccount" }); + + /** + * Calls CreateVestingAccount. + * @function createVestingAccount + * @memberof cosmos.vesting.v1beta1.Msg + * @instance + * @param {cosmos.vesting.v1beta1.IMsgCreateVestingAccount} request MsgCreateVestingAccount message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Msg; + })(); + + v1beta1.MsgCreateVestingAccount = (function() { + + /** + * Properties of a MsgCreateVestingAccount. + * @memberof cosmos.vesting.v1beta1 + * @interface IMsgCreateVestingAccount + * @property {string|null} [from_address] MsgCreateVestingAccount from_address + * @property {string|null} [to_address] MsgCreateVestingAccount to_address + * @property {Array.|null} [amount] MsgCreateVestingAccount amount + * @property {Long|null} [end_time] MsgCreateVestingAccount end_time + * @property {boolean|null} [delayed] MsgCreateVestingAccount delayed + */ + + /** + * Constructs a new MsgCreateVestingAccount. + * @memberof cosmos.vesting.v1beta1 + * @classdesc Represents a MsgCreateVestingAccount. + * @implements IMsgCreateVestingAccount + * @constructor + * @param {cosmos.vesting.v1beta1.IMsgCreateVestingAccount=} [properties] Properties to set + */ + function MsgCreateVestingAccount(properties) { + this.amount = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgCreateVestingAccount from_address. + * @member {string} from_address + * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccount + * @instance + */ + MsgCreateVestingAccount.prototype.from_address = ""; + + /** + * MsgCreateVestingAccount to_address. + * @member {string} to_address + * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccount + * @instance + */ + MsgCreateVestingAccount.prototype.to_address = ""; + + /** + * MsgCreateVestingAccount amount. + * @member {Array.} amount + * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccount + * @instance + */ + MsgCreateVestingAccount.prototype.amount = $util.emptyArray; + + /** + * MsgCreateVestingAccount end_time. + * @member {Long} end_time + * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccount + * @instance + */ + MsgCreateVestingAccount.prototype.end_time = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * MsgCreateVestingAccount delayed. + * @member {boolean} delayed + * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccount + * @instance + */ + MsgCreateVestingAccount.prototype.delayed = false; + + /** + * Encodes the specified MsgCreateVestingAccount message. Does not implicitly {@link cosmos.vesting.v1beta1.MsgCreateVestingAccount.verify|verify} messages. + * @function encode + * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccount + * @static + * @param {cosmos.vesting.v1beta1.IMsgCreateVestingAccount} message MsgCreateVestingAccount message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgCreateVestingAccount.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.from_address != null && Object.hasOwnProperty.call(message, "from_address")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.from_address); + if (message.to_address != null && Object.hasOwnProperty.call(message, "to_address")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.to_address); + if (message.amount != null && message.amount.length) + for (let i = 0; i < message.amount.length; ++i) + $root.cosmos.base.v1beta1.Coin.encode(message.amount[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.end_time != null && Object.hasOwnProperty.call(message, "end_time")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.end_time); + if (message.delayed != null && Object.hasOwnProperty.call(message, "delayed")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.delayed); + return writer; + }; + + /** + * Encodes the specified MsgCreateVestingAccount message, length delimited. Does not implicitly {@link cosmos.vesting.v1beta1.MsgCreateVestingAccount.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccount + * @static + * @param {cosmos.vesting.v1beta1.IMsgCreateVestingAccount} message MsgCreateVestingAccount message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgCreateVestingAccount.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgCreateVestingAccount message from the specified reader or buffer. + * @function decode + * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccount + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.vesting.v1beta1.MsgCreateVestingAccount} MsgCreateVestingAccount + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgCreateVestingAccount.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.vesting.v1beta1.MsgCreateVestingAccount(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.from_address = reader.string(); + break; + case 2: + message.to_address = reader.string(); + break; + case 3: + if (!(message.amount && message.amount.length)) + message.amount = []; + message.amount.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); + break; + case 4: + message.end_time = reader.int64(); + break; + case 5: + message.delayed = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgCreateVestingAccount message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccount + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.vesting.v1beta1.MsgCreateVestingAccount} MsgCreateVestingAccount + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgCreateVestingAccount.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgCreateVestingAccount message. + * @function verify + * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccount + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgCreateVestingAccount.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.from_address != null && message.hasOwnProperty("from_address")) + if (!$util.isString(message.from_address)) + return "from_address: string expected"; + if (message.to_address != null && message.hasOwnProperty("to_address")) + if (!$util.isString(message.to_address)) + return "to_address: string expected"; + if (message.amount != null && message.hasOwnProperty("amount")) { + if (!Array.isArray(message.amount)) + return "amount: array expected"; + for (let i = 0; i < message.amount.length; ++i) { + let error = $root.cosmos.base.v1beta1.Coin.verify(message.amount[i]); + if (error) + return "amount." + error; + } + } + if (message.end_time != null && message.hasOwnProperty("end_time")) + if (!$util.isInteger(message.end_time) && !(message.end_time && $util.isInteger(message.end_time.low) && $util.isInteger(message.end_time.high))) + return "end_time: integer|Long expected"; + if (message.delayed != null && message.hasOwnProperty("delayed")) + if (typeof message.delayed !== "boolean") + return "delayed: boolean expected"; + return null; + }; + + /** + * Creates a MsgCreateVestingAccount message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccount + * @static + * @param {Object.} object Plain object + * @returns {cosmos.vesting.v1beta1.MsgCreateVestingAccount} MsgCreateVestingAccount + */ + MsgCreateVestingAccount.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.vesting.v1beta1.MsgCreateVestingAccount) + return object; + let message = new $root.cosmos.vesting.v1beta1.MsgCreateVestingAccount(); + if (object.from_address != null) + message.from_address = String(object.from_address); + if (object.to_address != null) + message.to_address = String(object.to_address); + if (object.amount) { + if (!Array.isArray(object.amount)) + throw TypeError(".cosmos.vesting.v1beta1.MsgCreateVestingAccount.amount: array expected"); + message.amount = []; + for (let i = 0; i < object.amount.length; ++i) { + if (typeof object.amount[i] !== "object") + throw TypeError(".cosmos.vesting.v1beta1.MsgCreateVestingAccount.amount: object expected"); + message.amount[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.amount[i]); + } + } + if (object.end_time != null) + if ($util.Long) + (message.end_time = $util.Long.fromValue(object.end_time)).unsigned = false; + else if (typeof object.end_time === "string") + message.end_time = parseInt(object.end_time, 10); + else if (typeof object.end_time === "number") + message.end_time = object.end_time; + else if (typeof object.end_time === "object") + message.end_time = new $util.LongBits(object.end_time.low >>> 0, object.end_time.high >>> 0).toNumber(); + if (object.delayed != null) + message.delayed = Boolean(object.delayed); + return message; + }; + + /** + * Creates a plain object from a MsgCreateVestingAccount message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccount + * @static + * @param {cosmos.vesting.v1beta1.MsgCreateVestingAccount} message MsgCreateVestingAccount + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgCreateVestingAccount.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.amount = []; + if (options.defaults) { + object.from_address = ""; + object.to_address = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.end_time = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.end_time = options.longs === String ? "0" : 0; + object.delayed = false; + } + if (message.from_address != null && message.hasOwnProperty("from_address")) + object.from_address = message.from_address; + if (message.to_address != null && message.hasOwnProperty("to_address")) + object.to_address = message.to_address; + if (message.amount && message.amount.length) { + object.amount = []; + for (let j = 0; j < message.amount.length; ++j) + object.amount[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.amount[j], options); + } + if (message.end_time != null && message.hasOwnProperty("end_time")) + if (typeof message.end_time === "number") + object.end_time = options.longs === String ? String(message.end_time) : message.end_time; + else + object.end_time = options.longs === String ? $util.Long.prototype.toString.call(message.end_time) : options.longs === Number ? new $util.LongBits(message.end_time.low >>> 0, message.end_time.high >>> 0).toNumber() : message.end_time; + if (message.delayed != null && message.hasOwnProperty("delayed")) + object.delayed = message.delayed; + return object; + }; + + /** + * Converts this MsgCreateVestingAccount to JSON. + * @function toJSON + * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccount + * @instance + * @returns {Object.} JSON object + */ + MsgCreateVestingAccount.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgCreateVestingAccount; + })(); + + v1beta1.MsgCreateVestingAccountResponse = (function() { + + /** + * Properties of a MsgCreateVestingAccountResponse. + * @memberof cosmos.vesting.v1beta1 + * @interface IMsgCreateVestingAccountResponse + */ + + /** + * Constructs a new MsgCreateVestingAccountResponse. + * @memberof cosmos.vesting.v1beta1 + * @classdesc Represents a MsgCreateVestingAccountResponse. + * @implements IMsgCreateVestingAccountResponse + * @constructor + * @param {cosmos.vesting.v1beta1.IMsgCreateVestingAccountResponse=} [properties] Properties to set + */ + function MsgCreateVestingAccountResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgCreateVestingAccountResponse message. Does not implicitly {@link cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse.verify|verify} messages. + * @function encode + * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse + * @static + * @param {cosmos.vesting.v1beta1.IMsgCreateVestingAccountResponse} message MsgCreateVestingAccountResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgCreateVestingAccountResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgCreateVestingAccountResponse message, length delimited. Does not implicitly {@link cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse + * @static + * @param {cosmos.vesting.v1beta1.IMsgCreateVestingAccountResponse} message MsgCreateVestingAccountResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgCreateVestingAccountResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgCreateVestingAccountResponse message from the specified reader or buffer. + * @function decode + * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse} MsgCreateVestingAccountResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgCreateVestingAccountResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgCreateVestingAccountResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse} MsgCreateVestingAccountResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgCreateVestingAccountResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgCreateVestingAccountResponse message. + * @function verify + * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgCreateVestingAccountResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgCreateVestingAccountResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse + * @static + * @param {Object.} object Plain object + * @returns {cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse} MsgCreateVestingAccountResponse + */ + MsgCreateVestingAccountResponse.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse) + return object; + return new $root.cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse(); + }; + + /** + * Creates a plain object from a MsgCreateVestingAccountResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse + * @static + * @param {cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse} message MsgCreateVestingAccountResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgCreateVestingAccountResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgCreateVestingAccountResponse to JSON. + * @function toJSON + * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse + * @instance + * @returns {Object.} JSON object + */ + MsgCreateVestingAccountResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgCreateVestingAccountResponse; + })(); + + v1beta1.BaseVestingAccount = (function() { + + /** + * Properties of a BaseVestingAccount. + * @memberof cosmos.vesting.v1beta1 + * @interface IBaseVestingAccount + * @property {cosmos.auth.v1beta1.IBaseAccount|null} [base_account] BaseVestingAccount base_account + * @property {Array.|null} [original_vesting] BaseVestingAccount original_vesting + * @property {Array.|null} [delegated_free] BaseVestingAccount delegated_free + * @property {Array.|null} [delegated_vesting] BaseVestingAccount delegated_vesting + * @property {Long|null} [end_time] BaseVestingAccount end_time + */ + + /** + * Constructs a new BaseVestingAccount. + * @memberof cosmos.vesting.v1beta1 + * @classdesc Represents a BaseVestingAccount. + * @implements IBaseVestingAccount + * @constructor + * @param {cosmos.vesting.v1beta1.IBaseVestingAccount=} [properties] Properties to set + */ + function BaseVestingAccount(properties) { + this.original_vesting = []; + this.delegated_free = []; + this.delegated_vesting = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BaseVestingAccount base_account. + * @member {cosmos.auth.v1beta1.IBaseAccount|null|undefined} base_account + * @memberof cosmos.vesting.v1beta1.BaseVestingAccount + * @instance + */ + BaseVestingAccount.prototype.base_account = null; + + /** + * BaseVestingAccount original_vesting. + * @member {Array.} original_vesting + * @memberof cosmos.vesting.v1beta1.BaseVestingAccount + * @instance + */ + BaseVestingAccount.prototype.original_vesting = $util.emptyArray; + + /** + * BaseVestingAccount delegated_free. + * @member {Array.} delegated_free + * @memberof cosmos.vesting.v1beta1.BaseVestingAccount + * @instance + */ + BaseVestingAccount.prototype.delegated_free = $util.emptyArray; + + /** + * BaseVestingAccount delegated_vesting. + * @member {Array.} delegated_vesting + * @memberof cosmos.vesting.v1beta1.BaseVestingAccount + * @instance + */ + BaseVestingAccount.prototype.delegated_vesting = $util.emptyArray; + + /** + * BaseVestingAccount end_time. + * @member {Long} end_time + * @memberof cosmos.vesting.v1beta1.BaseVestingAccount + * @instance + */ + BaseVestingAccount.prototype.end_time = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Encodes the specified BaseVestingAccount message. Does not implicitly {@link cosmos.vesting.v1beta1.BaseVestingAccount.verify|verify} messages. + * @function encode + * @memberof cosmos.vesting.v1beta1.BaseVestingAccount + * @static + * @param {cosmos.vesting.v1beta1.IBaseVestingAccount} message BaseVestingAccount message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BaseVestingAccount.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.base_account != null && Object.hasOwnProperty.call(message, "base_account")) + $root.cosmos.auth.v1beta1.BaseAccount.encode(message.base_account, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.original_vesting != null && message.original_vesting.length) + for (let i = 0; i < message.original_vesting.length; ++i) + $root.cosmos.base.v1beta1.Coin.encode(message.original_vesting[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.delegated_free != null && message.delegated_free.length) + for (let i = 0; i < message.delegated_free.length; ++i) + $root.cosmos.base.v1beta1.Coin.encode(message.delegated_free[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.delegated_vesting != null && message.delegated_vesting.length) + for (let i = 0; i < message.delegated_vesting.length; ++i) + $root.cosmos.base.v1beta1.Coin.encode(message.delegated_vesting[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.end_time != null && Object.hasOwnProperty.call(message, "end_time")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.end_time); + return writer; + }; + + /** + * Encodes the specified BaseVestingAccount message, length delimited. Does not implicitly {@link cosmos.vesting.v1beta1.BaseVestingAccount.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.vesting.v1beta1.BaseVestingAccount + * @static + * @param {cosmos.vesting.v1beta1.IBaseVestingAccount} message BaseVestingAccount message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BaseVestingAccount.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BaseVestingAccount message from the specified reader or buffer. + * @function decode + * @memberof cosmos.vesting.v1beta1.BaseVestingAccount + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.vesting.v1beta1.BaseVestingAccount} BaseVestingAccount + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BaseVestingAccount.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.vesting.v1beta1.BaseVestingAccount(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.base_account = $root.cosmos.auth.v1beta1.BaseAccount.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.original_vesting && message.original_vesting.length)) + message.original_vesting = []; + message.original_vesting.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.delegated_free && message.delegated_free.length)) + message.delegated_free = []; + message.delegated_free.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); + break; + case 4: + if (!(message.delegated_vesting && message.delegated_vesting.length)) + message.delegated_vesting = []; + message.delegated_vesting.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); + break; + case 5: + message.end_time = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BaseVestingAccount message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.vesting.v1beta1.BaseVestingAccount + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.vesting.v1beta1.BaseVestingAccount} BaseVestingAccount + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BaseVestingAccount.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BaseVestingAccount message. + * @function verify + * @memberof cosmos.vesting.v1beta1.BaseVestingAccount + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BaseVestingAccount.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.base_account != null && message.hasOwnProperty("base_account")) { + let error = $root.cosmos.auth.v1beta1.BaseAccount.verify(message.base_account); + if (error) + return "base_account." + error; + } + if (message.original_vesting != null && message.hasOwnProperty("original_vesting")) { + if (!Array.isArray(message.original_vesting)) + return "original_vesting: array expected"; + for (let i = 0; i < message.original_vesting.length; ++i) { + let error = $root.cosmos.base.v1beta1.Coin.verify(message.original_vesting[i]); + if (error) + return "original_vesting." + error; + } + } + if (message.delegated_free != null && message.hasOwnProperty("delegated_free")) { + if (!Array.isArray(message.delegated_free)) + return "delegated_free: array expected"; + for (let i = 0; i < message.delegated_free.length; ++i) { + let error = $root.cosmos.base.v1beta1.Coin.verify(message.delegated_free[i]); + if (error) + return "delegated_free." + error; + } + } + if (message.delegated_vesting != null && message.hasOwnProperty("delegated_vesting")) { + if (!Array.isArray(message.delegated_vesting)) + return "delegated_vesting: array expected"; + for (let i = 0; i < message.delegated_vesting.length; ++i) { + let error = $root.cosmos.base.v1beta1.Coin.verify(message.delegated_vesting[i]); + if (error) + return "delegated_vesting." + error; + } + } + if (message.end_time != null && message.hasOwnProperty("end_time")) + if (!$util.isInteger(message.end_time) && !(message.end_time && $util.isInteger(message.end_time.low) && $util.isInteger(message.end_time.high))) + return "end_time: integer|Long expected"; + return null; + }; + + /** + * Creates a BaseVestingAccount message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.vesting.v1beta1.BaseVestingAccount + * @static + * @param {Object.} object Plain object + * @returns {cosmos.vesting.v1beta1.BaseVestingAccount} BaseVestingAccount + */ + BaseVestingAccount.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.vesting.v1beta1.BaseVestingAccount) + return object; + let message = new $root.cosmos.vesting.v1beta1.BaseVestingAccount(); + if (object.base_account != null) { + if (typeof object.base_account !== "object") + throw TypeError(".cosmos.vesting.v1beta1.BaseVestingAccount.base_account: object expected"); + message.base_account = $root.cosmos.auth.v1beta1.BaseAccount.fromObject(object.base_account); + } + if (object.original_vesting) { + if (!Array.isArray(object.original_vesting)) + throw TypeError(".cosmos.vesting.v1beta1.BaseVestingAccount.original_vesting: array expected"); + message.original_vesting = []; + for (let i = 0; i < object.original_vesting.length; ++i) { + if (typeof object.original_vesting[i] !== "object") + throw TypeError(".cosmos.vesting.v1beta1.BaseVestingAccount.original_vesting: object expected"); + message.original_vesting[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.original_vesting[i]); + } + } + if (object.delegated_free) { + if (!Array.isArray(object.delegated_free)) + throw TypeError(".cosmos.vesting.v1beta1.BaseVestingAccount.delegated_free: array expected"); + message.delegated_free = []; + for (let i = 0; i < object.delegated_free.length; ++i) { + if (typeof object.delegated_free[i] !== "object") + throw TypeError(".cosmos.vesting.v1beta1.BaseVestingAccount.delegated_free: object expected"); + message.delegated_free[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.delegated_free[i]); + } + } + if (object.delegated_vesting) { + if (!Array.isArray(object.delegated_vesting)) + throw TypeError(".cosmos.vesting.v1beta1.BaseVestingAccount.delegated_vesting: array expected"); + message.delegated_vesting = []; + for (let i = 0; i < object.delegated_vesting.length; ++i) { + if (typeof object.delegated_vesting[i] !== "object") + throw TypeError(".cosmos.vesting.v1beta1.BaseVestingAccount.delegated_vesting: object expected"); + message.delegated_vesting[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.delegated_vesting[i]); + } + } + if (object.end_time != null) + if ($util.Long) + (message.end_time = $util.Long.fromValue(object.end_time)).unsigned = false; + else if (typeof object.end_time === "string") + message.end_time = parseInt(object.end_time, 10); + else if (typeof object.end_time === "number") + message.end_time = object.end_time; + else if (typeof object.end_time === "object") + message.end_time = new $util.LongBits(object.end_time.low >>> 0, object.end_time.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a BaseVestingAccount message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.vesting.v1beta1.BaseVestingAccount + * @static + * @param {cosmos.vesting.v1beta1.BaseVestingAccount} message BaseVestingAccount + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BaseVestingAccount.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) { + object.original_vesting = []; + object.delegated_free = []; + object.delegated_vesting = []; + } + if (options.defaults) { + object.base_account = null; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.end_time = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.end_time = options.longs === String ? "0" : 0; + } + if (message.base_account != null && message.hasOwnProperty("base_account")) + object.base_account = $root.cosmos.auth.v1beta1.BaseAccount.toObject(message.base_account, options); + if (message.original_vesting && message.original_vesting.length) { + object.original_vesting = []; + for (let j = 0; j < message.original_vesting.length; ++j) + object.original_vesting[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.original_vesting[j], options); + } + if (message.delegated_free && message.delegated_free.length) { + object.delegated_free = []; + for (let j = 0; j < message.delegated_free.length; ++j) + object.delegated_free[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.delegated_free[j], options); + } + if (message.delegated_vesting && message.delegated_vesting.length) { + object.delegated_vesting = []; + for (let j = 0; j < message.delegated_vesting.length; ++j) + object.delegated_vesting[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.delegated_vesting[j], options); + } + if (message.end_time != null && message.hasOwnProperty("end_time")) + if (typeof message.end_time === "number") + object.end_time = options.longs === String ? String(message.end_time) : message.end_time; + else + object.end_time = options.longs === String ? $util.Long.prototype.toString.call(message.end_time) : options.longs === Number ? new $util.LongBits(message.end_time.low >>> 0, message.end_time.high >>> 0).toNumber() : message.end_time; + return object; + }; + + /** + * Converts this BaseVestingAccount to JSON. + * @function toJSON + * @memberof cosmos.vesting.v1beta1.BaseVestingAccount + * @instance + * @returns {Object.} JSON object + */ + BaseVestingAccount.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BaseVestingAccount; + })(); + + v1beta1.ContinuousVestingAccount = (function() { + + /** + * Properties of a ContinuousVestingAccount. + * @memberof cosmos.vesting.v1beta1 + * @interface IContinuousVestingAccount + * @property {cosmos.vesting.v1beta1.IBaseVestingAccount|null} [base_vesting_account] ContinuousVestingAccount base_vesting_account + * @property {Long|null} [start_time] ContinuousVestingAccount start_time + */ + + /** + * Constructs a new ContinuousVestingAccount. + * @memberof cosmos.vesting.v1beta1 + * @classdesc Represents a ContinuousVestingAccount. + * @implements IContinuousVestingAccount + * @constructor + * @param {cosmos.vesting.v1beta1.IContinuousVestingAccount=} [properties] Properties to set + */ + function ContinuousVestingAccount(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ContinuousVestingAccount base_vesting_account. + * @member {cosmos.vesting.v1beta1.IBaseVestingAccount|null|undefined} base_vesting_account + * @memberof cosmos.vesting.v1beta1.ContinuousVestingAccount + * @instance + */ + ContinuousVestingAccount.prototype.base_vesting_account = null; + + /** + * ContinuousVestingAccount start_time. + * @member {Long} start_time + * @memberof cosmos.vesting.v1beta1.ContinuousVestingAccount + * @instance + */ + ContinuousVestingAccount.prototype.start_time = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Encodes the specified ContinuousVestingAccount message. Does not implicitly {@link cosmos.vesting.v1beta1.ContinuousVestingAccount.verify|verify} messages. + * @function encode + * @memberof cosmos.vesting.v1beta1.ContinuousVestingAccount + * @static + * @param {cosmos.vesting.v1beta1.IContinuousVestingAccount} message ContinuousVestingAccount message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ContinuousVestingAccount.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.base_vesting_account != null && Object.hasOwnProperty.call(message, "base_vesting_account")) + $root.cosmos.vesting.v1beta1.BaseVestingAccount.encode(message.base_vesting_account, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.start_time != null && Object.hasOwnProperty.call(message, "start_time")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.start_time); + return writer; + }; + + /** + * Encodes the specified ContinuousVestingAccount message, length delimited. Does not implicitly {@link cosmos.vesting.v1beta1.ContinuousVestingAccount.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.vesting.v1beta1.ContinuousVestingAccount + * @static + * @param {cosmos.vesting.v1beta1.IContinuousVestingAccount} message ContinuousVestingAccount message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ContinuousVestingAccount.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ContinuousVestingAccount message from the specified reader or buffer. + * @function decode + * @memberof cosmos.vesting.v1beta1.ContinuousVestingAccount + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.vesting.v1beta1.ContinuousVestingAccount} ContinuousVestingAccount + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ContinuousVestingAccount.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.vesting.v1beta1.ContinuousVestingAccount(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.base_vesting_account = $root.cosmos.vesting.v1beta1.BaseVestingAccount.decode(reader, reader.uint32()); + break; + case 2: + message.start_time = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ContinuousVestingAccount message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.vesting.v1beta1.ContinuousVestingAccount + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.vesting.v1beta1.ContinuousVestingAccount} ContinuousVestingAccount + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ContinuousVestingAccount.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ContinuousVestingAccount message. + * @function verify + * @memberof cosmos.vesting.v1beta1.ContinuousVestingAccount + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ContinuousVestingAccount.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.base_vesting_account != null && message.hasOwnProperty("base_vesting_account")) { + let error = $root.cosmos.vesting.v1beta1.BaseVestingAccount.verify(message.base_vesting_account); + if (error) + return "base_vesting_account." + error; + } + if (message.start_time != null && message.hasOwnProperty("start_time")) + if (!$util.isInteger(message.start_time) && !(message.start_time && $util.isInteger(message.start_time.low) && $util.isInteger(message.start_time.high))) + return "start_time: integer|Long expected"; + return null; + }; + + /** + * Creates a ContinuousVestingAccount message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.vesting.v1beta1.ContinuousVestingAccount + * @static + * @param {Object.} object Plain object + * @returns {cosmos.vesting.v1beta1.ContinuousVestingAccount} ContinuousVestingAccount + */ + ContinuousVestingAccount.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.vesting.v1beta1.ContinuousVestingAccount) + return object; + let message = new $root.cosmos.vesting.v1beta1.ContinuousVestingAccount(); + if (object.base_vesting_account != null) { + if (typeof object.base_vesting_account !== "object") + throw TypeError(".cosmos.vesting.v1beta1.ContinuousVestingAccount.base_vesting_account: object expected"); + message.base_vesting_account = $root.cosmos.vesting.v1beta1.BaseVestingAccount.fromObject(object.base_vesting_account); + } + if (object.start_time != null) + if ($util.Long) + (message.start_time = $util.Long.fromValue(object.start_time)).unsigned = false; + else if (typeof object.start_time === "string") + message.start_time = parseInt(object.start_time, 10); + else if (typeof object.start_time === "number") + message.start_time = object.start_time; + else if (typeof object.start_time === "object") + message.start_time = new $util.LongBits(object.start_time.low >>> 0, object.start_time.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a ContinuousVestingAccount message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.vesting.v1beta1.ContinuousVestingAccount + * @static + * @param {cosmos.vesting.v1beta1.ContinuousVestingAccount} message ContinuousVestingAccount + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ContinuousVestingAccount.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.base_vesting_account = null; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.start_time = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.start_time = options.longs === String ? "0" : 0; + } + if (message.base_vesting_account != null && message.hasOwnProperty("base_vesting_account")) + object.base_vesting_account = $root.cosmos.vesting.v1beta1.BaseVestingAccount.toObject(message.base_vesting_account, options); + if (message.start_time != null && message.hasOwnProperty("start_time")) + if (typeof message.start_time === "number") + object.start_time = options.longs === String ? String(message.start_time) : message.start_time; + else + object.start_time = options.longs === String ? $util.Long.prototype.toString.call(message.start_time) : options.longs === Number ? new $util.LongBits(message.start_time.low >>> 0, message.start_time.high >>> 0).toNumber() : message.start_time; + return object; + }; + + /** + * Converts this ContinuousVestingAccount to JSON. + * @function toJSON + * @memberof cosmos.vesting.v1beta1.ContinuousVestingAccount + * @instance + * @returns {Object.} JSON object + */ + ContinuousVestingAccount.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ContinuousVestingAccount; + })(); + + v1beta1.DelayedVestingAccount = (function() { + + /** + * Properties of a DelayedVestingAccount. + * @memberof cosmos.vesting.v1beta1 + * @interface IDelayedVestingAccount + * @property {cosmos.vesting.v1beta1.IBaseVestingAccount|null} [base_vesting_account] DelayedVestingAccount base_vesting_account + */ + + /** + * Constructs a new DelayedVestingAccount. + * @memberof cosmos.vesting.v1beta1 + * @classdesc Represents a DelayedVestingAccount. + * @implements IDelayedVestingAccount + * @constructor + * @param {cosmos.vesting.v1beta1.IDelayedVestingAccount=} [properties] Properties to set + */ + function DelayedVestingAccount(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DelayedVestingAccount base_vesting_account. + * @member {cosmos.vesting.v1beta1.IBaseVestingAccount|null|undefined} base_vesting_account + * @memberof cosmos.vesting.v1beta1.DelayedVestingAccount + * @instance + */ + DelayedVestingAccount.prototype.base_vesting_account = null; + + /** + * Encodes the specified DelayedVestingAccount message. Does not implicitly {@link cosmos.vesting.v1beta1.DelayedVestingAccount.verify|verify} messages. + * @function encode + * @memberof cosmos.vesting.v1beta1.DelayedVestingAccount + * @static + * @param {cosmos.vesting.v1beta1.IDelayedVestingAccount} message DelayedVestingAccount message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DelayedVestingAccount.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.base_vesting_account != null && Object.hasOwnProperty.call(message, "base_vesting_account")) + $root.cosmos.vesting.v1beta1.BaseVestingAccount.encode(message.base_vesting_account, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DelayedVestingAccount message, length delimited. Does not implicitly {@link cosmos.vesting.v1beta1.DelayedVestingAccount.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.vesting.v1beta1.DelayedVestingAccount + * @static + * @param {cosmos.vesting.v1beta1.IDelayedVestingAccount} message DelayedVestingAccount message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DelayedVestingAccount.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DelayedVestingAccount message from the specified reader or buffer. + * @function decode + * @memberof cosmos.vesting.v1beta1.DelayedVestingAccount + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.vesting.v1beta1.DelayedVestingAccount} DelayedVestingAccount + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DelayedVestingAccount.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.vesting.v1beta1.DelayedVestingAccount(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.base_vesting_account = $root.cosmos.vesting.v1beta1.BaseVestingAccount.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DelayedVestingAccount message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.vesting.v1beta1.DelayedVestingAccount + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.vesting.v1beta1.DelayedVestingAccount} DelayedVestingAccount + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DelayedVestingAccount.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DelayedVestingAccount message. + * @function verify + * @memberof cosmos.vesting.v1beta1.DelayedVestingAccount + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DelayedVestingAccount.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.base_vesting_account != null && message.hasOwnProperty("base_vesting_account")) { + let error = $root.cosmos.vesting.v1beta1.BaseVestingAccount.verify(message.base_vesting_account); + if (error) + return "base_vesting_account." + error; + } + return null; + }; + + /** + * Creates a DelayedVestingAccount message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.vesting.v1beta1.DelayedVestingAccount + * @static + * @param {Object.} object Plain object + * @returns {cosmos.vesting.v1beta1.DelayedVestingAccount} DelayedVestingAccount + */ + DelayedVestingAccount.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.vesting.v1beta1.DelayedVestingAccount) + return object; + let message = new $root.cosmos.vesting.v1beta1.DelayedVestingAccount(); + if (object.base_vesting_account != null) { + if (typeof object.base_vesting_account !== "object") + throw TypeError(".cosmos.vesting.v1beta1.DelayedVestingAccount.base_vesting_account: object expected"); + message.base_vesting_account = $root.cosmos.vesting.v1beta1.BaseVestingAccount.fromObject(object.base_vesting_account); + } + return message; + }; + + /** + * Creates a plain object from a DelayedVestingAccount message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.vesting.v1beta1.DelayedVestingAccount + * @static + * @param {cosmos.vesting.v1beta1.DelayedVestingAccount} message DelayedVestingAccount + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DelayedVestingAccount.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.base_vesting_account = null; + if (message.base_vesting_account != null && message.hasOwnProperty("base_vesting_account")) + object.base_vesting_account = $root.cosmos.vesting.v1beta1.BaseVestingAccount.toObject(message.base_vesting_account, options); + return object; + }; + + /** + * Converts this DelayedVestingAccount to JSON. + * @function toJSON + * @memberof cosmos.vesting.v1beta1.DelayedVestingAccount + * @instance + * @returns {Object.} JSON object + */ + DelayedVestingAccount.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DelayedVestingAccount; + })(); + + v1beta1.Period = (function() { + + /** + * Properties of a Period. + * @memberof cosmos.vesting.v1beta1 + * @interface IPeriod + * @property {Long|null} [length] Period length + * @property {Array.|null} [amount] Period amount + */ + + /** + * Constructs a new Period. + * @memberof cosmos.vesting.v1beta1 + * @classdesc Represents a Period. + * @implements IPeriod + * @constructor + * @param {cosmos.vesting.v1beta1.IPeriod=} [properties] Properties to set + */ + function Period(properties) { + this.amount = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Period length. + * @member {Long} length + * @memberof cosmos.vesting.v1beta1.Period + * @instance + */ + Period.prototype.length = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Period amount. + * @member {Array.} amount + * @memberof cosmos.vesting.v1beta1.Period + * @instance + */ + Period.prototype.amount = $util.emptyArray; + + /** + * Encodes the specified Period message. Does not implicitly {@link cosmos.vesting.v1beta1.Period.verify|verify} messages. + * @function encode + * @memberof cosmos.vesting.v1beta1.Period + * @static + * @param {cosmos.vesting.v1beta1.IPeriod} message Period message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Period.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.length != null && Object.hasOwnProperty.call(message, "length")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.length); + if (message.amount != null && message.amount.length) + for (let i = 0; i < message.amount.length; ++i) + $root.cosmos.base.v1beta1.Coin.encode(message.amount[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Period message, length delimited. Does not implicitly {@link cosmos.vesting.v1beta1.Period.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.vesting.v1beta1.Period + * @static + * @param {cosmos.vesting.v1beta1.IPeriod} message Period message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Period.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Period message from the specified reader or buffer. + * @function decode + * @memberof cosmos.vesting.v1beta1.Period + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.vesting.v1beta1.Period} Period + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Period.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.vesting.v1beta1.Period(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.length = reader.int64(); + break; + case 2: + if (!(message.amount && message.amount.length)) + message.amount = []; + message.amount.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Period message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.vesting.v1beta1.Period + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.vesting.v1beta1.Period} Period + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Period.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Period message. + * @function verify + * @memberof cosmos.vesting.v1beta1.Period + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Period.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.length != null && message.hasOwnProperty("length")) + if (!$util.isInteger(message.length) && !(message.length && $util.isInteger(message.length.low) && $util.isInteger(message.length.high))) + return "length: integer|Long expected"; + if (message.amount != null && message.hasOwnProperty("amount")) { + if (!Array.isArray(message.amount)) + return "amount: array expected"; + for (let i = 0; i < message.amount.length; ++i) { + let error = $root.cosmos.base.v1beta1.Coin.verify(message.amount[i]); + if (error) + return "amount." + error; + } + } + return null; + }; + + /** + * Creates a Period message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.vesting.v1beta1.Period + * @static + * @param {Object.} object Plain object + * @returns {cosmos.vesting.v1beta1.Period} Period + */ + Period.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.vesting.v1beta1.Period) + return object; + let message = new $root.cosmos.vesting.v1beta1.Period(); + if (object.length != null) + if ($util.Long) + (message.length = $util.Long.fromValue(object.length)).unsigned = false; + else if (typeof object.length === "string") + message.length = parseInt(object.length, 10); + else if (typeof object.length === "number") + message.length = object.length; + else if (typeof object.length === "object") + message.length = new $util.LongBits(object.length.low >>> 0, object.length.high >>> 0).toNumber(); + if (object.amount) { + if (!Array.isArray(object.amount)) + throw TypeError(".cosmos.vesting.v1beta1.Period.amount: array expected"); + message.amount = []; + for (let i = 0; i < object.amount.length; ++i) { + if (typeof object.amount[i] !== "object") + throw TypeError(".cosmos.vesting.v1beta1.Period.amount: object expected"); + message.amount[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.amount[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Period message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.vesting.v1beta1.Period + * @static + * @param {cosmos.vesting.v1beta1.Period} message Period + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Period.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.amount = []; + if (options.defaults) + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.length = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.length = options.longs === String ? "0" : 0; + if (message.length != null && message.hasOwnProperty("length")) + if (typeof message.length === "number") + object.length = options.longs === String ? String(message.length) : message.length; + else + object.length = options.longs === String ? $util.Long.prototype.toString.call(message.length) : options.longs === Number ? new $util.LongBits(message.length.low >>> 0, message.length.high >>> 0).toNumber() : message.length; + if (message.amount && message.amount.length) { + object.amount = []; + for (let j = 0; j < message.amount.length; ++j) + object.amount[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.amount[j], options); + } + return object; + }; + + /** + * Converts this Period to JSON. + * @function toJSON + * @memberof cosmos.vesting.v1beta1.Period + * @instance + * @returns {Object.} JSON object + */ + Period.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Period; + })(); + + v1beta1.PeriodicVestingAccount = (function() { + + /** + * Properties of a PeriodicVestingAccount. + * @memberof cosmos.vesting.v1beta1 + * @interface IPeriodicVestingAccount + * @property {cosmos.vesting.v1beta1.IBaseVestingAccount|null} [base_vesting_account] PeriodicVestingAccount base_vesting_account + * @property {Long|null} [start_time] PeriodicVestingAccount start_time + * @property {Array.|null} [vesting_periods] PeriodicVestingAccount vesting_periods + */ + + /** + * Constructs a new PeriodicVestingAccount. + * @memberof cosmos.vesting.v1beta1 + * @classdesc Represents a PeriodicVestingAccount. + * @implements IPeriodicVestingAccount + * @constructor + * @param {cosmos.vesting.v1beta1.IPeriodicVestingAccount=} [properties] Properties to set + */ + function PeriodicVestingAccount(properties) { + this.vesting_periods = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PeriodicVestingAccount base_vesting_account. + * @member {cosmos.vesting.v1beta1.IBaseVestingAccount|null|undefined} base_vesting_account + * @memberof cosmos.vesting.v1beta1.PeriodicVestingAccount + * @instance + */ + PeriodicVestingAccount.prototype.base_vesting_account = null; + + /** + * PeriodicVestingAccount start_time. + * @member {Long} start_time + * @memberof cosmos.vesting.v1beta1.PeriodicVestingAccount + * @instance + */ + PeriodicVestingAccount.prototype.start_time = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * PeriodicVestingAccount vesting_periods. + * @member {Array.} vesting_periods + * @memberof cosmos.vesting.v1beta1.PeriodicVestingAccount + * @instance + */ + PeriodicVestingAccount.prototype.vesting_periods = $util.emptyArray; + + /** + * Encodes the specified PeriodicVestingAccount message. Does not implicitly {@link cosmos.vesting.v1beta1.PeriodicVestingAccount.verify|verify} messages. + * @function encode + * @memberof cosmos.vesting.v1beta1.PeriodicVestingAccount + * @static + * @param {cosmos.vesting.v1beta1.IPeriodicVestingAccount} message PeriodicVestingAccount message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PeriodicVestingAccount.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.base_vesting_account != null && Object.hasOwnProperty.call(message, "base_vesting_account")) + $root.cosmos.vesting.v1beta1.BaseVestingAccount.encode(message.base_vesting_account, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.start_time != null && Object.hasOwnProperty.call(message, "start_time")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.start_time); + if (message.vesting_periods != null && message.vesting_periods.length) + for (let i = 0; i < message.vesting_periods.length; ++i) + $root.cosmos.vesting.v1beta1.Period.encode(message.vesting_periods[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PeriodicVestingAccount message, length delimited. Does not implicitly {@link cosmos.vesting.v1beta1.PeriodicVestingAccount.verify|verify} messages. + * @function encodeDelimited + * @memberof cosmos.vesting.v1beta1.PeriodicVestingAccount + * @static + * @param {cosmos.vesting.v1beta1.IPeriodicVestingAccount} message PeriodicVestingAccount message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PeriodicVestingAccount.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PeriodicVestingAccount message from the specified reader or buffer. + * @function decode + * @memberof cosmos.vesting.v1beta1.PeriodicVestingAccount + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cosmos.vesting.v1beta1.PeriodicVestingAccount} PeriodicVestingAccount + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PeriodicVestingAccount.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.vesting.v1beta1.PeriodicVestingAccount(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.base_vesting_account = $root.cosmos.vesting.v1beta1.BaseVestingAccount.decode(reader, reader.uint32()); + break; + case 2: + message.start_time = reader.int64(); + break; + case 3: + if (!(message.vesting_periods && message.vesting_periods.length)) + message.vesting_periods = []; + message.vesting_periods.push($root.cosmos.vesting.v1beta1.Period.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PeriodicVestingAccount message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cosmos.vesting.v1beta1.PeriodicVestingAccount + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cosmos.vesting.v1beta1.PeriodicVestingAccount} PeriodicVestingAccount + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PeriodicVestingAccount.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PeriodicVestingAccount message. + * @function verify + * @memberof cosmos.vesting.v1beta1.PeriodicVestingAccount + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PeriodicVestingAccount.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.base_vesting_account != null && message.hasOwnProperty("base_vesting_account")) { + let error = $root.cosmos.vesting.v1beta1.BaseVestingAccount.verify(message.base_vesting_account); + if (error) + return "base_vesting_account." + error; + } + if (message.start_time != null && message.hasOwnProperty("start_time")) + if (!$util.isInteger(message.start_time) && !(message.start_time && $util.isInteger(message.start_time.low) && $util.isInteger(message.start_time.high))) + return "start_time: integer|Long expected"; + if (message.vesting_periods != null && message.hasOwnProperty("vesting_periods")) { + if (!Array.isArray(message.vesting_periods)) + return "vesting_periods: array expected"; + for (let i = 0; i < message.vesting_periods.length; ++i) { + let error = $root.cosmos.vesting.v1beta1.Period.verify(message.vesting_periods[i]); + if (error) + return "vesting_periods." + error; + } + } + return null; + }; + + /** + * Creates a PeriodicVestingAccount message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cosmos.vesting.v1beta1.PeriodicVestingAccount + * @static + * @param {Object.} object Plain object + * @returns {cosmos.vesting.v1beta1.PeriodicVestingAccount} PeriodicVestingAccount + */ + PeriodicVestingAccount.fromObject = function fromObject(object) { + if (object instanceof $root.cosmos.vesting.v1beta1.PeriodicVestingAccount) + return object; + let message = new $root.cosmos.vesting.v1beta1.PeriodicVestingAccount(); + if (object.base_vesting_account != null) { + if (typeof object.base_vesting_account !== "object") + throw TypeError(".cosmos.vesting.v1beta1.PeriodicVestingAccount.base_vesting_account: object expected"); + message.base_vesting_account = $root.cosmos.vesting.v1beta1.BaseVestingAccount.fromObject(object.base_vesting_account); + } + if (object.start_time != null) + if ($util.Long) + (message.start_time = $util.Long.fromValue(object.start_time)).unsigned = false; + else if (typeof object.start_time === "string") + message.start_time = parseInt(object.start_time, 10); + else if (typeof object.start_time === "number") + message.start_time = object.start_time; + else if (typeof object.start_time === "object") + message.start_time = new $util.LongBits(object.start_time.low >>> 0, object.start_time.high >>> 0).toNumber(); + if (object.vesting_periods) { + if (!Array.isArray(object.vesting_periods)) + throw TypeError(".cosmos.vesting.v1beta1.PeriodicVestingAccount.vesting_periods: array expected"); + message.vesting_periods = []; + for (let i = 0; i < object.vesting_periods.length; ++i) { + if (typeof object.vesting_periods[i] !== "object") + throw TypeError(".cosmos.vesting.v1beta1.PeriodicVestingAccount.vesting_periods: object expected"); + message.vesting_periods[i] = $root.cosmos.vesting.v1beta1.Period.fromObject(object.vesting_periods[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a PeriodicVestingAccount message. Also converts values to other types if specified. + * @function toObject + * @memberof cosmos.vesting.v1beta1.PeriodicVestingAccount + * @static + * @param {cosmos.vesting.v1beta1.PeriodicVestingAccount} message PeriodicVestingAccount + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PeriodicVestingAccount.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.vesting_periods = []; + if (options.defaults) { + object.base_vesting_account = null; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.start_time = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.start_time = options.longs === String ? "0" : 0; + } + if (message.base_vesting_account != null && message.hasOwnProperty("base_vesting_account")) + object.base_vesting_account = $root.cosmos.vesting.v1beta1.BaseVestingAccount.toObject(message.base_vesting_account, options); + if (message.start_time != null && message.hasOwnProperty("start_time")) + if (typeof message.start_time === "number") + object.start_time = options.longs === String ? String(message.start_time) : message.start_time; + else + object.start_time = options.longs === String ? $util.Long.prototype.toString.call(message.start_time) : options.longs === Number ? new $util.LongBits(message.start_time.low >>> 0, message.start_time.high >>> 0).toNumber() : message.start_time; + if (message.vesting_periods && message.vesting_periods.length) { + object.vesting_periods = []; + for (let j = 0; j < message.vesting_periods.length; ++j) + object.vesting_periods[j] = $root.cosmos.vesting.v1beta1.Period.toObject(message.vesting_periods[j], options); + } + return object; + }; + + /** + * Converts this PeriodicVestingAccount to JSON. + * @function toJSON + * @memberof cosmos.vesting.v1beta1.PeriodicVestingAccount + * @instance + * @returns {Object.} JSON object + */ + PeriodicVestingAccount.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PeriodicVestingAccount; + })(); + + return v1beta1; + })(); + + return vesting; + })(); + + return cosmos; +})(); + +export const google = $root.google = (() => { + + /** + * Namespace google. + * @exports google + * @namespace + */ + const google = {}; + + google.protobuf = (function() { + + /** + * Namespace protobuf. + * @memberof google + * @namespace + */ + const protobuf = {}; + + protobuf.Any = (function() { + + /** + * Properties of an Any. + * @memberof google.protobuf + * @interface IAny + * @property {string|null} [type_url] Any type_url + * @property {Uint8Array|null} [value] Any value + */ + + /** + * Constructs a new Any. + * @memberof google.protobuf + * @classdesc Represents an Any. + * @implements IAny + * @constructor + * @param {google.protobuf.IAny=} [properties] Properties to set + */ + function Any(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Any type_url. + * @member {string} type_url + * @memberof google.protobuf.Any + * @instance + */ + Any.prototype.type_url = ""; + + /** + * Any value. + * @member {Uint8Array} value + * @memberof google.protobuf.Any + * @instance + */ + Any.prototype.value = $util.newBuffer([]); + + /** + * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.IAny} message Any message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Any.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type_url != null && Object.hasOwnProperty.call(message, "type_url")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type_url); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value); + return writer; + }; + + /** + * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.IAny} message Any message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Any.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Any message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Any + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Any} Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Any.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Any(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type_url = reader.string(); + break; + case 2: + message.value = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Any message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Any + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Any} Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Any.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Any message. + * @function verify + * @memberof google.protobuf.Any + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Any.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type_url != null && message.hasOwnProperty("type_url")) + if (!$util.isString(message.type_url)) + return "type_url: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) + return "value: buffer expected"; + return null; + }; + + /** + * Creates an Any message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Any + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Any} Any + */ + Any.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Any) + return object; + let message = new $root.google.protobuf.Any(); + if (object.type_url != null) + message.type_url = String(object.type_url); + if (object.value != null) + if (typeof object.value === "string") + $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); + else if (object.value.length) + message.value = object.value; + return message; + }; + + /** + * Creates a plain object from an Any message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.Any} message Any + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Any.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.type_url = ""; + if (options.bytes === String) + object.value = ""; + else { + object.value = []; + if (options.bytes !== Array) + object.value = $util.newBuffer(object.value); + } + } + if (message.type_url != null && message.hasOwnProperty("type_url")) + object.type_url = message.type_url; + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; + return object; + }; + + /** + * Converts this Any to JSON. + * @function toJSON + * @memberof google.protobuf.Any + * @instance + * @returns {Object.} JSON object + */ + Any.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Any; + })(); + + protobuf.FileDescriptorSet = (function() { + + /** + * Properties of a FileDescriptorSet. + * @memberof google.protobuf + * @interface IFileDescriptorSet + * @property {Array.|null} [file] FileDescriptorSet file + */ + + /** + * Constructs a new FileDescriptorSet. + * @memberof google.protobuf + * @classdesc Represents a FileDescriptorSet. + * @implements IFileDescriptorSet + * @constructor + * @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set + */ + function FileDescriptorSet(properties) { + this.file = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileDescriptorSet file. + * @member {Array.} file + * @memberof google.protobuf.FileDescriptorSet + * @instance + */ + FileDescriptorSet.prototype.file = $util.emptyArray; + + /** + * Encodes the specified FileDescriptorSet message. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorSet.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.file != null && message.file.length) + for (let i = 0; i < message.file.length; ++i) + $root.google.protobuf.FileDescriptorProto.encode(message.file[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FileDescriptorSet message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorSet.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorSet.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorSet(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.file && message.file.length)) + message.file = []; + message.file.push($root.google.protobuf.FileDescriptorProto.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorSet.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileDescriptorSet message. + * @function verify + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileDescriptorSet.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.file != null && message.hasOwnProperty("file")) { + if (!Array.isArray(message.file)) + return "file: array expected"; + for (let i = 0; i < message.file.length; ++i) { + let error = $root.google.protobuf.FileDescriptorProto.verify(message.file[i]); + if (error) + return "file." + error; + } + } + return null; + }; + + /** + * Creates a FileDescriptorSet message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + */ + FileDescriptorSet.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileDescriptorSet) + return object; + let message = new $root.google.protobuf.FileDescriptorSet(); + if (object.file) { + if (!Array.isArray(object.file)) + throw TypeError(".google.protobuf.FileDescriptorSet.file: array expected"); + message.file = []; + for (let i = 0; i < object.file.length; ++i) { + if (typeof object.file[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorSet.file: object expected"); + message.file[i] = $root.google.protobuf.FileDescriptorProto.fromObject(object.file[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a FileDescriptorSet message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.FileDescriptorSet} message FileDescriptorSet + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileDescriptorSet.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.file = []; + if (message.file && message.file.length) { + object.file = []; + for (let j = 0; j < message.file.length; ++j) + object.file[j] = $root.google.protobuf.FileDescriptorProto.toObject(message.file[j], options); + } + return object; + }; + + /** + * Converts this FileDescriptorSet to JSON. + * @function toJSON + * @memberof google.protobuf.FileDescriptorSet + * @instance + * @returns {Object.} JSON object + */ + FileDescriptorSet.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FileDescriptorSet; + })(); + + protobuf.FileDescriptorProto = (function() { + + /** + * Properties of a FileDescriptorProto. + * @memberof google.protobuf + * @interface IFileDescriptorProto + * @property {string|null} [name] FileDescriptorProto name + * @property {string|null} ["package"] FileDescriptorProto package + * @property {Array.|null} [dependency] FileDescriptorProto dependency + * @property {Array.|null} [public_dependency] FileDescriptorProto public_dependency + * @property {Array.|null} [weak_dependency] FileDescriptorProto weak_dependency + * @property {Array.|null} [message_type] FileDescriptorProto message_type + * @property {Array.|null} [enum_type] FileDescriptorProto enum_type + * @property {Array.|null} [service] FileDescriptorProto service + * @property {Array.|null} [extension] FileDescriptorProto extension + * @property {google.protobuf.IFileOptions|null} [options] FileDescriptorProto options + * @property {google.protobuf.ISourceCodeInfo|null} [source_code_info] FileDescriptorProto source_code_info + * @property {string|null} [syntax] FileDescriptorProto syntax + */ + + /** + * Constructs a new FileDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a FileDescriptorProto. + * @implements IFileDescriptorProto + * @constructor + * @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set + */ + function FileDescriptorProto(properties) { + this.dependency = []; + this.public_dependency = []; + this.weak_dependency = []; + this.message_type = []; + this.enum_type = []; + this.service = []; + this.extension = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.name = ""; + + /** + * FileDescriptorProto package. + * @member {string} package + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype["package"] = ""; + + /** + * FileDescriptorProto dependency. + * @member {Array.} dependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.dependency = $util.emptyArray; + + /** + * FileDescriptorProto public_dependency. + * @member {Array.} public_dependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.public_dependency = $util.emptyArray; + + /** + * FileDescriptorProto weak_dependency. + * @member {Array.} weak_dependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.weak_dependency = $util.emptyArray; + + /** + * FileDescriptorProto message_type. + * @member {Array.} message_type + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.message_type = $util.emptyArray; + + /** + * FileDescriptorProto enum_type. + * @member {Array.} enum_type + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.enum_type = $util.emptyArray; + + /** + * FileDescriptorProto service. + * @member {Array.} service + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.service = $util.emptyArray; + + /** + * FileDescriptorProto extension. + * @member {Array.} extension + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.extension = $util.emptyArray; + + /** + * FileDescriptorProto options. + * @member {google.protobuf.IFileOptions|null|undefined} options + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.options = null; + + /** + * FileDescriptorProto source_code_info. + * @member {google.protobuf.ISourceCodeInfo|null|undefined} source_code_info + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.source_code_info = null; + + /** + * FileDescriptorProto syntax. + * @member {string} syntax + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.syntax = ""; + + /** + * Encodes the specified FileDescriptorProto message. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message["package"] != null && Object.hasOwnProperty.call(message, "package")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message["package"]); + if (message.dependency != null && message.dependency.length) + for (let i = 0; i < message.dependency.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.dependency[i]); + if (message.message_type != null && message.message_type.length) + for (let i = 0; i < message.message_type.length; ++i) + $root.google.protobuf.DescriptorProto.encode(message.message_type[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.enum_type != null && message.enum_type.length) + for (let i = 0; i < message.enum_type.length; ++i) + $root.google.protobuf.EnumDescriptorProto.encode(message.enum_type[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.service != null && message.service.length) + for (let i = 0; i < message.service.length; ++i) + $root.google.protobuf.ServiceDescriptorProto.encode(message.service[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.extension != null && message.extension.length) + for (let i = 0; i < message.extension.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.FileOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.source_code_info != null && Object.hasOwnProperty.call(message, "source_code_info")) + $root.google.protobuf.SourceCodeInfo.encode(message.source_code_info, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.public_dependency != null && message.public_dependency.length) + for (let i = 0; i < message.public_dependency.length; ++i) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.public_dependency[i]); + if (message.weak_dependency != null && message.weak_dependency.length) + for (let i = 0; i < message.weak_dependency.length; ++i) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.weak_dependency[i]); + if (message.syntax != null && Object.hasOwnProperty.call(message, "syntax")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); + return writer; + }; + + /** + * Encodes the specified FileDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorProto(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message["package"] = reader.string(); + break; + case 3: + if (!(message.dependency && message.dependency.length)) + message.dependency = []; + message.dependency.push(reader.string()); + break; + case 10: + if (!(message.public_dependency && message.public_dependency.length)) + message.public_dependency = []; + if ((tag & 7) === 2) { + let end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.public_dependency.push(reader.int32()); + } else + message.public_dependency.push(reader.int32()); + break; + case 11: + if (!(message.weak_dependency && message.weak_dependency.length)) + message.weak_dependency = []; + if ((tag & 7) === 2) { + let end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.weak_dependency.push(reader.int32()); + } else + message.weak_dependency.push(reader.int32()); + break; + case 4: + if (!(message.message_type && message.message_type.length)) + message.message_type = []; + message.message_type.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); + break; + case 5: + if (!(message.enum_type && message.enum_type.length)) + message.enum_type = []; + message.enum_type.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); + break; + case 6: + if (!(message.service && message.service.length)) + message.service = []; + message.service.push($root.google.protobuf.ServiceDescriptorProto.decode(reader, reader.uint32())); + break; + case 7: + if (!(message.extension && message.extension.length)) + message.extension = []; + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + case 8: + message.options = $root.google.protobuf.FileOptions.decode(reader, reader.uint32()); + break; + case 9: + message.source_code_info = $root.google.protobuf.SourceCodeInfo.decode(reader, reader.uint32()); + break; + case 12: + message.syntax = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileDescriptorProto message. + * @function verify + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message["package"] != null && message.hasOwnProperty("package")) + if (!$util.isString(message["package"])) + return "package: string expected"; + if (message.dependency != null && message.hasOwnProperty("dependency")) { + if (!Array.isArray(message.dependency)) + return "dependency: array expected"; + for (let i = 0; i < message.dependency.length; ++i) + if (!$util.isString(message.dependency[i])) + return "dependency: string[] expected"; + } + if (message.public_dependency != null && message.hasOwnProperty("public_dependency")) { + if (!Array.isArray(message.public_dependency)) + return "public_dependency: array expected"; + for (let i = 0; i < message.public_dependency.length; ++i) + if (!$util.isInteger(message.public_dependency[i])) + return "public_dependency: integer[] expected"; + } + if (message.weak_dependency != null && message.hasOwnProperty("weak_dependency")) { + if (!Array.isArray(message.weak_dependency)) + return "weak_dependency: array expected"; + for (let i = 0; i < message.weak_dependency.length; ++i) + if (!$util.isInteger(message.weak_dependency[i])) + return "weak_dependency: integer[] expected"; + } + if (message.message_type != null && message.hasOwnProperty("message_type")) { + if (!Array.isArray(message.message_type)) + return "message_type: array expected"; + for (let i = 0; i < message.message_type.length; ++i) { + let error = $root.google.protobuf.DescriptorProto.verify(message.message_type[i]); + if (error) + return "message_type." + error; + } + } + if (message.enum_type != null && message.hasOwnProperty("enum_type")) { + if (!Array.isArray(message.enum_type)) + return "enum_type: array expected"; + for (let i = 0; i < message.enum_type.length; ++i) { + let error = $root.google.protobuf.EnumDescriptorProto.verify(message.enum_type[i]); + if (error) + return "enum_type." + error; + } + } + if (message.service != null && message.hasOwnProperty("service")) { + if (!Array.isArray(message.service)) + return "service: array expected"; + for (let i = 0; i < message.service.length; ++i) { + let error = $root.google.protobuf.ServiceDescriptorProto.verify(message.service[i]); + if (error) + return "service." + error; + } + } + if (message.extension != null && message.hasOwnProperty("extension")) { + if (!Array.isArray(message.extension)) + return "extension: array expected"; + for (let i = 0; i < message.extension.length; ++i) { + let error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); + if (error) + return "extension." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + let error = $root.google.protobuf.FileOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.source_code_info != null && message.hasOwnProperty("source_code_info")) { + let error = $root.google.protobuf.SourceCodeInfo.verify(message.source_code_info); + if (error) + return "source_code_info." + error; + } + if (message.syntax != null && message.hasOwnProperty("syntax")) + if (!$util.isString(message.syntax)) + return "syntax: string expected"; + return null; + }; + + /** + * Creates a FileDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + */ + FileDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileDescriptorProto) + return object; + let message = new $root.google.protobuf.FileDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object["package"] != null) + message["package"] = String(object["package"]); + if (object.dependency) { + if (!Array.isArray(object.dependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.dependency: array expected"); + message.dependency = []; + for (let i = 0; i < object.dependency.length; ++i) + message.dependency[i] = String(object.dependency[i]); + } + if (object.public_dependency) { + if (!Array.isArray(object.public_dependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.public_dependency: array expected"); + message.public_dependency = []; + for (let i = 0; i < object.public_dependency.length; ++i) + message.public_dependency[i] = object.public_dependency[i] | 0; + } + if (object.weak_dependency) { + if (!Array.isArray(object.weak_dependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.weak_dependency: array expected"); + message.weak_dependency = []; + for (let i = 0; i < object.weak_dependency.length; ++i) + message.weak_dependency[i] = object.weak_dependency[i] | 0; + } + if (object.message_type) { + if (!Array.isArray(object.message_type)) + throw TypeError(".google.protobuf.FileDescriptorProto.message_type: array expected"); + message.message_type = []; + for (let i = 0; i < object.message_type.length; ++i) { + if (typeof object.message_type[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.message_type: object expected"); + message.message_type[i] = $root.google.protobuf.DescriptorProto.fromObject(object.message_type[i]); + } + } + if (object.enum_type) { + if (!Array.isArray(object.enum_type)) + throw TypeError(".google.protobuf.FileDescriptorProto.enum_type: array expected"); + message.enum_type = []; + for (let i = 0; i < object.enum_type.length; ++i) { + if (typeof object.enum_type[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.enum_type: object expected"); + message.enum_type[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enum_type[i]); + } + } + if (object.service) { + if (!Array.isArray(object.service)) + throw TypeError(".google.protobuf.FileDescriptorProto.service: array expected"); + message.service = []; + for (let i = 0; i < object.service.length; ++i) { + if (typeof object.service[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.service: object expected"); + message.service[i] = $root.google.protobuf.ServiceDescriptorProto.fromObject(object.service[i]); + } + } + if (object.extension) { + if (!Array.isArray(object.extension)) + throw TypeError(".google.protobuf.FileDescriptorProto.extension: array expected"); + message.extension = []; + for (let i = 0; i < object.extension.length; ++i) { + if (typeof object.extension[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.extension: object expected"); + message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.FileOptions.fromObject(object.options); + } + if (object.source_code_info != null) { + if (typeof object.source_code_info !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.source_code_info: object expected"); + message.source_code_info = $root.google.protobuf.SourceCodeInfo.fromObject(object.source_code_info); + } + if (object.syntax != null) + message.syntax = String(object.syntax); + return message; + }; + + /** + * Creates a plain object from a FileDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.FileDescriptorProto} message FileDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) { + object.dependency = []; + object.message_type = []; + object.enum_type = []; + object.service = []; + object.extension = []; + object.public_dependency = []; + object.weak_dependency = []; + } + if (options.defaults) { + object.name = ""; + object["package"] = ""; + object.options = null; + object.source_code_info = null; + object.syntax = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message["package"] != null && message.hasOwnProperty("package")) + object["package"] = message["package"]; + if (message.dependency && message.dependency.length) { + object.dependency = []; + for (let j = 0; j < message.dependency.length; ++j) + object.dependency[j] = message.dependency[j]; + } + if (message.message_type && message.message_type.length) { + object.message_type = []; + for (let j = 0; j < message.message_type.length; ++j) + object.message_type[j] = $root.google.protobuf.DescriptorProto.toObject(message.message_type[j], options); + } + if (message.enum_type && message.enum_type.length) { + object.enum_type = []; + for (let j = 0; j < message.enum_type.length; ++j) + object.enum_type[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enum_type[j], options); + } + if (message.service && message.service.length) { + object.service = []; + for (let j = 0; j < message.service.length; ++j) + object.service[j] = $root.google.protobuf.ServiceDescriptorProto.toObject(message.service[j], options); + } + if (message.extension && message.extension.length) { + object.extension = []; + for (let j = 0; j < message.extension.length; ++j) + object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.FileOptions.toObject(message.options, options); + if (message.source_code_info != null && message.hasOwnProperty("source_code_info")) + object.source_code_info = $root.google.protobuf.SourceCodeInfo.toObject(message.source_code_info, options); + if (message.public_dependency && message.public_dependency.length) { + object.public_dependency = []; + for (let j = 0; j < message.public_dependency.length; ++j) + object.public_dependency[j] = message.public_dependency[j]; + } + if (message.weak_dependency && message.weak_dependency.length) { + object.weak_dependency = []; + for (let j = 0; j < message.weak_dependency.length; ++j) + object.weak_dependency[j] = message.weak_dependency[j]; + } + if (message.syntax != null && message.hasOwnProperty("syntax")) + object.syntax = message.syntax; + return object; + }; + + /** + * Converts this FileDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.FileDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + FileDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FileDescriptorProto; + })(); + + protobuf.DescriptorProto = (function() { + + /** + * Properties of a DescriptorProto. + * @memberof google.protobuf + * @interface IDescriptorProto + * @property {string|null} [name] DescriptorProto name + * @property {Array.|null} [field] DescriptorProto field + * @property {Array.|null} [extension] DescriptorProto extension + * @property {Array.|null} [nested_type] DescriptorProto nested_type + * @property {Array.|null} [enum_type] DescriptorProto enum_type + * @property {Array.|null} [extension_range] DescriptorProto extension_range + * @property {Array.|null} [oneof_decl] DescriptorProto oneof_decl + * @property {google.protobuf.IMessageOptions|null} [options] DescriptorProto options + * @property {Array.|null} [reserved_range] DescriptorProto reserved_range + * @property {Array.|null} [reserved_name] DescriptorProto reserved_name + */ + + /** + * Constructs a new DescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a DescriptorProto. + * @implements IDescriptorProto + * @constructor + * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set + */ + function DescriptorProto(properties) { + this.field = []; + this.extension = []; + this.nested_type = []; + this.enum_type = []; + this.extension_range = []; + this.oneof_decl = []; + this.reserved_range = []; + this.reserved_name = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DescriptorProto name. + * @member {string} name + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.name = ""; + + /** + * DescriptorProto field. + * @member {Array.} field + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.field = $util.emptyArray; + + /** + * DescriptorProto extension. + * @member {Array.} extension + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.extension = $util.emptyArray; + + /** + * DescriptorProto nested_type. + * @member {Array.} nested_type + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.nested_type = $util.emptyArray; + + /** + * DescriptorProto enum_type. + * @member {Array.} enum_type + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.enum_type = $util.emptyArray; + + /** + * DescriptorProto extension_range. + * @member {Array.} extension_range + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.extension_range = $util.emptyArray; + + /** + * DescriptorProto oneof_decl. + * @member {Array.} oneof_decl + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.oneof_decl = $util.emptyArray; + + /** + * DescriptorProto options. + * @member {google.protobuf.IMessageOptions|null|undefined} options + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.options = null; + + /** + * DescriptorProto reserved_range. + * @member {Array.} reserved_range + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.reserved_range = $util.emptyArray; + + /** + * DescriptorProto reserved_name. + * @member {Array.} reserved_name + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.reserved_name = $util.emptyArray; + + /** + * Encodes the specified DescriptorProto message. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.field != null && message.field.length) + for (let i = 0; i < message.field.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.field[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.nested_type != null && message.nested_type.length) + for (let i = 0; i < message.nested_type.length; ++i) + $root.google.protobuf.DescriptorProto.encode(message.nested_type[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.enum_type != null && message.enum_type.length) + for (let i = 0; i < message.enum_type.length; ++i) + $root.google.protobuf.EnumDescriptorProto.encode(message.enum_type[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.extension_range != null && message.extension_range.length) + for (let i = 0; i < message.extension_range.length; ++i) + $root.google.protobuf.DescriptorProto.ExtensionRange.encode(message.extension_range[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.extension != null && message.extension.length) + for (let i = 0; i < message.extension.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.MessageOptions.encode(message.options, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.oneof_decl != null && message.oneof_decl.length) + for (let i = 0; i < message.oneof_decl.length; ++i) + $root.google.protobuf.OneofDescriptorProto.encode(message.oneof_decl[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.reserved_range != null && message.reserved_range.length) + for (let i = 0; i < message.reserved_range.length; ++i) + $root.google.protobuf.DescriptorProto.ReservedRange.encode(message.reserved_range[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.reserved_name != null && message.reserved_name.length) + for (let i = 0; i < message.reserved_name.length; ++i) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.reserved_name[i]); + return writer; + }; + + /** + * Encodes the specified DescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto} DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + if (!(message.field && message.field.length)) + message.field = []; + message.field.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + case 6: + if (!(message.extension && message.extension.length)) + message.extension = []; + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.nested_type && message.nested_type.length)) + message.nested_type = []; + message.nested_type.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); + break; + case 4: + if (!(message.enum_type && message.enum_type.length)) + message.enum_type = []; + message.enum_type.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); + break; + case 5: + if (!(message.extension_range && message.extension_range.length)) + message.extension_range = []; + message.extension_range.push($root.google.protobuf.DescriptorProto.ExtensionRange.decode(reader, reader.uint32())); + break; + case 8: + if (!(message.oneof_decl && message.oneof_decl.length)) + message.oneof_decl = []; + message.oneof_decl.push($root.google.protobuf.OneofDescriptorProto.decode(reader, reader.uint32())); + break; + case 7: + message.options = $root.google.protobuf.MessageOptions.decode(reader, reader.uint32()); + break; + case 9: + if (!(message.reserved_range && message.reserved_range.length)) + message.reserved_range = []; + message.reserved_range.push($root.google.protobuf.DescriptorProto.ReservedRange.decode(reader, reader.uint32())); + break; + case 10: + if (!(message.reserved_name && message.reserved_name.length)) + message.reserved_name = []; + message.reserved_name.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto} DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DescriptorProto message. + * @function verify + * @memberof google.protobuf.DescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.field != null && message.hasOwnProperty("field")) { + if (!Array.isArray(message.field)) + return "field: array expected"; + for (let i = 0; i < message.field.length; ++i) { + let error = $root.google.protobuf.FieldDescriptorProto.verify(message.field[i]); + if (error) + return "field." + error; + } + } + if (message.extension != null && message.hasOwnProperty("extension")) { + if (!Array.isArray(message.extension)) + return "extension: array expected"; + for (let i = 0; i < message.extension.length; ++i) { + let error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); + if (error) + return "extension." + error; + } + } + if (message.nested_type != null && message.hasOwnProperty("nested_type")) { + if (!Array.isArray(message.nested_type)) + return "nested_type: array expected"; + for (let i = 0; i < message.nested_type.length; ++i) { + let error = $root.google.protobuf.DescriptorProto.verify(message.nested_type[i]); + if (error) + return "nested_type." + error; + } + } + if (message.enum_type != null && message.hasOwnProperty("enum_type")) { + if (!Array.isArray(message.enum_type)) + return "enum_type: array expected"; + for (let i = 0; i < message.enum_type.length; ++i) { + let error = $root.google.protobuf.EnumDescriptorProto.verify(message.enum_type[i]); + if (error) + return "enum_type." + error; + } + } + if (message.extension_range != null && message.hasOwnProperty("extension_range")) { + if (!Array.isArray(message.extension_range)) + return "extension_range: array expected"; + for (let i = 0; i < message.extension_range.length; ++i) { + let error = $root.google.protobuf.DescriptorProto.ExtensionRange.verify(message.extension_range[i]); + if (error) + return "extension_range." + error; + } + } + if (message.oneof_decl != null && message.hasOwnProperty("oneof_decl")) { + if (!Array.isArray(message.oneof_decl)) + return "oneof_decl: array expected"; + for (let i = 0; i < message.oneof_decl.length; ++i) { + let error = $root.google.protobuf.OneofDescriptorProto.verify(message.oneof_decl[i]); + if (error) + return "oneof_decl." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + let error = $root.google.protobuf.MessageOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.reserved_range != null && message.hasOwnProperty("reserved_range")) { + if (!Array.isArray(message.reserved_range)) + return "reserved_range: array expected"; + for (let i = 0; i < message.reserved_range.length; ++i) { + let error = $root.google.protobuf.DescriptorProto.ReservedRange.verify(message.reserved_range[i]); + if (error) + return "reserved_range." + error; + } + } + if (message.reserved_name != null && message.hasOwnProperty("reserved_name")) { + if (!Array.isArray(message.reserved_name)) + return "reserved_name: array expected"; + for (let i = 0; i < message.reserved_name.length; ++i) + if (!$util.isString(message.reserved_name[i])) + return "reserved_name: string[] expected"; + } + return null; + }; + + /** + * Creates a DescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto} DescriptorProto + */ + DescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto) + return object; + let message = new $root.google.protobuf.DescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.field) { + if (!Array.isArray(object.field)) + throw TypeError(".google.protobuf.DescriptorProto.field: array expected"); + message.field = []; + for (let i = 0; i < object.field.length; ++i) { + if (typeof object.field[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.field: object expected"); + message.field[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.field[i]); + } + } + if (object.extension) { + if (!Array.isArray(object.extension)) + throw TypeError(".google.protobuf.DescriptorProto.extension: array expected"); + message.extension = []; + for (let i = 0; i < object.extension.length; ++i) { + if (typeof object.extension[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.extension: object expected"); + message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); + } + } + if (object.nested_type) { + if (!Array.isArray(object.nested_type)) + throw TypeError(".google.protobuf.DescriptorProto.nested_type: array expected"); + message.nested_type = []; + for (let i = 0; i < object.nested_type.length; ++i) { + if (typeof object.nested_type[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.nested_type: object expected"); + message.nested_type[i] = $root.google.protobuf.DescriptorProto.fromObject(object.nested_type[i]); + } + } + if (object.enum_type) { + if (!Array.isArray(object.enum_type)) + throw TypeError(".google.protobuf.DescriptorProto.enum_type: array expected"); + message.enum_type = []; + for (let i = 0; i < object.enum_type.length; ++i) { + if (typeof object.enum_type[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.enum_type: object expected"); + message.enum_type[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enum_type[i]); + } + } + if (object.extension_range) { + if (!Array.isArray(object.extension_range)) + throw TypeError(".google.protobuf.DescriptorProto.extension_range: array expected"); + message.extension_range = []; + for (let i = 0; i < object.extension_range.length; ++i) { + if (typeof object.extension_range[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.extension_range: object expected"); + message.extension_range[i] = $root.google.protobuf.DescriptorProto.ExtensionRange.fromObject(object.extension_range[i]); + } + } + if (object.oneof_decl) { + if (!Array.isArray(object.oneof_decl)) + throw TypeError(".google.protobuf.DescriptorProto.oneof_decl: array expected"); + message.oneof_decl = []; + for (let i = 0; i < object.oneof_decl.length; ++i) { + if (typeof object.oneof_decl[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.oneof_decl: object expected"); + message.oneof_decl[i] = $root.google.protobuf.OneofDescriptorProto.fromObject(object.oneof_decl[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.DescriptorProto.options: object expected"); + message.options = $root.google.protobuf.MessageOptions.fromObject(object.options); + } + if (object.reserved_range) { + if (!Array.isArray(object.reserved_range)) + throw TypeError(".google.protobuf.DescriptorProto.reserved_range: array expected"); + message.reserved_range = []; + for (let i = 0; i < object.reserved_range.length; ++i) { + if (typeof object.reserved_range[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.reserved_range: object expected"); + message.reserved_range[i] = $root.google.protobuf.DescriptorProto.ReservedRange.fromObject(object.reserved_range[i]); + } + } + if (object.reserved_name) { + if (!Array.isArray(object.reserved_name)) + throw TypeError(".google.protobuf.DescriptorProto.reserved_name: array expected"); + message.reserved_name = []; + for (let i = 0; i < object.reserved_name.length; ++i) + message.reserved_name[i] = String(object.reserved_name[i]); + } + return message; + }; + + /** + * Creates a plain object from a DescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.DescriptorProto} message DescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) { + object.field = []; + object.nested_type = []; + object.enum_type = []; + object.extension_range = []; + object.extension = []; + object.oneof_decl = []; + object.reserved_range = []; + object.reserved_name = []; + } + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.field && message.field.length) { + object.field = []; + for (let j = 0; j < message.field.length; ++j) + object.field[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.field[j], options); + } + if (message.nested_type && message.nested_type.length) { + object.nested_type = []; + for (let j = 0; j < message.nested_type.length; ++j) + object.nested_type[j] = $root.google.protobuf.DescriptorProto.toObject(message.nested_type[j], options); + } + if (message.enum_type && message.enum_type.length) { + object.enum_type = []; + for (let j = 0; j < message.enum_type.length; ++j) + object.enum_type[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enum_type[j], options); + } + if (message.extension_range && message.extension_range.length) { + object.extension_range = []; + for (let j = 0; j < message.extension_range.length; ++j) + object.extension_range[j] = $root.google.protobuf.DescriptorProto.ExtensionRange.toObject(message.extension_range[j], options); + } + if (message.extension && message.extension.length) { + object.extension = []; + for (let j = 0; j < message.extension.length; ++j) + object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.MessageOptions.toObject(message.options, options); + if (message.oneof_decl && message.oneof_decl.length) { + object.oneof_decl = []; + for (let j = 0; j < message.oneof_decl.length; ++j) + object.oneof_decl[j] = $root.google.protobuf.OneofDescriptorProto.toObject(message.oneof_decl[j], options); + } + if (message.reserved_range && message.reserved_range.length) { + object.reserved_range = []; + for (let j = 0; j < message.reserved_range.length; ++j) + object.reserved_range[j] = $root.google.protobuf.DescriptorProto.ReservedRange.toObject(message.reserved_range[j], options); + } + if (message.reserved_name && message.reserved_name.length) { + object.reserved_name = []; + for (let j = 0; j < message.reserved_name.length; ++j) + object.reserved_name[j] = message.reserved_name[j]; + } + return object; + }; + + /** + * Converts this DescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto + * @instance + * @returns {Object.} JSON object + */ + DescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + DescriptorProto.ExtensionRange = (function() { + + /** + * Properties of an ExtensionRange. + * @memberof google.protobuf.DescriptorProto + * @interface IExtensionRange + * @property {number|null} [start] ExtensionRange start + * @property {number|null} [end] ExtensionRange end + */ + + /** + * Constructs a new ExtensionRange. + * @memberof google.protobuf.DescriptorProto + * @classdesc Represents an ExtensionRange. + * @implements IExtensionRange + * @constructor + * @param {google.protobuf.DescriptorProto.IExtensionRange=} [properties] Properties to set + */ + function ExtensionRange(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExtensionRange start. + * @member {number} start + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.start = 0; + + /** + * ExtensionRange end. + * @member {number} end + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.end = 0; + + /** + * Encodes the specified ExtensionRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + return writer; + }; + + /** + * Encodes the specified ExtensionRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); + while (reader.pos < end) { + let 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; + }; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExtensionRange message. + * @function verify + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExtensionRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + return null; + }; + + /** + * Creates an ExtensionRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + */ + ExtensionRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto.ExtensionRange) + return object; + let message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + return message; + }; + + /** + * Creates a plain object from an ExtensionRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.ExtensionRange} message ExtensionRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExtensionRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + return object; + }; + + /** + * Converts this ExtensionRange to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + * @returns {Object.} JSON object + */ + ExtensionRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExtensionRange; + })(); + + DescriptorProto.ReservedRange = (function() { + + /** + * Properties of a ReservedRange. + * @memberof google.protobuf.DescriptorProto + * @interface IReservedRange + * @property {number|null} [start] ReservedRange start + * @property {number|null} [end] ReservedRange end + */ + + /** + * Constructs a new ReservedRange. + * @memberof google.protobuf.DescriptorProto + * @classdesc Represents a ReservedRange. + * @implements IReservedRange + * @constructor + * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set + */ + function ReservedRange(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReservedRange start. + * @member {number} start + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + */ + ReservedRange.prototype.start = 0; + + /** + * ReservedRange end. + * @member {number} end + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + */ + ReservedRange.prototype.end = 0; + + /** + * Encodes the specified ReservedRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReservedRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + return writer; + }; + + /** + * Encodes the specified ReservedRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReservedRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReservedRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReservedRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ReservedRange(); + while (reader.pos < end) { + let 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; + }; + + /** + * Decodes a ReservedRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReservedRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReservedRange message. + * @function verify + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReservedRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + return null; + }; + + /** + * Creates a ReservedRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + */ + ReservedRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto.ReservedRange) + return object; + let message = new $root.google.protobuf.DescriptorProto.ReservedRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + return message; + }; + + /** + * Creates a plain object from a ReservedRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.ReservedRange} message ReservedRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReservedRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + return object; + }; + + /** + * Converts this ReservedRange to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + * @returns {Object.} JSON object + */ + ReservedRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ReservedRange; + })(); + + return DescriptorProto; + })(); + + protobuf.FieldDescriptorProto = (function() { + + /** + * Properties of a FieldDescriptorProto. + * @memberof google.protobuf + * @interface IFieldDescriptorProto + * @property {string|null} [name] FieldDescriptorProto name + * @property {number|null} [number] FieldDescriptorProto number + * @property {google.protobuf.FieldDescriptorProto.Label|null} [label] FieldDescriptorProto label + * @property {google.protobuf.FieldDescriptorProto.Type|null} [type] FieldDescriptorProto type + * @property {string|null} [type_name] FieldDescriptorProto type_name + * @property {string|null} [extendee] FieldDescriptorProto extendee + * @property {string|null} [default_value] FieldDescriptorProto default_value + * @property {number|null} [oneof_index] FieldDescriptorProto oneof_index + * @property {string|null} [json_name] FieldDescriptorProto json_name + * @property {google.protobuf.IFieldOptions|null} [options] FieldDescriptorProto options + */ + + /** + * Constructs a new FieldDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a FieldDescriptorProto. + * @implements IFieldDescriptorProto + * @constructor + * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set + */ + function FieldDescriptorProto(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.name = ""; + + /** + * FieldDescriptorProto number. + * @member {number} number + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.number = 0; + + /** + * FieldDescriptorProto label. + * @member {google.protobuf.FieldDescriptorProto.Label} label + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.label = 1; + + /** + * FieldDescriptorProto type. + * @member {google.protobuf.FieldDescriptorProto.Type} type + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.type = 1; + + /** + * FieldDescriptorProto type_name. + * @member {string} type_name + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.type_name = ""; + + /** + * FieldDescriptorProto extendee. + * @member {string} extendee + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.extendee = ""; + + /** + * FieldDescriptorProto default_value. + * @member {string} default_value + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.default_value = ""; + + /** + * FieldDescriptorProto oneof_index. + * @member {number} oneof_index + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.oneof_index = 0; + + /** + * FieldDescriptorProto json_name. + * @member {string} json_name + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.json_name = ""; + + /** + * FieldDescriptorProto options. + * @member {google.protobuf.IFieldOptions|null|undefined} options + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.options = null; + + /** + * Encodes the specified FieldDescriptorProto message. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.extendee != null && Object.hasOwnProperty.call(message, "extendee")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.extendee); + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.number); + if (message.label != null && Object.hasOwnProperty.call(message, "label")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.label); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.type); + if (message.type_name != null && Object.hasOwnProperty.call(message, "type_name")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.type_name); + if (message.default_value != null && Object.hasOwnProperty.call(message, "default_value")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.default_value); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.FieldOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.oneof_index != null && Object.hasOwnProperty.call(message, "oneof_index")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.oneof_index); + if (message.json_name != null && Object.hasOwnProperty.call(message, "json_name")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.json_name); + return writer; + }; + + /** + * Encodes the specified FieldDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldDescriptorProto(); + while (reader.pos < end) { + let 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(); + break; + case 5: + message.type = reader.int32(); + break; + case 6: + message.type_name = reader.string(); + break; + case 2: + message.extendee = reader.string(); + break; + case 7: + message.default_value = reader.string(); + break; + case 9: + message.oneof_index = reader.int32(); + break; + case 10: + message.json_name = reader.string(); + break; + case 8: + message.options = $root.google.protobuf.FieldOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldDescriptorProto message. + * @function verify + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.number != null && message.hasOwnProperty("number")) + if (!$util.isInteger(message.number)) + return "number: integer expected"; + if (message.label != null && message.hasOwnProperty("label")) + switch (message.label) { + default: + return "label: enum value expected"; + case 1: + case 2: + case 3: + break; + } + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + break; + } + if (message.type_name != null && message.hasOwnProperty("type_name")) + if (!$util.isString(message.type_name)) + return "type_name: string expected"; + if (message.extendee != null && message.hasOwnProperty("extendee")) + if (!$util.isString(message.extendee)) + return "extendee: string expected"; + if (message.default_value != null && message.hasOwnProperty("default_value")) + if (!$util.isString(message.default_value)) + return "default_value: string expected"; + if (message.oneof_index != null && message.hasOwnProperty("oneof_index")) + if (!$util.isInteger(message.oneof_index)) + return "oneof_index: integer expected"; + if (message.json_name != null && message.hasOwnProperty("json_name")) + if (!$util.isString(message.json_name)) + return "json_name: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + let error = $root.google.protobuf.FieldOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates a FieldDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + */ + FieldDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldDescriptorProto) + return object; + let message = new $root.google.protobuf.FieldDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.number != null) + message.number = object.number | 0; + switch (object.label) { + case "LABEL_OPTIONAL": + case 1: + message.label = 1; + break; + case "LABEL_REQUIRED": + case 2: + message.label = 2; + break; + case "LABEL_REPEATED": + case 3: + message.label = 3; + break; + } + switch (object.type) { + case "TYPE_DOUBLE": + case 1: + message.type = 1; + break; + case "TYPE_FLOAT": + case 2: + message.type = 2; + break; + case "TYPE_INT64": + case 3: + message.type = 3; + break; + case "TYPE_UINT64": + case 4: + message.type = 4; + break; + case "TYPE_INT32": + case 5: + message.type = 5; + break; + case "TYPE_FIXED64": + case 6: + message.type = 6; + break; + case "TYPE_FIXED32": + case 7: + message.type = 7; + break; + case "TYPE_BOOL": + case 8: + message.type = 8; + break; + case "TYPE_STRING": + case 9: + message.type = 9; + break; + case "TYPE_GROUP": + case 10: + message.type = 10; + break; + case "TYPE_MESSAGE": + case 11: + message.type = 11; + break; + case "TYPE_BYTES": + case 12: + message.type = 12; + break; + case "TYPE_UINT32": + case 13: + message.type = 13; + break; + case "TYPE_ENUM": + case 14: + message.type = 14; + break; + case "TYPE_SFIXED32": + case 15: + message.type = 15; + break; + case "TYPE_SFIXED64": + case 16: + message.type = 16; + break; + case "TYPE_SINT32": + case 17: + message.type = 17; + break; + case "TYPE_SINT64": + case 18: + message.type = 18; + break; + } + if (object.type_name != null) + message.type_name = String(object.type_name); + if (object.extendee != null) + message.extendee = String(object.extendee); + if (object.default_value != null) + message.default_value = String(object.default_value); + if (object.oneof_index != null) + message.oneof_index = object.oneof_index | 0; + if (object.json_name != null) + message.json_name = String(object.json_name); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.FieldDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.FieldOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from a FieldDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.FieldDescriptorProto} message FieldDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.name = ""; + object.extendee = ""; + object.number = 0; + object.label = options.enums === String ? "LABEL_OPTIONAL" : 1; + object.type = options.enums === String ? "TYPE_DOUBLE" : 1; + object.type_name = ""; + object.default_value = ""; + object.options = null; + object.oneof_index = 0; + object.json_name = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.extendee != null && message.hasOwnProperty("extendee")) + object.extendee = message.extendee; + if (message.number != null && message.hasOwnProperty("number")) + object.number = message.number; + if (message.label != null && message.hasOwnProperty("label")) + object.label = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Label[message.label] : message.label; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Type[message.type] : message.type; + if (message.type_name != null && message.hasOwnProperty("type_name")) + object.type_name = message.type_name; + if (message.default_value != null && message.hasOwnProperty("default_value")) + object.default_value = message.default_value; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.FieldOptions.toObject(message.options, options); + if (message.oneof_index != null && message.hasOwnProperty("oneof_index")) + object.oneof_index = message.oneof_index; + if (message.json_name != null && message.hasOwnProperty("json_name")) + object.json_name = message.json_name; + return object; + }; + + /** + * Converts this FieldDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.FieldDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + FieldDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Type enum. + * @name google.protobuf.FieldDescriptorProto.Type + * @enum {number} + * @property {number} TYPE_DOUBLE=1 TYPE_DOUBLE value + * @property {number} TYPE_FLOAT=2 TYPE_FLOAT value + * @property {number} TYPE_INT64=3 TYPE_INT64 value + * @property {number} TYPE_UINT64=4 TYPE_UINT64 value + * @property {number} TYPE_INT32=5 TYPE_INT32 value + * @property {number} TYPE_FIXED64=6 TYPE_FIXED64 value + * @property {number} TYPE_FIXED32=7 TYPE_FIXED32 value + * @property {number} TYPE_BOOL=8 TYPE_BOOL value + * @property {number} TYPE_STRING=9 TYPE_STRING value + * @property {number} TYPE_GROUP=10 TYPE_GROUP value + * @property {number} TYPE_MESSAGE=11 TYPE_MESSAGE value + * @property {number} TYPE_BYTES=12 TYPE_BYTES value + * @property {number} TYPE_UINT32=13 TYPE_UINT32 value + * @property {number} TYPE_ENUM=14 TYPE_ENUM value + * @property {number} TYPE_SFIXED32=15 TYPE_SFIXED32 value + * @property {number} TYPE_SFIXED64=16 TYPE_SFIXED64 value + * @property {number} TYPE_SINT32=17 TYPE_SINT32 value + * @property {number} TYPE_SINT64=18 TYPE_SINT64 value + */ + FieldDescriptorProto.Type = (function() { + const valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "TYPE_DOUBLE"] = 1; + values[valuesById[2] = "TYPE_FLOAT"] = 2; + values[valuesById[3] = "TYPE_INT64"] = 3; + values[valuesById[4] = "TYPE_UINT64"] = 4; + values[valuesById[5] = "TYPE_INT32"] = 5; + values[valuesById[6] = "TYPE_FIXED64"] = 6; + values[valuesById[7] = "TYPE_FIXED32"] = 7; + values[valuesById[8] = "TYPE_BOOL"] = 8; + values[valuesById[9] = "TYPE_STRING"] = 9; + values[valuesById[10] = "TYPE_GROUP"] = 10; + values[valuesById[11] = "TYPE_MESSAGE"] = 11; + values[valuesById[12] = "TYPE_BYTES"] = 12; + values[valuesById[13] = "TYPE_UINT32"] = 13; + values[valuesById[14] = "TYPE_ENUM"] = 14; + values[valuesById[15] = "TYPE_SFIXED32"] = 15; + values[valuesById[16] = "TYPE_SFIXED64"] = 16; + values[valuesById[17] = "TYPE_SINT32"] = 17; + values[valuesById[18] = "TYPE_SINT64"] = 18; + return values; + })(); + + /** + * Label enum. + * @name google.protobuf.FieldDescriptorProto.Label + * @enum {number} + * @property {number} LABEL_OPTIONAL=1 LABEL_OPTIONAL value + * @property {number} LABEL_REQUIRED=2 LABEL_REQUIRED value + * @property {number} LABEL_REPEATED=3 LABEL_REPEATED value + */ + FieldDescriptorProto.Label = (function() { + const valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "LABEL_OPTIONAL"] = 1; + values[valuesById[2] = "LABEL_REQUIRED"] = 2; + values[valuesById[3] = "LABEL_REPEATED"] = 3; + return values; + })(); + + return FieldDescriptorProto; + })(); + + protobuf.OneofDescriptorProto = (function() { + + /** + * Properties of an OneofDescriptorProto. + * @memberof google.protobuf + * @interface IOneofDescriptorProto + * @property {string|null} [name] OneofDescriptorProto name + * @property {google.protobuf.IOneofOptions|null} [options] OneofDescriptorProto options + */ + + /** + * Constructs a new OneofDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an OneofDescriptorProto. + * @implements IOneofDescriptorProto + * @constructor + * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set + */ + function OneofDescriptorProto(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OneofDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.OneofDescriptorProto + * @instance + */ + OneofDescriptorProto.prototype.name = ""; + + /** + * OneofDescriptorProto options. + * @member {google.protobuf.IOneofOptions|null|undefined} options + * @memberof google.protobuf.OneofDescriptorProto + * @instance + */ + OneofDescriptorProto.prototype.options = null; + + /** + * Encodes the specified OneofDescriptorProto message. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.OneofOptions.encode(message.options, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OneofDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofDescriptorProto(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.options = $root.google.protobuf.OneofOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OneofDescriptorProto message. + * @function verify + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OneofDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + let error = $root.google.protobuf.OneofOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an OneofDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + */ + OneofDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.OneofDescriptorProto) + return object; + let message = new $root.google.protobuf.OneofDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.OneofDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.OneofOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an OneofDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.OneofDescriptorProto} message OneofDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OneofDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.OneofOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this OneofDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.OneofDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + OneofDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return OneofDescriptorProto; + })(); + + protobuf.EnumDescriptorProto = (function() { + + /** + * Properties of an EnumDescriptorProto. + * @memberof google.protobuf + * @interface IEnumDescriptorProto + * @property {string|null} [name] EnumDescriptorProto name + * @property {Array.|null} [value] EnumDescriptorProto value + * @property {google.protobuf.IEnumOptions|null} [options] EnumDescriptorProto options + */ + + /** + * Constructs a new EnumDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an EnumDescriptorProto. + * @implements IEnumDescriptorProto + * @constructor + * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set + */ + function EnumDescriptorProto(properties) { + this.value = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.name = ""; + + /** + * EnumDescriptorProto value. + * @member {Array.} value + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.value = $util.emptyArray; + + /** + * EnumDescriptorProto options. + * @member {google.protobuf.IEnumOptions|null|undefined} options + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.options = null; + + /** + * Encodes the specified EnumDescriptorProto message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.value != null && message.value.length) + for (let i = 0; i < message.value.length; ++i) + $root.google.protobuf.EnumValueDescriptorProto.encode(message.value[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.EnumOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + if (!(message.value && message.value.length)) + message.value = []; + message.value.push($root.google.protobuf.EnumValueDescriptorProto.decode(reader, reader.uint32())); + break; + case 3: + message.options = $root.google.protobuf.EnumOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumDescriptorProto message. + * @function verify + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.value != null && message.hasOwnProperty("value")) { + if (!Array.isArray(message.value)) + return "value: array expected"; + for (let i = 0; i < message.value.length; ++i) { + let error = $root.google.protobuf.EnumValueDescriptorProto.verify(message.value[i]); + if (error) + return "value." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + let error = $root.google.protobuf.EnumOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an EnumDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + */ + EnumDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumDescriptorProto) + return object; + let message = new $root.google.protobuf.EnumDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.value) { + if (!Array.isArray(object.value)) + throw TypeError(".google.protobuf.EnumDescriptorProto.value: array expected"); + message.value = []; + for (let i = 0; i < object.value.length; ++i) { + if (typeof object.value[i] !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.value: object expected"); + message.value[i] = $root.google.protobuf.EnumValueDescriptorProto.fromObject(object.value[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.EnumOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an EnumDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.EnumDescriptorProto} message EnumDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.value = []; + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.value && message.value.length) { + object.value = []; + for (let j = 0; j < message.value.length; ++j) + object.value[j] = $root.google.protobuf.EnumValueDescriptorProto.toObject(message.value[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.EnumOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this EnumDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.EnumDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + EnumDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnumDescriptorProto; + })(); + + protobuf.EnumValueDescriptorProto = (function() { + + /** + * Properties of an EnumValueDescriptorProto. + * @memberof google.protobuf + * @interface IEnumValueDescriptorProto + * @property {string|null} [name] EnumValueDescriptorProto name + * @property {number|null} [number] EnumValueDescriptorProto number + * @property {google.protobuf.IEnumValueOptions|null} [options] EnumValueDescriptorProto options + */ + + /** + * Constructs a new EnumValueDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an EnumValueDescriptorProto. + * @implements IEnumValueDescriptorProto + * @constructor + * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set + */ + function EnumValueDescriptorProto(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumValueDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.name = ""; + + /** + * EnumValueDescriptorProto number. + * @member {number} number + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.number = 0; + + /** + * EnumValueDescriptorProto options. + * @member {google.protobuf.IEnumValueOptions|null|undefined} options + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.options = null; + + /** + * Encodes the specified EnumValueDescriptorProto message. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.number); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.EnumValueOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumValueDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueDescriptorProto(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.number = reader.int32(); + break; + case 3: + message.options = $root.google.protobuf.EnumValueOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumValueDescriptorProto message. + * @function verify + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumValueDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.number != null && message.hasOwnProperty("number")) + if (!$util.isInteger(message.number)) + return "number: integer expected"; + if (message.options != null && message.hasOwnProperty("options")) { + let error = $root.google.protobuf.EnumValueOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an EnumValueDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + */ + EnumValueDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumValueDescriptorProto) + return object; + let message = new $root.google.protobuf.EnumValueDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.number != null) + message.number = object.number | 0; + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.EnumValueDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.EnumValueOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an EnumValueDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.EnumValueDescriptorProto} message EnumValueDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumValueDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.name = ""; + object.number = 0; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.number != null && message.hasOwnProperty("number")) + object.number = message.number; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.EnumValueOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this EnumValueDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + EnumValueDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnumValueDescriptorProto; + })(); + + protobuf.ServiceDescriptorProto = (function() { + + /** + * Properties of a ServiceDescriptorProto. + * @memberof google.protobuf + * @interface IServiceDescriptorProto + * @property {string|null} [name] ServiceDescriptorProto name + * @property {Array.|null} [method] ServiceDescriptorProto method + * @property {google.protobuf.IServiceOptions|null} [options] ServiceDescriptorProto options + */ + + /** + * Constructs a new ServiceDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a ServiceDescriptorProto. + * @implements IServiceDescriptorProto + * @constructor + * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set + */ + function ServiceDescriptorProto(properties) { + this.method = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServiceDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.name = ""; + + /** + * ServiceDescriptorProto method. + * @member {Array.} method + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.method = $util.emptyArray; + + /** + * ServiceDescriptorProto options. + * @member {google.protobuf.IServiceOptions|null|undefined} options + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.options = null; + + /** + * Encodes the specified ServiceDescriptorProto message. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.method != null && message.method.length) + for (let i = 0; i < message.method.length; ++i) + $root.google.protobuf.MethodDescriptorProto.encode(message.method[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.ServiceOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ServiceDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceDescriptorProto(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + if (!(message.method && message.method.length)) + message.method = []; + message.method.push($root.google.protobuf.MethodDescriptorProto.decode(reader, reader.uint32())); + break; + case 3: + message.options = $root.google.protobuf.ServiceOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceDescriptorProto message. + * @function verify + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.method != null && message.hasOwnProperty("method")) { + if (!Array.isArray(message.method)) + return "method: array expected"; + for (let i = 0; i < message.method.length; ++i) { + let error = $root.google.protobuf.MethodDescriptorProto.verify(message.method[i]); + if (error) + return "method." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + let error = $root.google.protobuf.ServiceOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates a ServiceDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + */ + ServiceDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ServiceDescriptorProto) + return object; + let message = new $root.google.protobuf.ServiceDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.method) { + if (!Array.isArray(object.method)) + throw TypeError(".google.protobuf.ServiceDescriptorProto.method: array expected"); + message.method = []; + for (let i = 0; i < object.method.length; ++i) { + if (typeof object.method[i] !== "object") + throw TypeError(".google.protobuf.ServiceDescriptorProto.method: object expected"); + message.method[i] = $root.google.protobuf.MethodDescriptorProto.fromObject(object.method[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.ServiceDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.ServiceOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from a ServiceDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.ServiceDescriptorProto} message ServiceDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.method = []; + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.method && message.method.length) { + object.method = []; + for (let j = 0; j < message.method.length; ++j) + object.method[j] = $root.google.protobuf.MethodDescriptorProto.toObject(message.method[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.ServiceOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this ServiceDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + ServiceDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ServiceDescriptorProto; + })(); + + protobuf.MethodDescriptorProto = (function() { + + /** + * Properties of a MethodDescriptorProto. + * @memberof google.protobuf + * @interface IMethodDescriptorProto + * @property {string|null} [name] MethodDescriptorProto name + * @property {string|null} [input_type] MethodDescriptorProto input_type + * @property {string|null} [output_type] MethodDescriptorProto output_type + * @property {google.protobuf.IMethodOptions|null} [options] MethodDescriptorProto options + * @property {boolean|null} [client_streaming] MethodDescriptorProto client_streaming + * @property {boolean|null} [server_streaming] MethodDescriptorProto server_streaming + */ + + /** + * Constructs a new MethodDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a MethodDescriptorProto. + * @implements IMethodDescriptorProto + * @constructor + * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set + */ + function MethodDescriptorProto(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MethodDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.name = ""; + + /** + * MethodDescriptorProto input_type. + * @member {string} input_type + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.input_type = ""; + + /** + * MethodDescriptorProto output_type. + * @member {string} output_type + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.output_type = ""; + + /** + * MethodDescriptorProto options. + * @member {google.protobuf.IMethodOptions|null|undefined} options + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.options = null; + + /** + * MethodDescriptorProto client_streaming. + * @member {boolean} client_streaming + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.client_streaming = false; + + /** + * MethodDescriptorProto server_streaming. + * @member {boolean} server_streaming + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.server_streaming = false; + + /** + * Encodes the specified MethodDescriptorProto message. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.input_type != null && Object.hasOwnProperty.call(message, "input_type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.input_type); + if (message.output_type != null && Object.hasOwnProperty.call(message, "output_type")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.output_type); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.MethodOptions.encode(message.options, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.client_streaming != null && Object.hasOwnProperty.call(message, "client_streaming")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.client_streaming); + if (message.server_streaming != null && Object.hasOwnProperty.call(message, "server_streaming")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.server_streaming); + return writer; + }; + + /** + * Encodes the specified MethodDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodDescriptorProto(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.input_type = reader.string(); + break; + case 3: + message.output_type = reader.string(); + break; + case 4: + message.options = $root.google.protobuf.MethodOptions.decode(reader, reader.uint32()); + break; + case 5: + message.client_streaming = reader.bool(); + break; + case 6: + message.server_streaming = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MethodDescriptorProto message. + * @function verify + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MethodDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.input_type != null && message.hasOwnProperty("input_type")) + if (!$util.isString(message.input_type)) + return "input_type: string expected"; + if (message.output_type != null && message.hasOwnProperty("output_type")) + if (!$util.isString(message.output_type)) + return "output_type: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + let error = $root.google.protobuf.MethodOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.client_streaming != null && message.hasOwnProperty("client_streaming")) + if (typeof message.client_streaming !== "boolean") + return "client_streaming: boolean expected"; + if (message.server_streaming != null && message.hasOwnProperty("server_streaming")) + if (typeof message.server_streaming !== "boolean") + return "server_streaming: boolean expected"; + return null; + }; + + /** + * Creates a MethodDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + */ + MethodDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MethodDescriptorProto) + return object; + let message = new $root.google.protobuf.MethodDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.input_type != null) + message.input_type = String(object.input_type); + if (object.output_type != null) + message.output_type = String(object.output_type); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.MethodDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.MethodOptions.fromObject(object.options); + } + if (object.client_streaming != null) + message.client_streaming = Boolean(object.client_streaming); + if (object.server_streaming != null) + message.server_streaming = Boolean(object.server_streaming); + return message; + }; + + /** + * Creates a plain object from a MethodDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.MethodDescriptorProto} message MethodDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MethodDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.name = ""; + object.input_type = ""; + object.output_type = ""; + object.options = null; + object.client_streaming = false; + object.server_streaming = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.input_type != null && message.hasOwnProperty("input_type")) + object.input_type = message.input_type; + if (message.output_type != null && message.hasOwnProperty("output_type")) + object.output_type = message.output_type; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.MethodOptions.toObject(message.options, options); + if (message.client_streaming != null && message.hasOwnProperty("client_streaming")) + object.client_streaming = message.client_streaming; + if (message.server_streaming != null && message.hasOwnProperty("server_streaming")) + object.server_streaming = message.server_streaming; + return object; + }; + + /** + * Converts this MethodDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.MethodDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + MethodDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MethodDescriptorProto; + })(); + + protobuf.FileOptions = (function() { + + /** + * Properties of a FileOptions. + * @memberof google.protobuf + * @interface IFileOptions + * @property {string|null} [java_package] FileOptions java_package + * @property {string|null} [java_outer_classname] FileOptions java_outer_classname + * @property {boolean|null} [java_multiple_files] FileOptions java_multiple_files + * @property {boolean|null} [java_generate_equals_and_hash] FileOptions java_generate_equals_and_hash + * @property {boolean|null} [java_string_check_utf8] FileOptions java_string_check_utf8 + * @property {google.protobuf.FileOptions.OptimizeMode|null} [optimize_for] FileOptions optimize_for + * @property {string|null} [go_package] FileOptions go_package + * @property {boolean|null} [cc_generic_services] FileOptions cc_generic_services + * @property {boolean|null} [java_generic_services] FileOptions java_generic_services + * @property {boolean|null} [py_generic_services] FileOptions py_generic_services + * @property {boolean|null} [deprecated] FileOptions deprecated + * @property {boolean|null} [cc_enable_arenas] FileOptions cc_enable_arenas + * @property {string|null} [objc_class_prefix] FileOptions objc_class_prefix + * @property {string|null} [csharp_namespace] FileOptions csharp_namespace + * @property {Array.|null} [uninterpreted_option] FileOptions uninterpreted_option + * @property {boolean|null} [".gogoproto.goproto_getters_all"] FileOptions .gogoproto.goproto_getters_all + * @property {boolean|null} [".gogoproto.goproto_enum_prefix_all"] FileOptions .gogoproto.goproto_enum_prefix_all + * @property {boolean|null} [".gogoproto.goproto_stringer_all"] FileOptions .gogoproto.goproto_stringer_all + * @property {boolean|null} [".gogoproto.verbose_equal_all"] FileOptions .gogoproto.verbose_equal_all + * @property {boolean|null} [".gogoproto.face_all"] FileOptions .gogoproto.face_all + * @property {boolean|null} [".gogoproto.gostring_all"] FileOptions .gogoproto.gostring_all + * @property {boolean|null} [".gogoproto.populate_all"] FileOptions .gogoproto.populate_all + * @property {boolean|null} [".gogoproto.stringer_all"] FileOptions .gogoproto.stringer_all + * @property {boolean|null} [".gogoproto.onlyone_all"] FileOptions .gogoproto.onlyone_all + * @property {boolean|null} [".gogoproto.equal_all"] FileOptions .gogoproto.equal_all + * @property {boolean|null} [".gogoproto.description_all"] FileOptions .gogoproto.description_all + * @property {boolean|null} [".gogoproto.testgen_all"] FileOptions .gogoproto.testgen_all + * @property {boolean|null} [".gogoproto.benchgen_all"] FileOptions .gogoproto.benchgen_all + * @property {boolean|null} [".gogoproto.marshaler_all"] FileOptions .gogoproto.marshaler_all + * @property {boolean|null} [".gogoproto.unmarshaler_all"] FileOptions .gogoproto.unmarshaler_all + * @property {boolean|null} [".gogoproto.stable_marshaler_all"] FileOptions .gogoproto.stable_marshaler_all + * @property {boolean|null} [".gogoproto.sizer_all"] FileOptions .gogoproto.sizer_all + * @property {boolean|null} [".gogoproto.goproto_enum_stringer_all"] FileOptions .gogoproto.goproto_enum_stringer_all + * @property {boolean|null} [".gogoproto.enum_stringer_all"] FileOptions .gogoproto.enum_stringer_all + * @property {boolean|null} [".gogoproto.unsafe_marshaler_all"] FileOptions .gogoproto.unsafe_marshaler_all + * @property {boolean|null} [".gogoproto.unsafe_unmarshaler_all"] FileOptions .gogoproto.unsafe_unmarshaler_all + * @property {boolean|null} [".gogoproto.goproto_extensions_map_all"] FileOptions .gogoproto.goproto_extensions_map_all + * @property {boolean|null} [".gogoproto.goproto_unrecognized_all"] FileOptions .gogoproto.goproto_unrecognized_all + * @property {boolean|null} [".gogoproto.gogoproto_import"] FileOptions .gogoproto.gogoproto_import + * @property {boolean|null} [".gogoproto.protosizer_all"] FileOptions .gogoproto.protosizer_all + * @property {boolean|null} [".gogoproto.compare_all"] FileOptions .gogoproto.compare_all + * @property {boolean|null} [".gogoproto.typedecl_all"] FileOptions .gogoproto.typedecl_all + * @property {boolean|null} [".gogoproto.enumdecl_all"] FileOptions .gogoproto.enumdecl_all + * @property {boolean|null} [".gogoproto.goproto_registration"] FileOptions .gogoproto.goproto_registration + * @property {boolean|null} [".gogoproto.messagename_all"] FileOptions .gogoproto.messagename_all + * @property {boolean|null} [".gogoproto.goproto_sizecache_all"] FileOptions .gogoproto.goproto_sizecache_all + * @property {boolean|null} [".gogoproto.goproto_unkeyed_all"] FileOptions .gogoproto.goproto_unkeyed_all + */ + + /** + * Constructs a new FileOptions. + * @memberof google.protobuf + * @classdesc Represents a FileOptions. + * @implements IFileOptions + * @constructor + * @param {google.protobuf.IFileOptions=} [properties] Properties to set + */ + function FileOptions(properties) { + this.uninterpreted_option = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileOptions java_package. + * @member {string} java_package + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.java_package = ""; + + /** + * FileOptions java_outer_classname. + * @member {string} java_outer_classname + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.java_outer_classname = ""; + + /** + * FileOptions java_multiple_files. + * @member {boolean} java_multiple_files + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.java_multiple_files = false; + + /** + * FileOptions java_generate_equals_and_hash. + * @member {boolean} java_generate_equals_and_hash + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.java_generate_equals_and_hash = false; + + /** + * FileOptions java_string_check_utf8. + * @member {boolean} java_string_check_utf8 + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.java_string_check_utf8 = false; + + /** + * FileOptions optimize_for. + * @member {google.protobuf.FileOptions.OptimizeMode} optimize_for + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.optimize_for = 1; + + /** + * FileOptions go_package. + * @member {string} go_package + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.go_package = ""; + + /** + * FileOptions cc_generic_services. + * @member {boolean} cc_generic_services + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.cc_generic_services = false; + + /** + * FileOptions java_generic_services. + * @member {boolean} java_generic_services + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.java_generic_services = false; + + /** + * FileOptions py_generic_services. + * @member {boolean} py_generic_services + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.py_generic_services = false; + + /** + * FileOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.deprecated = false; + + /** + * FileOptions cc_enable_arenas. + * @member {boolean} cc_enable_arenas + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.cc_enable_arenas = false; + + /** + * FileOptions objc_class_prefix. + * @member {string} objc_class_prefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.objc_class_prefix = ""; + + /** + * FileOptions csharp_namespace. + * @member {string} csharp_namespace + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.csharp_namespace = ""; + + /** + * FileOptions uninterpreted_option. + * @member {Array.} uninterpreted_option + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.uninterpreted_option = $util.emptyArray; + + /** + * FileOptions .gogoproto.goproto_getters_all. + * @member {boolean} .gogoproto.goproto_getters_all + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.goproto_getters_all"] = false; + + /** + * FileOptions .gogoproto.goproto_enum_prefix_all. + * @member {boolean} .gogoproto.goproto_enum_prefix_all + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.goproto_enum_prefix_all"] = false; + + /** + * FileOptions .gogoproto.goproto_stringer_all. + * @member {boolean} .gogoproto.goproto_stringer_all + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.goproto_stringer_all"] = false; + + /** + * FileOptions .gogoproto.verbose_equal_all. + * @member {boolean} .gogoproto.verbose_equal_all + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.verbose_equal_all"] = false; + + /** + * FileOptions .gogoproto.face_all. + * @member {boolean} .gogoproto.face_all + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.face_all"] = false; + + /** + * FileOptions .gogoproto.gostring_all. + * @member {boolean} .gogoproto.gostring_all + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.gostring_all"] = false; + + /** + * FileOptions .gogoproto.populate_all. + * @member {boolean} .gogoproto.populate_all + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.populate_all"] = false; + + /** + * FileOptions .gogoproto.stringer_all. + * @member {boolean} .gogoproto.stringer_all + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.stringer_all"] = false; + + /** + * FileOptions .gogoproto.onlyone_all. + * @member {boolean} .gogoproto.onlyone_all + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.onlyone_all"] = false; + + /** + * FileOptions .gogoproto.equal_all. + * @member {boolean} .gogoproto.equal_all + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.equal_all"] = false; + + /** + * FileOptions .gogoproto.description_all. + * @member {boolean} .gogoproto.description_all + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.description_all"] = false; + + /** + * FileOptions .gogoproto.testgen_all. + * @member {boolean} .gogoproto.testgen_all + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.testgen_all"] = false; + + /** + * FileOptions .gogoproto.benchgen_all. + * @member {boolean} .gogoproto.benchgen_all + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.benchgen_all"] = false; + + /** + * FileOptions .gogoproto.marshaler_all. + * @member {boolean} .gogoproto.marshaler_all + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.marshaler_all"] = false; + + /** + * FileOptions .gogoproto.unmarshaler_all. + * @member {boolean} .gogoproto.unmarshaler_all + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.unmarshaler_all"] = false; + + /** + * FileOptions .gogoproto.stable_marshaler_all. + * @member {boolean} .gogoproto.stable_marshaler_all + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.stable_marshaler_all"] = false; + + /** + * FileOptions .gogoproto.sizer_all. + * @member {boolean} .gogoproto.sizer_all + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.sizer_all"] = false; + + /** + * FileOptions .gogoproto.goproto_enum_stringer_all. + * @member {boolean} .gogoproto.goproto_enum_stringer_all + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.goproto_enum_stringer_all"] = false; + + /** + * FileOptions .gogoproto.enum_stringer_all. + * @member {boolean} .gogoproto.enum_stringer_all + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.enum_stringer_all"] = false; + + /** + * FileOptions .gogoproto.unsafe_marshaler_all. + * @member {boolean} .gogoproto.unsafe_marshaler_all + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.unsafe_marshaler_all"] = false; + + /** + * FileOptions .gogoproto.unsafe_unmarshaler_all. + * @member {boolean} .gogoproto.unsafe_unmarshaler_all + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.unsafe_unmarshaler_all"] = false; + + /** + * FileOptions .gogoproto.goproto_extensions_map_all. + * @member {boolean} .gogoproto.goproto_extensions_map_all + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.goproto_extensions_map_all"] = false; + + /** + * FileOptions .gogoproto.goproto_unrecognized_all. + * @member {boolean} .gogoproto.goproto_unrecognized_all + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.goproto_unrecognized_all"] = false; + + /** + * FileOptions .gogoproto.gogoproto_import. + * @member {boolean} .gogoproto.gogoproto_import + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.gogoproto_import"] = false; + + /** + * FileOptions .gogoproto.protosizer_all. + * @member {boolean} .gogoproto.protosizer_all + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.protosizer_all"] = false; + + /** + * FileOptions .gogoproto.compare_all. + * @member {boolean} .gogoproto.compare_all + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.compare_all"] = false; + + /** + * FileOptions .gogoproto.typedecl_all. + * @member {boolean} .gogoproto.typedecl_all + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.typedecl_all"] = false; + + /** + * FileOptions .gogoproto.enumdecl_all. + * @member {boolean} .gogoproto.enumdecl_all + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.enumdecl_all"] = false; + + /** + * FileOptions .gogoproto.goproto_registration. + * @member {boolean} .gogoproto.goproto_registration + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.goproto_registration"] = false; + + /** + * FileOptions .gogoproto.messagename_all. + * @member {boolean} .gogoproto.messagename_all + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.messagename_all"] = false; + + /** + * FileOptions .gogoproto.goproto_sizecache_all. + * @member {boolean} .gogoproto.goproto_sizecache_all + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.goproto_sizecache_all"] = false; + + /** + * FileOptions .gogoproto.goproto_unkeyed_all. + * @member {boolean} .gogoproto.goproto_unkeyed_all + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".gogoproto.goproto_unkeyed_all"] = false; + + /** + * Encodes the specified FileOptions message. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.java_package != null && Object.hasOwnProperty.call(message, "java_package")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.java_package); + if (message.java_outer_classname != null && Object.hasOwnProperty.call(message, "java_outer_classname")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.java_outer_classname); + if (message.optimize_for != null && Object.hasOwnProperty.call(message, "optimize_for")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.optimize_for); + if (message.java_multiple_files != null && Object.hasOwnProperty.call(message, "java_multiple_files")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.java_multiple_files); + if (message.go_package != null && Object.hasOwnProperty.call(message, "go_package")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.go_package); + if (message.cc_generic_services != null && Object.hasOwnProperty.call(message, "cc_generic_services")) + writer.uint32(/* id 16, wireType 0 =*/128).bool(message.cc_generic_services); + if (message.java_generic_services != null && Object.hasOwnProperty.call(message, "java_generic_services")) + writer.uint32(/* id 17, wireType 0 =*/136).bool(message.java_generic_services); + if (message.py_generic_services != null && Object.hasOwnProperty.call(message, "py_generic_services")) + writer.uint32(/* id 18, wireType 0 =*/144).bool(message.py_generic_services); + if (message.java_generate_equals_and_hash != null && Object.hasOwnProperty.call(message, "java_generate_equals_and_hash")) + writer.uint32(/* id 20, wireType 0 =*/160).bool(message.java_generate_equals_and_hash); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 23, wireType 0 =*/184).bool(message.deprecated); + if (message.java_string_check_utf8 != null && Object.hasOwnProperty.call(message, "java_string_check_utf8")) + writer.uint32(/* id 27, wireType 0 =*/216).bool(message.java_string_check_utf8); + if (message.cc_enable_arenas != null && Object.hasOwnProperty.call(message, "cc_enable_arenas")) + writer.uint32(/* id 31, wireType 0 =*/248).bool(message.cc_enable_arenas); + if (message.objc_class_prefix != null && Object.hasOwnProperty.call(message, "objc_class_prefix")) + writer.uint32(/* id 36, wireType 2 =*/290).string(message.objc_class_prefix); + if (message.csharp_namespace != null && Object.hasOwnProperty.call(message, "csharp_namespace")) + writer.uint32(/* id 37, wireType 2 =*/298).string(message.csharp_namespace); + if (message.uninterpreted_option != null && message.uninterpreted_option.length) + for (let i = 0; i < message.uninterpreted_option.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpreted_option[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".gogoproto.goproto_getters_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_getters_all")) + writer.uint32(/* id 63001, wireType 0 =*/504008).bool(message[".gogoproto.goproto_getters_all"]); + if (message[".gogoproto.goproto_enum_prefix_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_enum_prefix_all")) + writer.uint32(/* id 63002, wireType 0 =*/504016).bool(message[".gogoproto.goproto_enum_prefix_all"]); + if (message[".gogoproto.goproto_stringer_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_stringer_all")) + writer.uint32(/* id 63003, wireType 0 =*/504024).bool(message[".gogoproto.goproto_stringer_all"]); + if (message[".gogoproto.verbose_equal_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.verbose_equal_all")) + writer.uint32(/* id 63004, wireType 0 =*/504032).bool(message[".gogoproto.verbose_equal_all"]); + if (message[".gogoproto.face_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.face_all")) + writer.uint32(/* id 63005, wireType 0 =*/504040).bool(message[".gogoproto.face_all"]); + if (message[".gogoproto.gostring_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.gostring_all")) + writer.uint32(/* id 63006, wireType 0 =*/504048).bool(message[".gogoproto.gostring_all"]); + if (message[".gogoproto.populate_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.populate_all")) + writer.uint32(/* id 63007, wireType 0 =*/504056).bool(message[".gogoproto.populate_all"]); + if (message[".gogoproto.stringer_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.stringer_all")) + writer.uint32(/* id 63008, wireType 0 =*/504064).bool(message[".gogoproto.stringer_all"]); + if (message[".gogoproto.onlyone_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.onlyone_all")) + writer.uint32(/* id 63009, wireType 0 =*/504072).bool(message[".gogoproto.onlyone_all"]); + if (message[".gogoproto.equal_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.equal_all")) + writer.uint32(/* id 63013, wireType 0 =*/504104).bool(message[".gogoproto.equal_all"]); + if (message[".gogoproto.description_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.description_all")) + writer.uint32(/* id 63014, wireType 0 =*/504112).bool(message[".gogoproto.description_all"]); + if (message[".gogoproto.testgen_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.testgen_all")) + writer.uint32(/* id 63015, wireType 0 =*/504120).bool(message[".gogoproto.testgen_all"]); + if (message[".gogoproto.benchgen_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.benchgen_all")) + writer.uint32(/* id 63016, wireType 0 =*/504128).bool(message[".gogoproto.benchgen_all"]); + if (message[".gogoproto.marshaler_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.marshaler_all")) + writer.uint32(/* id 63017, wireType 0 =*/504136).bool(message[".gogoproto.marshaler_all"]); + if (message[".gogoproto.unmarshaler_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.unmarshaler_all")) + writer.uint32(/* id 63018, wireType 0 =*/504144).bool(message[".gogoproto.unmarshaler_all"]); + if (message[".gogoproto.stable_marshaler_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.stable_marshaler_all")) + writer.uint32(/* id 63019, wireType 0 =*/504152).bool(message[".gogoproto.stable_marshaler_all"]); + if (message[".gogoproto.sizer_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.sizer_all")) + writer.uint32(/* id 63020, wireType 0 =*/504160).bool(message[".gogoproto.sizer_all"]); + if (message[".gogoproto.goproto_enum_stringer_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_enum_stringer_all")) + writer.uint32(/* id 63021, wireType 0 =*/504168).bool(message[".gogoproto.goproto_enum_stringer_all"]); + if (message[".gogoproto.enum_stringer_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.enum_stringer_all")) + writer.uint32(/* id 63022, wireType 0 =*/504176).bool(message[".gogoproto.enum_stringer_all"]); + if (message[".gogoproto.unsafe_marshaler_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.unsafe_marshaler_all")) + writer.uint32(/* id 63023, wireType 0 =*/504184).bool(message[".gogoproto.unsafe_marshaler_all"]); + if (message[".gogoproto.unsafe_unmarshaler_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.unsafe_unmarshaler_all")) + writer.uint32(/* id 63024, wireType 0 =*/504192).bool(message[".gogoproto.unsafe_unmarshaler_all"]); + if (message[".gogoproto.goproto_extensions_map_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_extensions_map_all")) + writer.uint32(/* id 63025, wireType 0 =*/504200).bool(message[".gogoproto.goproto_extensions_map_all"]); + if (message[".gogoproto.goproto_unrecognized_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_unrecognized_all")) + writer.uint32(/* id 63026, wireType 0 =*/504208).bool(message[".gogoproto.goproto_unrecognized_all"]); + if (message[".gogoproto.gogoproto_import"] != null && Object.hasOwnProperty.call(message, ".gogoproto.gogoproto_import")) + writer.uint32(/* id 63027, wireType 0 =*/504216).bool(message[".gogoproto.gogoproto_import"]); + if (message[".gogoproto.protosizer_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.protosizer_all")) + writer.uint32(/* id 63028, wireType 0 =*/504224).bool(message[".gogoproto.protosizer_all"]); + if (message[".gogoproto.compare_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.compare_all")) + writer.uint32(/* id 63029, wireType 0 =*/504232).bool(message[".gogoproto.compare_all"]); + if (message[".gogoproto.typedecl_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.typedecl_all")) + writer.uint32(/* id 63030, wireType 0 =*/504240).bool(message[".gogoproto.typedecl_all"]); + if (message[".gogoproto.enumdecl_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.enumdecl_all")) + writer.uint32(/* id 63031, wireType 0 =*/504248).bool(message[".gogoproto.enumdecl_all"]); + if (message[".gogoproto.goproto_registration"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_registration")) + writer.uint32(/* id 63032, wireType 0 =*/504256).bool(message[".gogoproto.goproto_registration"]); + if (message[".gogoproto.messagename_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.messagename_all")) + writer.uint32(/* id 63033, wireType 0 =*/504264).bool(message[".gogoproto.messagename_all"]); + if (message[".gogoproto.goproto_sizecache_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_sizecache_all")) + writer.uint32(/* id 63034, wireType 0 =*/504272).bool(message[".gogoproto.goproto_sizecache_all"]); + if (message[".gogoproto.goproto_unkeyed_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_unkeyed_all")) + writer.uint32(/* id 63035, wireType 0 =*/504280).bool(message[".gogoproto.goproto_unkeyed_all"]); + return writer; + }; + + /** + * Encodes the specified FileOptions message, length delimited. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileOptions} FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileOptions(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.java_package = reader.string(); + break; + case 8: + message.java_outer_classname = reader.string(); + break; + case 10: + message.java_multiple_files = reader.bool(); + break; + case 20: + message.java_generate_equals_and_hash = reader.bool(); + break; + case 27: + message.java_string_check_utf8 = reader.bool(); + break; + case 9: + message.optimize_for = reader.int32(); + break; + case 11: + message.go_package = reader.string(); + break; + case 16: + message.cc_generic_services = reader.bool(); + break; + case 17: + message.java_generic_services = reader.bool(); + break; + case 18: + message.py_generic_services = reader.bool(); + break; + case 23: + message.deprecated = reader.bool(); + break; + case 31: + message.cc_enable_arenas = reader.bool(); + break; + case 36: + message.objc_class_prefix = reader.string(); + break; + case 37: + message.csharp_namespace = reader.string(); + break; + case 999: + if (!(message.uninterpreted_option && message.uninterpreted_option.length)) + message.uninterpreted_option = []; + message.uninterpreted_option.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + case 63001: + message[".gogoproto.goproto_getters_all"] = reader.bool(); + break; + case 63002: + message[".gogoproto.goproto_enum_prefix_all"] = reader.bool(); + break; + case 63003: + message[".gogoproto.goproto_stringer_all"] = reader.bool(); + break; + case 63004: + message[".gogoproto.verbose_equal_all"] = reader.bool(); + break; + case 63005: + message[".gogoproto.face_all"] = reader.bool(); + break; + case 63006: + message[".gogoproto.gostring_all"] = reader.bool(); + break; + case 63007: + message[".gogoproto.populate_all"] = reader.bool(); + break; + case 63008: + message[".gogoproto.stringer_all"] = reader.bool(); + break; + case 63009: + message[".gogoproto.onlyone_all"] = reader.bool(); + break; + case 63013: + message[".gogoproto.equal_all"] = reader.bool(); + break; + case 63014: + message[".gogoproto.description_all"] = reader.bool(); + break; + case 63015: + message[".gogoproto.testgen_all"] = reader.bool(); + break; + case 63016: + message[".gogoproto.benchgen_all"] = reader.bool(); + break; + case 63017: + message[".gogoproto.marshaler_all"] = reader.bool(); + break; + case 63018: + message[".gogoproto.unmarshaler_all"] = reader.bool(); + break; + case 63019: + message[".gogoproto.stable_marshaler_all"] = reader.bool(); + break; + case 63020: + message[".gogoproto.sizer_all"] = reader.bool(); + break; + case 63021: + message[".gogoproto.goproto_enum_stringer_all"] = reader.bool(); + break; + case 63022: + message[".gogoproto.enum_stringer_all"] = reader.bool(); + break; + case 63023: + message[".gogoproto.unsafe_marshaler_all"] = reader.bool(); + break; + case 63024: + message[".gogoproto.unsafe_unmarshaler_all"] = reader.bool(); + break; + case 63025: + message[".gogoproto.goproto_extensions_map_all"] = reader.bool(); + break; + case 63026: + message[".gogoproto.goproto_unrecognized_all"] = reader.bool(); + break; + case 63027: + message[".gogoproto.gogoproto_import"] = reader.bool(); + break; + case 63028: + message[".gogoproto.protosizer_all"] = reader.bool(); + break; + case 63029: + message[".gogoproto.compare_all"] = reader.bool(); + break; + case 63030: + message[".gogoproto.typedecl_all"] = reader.bool(); + break; + case 63031: + message[".gogoproto.enumdecl_all"] = reader.bool(); + break; + case 63032: + message[".gogoproto.goproto_registration"] = reader.bool(); + break; + case 63033: + message[".gogoproto.messagename_all"] = reader.bool(); + break; + case 63034: + message[".gogoproto.goproto_sizecache_all"] = reader.bool(); + break; + case 63035: + message[".gogoproto.goproto_unkeyed_all"] = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileOptions} FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileOptions message. + * @function verify + * @memberof google.protobuf.FileOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.java_package != null && message.hasOwnProperty("java_package")) + if (!$util.isString(message.java_package)) + return "java_package: string expected"; + if (message.java_outer_classname != null && message.hasOwnProperty("java_outer_classname")) + if (!$util.isString(message.java_outer_classname)) + return "java_outer_classname: string expected"; + if (message.java_multiple_files != null && message.hasOwnProperty("java_multiple_files")) + if (typeof message.java_multiple_files !== "boolean") + return "java_multiple_files: boolean expected"; + if (message.java_generate_equals_and_hash != null && message.hasOwnProperty("java_generate_equals_and_hash")) + if (typeof message.java_generate_equals_and_hash !== "boolean") + return "java_generate_equals_and_hash: boolean expected"; + if (message.java_string_check_utf8 != null && message.hasOwnProperty("java_string_check_utf8")) + if (typeof message.java_string_check_utf8 !== "boolean") + return "java_string_check_utf8: boolean expected"; + if (message.optimize_for != null && message.hasOwnProperty("optimize_for")) + switch (message.optimize_for) { + default: + return "optimize_for: enum value expected"; + case 1: + case 2: + case 3: + break; + } + if (message.go_package != null && message.hasOwnProperty("go_package")) + if (!$util.isString(message.go_package)) + return "go_package: string expected"; + if (message.cc_generic_services != null && message.hasOwnProperty("cc_generic_services")) + if (typeof message.cc_generic_services !== "boolean") + return "cc_generic_services: boolean expected"; + if (message.java_generic_services != null && message.hasOwnProperty("java_generic_services")) + if (typeof message.java_generic_services !== "boolean") + return "java_generic_services: boolean expected"; + if (message.py_generic_services != null && message.hasOwnProperty("py_generic_services")) + if (typeof message.py_generic_services !== "boolean") + return "py_generic_services: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.cc_enable_arenas != null && message.hasOwnProperty("cc_enable_arenas")) + if (typeof message.cc_enable_arenas !== "boolean") + return "cc_enable_arenas: boolean expected"; + if (message.objc_class_prefix != null && message.hasOwnProperty("objc_class_prefix")) + if (!$util.isString(message.objc_class_prefix)) + return "objc_class_prefix: string expected"; + if (message.csharp_namespace != null && message.hasOwnProperty("csharp_namespace")) + if (!$util.isString(message.csharp_namespace)) + return "csharp_namespace: string expected"; + if (message.uninterpreted_option != null && message.hasOwnProperty("uninterpreted_option")) { + if (!Array.isArray(message.uninterpreted_option)) + return "uninterpreted_option: array expected"; + for (let i = 0; i < message.uninterpreted_option.length; ++i) { + let error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpreted_option[i]); + if (error) + return "uninterpreted_option." + error; + } + } + if (message[".gogoproto.goproto_getters_all"] != null && message.hasOwnProperty(".gogoproto.goproto_getters_all")) + if (typeof message[".gogoproto.goproto_getters_all"] !== "boolean") + return ".gogoproto.goproto_getters_all: boolean expected"; + if (message[".gogoproto.goproto_enum_prefix_all"] != null && message.hasOwnProperty(".gogoproto.goproto_enum_prefix_all")) + if (typeof message[".gogoproto.goproto_enum_prefix_all"] !== "boolean") + return ".gogoproto.goproto_enum_prefix_all: boolean expected"; + if (message[".gogoproto.goproto_stringer_all"] != null && message.hasOwnProperty(".gogoproto.goproto_stringer_all")) + if (typeof message[".gogoproto.goproto_stringer_all"] !== "boolean") + return ".gogoproto.goproto_stringer_all: boolean expected"; + if (message[".gogoproto.verbose_equal_all"] != null && message.hasOwnProperty(".gogoproto.verbose_equal_all")) + if (typeof message[".gogoproto.verbose_equal_all"] !== "boolean") + return ".gogoproto.verbose_equal_all: boolean expected"; + if (message[".gogoproto.face_all"] != null && message.hasOwnProperty(".gogoproto.face_all")) + if (typeof message[".gogoproto.face_all"] !== "boolean") + return ".gogoproto.face_all: boolean expected"; + if (message[".gogoproto.gostring_all"] != null && message.hasOwnProperty(".gogoproto.gostring_all")) + if (typeof message[".gogoproto.gostring_all"] !== "boolean") + return ".gogoproto.gostring_all: boolean expected"; + if (message[".gogoproto.populate_all"] != null && message.hasOwnProperty(".gogoproto.populate_all")) + if (typeof message[".gogoproto.populate_all"] !== "boolean") + return ".gogoproto.populate_all: boolean expected"; + if (message[".gogoproto.stringer_all"] != null && message.hasOwnProperty(".gogoproto.stringer_all")) + if (typeof message[".gogoproto.stringer_all"] !== "boolean") + return ".gogoproto.stringer_all: boolean expected"; + if (message[".gogoproto.onlyone_all"] != null && message.hasOwnProperty(".gogoproto.onlyone_all")) + if (typeof message[".gogoproto.onlyone_all"] !== "boolean") + return ".gogoproto.onlyone_all: boolean expected"; + if (message[".gogoproto.equal_all"] != null && message.hasOwnProperty(".gogoproto.equal_all")) + if (typeof message[".gogoproto.equal_all"] !== "boolean") + return ".gogoproto.equal_all: boolean expected"; + if (message[".gogoproto.description_all"] != null && message.hasOwnProperty(".gogoproto.description_all")) + if (typeof message[".gogoproto.description_all"] !== "boolean") + return ".gogoproto.description_all: boolean expected"; + if (message[".gogoproto.testgen_all"] != null && message.hasOwnProperty(".gogoproto.testgen_all")) + if (typeof message[".gogoproto.testgen_all"] !== "boolean") + return ".gogoproto.testgen_all: boolean expected"; + if (message[".gogoproto.benchgen_all"] != null && message.hasOwnProperty(".gogoproto.benchgen_all")) + if (typeof message[".gogoproto.benchgen_all"] !== "boolean") + return ".gogoproto.benchgen_all: boolean expected"; + if (message[".gogoproto.marshaler_all"] != null && message.hasOwnProperty(".gogoproto.marshaler_all")) + if (typeof message[".gogoproto.marshaler_all"] !== "boolean") + return ".gogoproto.marshaler_all: boolean expected"; + if (message[".gogoproto.unmarshaler_all"] != null && message.hasOwnProperty(".gogoproto.unmarshaler_all")) + if (typeof message[".gogoproto.unmarshaler_all"] !== "boolean") + return ".gogoproto.unmarshaler_all: boolean expected"; + if (message[".gogoproto.stable_marshaler_all"] != null && message.hasOwnProperty(".gogoproto.stable_marshaler_all")) + if (typeof message[".gogoproto.stable_marshaler_all"] !== "boolean") + return ".gogoproto.stable_marshaler_all: boolean expected"; + if (message[".gogoproto.sizer_all"] != null && message.hasOwnProperty(".gogoproto.sizer_all")) + if (typeof message[".gogoproto.sizer_all"] !== "boolean") + return ".gogoproto.sizer_all: boolean expected"; + if (message[".gogoproto.goproto_enum_stringer_all"] != null && message.hasOwnProperty(".gogoproto.goproto_enum_stringer_all")) + if (typeof message[".gogoproto.goproto_enum_stringer_all"] !== "boolean") + return ".gogoproto.goproto_enum_stringer_all: boolean expected"; + if (message[".gogoproto.enum_stringer_all"] != null && message.hasOwnProperty(".gogoproto.enum_stringer_all")) + if (typeof message[".gogoproto.enum_stringer_all"] !== "boolean") + return ".gogoproto.enum_stringer_all: boolean expected"; + if (message[".gogoproto.unsafe_marshaler_all"] != null && message.hasOwnProperty(".gogoproto.unsafe_marshaler_all")) + if (typeof message[".gogoproto.unsafe_marshaler_all"] !== "boolean") + return ".gogoproto.unsafe_marshaler_all: boolean expected"; + if (message[".gogoproto.unsafe_unmarshaler_all"] != null && message.hasOwnProperty(".gogoproto.unsafe_unmarshaler_all")) + if (typeof message[".gogoproto.unsafe_unmarshaler_all"] !== "boolean") + return ".gogoproto.unsafe_unmarshaler_all: boolean expected"; + if (message[".gogoproto.goproto_extensions_map_all"] != null && message.hasOwnProperty(".gogoproto.goproto_extensions_map_all")) + if (typeof message[".gogoproto.goproto_extensions_map_all"] !== "boolean") + return ".gogoproto.goproto_extensions_map_all: boolean expected"; + if (message[".gogoproto.goproto_unrecognized_all"] != null && message.hasOwnProperty(".gogoproto.goproto_unrecognized_all")) + if (typeof message[".gogoproto.goproto_unrecognized_all"] !== "boolean") + return ".gogoproto.goproto_unrecognized_all: boolean expected"; + if (message[".gogoproto.gogoproto_import"] != null && message.hasOwnProperty(".gogoproto.gogoproto_import")) + if (typeof message[".gogoproto.gogoproto_import"] !== "boolean") + return ".gogoproto.gogoproto_import: boolean expected"; + if (message[".gogoproto.protosizer_all"] != null && message.hasOwnProperty(".gogoproto.protosizer_all")) + if (typeof message[".gogoproto.protosizer_all"] !== "boolean") + return ".gogoproto.protosizer_all: boolean expected"; + if (message[".gogoproto.compare_all"] != null && message.hasOwnProperty(".gogoproto.compare_all")) + if (typeof message[".gogoproto.compare_all"] !== "boolean") + return ".gogoproto.compare_all: boolean expected"; + if (message[".gogoproto.typedecl_all"] != null && message.hasOwnProperty(".gogoproto.typedecl_all")) + if (typeof message[".gogoproto.typedecl_all"] !== "boolean") + return ".gogoproto.typedecl_all: boolean expected"; + if (message[".gogoproto.enumdecl_all"] != null && message.hasOwnProperty(".gogoproto.enumdecl_all")) + if (typeof message[".gogoproto.enumdecl_all"] !== "boolean") + return ".gogoproto.enumdecl_all: boolean expected"; + if (message[".gogoproto.goproto_registration"] != null && message.hasOwnProperty(".gogoproto.goproto_registration")) + if (typeof message[".gogoproto.goproto_registration"] !== "boolean") + return ".gogoproto.goproto_registration: boolean expected"; + if (message[".gogoproto.messagename_all"] != null && message.hasOwnProperty(".gogoproto.messagename_all")) + if (typeof message[".gogoproto.messagename_all"] !== "boolean") + return ".gogoproto.messagename_all: boolean expected"; + if (message[".gogoproto.goproto_sizecache_all"] != null && message.hasOwnProperty(".gogoproto.goproto_sizecache_all")) + if (typeof message[".gogoproto.goproto_sizecache_all"] !== "boolean") + return ".gogoproto.goproto_sizecache_all: boolean expected"; + if (message[".gogoproto.goproto_unkeyed_all"] != null && message.hasOwnProperty(".gogoproto.goproto_unkeyed_all")) + if (typeof message[".gogoproto.goproto_unkeyed_all"] !== "boolean") + return ".gogoproto.goproto_unkeyed_all: boolean expected"; + return null; + }; + + /** + * Creates a FileOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileOptions} FileOptions + */ + FileOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileOptions) + return object; + let message = new $root.google.protobuf.FileOptions(); + if (object.java_package != null) + message.java_package = String(object.java_package); + if (object.java_outer_classname != null) + message.java_outer_classname = String(object.java_outer_classname); + if (object.java_multiple_files != null) + message.java_multiple_files = Boolean(object.java_multiple_files); + if (object.java_generate_equals_and_hash != null) + message.java_generate_equals_and_hash = Boolean(object.java_generate_equals_and_hash); + if (object.java_string_check_utf8 != null) + message.java_string_check_utf8 = Boolean(object.java_string_check_utf8); + switch (object.optimize_for) { + case "SPEED": + case 1: + message.optimize_for = 1; + break; + case "CODE_SIZE": + case 2: + message.optimize_for = 2; + break; + case "LITE_RUNTIME": + case 3: + message.optimize_for = 3; + break; + } + if (object.go_package != null) + message.go_package = String(object.go_package); + if (object.cc_generic_services != null) + message.cc_generic_services = Boolean(object.cc_generic_services); + if (object.java_generic_services != null) + message.java_generic_services = Boolean(object.java_generic_services); + if (object.py_generic_services != null) + message.py_generic_services = Boolean(object.py_generic_services); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.cc_enable_arenas != null) + message.cc_enable_arenas = Boolean(object.cc_enable_arenas); + if (object.objc_class_prefix != null) + message.objc_class_prefix = String(object.objc_class_prefix); + if (object.csharp_namespace != null) + message.csharp_namespace = String(object.csharp_namespace); + if (object.uninterpreted_option) { + if (!Array.isArray(object.uninterpreted_option)) + throw TypeError(".google.protobuf.FileOptions.uninterpreted_option: array expected"); + message.uninterpreted_option = []; + for (let i = 0; i < object.uninterpreted_option.length; ++i) { + if (typeof object.uninterpreted_option[i] !== "object") + throw TypeError(".google.protobuf.FileOptions.uninterpreted_option: object expected"); + message.uninterpreted_option[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpreted_option[i]); + } + } + if (object[".gogoproto.goproto_getters_all"] != null) + message[".gogoproto.goproto_getters_all"] = Boolean(object[".gogoproto.goproto_getters_all"]); + if (object[".gogoproto.goproto_enum_prefix_all"] != null) + message[".gogoproto.goproto_enum_prefix_all"] = Boolean(object[".gogoproto.goproto_enum_prefix_all"]); + if (object[".gogoproto.goproto_stringer_all"] != null) + message[".gogoproto.goproto_stringer_all"] = Boolean(object[".gogoproto.goproto_stringer_all"]); + if (object[".gogoproto.verbose_equal_all"] != null) + message[".gogoproto.verbose_equal_all"] = Boolean(object[".gogoproto.verbose_equal_all"]); + if (object[".gogoproto.face_all"] != null) + message[".gogoproto.face_all"] = Boolean(object[".gogoproto.face_all"]); + if (object[".gogoproto.gostring_all"] != null) + message[".gogoproto.gostring_all"] = Boolean(object[".gogoproto.gostring_all"]); + if (object[".gogoproto.populate_all"] != null) + message[".gogoproto.populate_all"] = Boolean(object[".gogoproto.populate_all"]); + if (object[".gogoproto.stringer_all"] != null) + message[".gogoproto.stringer_all"] = Boolean(object[".gogoproto.stringer_all"]); + if (object[".gogoproto.onlyone_all"] != null) + message[".gogoproto.onlyone_all"] = Boolean(object[".gogoproto.onlyone_all"]); + if (object[".gogoproto.equal_all"] != null) + message[".gogoproto.equal_all"] = Boolean(object[".gogoproto.equal_all"]); + if (object[".gogoproto.description_all"] != null) + message[".gogoproto.description_all"] = Boolean(object[".gogoproto.description_all"]); + if (object[".gogoproto.testgen_all"] != null) + message[".gogoproto.testgen_all"] = Boolean(object[".gogoproto.testgen_all"]); + if (object[".gogoproto.benchgen_all"] != null) + message[".gogoproto.benchgen_all"] = Boolean(object[".gogoproto.benchgen_all"]); + if (object[".gogoproto.marshaler_all"] != null) + message[".gogoproto.marshaler_all"] = Boolean(object[".gogoproto.marshaler_all"]); + if (object[".gogoproto.unmarshaler_all"] != null) + message[".gogoproto.unmarshaler_all"] = Boolean(object[".gogoproto.unmarshaler_all"]); + if (object[".gogoproto.stable_marshaler_all"] != null) + message[".gogoproto.stable_marshaler_all"] = Boolean(object[".gogoproto.stable_marshaler_all"]); + if (object[".gogoproto.sizer_all"] != null) + message[".gogoproto.sizer_all"] = Boolean(object[".gogoproto.sizer_all"]); + if (object[".gogoproto.goproto_enum_stringer_all"] != null) + message[".gogoproto.goproto_enum_stringer_all"] = Boolean(object[".gogoproto.goproto_enum_stringer_all"]); + if (object[".gogoproto.enum_stringer_all"] != null) + message[".gogoproto.enum_stringer_all"] = Boolean(object[".gogoproto.enum_stringer_all"]); + if (object[".gogoproto.unsafe_marshaler_all"] != null) + message[".gogoproto.unsafe_marshaler_all"] = Boolean(object[".gogoproto.unsafe_marshaler_all"]); + if (object[".gogoproto.unsafe_unmarshaler_all"] != null) + message[".gogoproto.unsafe_unmarshaler_all"] = Boolean(object[".gogoproto.unsafe_unmarshaler_all"]); + if (object[".gogoproto.goproto_extensions_map_all"] != null) + message[".gogoproto.goproto_extensions_map_all"] = Boolean(object[".gogoproto.goproto_extensions_map_all"]); + if (object[".gogoproto.goproto_unrecognized_all"] != null) + message[".gogoproto.goproto_unrecognized_all"] = Boolean(object[".gogoproto.goproto_unrecognized_all"]); + if (object[".gogoproto.gogoproto_import"] != null) + message[".gogoproto.gogoproto_import"] = Boolean(object[".gogoproto.gogoproto_import"]); + if (object[".gogoproto.protosizer_all"] != null) + message[".gogoproto.protosizer_all"] = Boolean(object[".gogoproto.protosizer_all"]); + if (object[".gogoproto.compare_all"] != null) + message[".gogoproto.compare_all"] = Boolean(object[".gogoproto.compare_all"]); + if (object[".gogoproto.typedecl_all"] != null) + message[".gogoproto.typedecl_all"] = Boolean(object[".gogoproto.typedecl_all"]); + if (object[".gogoproto.enumdecl_all"] != null) + message[".gogoproto.enumdecl_all"] = Boolean(object[".gogoproto.enumdecl_all"]); + if (object[".gogoproto.goproto_registration"] != null) + message[".gogoproto.goproto_registration"] = Boolean(object[".gogoproto.goproto_registration"]); + if (object[".gogoproto.messagename_all"] != null) + message[".gogoproto.messagename_all"] = Boolean(object[".gogoproto.messagename_all"]); + if (object[".gogoproto.goproto_sizecache_all"] != null) + message[".gogoproto.goproto_sizecache_all"] = Boolean(object[".gogoproto.goproto_sizecache_all"]); + if (object[".gogoproto.goproto_unkeyed_all"] != null) + message[".gogoproto.goproto_unkeyed_all"] = Boolean(object[".gogoproto.goproto_unkeyed_all"]); + return message; + }; + + /** + * Creates a plain object from a FileOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.FileOptions} message FileOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.uninterpreted_option = []; + if (options.defaults) { + object.java_package = ""; + object.java_outer_classname = ""; + object.optimize_for = options.enums === String ? "SPEED" : 1; + object.java_multiple_files = false; + object.go_package = ""; + object.cc_generic_services = false; + object.java_generic_services = false; + object.py_generic_services = false; + object.java_generate_equals_and_hash = false; + object.deprecated = false; + object.java_string_check_utf8 = false; + object.cc_enable_arenas = false; + object.objc_class_prefix = ""; + object.csharp_namespace = ""; + object[".gogoproto.goproto_getters_all"] = false; + object[".gogoproto.goproto_enum_prefix_all"] = false; + object[".gogoproto.goproto_stringer_all"] = false; + object[".gogoproto.verbose_equal_all"] = false; + object[".gogoproto.face_all"] = false; + object[".gogoproto.gostring_all"] = false; + object[".gogoproto.populate_all"] = false; + object[".gogoproto.stringer_all"] = false; + object[".gogoproto.onlyone_all"] = false; + object[".gogoproto.equal_all"] = false; + object[".gogoproto.description_all"] = false; + object[".gogoproto.testgen_all"] = false; + object[".gogoproto.benchgen_all"] = false; + object[".gogoproto.marshaler_all"] = false; + object[".gogoproto.unmarshaler_all"] = false; + object[".gogoproto.stable_marshaler_all"] = false; + object[".gogoproto.sizer_all"] = false; + object[".gogoproto.goproto_enum_stringer_all"] = false; + object[".gogoproto.enum_stringer_all"] = false; + object[".gogoproto.unsafe_marshaler_all"] = false; + object[".gogoproto.unsafe_unmarshaler_all"] = false; + object[".gogoproto.goproto_extensions_map_all"] = false; + object[".gogoproto.goproto_unrecognized_all"] = false; + object[".gogoproto.gogoproto_import"] = false; + object[".gogoproto.protosizer_all"] = false; + object[".gogoproto.compare_all"] = false; + object[".gogoproto.typedecl_all"] = false; + object[".gogoproto.enumdecl_all"] = false; + object[".gogoproto.goproto_registration"] = false; + object[".gogoproto.messagename_all"] = false; + object[".gogoproto.goproto_sizecache_all"] = false; + object[".gogoproto.goproto_unkeyed_all"] = false; + } + if (message.java_package != null && message.hasOwnProperty("java_package")) + object.java_package = message.java_package; + if (message.java_outer_classname != null && message.hasOwnProperty("java_outer_classname")) + object.java_outer_classname = message.java_outer_classname; + if (message.optimize_for != null && message.hasOwnProperty("optimize_for")) + object.optimize_for = options.enums === String ? $root.google.protobuf.FileOptions.OptimizeMode[message.optimize_for] : message.optimize_for; + if (message.java_multiple_files != null && message.hasOwnProperty("java_multiple_files")) + object.java_multiple_files = message.java_multiple_files; + if (message.go_package != null && message.hasOwnProperty("go_package")) + object.go_package = message.go_package; + if (message.cc_generic_services != null && message.hasOwnProperty("cc_generic_services")) + object.cc_generic_services = message.cc_generic_services; + if (message.java_generic_services != null && message.hasOwnProperty("java_generic_services")) + object.java_generic_services = message.java_generic_services; + if (message.py_generic_services != null && message.hasOwnProperty("py_generic_services")) + object.py_generic_services = message.py_generic_services; + if (message.java_generate_equals_and_hash != null && message.hasOwnProperty("java_generate_equals_and_hash")) + object.java_generate_equals_and_hash = message.java_generate_equals_and_hash; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.java_string_check_utf8 != null && message.hasOwnProperty("java_string_check_utf8")) + object.java_string_check_utf8 = message.java_string_check_utf8; + if (message.cc_enable_arenas != null && message.hasOwnProperty("cc_enable_arenas")) + object.cc_enable_arenas = message.cc_enable_arenas; + if (message.objc_class_prefix != null && message.hasOwnProperty("objc_class_prefix")) + object.objc_class_prefix = message.objc_class_prefix; + if (message.csharp_namespace != null && message.hasOwnProperty("csharp_namespace")) + object.csharp_namespace = message.csharp_namespace; + if (message.uninterpreted_option && message.uninterpreted_option.length) { + object.uninterpreted_option = []; + for (let j = 0; j < message.uninterpreted_option.length; ++j) + object.uninterpreted_option[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpreted_option[j], options); + } + if (message[".gogoproto.goproto_getters_all"] != null && message.hasOwnProperty(".gogoproto.goproto_getters_all")) + object[".gogoproto.goproto_getters_all"] = message[".gogoproto.goproto_getters_all"]; + if (message[".gogoproto.goproto_enum_prefix_all"] != null && message.hasOwnProperty(".gogoproto.goproto_enum_prefix_all")) + object[".gogoproto.goproto_enum_prefix_all"] = message[".gogoproto.goproto_enum_prefix_all"]; + if (message[".gogoproto.goproto_stringer_all"] != null && message.hasOwnProperty(".gogoproto.goproto_stringer_all")) + object[".gogoproto.goproto_stringer_all"] = message[".gogoproto.goproto_stringer_all"]; + if (message[".gogoproto.verbose_equal_all"] != null && message.hasOwnProperty(".gogoproto.verbose_equal_all")) + object[".gogoproto.verbose_equal_all"] = message[".gogoproto.verbose_equal_all"]; + if (message[".gogoproto.face_all"] != null && message.hasOwnProperty(".gogoproto.face_all")) + object[".gogoproto.face_all"] = message[".gogoproto.face_all"]; + if (message[".gogoproto.gostring_all"] != null && message.hasOwnProperty(".gogoproto.gostring_all")) + object[".gogoproto.gostring_all"] = message[".gogoproto.gostring_all"]; + if (message[".gogoproto.populate_all"] != null && message.hasOwnProperty(".gogoproto.populate_all")) + object[".gogoproto.populate_all"] = message[".gogoproto.populate_all"]; + if (message[".gogoproto.stringer_all"] != null && message.hasOwnProperty(".gogoproto.stringer_all")) + object[".gogoproto.stringer_all"] = message[".gogoproto.stringer_all"]; + if (message[".gogoproto.onlyone_all"] != null && message.hasOwnProperty(".gogoproto.onlyone_all")) + object[".gogoproto.onlyone_all"] = message[".gogoproto.onlyone_all"]; + if (message[".gogoproto.equal_all"] != null && message.hasOwnProperty(".gogoproto.equal_all")) + object[".gogoproto.equal_all"] = message[".gogoproto.equal_all"]; + if (message[".gogoproto.description_all"] != null && message.hasOwnProperty(".gogoproto.description_all")) + object[".gogoproto.description_all"] = message[".gogoproto.description_all"]; + if (message[".gogoproto.testgen_all"] != null && message.hasOwnProperty(".gogoproto.testgen_all")) + object[".gogoproto.testgen_all"] = message[".gogoproto.testgen_all"]; + if (message[".gogoproto.benchgen_all"] != null && message.hasOwnProperty(".gogoproto.benchgen_all")) + object[".gogoproto.benchgen_all"] = message[".gogoproto.benchgen_all"]; + if (message[".gogoproto.marshaler_all"] != null && message.hasOwnProperty(".gogoproto.marshaler_all")) + object[".gogoproto.marshaler_all"] = message[".gogoproto.marshaler_all"]; + if (message[".gogoproto.unmarshaler_all"] != null && message.hasOwnProperty(".gogoproto.unmarshaler_all")) + object[".gogoproto.unmarshaler_all"] = message[".gogoproto.unmarshaler_all"]; + if (message[".gogoproto.stable_marshaler_all"] != null && message.hasOwnProperty(".gogoproto.stable_marshaler_all")) + object[".gogoproto.stable_marshaler_all"] = message[".gogoproto.stable_marshaler_all"]; + if (message[".gogoproto.sizer_all"] != null && message.hasOwnProperty(".gogoproto.sizer_all")) + object[".gogoproto.sizer_all"] = message[".gogoproto.sizer_all"]; + if (message[".gogoproto.goproto_enum_stringer_all"] != null && message.hasOwnProperty(".gogoproto.goproto_enum_stringer_all")) + object[".gogoproto.goproto_enum_stringer_all"] = message[".gogoproto.goproto_enum_stringer_all"]; + if (message[".gogoproto.enum_stringer_all"] != null && message.hasOwnProperty(".gogoproto.enum_stringer_all")) + object[".gogoproto.enum_stringer_all"] = message[".gogoproto.enum_stringer_all"]; + if (message[".gogoproto.unsafe_marshaler_all"] != null && message.hasOwnProperty(".gogoproto.unsafe_marshaler_all")) + object[".gogoproto.unsafe_marshaler_all"] = message[".gogoproto.unsafe_marshaler_all"]; + if (message[".gogoproto.unsafe_unmarshaler_all"] != null && message.hasOwnProperty(".gogoproto.unsafe_unmarshaler_all")) + object[".gogoproto.unsafe_unmarshaler_all"] = message[".gogoproto.unsafe_unmarshaler_all"]; + if (message[".gogoproto.goproto_extensions_map_all"] != null && message.hasOwnProperty(".gogoproto.goproto_extensions_map_all")) + object[".gogoproto.goproto_extensions_map_all"] = message[".gogoproto.goproto_extensions_map_all"]; + if (message[".gogoproto.goproto_unrecognized_all"] != null && message.hasOwnProperty(".gogoproto.goproto_unrecognized_all")) + object[".gogoproto.goproto_unrecognized_all"] = message[".gogoproto.goproto_unrecognized_all"]; + if (message[".gogoproto.gogoproto_import"] != null && message.hasOwnProperty(".gogoproto.gogoproto_import")) + object[".gogoproto.gogoproto_import"] = message[".gogoproto.gogoproto_import"]; + if (message[".gogoproto.protosizer_all"] != null && message.hasOwnProperty(".gogoproto.protosizer_all")) + object[".gogoproto.protosizer_all"] = message[".gogoproto.protosizer_all"]; + if (message[".gogoproto.compare_all"] != null && message.hasOwnProperty(".gogoproto.compare_all")) + object[".gogoproto.compare_all"] = message[".gogoproto.compare_all"]; + if (message[".gogoproto.typedecl_all"] != null && message.hasOwnProperty(".gogoproto.typedecl_all")) + object[".gogoproto.typedecl_all"] = message[".gogoproto.typedecl_all"]; + if (message[".gogoproto.enumdecl_all"] != null && message.hasOwnProperty(".gogoproto.enumdecl_all")) + object[".gogoproto.enumdecl_all"] = message[".gogoproto.enumdecl_all"]; + if (message[".gogoproto.goproto_registration"] != null && message.hasOwnProperty(".gogoproto.goproto_registration")) + object[".gogoproto.goproto_registration"] = message[".gogoproto.goproto_registration"]; + if (message[".gogoproto.messagename_all"] != null && message.hasOwnProperty(".gogoproto.messagename_all")) + object[".gogoproto.messagename_all"] = message[".gogoproto.messagename_all"]; + if (message[".gogoproto.goproto_sizecache_all"] != null && message.hasOwnProperty(".gogoproto.goproto_sizecache_all")) + object[".gogoproto.goproto_sizecache_all"] = message[".gogoproto.goproto_sizecache_all"]; + if (message[".gogoproto.goproto_unkeyed_all"] != null && message.hasOwnProperty(".gogoproto.goproto_unkeyed_all")) + object[".gogoproto.goproto_unkeyed_all"] = message[".gogoproto.goproto_unkeyed_all"]; + return object; + }; + + /** + * Converts this FileOptions to JSON. + * @function toJSON + * @memberof google.protobuf.FileOptions + * @instance + * @returns {Object.} JSON object + */ + FileOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * OptimizeMode enum. + * @name google.protobuf.FileOptions.OptimizeMode + * @enum {number} + * @property {number} SPEED=1 SPEED value + * @property {number} CODE_SIZE=2 CODE_SIZE value + * @property {number} LITE_RUNTIME=3 LITE_RUNTIME value + */ + FileOptions.OptimizeMode = (function() { + const valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "SPEED"] = 1; + values[valuesById[2] = "CODE_SIZE"] = 2; + values[valuesById[3] = "LITE_RUNTIME"] = 3; + return values; + })(); + + return FileOptions; + })(); + + protobuf.MessageOptions = (function() { + + /** + * Properties of a MessageOptions. + * @memberof google.protobuf + * @interface IMessageOptions + * @property {boolean|null} [message_set_wire_format] MessageOptions message_set_wire_format + * @property {boolean|null} [no_standard_descriptor_accessor] MessageOptions no_standard_descriptor_accessor + * @property {boolean|null} [deprecated] MessageOptions deprecated + * @property {boolean|null} [map_entry] MessageOptions map_entry + * @property {Array.|null} [uninterpreted_option] MessageOptions uninterpreted_option + * @property {string|null} [".cosmos_proto.interface_type"] MessageOptions .cosmos_proto.interface_type + * @property {string|null} [".cosmos_proto.implements_interface"] MessageOptions .cosmos_proto.implements_interface + * @property {boolean|null} [".gogoproto.goproto_getters"] MessageOptions .gogoproto.goproto_getters + * @property {boolean|null} [".gogoproto.goproto_stringer"] MessageOptions .gogoproto.goproto_stringer + * @property {boolean|null} [".gogoproto.verbose_equal"] MessageOptions .gogoproto.verbose_equal + * @property {boolean|null} [".gogoproto.face"] MessageOptions .gogoproto.face + * @property {boolean|null} [".gogoproto.gostring"] MessageOptions .gogoproto.gostring + * @property {boolean|null} [".gogoproto.populate"] MessageOptions .gogoproto.populate + * @property {boolean|null} [".gogoproto.stringer"] MessageOptions .gogoproto.stringer + * @property {boolean|null} [".gogoproto.onlyone"] MessageOptions .gogoproto.onlyone + * @property {boolean|null} [".gogoproto.equal"] MessageOptions .gogoproto.equal + * @property {boolean|null} [".gogoproto.description"] MessageOptions .gogoproto.description + * @property {boolean|null} [".gogoproto.testgen"] MessageOptions .gogoproto.testgen + * @property {boolean|null} [".gogoproto.benchgen"] MessageOptions .gogoproto.benchgen + * @property {boolean|null} [".gogoproto.marshaler"] MessageOptions .gogoproto.marshaler + * @property {boolean|null} [".gogoproto.unmarshaler"] MessageOptions .gogoproto.unmarshaler + * @property {boolean|null} [".gogoproto.stable_marshaler"] MessageOptions .gogoproto.stable_marshaler + * @property {boolean|null} [".gogoproto.sizer"] MessageOptions .gogoproto.sizer + * @property {boolean|null} [".gogoproto.unsafe_marshaler"] MessageOptions .gogoproto.unsafe_marshaler + * @property {boolean|null} [".gogoproto.unsafe_unmarshaler"] MessageOptions .gogoproto.unsafe_unmarshaler + * @property {boolean|null} [".gogoproto.goproto_extensions_map"] MessageOptions .gogoproto.goproto_extensions_map + * @property {boolean|null} [".gogoproto.goproto_unrecognized"] MessageOptions .gogoproto.goproto_unrecognized + * @property {boolean|null} [".gogoproto.protosizer"] MessageOptions .gogoproto.protosizer + * @property {boolean|null} [".gogoproto.compare"] MessageOptions .gogoproto.compare + * @property {boolean|null} [".gogoproto.typedecl"] MessageOptions .gogoproto.typedecl + * @property {boolean|null} [".gogoproto.messagename"] MessageOptions .gogoproto.messagename + * @property {boolean|null} [".gogoproto.goproto_sizecache"] MessageOptions .gogoproto.goproto_sizecache + * @property {boolean|null} [".gogoproto.goproto_unkeyed"] MessageOptions .gogoproto.goproto_unkeyed + */ + + /** + * Constructs a new MessageOptions. + * @memberof google.protobuf + * @classdesc Represents a MessageOptions. + * @implements IMessageOptions + * @constructor + * @param {google.protobuf.IMessageOptions=} [properties] Properties to set + */ + function MessageOptions(properties) { + this.uninterpreted_option = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MessageOptions message_set_wire_format. + * @member {boolean} message_set_wire_format + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.message_set_wire_format = false; + + /** + * MessageOptions no_standard_descriptor_accessor. + * @member {boolean} no_standard_descriptor_accessor + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.no_standard_descriptor_accessor = false; + + /** + * MessageOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.deprecated = false; + + /** + * MessageOptions map_entry. + * @member {boolean} map_entry + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.map_entry = false; + + /** + * MessageOptions uninterpreted_option. + * @member {Array.} uninterpreted_option + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.uninterpreted_option = $util.emptyArray; + + /** + * MessageOptions .cosmos_proto.interface_type. + * @member {string} .cosmos_proto.interface_type + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".cosmos_proto.interface_type"] = ""; + + /** + * MessageOptions .cosmos_proto.implements_interface. + * @member {string} .cosmos_proto.implements_interface + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".cosmos_proto.implements_interface"] = ""; + + /** + * MessageOptions .gogoproto.goproto_getters. + * @member {boolean} .gogoproto.goproto_getters + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".gogoproto.goproto_getters"] = false; + + /** + * MessageOptions .gogoproto.goproto_stringer. + * @member {boolean} .gogoproto.goproto_stringer + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".gogoproto.goproto_stringer"] = false; + + /** + * MessageOptions .gogoproto.verbose_equal. + * @member {boolean} .gogoproto.verbose_equal + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".gogoproto.verbose_equal"] = false; + + /** + * MessageOptions .gogoproto.face. + * @member {boolean} .gogoproto.face + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".gogoproto.face"] = false; + + /** + * MessageOptions .gogoproto.gostring. + * @member {boolean} .gogoproto.gostring + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".gogoproto.gostring"] = false; + + /** + * MessageOptions .gogoproto.populate. + * @member {boolean} .gogoproto.populate + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".gogoproto.populate"] = false; + + /** + * MessageOptions .gogoproto.stringer. + * @member {boolean} .gogoproto.stringer + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".gogoproto.stringer"] = false; + + /** + * MessageOptions .gogoproto.onlyone. + * @member {boolean} .gogoproto.onlyone + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".gogoproto.onlyone"] = false; + + /** + * MessageOptions .gogoproto.equal. + * @member {boolean} .gogoproto.equal + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".gogoproto.equal"] = false; + + /** + * MessageOptions .gogoproto.description. + * @member {boolean} .gogoproto.description + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".gogoproto.description"] = false; + + /** + * MessageOptions .gogoproto.testgen. + * @member {boolean} .gogoproto.testgen + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".gogoproto.testgen"] = false; + + /** + * MessageOptions .gogoproto.benchgen. + * @member {boolean} .gogoproto.benchgen + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".gogoproto.benchgen"] = false; + + /** + * MessageOptions .gogoproto.marshaler. + * @member {boolean} .gogoproto.marshaler + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".gogoproto.marshaler"] = false; + + /** + * MessageOptions .gogoproto.unmarshaler. + * @member {boolean} .gogoproto.unmarshaler + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".gogoproto.unmarshaler"] = false; + + /** + * MessageOptions .gogoproto.stable_marshaler. + * @member {boolean} .gogoproto.stable_marshaler + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".gogoproto.stable_marshaler"] = false; + + /** + * MessageOptions .gogoproto.sizer. + * @member {boolean} .gogoproto.sizer + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".gogoproto.sizer"] = false; + + /** + * MessageOptions .gogoproto.unsafe_marshaler. + * @member {boolean} .gogoproto.unsafe_marshaler + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".gogoproto.unsafe_marshaler"] = false; + + /** + * MessageOptions .gogoproto.unsafe_unmarshaler. + * @member {boolean} .gogoproto.unsafe_unmarshaler + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".gogoproto.unsafe_unmarshaler"] = false; + + /** + * MessageOptions .gogoproto.goproto_extensions_map. + * @member {boolean} .gogoproto.goproto_extensions_map + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".gogoproto.goproto_extensions_map"] = false; + + /** + * MessageOptions .gogoproto.goproto_unrecognized. + * @member {boolean} .gogoproto.goproto_unrecognized + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".gogoproto.goproto_unrecognized"] = false; + + /** + * MessageOptions .gogoproto.protosizer. + * @member {boolean} .gogoproto.protosizer + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".gogoproto.protosizer"] = false; + + /** + * MessageOptions .gogoproto.compare. + * @member {boolean} .gogoproto.compare + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".gogoproto.compare"] = false; + + /** + * MessageOptions .gogoproto.typedecl. + * @member {boolean} .gogoproto.typedecl + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".gogoproto.typedecl"] = false; + + /** + * MessageOptions .gogoproto.messagename. + * @member {boolean} .gogoproto.messagename + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".gogoproto.messagename"] = false; + + /** + * MessageOptions .gogoproto.goproto_sizecache. + * @member {boolean} .gogoproto.goproto_sizecache + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".gogoproto.goproto_sizecache"] = false; + + /** + * MessageOptions .gogoproto.goproto_unkeyed. + * @member {boolean} .gogoproto.goproto_unkeyed + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".gogoproto.goproto_unkeyed"] = false; + + /** + * Encodes the specified MessageOptions message. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.message_set_wire_format != null && Object.hasOwnProperty.call(message, "message_set_wire_format")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.message_set_wire_format); + if (message.no_standard_descriptor_accessor != null && Object.hasOwnProperty.call(message, "no_standard_descriptor_accessor")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.no_standard_descriptor_accessor); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.map_entry != null && Object.hasOwnProperty.call(message, "map_entry")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.map_entry); + if (message.uninterpreted_option != null && message.uninterpreted_option.length) + for (let i = 0; i < message.uninterpreted_option.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpreted_option[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".gogoproto.goproto_getters"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_getters")) + writer.uint32(/* id 64001, wireType 0 =*/512008).bool(message[".gogoproto.goproto_getters"]); + if (message[".gogoproto.goproto_stringer"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_stringer")) + writer.uint32(/* id 64003, wireType 0 =*/512024).bool(message[".gogoproto.goproto_stringer"]); + if (message[".gogoproto.verbose_equal"] != null && Object.hasOwnProperty.call(message, ".gogoproto.verbose_equal")) + writer.uint32(/* id 64004, wireType 0 =*/512032).bool(message[".gogoproto.verbose_equal"]); + if (message[".gogoproto.face"] != null && Object.hasOwnProperty.call(message, ".gogoproto.face")) + writer.uint32(/* id 64005, wireType 0 =*/512040).bool(message[".gogoproto.face"]); + if (message[".gogoproto.gostring"] != null && Object.hasOwnProperty.call(message, ".gogoproto.gostring")) + writer.uint32(/* id 64006, wireType 0 =*/512048).bool(message[".gogoproto.gostring"]); + if (message[".gogoproto.populate"] != null && Object.hasOwnProperty.call(message, ".gogoproto.populate")) + writer.uint32(/* id 64007, wireType 0 =*/512056).bool(message[".gogoproto.populate"]); + if (message[".gogoproto.onlyone"] != null && Object.hasOwnProperty.call(message, ".gogoproto.onlyone")) + writer.uint32(/* id 64009, wireType 0 =*/512072).bool(message[".gogoproto.onlyone"]); + if (message[".gogoproto.equal"] != null && Object.hasOwnProperty.call(message, ".gogoproto.equal")) + writer.uint32(/* id 64013, wireType 0 =*/512104).bool(message[".gogoproto.equal"]); + if (message[".gogoproto.description"] != null && Object.hasOwnProperty.call(message, ".gogoproto.description")) + writer.uint32(/* id 64014, wireType 0 =*/512112).bool(message[".gogoproto.description"]); + if (message[".gogoproto.testgen"] != null && Object.hasOwnProperty.call(message, ".gogoproto.testgen")) + writer.uint32(/* id 64015, wireType 0 =*/512120).bool(message[".gogoproto.testgen"]); + if (message[".gogoproto.benchgen"] != null && Object.hasOwnProperty.call(message, ".gogoproto.benchgen")) + writer.uint32(/* id 64016, wireType 0 =*/512128).bool(message[".gogoproto.benchgen"]); + if (message[".gogoproto.marshaler"] != null && Object.hasOwnProperty.call(message, ".gogoproto.marshaler")) + writer.uint32(/* id 64017, wireType 0 =*/512136).bool(message[".gogoproto.marshaler"]); + if (message[".gogoproto.unmarshaler"] != null && Object.hasOwnProperty.call(message, ".gogoproto.unmarshaler")) + writer.uint32(/* id 64018, wireType 0 =*/512144).bool(message[".gogoproto.unmarshaler"]); + if (message[".gogoproto.stable_marshaler"] != null && Object.hasOwnProperty.call(message, ".gogoproto.stable_marshaler")) + writer.uint32(/* id 64019, wireType 0 =*/512152).bool(message[".gogoproto.stable_marshaler"]); + if (message[".gogoproto.sizer"] != null && Object.hasOwnProperty.call(message, ".gogoproto.sizer")) + writer.uint32(/* id 64020, wireType 0 =*/512160).bool(message[".gogoproto.sizer"]); + if (message[".gogoproto.unsafe_marshaler"] != null && Object.hasOwnProperty.call(message, ".gogoproto.unsafe_marshaler")) + writer.uint32(/* id 64023, wireType 0 =*/512184).bool(message[".gogoproto.unsafe_marshaler"]); + if (message[".gogoproto.unsafe_unmarshaler"] != null && Object.hasOwnProperty.call(message, ".gogoproto.unsafe_unmarshaler")) + writer.uint32(/* id 64024, wireType 0 =*/512192).bool(message[".gogoproto.unsafe_unmarshaler"]); + if (message[".gogoproto.goproto_extensions_map"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_extensions_map")) + writer.uint32(/* id 64025, wireType 0 =*/512200).bool(message[".gogoproto.goproto_extensions_map"]); + if (message[".gogoproto.goproto_unrecognized"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_unrecognized")) + writer.uint32(/* id 64026, wireType 0 =*/512208).bool(message[".gogoproto.goproto_unrecognized"]); + if (message[".gogoproto.protosizer"] != null && Object.hasOwnProperty.call(message, ".gogoproto.protosizer")) + writer.uint32(/* id 64028, wireType 0 =*/512224).bool(message[".gogoproto.protosizer"]); + if (message[".gogoproto.compare"] != null && Object.hasOwnProperty.call(message, ".gogoproto.compare")) + writer.uint32(/* id 64029, wireType 0 =*/512232).bool(message[".gogoproto.compare"]); + if (message[".gogoproto.typedecl"] != null && Object.hasOwnProperty.call(message, ".gogoproto.typedecl")) + writer.uint32(/* id 64030, wireType 0 =*/512240).bool(message[".gogoproto.typedecl"]); + if (message[".gogoproto.messagename"] != null && Object.hasOwnProperty.call(message, ".gogoproto.messagename")) + writer.uint32(/* id 64033, wireType 0 =*/512264).bool(message[".gogoproto.messagename"]); + if (message[".gogoproto.goproto_sizecache"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_sizecache")) + writer.uint32(/* id 64034, wireType 0 =*/512272).bool(message[".gogoproto.goproto_sizecache"]); + if (message[".gogoproto.goproto_unkeyed"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_unkeyed")) + writer.uint32(/* id 64035, wireType 0 =*/512280).bool(message[".gogoproto.goproto_unkeyed"]); + if (message[".gogoproto.stringer"] != null && Object.hasOwnProperty.call(message, ".gogoproto.stringer")) + writer.uint32(/* id 67008, wireType 0 =*/536064).bool(message[".gogoproto.stringer"]); + if (message[".cosmos_proto.interface_type"] != null && Object.hasOwnProperty.call(message, ".cosmos_proto.interface_type")) + writer.uint32(/* id 93001, wireType 2 =*/744010).string(message[".cosmos_proto.interface_type"]); + if (message[".cosmos_proto.implements_interface"] != null && Object.hasOwnProperty.call(message, ".cosmos_proto.implements_interface")) + writer.uint32(/* id 93002, wireType 2 =*/744018).string(message[".cosmos_proto.implements_interface"]); + return writer; + }; + + /** + * Encodes the specified MessageOptions message, length delimited. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MessageOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MessageOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MessageOptions} MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MessageOptions(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.message_set_wire_format = reader.bool(); + break; + case 2: + message.no_standard_descriptor_accessor = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 7: + message.map_entry = reader.bool(); + break; + case 999: + if (!(message.uninterpreted_option && message.uninterpreted_option.length)) + message.uninterpreted_option = []; + message.uninterpreted_option.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + case 93001: + message[".cosmos_proto.interface_type"] = reader.string(); + break; + case 93002: + message[".cosmos_proto.implements_interface"] = reader.string(); + break; + case 64001: + message[".gogoproto.goproto_getters"] = reader.bool(); + break; + case 64003: + message[".gogoproto.goproto_stringer"] = reader.bool(); + break; + case 64004: + message[".gogoproto.verbose_equal"] = reader.bool(); + break; + case 64005: + message[".gogoproto.face"] = reader.bool(); + break; + case 64006: + message[".gogoproto.gostring"] = reader.bool(); + break; + case 64007: + message[".gogoproto.populate"] = reader.bool(); + break; + case 67008: + message[".gogoproto.stringer"] = reader.bool(); + break; + case 64009: + message[".gogoproto.onlyone"] = reader.bool(); + break; + case 64013: + message[".gogoproto.equal"] = reader.bool(); + break; + case 64014: + message[".gogoproto.description"] = reader.bool(); + break; + case 64015: + message[".gogoproto.testgen"] = reader.bool(); + break; + case 64016: + message[".gogoproto.benchgen"] = reader.bool(); + break; + case 64017: + message[".gogoproto.marshaler"] = reader.bool(); + break; + case 64018: + message[".gogoproto.unmarshaler"] = reader.bool(); + break; + case 64019: + message[".gogoproto.stable_marshaler"] = reader.bool(); + break; + case 64020: + message[".gogoproto.sizer"] = reader.bool(); + break; + case 64023: + message[".gogoproto.unsafe_marshaler"] = reader.bool(); + break; + case 64024: + message[".gogoproto.unsafe_unmarshaler"] = reader.bool(); + break; + case 64025: + message[".gogoproto.goproto_extensions_map"] = reader.bool(); + break; + case 64026: + message[".gogoproto.goproto_unrecognized"] = reader.bool(); + break; + case 64028: + message[".gogoproto.protosizer"] = reader.bool(); + break; + case 64029: + message[".gogoproto.compare"] = reader.bool(); + break; + case 64030: + message[".gogoproto.typedecl"] = reader.bool(); + break; + case 64033: + message[".gogoproto.messagename"] = reader.bool(); + break; + case 64034: + message[".gogoproto.goproto_sizecache"] = reader.bool(); + break; + case 64035: + message[".gogoproto.goproto_unkeyed"] = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MessageOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MessageOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MessageOptions} MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MessageOptions message. + * @function verify + * @memberof google.protobuf.MessageOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MessageOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.message_set_wire_format != null && message.hasOwnProperty("message_set_wire_format")) + if (typeof message.message_set_wire_format !== "boolean") + return "message_set_wire_format: boolean expected"; + if (message.no_standard_descriptor_accessor != null && message.hasOwnProperty("no_standard_descriptor_accessor")) + if (typeof message.no_standard_descriptor_accessor !== "boolean") + return "no_standard_descriptor_accessor: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.map_entry != null && message.hasOwnProperty("map_entry")) + if (typeof message.map_entry !== "boolean") + return "map_entry: boolean expected"; + if (message.uninterpreted_option != null && message.hasOwnProperty("uninterpreted_option")) { + if (!Array.isArray(message.uninterpreted_option)) + return "uninterpreted_option: array expected"; + for (let i = 0; i < message.uninterpreted_option.length; ++i) { + let error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpreted_option[i]); + if (error) + return "uninterpreted_option." + error; + } + } + if (message[".cosmos_proto.interface_type"] != null && message.hasOwnProperty(".cosmos_proto.interface_type")) + if (!$util.isString(message[".cosmos_proto.interface_type"])) + return ".cosmos_proto.interface_type: string expected"; + if (message[".cosmos_proto.implements_interface"] != null && message.hasOwnProperty(".cosmos_proto.implements_interface")) + if (!$util.isString(message[".cosmos_proto.implements_interface"])) + return ".cosmos_proto.implements_interface: string expected"; + if (message[".gogoproto.goproto_getters"] != null && message.hasOwnProperty(".gogoproto.goproto_getters")) + if (typeof message[".gogoproto.goproto_getters"] !== "boolean") + return ".gogoproto.goproto_getters: boolean expected"; + if (message[".gogoproto.goproto_stringer"] != null && message.hasOwnProperty(".gogoproto.goproto_stringer")) + if (typeof message[".gogoproto.goproto_stringer"] !== "boolean") + return ".gogoproto.goproto_stringer: boolean expected"; + if (message[".gogoproto.verbose_equal"] != null && message.hasOwnProperty(".gogoproto.verbose_equal")) + if (typeof message[".gogoproto.verbose_equal"] !== "boolean") + return ".gogoproto.verbose_equal: boolean expected"; + if (message[".gogoproto.face"] != null && message.hasOwnProperty(".gogoproto.face")) + if (typeof message[".gogoproto.face"] !== "boolean") + return ".gogoproto.face: boolean expected"; + if (message[".gogoproto.gostring"] != null && message.hasOwnProperty(".gogoproto.gostring")) + if (typeof message[".gogoproto.gostring"] !== "boolean") + return ".gogoproto.gostring: boolean expected"; + if (message[".gogoproto.populate"] != null && message.hasOwnProperty(".gogoproto.populate")) + if (typeof message[".gogoproto.populate"] !== "boolean") + return ".gogoproto.populate: boolean expected"; + if (message[".gogoproto.stringer"] != null && message.hasOwnProperty(".gogoproto.stringer")) + if (typeof message[".gogoproto.stringer"] !== "boolean") + return ".gogoproto.stringer: boolean expected"; + if (message[".gogoproto.onlyone"] != null && message.hasOwnProperty(".gogoproto.onlyone")) + if (typeof message[".gogoproto.onlyone"] !== "boolean") + return ".gogoproto.onlyone: boolean expected"; + if (message[".gogoproto.equal"] != null && message.hasOwnProperty(".gogoproto.equal")) + if (typeof message[".gogoproto.equal"] !== "boolean") + return ".gogoproto.equal: boolean expected"; + if (message[".gogoproto.description"] != null && message.hasOwnProperty(".gogoproto.description")) + if (typeof message[".gogoproto.description"] !== "boolean") + return ".gogoproto.description: boolean expected"; + if (message[".gogoproto.testgen"] != null && message.hasOwnProperty(".gogoproto.testgen")) + if (typeof message[".gogoproto.testgen"] !== "boolean") + return ".gogoproto.testgen: boolean expected"; + if (message[".gogoproto.benchgen"] != null && message.hasOwnProperty(".gogoproto.benchgen")) + if (typeof message[".gogoproto.benchgen"] !== "boolean") + return ".gogoproto.benchgen: boolean expected"; + if (message[".gogoproto.marshaler"] != null && message.hasOwnProperty(".gogoproto.marshaler")) + if (typeof message[".gogoproto.marshaler"] !== "boolean") + return ".gogoproto.marshaler: boolean expected"; + if (message[".gogoproto.unmarshaler"] != null && message.hasOwnProperty(".gogoproto.unmarshaler")) + if (typeof message[".gogoproto.unmarshaler"] !== "boolean") + return ".gogoproto.unmarshaler: boolean expected"; + if (message[".gogoproto.stable_marshaler"] != null && message.hasOwnProperty(".gogoproto.stable_marshaler")) + if (typeof message[".gogoproto.stable_marshaler"] !== "boolean") + return ".gogoproto.stable_marshaler: boolean expected"; + if (message[".gogoproto.sizer"] != null && message.hasOwnProperty(".gogoproto.sizer")) + if (typeof message[".gogoproto.sizer"] !== "boolean") + return ".gogoproto.sizer: boolean expected"; + if (message[".gogoproto.unsafe_marshaler"] != null && message.hasOwnProperty(".gogoproto.unsafe_marshaler")) + if (typeof message[".gogoproto.unsafe_marshaler"] !== "boolean") + return ".gogoproto.unsafe_marshaler: boolean expected"; + if (message[".gogoproto.unsafe_unmarshaler"] != null && message.hasOwnProperty(".gogoproto.unsafe_unmarshaler")) + if (typeof message[".gogoproto.unsafe_unmarshaler"] !== "boolean") + return ".gogoproto.unsafe_unmarshaler: boolean expected"; + if (message[".gogoproto.goproto_extensions_map"] != null && message.hasOwnProperty(".gogoproto.goproto_extensions_map")) + if (typeof message[".gogoproto.goproto_extensions_map"] !== "boolean") + return ".gogoproto.goproto_extensions_map: boolean expected"; + if (message[".gogoproto.goproto_unrecognized"] != null && message.hasOwnProperty(".gogoproto.goproto_unrecognized")) + if (typeof message[".gogoproto.goproto_unrecognized"] !== "boolean") + return ".gogoproto.goproto_unrecognized: boolean expected"; + if (message[".gogoproto.protosizer"] != null && message.hasOwnProperty(".gogoproto.protosizer")) + if (typeof message[".gogoproto.protosizer"] !== "boolean") + return ".gogoproto.protosizer: boolean expected"; + if (message[".gogoproto.compare"] != null && message.hasOwnProperty(".gogoproto.compare")) + if (typeof message[".gogoproto.compare"] !== "boolean") + return ".gogoproto.compare: boolean expected"; + if (message[".gogoproto.typedecl"] != null && message.hasOwnProperty(".gogoproto.typedecl")) + if (typeof message[".gogoproto.typedecl"] !== "boolean") + return ".gogoproto.typedecl: boolean expected"; + if (message[".gogoproto.messagename"] != null && message.hasOwnProperty(".gogoproto.messagename")) + if (typeof message[".gogoproto.messagename"] !== "boolean") + return ".gogoproto.messagename: boolean expected"; + if (message[".gogoproto.goproto_sizecache"] != null && message.hasOwnProperty(".gogoproto.goproto_sizecache")) + if (typeof message[".gogoproto.goproto_sizecache"] !== "boolean") + return ".gogoproto.goproto_sizecache: boolean expected"; + if (message[".gogoproto.goproto_unkeyed"] != null && message.hasOwnProperty(".gogoproto.goproto_unkeyed")) + if (typeof message[".gogoproto.goproto_unkeyed"] !== "boolean") + return ".gogoproto.goproto_unkeyed: boolean expected"; + return null; + }; + + /** + * Creates a MessageOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MessageOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MessageOptions} MessageOptions + */ + MessageOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MessageOptions) + return object; + let message = new $root.google.protobuf.MessageOptions(); + if (object.message_set_wire_format != null) + message.message_set_wire_format = Boolean(object.message_set_wire_format); + if (object.no_standard_descriptor_accessor != null) + message.no_standard_descriptor_accessor = Boolean(object.no_standard_descriptor_accessor); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.map_entry != null) + message.map_entry = Boolean(object.map_entry); + if (object.uninterpreted_option) { + if (!Array.isArray(object.uninterpreted_option)) + throw TypeError(".google.protobuf.MessageOptions.uninterpreted_option: array expected"); + message.uninterpreted_option = []; + for (let i = 0; i < object.uninterpreted_option.length; ++i) { + if (typeof object.uninterpreted_option[i] !== "object") + throw TypeError(".google.protobuf.MessageOptions.uninterpreted_option: object expected"); + message.uninterpreted_option[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpreted_option[i]); + } + } + if (object[".cosmos_proto.interface_type"] != null) + message[".cosmos_proto.interface_type"] = String(object[".cosmos_proto.interface_type"]); + if (object[".cosmos_proto.implements_interface"] != null) + message[".cosmos_proto.implements_interface"] = String(object[".cosmos_proto.implements_interface"]); + if (object[".gogoproto.goproto_getters"] != null) + message[".gogoproto.goproto_getters"] = Boolean(object[".gogoproto.goproto_getters"]); + if (object[".gogoproto.goproto_stringer"] != null) + message[".gogoproto.goproto_stringer"] = Boolean(object[".gogoproto.goproto_stringer"]); + if (object[".gogoproto.verbose_equal"] != null) + message[".gogoproto.verbose_equal"] = Boolean(object[".gogoproto.verbose_equal"]); + if (object[".gogoproto.face"] != null) + message[".gogoproto.face"] = Boolean(object[".gogoproto.face"]); + if (object[".gogoproto.gostring"] != null) + message[".gogoproto.gostring"] = Boolean(object[".gogoproto.gostring"]); + if (object[".gogoproto.populate"] != null) + message[".gogoproto.populate"] = Boolean(object[".gogoproto.populate"]); + if (object[".gogoproto.stringer"] != null) + message[".gogoproto.stringer"] = Boolean(object[".gogoproto.stringer"]); + if (object[".gogoproto.onlyone"] != null) + message[".gogoproto.onlyone"] = Boolean(object[".gogoproto.onlyone"]); + if (object[".gogoproto.equal"] != null) + message[".gogoproto.equal"] = Boolean(object[".gogoproto.equal"]); + if (object[".gogoproto.description"] != null) + message[".gogoproto.description"] = Boolean(object[".gogoproto.description"]); + if (object[".gogoproto.testgen"] != null) + message[".gogoproto.testgen"] = Boolean(object[".gogoproto.testgen"]); + if (object[".gogoproto.benchgen"] != null) + message[".gogoproto.benchgen"] = Boolean(object[".gogoproto.benchgen"]); + if (object[".gogoproto.marshaler"] != null) + message[".gogoproto.marshaler"] = Boolean(object[".gogoproto.marshaler"]); + if (object[".gogoproto.unmarshaler"] != null) + message[".gogoproto.unmarshaler"] = Boolean(object[".gogoproto.unmarshaler"]); + if (object[".gogoproto.stable_marshaler"] != null) + message[".gogoproto.stable_marshaler"] = Boolean(object[".gogoproto.stable_marshaler"]); + if (object[".gogoproto.sizer"] != null) + message[".gogoproto.sizer"] = Boolean(object[".gogoproto.sizer"]); + if (object[".gogoproto.unsafe_marshaler"] != null) + message[".gogoproto.unsafe_marshaler"] = Boolean(object[".gogoproto.unsafe_marshaler"]); + if (object[".gogoproto.unsafe_unmarshaler"] != null) + message[".gogoproto.unsafe_unmarshaler"] = Boolean(object[".gogoproto.unsafe_unmarshaler"]); + if (object[".gogoproto.goproto_extensions_map"] != null) + message[".gogoproto.goproto_extensions_map"] = Boolean(object[".gogoproto.goproto_extensions_map"]); + if (object[".gogoproto.goproto_unrecognized"] != null) + message[".gogoproto.goproto_unrecognized"] = Boolean(object[".gogoproto.goproto_unrecognized"]); + if (object[".gogoproto.protosizer"] != null) + message[".gogoproto.protosizer"] = Boolean(object[".gogoproto.protosizer"]); + if (object[".gogoproto.compare"] != null) + message[".gogoproto.compare"] = Boolean(object[".gogoproto.compare"]); + if (object[".gogoproto.typedecl"] != null) + message[".gogoproto.typedecl"] = Boolean(object[".gogoproto.typedecl"]); + if (object[".gogoproto.messagename"] != null) + message[".gogoproto.messagename"] = Boolean(object[".gogoproto.messagename"]); + if (object[".gogoproto.goproto_sizecache"] != null) + message[".gogoproto.goproto_sizecache"] = Boolean(object[".gogoproto.goproto_sizecache"]); + if (object[".gogoproto.goproto_unkeyed"] != null) + message[".gogoproto.goproto_unkeyed"] = Boolean(object[".gogoproto.goproto_unkeyed"]); + return message; + }; + + /** + * Creates a plain object from a MessageOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.MessageOptions} message MessageOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MessageOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.uninterpreted_option = []; + if (options.defaults) { + object.message_set_wire_format = false; + object.no_standard_descriptor_accessor = false; + object.deprecated = false; + object.map_entry = false; + object[".gogoproto.goproto_getters"] = false; + object[".gogoproto.goproto_stringer"] = false; + object[".gogoproto.verbose_equal"] = false; + object[".gogoproto.face"] = false; + object[".gogoproto.gostring"] = false; + object[".gogoproto.populate"] = false; + object[".gogoproto.onlyone"] = false; + object[".gogoproto.equal"] = false; + object[".gogoproto.description"] = false; + object[".gogoproto.testgen"] = false; + object[".gogoproto.benchgen"] = false; + object[".gogoproto.marshaler"] = false; + object[".gogoproto.unmarshaler"] = false; + object[".gogoproto.stable_marshaler"] = false; + object[".gogoproto.sizer"] = false; + object[".gogoproto.unsafe_marshaler"] = false; + object[".gogoproto.unsafe_unmarshaler"] = false; + object[".gogoproto.goproto_extensions_map"] = false; + object[".gogoproto.goproto_unrecognized"] = false; + object[".gogoproto.protosizer"] = false; + object[".gogoproto.compare"] = false; + object[".gogoproto.typedecl"] = false; + object[".gogoproto.messagename"] = false; + object[".gogoproto.goproto_sizecache"] = false; + object[".gogoproto.goproto_unkeyed"] = false; + object[".gogoproto.stringer"] = false; + object[".cosmos_proto.interface_type"] = ""; + object[".cosmos_proto.implements_interface"] = ""; + } + if (message.message_set_wire_format != null && message.hasOwnProperty("message_set_wire_format")) + object.message_set_wire_format = message.message_set_wire_format; + if (message.no_standard_descriptor_accessor != null && message.hasOwnProperty("no_standard_descriptor_accessor")) + object.no_standard_descriptor_accessor = message.no_standard_descriptor_accessor; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.map_entry != null && message.hasOwnProperty("map_entry")) + object.map_entry = message.map_entry; + if (message.uninterpreted_option && message.uninterpreted_option.length) { + object.uninterpreted_option = []; + for (let j = 0; j < message.uninterpreted_option.length; ++j) + object.uninterpreted_option[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpreted_option[j], options); + } + if (message[".gogoproto.goproto_getters"] != null && message.hasOwnProperty(".gogoproto.goproto_getters")) + object[".gogoproto.goproto_getters"] = message[".gogoproto.goproto_getters"]; + if (message[".gogoproto.goproto_stringer"] != null && message.hasOwnProperty(".gogoproto.goproto_stringer")) + object[".gogoproto.goproto_stringer"] = message[".gogoproto.goproto_stringer"]; + if (message[".gogoproto.verbose_equal"] != null && message.hasOwnProperty(".gogoproto.verbose_equal")) + object[".gogoproto.verbose_equal"] = message[".gogoproto.verbose_equal"]; + if (message[".gogoproto.face"] != null && message.hasOwnProperty(".gogoproto.face")) + object[".gogoproto.face"] = message[".gogoproto.face"]; + if (message[".gogoproto.gostring"] != null && message.hasOwnProperty(".gogoproto.gostring")) + object[".gogoproto.gostring"] = message[".gogoproto.gostring"]; + if (message[".gogoproto.populate"] != null && message.hasOwnProperty(".gogoproto.populate")) + object[".gogoproto.populate"] = message[".gogoproto.populate"]; + if (message[".gogoproto.onlyone"] != null && message.hasOwnProperty(".gogoproto.onlyone")) + object[".gogoproto.onlyone"] = message[".gogoproto.onlyone"]; + if (message[".gogoproto.equal"] != null && message.hasOwnProperty(".gogoproto.equal")) + object[".gogoproto.equal"] = message[".gogoproto.equal"]; + if (message[".gogoproto.description"] != null && message.hasOwnProperty(".gogoproto.description")) + object[".gogoproto.description"] = message[".gogoproto.description"]; + if (message[".gogoproto.testgen"] != null && message.hasOwnProperty(".gogoproto.testgen")) + object[".gogoproto.testgen"] = message[".gogoproto.testgen"]; + if (message[".gogoproto.benchgen"] != null && message.hasOwnProperty(".gogoproto.benchgen")) + object[".gogoproto.benchgen"] = message[".gogoproto.benchgen"]; + if (message[".gogoproto.marshaler"] != null && message.hasOwnProperty(".gogoproto.marshaler")) + object[".gogoproto.marshaler"] = message[".gogoproto.marshaler"]; + if (message[".gogoproto.unmarshaler"] != null && message.hasOwnProperty(".gogoproto.unmarshaler")) + object[".gogoproto.unmarshaler"] = message[".gogoproto.unmarshaler"]; + if (message[".gogoproto.stable_marshaler"] != null && message.hasOwnProperty(".gogoproto.stable_marshaler")) + object[".gogoproto.stable_marshaler"] = message[".gogoproto.stable_marshaler"]; + if (message[".gogoproto.sizer"] != null && message.hasOwnProperty(".gogoproto.sizer")) + object[".gogoproto.sizer"] = message[".gogoproto.sizer"]; + if (message[".gogoproto.unsafe_marshaler"] != null && message.hasOwnProperty(".gogoproto.unsafe_marshaler")) + object[".gogoproto.unsafe_marshaler"] = message[".gogoproto.unsafe_marshaler"]; + if (message[".gogoproto.unsafe_unmarshaler"] != null && message.hasOwnProperty(".gogoproto.unsafe_unmarshaler")) + object[".gogoproto.unsafe_unmarshaler"] = message[".gogoproto.unsafe_unmarshaler"]; + if (message[".gogoproto.goproto_extensions_map"] != null && message.hasOwnProperty(".gogoproto.goproto_extensions_map")) + object[".gogoproto.goproto_extensions_map"] = message[".gogoproto.goproto_extensions_map"]; + if (message[".gogoproto.goproto_unrecognized"] != null && message.hasOwnProperty(".gogoproto.goproto_unrecognized")) + object[".gogoproto.goproto_unrecognized"] = message[".gogoproto.goproto_unrecognized"]; + if (message[".gogoproto.protosizer"] != null && message.hasOwnProperty(".gogoproto.protosizer")) + object[".gogoproto.protosizer"] = message[".gogoproto.protosizer"]; + if (message[".gogoproto.compare"] != null && message.hasOwnProperty(".gogoproto.compare")) + object[".gogoproto.compare"] = message[".gogoproto.compare"]; + if (message[".gogoproto.typedecl"] != null && message.hasOwnProperty(".gogoproto.typedecl")) + object[".gogoproto.typedecl"] = message[".gogoproto.typedecl"]; + if (message[".gogoproto.messagename"] != null && message.hasOwnProperty(".gogoproto.messagename")) + object[".gogoproto.messagename"] = message[".gogoproto.messagename"]; + if (message[".gogoproto.goproto_sizecache"] != null && message.hasOwnProperty(".gogoproto.goproto_sizecache")) + object[".gogoproto.goproto_sizecache"] = message[".gogoproto.goproto_sizecache"]; + if (message[".gogoproto.goproto_unkeyed"] != null && message.hasOwnProperty(".gogoproto.goproto_unkeyed")) + object[".gogoproto.goproto_unkeyed"] = message[".gogoproto.goproto_unkeyed"]; + if (message[".gogoproto.stringer"] != null && message.hasOwnProperty(".gogoproto.stringer")) + object[".gogoproto.stringer"] = message[".gogoproto.stringer"]; + if (message[".cosmos_proto.interface_type"] != null && message.hasOwnProperty(".cosmos_proto.interface_type")) + object[".cosmos_proto.interface_type"] = message[".cosmos_proto.interface_type"]; + if (message[".cosmos_proto.implements_interface"] != null && message.hasOwnProperty(".cosmos_proto.implements_interface")) + object[".cosmos_proto.implements_interface"] = message[".cosmos_proto.implements_interface"]; + return object; + }; + + /** + * Converts this MessageOptions to JSON. + * @function toJSON + * @memberof google.protobuf.MessageOptions + * @instance + * @returns {Object.} JSON object + */ + MessageOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MessageOptions; + })(); + + protobuf.FieldOptions = (function() { + + /** + * Properties of a FieldOptions. + * @memberof google.protobuf + * @interface IFieldOptions + * @property {google.protobuf.FieldOptions.CType|null} [ctype] FieldOptions ctype + * @property {boolean|null} [packed] FieldOptions packed + * @property {google.protobuf.FieldOptions.JSType|null} [jstype] FieldOptions jstype + * @property {boolean|null} [lazy] FieldOptions lazy + * @property {boolean|null} [deprecated] FieldOptions deprecated + * @property {boolean|null} [weak] FieldOptions weak + * @property {Array.|null} [uninterpreted_option] FieldOptions uninterpreted_option + * @property {string|null} [".cosmos_proto.accepts_interface"] FieldOptions .cosmos_proto.accepts_interface + * @property {boolean|null} [".gogoproto.nullable"] FieldOptions .gogoproto.nullable + * @property {boolean|null} [".gogoproto.embed"] FieldOptions .gogoproto.embed + * @property {string|null} [".gogoproto.customtype"] FieldOptions .gogoproto.customtype + * @property {string|null} [".gogoproto.customname"] FieldOptions .gogoproto.customname + * @property {string|null} [".gogoproto.jsontag"] FieldOptions .gogoproto.jsontag + * @property {string|null} [".gogoproto.moretags"] FieldOptions .gogoproto.moretags + * @property {string|null} [".gogoproto.casttype"] FieldOptions .gogoproto.casttype + * @property {string|null} [".gogoproto.castkey"] FieldOptions .gogoproto.castkey + * @property {string|null} [".gogoproto.castvalue"] FieldOptions .gogoproto.castvalue + * @property {boolean|null} [".gogoproto.stdtime"] FieldOptions .gogoproto.stdtime + * @property {boolean|null} [".gogoproto.stdduration"] FieldOptions .gogoproto.stdduration + * @property {boolean|null} [".gogoproto.wktpointer"] FieldOptions .gogoproto.wktpointer + * @property {string|null} [".gogoproto.castrepeated"] FieldOptions .gogoproto.castrepeated + */ + + /** + * Constructs a new FieldOptions. + * @memberof google.protobuf + * @classdesc Represents a FieldOptions. + * @implements IFieldOptions + * @constructor + * @param {google.protobuf.IFieldOptions=} [properties] Properties to set + */ + function FieldOptions(properties) { + this.uninterpreted_option = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldOptions ctype. + * @member {google.protobuf.FieldOptions.CType} ctype + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.ctype = 0; + + /** + * FieldOptions packed. + * @member {boolean} packed + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.packed = false; + + /** + * FieldOptions jstype. + * @member {google.protobuf.FieldOptions.JSType} jstype + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.jstype = 0; + + /** + * FieldOptions lazy. + * @member {boolean} lazy + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.lazy = false; + + /** + * FieldOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.deprecated = false; + + /** + * FieldOptions weak. + * @member {boolean} weak + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.weak = false; + + /** + * FieldOptions uninterpreted_option. + * @member {Array.} uninterpreted_option + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.uninterpreted_option = $util.emptyArray; + + /** + * FieldOptions .cosmos_proto.accepts_interface. + * @member {string} .cosmos_proto.accepts_interface + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".cosmos_proto.accepts_interface"] = ""; + + /** + * FieldOptions .gogoproto.nullable. + * @member {boolean} .gogoproto.nullable + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".gogoproto.nullable"] = false; + + /** + * FieldOptions .gogoproto.embed. + * @member {boolean} .gogoproto.embed + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".gogoproto.embed"] = false; + + /** + * FieldOptions .gogoproto.customtype. + * @member {string} .gogoproto.customtype + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".gogoproto.customtype"] = ""; + + /** + * FieldOptions .gogoproto.customname. + * @member {string} .gogoproto.customname + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".gogoproto.customname"] = ""; + + /** + * FieldOptions .gogoproto.jsontag. + * @member {string} .gogoproto.jsontag + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".gogoproto.jsontag"] = ""; + + /** + * FieldOptions .gogoproto.moretags. + * @member {string} .gogoproto.moretags + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".gogoproto.moretags"] = ""; + + /** + * FieldOptions .gogoproto.casttype. + * @member {string} .gogoproto.casttype + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".gogoproto.casttype"] = ""; + + /** + * FieldOptions .gogoproto.castkey. + * @member {string} .gogoproto.castkey + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".gogoproto.castkey"] = ""; + + /** + * FieldOptions .gogoproto.castvalue. + * @member {string} .gogoproto.castvalue + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".gogoproto.castvalue"] = ""; + + /** + * FieldOptions .gogoproto.stdtime. + * @member {boolean} .gogoproto.stdtime + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".gogoproto.stdtime"] = false; + + /** + * FieldOptions .gogoproto.stdduration. + * @member {boolean} .gogoproto.stdduration + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".gogoproto.stdduration"] = false; + + /** + * FieldOptions .gogoproto.wktpointer. + * @member {boolean} .gogoproto.wktpointer + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".gogoproto.wktpointer"] = false; + + /** + * FieldOptions .gogoproto.castrepeated. + * @member {string} .gogoproto.castrepeated + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".gogoproto.castrepeated"] = ""; + + /** + * Encodes the specified FieldOptions message. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ctype != null && Object.hasOwnProperty.call(message, "ctype")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ctype); + if (message.packed != null && Object.hasOwnProperty.call(message, "packed")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.packed); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.lazy != null && Object.hasOwnProperty.call(message, "lazy")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.lazy); + if (message.jstype != null && Object.hasOwnProperty.call(message, "jstype")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jstype); + if (message.weak != null && Object.hasOwnProperty.call(message, "weak")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.weak); + if (message.uninterpreted_option != null && message.uninterpreted_option.length) + for (let i = 0; i < message.uninterpreted_option.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpreted_option[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".gogoproto.nullable"] != null && Object.hasOwnProperty.call(message, ".gogoproto.nullable")) + writer.uint32(/* id 65001, wireType 0 =*/520008).bool(message[".gogoproto.nullable"]); + if (message[".gogoproto.embed"] != null && Object.hasOwnProperty.call(message, ".gogoproto.embed")) + writer.uint32(/* id 65002, wireType 0 =*/520016).bool(message[".gogoproto.embed"]); + if (message[".gogoproto.customtype"] != null && Object.hasOwnProperty.call(message, ".gogoproto.customtype")) + writer.uint32(/* id 65003, wireType 2 =*/520026).string(message[".gogoproto.customtype"]); + if (message[".gogoproto.customname"] != null && Object.hasOwnProperty.call(message, ".gogoproto.customname")) + writer.uint32(/* id 65004, wireType 2 =*/520034).string(message[".gogoproto.customname"]); + if (message[".gogoproto.jsontag"] != null && Object.hasOwnProperty.call(message, ".gogoproto.jsontag")) + writer.uint32(/* id 65005, wireType 2 =*/520042).string(message[".gogoproto.jsontag"]); + if (message[".gogoproto.moretags"] != null && Object.hasOwnProperty.call(message, ".gogoproto.moretags")) + writer.uint32(/* id 65006, wireType 2 =*/520050).string(message[".gogoproto.moretags"]); + if (message[".gogoproto.casttype"] != null && Object.hasOwnProperty.call(message, ".gogoproto.casttype")) + writer.uint32(/* id 65007, wireType 2 =*/520058).string(message[".gogoproto.casttype"]); + if (message[".gogoproto.castkey"] != null && Object.hasOwnProperty.call(message, ".gogoproto.castkey")) + writer.uint32(/* id 65008, wireType 2 =*/520066).string(message[".gogoproto.castkey"]); + if (message[".gogoproto.castvalue"] != null && Object.hasOwnProperty.call(message, ".gogoproto.castvalue")) + writer.uint32(/* id 65009, wireType 2 =*/520074).string(message[".gogoproto.castvalue"]); + if (message[".gogoproto.stdtime"] != null && Object.hasOwnProperty.call(message, ".gogoproto.stdtime")) + writer.uint32(/* id 65010, wireType 0 =*/520080).bool(message[".gogoproto.stdtime"]); + if (message[".gogoproto.stdduration"] != null && Object.hasOwnProperty.call(message, ".gogoproto.stdduration")) + writer.uint32(/* id 65011, wireType 0 =*/520088).bool(message[".gogoproto.stdduration"]); + if (message[".gogoproto.wktpointer"] != null && Object.hasOwnProperty.call(message, ".gogoproto.wktpointer")) + writer.uint32(/* id 65012, wireType 0 =*/520096).bool(message[".gogoproto.wktpointer"]); + if (message[".gogoproto.castrepeated"] != null && Object.hasOwnProperty.call(message, ".gogoproto.castrepeated")) + writer.uint32(/* id 65013, wireType 2 =*/520106).string(message[".gogoproto.castrepeated"]); + if (message[".cosmos_proto.accepts_interface"] != null && Object.hasOwnProperty.call(message, ".cosmos_proto.accepts_interface")) + writer.uint32(/* id 93001, wireType 2 =*/744010).string(message[".cosmos_proto.accepts_interface"]); + return writer; + }; + + /** + * Encodes the specified FieldOptions message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldOptions} FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ctype = reader.int32(); + break; + case 2: + message.packed = reader.bool(); + break; + case 6: + message.jstype = reader.int32(); + break; + case 5: + message.lazy = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 10: + message.weak = reader.bool(); + break; + case 999: + if (!(message.uninterpreted_option && message.uninterpreted_option.length)) + message.uninterpreted_option = []; + message.uninterpreted_option.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + case 93001: + message[".cosmos_proto.accepts_interface"] = reader.string(); + break; + case 65001: + message[".gogoproto.nullable"] = reader.bool(); + break; + case 65002: + message[".gogoproto.embed"] = reader.bool(); + break; + case 65003: + message[".gogoproto.customtype"] = reader.string(); + break; + case 65004: + message[".gogoproto.customname"] = reader.string(); + break; + case 65005: + message[".gogoproto.jsontag"] = reader.string(); + break; + case 65006: + message[".gogoproto.moretags"] = reader.string(); + break; + case 65007: + message[".gogoproto.casttype"] = reader.string(); + break; + case 65008: + message[".gogoproto.castkey"] = reader.string(); + break; + case 65009: + message[".gogoproto.castvalue"] = reader.string(); + break; + case 65010: + message[".gogoproto.stdtime"] = reader.bool(); + break; + case 65011: + message[".gogoproto.stdduration"] = reader.bool(); + break; + case 65012: + message[".gogoproto.wktpointer"] = reader.bool(); + break; + case 65013: + message[".gogoproto.castrepeated"] = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldOptions} FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldOptions message. + * @function verify + * @memberof google.protobuf.FieldOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ctype != null && message.hasOwnProperty("ctype")) + switch (message.ctype) { + default: + return "ctype: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.packed != null && message.hasOwnProperty("packed")) + if (typeof message.packed !== "boolean") + return "packed: boolean expected"; + if (message.jstype != null && message.hasOwnProperty("jstype")) + switch (message.jstype) { + default: + return "jstype: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.lazy != null && message.hasOwnProperty("lazy")) + if (typeof message.lazy !== "boolean") + return "lazy: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.weak != null && message.hasOwnProperty("weak")) + if (typeof message.weak !== "boolean") + return "weak: boolean expected"; + if (message.uninterpreted_option != null && message.hasOwnProperty("uninterpreted_option")) { + if (!Array.isArray(message.uninterpreted_option)) + return "uninterpreted_option: array expected"; + for (let i = 0; i < message.uninterpreted_option.length; ++i) { + let error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpreted_option[i]); + if (error) + return "uninterpreted_option." + error; + } + } + if (message[".cosmos_proto.accepts_interface"] != null && message.hasOwnProperty(".cosmos_proto.accepts_interface")) + if (!$util.isString(message[".cosmos_proto.accepts_interface"])) + return ".cosmos_proto.accepts_interface: string expected"; + if (message[".gogoproto.nullable"] != null && message.hasOwnProperty(".gogoproto.nullable")) + if (typeof message[".gogoproto.nullable"] !== "boolean") + return ".gogoproto.nullable: boolean expected"; + if (message[".gogoproto.embed"] != null && message.hasOwnProperty(".gogoproto.embed")) + if (typeof message[".gogoproto.embed"] !== "boolean") + return ".gogoproto.embed: boolean expected"; + if (message[".gogoproto.customtype"] != null && message.hasOwnProperty(".gogoproto.customtype")) + if (!$util.isString(message[".gogoproto.customtype"])) + return ".gogoproto.customtype: string expected"; + if (message[".gogoproto.customname"] != null && message.hasOwnProperty(".gogoproto.customname")) + if (!$util.isString(message[".gogoproto.customname"])) + return ".gogoproto.customname: string expected"; + if (message[".gogoproto.jsontag"] != null && message.hasOwnProperty(".gogoproto.jsontag")) + if (!$util.isString(message[".gogoproto.jsontag"])) + return ".gogoproto.jsontag: string expected"; + if (message[".gogoproto.moretags"] != null && message.hasOwnProperty(".gogoproto.moretags")) + if (!$util.isString(message[".gogoproto.moretags"])) + return ".gogoproto.moretags: string expected"; + if (message[".gogoproto.casttype"] != null && message.hasOwnProperty(".gogoproto.casttype")) + if (!$util.isString(message[".gogoproto.casttype"])) + return ".gogoproto.casttype: string expected"; + if (message[".gogoproto.castkey"] != null && message.hasOwnProperty(".gogoproto.castkey")) + if (!$util.isString(message[".gogoproto.castkey"])) + return ".gogoproto.castkey: string expected"; + if (message[".gogoproto.castvalue"] != null && message.hasOwnProperty(".gogoproto.castvalue")) + if (!$util.isString(message[".gogoproto.castvalue"])) + return ".gogoproto.castvalue: string expected"; + if (message[".gogoproto.stdtime"] != null && message.hasOwnProperty(".gogoproto.stdtime")) + if (typeof message[".gogoproto.stdtime"] !== "boolean") + return ".gogoproto.stdtime: boolean expected"; + if (message[".gogoproto.stdduration"] != null && message.hasOwnProperty(".gogoproto.stdduration")) + if (typeof message[".gogoproto.stdduration"] !== "boolean") + return ".gogoproto.stdduration: boolean expected"; + if (message[".gogoproto.wktpointer"] != null && message.hasOwnProperty(".gogoproto.wktpointer")) + if (typeof message[".gogoproto.wktpointer"] !== "boolean") + return ".gogoproto.wktpointer: boolean expected"; + if (message[".gogoproto.castrepeated"] != null && message.hasOwnProperty(".gogoproto.castrepeated")) + if (!$util.isString(message[".gogoproto.castrepeated"])) + return ".gogoproto.castrepeated: string expected"; + return null; + }; + + /** + * Creates a FieldOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldOptions} FieldOptions + */ + FieldOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldOptions) + return object; + let message = new $root.google.protobuf.FieldOptions(); + switch (object.ctype) { + case "STRING": + case 0: + message.ctype = 0; + break; + case "CORD": + case 1: + message.ctype = 1; + break; + case "STRING_PIECE": + case 2: + message.ctype = 2; + break; + } + if (object.packed != null) + message.packed = Boolean(object.packed); + switch (object.jstype) { + case "JS_NORMAL": + case 0: + message.jstype = 0; + break; + case "JS_STRING": + case 1: + message.jstype = 1; + break; + case "JS_NUMBER": + case 2: + message.jstype = 2; + break; + } + if (object.lazy != null) + message.lazy = Boolean(object.lazy); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.weak != null) + message.weak = Boolean(object.weak); + if (object.uninterpreted_option) { + if (!Array.isArray(object.uninterpreted_option)) + throw TypeError(".google.protobuf.FieldOptions.uninterpreted_option: array expected"); + message.uninterpreted_option = []; + for (let i = 0; i < object.uninterpreted_option.length; ++i) { + if (typeof object.uninterpreted_option[i] !== "object") + throw TypeError(".google.protobuf.FieldOptions.uninterpreted_option: object expected"); + message.uninterpreted_option[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpreted_option[i]); + } + } + if (object[".cosmos_proto.accepts_interface"] != null) + message[".cosmos_proto.accepts_interface"] = String(object[".cosmos_proto.accepts_interface"]); + if (object[".gogoproto.nullable"] != null) + message[".gogoproto.nullable"] = Boolean(object[".gogoproto.nullable"]); + if (object[".gogoproto.embed"] != null) + message[".gogoproto.embed"] = Boolean(object[".gogoproto.embed"]); + if (object[".gogoproto.customtype"] != null) + message[".gogoproto.customtype"] = String(object[".gogoproto.customtype"]); + if (object[".gogoproto.customname"] != null) + message[".gogoproto.customname"] = String(object[".gogoproto.customname"]); + if (object[".gogoproto.jsontag"] != null) + message[".gogoproto.jsontag"] = String(object[".gogoproto.jsontag"]); + if (object[".gogoproto.moretags"] != null) + message[".gogoproto.moretags"] = String(object[".gogoproto.moretags"]); + if (object[".gogoproto.casttype"] != null) + message[".gogoproto.casttype"] = String(object[".gogoproto.casttype"]); + if (object[".gogoproto.castkey"] != null) + message[".gogoproto.castkey"] = String(object[".gogoproto.castkey"]); + if (object[".gogoproto.castvalue"] != null) + message[".gogoproto.castvalue"] = String(object[".gogoproto.castvalue"]); + if (object[".gogoproto.stdtime"] != null) + message[".gogoproto.stdtime"] = Boolean(object[".gogoproto.stdtime"]); + if (object[".gogoproto.stdduration"] != null) + message[".gogoproto.stdduration"] = Boolean(object[".gogoproto.stdduration"]); + if (object[".gogoproto.wktpointer"] != null) + message[".gogoproto.wktpointer"] = Boolean(object[".gogoproto.wktpointer"]); + if (object[".gogoproto.castrepeated"] != null) + message[".gogoproto.castrepeated"] = String(object[".gogoproto.castrepeated"]); + return message; + }; + + /** + * Creates a plain object from a FieldOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.FieldOptions} message FieldOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.uninterpreted_option = []; + if (options.defaults) { + object.ctype = options.enums === String ? "STRING" : 0; + object.packed = false; + object.deprecated = false; + object.lazy = false; + object.jstype = options.enums === String ? "JS_NORMAL" : 0; + object.weak = false; + object[".gogoproto.nullable"] = false; + object[".gogoproto.embed"] = false; + object[".gogoproto.customtype"] = ""; + object[".gogoproto.customname"] = ""; + object[".gogoproto.jsontag"] = ""; + object[".gogoproto.moretags"] = ""; + object[".gogoproto.casttype"] = ""; + object[".gogoproto.castkey"] = ""; + object[".gogoproto.castvalue"] = ""; + object[".gogoproto.stdtime"] = false; + object[".gogoproto.stdduration"] = false; + object[".gogoproto.wktpointer"] = false; + object[".gogoproto.castrepeated"] = ""; + object[".cosmos_proto.accepts_interface"] = ""; + } + if (message.ctype != null && message.hasOwnProperty("ctype")) + object.ctype = options.enums === String ? $root.google.protobuf.FieldOptions.CType[message.ctype] : message.ctype; + if (message.packed != null && message.hasOwnProperty("packed")) + object.packed = message.packed; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.lazy != null && message.hasOwnProperty("lazy")) + object.lazy = message.lazy; + if (message.jstype != null && message.hasOwnProperty("jstype")) + object.jstype = options.enums === String ? $root.google.protobuf.FieldOptions.JSType[message.jstype] : message.jstype; + if (message.weak != null && message.hasOwnProperty("weak")) + object.weak = message.weak; + if (message.uninterpreted_option && message.uninterpreted_option.length) { + object.uninterpreted_option = []; + for (let j = 0; j < message.uninterpreted_option.length; ++j) + object.uninterpreted_option[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpreted_option[j], options); + } + if (message[".gogoproto.nullable"] != null && message.hasOwnProperty(".gogoproto.nullable")) + object[".gogoproto.nullable"] = message[".gogoproto.nullable"]; + if (message[".gogoproto.embed"] != null && message.hasOwnProperty(".gogoproto.embed")) + object[".gogoproto.embed"] = message[".gogoproto.embed"]; + if (message[".gogoproto.customtype"] != null && message.hasOwnProperty(".gogoproto.customtype")) + object[".gogoproto.customtype"] = message[".gogoproto.customtype"]; + if (message[".gogoproto.customname"] != null && message.hasOwnProperty(".gogoproto.customname")) + object[".gogoproto.customname"] = message[".gogoproto.customname"]; + if (message[".gogoproto.jsontag"] != null && message.hasOwnProperty(".gogoproto.jsontag")) + object[".gogoproto.jsontag"] = message[".gogoproto.jsontag"]; + if (message[".gogoproto.moretags"] != null && message.hasOwnProperty(".gogoproto.moretags")) + object[".gogoproto.moretags"] = message[".gogoproto.moretags"]; + if (message[".gogoproto.casttype"] != null && message.hasOwnProperty(".gogoproto.casttype")) + object[".gogoproto.casttype"] = message[".gogoproto.casttype"]; + if (message[".gogoproto.castkey"] != null && message.hasOwnProperty(".gogoproto.castkey")) + object[".gogoproto.castkey"] = message[".gogoproto.castkey"]; + if (message[".gogoproto.castvalue"] != null && message.hasOwnProperty(".gogoproto.castvalue")) + object[".gogoproto.castvalue"] = message[".gogoproto.castvalue"]; + if (message[".gogoproto.stdtime"] != null && message.hasOwnProperty(".gogoproto.stdtime")) + object[".gogoproto.stdtime"] = message[".gogoproto.stdtime"]; + if (message[".gogoproto.stdduration"] != null && message.hasOwnProperty(".gogoproto.stdduration")) + object[".gogoproto.stdduration"] = message[".gogoproto.stdduration"]; + if (message[".gogoproto.wktpointer"] != null && message.hasOwnProperty(".gogoproto.wktpointer")) + object[".gogoproto.wktpointer"] = message[".gogoproto.wktpointer"]; + if (message[".gogoproto.castrepeated"] != null && message.hasOwnProperty(".gogoproto.castrepeated")) + object[".gogoproto.castrepeated"] = message[".gogoproto.castrepeated"]; + if (message[".cosmos_proto.accepts_interface"] != null && message.hasOwnProperty(".cosmos_proto.accepts_interface")) + object[".cosmos_proto.accepts_interface"] = message[".cosmos_proto.accepts_interface"]; + return object; + }; + + /** + * Converts this FieldOptions to JSON. + * @function toJSON + * @memberof google.protobuf.FieldOptions + * @instance + * @returns {Object.} JSON object + */ + FieldOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * CType enum. + * @name google.protobuf.FieldOptions.CType + * @enum {number} + * @property {number} STRING=0 STRING value + * @property {number} CORD=1 CORD value + * @property {number} STRING_PIECE=2 STRING_PIECE value + */ + FieldOptions.CType = (function() { + const valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STRING"] = 0; + values[valuesById[1] = "CORD"] = 1; + values[valuesById[2] = "STRING_PIECE"] = 2; + return values; + })(); + + /** + * JSType enum. + * @name google.protobuf.FieldOptions.JSType + * @enum {number} + * @property {number} JS_NORMAL=0 JS_NORMAL value + * @property {number} JS_STRING=1 JS_STRING value + * @property {number} JS_NUMBER=2 JS_NUMBER value + */ + FieldOptions.JSType = (function() { + const valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "JS_NORMAL"] = 0; + values[valuesById[1] = "JS_STRING"] = 1; + values[valuesById[2] = "JS_NUMBER"] = 2; + return values; + })(); + + return FieldOptions; + })(); + + protobuf.OneofOptions = (function() { + + /** + * Properties of an OneofOptions. + * @memberof google.protobuf + * @interface IOneofOptions + * @property {Array.|null} [uninterpreted_option] OneofOptions uninterpreted_option + */ + + /** + * Constructs a new OneofOptions. + * @memberof google.protobuf + * @classdesc Represents an OneofOptions. + * @implements IOneofOptions + * @constructor + * @param {google.protobuf.IOneofOptions=} [properties] Properties to set + */ + function OneofOptions(properties) { + this.uninterpreted_option = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OneofOptions uninterpreted_option. + * @member {Array.} uninterpreted_option + * @memberof google.protobuf.OneofOptions + * @instance + */ + OneofOptions.prototype.uninterpreted_option = $util.emptyArray; + + /** + * Encodes the specified OneofOptions message. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uninterpreted_option != null && message.uninterpreted_option.length) + for (let i = 0; i < message.uninterpreted_option.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpreted_option[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OneofOptions message, length delimited. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OneofOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.OneofOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.OneofOptions} OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofOptions(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 999: + if (!(message.uninterpreted_option && message.uninterpreted_option.length)) + message.uninterpreted_option = []; + message.uninterpreted_option.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OneofOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.OneofOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.OneofOptions} OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OneofOptions message. + * @function verify + * @memberof google.protobuf.OneofOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OneofOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uninterpreted_option != null && message.hasOwnProperty("uninterpreted_option")) { + if (!Array.isArray(message.uninterpreted_option)) + return "uninterpreted_option: array expected"; + for (let i = 0; i < message.uninterpreted_option.length; ++i) { + let error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpreted_option[i]); + if (error) + return "uninterpreted_option." + error; + } + } + return null; + }; + + /** + * Creates an OneofOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.OneofOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.OneofOptions} OneofOptions + */ + OneofOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.OneofOptions) + return object; + let message = new $root.google.protobuf.OneofOptions(); + if (object.uninterpreted_option) { + if (!Array.isArray(object.uninterpreted_option)) + throw TypeError(".google.protobuf.OneofOptions.uninterpreted_option: array expected"); + message.uninterpreted_option = []; + for (let i = 0; i < object.uninterpreted_option.length; ++i) { + if (typeof object.uninterpreted_option[i] !== "object") + throw TypeError(".google.protobuf.OneofOptions.uninterpreted_option: object expected"); + message.uninterpreted_option[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpreted_option[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an OneofOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.OneofOptions} message OneofOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OneofOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.uninterpreted_option = []; + if (message.uninterpreted_option && message.uninterpreted_option.length) { + object.uninterpreted_option = []; + for (let j = 0; j < message.uninterpreted_option.length; ++j) + object.uninterpreted_option[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpreted_option[j], options); + } + return object; + }; + + /** + * Converts this OneofOptions to JSON. + * @function toJSON + * @memberof google.protobuf.OneofOptions + * @instance + * @returns {Object.} JSON object + */ + OneofOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return OneofOptions; + })(); + + protobuf.EnumOptions = (function() { + + /** + * Properties of an EnumOptions. + * @memberof google.protobuf + * @interface IEnumOptions + * @property {boolean|null} [allow_alias] EnumOptions allow_alias + * @property {boolean|null} [deprecated] EnumOptions deprecated + * @property {Array.|null} [uninterpreted_option] EnumOptions uninterpreted_option + * @property {boolean|null} [".gogoproto.goproto_enum_prefix"] EnumOptions .gogoproto.goproto_enum_prefix + * @property {boolean|null} [".gogoproto.goproto_enum_stringer"] EnumOptions .gogoproto.goproto_enum_stringer + * @property {boolean|null} [".gogoproto.enum_stringer"] EnumOptions .gogoproto.enum_stringer + * @property {string|null} [".gogoproto.enum_customname"] EnumOptions .gogoproto.enum_customname + * @property {boolean|null} [".gogoproto.enumdecl"] EnumOptions .gogoproto.enumdecl + */ + + /** + * Constructs a new EnumOptions. + * @memberof google.protobuf + * @classdesc Represents an EnumOptions. + * @implements IEnumOptions + * @constructor + * @param {google.protobuf.IEnumOptions=} [properties] Properties to set + */ + function EnumOptions(properties) { + this.uninterpreted_option = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumOptions allow_alias. + * @member {boolean} allow_alias + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.allow_alias = false; + + /** + * EnumOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.deprecated = false; + + /** + * EnumOptions uninterpreted_option. + * @member {Array.} uninterpreted_option + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.uninterpreted_option = $util.emptyArray; + + /** + * EnumOptions .gogoproto.goproto_enum_prefix. + * @member {boolean} .gogoproto.goproto_enum_prefix + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype[".gogoproto.goproto_enum_prefix"] = false; + + /** + * EnumOptions .gogoproto.goproto_enum_stringer. + * @member {boolean} .gogoproto.goproto_enum_stringer + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype[".gogoproto.goproto_enum_stringer"] = false; + + /** + * EnumOptions .gogoproto.enum_stringer. + * @member {boolean} .gogoproto.enum_stringer + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype[".gogoproto.enum_stringer"] = false; + + /** + * EnumOptions .gogoproto.enum_customname. + * @member {string} .gogoproto.enum_customname + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype[".gogoproto.enum_customname"] = ""; + + /** + * EnumOptions .gogoproto.enumdecl. + * @member {boolean} .gogoproto.enumdecl + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype[".gogoproto.enumdecl"] = false; + + /** + * Encodes the specified EnumOptions message. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.allow_alias != null && Object.hasOwnProperty.call(message, "allow_alias")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.allow_alias); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.uninterpreted_option != null && message.uninterpreted_option.length) + for (let i = 0; i < message.uninterpreted_option.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpreted_option[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".gogoproto.goproto_enum_prefix"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_enum_prefix")) + writer.uint32(/* id 62001, wireType 0 =*/496008).bool(message[".gogoproto.goproto_enum_prefix"]); + if (message[".gogoproto.goproto_enum_stringer"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_enum_stringer")) + writer.uint32(/* id 62021, wireType 0 =*/496168).bool(message[".gogoproto.goproto_enum_stringer"]); + if (message[".gogoproto.enum_stringer"] != null && Object.hasOwnProperty.call(message, ".gogoproto.enum_stringer")) + writer.uint32(/* id 62022, wireType 0 =*/496176).bool(message[".gogoproto.enum_stringer"]); + if (message[".gogoproto.enum_customname"] != null && Object.hasOwnProperty.call(message, ".gogoproto.enum_customname")) + writer.uint32(/* id 62023, wireType 2 =*/496186).string(message[".gogoproto.enum_customname"]); + if (message[".gogoproto.enumdecl"] != null && Object.hasOwnProperty.call(message, ".gogoproto.enumdecl")) + writer.uint32(/* id 62024, wireType 0 =*/496192).bool(message[".gogoproto.enumdecl"]); + return writer; + }; + + /** + * Encodes the specified EnumOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumOptions} EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumOptions(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.allow_alias = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 999: + if (!(message.uninterpreted_option && message.uninterpreted_option.length)) + message.uninterpreted_option = []; + message.uninterpreted_option.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + case 62001: + message[".gogoproto.goproto_enum_prefix"] = reader.bool(); + break; + case 62021: + message[".gogoproto.goproto_enum_stringer"] = reader.bool(); + break; + case 62022: + message[".gogoproto.enum_stringer"] = reader.bool(); + break; + case 62023: + message[".gogoproto.enum_customname"] = reader.string(); + break; + case 62024: + message[".gogoproto.enumdecl"] = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumOptions} EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumOptions message. + * @function verify + * @memberof google.protobuf.EnumOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.allow_alias != null && message.hasOwnProperty("allow_alias")) + if (typeof message.allow_alias !== "boolean") + return "allow_alias: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.uninterpreted_option != null && message.hasOwnProperty("uninterpreted_option")) { + if (!Array.isArray(message.uninterpreted_option)) + return "uninterpreted_option: array expected"; + for (let i = 0; i < message.uninterpreted_option.length; ++i) { + let error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpreted_option[i]); + if (error) + return "uninterpreted_option." + error; + } + } + if (message[".gogoproto.goproto_enum_prefix"] != null && message.hasOwnProperty(".gogoproto.goproto_enum_prefix")) + if (typeof message[".gogoproto.goproto_enum_prefix"] !== "boolean") + return ".gogoproto.goproto_enum_prefix: boolean expected"; + if (message[".gogoproto.goproto_enum_stringer"] != null && message.hasOwnProperty(".gogoproto.goproto_enum_stringer")) + if (typeof message[".gogoproto.goproto_enum_stringer"] !== "boolean") + return ".gogoproto.goproto_enum_stringer: boolean expected"; + if (message[".gogoproto.enum_stringer"] != null && message.hasOwnProperty(".gogoproto.enum_stringer")) + if (typeof message[".gogoproto.enum_stringer"] !== "boolean") + return ".gogoproto.enum_stringer: boolean expected"; + if (message[".gogoproto.enum_customname"] != null && message.hasOwnProperty(".gogoproto.enum_customname")) + if (!$util.isString(message[".gogoproto.enum_customname"])) + return ".gogoproto.enum_customname: string expected"; + if (message[".gogoproto.enumdecl"] != null && message.hasOwnProperty(".gogoproto.enumdecl")) + if (typeof message[".gogoproto.enumdecl"] !== "boolean") + return ".gogoproto.enumdecl: boolean expected"; + return null; + }; + + /** + * Creates an EnumOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumOptions} EnumOptions + */ + EnumOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumOptions) + return object; + let message = new $root.google.protobuf.EnumOptions(); + if (object.allow_alias != null) + message.allow_alias = Boolean(object.allow_alias); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.uninterpreted_option) { + if (!Array.isArray(object.uninterpreted_option)) + throw TypeError(".google.protobuf.EnumOptions.uninterpreted_option: array expected"); + message.uninterpreted_option = []; + for (let i = 0; i < object.uninterpreted_option.length; ++i) { + if (typeof object.uninterpreted_option[i] !== "object") + throw TypeError(".google.protobuf.EnumOptions.uninterpreted_option: object expected"); + message.uninterpreted_option[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpreted_option[i]); + } + } + if (object[".gogoproto.goproto_enum_prefix"] != null) + message[".gogoproto.goproto_enum_prefix"] = Boolean(object[".gogoproto.goproto_enum_prefix"]); + if (object[".gogoproto.goproto_enum_stringer"] != null) + message[".gogoproto.goproto_enum_stringer"] = Boolean(object[".gogoproto.goproto_enum_stringer"]); + if (object[".gogoproto.enum_stringer"] != null) + message[".gogoproto.enum_stringer"] = Boolean(object[".gogoproto.enum_stringer"]); + if (object[".gogoproto.enum_customname"] != null) + message[".gogoproto.enum_customname"] = String(object[".gogoproto.enum_customname"]); + if (object[".gogoproto.enumdecl"] != null) + message[".gogoproto.enumdecl"] = Boolean(object[".gogoproto.enumdecl"]); + return message; + }; + + /** + * Creates a plain object from an EnumOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.EnumOptions} message EnumOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.uninterpreted_option = []; + if (options.defaults) { + object.allow_alias = false; + object.deprecated = false; + object[".gogoproto.goproto_enum_prefix"] = false; + object[".gogoproto.goproto_enum_stringer"] = false; + object[".gogoproto.enum_stringer"] = false; + object[".gogoproto.enum_customname"] = ""; + object[".gogoproto.enumdecl"] = false; + } + if (message.allow_alias != null && message.hasOwnProperty("allow_alias")) + object.allow_alias = message.allow_alias; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.uninterpreted_option && message.uninterpreted_option.length) { + object.uninterpreted_option = []; + for (let j = 0; j < message.uninterpreted_option.length; ++j) + object.uninterpreted_option[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpreted_option[j], options); + } + if (message[".gogoproto.goproto_enum_prefix"] != null && message.hasOwnProperty(".gogoproto.goproto_enum_prefix")) + object[".gogoproto.goproto_enum_prefix"] = message[".gogoproto.goproto_enum_prefix"]; + if (message[".gogoproto.goproto_enum_stringer"] != null && message.hasOwnProperty(".gogoproto.goproto_enum_stringer")) + object[".gogoproto.goproto_enum_stringer"] = message[".gogoproto.goproto_enum_stringer"]; + if (message[".gogoproto.enum_stringer"] != null && message.hasOwnProperty(".gogoproto.enum_stringer")) + object[".gogoproto.enum_stringer"] = message[".gogoproto.enum_stringer"]; + if (message[".gogoproto.enum_customname"] != null && message.hasOwnProperty(".gogoproto.enum_customname")) + object[".gogoproto.enum_customname"] = message[".gogoproto.enum_customname"]; + if (message[".gogoproto.enumdecl"] != null && message.hasOwnProperty(".gogoproto.enumdecl")) + object[".gogoproto.enumdecl"] = message[".gogoproto.enumdecl"]; + return object; + }; + + /** + * Converts this EnumOptions to JSON. + * @function toJSON + * @memberof google.protobuf.EnumOptions + * @instance + * @returns {Object.} JSON object + */ + EnumOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnumOptions; + })(); + + protobuf.EnumValueOptions = (function() { + + /** + * Properties of an EnumValueOptions. + * @memberof google.protobuf + * @interface IEnumValueOptions + * @property {boolean|null} [deprecated] EnumValueOptions deprecated + * @property {Array.|null} [uninterpreted_option] EnumValueOptions uninterpreted_option + * @property {string|null} [".gogoproto.enumvalue_customname"] EnumValueOptions .gogoproto.enumvalue_customname + */ + + /** + * Constructs a new EnumValueOptions. + * @memberof google.protobuf + * @classdesc Represents an EnumValueOptions. + * @implements IEnumValueOptions + * @constructor + * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set + */ + function EnumValueOptions(properties) { + this.uninterpreted_option = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumValueOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.deprecated = false; + + /** + * EnumValueOptions uninterpreted_option. + * @member {Array.} uninterpreted_option + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.uninterpreted_option = $util.emptyArray; + + /** + * EnumValueOptions .gogoproto.enumvalue_customname. + * @member {string} .gogoproto.enumvalue_customname + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype[".gogoproto.enumvalue_customname"] = ""; + + /** + * Encodes the specified EnumValueOptions message. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.deprecated); + if (message.uninterpreted_option != null && message.uninterpreted_option.length) + for (let i = 0; i < message.uninterpreted_option.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpreted_option[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".gogoproto.enumvalue_customname"] != null && Object.hasOwnProperty.call(message, ".gogoproto.enumvalue_customname")) + writer.uint32(/* id 66001, wireType 2 =*/528010).string(message[".gogoproto.enumvalue_customname"]); + return writer; + }; + + /** + * Encodes the specified EnumValueOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueOptions(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deprecated = reader.bool(); + break; + case 999: + if (!(message.uninterpreted_option && message.uninterpreted_option.length)) + message.uninterpreted_option = []; + message.uninterpreted_option.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + case 66001: + message[".gogoproto.enumvalue_customname"] = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumValueOptions message. + * @function verify + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumValueOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.uninterpreted_option != null && message.hasOwnProperty("uninterpreted_option")) { + if (!Array.isArray(message.uninterpreted_option)) + return "uninterpreted_option: array expected"; + for (let i = 0; i < message.uninterpreted_option.length; ++i) { + let error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpreted_option[i]); + if (error) + return "uninterpreted_option." + error; + } + } + if (message[".gogoproto.enumvalue_customname"] != null && message.hasOwnProperty(".gogoproto.enumvalue_customname")) + if (!$util.isString(message[".gogoproto.enumvalue_customname"])) + return ".gogoproto.enumvalue_customname: string expected"; + return null; + }; + + /** + * Creates an EnumValueOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + */ + EnumValueOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumValueOptions) + return object; + let message = new $root.google.protobuf.EnumValueOptions(); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.uninterpreted_option) { + if (!Array.isArray(object.uninterpreted_option)) + throw TypeError(".google.protobuf.EnumValueOptions.uninterpreted_option: array expected"); + message.uninterpreted_option = []; + for (let i = 0; i < object.uninterpreted_option.length; ++i) { + if (typeof object.uninterpreted_option[i] !== "object") + throw TypeError(".google.protobuf.EnumValueOptions.uninterpreted_option: object expected"); + message.uninterpreted_option[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpreted_option[i]); + } + } + if (object[".gogoproto.enumvalue_customname"] != null) + message[".gogoproto.enumvalue_customname"] = String(object[".gogoproto.enumvalue_customname"]); + return message; + }; + + /** + * Creates a plain object from an EnumValueOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.EnumValueOptions} message EnumValueOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumValueOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.uninterpreted_option = []; + if (options.defaults) { + object.deprecated = false; + object[".gogoproto.enumvalue_customname"] = ""; + } + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.uninterpreted_option && message.uninterpreted_option.length) { + object.uninterpreted_option = []; + for (let j = 0; j < message.uninterpreted_option.length; ++j) + object.uninterpreted_option[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpreted_option[j], options); + } + if (message[".gogoproto.enumvalue_customname"] != null && message.hasOwnProperty(".gogoproto.enumvalue_customname")) + object[".gogoproto.enumvalue_customname"] = message[".gogoproto.enumvalue_customname"]; + return object; + }; + + /** + * Converts this EnumValueOptions to JSON. + * @function toJSON + * @memberof google.protobuf.EnumValueOptions + * @instance + * @returns {Object.} JSON object + */ + EnumValueOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnumValueOptions; + })(); + + protobuf.ServiceOptions = (function() { + + /** + * Properties of a ServiceOptions. + * @memberof google.protobuf + * @interface IServiceOptions + * @property {boolean|null} [deprecated] ServiceOptions deprecated + * @property {Array.|null} [uninterpreted_option] ServiceOptions uninterpreted_option + */ + + /** + * Constructs a new ServiceOptions. + * @memberof google.protobuf + * @classdesc Represents a ServiceOptions. + * @implements IServiceOptions + * @constructor + * @param {google.protobuf.IServiceOptions=} [properties] Properties to set + */ + function ServiceOptions(properties) { + this.uninterpreted_option = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServiceOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype.deprecated = false; + + /** + * ServiceOptions uninterpreted_option. + * @member {Array.} uninterpreted_option + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype.uninterpreted_option = $util.emptyArray; + + /** + * Encodes the specified ServiceOptions message. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); + if (message.uninterpreted_option != null && message.uninterpreted_option.length) + for (let i = 0; i < message.uninterpreted_option.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpreted_option[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ServiceOptions message, length delimited. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ServiceOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ServiceOptions} ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceOptions(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 33: + message.deprecated = reader.bool(); + break; + case 999: + if (!(message.uninterpreted_option && message.uninterpreted_option.length)) + message.uninterpreted_option = []; + message.uninterpreted_option.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ServiceOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ServiceOptions} ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceOptions message. + * @function verify + * @memberof google.protobuf.ServiceOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.uninterpreted_option != null && message.hasOwnProperty("uninterpreted_option")) { + if (!Array.isArray(message.uninterpreted_option)) + return "uninterpreted_option: array expected"; + for (let i = 0; i < message.uninterpreted_option.length; ++i) { + let error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpreted_option[i]); + if (error) + return "uninterpreted_option." + error; + } + } + return null; + }; + + /** + * Creates a ServiceOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ServiceOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ServiceOptions} ServiceOptions + */ + ServiceOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ServiceOptions) + return object; + let message = new $root.google.protobuf.ServiceOptions(); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.uninterpreted_option) { + if (!Array.isArray(object.uninterpreted_option)) + throw TypeError(".google.protobuf.ServiceOptions.uninterpreted_option: array expected"); + message.uninterpreted_option = []; + for (let i = 0; i < object.uninterpreted_option.length; ++i) { + if (typeof object.uninterpreted_option[i] !== "object") + throw TypeError(".google.protobuf.ServiceOptions.uninterpreted_option: object expected"); + message.uninterpreted_option[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpreted_option[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ServiceOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.ServiceOptions} message ServiceOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.uninterpreted_option = []; + if (options.defaults) + object.deprecated = false; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.uninterpreted_option && message.uninterpreted_option.length) { + object.uninterpreted_option = []; + for (let j = 0; j < message.uninterpreted_option.length; ++j) + object.uninterpreted_option[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpreted_option[j], options); + } + return object; + }; + + /** + * Converts this ServiceOptions to JSON. + * @function toJSON + * @memberof google.protobuf.ServiceOptions + * @instance + * @returns {Object.} JSON object + */ + ServiceOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ServiceOptions; + })(); + + protobuf.MethodOptions = (function() { + + /** + * Properties of a MethodOptions. + * @memberof google.protobuf + * @interface IMethodOptions + * @property {boolean|null} [deprecated] MethodOptions deprecated + * @property {Array.|null} [uninterpreted_option] MethodOptions uninterpreted_option + * @property {google.api.IHttpRule|null} [".google.api.http"] MethodOptions .google.api.http + */ + + /** + * Constructs a new MethodOptions. + * @memberof google.protobuf + * @classdesc Represents a MethodOptions. + * @implements IMethodOptions + * @constructor + * @param {google.protobuf.IMethodOptions=} [properties] Properties to set + */ + function MethodOptions(properties) { + this.uninterpreted_option = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MethodOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype.deprecated = false; + + /** + * MethodOptions uninterpreted_option. + * @member {Array.} uninterpreted_option + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype.uninterpreted_option = $util.emptyArray; + + /** + * MethodOptions .google.api.http. + * @member {google.api.IHttpRule|null|undefined} .google.api.http + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype[".google.api.http"] = null; + + /** + * Encodes the specified MethodOptions message. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); + if (message.uninterpreted_option != null && message.uninterpreted_option.length) + for (let i = 0; i < message.uninterpreted_option.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpreted_option[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.http"] != null && Object.hasOwnProperty.call(message, ".google.api.http")) + $root.google.api.HttpRule.encode(message[".google.api.http"], writer.uint32(/* id 72295728, wireType 2 =*/578365826).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MethodOptions message, length delimited. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MethodOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MethodOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MethodOptions} MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodOptions(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 33: + message.deprecated = reader.bool(); + break; + case 999: + if (!(message.uninterpreted_option && message.uninterpreted_option.length)) + message.uninterpreted_option = []; + message.uninterpreted_option.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + case 72295728: + message[".google.api.http"] = $root.google.api.HttpRule.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MethodOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MethodOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MethodOptions} MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MethodOptions message. + * @function verify + * @memberof google.protobuf.MethodOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MethodOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.uninterpreted_option != null && message.hasOwnProperty("uninterpreted_option")) { + if (!Array.isArray(message.uninterpreted_option)) + return "uninterpreted_option: array expected"; + for (let i = 0; i < message.uninterpreted_option.length; ++i) { + let error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpreted_option[i]); + if (error) + return "uninterpreted_option." + error; + } + } + if (message[".google.api.http"] != null && message.hasOwnProperty(".google.api.http")) { + let error = $root.google.api.HttpRule.verify(message[".google.api.http"]); + if (error) + return ".google.api.http." + error; + } + return null; + }; + + /** + * Creates a MethodOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MethodOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MethodOptions} MethodOptions + */ + MethodOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MethodOptions) + return object; + let message = new $root.google.protobuf.MethodOptions(); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.uninterpreted_option) { + if (!Array.isArray(object.uninterpreted_option)) + throw TypeError(".google.protobuf.MethodOptions.uninterpreted_option: array expected"); + message.uninterpreted_option = []; + for (let i = 0; i < object.uninterpreted_option.length; ++i) { + if (typeof object.uninterpreted_option[i] !== "object") + throw TypeError(".google.protobuf.MethodOptions.uninterpreted_option: object expected"); + message.uninterpreted_option[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpreted_option[i]); + } + } + if (object[".google.api.http"] != null) { + if (typeof object[".google.api.http"] !== "object") + throw TypeError(".google.protobuf.MethodOptions..google.api.http: object expected"); + message[".google.api.http"] = $root.google.api.HttpRule.fromObject(object[".google.api.http"]); + } + return message; + }; + + /** + * Creates a plain object from a MethodOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.MethodOptions} message MethodOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MethodOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.uninterpreted_option = []; + if (options.defaults) { + object.deprecated = false; + object[".google.api.http"] = null; + } + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.uninterpreted_option && message.uninterpreted_option.length) { + object.uninterpreted_option = []; + for (let j = 0; j < message.uninterpreted_option.length; ++j) + object.uninterpreted_option[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpreted_option[j], options); + } + if (message[".google.api.http"] != null && message.hasOwnProperty(".google.api.http")) + object[".google.api.http"] = $root.google.api.HttpRule.toObject(message[".google.api.http"], options); + return object; + }; + + /** + * Converts this MethodOptions to JSON. + * @function toJSON + * @memberof google.protobuf.MethodOptions + * @instance + * @returns {Object.} JSON object + */ + MethodOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MethodOptions; + })(); + + protobuf.UninterpretedOption = (function() { + + /** + * Properties of an UninterpretedOption. + * @memberof google.protobuf + * @interface IUninterpretedOption + * @property {Array.|null} [name] UninterpretedOption name + * @property {string|null} [identifier_value] UninterpretedOption identifier_value + * @property {Long|null} [positive_int_value] UninterpretedOption positive_int_value + * @property {Long|null} [negative_int_value] UninterpretedOption negative_int_value + * @property {number|null} [double_value] UninterpretedOption double_value + * @property {Uint8Array|null} [string_value] UninterpretedOption string_value + * @property {string|null} [aggregate_value] UninterpretedOption aggregate_value + */ + + /** + * Constructs a new UninterpretedOption. + * @memberof google.protobuf + * @classdesc Represents an UninterpretedOption. + * @implements IUninterpretedOption + * @constructor + * @param {google.protobuf.IUninterpretedOption=} [properties] Properties to set + */ + function UninterpretedOption(properties) { + this.name = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UninterpretedOption name. + * @member {Array.} name + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.name = $util.emptyArray; + + /** + * UninterpretedOption identifier_value. + * @member {string} identifier_value + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.identifier_value = ""; + + /** + * UninterpretedOption positive_int_value. + * @member {Long} positive_int_value + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.positive_int_value = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * UninterpretedOption negative_int_value. + * @member {Long} negative_int_value + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.negative_int_value = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * UninterpretedOption double_value. + * @member {number} double_value + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.double_value = 0; + + /** + * UninterpretedOption string_value. + * @member {Uint8Array} string_value + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.string_value = $util.newBuffer([]); + + /** + * UninterpretedOption aggregate_value. + * @member {string} aggregate_value + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.aggregate_value = ""; + + /** + * Encodes the specified UninterpretedOption message. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UninterpretedOption.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.name.length) + for (let i = 0; i < message.name.length; ++i) + $root.google.protobuf.UninterpretedOption.NamePart.encode(message.name[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.identifier_value != null && Object.hasOwnProperty.call(message, "identifier_value")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.identifier_value); + if (message.positive_int_value != null && Object.hasOwnProperty.call(message, "positive_int_value")) + writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.positive_int_value); + if (message.negative_int_value != null && Object.hasOwnProperty.call(message, "negative_int_value")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.negative_int_value); + if (message.double_value != null && Object.hasOwnProperty.call(message, "double_value")) + writer.uint32(/* id 6, wireType 1 =*/49).double(message.double_value); + if (message.string_value != null && Object.hasOwnProperty.call(message, "string_value")) + writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.string_value); + if (message.aggregate_value != null && Object.hasOwnProperty.call(message, "aggregate_value")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.aggregate_value); + return writer; + }; + + /** + * Encodes the specified UninterpretedOption message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UninterpretedOption.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UninterpretedOption.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (!(message.name && message.name.length)) + message.name = []; + message.name.push($root.google.protobuf.UninterpretedOption.NamePart.decode(reader, reader.uint32())); + break; + case 3: + message.identifier_value = reader.string(); + break; + case 4: + message.positive_int_value = reader.uint64(); + break; + case 5: + message.negative_int_value = reader.int64(); + break; + case 6: + message.double_value = reader.double(); + break; + case 7: + message.string_value = reader.bytes(); + break; + case 8: + message.aggregate_value = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UninterpretedOption.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UninterpretedOption message. + * @function verify + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UninterpretedOption.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) { + if (!Array.isArray(message.name)) + return "name: array expected"; + for (let i = 0; i < message.name.length; ++i) { + let error = $root.google.protobuf.UninterpretedOption.NamePart.verify(message.name[i]); + if (error) + return "name." + error; + } + } + if (message.identifier_value != null && message.hasOwnProperty("identifier_value")) + if (!$util.isString(message.identifier_value)) + return "identifier_value: string expected"; + if (message.positive_int_value != null && message.hasOwnProperty("positive_int_value")) + if (!$util.isInteger(message.positive_int_value) && !(message.positive_int_value && $util.isInteger(message.positive_int_value.low) && $util.isInteger(message.positive_int_value.high))) + return "positive_int_value: integer|Long expected"; + if (message.negative_int_value != null && message.hasOwnProperty("negative_int_value")) + if (!$util.isInteger(message.negative_int_value) && !(message.negative_int_value && $util.isInteger(message.negative_int_value.low) && $util.isInteger(message.negative_int_value.high))) + return "negative_int_value: integer|Long expected"; + if (message.double_value != null && message.hasOwnProperty("double_value")) + if (typeof message.double_value !== "number") + return "double_value: number expected"; + if (message.string_value != null && message.hasOwnProperty("string_value")) + if (!(message.string_value && typeof message.string_value.length === "number" || $util.isString(message.string_value))) + return "string_value: buffer expected"; + if (message.aggregate_value != null && message.hasOwnProperty("aggregate_value")) + if (!$util.isString(message.aggregate_value)) + return "aggregate_value: string expected"; + return null; + }; + + /** + * Creates an UninterpretedOption message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + */ + UninterpretedOption.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UninterpretedOption) + return object; + let message = new $root.google.protobuf.UninterpretedOption(); + if (object.name) { + if (!Array.isArray(object.name)) + throw TypeError(".google.protobuf.UninterpretedOption.name: array expected"); + message.name = []; + for (let i = 0; i < object.name.length; ++i) { + if (typeof object.name[i] !== "object") + throw TypeError(".google.protobuf.UninterpretedOption.name: object expected"); + message.name[i] = $root.google.protobuf.UninterpretedOption.NamePart.fromObject(object.name[i]); + } + } + if (object.identifier_value != null) + message.identifier_value = String(object.identifier_value); + if (object.positive_int_value != null) + if ($util.Long) + (message.positive_int_value = $util.Long.fromValue(object.positive_int_value)).unsigned = true; + else if (typeof object.positive_int_value === "string") + message.positive_int_value = parseInt(object.positive_int_value, 10); + else if (typeof object.positive_int_value === "number") + message.positive_int_value = object.positive_int_value; + else if (typeof object.positive_int_value === "object") + message.positive_int_value = new $util.LongBits(object.positive_int_value.low >>> 0, object.positive_int_value.high >>> 0).toNumber(true); + if (object.negative_int_value != null) + if ($util.Long) + (message.negative_int_value = $util.Long.fromValue(object.negative_int_value)).unsigned = false; + else if (typeof object.negative_int_value === "string") + message.negative_int_value = parseInt(object.negative_int_value, 10); + else if (typeof object.negative_int_value === "number") + message.negative_int_value = object.negative_int_value; + else if (typeof object.negative_int_value === "object") + message.negative_int_value = new $util.LongBits(object.negative_int_value.low >>> 0, object.negative_int_value.high >>> 0).toNumber(); + if (object.double_value != null) + message.double_value = Number(object.double_value); + if (object.string_value != null) + if (typeof object.string_value === "string") + $util.base64.decode(object.string_value, message.string_value = $util.newBuffer($util.base64.length(object.string_value)), 0); + else if (object.string_value.length) + message.string_value = object.string_value; + if (object.aggregate_value != null) + message.aggregate_value = String(object.aggregate_value); + return message; + }; + + /** + * Creates a plain object from an UninterpretedOption message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.UninterpretedOption} message UninterpretedOption + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UninterpretedOption.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.name = []; + if (options.defaults) { + object.identifier_value = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.positive_int_value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.positive_int_value = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.negative_int_value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.negative_int_value = options.longs === String ? "0" : 0; + object.double_value = 0; + if (options.bytes === String) + object.string_value = ""; + else { + object.string_value = []; + if (options.bytes !== Array) + object.string_value = $util.newBuffer(object.string_value); + } + object.aggregate_value = ""; + } + if (message.name && message.name.length) { + object.name = []; + for (let j = 0; j < message.name.length; ++j) + object.name[j] = $root.google.protobuf.UninterpretedOption.NamePart.toObject(message.name[j], options); + } + if (message.identifier_value != null && message.hasOwnProperty("identifier_value")) + object.identifier_value = message.identifier_value; + if (message.positive_int_value != null && message.hasOwnProperty("positive_int_value")) + if (typeof message.positive_int_value === "number") + object.positive_int_value = options.longs === String ? String(message.positive_int_value) : message.positive_int_value; + else + object.positive_int_value = options.longs === String ? $util.Long.prototype.toString.call(message.positive_int_value) : options.longs === Number ? new $util.LongBits(message.positive_int_value.low >>> 0, message.positive_int_value.high >>> 0).toNumber(true) : message.positive_int_value; + if (message.negative_int_value != null && message.hasOwnProperty("negative_int_value")) + if (typeof message.negative_int_value === "number") + object.negative_int_value = options.longs === String ? String(message.negative_int_value) : message.negative_int_value; + else + object.negative_int_value = options.longs === String ? $util.Long.prototype.toString.call(message.negative_int_value) : options.longs === Number ? new $util.LongBits(message.negative_int_value.low >>> 0, message.negative_int_value.high >>> 0).toNumber() : message.negative_int_value; + if (message.double_value != null && message.hasOwnProperty("double_value")) + object.double_value = options.json && !isFinite(message.double_value) ? String(message.double_value) : message.double_value; + if (message.string_value != null && message.hasOwnProperty("string_value")) + object.string_value = options.bytes === String ? $util.base64.encode(message.string_value, 0, message.string_value.length) : options.bytes === Array ? Array.prototype.slice.call(message.string_value) : message.string_value; + if (message.aggregate_value != null && message.hasOwnProperty("aggregate_value")) + object.aggregate_value = message.aggregate_value; + return object; + }; + + /** + * Converts this UninterpretedOption to JSON. + * @function toJSON + * @memberof google.protobuf.UninterpretedOption + * @instance + * @returns {Object.} JSON object + */ + UninterpretedOption.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + UninterpretedOption.NamePart = (function() { + + /** + * Properties of a NamePart. + * @memberof google.protobuf.UninterpretedOption + * @interface INamePart + * @property {string} name_part NamePart name_part + * @property {boolean} is_extension NamePart is_extension + */ + + /** + * Constructs a new NamePart. + * @memberof google.protobuf.UninterpretedOption + * @classdesc Represents a NamePart. + * @implements INamePart + * @constructor + * @param {google.protobuf.UninterpretedOption.INamePart=} [properties] Properties to set + */ + function NamePart(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NamePart name_part. + * @member {string} name_part + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + */ + NamePart.prototype.name_part = ""; + + /** + * NamePart is_extension. + * @member {boolean} is_extension + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + */ + NamePart.prototype.is_extension = false; + + /** + * Encodes the specified NamePart message. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.INamePart} message NamePart message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NamePart.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name_part); + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.is_extension); + return writer; + }; + + /** + * Encodes the specified NamePart message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.INamePart} message NamePart message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NamePart.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NamePart message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NamePart.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption.NamePart(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name_part = reader.string(); + break; + case 2: + message.is_extension = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + if (!message.hasOwnProperty("name_part")) + throw $util.ProtocolError("missing required 'name_part'", { instance: message }); + if (!message.hasOwnProperty("is_extension")) + throw $util.ProtocolError("missing required 'is_extension'", { instance: message }); + return message; + }; + + /** + * Decodes a NamePart message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NamePart.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NamePart message. + * @function verify + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NamePart.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (!$util.isString(message.name_part)) + return "name_part: string expected"; + if (typeof message.is_extension !== "boolean") + return "is_extension: boolean expected"; + return null; + }; + + /** + * Creates a NamePart message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart + */ + NamePart.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UninterpretedOption.NamePart) + return object; + let message = new $root.google.protobuf.UninterpretedOption.NamePart(); + if (object.name_part != null) + message.name_part = String(object.name_part); + if (object.is_extension != null) + message.is_extension = Boolean(object.is_extension); + return message; + }; + + /** + * Creates a plain object from a NamePart message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.NamePart} message NamePart + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NamePart.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.name_part = ""; + object.is_extension = false; + } + if (message.name_part != null && message.hasOwnProperty("name_part")) + object.name_part = message.name_part; + if (message.is_extension != null && message.hasOwnProperty("is_extension")) + object.is_extension = message.is_extension; + return object; + }; + + /** + * Converts this NamePart to JSON. + * @function toJSON + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + * @returns {Object.} JSON object + */ + NamePart.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return NamePart; + })(); + + return UninterpretedOption; + })(); + + protobuf.SourceCodeInfo = (function() { + + /** + * Properties of a SourceCodeInfo. + * @memberof google.protobuf + * @interface ISourceCodeInfo + * @property {Array.|null} [location] SourceCodeInfo location + */ + + /** + * Constructs a new SourceCodeInfo. + * @memberof google.protobuf + * @classdesc Represents a SourceCodeInfo. + * @implements ISourceCodeInfo + * @constructor + * @param {google.protobuf.ISourceCodeInfo=} [properties] Properties to set + */ + function SourceCodeInfo(properties) { + this.location = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SourceCodeInfo location. + * @member {Array.} location + * @memberof google.protobuf.SourceCodeInfo + * @instance + */ + SourceCodeInfo.prototype.location = $util.emptyArray; + + /** + * Encodes the specified SourceCodeInfo message. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @function encode + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceCodeInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.location != null && message.location.length) + for (let i = 0; i < message.location.length; ++i) + $root.google.protobuf.SourceCodeInfo.Location.encode(message.location[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SourceCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceCodeInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.location && message.location.length)) + message.location = []; + message.location.push($root.google.protobuf.SourceCodeInfo.Location.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceCodeInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SourceCodeInfo message. + * @function verify + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SourceCodeInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.location != null && message.hasOwnProperty("location")) { + if (!Array.isArray(message.location)) + return "location: array expected"; + for (let i = 0; i < message.location.length; ++i) { + let error = $root.google.protobuf.SourceCodeInfo.Location.verify(message.location[i]); + if (error) + return "location." + error; + } + } + return null; + }; + + /** + * Creates a SourceCodeInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + */ + SourceCodeInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.SourceCodeInfo) + return object; + let message = new $root.google.protobuf.SourceCodeInfo(); + if (object.location) { + if (!Array.isArray(object.location)) + throw TypeError(".google.protobuf.SourceCodeInfo.location: array expected"); + message.location = []; + for (let i = 0; i < object.location.length; ++i) { + if (typeof object.location[i] !== "object") + throw TypeError(".google.protobuf.SourceCodeInfo.location: object expected"); + message.location[i] = $root.google.protobuf.SourceCodeInfo.Location.fromObject(object.location[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SourceCodeInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.SourceCodeInfo} message SourceCodeInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SourceCodeInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.location = []; + if (message.location && message.location.length) { + object.location = []; + for (let j = 0; j < message.location.length; ++j) + object.location[j] = $root.google.protobuf.SourceCodeInfo.Location.toObject(message.location[j], options); + } + return object; + }; + + /** + * Converts this SourceCodeInfo to JSON. + * @function toJSON + * @memberof google.protobuf.SourceCodeInfo + * @instance + * @returns {Object.} JSON object + */ + SourceCodeInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + SourceCodeInfo.Location = (function() { + + /** + * Properties of a Location. + * @memberof google.protobuf.SourceCodeInfo + * @interface ILocation + * @property {Array.|null} [path] Location path + * @property {Array.|null} [span] Location span + * @property {string|null} [leading_comments] Location leading_comments + * @property {string|null} [trailing_comments] Location trailing_comments + * @property {Array.|null} [leading_detached_comments] Location leading_detached_comments + */ + + /** + * Constructs a new Location. + * @memberof google.protobuf.SourceCodeInfo + * @classdesc Represents a Location. + * @implements ILocation + * @constructor + * @param {google.protobuf.SourceCodeInfo.ILocation=} [properties] Properties to set + */ + function Location(properties) { + this.path = []; + this.span = []; + this.leading_detached_comments = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Location path. + * @member {Array.} path + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.path = $util.emptyArray; + + /** + * Location span. + * @member {Array.} span + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.span = $util.emptyArray; + + /** + * Location leading_comments. + * @member {string} leading_comments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.leading_comments = ""; + + /** + * Location trailing_comments. + * @member {string} trailing_comments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.trailing_comments = ""; + + /** + * Location leading_detached_comments. + * @member {Array.} leading_detached_comments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.leading_detached_comments = $util.emptyArray; + + /** + * Encodes the specified Location message. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @function encode + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation} message Location message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Location.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.path != null && message.path.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (let i = 0; i < message.path.length; ++i) + writer.int32(message.path[i]); + writer.ldelim(); + } + if (message.span != null && message.span.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (let i = 0; i < message.span.length; ++i) + writer.int32(message.span[i]); + writer.ldelim(); + } + if (message.leading_comments != null && Object.hasOwnProperty.call(message, "leading_comments")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.leading_comments); + if (message.trailing_comments != null && Object.hasOwnProperty.call(message, "trailing_comments")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.trailing_comments); + if (message.leading_detached_comments != null && message.leading_detached_comments.length) + for (let i = 0; i < message.leading_detached_comments.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.leading_detached_comments[i]); + return writer; + }; + + /** + * Encodes the specified Location message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation} message Location message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Location.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Location message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.SourceCodeInfo.Location} Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Location.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo.Location(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.path && message.path.length)) + message.path = []; + if ((tag & 7) === 2) { + let end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.path.push(reader.int32()); + } else + message.path.push(reader.int32()); + break; + case 2: + if (!(message.span && message.span.length)) + message.span = []; + if ((tag & 7) === 2) { + let end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.span.push(reader.int32()); + } else + message.span.push(reader.int32()); + break; + case 3: + message.leading_comments = reader.string(); + break; + case 4: + message.trailing_comments = reader.string(); + break; + case 6: + if (!(message.leading_detached_comments && message.leading_detached_comments.length)) + message.leading_detached_comments = []; + message.leading_detached_comments.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Location message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.SourceCodeInfo.Location} Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Location.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Location message. + * @function verify + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Location.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.path != null && message.hasOwnProperty("path")) { + if (!Array.isArray(message.path)) + return "path: array expected"; + for (let i = 0; i < message.path.length; ++i) + if (!$util.isInteger(message.path[i])) + return "path: integer[] expected"; + } + if (message.span != null && message.hasOwnProperty("span")) { + if (!Array.isArray(message.span)) + return "span: array expected"; + for (let i = 0; i < message.span.length; ++i) + if (!$util.isInteger(message.span[i])) + return "span: integer[] expected"; + } + if (message.leading_comments != null && message.hasOwnProperty("leading_comments")) + if (!$util.isString(message.leading_comments)) + return "leading_comments: string expected"; + if (message.trailing_comments != null && message.hasOwnProperty("trailing_comments")) + if (!$util.isString(message.trailing_comments)) + return "trailing_comments: string expected"; + if (message.leading_detached_comments != null && message.hasOwnProperty("leading_detached_comments")) { + if (!Array.isArray(message.leading_detached_comments)) + return "leading_detached_comments: array expected"; + for (let i = 0; i < message.leading_detached_comments.length; ++i) + if (!$util.isString(message.leading_detached_comments[i])) + return "leading_detached_comments: string[] expected"; + } + return null; + }; + + /** + * Creates a Location message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.SourceCodeInfo.Location} Location + */ + Location.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.SourceCodeInfo.Location) + return object; + let message = new $root.google.protobuf.SourceCodeInfo.Location(); + if (object.path) { + if (!Array.isArray(object.path)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.path: array expected"); + message.path = []; + for (let i = 0; i < object.path.length; ++i) + message.path[i] = object.path[i] | 0; + } + if (object.span) { + if (!Array.isArray(object.span)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.span: array expected"); + message.span = []; + for (let i = 0; i < object.span.length; ++i) + message.span[i] = object.span[i] | 0; + } + if (object.leading_comments != null) + message.leading_comments = String(object.leading_comments); + if (object.trailing_comments != null) + message.trailing_comments = String(object.trailing_comments); + if (object.leading_detached_comments) { + if (!Array.isArray(object.leading_detached_comments)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.leading_detached_comments: array expected"); + message.leading_detached_comments = []; + for (let i = 0; i < object.leading_detached_comments.length; ++i) + message.leading_detached_comments[i] = String(object.leading_detached_comments[i]); + } + return message; + }; + + /** + * Creates a plain object from a Location message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.Location} message Location + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Location.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) { + object.path = []; + object.span = []; + object.leading_detached_comments = []; + } + if (options.defaults) { + object.leading_comments = ""; + object.trailing_comments = ""; + } + if (message.path && message.path.length) { + object.path = []; + for (let j = 0; j < message.path.length; ++j) + object.path[j] = message.path[j]; + } + if (message.span && message.span.length) { + object.span = []; + for (let j = 0; j < message.span.length; ++j) + object.span[j] = message.span[j]; + } + if (message.leading_comments != null && message.hasOwnProperty("leading_comments")) + object.leading_comments = message.leading_comments; + if (message.trailing_comments != null && message.hasOwnProperty("trailing_comments")) + object.trailing_comments = message.trailing_comments; + if (message.leading_detached_comments && message.leading_detached_comments.length) { + object.leading_detached_comments = []; + for (let j = 0; j < message.leading_detached_comments.length; ++j) + object.leading_detached_comments[j] = message.leading_detached_comments[j]; + } + return object; + }; + + /** + * Converts this Location to JSON. + * @function toJSON + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + * @returns {Object.} JSON object + */ + Location.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Location; + })(); + + return SourceCodeInfo; + })(); + + protobuf.GeneratedCodeInfo = (function() { + + /** + * Properties of a GeneratedCodeInfo. + * @memberof google.protobuf + * @interface IGeneratedCodeInfo + * @property {Array.|null} [annotation] GeneratedCodeInfo annotation + */ + + /** + * Constructs a new GeneratedCodeInfo. + * @memberof google.protobuf + * @classdesc Represents a GeneratedCodeInfo. + * @implements IGeneratedCodeInfo + * @constructor + * @param {google.protobuf.IGeneratedCodeInfo=} [properties] Properties to set + */ + function GeneratedCodeInfo(properties) { + this.annotation = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GeneratedCodeInfo annotation. + * @member {Array.} annotation + * @memberof google.protobuf.GeneratedCodeInfo + * @instance + */ + GeneratedCodeInfo.prototype.annotation = $util.emptyArray; + + /** + * Encodes the specified GeneratedCodeInfo message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @function encode + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GeneratedCodeInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.annotation != null && message.annotation.length) + for (let i = 0; i < message.annotation.length; ++i) + $root.google.protobuf.GeneratedCodeInfo.Annotation.encode(message.annotation[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GeneratedCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GeneratedCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GeneratedCodeInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.GeneratedCodeInfo(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.annotation && message.annotation.length)) + message.annotation = []; + message.annotation.push($root.google.protobuf.GeneratedCodeInfo.Annotation.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GeneratedCodeInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GeneratedCodeInfo message. + * @function verify + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GeneratedCodeInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.annotation != null && message.hasOwnProperty("annotation")) { + if (!Array.isArray(message.annotation)) + return "annotation: array expected"; + for (let i = 0; i < message.annotation.length; ++i) { + let error = $root.google.protobuf.GeneratedCodeInfo.Annotation.verify(message.annotation[i]); + if (error) + return "annotation." + error; + } + } + return null; + }; + + /** + * Creates a GeneratedCodeInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + */ + GeneratedCodeInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.GeneratedCodeInfo) + return object; + let message = new $root.google.protobuf.GeneratedCodeInfo(); + if (object.annotation) { + if (!Array.isArray(object.annotation)) + throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: array expected"); + message.annotation = []; + for (let i = 0; i < object.annotation.length; ++i) { + if (typeof object.annotation[i] !== "object") + throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: object expected"); + message.annotation[i] = $root.google.protobuf.GeneratedCodeInfo.Annotation.fromObject(object.annotation[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a GeneratedCodeInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.GeneratedCodeInfo} message GeneratedCodeInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GeneratedCodeInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.annotation = []; + if (message.annotation && message.annotation.length) { + object.annotation = []; + for (let j = 0; j < message.annotation.length; ++j) + object.annotation[j] = $root.google.protobuf.GeneratedCodeInfo.Annotation.toObject(message.annotation[j], options); + } + return object; + }; + + /** + * Converts this GeneratedCodeInfo to JSON. + * @function toJSON + * @memberof google.protobuf.GeneratedCodeInfo + * @instance + * @returns {Object.} JSON object + */ + GeneratedCodeInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GeneratedCodeInfo.Annotation = (function() { + + /** + * Properties of an Annotation. + * @memberof google.protobuf.GeneratedCodeInfo + * @interface IAnnotation + * @property {Array.|null} [path] Annotation path + * @property {string|null} [source_file] Annotation source_file + * @property {number|null} [begin] Annotation begin + * @property {number|null} [end] Annotation end + */ + + /** + * Constructs a new Annotation. + * @memberof google.protobuf.GeneratedCodeInfo + * @classdesc Represents an Annotation. + * @implements IAnnotation + * @constructor + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation=} [properties] Properties to set + */ + function Annotation(properties) { + this.path = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Annotation path. + * @member {Array.} path + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.path = $util.emptyArray; + + /** + * Annotation source_file. + * @member {string} source_file + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.source_file = ""; + + /** + * Annotation begin. + * @member {number} begin + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.begin = 0; + + /** + * Annotation end. + * @member {number} end + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.end = 0; + + /** + * Encodes the specified Annotation message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @function encode + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation} message Annotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Annotation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.path != null && message.path.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (let i = 0; i < message.path.length; ++i) + writer.int32(message.path[i]); + writer.ldelim(); + } + if (message.source_file != null && Object.hasOwnProperty.call(message, "source_file")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.source_file); + if (message.begin != null && Object.hasOwnProperty.call(message, "begin")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.begin); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.end); + return writer; + }; + + /** + * Encodes the specified Annotation message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation} message Annotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Annotation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Annotation message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Annotation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.GeneratedCodeInfo.Annotation(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.path && message.path.length)) + message.path = []; + if ((tag & 7) === 2) { + let end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.path.push(reader.int32()); + } else + message.path.push(reader.int32()); + break; + case 2: + message.source_file = reader.string(); + break; + case 3: + message.begin = reader.int32(); + break; + case 4: + message.end = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Annotation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Annotation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Annotation message. + * @function verify + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Annotation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.path != null && message.hasOwnProperty("path")) { + if (!Array.isArray(message.path)) + return "path: array expected"; + for (let i = 0; i < message.path.length; ++i) + if (!$util.isInteger(message.path[i])) + return "path: integer[] expected"; + } + if (message.source_file != null && message.hasOwnProperty("source_file")) + if (!$util.isString(message.source_file)) + return "source_file: string expected"; + if (message.begin != null && message.hasOwnProperty("begin")) + if (!$util.isInteger(message.begin)) + return "begin: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + return null; + }; + + /** + * Creates an Annotation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation + */ + Annotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.GeneratedCodeInfo.Annotation) + return object; + let message = new $root.google.protobuf.GeneratedCodeInfo.Annotation(); + if (object.path) { + if (!Array.isArray(object.path)) + throw TypeError(".google.protobuf.GeneratedCodeInfo.Annotation.path: array expected"); + message.path = []; + for (let i = 0; i < object.path.length; ++i) + message.path[i] = object.path[i] | 0; + } + if (object.source_file != null) + message.source_file = String(object.source_file); + if (object.begin != null) + message.begin = object.begin | 0; + if (object.end != null) + message.end = object.end | 0; + return message; + }; + + /** + * Creates a plain object from an Annotation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.Annotation} message Annotation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Annotation.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.path = []; + if (options.defaults) { + object.source_file = ""; + object.begin = 0; + object.end = 0; + } + if (message.path && message.path.length) { + object.path = []; + for (let j = 0; j < message.path.length; ++j) + object.path[j] = message.path[j]; + } + if (message.source_file != null && message.hasOwnProperty("source_file")) + object.source_file = message.source_file; + if (message.begin != null && message.hasOwnProperty("begin")) + object.begin = message.begin; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + return object; + }; + + /** + * Converts this Annotation to JSON. + * @function toJSON + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + * @returns {Object.} JSON object + */ + Annotation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Annotation; + })(); + + return GeneratedCodeInfo; + })(); + + protobuf.Timestamp = (function() { + + /** + * Properties of a Timestamp. + * @memberof google.protobuf + * @interface ITimestamp + * @property {Long|null} [seconds] Timestamp seconds + * @property {number|null} [nanos] Timestamp nanos + */ + + /** + * Constructs a new Timestamp. + * @memberof google.protobuf + * @classdesc Represents a Timestamp. + * @implements ITimestamp + * @constructor + * @param {google.protobuf.ITimestamp=} [properties] Properties to set + */ + function Timestamp(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Timestamp seconds. + * @member {Long} seconds + * @memberof google.protobuf.Timestamp + * @instance + */ + Timestamp.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Timestamp nanos. + * @member {number} nanos + * @memberof google.protobuf.Timestamp + * @instance + */ + Timestamp.prototype.nanos = 0; + + /** + * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Timestamp.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); + return writer; + }; + + /** + * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Timestamp.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Timestamp message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Timestamp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Timestamp} Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Timestamp.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Timestamp(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.seconds = reader.int64(); + break; + case 2: + message.nanos = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Timestamp message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Timestamp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Timestamp} Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Timestamp.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Timestamp message. + * @function verify + * @memberof google.protobuf.Timestamp + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Timestamp.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) + return "seconds: integer|Long expected"; + if (message.nanos != null && message.hasOwnProperty("nanos")) + if (!$util.isInteger(message.nanos)) + return "nanos: integer expected"; + return null; + }; + + /** + * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Timestamp + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Timestamp} Timestamp + */ + Timestamp.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Timestamp) + return object; + let message = new $root.google.protobuf.Timestamp(); + if (object.seconds != null) + if ($util.Long) + (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; + else if (typeof object.seconds === "string") + message.seconds = parseInt(object.seconds, 10); + else if (typeof object.seconds === "number") + message.seconds = object.seconds; + else if (typeof object.seconds === "object") + message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); + if (object.nanos != null) + message.nanos = object.nanos | 0; + return message; + }; + + /** + * Creates a plain object from a Timestamp message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.Timestamp} message Timestamp + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Timestamp.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.seconds = options.longs === String ? "0" : 0; + object.nanos = 0; + } + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (typeof message.seconds === "number") + object.seconds = options.longs === String ? String(message.seconds) : message.seconds; + else + object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; + if (message.nanos != null && message.hasOwnProperty("nanos")) + object.nanos = message.nanos; + return object; + }; + + /** + * Converts this Timestamp to JSON. + * @function toJSON + * @memberof google.protobuf.Timestamp + * @instance + * @returns {Object.} JSON object + */ + Timestamp.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Timestamp; + })(); + + protobuf.Duration = (function() { + + /** + * Properties of a Duration. + * @memberof google.protobuf + * @interface IDuration + * @property {Long|null} [seconds] Duration seconds + * @property {number|null} [nanos] Duration nanos + */ + + /** + * Constructs a new Duration. + * @memberof google.protobuf + * @classdesc Represents a Duration. + * @implements IDuration + * @constructor + * @param {google.protobuf.IDuration=} [properties] Properties to set + */ + function Duration(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Duration seconds. + * @member {Long} seconds + * @memberof google.protobuf.Duration + * @instance + */ + Duration.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Duration nanos. + * @member {number} nanos + * @memberof google.protobuf.Duration + * @instance + */ + Duration.prototype.nanos = 0; + + /** + * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.IDuration} message Duration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Duration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); + return writer; + }; + + /** + * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.IDuration} message Duration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Duration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Duration message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Duration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Duration} Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Duration.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Duration(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.seconds = reader.int64(); + break; + case 2: + message.nanos = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Duration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Duration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Duration} Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Duration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Duration message. + * @function verify + * @memberof google.protobuf.Duration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Duration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) + return "seconds: integer|Long expected"; + if (message.nanos != null && message.hasOwnProperty("nanos")) + if (!$util.isInteger(message.nanos)) + return "nanos: integer expected"; + return null; + }; + + /** + * Creates a Duration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Duration + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Duration} Duration + */ + Duration.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Duration) + return object; + let message = new $root.google.protobuf.Duration(); + if (object.seconds != null) + if ($util.Long) + (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; + else if (typeof object.seconds === "string") + message.seconds = parseInt(object.seconds, 10); + else if (typeof object.seconds === "number") + message.seconds = object.seconds; + else if (typeof object.seconds === "object") + message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); + if (object.nanos != null) + message.nanos = object.nanos | 0; + return message; + }; + + /** + * Creates a plain object from a Duration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.Duration} message Duration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Duration.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.seconds = options.longs === String ? "0" : 0; + object.nanos = 0; + } + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (typeof message.seconds === "number") + object.seconds = options.longs === String ? String(message.seconds) : message.seconds; + else + object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; + if (message.nanos != null && message.hasOwnProperty("nanos")) + object.nanos = message.nanos; + return object; + }; + + /** + * Converts this Duration to JSON. + * @function toJSON + * @memberof google.protobuf.Duration + * @instance + * @returns {Object.} JSON object + */ + Duration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Duration; + })(); + + return protobuf; + })(); + + google.api = (function() { + + /** + * Namespace api. + * @memberof google + * @namespace + */ + const api = {}; + + api.Http = (function() { + + /** + * Properties of a Http. + * @memberof google.api + * @interface IHttp + * @property {Array.|null} [rules] Http rules + */ + + /** + * Constructs a new Http. + * @memberof google.api + * @classdesc Represents a Http. + * @implements IHttp + * @constructor + * @param {google.api.IHttp=} [properties] Properties to set + */ + function Http(properties) { + this.rules = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Http rules. + * @member {Array.} rules + * @memberof google.api.Http + * @instance + */ + Http.prototype.rules = $util.emptyArray; + + /** + * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @function encode + * @memberof google.api.Http + * @static + * @param {google.api.IHttp} message Http message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Http.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rules != null && message.rules.length) + for (let i = 0; i < message.rules.length; ++i) + $root.google.api.HttpRule.encode(message.rules[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Http + * @static + * @param {google.api.IHttp} message Http message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Http.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Http message from the specified reader or buffer. + * @function decode + * @memberof google.api.Http + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Http} Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Http.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Http(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.rules && message.rules.length)) + message.rules = []; + message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Http message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Http + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Http} Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Http.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Http message. + * @function verify + * @memberof google.api.Http + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Http.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rules != null && message.hasOwnProperty("rules")) { + if (!Array.isArray(message.rules)) + return "rules: array expected"; + for (let i = 0; i < message.rules.length; ++i) { + let error = $root.google.api.HttpRule.verify(message.rules[i]); + if (error) + return "rules." + error; + } + } + return null; + }; + + /** + * Creates a Http message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Http + * @static + * @param {Object.} object Plain object + * @returns {google.api.Http} Http + */ + Http.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Http) + return object; + let message = new $root.google.api.Http(); + if (object.rules) { + if (!Array.isArray(object.rules)) + throw TypeError(".google.api.Http.rules: array expected"); + message.rules = []; + for (let i = 0; i < object.rules.length; ++i) { + if (typeof object.rules[i] !== "object") + throw TypeError(".google.api.Http.rules: object expected"); + message.rules[i] = $root.google.api.HttpRule.fromObject(object.rules[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Http message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Http + * @static + * @param {google.api.Http} message Http + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Http.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.rules = []; + if (message.rules && message.rules.length) { + object.rules = []; + for (let j = 0; j < message.rules.length; ++j) + object.rules[j] = $root.google.api.HttpRule.toObject(message.rules[j], options); + } + return object; + }; + + /** + * Converts this Http to JSON. + * @function toJSON + * @memberof google.api.Http + * @instance + * @returns {Object.} JSON object + */ + Http.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Http; + })(); + + api.HttpRule = (function() { + + /** + * Properties of a HttpRule. + * @memberof google.api + * @interface IHttpRule + * @property {string|null} [get] HttpRule get + * @property {string|null} [put] HttpRule put + * @property {string|null} [post] HttpRule post + * @property {string|null} ["delete"] HttpRule delete + * @property {string|null} [patch] HttpRule patch + * @property {google.api.ICustomHttpPattern|null} [custom] HttpRule custom + * @property {string|null} [selector] HttpRule selector + * @property {string|null} [body] HttpRule body + * @property {Array.|null} [additional_bindings] HttpRule additional_bindings + */ + + /** + * Constructs a new HttpRule. + * @memberof google.api + * @classdesc Represents a HttpRule. + * @implements IHttpRule + * @constructor + * @param {google.api.IHttpRule=} [properties] Properties to set + */ + function HttpRule(properties) { + this.additional_bindings = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HttpRule get. + * @member {string} get + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.get = ""; + + /** + * HttpRule put. + * @member {string} put + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.put = ""; + + /** + * HttpRule post. + * @member {string} post + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.post = ""; + + /** + * HttpRule delete. + * @member {string} delete + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype["delete"] = ""; + + /** + * HttpRule patch. + * @member {string} patch + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.patch = ""; + + /** + * HttpRule custom. + * @member {google.api.ICustomHttpPattern|null|undefined} custom + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.custom = null; + + /** + * HttpRule selector. + * @member {string} selector + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.selector = ""; + + /** + * HttpRule body. + * @member {string} body + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.body = ""; + + /** + * HttpRule additional_bindings. + * @member {Array.} additional_bindings + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.additional_bindings = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + let $oneOfFields; + + /** + * HttpRule pattern. + * @member {"get"|"put"|"post"|"delete"|"patch"|"custom"|undefined} pattern + * @memberof google.api.HttpRule + * @instance + */ + Object.defineProperty(HttpRule.prototype, "pattern", { + get: $util.oneOfGetter($oneOfFields = ["get", "put", "post", "delete", "patch", "custom"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @function encode + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule} message HttpRule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpRule.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); + if (message.get != null && Object.hasOwnProperty.call(message, "get")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.get); + if (message.put != null && Object.hasOwnProperty.call(message, "put")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.put); + if (message.post != null && Object.hasOwnProperty.call(message, "post")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.post); + if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message["delete"]); + if (message.patch != null && Object.hasOwnProperty.call(message, "patch")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.patch); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.body); + if (message.custom != null && Object.hasOwnProperty.call(message, "custom")) + $root.google.api.CustomHttpPattern.encode(message.custom, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.additional_bindings != null && message.additional_bindings.length) + for (let i = 0; i < message.additional_bindings.length; ++i) + $root.google.api.HttpRule.encode(message.additional_bindings[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule} message HttpRule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpRule.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HttpRule message from the specified reader or buffer. + * @function decode + * @memberof google.api.HttpRule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.HttpRule} HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpRule.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.HttpRule(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + 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 = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32()); + break; + case 1: + message.selector = reader.string(); + break; + case 7: + message.body = reader.string(); + break; + case 11: + if (!(message.additional_bindings && message.additional_bindings.length)) + message.additional_bindings = []; + message.additional_bindings.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HttpRule message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.HttpRule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.HttpRule} HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpRule.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HttpRule message. + * @function verify + * @memberof google.api.HttpRule + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HttpRule.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + let properties = {}; + if (message.get != null && message.hasOwnProperty("get")) { + properties.pattern = 1; + if (!$util.isString(message.get)) + return "get: string expected"; + } + if (message.put != null && message.hasOwnProperty("put")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.put)) + return "put: string expected"; + } + if (message.post != null && message.hasOwnProperty("post")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.post)) + return "post: string expected"; + } + if (message["delete"] != null && message.hasOwnProperty("delete")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message["delete"])) + return "delete: string expected"; + } + if (message.patch != null && message.hasOwnProperty("patch")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.patch)) + return "patch: string expected"; + } + if (message.custom != null && message.hasOwnProperty("custom")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + { + let error = $root.google.api.CustomHttpPattern.verify(message.custom); + if (error) + return "custom." + error; + } + } + if (message.selector != null && message.hasOwnProperty("selector")) + if (!$util.isString(message.selector)) + return "selector: string expected"; + if (message.body != null && message.hasOwnProperty("body")) + if (!$util.isString(message.body)) + return "body: string expected"; + if (message.additional_bindings != null && message.hasOwnProperty("additional_bindings")) { + if (!Array.isArray(message.additional_bindings)) + return "additional_bindings: array expected"; + for (let i = 0; i < message.additional_bindings.length; ++i) { + let error = $root.google.api.HttpRule.verify(message.additional_bindings[i]); + if (error) + return "additional_bindings." + error; + } + } + return null; + }; + + /** + * Creates a HttpRule message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.HttpRule + * @static + * @param {Object.} object Plain object + * @returns {google.api.HttpRule} HttpRule + */ + HttpRule.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.HttpRule) + return object; + let message = new $root.google.api.HttpRule(); + if (object.get != null) + message.get = String(object.get); + if (object.put != null) + message.put = String(object.put); + if (object.post != null) + message.post = String(object.post); + if (object["delete"] != null) + message["delete"] = String(object["delete"]); + if (object.patch != null) + message.patch = String(object.patch); + if (object.custom != null) { + if (typeof object.custom !== "object") + throw TypeError(".google.api.HttpRule.custom: object expected"); + message.custom = $root.google.api.CustomHttpPattern.fromObject(object.custom); + } + if (object.selector != null) + message.selector = String(object.selector); + if (object.body != null) + message.body = String(object.body); + if (object.additional_bindings) { + if (!Array.isArray(object.additional_bindings)) + throw TypeError(".google.api.HttpRule.additional_bindings: array expected"); + message.additional_bindings = []; + for (let i = 0; i < object.additional_bindings.length; ++i) { + if (typeof object.additional_bindings[i] !== "object") + throw TypeError(".google.api.HttpRule.additional_bindings: object expected"); + message.additional_bindings[i] = $root.google.api.HttpRule.fromObject(object.additional_bindings[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a HttpRule message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.HttpRule + * @static + * @param {google.api.HttpRule} message HttpRule + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HttpRule.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.additional_bindings = []; + if (options.defaults) { + object.selector = ""; + object.body = ""; + } + if (message.selector != null && message.hasOwnProperty("selector")) + object.selector = message.selector; + if (message.get != null && message.hasOwnProperty("get")) { + object.get = message.get; + if (options.oneofs) + object.pattern = "get"; + } + if (message.put != null && message.hasOwnProperty("put")) { + object.put = message.put; + if (options.oneofs) + object.pattern = "put"; + } + if (message.post != null && message.hasOwnProperty("post")) { + object.post = message.post; + if (options.oneofs) + object.pattern = "post"; + } + if (message["delete"] != null && message.hasOwnProperty("delete")) { + object["delete"] = message["delete"]; + if (options.oneofs) + object.pattern = "delete"; + } + if (message.patch != null && message.hasOwnProperty("patch")) { + object.patch = message.patch; + if (options.oneofs) + object.pattern = "patch"; + } + if (message.body != null && message.hasOwnProperty("body")) + object.body = message.body; + if (message.custom != null && message.hasOwnProperty("custom")) { + object.custom = $root.google.api.CustomHttpPattern.toObject(message.custom, options); + if (options.oneofs) + object.pattern = "custom"; + } + if (message.additional_bindings && message.additional_bindings.length) { + object.additional_bindings = []; + for (let j = 0; j < message.additional_bindings.length; ++j) + object.additional_bindings[j] = $root.google.api.HttpRule.toObject(message.additional_bindings[j], options); + } + return object; + }; + + /** + * Converts this HttpRule to JSON. + * @function toJSON + * @memberof google.api.HttpRule + * @instance + * @returns {Object.} JSON object + */ + HttpRule.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return HttpRule; + })(); + + api.CustomHttpPattern = (function() { + + /** + * Properties of a CustomHttpPattern. + * @memberof google.api + * @interface ICustomHttpPattern + * @property {string|null} [kind] CustomHttpPattern kind + * @property {string|null} [path] CustomHttpPattern path + */ + + /** + * Constructs a new CustomHttpPattern. + * @memberof google.api + * @classdesc Represents a CustomHttpPattern. + * @implements ICustomHttpPattern + * @constructor + * @param {google.api.ICustomHttpPattern=} [properties] Properties to set + */ + function CustomHttpPattern(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CustomHttpPattern kind. + * @member {string} kind + * @memberof google.api.CustomHttpPattern + * @instance + */ + CustomHttpPattern.prototype.kind = ""; + + /** + * CustomHttpPattern path. + * @member {string} path + * @memberof google.api.CustomHttpPattern + * @instance + */ + CustomHttpPattern.prototype.path = ""; + + /** + * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @function encode + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomHttpPattern.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); + return writer; + }; + + /** + * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomHttpPattern.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer. + * @function decode + * @memberof google.api.CustomHttpPattern + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomHttpPattern.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CustomHttpPattern(); + while (reader.pos < end) { + let 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; + }; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.CustomHttpPattern + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomHttpPattern.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CustomHttpPattern message. + * @function verify + * @memberof google.api.CustomHttpPattern + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CustomHttpPattern.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!$util.isString(message.path)) + return "path: string expected"; + return null; + }; + + /** + * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.CustomHttpPattern + * @static + * @param {Object.} object Plain object + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + */ + CustomHttpPattern.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.CustomHttpPattern) + return object; + let message = new $root.google.api.CustomHttpPattern(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.path != null) + message.path = String(object.path); + return message; + }; + + /** + * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.CustomHttpPattern} message CustomHttpPattern + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CustomHttpPattern.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.kind = ""; + object.path = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.path != null && message.hasOwnProperty("path")) + object.path = message.path; + return object; + }; + + /** + * Converts this CustomHttpPattern to JSON. + * @function toJSON + * @memberof google.api.CustomHttpPattern + * @instance + * @returns {Object.} JSON object + */ + CustomHttpPattern.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CustomHttpPattern; + })(); + + api.HttpBody = (function() { + + /** + * Properties of a HttpBody. + * @memberof google.api + * @interface IHttpBody + * @property {string|null} [content_type] HttpBody content_type + * @property {Uint8Array|null} [data] HttpBody data + * @property {Array.|null} [extensions] HttpBody extensions + */ + + /** + * Constructs a new HttpBody. + * @memberof google.api + * @classdesc Represents a HttpBody. + * @implements IHttpBody + * @constructor + * @param {google.api.IHttpBody=} [properties] Properties to set + */ + function HttpBody(properties) { + this.extensions = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HttpBody content_type. + * @member {string} content_type + * @memberof google.api.HttpBody + * @instance + */ + HttpBody.prototype.content_type = ""; + + /** + * HttpBody data. + * @member {Uint8Array} data + * @memberof google.api.HttpBody + * @instance + */ + HttpBody.prototype.data = $util.newBuffer([]); + + /** + * HttpBody extensions. + * @member {Array.} extensions + * @memberof google.api.HttpBody + * @instance + */ + HttpBody.prototype.extensions = $util.emptyArray; + + /** + * Encodes the specified HttpBody message. Does not implicitly {@link google.api.HttpBody.verify|verify} messages. + * @function encode + * @memberof google.api.HttpBody + * @static + * @param {google.api.IHttpBody} message HttpBody message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpBody.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.content_type != null && Object.hasOwnProperty.call(message, "content_type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.content_type); + if (message.data != null && Object.hasOwnProperty.call(message, "data")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.data); + if (message.extensions != null && message.extensions.length) + for (let i = 0; i < message.extensions.length; ++i) + $root.google.protobuf.Any.encode(message.extensions[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified HttpBody message, length delimited. Does not implicitly {@link google.api.HttpBody.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.HttpBody + * @static + * @param {google.api.IHttpBody} message HttpBody message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpBody.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HttpBody message from the specified reader or buffer. + * @function decode + * @memberof google.api.HttpBody + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.HttpBody} HttpBody + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpBody.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.HttpBody(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.content_type = reader.string(); + break; + case 2: + message.data = reader.bytes(); + break; + case 3: + if (!(message.extensions && message.extensions.length)) + message.extensions = []; + message.extensions.push($root.google.protobuf.Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HttpBody message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.HttpBody + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.HttpBody} HttpBody + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpBody.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HttpBody message. + * @function verify + * @memberof google.api.HttpBody + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HttpBody.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.content_type != null && message.hasOwnProperty("content_type")) + if (!$util.isString(message.content_type)) + return "content_type: string expected"; + if (message.data != null && message.hasOwnProperty("data")) + if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) + return "data: buffer expected"; + if (message.extensions != null && message.hasOwnProperty("extensions")) { + if (!Array.isArray(message.extensions)) + return "extensions: array expected"; + for (let i = 0; i < message.extensions.length; ++i) { + let error = $root.google.protobuf.Any.verify(message.extensions[i]); + if (error) + return "extensions." + error; + } + } + return null; + }; + + /** + * Creates a HttpBody message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.HttpBody + * @static + * @param {Object.} object Plain object + * @returns {google.api.HttpBody} HttpBody + */ + HttpBody.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.HttpBody) + return object; + let message = new $root.google.api.HttpBody(); + if (object.content_type != null) + message.content_type = String(object.content_type); + if (object.data != null) + if (typeof object.data === "string") + $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); + else if (object.data.length) + message.data = object.data; + if (object.extensions) { + if (!Array.isArray(object.extensions)) + throw TypeError(".google.api.HttpBody.extensions: array expected"); + message.extensions = []; + for (let i = 0; i < object.extensions.length; ++i) { + if (typeof object.extensions[i] !== "object") + throw TypeError(".google.api.HttpBody.extensions: object expected"); + message.extensions[i] = $root.google.protobuf.Any.fromObject(object.extensions[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a HttpBody message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.HttpBody + * @static + * @param {google.api.HttpBody} message HttpBody + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HttpBody.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.extensions = []; + if (options.defaults) { + object.content_type = ""; + if (options.bytes === String) + object.data = ""; + else { + object.data = []; + if (options.bytes !== Array) + object.data = $util.newBuffer(object.data); + } + } + if (message.content_type != null && message.hasOwnProperty("content_type")) + object.content_type = message.content_type; + if (message.data != null && message.hasOwnProperty("data")) + object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; + if (message.extensions && message.extensions.length) { + object.extensions = []; + for (let j = 0; j < message.extensions.length; ++j) + object.extensions[j] = $root.google.protobuf.Any.toObject(message.extensions[j], options); + } + return object; + }; + + /** + * Converts this HttpBody to JSON. + * @function toJSON + * @memberof google.api.HttpBody + * @instance + * @returns {Object.} JSON object + */ + HttpBody.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return HttpBody; + })(); + + return api; + })(); + + return google; +})(); + +export const cosmos_proto = $root.cosmos_proto = (() => { + + /** + * Namespace cosmos_proto. + * @exports cosmos_proto + * @namespace + */ + const cosmos_proto = {}; + + return cosmos_proto; +})(); + +export const gogoproto = $root.gogoproto = (() => { + + /** + * Namespace gogoproto. + * @exports gogoproto + * @namespace + */ + const gogoproto = {}; + + return gogoproto; +})(); + +export const ibc = $root.ibc = (() => { + + /** + * Namespace ibc. + * @exports ibc + * @namespace + */ + const ibc = {}; + + ibc.applications = (function() { + + /** + * Namespace applications. + * @memberof ibc + * @namespace + */ + const applications = {}; + + applications.transfer = (function() { + + /** + * Namespace transfer. + * @memberof ibc.applications + * @namespace + */ + const transfer = {}; + + transfer.v1 = (function() { + + /** + * Namespace v1. + * @memberof ibc.applications.transfer + * @namespace + */ + const v1 = {}; + + v1.Msg = (function() { + + /** + * Constructs a new Msg service. + * @memberof ibc.applications.transfer.v1 + * @classdesc Represents a Msg + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Msg(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Msg.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Msg; + + /** + * Callback as used by {@link ibc.applications.transfer.v1.Msg#transfer}. + * @memberof ibc.applications.transfer.v1.Msg + * @typedef TransferCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.applications.transfer.v1.MsgTransferResponse} [response] MsgTransferResponse + */ + + /** + * Calls Transfer. + * @function transfer + * @memberof ibc.applications.transfer.v1.Msg + * @instance + * @param {ibc.applications.transfer.v1.IMsgTransfer} request MsgTransfer message or plain object + * @param {ibc.applications.transfer.v1.Msg.TransferCallback} callback Node-style callback called with the error, if any, and MsgTransferResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.transfer = function transfer(request, callback) { + return this.rpcCall(transfer, $root.ibc.applications.transfer.v1.MsgTransfer, $root.ibc.applications.transfer.v1.MsgTransferResponse, request, callback); + }, "name", { value: "Transfer" }); + + /** + * Calls Transfer. + * @function transfer + * @memberof ibc.applications.transfer.v1.Msg + * @instance + * @param {ibc.applications.transfer.v1.IMsgTransfer} request MsgTransfer message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Msg; + })(); + + v1.MsgTransfer = (function() { + + /** + * Properties of a MsgTransfer. + * @memberof ibc.applications.transfer.v1 + * @interface IMsgTransfer + * @property {string|null} [source_port] MsgTransfer source_port + * @property {string|null} [source_channel] MsgTransfer source_channel + * @property {cosmos.base.v1beta1.ICoin|null} [token] MsgTransfer token + * @property {string|null} [sender] MsgTransfer sender + * @property {string|null} [receiver] MsgTransfer receiver + * @property {ibc.core.client.v1.IHeight|null} [timeout_height] MsgTransfer timeout_height + * @property {Long|null} [timeout_timestamp] MsgTransfer timeout_timestamp + */ + + /** + * Constructs a new MsgTransfer. + * @memberof ibc.applications.transfer.v1 + * @classdesc Represents a MsgTransfer. + * @implements IMsgTransfer + * @constructor + * @param {ibc.applications.transfer.v1.IMsgTransfer=} [properties] Properties to set + */ + function MsgTransfer(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgTransfer source_port. + * @member {string} source_port + * @memberof ibc.applications.transfer.v1.MsgTransfer + * @instance + */ + MsgTransfer.prototype.source_port = ""; + + /** + * MsgTransfer source_channel. + * @member {string} source_channel + * @memberof ibc.applications.transfer.v1.MsgTransfer + * @instance + */ + MsgTransfer.prototype.source_channel = ""; + + /** + * MsgTransfer token. + * @member {cosmos.base.v1beta1.ICoin|null|undefined} token + * @memberof ibc.applications.transfer.v1.MsgTransfer + * @instance + */ + MsgTransfer.prototype.token = null; + + /** + * MsgTransfer sender. + * @member {string} sender + * @memberof ibc.applications.transfer.v1.MsgTransfer + * @instance + */ + MsgTransfer.prototype.sender = ""; + + /** + * MsgTransfer receiver. + * @member {string} receiver + * @memberof ibc.applications.transfer.v1.MsgTransfer + * @instance + */ + MsgTransfer.prototype.receiver = ""; + + /** + * MsgTransfer timeout_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} timeout_height + * @memberof ibc.applications.transfer.v1.MsgTransfer + * @instance + */ + MsgTransfer.prototype.timeout_height = null; + + /** + * MsgTransfer timeout_timestamp. + * @member {Long} timeout_timestamp + * @memberof ibc.applications.transfer.v1.MsgTransfer + * @instance + */ + MsgTransfer.prototype.timeout_timestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified MsgTransfer message. Does not implicitly {@link ibc.applications.transfer.v1.MsgTransfer.verify|verify} messages. + * @function encode + * @memberof ibc.applications.transfer.v1.MsgTransfer + * @static + * @param {ibc.applications.transfer.v1.IMsgTransfer} message MsgTransfer message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgTransfer.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.source_port != null && Object.hasOwnProperty.call(message, "source_port")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.source_port); + if (message.source_channel != null && Object.hasOwnProperty.call(message, "source_channel")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.source_channel); + if (message.token != null && Object.hasOwnProperty.call(message, "token")) + $root.cosmos.base.v1beta1.Coin.encode(message.token, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.sender != null && Object.hasOwnProperty.call(message, "sender")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.sender); + if (message.receiver != null && Object.hasOwnProperty.call(message, "receiver")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.receiver); + if (message.timeout_height != null && Object.hasOwnProperty.call(message, "timeout_height")) + $root.ibc.core.client.v1.Height.encode(message.timeout_height, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.timeout_timestamp != null && Object.hasOwnProperty.call(message, "timeout_timestamp")) + writer.uint32(/* id 7, wireType 0 =*/56).uint64(message.timeout_timestamp); + return writer; + }; + + /** + * Encodes the specified MsgTransfer message, length delimited. Does not implicitly {@link ibc.applications.transfer.v1.MsgTransfer.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.applications.transfer.v1.MsgTransfer + * @static + * @param {ibc.applications.transfer.v1.IMsgTransfer} message MsgTransfer message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgTransfer.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgTransfer message from the specified reader or buffer. + * @function decode + * @memberof ibc.applications.transfer.v1.MsgTransfer + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.applications.transfer.v1.MsgTransfer} MsgTransfer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgTransfer.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.applications.transfer.v1.MsgTransfer(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.source_port = reader.string(); + break; + case 2: + message.source_channel = reader.string(); + break; + case 3: + message.token = $root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32()); + break; + case 4: + message.sender = reader.string(); + break; + case 5: + message.receiver = reader.string(); + break; + case 6: + message.timeout_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + case 7: + message.timeout_timestamp = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgTransfer message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.applications.transfer.v1.MsgTransfer + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.applications.transfer.v1.MsgTransfer} MsgTransfer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgTransfer.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgTransfer message. + * @function verify + * @memberof ibc.applications.transfer.v1.MsgTransfer + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgTransfer.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.source_port != null && message.hasOwnProperty("source_port")) + if (!$util.isString(message.source_port)) + return "source_port: string expected"; + if (message.source_channel != null && message.hasOwnProperty("source_channel")) + if (!$util.isString(message.source_channel)) + return "source_channel: string expected"; + if (message.token != null && message.hasOwnProperty("token")) { + let error = $root.cosmos.base.v1beta1.Coin.verify(message.token); + if (error) + return "token." + error; + } + if (message.sender != null && message.hasOwnProperty("sender")) + if (!$util.isString(message.sender)) + return "sender: string expected"; + if (message.receiver != null && message.hasOwnProperty("receiver")) + if (!$util.isString(message.receiver)) + return "receiver: string expected"; + if (message.timeout_height != null && message.hasOwnProperty("timeout_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.timeout_height); + if (error) + return "timeout_height." + error; + } + if (message.timeout_timestamp != null && message.hasOwnProperty("timeout_timestamp")) + if (!$util.isInteger(message.timeout_timestamp) && !(message.timeout_timestamp && $util.isInteger(message.timeout_timestamp.low) && $util.isInteger(message.timeout_timestamp.high))) + return "timeout_timestamp: integer|Long expected"; + return null; + }; + + /** + * Creates a MsgTransfer message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.applications.transfer.v1.MsgTransfer + * @static + * @param {Object.} object Plain object + * @returns {ibc.applications.transfer.v1.MsgTransfer} MsgTransfer + */ + MsgTransfer.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.applications.transfer.v1.MsgTransfer) + return object; + let message = new $root.ibc.applications.transfer.v1.MsgTransfer(); + if (object.source_port != null) + message.source_port = String(object.source_port); + if (object.source_channel != null) + message.source_channel = String(object.source_channel); + if (object.token != null) { + if (typeof object.token !== "object") + throw TypeError(".ibc.applications.transfer.v1.MsgTransfer.token: object expected"); + message.token = $root.cosmos.base.v1beta1.Coin.fromObject(object.token); + } + if (object.sender != null) + message.sender = String(object.sender); + if (object.receiver != null) + message.receiver = String(object.receiver); + if (object.timeout_height != null) { + if (typeof object.timeout_height !== "object") + throw TypeError(".ibc.applications.transfer.v1.MsgTransfer.timeout_height: object expected"); + message.timeout_height = $root.ibc.core.client.v1.Height.fromObject(object.timeout_height); + } + if (object.timeout_timestamp != null) + if ($util.Long) + (message.timeout_timestamp = $util.Long.fromValue(object.timeout_timestamp)).unsigned = true; + else if (typeof object.timeout_timestamp === "string") + message.timeout_timestamp = parseInt(object.timeout_timestamp, 10); + else if (typeof object.timeout_timestamp === "number") + message.timeout_timestamp = object.timeout_timestamp; + else if (typeof object.timeout_timestamp === "object") + message.timeout_timestamp = new $util.LongBits(object.timeout_timestamp.low >>> 0, object.timeout_timestamp.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a MsgTransfer message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.applications.transfer.v1.MsgTransfer + * @static + * @param {ibc.applications.transfer.v1.MsgTransfer} message MsgTransfer + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgTransfer.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.source_port = ""; + object.source_channel = ""; + object.token = null; + object.sender = ""; + object.receiver = ""; + object.timeout_height = null; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.timeout_timestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.timeout_timestamp = options.longs === String ? "0" : 0; + } + if (message.source_port != null && message.hasOwnProperty("source_port")) + object.source_port = message.source_port; + if (message.source_channel != null && message.hasOwnProperty("source_channel")) + object.source_channel = message.source_channel; + if (message.token != null && message.hasOwnProperty("token")) + object.token = $root.cosmos.base.v1beta1.Coin.toObject(message.token, options); + if (message.sender != null && message.hasOwnProperty("sender")) + object.sender = message.sender; + if (message.receiver != null && message.hasOwnProperty("receiver")) + object.receiver = message.receiver; + if (message.timeout_height != null && message.hasOwnProperty("timeout_height")) + object.timeout_height = $root.ibc.core.client.v1.Height.toObject(message.timeout_height, options); + if (message.timeout_timestamp != null && message.hasOwnProperty("timeout_timestamp")) + if (typeof message.timeout_timestamp === "number") + object.timeout_timestamp = options.longs === String ? String(message.timeout_timestamp) : message.timeout_timestamp; + else + object.timeout_timestamp = options.longs === String ? $util.Long.prototype.toString.call(message.timeout_timestamp) : options.longs === Number ? new $util.LongBits(message.timeout_timestamp.low >>> 0, message.timeout_timestamp.high >>> 0).toNumber(true) : message.timeout_timestamp; + return object; + }; + + /** + * Converts this MsgTransfer to JSON. + * @function toJSON + * @memberof ibc.applications.transfer.v1.MsgTransfer + * @instance + * @returns {Object.} JSON object + */ + MsgTransfer.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgTransfer; + })(); + + v1.MsgTransferResponse = (function() { + + /** + * Properties of a MsgTransferResponse. + * @memberof ibc.applications.transfer.v1 + * @interface IMsgTransferResponse + */ + + /** + * Constructs a new MsgTransferResponse. + * @memberof ibc.applications.transfer.v1 + * @classdesc Represents a MsgTransferResponse. + * @implements IMsgTransferResponse + * @constructor + * @param {ibc.applications.transfer.v1.IMsgTransferResponse=} [properties] Properties to set + */ + function MsgTransferResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgTransferResponse message. Does not implicitly {@link ibc.applications.transfer.v1.MsgTransferResponse.verify|verify} messages. + * @function encode + * @memberof ibc.applications.transfer.v1.MsgTransferResponse + * @static + * @param {ibc.applications.transfer.v1.IMsgTransferResponse} message MsgTransferResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgTransferResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgTransferResponse message, length delimited. Does not implicitly {@link ibc.applications.transfer.v1.MsgTransferResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.applications.transfer.v1.MsgTransferResponse + * @static + * @param {ibc.applications.transfer.v1.IMsgTransferResponse} message MsgTransferResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgTransferResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgTransferResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.applications.transfer.v1.MsgTransferResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.applications.transfer.v1.MsgTransferResponse} MsgTransferResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgTransferResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.applications.transfer.v1.MsgTransferResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgTransferResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.applications.transfer.v1.MsgTransferResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.applications.transfer.v1.MsgTransferResponse} MsgTransferResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgTransferResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgTransferResponse message. + * @function verify + * @memberof ibc.applications.transfer.v1.MsgTransferResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgTransferResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgTransferResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.applications.transfer.v1.MsgTransferResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.applications.transfer.v1.MsgTransferResponse} MsgTransferResponse + */ + MsgTransferResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.applications.transfer.v1.MsgTransferResponse) + return object; + return new $root.ibc.applications.transfer.v1.MsgTransferResponse(); + }; + + /** + * Creates a plain object from a MsgTransferResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.applications.transfer.v1.MsgTransferResponse + * @static + * @param {ibc.applications.transfer.v1.MsgTransferResponse} message MsgTransferResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgTransferResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgTransferResponse to JSON. + * @function toJSON + * @memberof ibc.applications.transfer.v1.MsgTransferResponse + * @instance + * @returns {Object.} JSON object + */ + MsgTransferResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgTransferResponse; + })(); + + v1.FungibleTokenPacketData = (function() { + + /** + * Properties of a FungibleTokenPacketData. + * @memberof ibc.applications.transfer.v1 + * @interface IFungibleTokenPacketData + * @property {string|null} [denom] FungibleTokenPacketData denom + * @property {Long|null} [amount] FungibleTokenPacketData amount + * @property {string|null} [sender] FungibleTokenPacketData sender + * @property {string|null} [receiver] FungibleTokenPacketData receiver + */ + + /** + * Constructs a new FungibleTokenPacketData. + * @memberof ibc.applications.transfer.v1 + * @classdesc Represents a FungibleTokenPacketData. + * @implements IFungibleTokenPacketData + * @constructor + * @param {ibc.applications.transfer.v1.IFungibleTokenPacketData=} [properties] Properties to set + */ + function FungibleTokenPacketData(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FungibleTokenPacketData denom. + * @member {string} denom + * @memberof ibc.applications.transfer.v1.FungibleTokenPacketData + * @instance + */ + FungibleTokenPacketData.prototype.denom = ""; + + /** + * FungibleTokenPacketData amount. + * @member {Long} amount + * @memberof ibc.applications.transfer.v1.FungibleTokenPacketData + * @instance + */ + FungibleTokenPacketData.prototype.amount = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * FungibleTokenPacketData sender. + * @member {string} sender + * @memberof ibc.applications.transfer.v1.FungibleTokenPacketData + * @instance + */ + FungibleTokenPacketData.prototype.sender = ""; + + /** + * FungibleTokenPacketData receiver. + * @member {string} receiver + * @memberof ibc.applications.transfer.v1.FungibleTokenPacketData + * @instance + */ + FungibleTokenPacketData.prototype.receiver = ""; + + /** + * Encodes the specified FungibleTokenPacketData message. Does not implicitly {@link ibc.applications.transfer.v1.FungibleTokenPacketData.verify|verify} messages. + * @function encode + * @memberof ibc.applications.transfer.v1.FungibleTokenPacketData + * @static + * @param {ibc.applications.transfer.v1.IFungibleTokenPacketData} message FungibleTokenPacketData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FungibleTokenPacketData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.denom != null && Object.hasOwnProperty.call(message, "denom")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.denom); + if (message.amount != null && Object.hasOwnProperty.call(message, "amount")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.amount); + if (message.sender != null && Object.hasOwnProperty.call(message, "sender")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.sender); + if (message.receiver != null && Object.hasOwnProperty.call(message, "receiver")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.receiver); + return writer; + }; + + /** + * Encodes the specified FungibleTokenPacketData message, length delimited. Does not implicitly {@link ibc.applications.transfer.v1.FungibleTokenPacketData.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.applications.transfer.v1.FungibleTokenPacketData + * @static + * @param {ibc.applications.transfer.v1.IFungibleTokenPacketData} message FungibleTokenPacketData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FungibleTokenPacketData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FungibleTokenPacketData message from the specified reader or buffer. + * @function decode + * @memberof ibc.applications.transfer.v1.FungibleTokenPacketData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.applications.transfer.v1.FungibleTokenPacketData} FungibleTokenPacketData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FungibleTokenPacketData.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.applications.transfer.v1.FungibleTokenPacketData(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + case 2: + message.amount = reader.uint64(); + break; + case 3: + message.sender = reader.string(); + break; + case 4: + message.receiver = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FungibleTokenPacketData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.applications.transfer.v1.FungibleTokenPacketData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.applications.transfer.v1.FungibleTokenPacketData} FungibleTokenPacketData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FungibleTokenPacketData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FungibleTokenPacketData message. + * @function verify + * @memberof ibc.applications.transfer.v1.FungibleTokenPacketData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FungibleTokenPacketData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.denom != null && message.hasOwnProperty("denom")) + if (!$util.isString(message.denom)) + return "denom: string expected"; + if (message.amount != null && message.hasOwnProperty("amount")) + if (!$util.isInteger(message.amount) && !(message.amount && $util.isInteger(message.amount.low) && $util.isInteger(message.amount.high))) + return "amount: integer|Long expected"; + if (message.sender != null && message.hasOwnProperty("sender")) + if (!$util.isString(message.sender)) + return "sender: string expected"; + if (message.receiver != null && message.hasOwnProperty("receiver")) + if (!$util.isString(message.receiver)) + return "receiver: string expected"; + return null; + }; + + /** + * Creates a FungibleTokenPacketData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.applications.transfer.v1.FungibleTokenPacketData + * @static + * @param {Object.} object Plain object + * @returns {ibc.applications.transfer.v1.FungibleTokenPacketData} FungibleTokenPacketData + */ + FungibleTokenPacketData.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.applications.transfer.v1.FungibleTokenPacketData) + return object; + let message = new $root.ibc.applications.transfer.v1.FungibleTokenPacketData(); + if (object.denom != null) + message.denom = String(object.denom); + if (object.amount != null) + if ($util.Long) + (message.amount = $util.Long.fromValue(object.amount)).unsigned = true; + else if (typeof object.amount === "string") + message.amount = parseInt(object.amount, 10); + else if (typeof object.amount === "number") + message.amount = object.amount; + else if (typeof object.amount === "object") + message.amount = new $util.LongBits(object.amount.low >>> 0, object.amount.high >>> 0).toNumber(true); + if (object.sender != null) + message.sender = String(object.sender); + if (object.receiver != null) + message.receiver = String(object.receiver); + return message; + }; + + /** + * Creates a plain object from a FungibleTokenPacketData message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.applications.transfer.v1.FungibleTokenPacketData + * @static + * @param {ibc.applications.transfer.v1.FungibleTokenPacketData} message FungibleTokenPacketData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FungibleTokenPacketData.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.denom = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.amount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.amount = options.longs === String ? "0" : 0; + object.sender = ""; + object.receiver = ""; + } + if (message.denom != null && message.hasOwnProperty("denom")) + object.denom = message.denom; + if (message.amount != null && message.hasOwnProperty("amount")) + if (typeof message.amount === "number") + object.amount = options.longs === String ? String(message.amount) : message.amount; + else + object.amount = options.longs === String ? $util.Long.prototype.toString.call(message.amount) : options.longs === Number ? new $util.LongBits(message.amount.low >>> 0, message.amount.high >>> 0).toNumber(true) : message.amount; + if (message.sender != null && message.hasOwnProperty("sender")) + object.sender = message.sender; + if (message.receiver != null && message.hasOwnProperty("receiver")) + object.receiver = message.receiver; + return object; + }; + + /** + * Converts this FungibleTokenPacketData to JSON. + * @function toJSON + * @memberof ibc.applications.transfer.v1.FungibleTokenPacketData + * @instance + * @returns {Object.} JSON object + */ + FungibleTokenPacketData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FungibleTokenPacketData; + })(); + + v1.DenomTrace = (function() { + + /** + * Properties of a DenomTrace. + * @memberof ibc.applications.transfer.v1 + * @interface IDenomTrace + * @property {string|null} [path] DenomTrace path + * @property {string|null} [base_denom] DenomTrace base_denom + */ + + /** + * Constructs a new DenomTrace. + * @memberof ibc.applications.transfer.v1 + * @classdesc Represents a DenomTrace. + * @implements IDenomTrace + * @constructor + * @param {ibc.applications.transfer.v1.IDenomTrace=} [properties] Properties to set + */ + function DenomTrace(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DenomTrace path. + * @member {string} path + * @memberof ibc.applications.transfer.v1.DenomTrace + * @instance + */ + DenomTrace.prototype.path = ""; + + /** + * DenomTrace base_denom. + * @member {string} base_denom + * @memberof ibc.applications.transfer.v1.DenomTrace + * @instance + */ + DenomTrace.prototype.base_denom = ""; + + /** + * Encodes the specified DenomTrace message. Does not implicitly {@link ibc.applications.transfer.v1.DenomTrace.verify|verify} messages. + * @function encode + * @memberof ibc.applications.transfer.v1.DenomTrace + * @static + * @param {ibc.applications.transfer.v1.IDenomTrace} message DenomTrace message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DenomTrace.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.path); + if (message.base_denom != null && Object.hasOwnProperty.call(message, "base_denom")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.base_denom); + return writer; + }; + + /** + * Encodes the specified DenomTrace message, length delimited. Does not implicitly {@link ibc.applications.transfer.v1.DenomTrace.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.applications.transfer.v1.DenomTrace + * @static + * @param {ibc.applications.transfer.v1.IDenomTrace} message DenomTrace message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DenomTrace.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DenomTrace message from the specified reader or buffer. + * @function decode + * @memberof ibc.applications.transfer.v1.DenomTrace + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.applications.transfer.v1.DenomTrace} DenomTrace + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DenomTrace.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.applications.transfer.v1.DenomTrace(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.string(); + break; + case 2: + message.base_denom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DenomTrace message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.applications.transfer.v1.DenomTrace + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.applications.transfer.v1.DenomTrace} DenomTrace + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DenomTrace.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DenomTrace message. + * @function verify + * @memberof ibc.applications.transfer.v1.DenomTrace + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DenomTrace.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!$util.isString(message.path)) + return "path: string expected"; + if (message.base_denom != null && message.hasOwnProperty("base_denom")) + if (!$util.isString(message.base_denom)) + return "base_denom: string expected"; + return null; + }; + + /** + * Creates a DenomTrace message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.applications.transfer.v1.DenomTrace + * @static + * @param {Object.} object Plain object + * @returns {ibc.applications.transfer.v1.DenomTrace} DenomTrace + */ + DenomTrace.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.applications.transfer.v1.DenomTrace) + return object; + let message = new $root.ibc.applications.transfer.v1.DenomTrace(); + if (object.path != null) + message.path = String(object.path); + if (object.base_denom != null) + message.base_denom = String(object.base_denom); + return message; + }; + + /** + * Creates a plain object from a DenomTrace message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.applications.transfer.v1.DenomTrace + * @static + * @param {ibc.applications.transfer.v1.DenomTrace} message DenomTrace + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DenomTrace.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.path = ""; + object.base_denom = ""; + } + if (message.path != null && message.hasOwnProperty("path")) + object.path = message.path; + if (message.base_denom != null && message.hasOwnProperty("base_denom")) + object.base_denom = message.base_denom; + return object; + }; + + /** + * Converts this DenomTrace to JSON. + * @function toJSON + * @memberof ibc.applications.transfer.v1.DenomTrace + * @instance + * @returns {Object.} JSON object + */ + DenomTrace.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DenomTrace; + })(); + + v1.Params = (function() { + + /** + * Properties of a Params. + * @memberof ibc.applications.transfer.v1 + * @interface IParams + * @property {boolean|null} [send_enabled] Params send_enabled + * @property {boolean|null} [receive_enabled] Params receive_enabled + */ + + /** + * Constructs a new Params. + * @memberof ibc.applications.transfer.v1 + * @classdesc Represents a Params. + * @implements IParams + * @constructor + * @param {ibc.applications.transfer.v1.IParams=} [properties] Properties to set + */ + function Params(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Params send_enabled. + * @member {boolean} send_enabled + * @memberof ibc.applications.transfer.v1.Params + * @instance + */ + Params.prototype.send_enabled = false; + + /** + * Params receive_enabled. + * @member {boolean} receive_enabled + * @memberof ibc.applications.transfer.v1.Params + * @instance + */ + Params.prototype.receive_enabled = false; + + /** + * Encodes the specified Params message. Does not implicitly {@link ibc.applications.transfer.v1.Params.verify|verify} messages. + * @function encode + * @memberof ibc.applications.transfer.v1.Params + * @static + * @param {ibc.applications.transfer.v1.IParams} message Params message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Params.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.send_enabled != null && Object.hasOwnProperty.call(message, "send_enabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.send_enabled); + if (message.receive_enabled != null && Object.hasOwnProperty.call(message, "receive_enabled")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.receive_enabled); + return writer; + }; + + /** + * Encodes the specified Params message, length delimited. Does not implicitly {@link ibc.applications.transfer.v1.Params.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.applications.transfer.v1.Params + * @static + * @param {ibc.applications.transfer.v1.IParams} message Params message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Params.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Params message from the specified reader or buffer. + * @function decode + * @memberof ibc.applications.transfer.v1.Params + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.applications.transfer.v1.Params} Params + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Params.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.applications.transfer.v1.Params(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.send_enabled = reader.bool(); + break; + case 2: + message.receive_enabled = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Params message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.applications.transfer.v1.Params + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.applications.transfer.v1.Params} Params + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Params.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Params message. + * @function verify + * @memberof ibc.applications.transfer.v1.Params + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Params.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.send_enabled != null && message.hasOwnProperty("send_enabled")) + if (typeof message.send_enabled !== "boolean") + return "send_enabled: boolean expected"; + if (message.receive_enabled != null && message.hasOwnProperty("receive_enabled")) + if (typeof message.receive_enabled !== "boolean") + return "receive_enabled: boolean expected"; + return null; + }; + + /** + * Creates a Params message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.applications.transfer.v1.Params + * @static + * @param {Object.} object Plain object + * @returns {ibc.applications.transfer.v1.Params} Params + */ + Params.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.applications.transfer.v1.Params) + return object; + let message = new $root.ibc.applications.transfer.v1.Params(); + if (object.send_enabled != null) + message.send_enabled = Boolean(object.send_enabled); + if (object.receive_enabled != null) + message.receive_enabled = Boolean(object.receive_enabled); + return message; + }; + + /** + * Creates a plain object from a Params message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.applications.transfer.v1.Params + * @static + * @param {ibc.applications.transfer.v1.Params} message Params + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Params.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.send_enabled = false; + object.receive_enabled = false; + } + if (message.send_enabled != null && message.hasOwnProperty("send_enabled")) + object.send_enabled = message.send_enabled; + if (message.receive_enabled != null && message.hasOwnProperty("receive_enabled")) + object.receive_enabled = message.receive_enabled; + return object; + }; + + /** + * Converts this Params to JSON. + * @function toJSON + * @memberof ibc.applications.transfer.v1.Params + * @instance + * @returns {Object.} JSON object + */ + Params.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Params; + })(); + + v1.Query = (function() { + + /** + * Constructs a new Query service. + * @memberof ibc.applications.transfer.v1 + * @classdesc Represents a Query + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Query(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Query.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Query; + + /** + * Callback as used by {@link ibc.applications.transfer.v1.Query#denomTrace}. + * @memberof ibc.applications.transfer.v1.Query + * @typedef DenomTraceCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.applications.transfer.v1.QueryDenomTraceResponse} [response] QueryDenomTraceResponse + */ + + /** + * Calls DenomTrace. + * @function denomTrace + * @memberof ibc.applications.transfer.v1.Query + * @instance + * @param {ibc.applications.transfer.v1.IQueryDenomTraceRequest} request QueryDenomTraceRequest message or plain object + * @param {ibc.applications.transfer.v1.Query.DenomTraceCallback} callback Node-style callback called with the error, if any, and QueryDenomTraceResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.denomTrace = function denomTrace(request, callback) { + return this.rpcCall(denomTrace, $root.ibc.applications.transfer.v1.QueryDenomTraceRequest, $root.ibc.applications.transfer.v1.QueryDenomTraceResponse, request, callback); + }, "name", { value: "DenomTrace" }); + + /** + * Calls DenomTrace. + * @function denomTrace + * @memberof ibc.applications.transfer.v1.Query + * @instance + * @param {ibc.applications.transfer.v1.IQueryDenomTraceRequest} request QueryDenomTraceRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.applications.transfer.v1.Query#denomTraces}. + * @memberof ibc.applications.transfer.v1.Query + * @typedef DenomTracesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.applications.transfer.v1.QueryDenomTracesResponse} [response] QueryDenomTracesResponse + */ + + /** + * Calls DenomTraces. + * @function denomTraces + * @memberof ibc.applications.transfer.v1.Query + * @instance + * @param {ibc.applications.transfer.v1.IQueryDenomTracesRequest} request QueryDenomTracesRequest message or plain object + * @param {ibc.applications.transfer.v1.Query.DenomTracesCallback} callback Node-style callback called with the error, if any, and QueryDenomTracesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.denomTraces = function denomTraces(request, callback) { + return this.rpcCall(denomTraces, $root.ibc.applications.transfer.v1.QueryDenomTracesRequest, $root.ibc.applications.transfer.v1.QueryDenomTracesResponse, request, callback); + }, "name", { value: "DenomTraces" }); + + /** + * Calls DenomTraces. + * @function denomTraces + * @memberof ibc.applications.transfer.v1.Query + * @instance + * @param {ibc.applications.transfer.v1.IQueryDenomTracesRequest} request QueryDenomTracesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.applications.transfer.v1.Query#params}. + * @memberof ibc.applications.transfer.v1.Query + * @typedef ParamsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.applications.transfer.v1.QueryParamsResponse} [response] QueryParamsResponse + */ + + /** + * Calls Params. + * @function params + * @memberof ibc.applications.transfer.v1.Query + * @instance + * @param {ibc.applications.transfer.v1.IQueryParamsRequest} request QueryParamsRequest message or plain object + * @param {ibc.applications.transfer.v1.Query.ParamsCallback} callback Node-style callback called with the error, if any, and QueryParamsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.params = function params(request, callback) { + return this.rpcCall(params, $root.ibc.applications.transfer.v1.QueryParamsRequest, $root.ibc.applications.transfer.v1.QueryParamsResponse, request, callback); + }, "name", { value: "Params" }); + + /** + * Calls Params. + * @function params + * @memberof ibc.applications.transfer.v1.Query + * @instance + * @param {ibc.applications.transfer.v1.IQueryParamsRequest} request QueryParamsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Query; + })(); + + v1.QueryDenomTraceRequest = (function() { + + /** + * Properties of a QueryDenomTraceRequest. + * @memberof ibc.applications.transfer.v1 + * @interface IQueryDenomTraceRequest + * @property {string|null} [hash] QueryDenomTraceRequest hash + */ + + /** + * Constructs a new QueryDenomTraceRequest. + * @memberof ibc.applications.transfer.v1 + * @classdesc Represents a QueryDenomTraceRequest. + * @implements IQueryDenomTraceRequest + * @constructor + * @param {ibc.applications.transfer.v1.IQueryDenomTraceRequest=} [properties] Properties to set + */ + function QueryDenomTraceRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryDenomTraceRequest hash. + * @member {string} hash + * @memberof ibc.applications.transfer.v1.QueryDenomTraceRequest + * @instance + */ + QueryDenomTraceRequest.prototype.hash = ""; + + /** + * Encodes the specified QueryDenomTraceRequest message. Does not implicitly {@link ibc.applications.transfer.v1.QueryDenomTraceRequest.verify|verify} messages. + * @function encode + * @memberof ibc.applications.transfer.v1.QueryDenomTraceRequest + * @static + * @param {ibc.applications.transfer.v1.IQueryDenomTraceRequest} message QueryDenomTraceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDenomTraceRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.hash != null && Object.hasOwnProperty.call(message, "hash")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.hash); + return writer; + }; + + /** + * Encodes the specified QueryDenomTraceRequest message, length delimited. Does not implicitly {@link ibc.applications.transfer.v1.QueryDenomTraceRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.applications.transfer.v1.QueryDenomTraceRequest + * @static + * @param {ibc.applications.transfer.v1.IQueryDenomTraceRequest} message QueryDenomTraceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDenomTraceRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryDenomTraceRequest message from the specified reader or buffer. + * @function decode + * @memberof ibc.applications.transfer.v1.QueryDenomTraceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.applications.transfer.v1.QueryDenomTraceRequest} QueryDenomTraceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDenomTraceRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.applications.transfer.v1.QueryDenomTraceRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryDenomTraceRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.applications.transfer.v1.QueryDenomTraceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.applications.transfer.v1.QueryDenomTraceRequest} QueryDenomTraceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDenomTraceRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryDenomTraceRequest message. + * @function verify + * @memberof ibc.applications.transfer.v1.QueryDenomTraceRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryDenomTraceRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.hash != null && message.hasOwnProperty("hash")) + if (!$util.isString(message.hash)) + return "hash: string expected"; + return null; + }; + + /** + * Creates a QueryDenomTraceRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.applications.transfer.v1.QueryDenomTraceRequest + * @static + * @param {Object.} object Plain object + * @returns {ibc.applications.transfer.v1.QueryDenomTraceRequest} QueryDenomTraceRequest + */ + QueryDenomTraceRequest.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.applications.transfer.v1.QueryDenomTraceRequest) + return object; + let message = new $root.ibc.applications.transfer.v1.QueryDenomTraceRequest(); + if (object.hash != null) + message.hash = String(object.hash); + return message; + }; + + /** + * Creates a plain object from a QueryDenomTraceRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.applications.transfer.v1.QueryDenomTraceRequest + * @static + * @param {ibc.applications.transfer.v1.QueryDenomTraceRequest} message QueryDenomTraceRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryDenomTraceRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.hash = ""; + if (message.hash != null && message.hasOwnProperty("hash")) + object.hash = message.hash; + return object; + }; + + /** + * Converts this QueryDenomTraceRequest to JSON. + * @function toJSON + * @memberof ibc.applications.transfer.v1.QueryDenomTraceRequest + * @instance + * @returns {Object.} JSON object + */ + QueryDenomTraceRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryDenomTraceRequest; + })(); + + v1.QueryDenomTraceResponse = (function() { + + /** + * Properties of a QueryDenomTraceResponse. + * @memberof ibc.applications.transfer.v1 + * @interface IQueryDenomTraceResponse + * @property {ibc.applications.transfer.v1.IDenomTrace|null} [denom_trace] QueryDenomTraceResponse denom_trace + */ + + /** + * Constructs a new QueryDenomTraceResponse. + * @memberof ibc.applications.transfer.v1 + * @classdesc Represents a QueryDenomTraceResponse. + * @implements IQueryDenomTraceResponse + * @constructor + * @param {ibc.applications.transfer.v1.IQueryDenomTraceResponse=} [properties] Properties to set + */ + function QueryDenomTraceResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryDenomTraceResponse denom_trace. + * @member {ibc.applications.transfer.v1.IDenomTrace|null|undefined} denom_trace + * @memberof ibc.applications.transfer.v1.QueryDenomTraceResponse + * @instance + */ + QueryDenomTraceResponse.prototype.denom_trace = null; + + /** + * Encodes the specified QueryDenomTraceResponse message. Does not implicitly {@link ibc.applications.transfer.v1.QueryDenomTraceResponse.verify|verify} messages. + * @function encode + * @memberof ibc.applications.transfer.v1.QueryDenomTraceResponse + * @static + * @param {ibc.applications.transfer.v1.IQueryDenomTraceResponse} message QueryDenomTraceResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDenomTraceResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.denom_trace != null && Object.hasOwnProperty.call(message, "denom_trace")) + $root.ibc.applications.transfer.v1.DenomTrace.encode(message.denom_trace, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryDenomTraceResponse message, length delimited. Does not implicitly {@link ibc.applications.transfer.v1.QueryDenomTraceResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.applications.transfer.v1.QueryDenomTraceResponse + * @static + * @param {ibc.applications.transfer.v1.IQueryDenomTraceResponse} message QueryDenomTraceResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDenomTraceResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryDenomTraceResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.applications.transfer.v1.QueryDenomTraceResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.applications.transfer.v1.QueryDenomTraceResponse} QueryDenomTraceResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDenomTraceResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.applications.transfer.v1.QueryDenomTraceResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom_trace = $root.ibc.applications.transfer.v1.DenomTrace.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryDenomTraceResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.applications.transfer.v1.QueryDenomTraceResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.applications.transfer.v1.QueryDenomTraceResponse} QueryDenomTraceResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDenomTraceResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryDenomTraceResponse message. + * @function verify + * @memberof ibc.applications.transfer.v1.QueryDenomTraceResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryDenomTraceResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.denom_trace != null && message.hasOwnProperty("denom_trace")) { + let error = $root.ibc.applications.transfer.v1.DenomTrace.verify(message.denom_trace); + if (error) + return "denom_trace." + error; + } + return null; + }; + + /** + * Creates a QueryDenomTraceResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.applications.transfer.v1.QueryDenomTraceResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.applications.transfer.v1.QueryDenomTraceResponse} QueryDenomTraceResponse + */ + QueryDenomTraceResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.applications.transfer.v1.QueryDenomTraceResponse) + return object; + let message = new $root.ibc.applications.transfer.v1.QueryDenomTraceResponse(); + if (object.denom_trace != null) { + if (typeof object.denom_trace !== "object") + throw TypeError(".ibc.applications.transfer.v1.QueryDenomTraceResponse.denom_trace: object expected"); + message.denom_trace = $root.ibc.applications.transfer.v1.DenomTrace.fromObject(object.denom_trace); + } + return message; + }; + + /** + * Creates a plain object from a QueryDenomTraceResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.applications.transfer.v1.QueryDenomTraceResponse + * @static + * @param {ibc.applications.transfer.v1.QueryDenomTraceResponse} message QueryDenomTraceResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryDenomTraceResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.denom_trace = null; + if (message.denom_trace != null && message.hasOwnProperty("denom_trace")) + object.denom_trace = $root.ibc.applications.transfer.v1.DenomTrace.toObject(message.denom_trace, options); + return object; + }; + + /** + * Converts this QueryDenomTraceResponse to JSON. + * @function toJSON + * @memberof ibc.applications.transfer.v1.QueryDenomTraceResponse + * @instance + * @returns {Object.} JSON object + */ + QueryDenomTraceResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryDenomTraceResponse; + })(); + + v1.QueryDenomTracesRequest = (function() { + + /** + * Properties of a QueryDenomTracesRequest. + * @memberof ibc.applications.transfer.v1 + * @interface IQueryDenomTracesRequest + * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryDenomTracesRequest pagination + */ + + /** + * Constructs a new QueryDenomTracesRequest. + * @memberof ibc.applications.transfer.v1 + * @classdesc Represents a QueryDenomTracesRequest. + * @implements IQueryDenomTracesRequest + * @constructor + * @param {ibc.applications.transfer.v1.IQueryDenomTracesRequest=} [properties] Properties to set + */ + function QueryDenomTracesRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryDenomTracesRequest pagination. + * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination + * @memberof ibc.applications.transfer.v1.QueryDenomTracesRequest + * @instance + */ + QueryDenomTracesRequest.prototype.pagination = null; + + /** + * Encodes the specified QueryDenomTracesRequest message. Does not implicitly {@link ibc.applications.transfer.v1.QueryDenomTracesRequest.verify|verify} messages. + * @function encode + * @memberof ibc.applications.transfer.v1.QueryDenomTracesRequest + * @static + * @param {ibc.applications.transfer.v1.IQueryDenomTracesRequest} message QueryDenomTracesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDenomTracesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryDenomTracesRequest message, length delimited. Does not implicitly {@link ibc.applications.transfer.v1.QueryDenomTracesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.applications.transfer.v1.QueryDenomTracesRequest + * @static + * @param {ibc.applications.transfer.v1.IQueryDenomTracesRequest} message QueryDenomTracesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDenomTracesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryDenomTracesRequest message from the specified reader or buffer. + * @function decode + * @memberof ibc.applications.transfer.v1.QueryDenomTracesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.applications.transfer.v1.QueryDenomTracesRequest} QueryDenomTracesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDenomTracesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.applications.transfer.v1.QueryDenomTracesRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryDenomTracesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.applications.transfer.v1.QueryDenomTracesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.applications.transfer.v1.QueryDenomTracesRequest} QueryDenomTracesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDenomTracesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryDenomTracesRequest message. + * @function verify + * @memberof ibc.applications.transfer.v1.QueryDenomTracesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryDenomTracesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryDenomTracesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.applications.transfer.v1.QueryDenomTracesRequest + * @static + * @param {Object.} object Plain object + * @returns {ibc.applications.transfer.v1.QueryDenomTracesRequest} QueryDenomTracesRequest + */ + QueryDenomTracesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.applications.transfer.v1.QueryDenomTracesRequest) + return object; + let message = new $root.ibc.applications.transfer.v1.QueryDenomTracesRequest(); + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".ibc.applications.transfer.v1.QueryDenomTracesRequest.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryDenomTracesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.applications.transfer.v1.QueryDenomTracesRequest + * @static + * @param {ibc.applications.transfer.v1.QueryDenomTracesRequest} message QueryDenomTracesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryDenomTracesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.pagination = null; + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryDenomTracesRequest to JSON. + * @function toJSON + * @memberof ibc.applications.transfer.v1.QueryDenomTracesRequest + * @instance + * @returns {Object.} JSON object + */ + QueryDenomTracesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryDenomTracesRequest; + })(); + + v1.QueryDenomTracesResponse = (function() { + + /** + * Properties of a QueryDenomTracesResponse. + * @memberof ibc.applications.transfer.v1 + * @interface IQueryDenomTracesResponse + * @property {Array.|null} [denom_traces] QueryDenomTracesResponse denom_traces + * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryDenomTracesResponse pagination + */ + + /** + * Constructs a new QueryDenomTracesResponse. + * @memberof ibc.applications.transfer.v1 + * @classdesc Represents a QueryDenomTracesResponse. + * @implements IQueryDenomTracesResponse + * @constructor + * @param {ibc.applications.transfer.v1.IQueryDenomTracesResponse=} [properties] Properties to set + */ + function QueryDenomTracesResponse(properties) { + this.denom_traces = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryDenomTracesResponse denom_traces. + * @member {Array.} denom_traces + * @memberof ibc.applications.transfer.v1.QueryDenomTracesResponse + * @instance + */ + QueryDenomTracesResponse.prototype.denom_traces = $util.emptyArray; + + /** + * QueryDenomTracesResponse pagination. + * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination + * @memberof ibc.applications.transfer.v1.QueryDenomTracesResponse + * @instance + */ + QueryDenomTracesResponse.prototype.pagination = null; + + /** + * Encodes the specified QueryDenomTracesResponse message. Does not implicitly {@link ibc.applications.transfer.v1.QueryDenomTracesResponse.verify|verify} messages. + * @function encode + * @memberof ibc.applications.transfer.v1.QueryDenomTracesResponse + * @static + * @param {ibc.applications.transfer.v1.IQueryDenomTracesResponse} message QueryDenomTracesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDenomTracesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.denom_traces != null && message.denom_traces.length) + for (let i = 0; i < message.denom_traces.length; ++i) + $root.ibc.applications.transfer.v1.DenomTrace.encode(message.denom_traces[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryDenomTracesResponse message, length delimited. Does not implicitly {@link ibc.applications.transfer.v1.QueryDenomTracesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.applications.transfer.v1.QueryDenomTracesResponse + * @static + * @param {ibc.applications.transfer.v1.IQueryDenomTracesResponse} message QueryDenomTracesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryDenomTracesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryDenomTracesResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.applications.transfer.v1.QueryDenomTracesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.applications.transfer.v1.QueryDenomTracesResponse} QueryDenomTracesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDenomTracesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.applications.transfer.v1.QueryDenomTracesResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.denom_traces && message.denom_traces.length)) + message.denom_traces = []; + message.denom_traces.push($root.ibc.applications.transfer.v1.DenomTrace.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryDenomTracesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.applications.transfer.v1.QueryDenomTracesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.applications.transfer.v1.QueryDenomTracesResponse} QueryDenomTracesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryDenomTracesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryDenomTracesResponse message. + * @function verify + * @memberof ibc.applications.transfer.v1.QueryDenomTracesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryDenomTracesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.denom_traces != null && message.hasOwnProperty("denom_traces")) { + if (!Array.isArray(message.denom_traces)) + return "denom_traces: array expected"; + for (let i = 0; i < message.denom_traces.length; ++i) { + let error = $root.ibc.applications.transfer.v1.DenomTrace.verify(message.denom_traces[i]); + if (error) + return "denom_traces." + error; + } + } + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryDenomTracesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.applications.transfer.v1.QueryDenomTracesResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.applications.transfer.v1.QueryDenomTracesResponse} QueryDenomTracesResponse + */ + QueryDenomTracesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.applications.transfer.v1.QueryDenomTracesResponse) + return object; + let message = new $root.ibc.applications.transfer.v1.QueryDenomTracesResponse(); + if (object.denom_traces) { + if (!Array.isArray(object.denom_traces)) + throw TypeError(".ibc.applications.transfer.v1.QueryDenomTracesResponse.denom_traces: array expected"); + message.denom_traces = []; + for (let i = 0; i < object.denom_traces.length; ++i) { + if (typeof object.denom_traces[i] !== "object") + throw TypeError(".ibc.applications.transfer.v1.QueryDenomTracesResponse.denom_traces: object expected"); + message.denom_traces[i] = $root.ibc.applications.transfer.v1.DenomTrace.fromObject(object.denom_traces[i]); + } + } + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".ibc.applications.transfer.v1.QueryDenomTracesResponse.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryDenomTracesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.applications.transfer.v1.QueryDenomTracesResponse + * @static + * @param {ibc.applications.transfer.v1.QueryDenomTracesResponse} message QueryDenomTracesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryDenomTracesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.denom_traces = []; + if (options.defaults) + object.pagination = null; + if (message.denom_traces && message.denom_traces.length) { + object.denom_traces = []; + for (let j = 0; j < message.denom_traces.length; ++j) + object.denom_traces[j] = $root.ibc.applications.transfer.v1.DenomTrace.toObject(message.denom_traces[j], options); + } + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryDenomTracesResponse to JSON. + * @function toJSON + * @memberof ibc.applications.transfer.v1.QueryDenomTracesResponse + * @instance + * @returns {Object.} JSON object + */ + QueryDenomTracesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryDenomTracesResponse; + })(); + + v1.QueryParamsRequest = (function() { + + /** + * Properties of a QueryParamsRequest. + * @memberof ibc.applications.transfer.v1 + * @interface IQueryParamsRequest + */ + + /** + * Constructs a new QueryParamsRequest. + * @memberof ibc.applications.transfer.v1 + * @classdesc Represents a QueryParamsRequest. + * @implements IQueryParamsRequest + * @constructor + * @param {ibc.applications.transfer.v1.IQueryParamsRequest=} [properties] Properties to set + */ + function QueryParamsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified QueryParamsRequest message. Does not implicitly {@link ibc.applications.transfer.v1.QueryParamsRequest.verify|verify} messages. + * @function encode + * @memberof ibc.applications.transfer.v1.QueryParamsRequest + * @static + * @param {ibc.applications.transfer.v1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified QueryParamsRequest message, length delimited. Does not implicitly {@link ibc.applications.transfer.v1.QueryParamsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.applications.transfer.v1.QueryParamsRequest + * @static + * @param {ibc.applications.transfer.v1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryParamsRequest message from the specified reader or buffer. + * @function decode + * @memberof ibc.applications.transfer.v1.QueryParamsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.applications.transfer.v1.QueryParamsRequest} QueryParamsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.applications.transfer.v1.QueryParamsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryParamsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.applications.transfer.v1.QueryParamsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.applications.transfer.v1.QueryParamsRequest} QueryParamsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryParamsRequest message. + * @function verify + * @memberof ibc.applications.transfer.v1.QueryParamsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryParamsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a QueryParamsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.applications.transfer.v1.QueryParamsRequest + * @static + * @param {Object.} object Plain object + * @returns {ibc.applications.transfer.v1.QueryParamsRequest} QueryParamsRequest + */ + QueryParamsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.applications.transfer.v1.QueryParamsRequest) + return object; + return new $root.ibc.applications.transfer.v1.QueryParamsRequest(); + }; + + /** + * Creates a plain object from a QueryParamsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.applications.transfer.v1.QueryParamsRequest + * @static + * @param {ibc.applications.transfer.v1.QueryParamsRequest} message QueryParamsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryParamsRequest.toObject = function toObject() { + return {}; + }; + + /** + * Converts this QueryParamsRequest to JSON. + * @function toJSON + * @memberof ibc.applications.transfer.v1.QueryParamsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryParamsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryParamsRequest; + })(); + + v1.QueryParamsResponse = (function() { + + /** + * Properties of a QueryParamsResponse. + * @memberof ibc.applications.transfer.v1 + * @interface IQueryParamsResponse + * @property {ibc.applications.transfer.v1.IParams|null} [params] QueryParamsResponse params + */ + + /** + * Constructs a new QueryParamsResponse. + * @memberof ibc.applications.transfer.v1 + * @classdesc Represents a QueryParamsResponse. + * @implements IQueryParamsResponse + * @constructor + * @param {ibc.applications.transfer.v1.IQueryParamsResponse=} [properties] Properties to set + */ + function QueryParamsResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryParamsResponse params. + * @member {ibc.applications.transfer.v1.IParams|null|undefined} params + * @memberof ibc.applications.transfer.v1.QueryParamsResponse + * @instance + */ + QueryParamsResponse.prototype.params = null; + + /** + * Encodes the specified QueryParamsResponse message. Does not implicitly {@link ibc.applications.transfer.v1.QueryParamsResponse.verify|verify} messages. + * @function encode + * @memberof ibc.applications.transfer.v1.QueryParamsResponse + * @static + * @param {ibc.applications.transfer.v1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.params != null && Object.hasOwnProperty.call(message, "params")) + $root.ibc.applications.transfer.v1.Params.encode(message.params, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryParamsResponse message, length delimited. Does not implicitly {@link ibc.applications.transfer.v1.QueryParamsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.applications.transfer.v1.QueryParamsResponse + * @static + * @param {ibc.applications.transfer.v1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParamsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryParamsResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.applications.transfer.v1.QueryParamsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.applications.transfer.v1.QueryParamsResponse} QueryParamsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.applications.transfer.v1.QueryParamsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = $root.ibc.applications.transfer.v1.Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryParamsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.applications.transfer.v1.QueryParamsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.applications.transfer.v1.QueryParamsResponse} QueryParamsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParamsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryParamsResponse message. + * @function verify + * @memberof ibc.applications.transfer.v1.QueryParamsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryParamsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.params != null && message.hasOwnProperty("params")) { + let error = $root.ibc.applications.transfer.v1.Params.verify(message.params); + if (error) + return "params." + error; + } + return null; + }; + + /** + * Creates a QueryParamsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.applications.transfer.v1.QueryParamsResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.applications.transfer.v1.QueryParamsResponse} QueryParamsResponse + */ + QueryParamsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.applications.transfer.v1.QueryParamsResponse) + return object; + let message = new $root.ibc.applications.transfer.v1.QueryParamsResponse(); + if (object.params != null) { + if (typeof object.params !== "object") + throw TypeError(".ibc.applications.transfer.v1.QueryParamsResponse.params: object expected"); + message.params = $root.ibc.applications.transfer.v1.Params.fromObject(object.params); + } + return message; + }; + + /** + * Creates a plain object from a QueryParamsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.applications.transfer.v1.QueryParamsResponse + * @static + * @param {ibc.applications.transfer.v1.QueryParamsResponse} message QueryParamsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryParamsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.params = null; + if (message.params != null && message.hasOwnProperty("params")) + object.params = $root.ibc.applications.transfer.v1.Params.toObject(message.params, options); + return object; + }; + + /** + * Converts this QueryParamsResponse to JSON. + * @function toJSON + * @memberof ibc.applications.transfer.v1.QueryParamsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryParamsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryParamsResponse; + })(); + + v1.GenesisState = (function() { + + /** + * Properties of a GenesisState. + * @memberof ibc.applications.transfer.v1 + * @interface IGenesisState + * @property {string|null} [port_id] GenesisState port_id + * @property {Array.|null} [denom_traces] GenesisState denom_traces + * @property {ibc.applications.transfer.v1.IParams|null} [params] GenesisState params + */ + + /** + * Constructs a new GenesisState. + * @memberof ibc.applications.transfer.v1 + * @classdesc Represents a GenesisState. + * @implements IGenesisState + * @constructor + * @param {ibc.applications.transfer.v1.IGenesisState=} [properties] Properties to set + */ + function GenesisState(properties) { + this.denom_traces = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenesisState port_id. + * @member {string} port_id + * @memberof ibc.applications.transfer.v1.GenesisState + * @instance + */ + GenesisState.prototype.port_id = ""; + + /** + * GenesisState denom_traces. + * @member {Array.} denom_traces + * @memberof ibc.applications.transfer.v1.GenesisState + * @instance + */ + GenesisState.prototype.denom_traces = $util.emptyArray; + + /** + * GenesisState params. + * @member {ibc.applications.transfer.v1.IParams|null|undefined} params + * @memberof ibc.applications.transfer.v1.GenesisState + * @instance + */ + GenesisState.prototype.params = null; + + /** + * Encodes the specified GenesisState message. Does not implicitly {@link ibc.applications.transfer.v1.GenesisState.verify|verify} messages. + * @function encode + * @memberof ibc.applications.transfer.v1.GenesisState + * @static + * @param {ibc.applications.transfer.v1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); + if (message.denom_traces != null && message.denom_traces.length) + for (let i = 0; i < message.denom_traces.length; ++i) + $root.ibc.applications.transfer.v1.DenomTrace.encode(message.denom_traces[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.params != null && Object.hasOwnProperty.call(message, "params")) + $root.ibc.applications.transfer.v1.Params.encode(message.params, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link ibc.applications.transfer.v1.GenesisState.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.applications.transfer.v1.GenesisState + * @static + * @param {ibc.applications.transfer.v1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer. + * @function decode + * @memberof ibc.applications.transfer.v1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.applications.transfer.v1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.applications.transfer.v1.GenesisState(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.port_id = reader.string(); + break; + case 2: + if (!(message.denom_traces && message.denom_traces.length)) + message.denom_traces = []; + message.denom_traces.push($root.ibc.applications.transfer.v1.DenomTrace.decode(reader, reader.uint32())); + break; + case 3: + message.params = $root.ibc.applications.transfer.v1.Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.applications.transfer.v1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.applications.transfer.v1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenesisState message. + * @function verify + * @memberof ibc.applications.transfer.v1.GenesisState + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenesisState.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.port_id != null && message.hasOwnProperty("port_id")) + if (!$util.isString(message.port_id)) + return "port_id: string expected"; + if (message.denom_traces != null && message.hasOwnProperty("denom_traces")) { + if (!Array.isArray(message.denom_traces)) + return "denom_traces: array expected"; + for (let i = 0; i < message.denom_traces.length; ++i) { + let error = $root.ibc.applications.transfer.v1.DenomTrace.verify(message.denom_traces[i]); + if (error) + return "denom_traces." + error; + } + } + if (message.params != null && message.hasOwnProperty("params")) { + let error = $root.ibc.applications.transfer.v1.Params.verify(message.params); + if (error) + return "params." + error; + } + return null; + }; + + /** + * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.applications.transfer.v1.GenesisState + * @static + * @param {Object.} object Plain object + * @returns {ibc.applications.transfer.v1.GenesisState} GenesisState + */ + GenesisState.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.applications.transfer.v1.GenesisState) + return object; + let message = new $root.ibc.applications.transfer.v1.GenesisState(); + if (object.port_id != null) + message.port_id = String(object.port_id); + if (object.denom_traces) { + if (!Array.isArray(object.denom_traces)) + throw TypeError(".ibc.applications.transfer.v1.GenesisState.denom_traces: array expected"); + message.denom_traces = []; + for (let i = 0; i < object.denom_traces.length; ++i) { + if (typeof object.denom_traces[i] !== "object") + throw TypeError(".ibc.applications.transfer.v1.GenesisState.denom_traces: object expected"); + message.denom_traces[i] = $root.ibc.applications.transfer.v1.DenomTrace.fromObject(object.denom_traces[i]); + } + } + if (object.params != null) { + if (typeof object.params !== "object") + throw TypeError(".ibc.applications.transfer.v1.GenesisState.params: object expected"); + message.params = $root.ibc.applications.transfer.v1.Params.fromObject(object.params); + } + return message; + }; + + /** + * Creates a plain object from a GenesisState message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.applications.transfer.v1.GenesisState + * @static + * @param {ibc.applications.transfer.v1.GenesisState} message GenesisState + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenesisState.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.denom_traces = []; + if (options.defaults) { + object.port_id = ""; + object.params = null; + } + if (message.port_id != null && message.hasOwnProperty("port_id")) + object.port_id = message.port_id; + if (message.denom_traces && message.denom_traces.length) { + object.denom_traces = []; + for (let j = 0; j < message.denom_traces.length; ++j) + object.denom_traces[j] = $root.ibc.applications.transfer.v1.DenomTrace.toObject(message.denom_traces[j], options); + } + if (message.params != null && message.hasOwnProperty("params")) + object.params = $root.ibc.applications.transfer.v1.Params.toObject(message.params, options); + return object; + }; + + /** + * Converts this GenesisState to JSON. + * @function toJSON + * @memberof ibc.applications.transfer.v1.GenesisState + * @instance + * @returns {Object.} JSON object + */ + GenesisState.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenesisState; + })(); + + return v1; + })(); + + return transfer; + })(); + + return applications; + })(); + + ibc.core = (function() { + + /** + * Namespace core. + * @memberof ibc + * @namespace + */ + const core = {}; + + core.channel = (function() { + + /** + * Namespace channel. + * @memberof ibc.core + * @namespace + */ + const channel = {}; + + channel.v1 = (function() { + + /** + * Namespace v1. + * @memberof ibc.core.channel + * @namespace + */ + const v1 = {}; + + v1.Msg = (function() { + + /** + * Constructs a new Msg service. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a Msg + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Msg(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Msg.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Msg; + + /** + * Callback as used by {@link ibc.core.channel.v1.Msg#channelOpenInit}. + * @memberof ibc.core.channel.v1.Msg + * @typedef ChannelOpenInitCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.channel.v1.MsgChannelOpenInitResponse} [response] MsgChannelOpenInitResponse + */ + + /** + * Calls ChannelOpenInit. + * @function channelOpenInit + * @memberof ibc.core.channel.v1.Msg + * @instance + * @param {ibc.core.channel.v1.IMsgChannelOpenInit} request MsgChannelOpenInit message or plain object + * @param {ibc.core.channel.v1.Msg.ChannelOpenInitCallback} callback Node-style callback called with the error, if any, and MsgChannelOpenInitResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.channelOpenInit = function channelOpenInit(request, callback) { + return this.rpcCall(channelOpenInit, $root.ibc.core.channel.v1.MsgChannelOpenInit, $root.ibc.core.channel.v1.MsgChannelOpenInitResponse, request, callback); + }, "name", { value: "ChannelOpenInit" }); + + /** + * Calls ChannelOpenInit. + * @function channelOpenInit + * @memberof ibc.core.channel.v1.Msg + * @instance + * @param {ibc.core.channel.v1.IMsgChannelOpenInit} request MsgChannelOpenInit message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.channel.v1.Msg#channelOpenTry}. + * @memberof ibc.core.channel.v1.Msg + * @typedef ChannelOpenTryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.channel.v1.MsgChannelOpenTryResponse} [response] MsgChannelOpenTryResponse + */ + + /** + * Calls ChannelOpenTry. + * @function channelOpenTry + * @memberof ibc.core.channel.v1.Msg + * @instance + * @param {ibc.core.channel.v1.IMsgChannelOpenTry} request MsgChannelOpenTry message or plain object + * @param {ibc.core.channel.v1.Msg.ChannelOpenTryCallback} callback Node-style callback called with the error, if any, and MsgChannelOpenTryResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.channelOpenTry = function channelOpenTry(request, callback) { + return this.rpcCall(channelOpenTry, $root.ibc.core.channel.v1.MsgChannelOpenTry, $root.ibc.core.channel.v1.MsgChannelOpenTryResponse, request, callback); + }, "name", { value: "ChannelOpenTry" }); + + /** + * Calls ChannelOpenTry. + * @function channelOpenTry + * @memberof ibc.core.channel.v1.Msg + * @instance + * @param {ibc.core.channel.v1.IMsgChannelOpenTry} request MsgChannelOpenTry message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.channel.v1.Msg#channelOpenAck}. + * @memberof ibc.core.channel.v1.Msg + * @typedef ChannelOpenAckCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.channel.v1.MsgChannelOpenAckResponse} [response] MsgChannelOpenAckResponse + */ + + /** + * Calls ChannelOpenAck. + * @function channelOpenAck + * @memberof ibc.core.channel.v1.Msg + * @instance + * @param {ibc.core.channel.v1.IMsgChannelOpenAck} request MsgChannelOpenAck message or plain object + * @param {ibc.core.channel.v1.Msg.ChannelOpenAckCallback} callback Node-style callback called with the error, if any, and MsgChannelOpenAckResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.channelOpenAck = function channelOpenAck(request, callback) { + return this.rpcCall(channelOpenAck, $root.ibc.core.channel.v1.MsgChannelOpenAck, $root.ibc.core.channel.v1.MsgChannelOpenAckResponse, request, callback); + }, "name", { value: "ChannelOpenAck" }); + + /** + * Calls ChannelOpenAck. + * @function channelOpenAck + * @memberof ibc.core.channel.v1.Msg + * @instance + * @param {ibc.core.channel.v1.IMsgChannelOpenAck} request MsgChannelOpenAck message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.channel.v1.Msg#channelOpenConfirm}. + * @memberof ibc.core.channel.v1.Msg + * @typedef ChannelOpenConfirmCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.channel.v1.MsgChannelOpenConfirmResponse} [response] MsgChannelOpenConfirmResponse + */ + + /** + * Calls ChannelOpenConfirm. + * @function channelOpenConfirm + * @memberof ibc.core.channel.v1.Msg + * @instance + * @param {ibc.core.channel.v1.IMsgChannelOpenConfirm} request MsgChannelOpenConfirm message or plain object + * @param {ibc.core.channel.v1.Msg.ChannelOpenConfirmCallback} callback Node-style callback called with the error, if any, and MsgChannelOpenConfirmResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.channelOpenConfirm = function channelOpenConfirm(request, callback) { + return this.rpcCall(channelOpenConfirm, $root.ibc.core.channel.v1.MsgChannelOpenConfirm, $root.ibc.core.channel.v1.MsgChannelOpenConfirmResponse, request, callback); + }, "name", { value: "ChannelOpenConfirm" }); + + /** + * Calls ChannelOpenConfirm. + * @function channelOpenConfirm + * @memberof ibc.core.channel.v1.Msg + * @instance + * @param {ibc.core.channel.v1.IMsgChannelOpenConfirm} request MsgChannelOpenConfirm message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.channel.v1.Msg#channelCloseInit}. + * @memberof ibc.core.channel.v1.Msg + * @typedef ChannelCloseInitCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.channel.v1.MsgChannelCloseInitResponse} [response] MsgChannelCloseInitResponse + */ + + /** + * Calls ChannelCloseInit. + * @function channelCloseInit + * @memberof ibc.core.channel.v1.Msg + * @instance + * @param {ibc.core.channel.v1.IMsgChannelCloseInit} request MsgChannelCloseInit message or plain object + * @param {ibc.core.channel.v1.Msg.ChannelCloseInitCallback} callback Node-style callback called with the error, if any, and MsgChannelCloseInitResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.channelCloseInit = function channelCloseInit(request, callback) { + return this.rpcCall(channelCloseInit, $root.ibc.core.channel.v1.MsgChannelCloseInit, $root.ibc.core.channel.v1.MsgChannelCloseInitResponse, request, callback); + }, "name", { value: "ChannelCloseInit" }); + + /** + * Calls ChannelCloseInit. + * @function channelCloseInit + * @memberof ibc.core.channel.v1.Msg + * @instance + * @param {ibc.core.channel.v1.IMsgChannelCloseInit} request MsgChannelCloseInit message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.channel.v1.Msg#channelCloseConfirm}. + * @memberof ibc.core.channel.v1.Msg + * @typedef ChannelCloseConfirmCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.channel.v1.MsgChannelCloseConfirmResponse} [response] MsgChannelCloseConfirmResponse + */ + + /** + * Calls ChannelCloseConfirm. + * @function channelCloseConfirm + * @memberof ibc.core.channel.v1.Msg + * @instance + * @param {ibc.core.channel.v1.IMsgChannelCloseConfirm} request MsgChannelCloseConfirm message or plain object + * @param {ibc.core.channel.v1.Msg.ChannelCloseConfirmCallback} callback Node-style callback called with the error, if any, and MsgChannelCloseConfirmResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.channelCloseConfirm = function channelCloseConfirm(request, callback) { + return this.rpcCall(channelCloseConfirm, $root.ibc.core.channel.v1.MsgChannelCloseConfirm, $root.ibc.core.channel.v1.MsgChannelCloseConfirmResponse, request, callback); + }, "name", { value: "ChannelCloseConfirm" }); + + /** + * Calls ChannelCloseConfirm. + * @function channelCloseConfirm + * @memberof ibc.core.channel.v1.Msg + * @instance + * @param {ibc.core.channel.v1.IMsgChannelCloseConfirm} request MsgChannelCloseConfirm message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.channel.v1.Msg#recvPacket}. + * @memberof ibc.core.channel.v1.Msg + * @typedef RecvPacketCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.channel.v1.MsgRecvPacketResponse} [response] MsgRecvPacketResponse + */ + + /** + * Calls RecvPacket. + * @function recvPacket + * @memberof ibc.core.channel.v1.Msg + * @instance + * @param {ibc.core.channel.v1.IMsgRecvPacket} request MsgRecvPacket message or plain object + * @param {ibc.core.channel.v1.Msg.RecvPacketCallback} callback Node-style callback called with the error, if any, and MsgRecvPacketResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.recvPacket = function recvPacket(request, callback) { + return this.rpcCall(recvPacket, $root.ibc.core.channel.v1.MsgRecvPacket, $root.ibc.core.channel.v1.MsgRecvPacketResponse, request, callback); + }, "name", { value: "RecvPacket" }); + + /** + * Calls RecvPacket. + * @function recvPacket + * @memberof ibc.core.channel.v1.Msg + * @instance + * @param {ibc.core.channel.v1.IMsgRecvPacket} request MsgRecvPacket message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.channel.v1.Msg#timeout}. + * @memberof ibc.core.channel.v1.Msg + * @typedef TimeoutCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.channel.v1.MsgTimeoutResponse} [response] MsgTimeoutResponse + */ + + /** + * Calls Timeout. + * @function timeout + * @memberof ibc.core.channel.v1.Msg + * @instance + * @param {ibc.core.channel.v1.IMsgTimeout} request MsgTimeout message or plain object + * @param {ibc.core.channel.v1.Msg.TimeoutCallback} callback Node-style callback called with the error, if any, and MsgTimeoutResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.timeout = function timeout(request, callback) { + return this.rpcCall(timeout, $root.ibc.core.channel.v1.MsgTimeout, $root.ibc.core.channel.v1.MsgTimeoutResponse, request, callback); + }, "name", { value: "Timeout" }); + + /** + * Calls Timeout. + * @function timeout + * @memberof ibc.core.channel.v1.Msg + * @instance + * @param {ibc.core.channel.v1.IMsgTimeout} request MsgTimeout message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.channel.v1.Msg#timeoutOnClose}. + * @memberof ibc.core.channel.v1.Msg + * @typedef TimeoutOnCloseCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.channel.v1.MsgTimeoutOnCloseResponse} [response] MsgTimeoutOnCloseResponse + */ + + /** + * Calls TimeoutOnClose. + * @function timeoutOnClose + * @memberof ibc.core.channel.v1.Msg + * @instance + * @param {ibc.core.channel.v1.IMsgTimeoutOnClose} request MsgTimeoutOnClose message or plain object + * @param {ibc.core.channel.v1.Msg.TimeoutOnCloseCallback} callback Node-style callback called with the error, if any, and MsgTimeoutOnCloseResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.timeoutOnClose = function timeoutOnClose(request, callback) { + return this.rpcCall(timeoutOnClose, $root.ibc.core.channel.v1.MsgTimeoutOnClose, $root.ibc.core.channel.v1.MsgTimeoutOnCloseResponse, request, callback); + }, "name", { value: "TimeoutOnClose" }); + + /** + * Calls TimeoutOnClose. + * @function timeoutOnClose + * @memberof ibc.core.channel.v1.Msg + * @instance + * @param {ibc.core.channel.v1.IMsgTimeoutOnClose} request MsgTimeoutOnClose message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.channel.v1.Msg#acknowledgement}. + * @memberof ibc.core.channel.v1.Msg + * @typedef AcknowledgementCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.channel.v1.MsgAcknowledgementResponse} [response] MsgAcknowledgementResponse + */ + + /** + * Calls Acknowledgement. + * @function acknowledgement + * @memberof ibc.core.channel.v1.Msg + * @instance + * @param {ibc.core.channel.v1.IMsgAcknowledgement} request MsgAcknowledgement message or plain object + * @param {ibc.core.channel.v1.Msg.AcknowledgementCallback} callback Node-style callback called with the error, if any, and MsgAcknowledgementResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.acknowledgement = function acknowledgement(request, callback) { + return this.rpcCall(acknowledgement, $root.ibc.core.channel.v1.MsgAcknowledgement, $root.ibc.core.channel.v1.MsgAcknowledgementResponse, request, callback); + }, "name", { value: "Acknowledgement" }); + + /** + * Calls Acknowledgement. + * @function acknowledgement + * @memberof ibc.core.channel.v1.Msg + * @instance + * @param {ibc.core.channel.v1.IMsgAcknowledgement} request MsgAcknowledgement message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Msg; + })(); + + v1.MsgChannelOpenInit = (function() { + + /** + * Properties of a MsgChannelOpenInit. + * @memberof ibc.core.channel.v1 + * @interface IMsgChannelOpenInit + * @property {string|null} [port_id] MsgChannelOpenInit port_id + * @property {ibc.core.channel.v1.IChannel|null} [channel] MsgChannelOpenInit channel + * @property {string|null} [signer] MsgChannelOpenInit signer + */ + + /** + * Constructs a new MsgChannelOpenInit. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a MsgChannelOpenInit. + * @implements IMsgChannelOpenInit + * @constructor + * @param {ibc.core.channel.v1.IMsgChannelOpenInit=} [properties] Properties to set + */ + function MsgChannelOpenInit(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgChannelOpenInit port_id. + * @member {string} port_id + * @memberof ibc.core.channel.v1.MsgChannelOpenInit + * @instance + */ + MsgChannelOpenInit.prototype.port_id = ""; + + /** + * MsgChannelOpenInit channel. + * @member {ibc.core.channel.v1.IChannel|null|undefined} channel + * @memberof ibc.core.channel.v1.MsgChannelOpenInit + * @instance + */ + MsgChannelOpenInit.prototype.channel = null; + + /** + * MsgChannelOpenInit signer. + * @member {string} signer + * @memberof ibc.core.channel.v1.MsgChannelOpenInit + * @instance + */ + MsgChannelOpenInit.prototype.signer = ""; + + /** + * Encodes the specified MsgChannelOpenInit message. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenInit.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.MsgChannelOpenInit + * @static + * @param {ibc.core.channel.v1.IMsgChannelOpenInit} message MsgChannelOpenInit message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgChannelOpenInit.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); + if (message.channel != null && Object.hasOwnProperty.call(message, "channel")) + $root.ibc.core.channel.v1.Channel.encode(message.channel, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.signer); + return writer; + }; + + /** + * Encodes the specified MsgChannelOpenInit message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenInit.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.MsgChannelOpenInit + * @static + * @param {ibc.core.channel.v1.IMsgChannelOpenInit} message MsgChannelOpenInit message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgChannelOpenInit.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgChannelOpenInit message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.MsgChannelOpenInit + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.MsgChannelOpenInit} MsgChannelOpenInit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgChannelOpenInit.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgChannelOpenInit(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.port_id = reader.string(); + break; + case 2: + message.channel = $root.ibc.core.channel.v1.Channel.decode(reader, reader.uint32()); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgChannelOpenInit message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.MsgChannelOpenInit + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.MsgChannelOpenInit} MsgChannelOpenInit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgChannelOpenInit.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgChannelOpenInit message. + * @function verify + * @memberof ibc.core.channel.v1.MsgChannelOpenInit + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgChannelOpenInit.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.port_id != null && message.hasOwnProperty("port_id")) + if (!$util.isString(message.port_id)) + return "port_id: string expected"; + if (message.channel != null && message.hasOwnProperty("channel")) { + let error = $root.ibc.core.channel.v1.Channel.verify(message.channel); + if (error) + return "channel." + error; + } + if (message.signer != null && message.hasOwnProperty("signer")) + if (!$util.isString(message.signer)) + return "signer: string expected"; + return null; + }; + + /** + * Creates a MsgChannelOpenInit message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.MsgChannelOpenInit + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.MsgChannelOpenInit} MsgChannelOpenInit + */ + MsgChannelOpenInit.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.MsgChannelOpenInit) + return object; + let message = new $root.ibc.core.channel.v1.MsgChannelOpenInit(); + if (object.port_id != null) + message.port_id = String(object.port_id); + if (object.channel != null) { + if (typeof object.channel !== "object") + throw TypeError(".ibc.core.channel.v1.MsgChannelOpenInit.channel: object expected"); + message.channel = $root.ibc.core.channel.v1.Channel.fromObject(object.channel); + } + if (object.signer != null) + message.signer = String(object.signer); + return message; + }; + + /** + * Creates a plain object from a MsgChannelOpenInit message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.MsgChannelOpenInit + * @static + * @param {ibc.core.channel.v1.MsgChannelOpenInit} message MsgChannelOpenInit + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgChannelOpenInit.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.port_id = ""; + object.channel = null; + object.signer = ""; + } + if (message.port_id != null && message.hasOwnProperty("port_id")) + object.port_id = message.port_id; + if (message.channel != null && message.hasOwnProperty("channel")) + object.channel = $root.ibc.core.channel.v1.Channel.toObject(message.channel, options); + if (message.signer != null && message.hasOwnProperty("signer")) + object.signer = message.signer; + return object; + }; + + /** + * Converts this MsgChannelOpenInit to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.MsgChannelOpenInit + * @instance + * @returns {Object.} JSON object + */ + MsgChannelOpenInit.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgChannelOpenInit; + })(); + + v1.MsgChannelOpenInitResponse = (function() { + + /** + * Properties of a MsgChannelOpenInitResponse. + * @memberof ibc.core.channel.v1 + * @interface IMsgChannelOpenInitResponse + */ + + /** + * Constructs a new MsgChannelOpenInitResponse. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a MsgChannelOpenInitResponse. + * @implements IMsgChannelOpenInitResponse + * @constructor + * @param {ibc.core.channel.v1.IMsgChannelOpenInitResponse=} [properties] Properties to set + */ + function MsgChannelOpenInitResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgChannelOpenInitResponse message. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenInitResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.MsgChannelOpenInitResponse + * @static + * @param {ibc.core.channel.v1.IMsgChannelOpenInitResponse} message MsgChannelOpenInitResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgChannelOpenInitResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgChannelOpenInitResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenInitResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.MsgChannelOpenInitResponse + * @static + * @param {ibc.core.channel.v1.IMsgChannelOpenInitResponse} message MsgChannelOpenInitResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgChannelOpenInitResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgChannelOpenInitResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.MsgChannelOpenInitResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.MsgChannelOpenInitResponse} MsgChannelOpenInitResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgChannelOpenInitResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgChannelOpenInitResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgChannelOpenInitResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.MsgChannelOpenInitResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.MsgChannelOpenInitResponse} MsgChannelOpenInitResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgChannelOpenInitResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgChannelOpenInitResponse message. + * @function verify + * @memberof ibc.core.channel.v1.MsgChannelOpenInitResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgChannelOpenInitResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgChannelOpenInitResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.MsgChannelOpenInitResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.MsgChannelOpenInitResponse} MsgChannelOpenInitResponse + */ + MsgChannelOpenInitResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.MsgChannelOpenInitResponse) + return object; + return new $root.ibc.core.channel.v1.MsgChannelOpenInitResponse(); + }; + + /** + * Creates a plain object from a MsgChannelOpenInitResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.MsgChannelOpenInitResponse + * @static + * @param {ibc.core.channel.v1.MsgChannelOpenInitResponse} message MsgChannelOpenInitResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgChannelOpenInitResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgChannelOpenInitResponse to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.MsgChannelOpenInitResponse + * @instance + * @returns {Object.} JSON object + */ + MsgChannelOpenInitResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgChannelOpenInitResponse; + })(); + + v1.MsgChannelOpenTry = (function() { + + /** + * Properties of a MsgChannelOpenTry. + * @memberof ibc.core.channel.v1 + * @interface IMsgChannelOpenTry + * @property {string|null} [port_id] MsgChannelOpenTry port_id + * @property {string|null} [previous_channel_id] MsgChannelOpenTry previous_channel_id + * @property {ibc.core.channel.v1.IChannel|null} [channel] MsgChannelOpenTry channel + * @property {string|null} [counterparty_version] MsgChannelOpenTry counterparty_version + * @property {Uint8Array|null} [proof_init] MsgChannelOpenTry proof_init + * @property {ibc.core.client.v1.IHeight|null} [proof_height] MsgChannelOpenTry proof_height + * @property {string|null} [signer] MsgChannelOpenTry signer + */ + + /** + * Constructs a new MsgChannelOpenTry. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a MsgChannelOpenTry. + * @implements IMsgChannelOpenTry + * @constructor + * @param {ibc.core.channel.v1.IMsgChannelOpenTry=} [properties] Properties to set + */ + function MsgChannelOpenTry(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgChannelOpenTry port_id. + * @member {string} port_id + * @memberof ibc.core.channel.v1.MsgChannelOpenTry + * @instance + */ + MsgChannelOpenTry.prototype.port_id = ""; + + /** + * MsgChannelOpenTry previous_channel_id. + * @member {string} previous_channel_id + * @memberof ibc.core.channel.v1.MsgChannelOpenTry + * @instance + */ + MsgChannelOpenTry.prototype.previous_channel_id = ""; + + /** + * MsgChannelOpenTry channel. + * @member {ibc.core.channel.v1.IChannel|null|undefined} channel + * @memberof ibc.core.channel.v1.MsgChannelOpenTry + * @instance + */ + MsgChannelOpenTry.prototype.channel = null; + + /** + * MsgChannelOpenTry counterparty_version. + * @member {string} counterparty_version + * @memberof ibc.core.channel.v1.MsgChannelOpenTry + * @instance + */ + MsgChannelOpenTry.prototype.counterparty_version = ""; + + /** + * MsgChannelOpenTry proof_init. + * @member {Uint8Array} proof_init + * @memberof ibc.core.channel.v1.MsgChannelOpenTry + * @instance + */ + MsgChannelOpenTry.prototype.proof_init = $util.newBuffer([]); + + /** + * MsgChannelOpenTry proof_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height + * @memberof ibc.core.channel.v1.MsgChannelOpenTry + * @instance + */ + MsgChannelOpenTry.prototype.proof_height = null; + + /** + * MsgChannelOpenTry signer. + * @member {string} signer + * @memberof ibc.core.channel.v1.MsgChannelOpenTry + * @instance + */ + MsgChannelOpenTry.prototype.signer = ""; + + /** + * Encodes the specified MsgChannelOpenTry message. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenTry.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.MsgChannelOpenTry + * @static + * @param {ibc.core.channel.v1.IMsgChannelOpenTry} message MsgChannelOpenTry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgChannelOpenTry.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); + if (message.previous_channel_id != null && Object.hasOwnProperty.call(message, "previous_channel_id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.previous_channel_id); + if (message.channel != null && Object.hasOwnProperty.call(message, "channel")) + $root.ibc.core.channel.v1.Channel.encode(message.channel, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.counterparty_version != null && Object.hasOwnProperty.call(message, "counterparty_version")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.counterparty_version); + if (message.proof_init != null && Object.hasOwnProperty.call(message, "proof_init")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.proof_init); + if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) + $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.signer); + return writer; + }; + + /** + * Encodes the specified MsgChannelOpenTry message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenTry.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.MsgChannelOpenTry + * @static + * @param {ibc.core.channel.v1.IMsgChannelOpenTry} message MsgChannelOpenTry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgChannelOpenTry.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgChannelOpenTry message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.MsgChannelOpenTry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.MsgChannelOpenTry} MsgChannelOpenTry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgChannelOpenTry.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgChannelOpenTry(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.port_id = reader.string(); + break; + case 2: + message.previous_channel_id = reader.string(); + break; + case 3: + message.channel = $root.ibc.core.channel.v1.Channel.decode(reader, reader.uint32()); + break; + case 4: + message.counterparty_version = reader.string(); + break; + case 5: + message.proof_init = reader.bytes(); + break; + case 6: + message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + case 7: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgChannelOpenTry message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.MsgChannelOpenTry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.MsgChannelOpenTry} MsgChannelOpenTry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgChannelOpenTry.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgChannelOpenTry message. + * @function verify + * @memberof ibc.core.channel.v1.MsgChannelOpenTry + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgChannelOpenTry.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.port_id != null && message.hasOwnProperty("port_id")) + if (!$util.isString(message.port_id)) + return "port_id: string expected"; + if (message.previous_channel_id != null && message.hasOwnProperty("previous_channel_id")) + if (!$util.isString(message.previous_channel_id)) + return "previous_channel_id: string expected"; + if (message.channel != null && message.hasOwnProperty("channel")) { + let error = $root.ibc.core.channel.v1.Channel.verify(message.channel); + if (error) + return "channel." + error; + } + if (message.counterparty_version != null && message.hasOwnProperty("counterparty_version")) + if (!$util.isString(message.counterparty_version)) + return "counterparty_version: string expected"; + if (message.proof_init != null && message.hasOwnProperty("proof_init")) + if (!(message.proof_init && typeof message.proof_init.length === "number" || $util.isString(message.proof_init))) + return "proof_init: buffer expected"; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); + if (error) + return "proof_height." + error; + } + if (message.signer != null && message.hasOwnProperty("signer")) + if (!$util.isString(message.signer)) + return "signer: string expected"; + return null; + }; + + /** + * Creates a MsgChannelOpenTry message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.MsgChannelOpenTry + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.MsgChannelOpenTry} MsgChannelOpenTry + */ + MsgChannelOpenTry.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.MsgChannelOpenTry) + return object; + let message = new $root.ibc.core.channel.v1.MsgChannelOpenTry(); + if (object.port_id != null) + message.port_id = String(object.port_id); + if (object.previous_channel_id != null) + message.previous_channel_id = String(object.previous_channel_id); + if (object.channel != null) { + if (typeof object.channel !== "object") + throw TypeError(".ibc.core.channel.v1.MsgChannelOpenTry.channel: object expected"); + message.channel = $root.ibc.core.channel.v1.Channel.fromObject(object.channel); + } + if (object.counterparty_version != null) + message.counterparty_version = String(object.counterparty_version); + if (object.proof_init != null) + if (typeof object.proof_init === "string") + $util.base64.decode(object.proof_init, message.proof_init = $util.newBuffer($util.base64.length(object.proof_init)), 0); + else if (object.proof_init.length) + message.proof_init = object.proof_init; + if (object.proof_height != null) { + if (typeof object.proof_height !== "object") + throw TypeError(".ibc.core.channel.v1.MsgChannelOpenTry.proof_height: object expected"); + message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); + } + if (object.signer != null) + message.signer = String(object.signer); + return message; + }; + + /** + * Creates a plain object from a MsgChannelOpenTry message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.MsgChannelOpenTry + * @static + * @param {ibc.core.channel.v1.MsgChannelOpenTry} message MsgChannelOpenTry + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgChannelOpenTry.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.port_id = ""; + object.previous_channel_id = ""; + object.channel = null; + object.counterparty_version = ""; + if (options.bytes === String) + object.proof_init = ""; + else { + object.proof_init = []; + if (options.bytes !== Array) + object.proof_init = $util.newBuffer(object.proof_init); + } + object.proof_height = null; + object.signer = ""; + } + if (message.port_id != null && message.hasOwnProperty("port_id")) + object.port_id = message.port_id; + if (message.previous_channel_id != null && message.hasOwnProperty("previous_channel_id")) + object.previous_channel_id = message.previous_channel_id; + if (message.channel != null && message.hasOwnProperty("channel")) + object.channel = $root.ibc.core.channel.v1.Channel.toObject(message.channel, options); + if (message.counterparty_version != null && message.hasOwnProperty("counterparty_version")) + object.counterparty_version = message.counterparty_version; + if (message.proof_init != null && message.hasOwnProperty("proof_init")) + object.proof_init = options.bytes === String ? $util.base64.encode(message.proof_init, 0, message.proof_init.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_init) : message.proof_init; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) + object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); + if (message.signer != null && message.hasOwnProperty("signer")) + object.signer = message.signer; + return object; + }; + + /** + * Converts this MsgChannelOpenTry to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.MsgChannelOpenTry + * @instance + * @returns {Object.} JSON object + */ + MsgChannelOpenTry.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgChannelOpenTry; + })(); + + v1.MsgChannelOpenTryResponse = (function() { + + /** + * Properties of a MsgChannelOpenTryResponse. + * @memberof ibc.core.channel.v1 + * @interface IMsgChannelOpenTryResponse + */ + + /** + * Constructs a new MsgChannelOpenTryResponse. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a MsgChannelOpenTryResponse. + * @implements IMsgChannelOpenTryResponse + * @constructor + * @param {ibc.core.channel.v1.IMsgChannelOpenTryResponse=} [properties] Properties to set + */ + function MsgChannelOpenTryResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgChannelOpenTryResponse message. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenTryResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.MsgChannelOpenTryResponse + * @static + * @param {ibc.core.channel.v1.IMsgChannelOpenTryResponse} message MsgChannelOpenTryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgChannelOpenTryResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgChannelOpenTryResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenTryResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.MsgChannelOpenTryResponse + * @static + * @param {ibc.core.channel.v1.IMsgChannelOpenTryResponse} message MsgChannelOpenTryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgChannelOpenTryResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgChannelOpenTryResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.MsgChannelOpenTryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.MsgChannelOpenTryResponse} MsgChannelOpenTryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgChannelOpenTryResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgChannelOpenTryResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgChannelOpenTryResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.MsgChannelOpenTryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.MsgChannelOpenTryResponse} MsgChannelOpenTryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgChannelOpenTryResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgChannelOpenTryResponse message. + * @function verify + * @memberof ibc.core.channel.v1.MsgChannelOpenTryResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgChannelOpenTryResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgChannelOpenTryResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.MsgChannelOpenTryResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.MsgChannelOpenTryResponse} MsgChannelOpenTryResponse + */ + MsgChannelOpenTryResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.MsgChannelOpenTryResponse) + return object; + return new $root.ibc.core.channel.v1.MsgChannelOpenTryResponse(); + }; + + /** + * Creates a plain object from a MsgChannelOpenTryResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.MsgChannelOpenTryResponse + * @static + * @param {ibc.core.channel.v1.MsgChannelOpenTryResponse} message MsgChannelOpenTryResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgChannelOpenTryResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgChannelOpenTryResponse to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.MsgChannelOpenTryResponse + * @instance + * @returns {Object.} JSON object + */ + MsgChannelOpenTryResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgChannelOpenTryResponse; + })(); + + v1.MsgChannelOpenAck = (function() { + + /** + * Properties of a MsgChannelOpenAck. + * @memberof ibc.core.channel.v1 + * @interface IMsgChannelOpenAck + * @property {string|null} [port_id] MsgChannelOpenAck port_id + * @property {string|null} [channel_id] MsgChannelOpenAck channel_id + * @property {string|null} [counterparty_channel_id] MsgChannelOpenAck counterparty_channel_id + * @property {string|null} [counterparty_version] MsgChannelOpenAck counterparty_version + * @property {Uint8Array|null} [proof_try] MsgChannelOpenAck proof_try + * @property {ibc.core.client.v1.IHeight|null} [proof_height] MsgChannelOpenAck proof_height + * @property {string|null} [signer] MsgChannelOpenAck signer + */ + + /** + * Constructs a new MsgChannelOpenAck. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a MsgChannelOpenAck. + * @implements IMsgChannelOpenAck + * @constructor + * @param {ibc.core.channel.v1.IMsgChannelOpenAck=} [properties] Properties to set + */ + function MsgChannelOpenAck(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgChannelOpenAck port_id. + * @member {string} port_id + * @memberof ibc.core.channel.v1.MsgChannelOpenAck + * @instance + */ + MsgChannelOpenAck.prototype.port_id = ""; + + /** + * MsgChannelOpenAck channel_id. + * @member {string} channel_id + * @memberof ibc.core.channel.v1.MsgChannelOpenAck + * @instance + */ + MsgChannelOpenAck.prototype.channel_id = ""; + + /** + * MsgChannelOpenAck counterparty_channel_id. + * @member {string} counterparty_channel_id + * @memberof ibc.core.channel.v1.MsgChannelOpenAck + * @instance + */ + MsgChannelOpenAck.prototype.counterparty_channel_id = ""; + + /** + * MsgChannelOpenAck counterparty_version. + * @member {string} counterparty_version + * @memberof ibc.core.channel.v1.MsgChannelOpenAck + * @instance + */ + MsgChannelOpenAck.prototype.counterparty_version = ""; + + /** + * MsgChannelOpenAck proof_try. + * @member {Uint8Array} proof_try + * @memberof ibc.core.channel.v1.MsgChannelOpenAck + * @instance + */ + MsgChannelOpenAck.prototype.proof_try = $util.newBuffer([]); + + /** + * MsgChannelOpenAck proof_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height + * @memberof ibc.core.channel.v1.MsgChannelOpenAck + * @instance + */ + MsgChannelOpenAck.prototype.proof_height = null; + + /** + * MsgChannelOpenAck signer. + * @member {string} signer + * @memberof ibc.core.channel.v1.MsgChannelOpenAck + * @instance + */ + MsgChannelOpenAck.prototype.signer = ""; + + /** + * Encodes the specified MsgChannelOpenAck message. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenAck.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.MsgChannelOpenAck + * @static + * @param {ibc.core.channel.v1.IMsgChannelOpenAck} message MsgChannelOpenAck message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgChannelOpenAck.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); + if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); + if (message.counterparty_channel_id != null && Object.hasOwnProperty.call(message, "counterparty_channel_id")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.counterparty_channel_id); + if (message.counterparty_version != null && Object.hasOwnProperty.call(message, "counterparty_version")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.counterparty_version); + if (message.proof_try != null && Object.hasOwnProperty.call(message, "proof_try")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.proof_try); + if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) + $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.signer); + return writer; + }; + + /** + * Encodes the specified MsgChannelOpenAck message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenAck.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.MsgChannelOpenAck + * @static + * @param {ibc.core.channel.v1.IMsgChannelOpenAck} message MsgChannelOpenAck message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgChannelOpenAck.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgChannelOpenAck message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.MsgChannelOpenAck + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.MsgChannelOpenAck} MsgChannelOpenAck + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgChannelOpenAck.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgChannelOpenAck(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.port_id = reader.string(); + break; + case 2: + message.channel_id = reader.string(); + break; + case 3: + message.counterparty_channel_id = reader.string(); + break; + case 4: + message.counterparty_version = reader.string(); + break; + case 5: + message.proof_try = reader.bytes(); + break; + case 6: + message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + case 7: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgChannelOpenAck message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.MsgChannelOpenAck + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.MsgChannelOpenAck} MsgChannelOpenAck + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgChannelOpenAck.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgChannelOpenAck message. + * @function verify + * @memberof ibc.core.channel.v1.MsgChannelOpenAck + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgChannelOpenAck.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.port_id != null && message.hasOwnProperty("port_id")) + if (!$util.isString(message.port_id)) + return "port_id: string expected"; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + if (!$util.isString(message.channel_id)) + return "channel_id: string expected"; + if (message.counterparty_channel_id != null && message.hasOwnProperty("counterparty_channel_id")) + if (!$util.isString(message.counterparty_channel_id)) + return "counterparty_channel_id: string expected"; + if (message.counterparty_version != null && message.hasOwnProperty("counterparty_version")) + if (!$util.isString(message.counterparty_version)) + return "counterparty_version: string expected"; + if (message.proof_try != null && message.hasOwnProperty("proof_try")) + if (!(message.proof_try && typeof message.proof_try.length === "number" || $util.isString(message.proof_try))) + return "proof_try: buffer expected"; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); + if (error) + return "proof_height." + error; + } + if (message.signer != null && message.hasOwnProperty("signer")) + if (!$util.isString(message.signer)) + return "signer: string expected"; + return null; + }; + + /** + * Creates a MsgChannelOpenAck message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.MsgChannelOpenAck + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.MsgChannelOpenAck} MsgChannelOpenAck + */ + MsgChannelOpenAck.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.MsgChannelOpenAck) + return object; + let message = new $root.ibc.core.channel.v1.MsgChannelOpenAck(); + if (object.port_id != null) + message.port_id = String(object.port_id); + if (object.channel_id != null) + message.channel_id = String(object.channel_id); + if (object.counterparty_channel_id != null) + message.counterparty_channel_id = String(object.counterparty_channel_id); + if (object.counterparty_version != null) + message.counterparty_version = String(object.counterparty_version); + if (object.proof_try != null) + if (typeof object.proof_try === "string") + $util.base64.decode(object.proof_try, message.proof_try = $util.newBuffer($util.base64.length(object.proof_try)), 0); + else if (object.proof_try.length) + message.proof_try = object.proof_try; + if (object.proof_height != null) { + if (typeof object.proof_height !== "object") + throw TypeError(".ibc.core.channel.v1.MsgChannelOpenAck.proof_height: object expected"); + message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); + } + if (object.signer != null) + message.signer = String(object.signer); + return message; + }; + + /** + * Creates a plain object from a MsgChannelOpenAck message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.MsgChannelOpenAck + * @static + * @param {ibc.core.channel.v1.MsgChannelOpenAck} message MsgChannelOpenAck + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgChannelOpenAck.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.port_id = ""; + object.channel_id = ""; + object.counterparty_channel_id = ""; + object.counterparty_version = ""; + if (options.bytes === String) + object.proof_try = ""; + else { + object.proof_try = []; + if (options.bytes !== Array) + object.proof_try = $util.newBuffer(object.proof_try); + } + object.proof_height = null; + object.signer = ""; + } + if (message.port_id != null && message.hasOwnProperty("port_id")) + object.port_id = message.port_id; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + object.channel_id = message.channel_id; + if (message.counterparty_channel_id != null && message.hasOwnProperty("counterparty_channel_id")) + object.counterparty_channel_id = message.counterparty_channel_id; + if (message.counterparty_version != null && message.hasOwnProperty("counterparty_version")) + object.counterparty_version = message.counterparty_version; + if (message.proof_try != null && message.hasOwnProperty("proof_try")) + object.proof_try = options.bytes === String ? $util.base64.encode(message.proof_try, 0, message.proof_try.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_try) : message.proof_try; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) + object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); + if (message.signer != null && message.hasOwnProperty("signer")) + object.signer = message.signer; + return object; + }; + + /** + * Converts this MsgChannelOpenAck to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.MsgChannelOpenAck + * @instance + * @returns {Object.} JSON object + */ + MsgChannelOpenAck.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgChannelOpenAck; + })(); + + v1.MsgChannelOpenAckResponse = (function() { + + /** + * Properties of a MsgChannelOpenAckResponse. + * @memberof ibc.core.channel.v1 + * @interface IMsgChannelOpenAckResponse + */ + + /** + * Constructs a new MsgChannelOpenAckResponse. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a MsgChannelOpenAckResponse. + * @implements IMsgChannelOpenAckResponse + * @constructor + * @param {ibc.core.channel.v1.IMsgChannelOpenAckResponse=} [properties] Properties to set + */ + function MsgChannelOpenAckResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgChannelOpenAckResponse message. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenAckResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.MsgChannelOpenAckResponse + * @static + * @param {ibc.core.channel.v1.IMsgChannelOpenAckResponse} message MsgChannelOpenAckResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgChannelOpenAckResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgChannelOpenAckResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenAckResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.MsgChannelOpenAckResponse + * @static + * @param {ibc.core.channel.v1.IMsgChannelOpenAckResponse} message MsgChannelOpenAckResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgChannelOpenAckResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgChannelOpenAckResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.MsgChannelOpenAckResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.MsgChannelOpenAckResponse} MsgChannelOpenAckResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgChannelOpenAckResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgChannelOpenAckResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgChannelOpenAckResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.MsgChannelOpenAckResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.MsgChannelOpenAckResponse} MsgChannelOpenAckResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgChannelOpenAckResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgChannelOpenAckResponse message. + * @function verify + * @memberof ibc.core.channel.v1.MsgChannelOpenAckResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgChannelOpenAckResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgChannelOpenAckResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.MsgChannelOpenAckResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.MsgChannelOpenAckResponse} MsgChannelOpenAckResponse + */ + MsgChannelOpenAckResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.MsgChannelOpenAckResponse) + return object; + return new $root.ibc.core.channel.v1.MsgChannelOpenAckResponse(); + }; + + /** + * Creates a plain object from a MsgChannelOpenAckResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.MsgChannelOpenAckResponse + * @static + * @param {ibc.core.channel.v1.MsgChannelOpenAckResponse} message MsgChannelOpenAckResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgChannelOpenAckResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgChannelOpenAckResponse to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.MsgChannelOpenAckResponse + * @instance + * @returns {Object.} JSON object + */ + MsgChannelOpenAckResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgChannelOpenAckResponse; + })(); + + v1.MsgChannelOpenConfirm = (function() { + + /** + * Properties of a MsgChannelOpenConfirm. + * @memberof ibc.core.channel.v1 + * @interface IMsgChannelOpenConfirm + * @property {string|null} [port_id] MsgChannelOpenConfirm port_id + * @property {string|null} [channel_id] MsgChannelOpenConfirm channel_id + * @property {Uint8Array|null} [proof_ack] MsgChannelOpenConfirm proof_ack + * @property {ibc.core.client.v1.IHeight|null} [proof_height] MsgChannelOpenConfirm proof_height + * @property {string|null} [signer] MsgChannelOpenConfirm signer + */ + + /** + * Constructs a new MsgChannelOpenConfirm. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a MsgChannelOpenConfirm. + * @implements IMsgChannelOpenConfirm + * @constructor + * @param {ibc.core.channel.v1.IMsgChannelOpenConfirm=} [properties] Properties to set + */ + function MsgChannelOpenConfirm(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgChannelOpenConfirm port_id. + * @member {string} port_id + * @memberof ibc.core.channel.v1.MsgChannelOpenConfirm + * @instance + */ + MsgChannelOpenConfirm.prototype.port_id = ""; + + /** + * MsgChannelOpenConfirm channel_id. + * @member {string} channel_id + * @memberof ibc.core.channel.v1.MsgChannelOpenConfirm + * @instance + */ + MsgChannelOpenConfirm.prototype.channel_id = ""; + + /** + * MsgChannelOpenConfirm proof_ack. + * @member {Uint8Array} proof_ack + * @memberof ibc.core.channel.v1.MsgChannelOpenConfirm + * @instance + */ + MsgChannelOpenConfirm.prototype.proof_ack = $util.newBuffer([]); + + /** + * MsgChannelOpenConfirm proof_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height + * @memberof ibc.core.channel.v1.MsgChannelOpenConfirm + * @instance + */ + MsgChannelOpenConfirm.prototype.proof_height = null; + + /** + * MsgChannelOpenConfirm signer. + * @member {string} signer + * @memberof ibc.core.channel.v1.MsgChannelOpenConfirm + * @instance + */ + MsgChannelOpenConfirm.prototype.signer = ""; + + /** + * Encodes the specified MsgChannelOpenConfirm message. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenConfirm.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.MsgChannelOpenConfirm + * @static + * @param {ibc.core.channel.v1.IMsgChannelOpenConfirm} message MsgChannelOpenConfirm message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgChannelOpenConfirm.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); + if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); + if (message.proof_ack != null && Object.hasOwnProperty.call(message, "proof_ack")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.proof_ack); + if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) + $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.signer); + return writer; + }; + + /** + * Encodes the specified MsgChannelOpenConfirm message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenConfirm.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.MsgChannelOpenConfirm + * @static + * @param {ibc.core.channel.v1.IMsgChannelOpenConfirm} message MsgChannelOpenConfirm message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgChannelOpenConfirm.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgChannelOpenConfirm message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.MsgChannelOpenConfirm + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.MsgChannelOpenConfirm} MsgChannelOpenConfirm + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgChannelOpenConfirm.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgChannelOpenConfirm(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.port_id = reader.string(); + break; + case 2: + message.channel_id = reader.string(); + break; + case 3: + message.proof_ack = reader.bytes(); + break; + case 4: + message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + case 5: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgChannelOpenConfirm message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.MsgChannelOpenConfirm + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.MsgChannelOpenConfirm} MsgChannelOpenConfirm + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgChannelOpenConfirm.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgChannelOpenConfirm message. + * @function verify + * @memberof ibc.core.channel.v1.MsgChannelOpenConfirm + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgChannelOpenConfirm.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.port_id != null && message.hasOwnProperty("port_id")) + if (!$util.isString(message.port_id)) + return "port_id: string expected"; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + if (!$util.isString(message.channel_id)) + return "channel_id: string expected"; + if (message.proof_ack != null && message.hasOwnProperty("proof_ack")) + if (!(message.proof_ack && typeof message.proof_ack.length === "number" || $util.isString(message.proof_ack))) + return "proof_ack: buffer expected"; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); + if (error) + return "proof_height." + error; + } + if (message.signer != null && message.hasOwnProperty("signer")) + if (!$util.isString(message.signer)) + return "signer: string expected"; + return null; + }; + + /** + * Creates a MsgChannelOpenConfirm message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.MsgChannelOpenConfirm + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.MsgChannelOpenConfirm} MsgChannelOpenConfirm + */ + MsgChannelOpenConfirm.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.MsgChannelOpenConfirm) + return object; + let message = new $root.ibc.core.channel.v1.MsgChannelOpenConfirm(); + if (object.port_id != null) + message.port_id = String(object.port_id); + if (object.channel_id != null) + message.channel_id = String(object.channel_id); + if (object.proof_ack != null) + if (typeof object.proof_ack === "string") + $util.base64.decode(object.proof_ack, message.proof_ack = $util.newBuffer($util.base64.length(object.proof_ack)), 0); + else if (object.proof_ack.length) + message.proof_ack = object.proof_ack; + if (object.proof_height != null) { + if (typeof object.proof_height !== "object") + throw TypeError(".ibc.core.channel.v1.MsgChannelOpenConfirm.proof_height: object expected"); + message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); + } + if (object.signer != null) + message.signer = String(object.signer); + return message; + }; + + /** + * Creates a plain object from a MsgChannelOpenConfirm message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.MsgChannelOpenConfirm + * @static + * @param {ibc.core.channel.v1.MsgChannelOpenConfirm} message MsgChannelOpenConfirm + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgChannelOpenConfirm.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.port_id = ""; + object.channel_id = ""; + if (options.bytes === String) + object.proof_ack = ""; + else { + object.proof_ack = []; + if (options.bytes !== Array) + object.proof_ack = $util.newBuffer(object.proof_ack); + } + object.proof_height = null; + object.signer = ""; + } + if (message.port_id != null && message.hasOwnProperty("port_id")) + object.port_id = message.port_id; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + object.channel_id = message.channel_id; + if (message.proof_ack != null && message.hasOwnProperty("proof_ack")) + object.proof_ack = options.bytes === String ? $util.base64.encode(message.proof_ack, 0, message.proof_ack.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_ack) : message.proof_ack; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) + object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); + if (message.signer != null && message.hasOwnProperty("signer")) + object.signer = message.signer; + return object; + }; + + /** + * Converts this MsgChannelOpenConfirm to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.MsgChannelOpenConfirm + * @instance + * @returns {Object.} JSON object + */ + MsgChannelOpenConfirm.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgChannelOpenConfirm; + })(); + + v1.MsgChannelOpenConfirmResponse = (function() { + + /** + * Properties of a MsgChannelOpenConfirmResponse. + * @memberof ibc.core.channel.v1 + * @interface IMsgChannelOpenConfirmResponse + */ + + /** + * Constructs a new MsgChannelOpenConfirmResponse. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a MsgChannelOpenConfirmResponse. + * @implements IMsgChannelOpenConfirmResponse + * @constructor + * @param {ibc.core.channel.v1.IMsgChannelOpenConfirmResponse=} [properties] Properties to set + */ + function MsgChannelOpenConfirmResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgChannelOpenConfirmResponse message. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenConfirmResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.MsgChannelOpenConfirmResponse + * @static + * @param {ibc.core.channel.v1.IMsgChannelOpenConfirmResponse} message MsgChannelOpenConfirmResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgChannelOpenConfirmResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgChannelOpenConfirmResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenConfirmResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.MsgChannelOpenConfirmResponse + * @static + * @param {ibc.core.channel.v1.IMsgChannelOpenConfirmResponse} message MsgChannelOpenConfirmResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgChannelOpenConfirmResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgChannelOpenConfirmResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.MsgChannelOpenConfirmResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.MsgChannelOpenConfirmResponse} MsgChannelOpenConfirmResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgChannelOpenConfirmResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgChannelOpenConfirmResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgChannelOpenConfirmResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.MsgChannelOpenConfirmResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.MsgChannelOpenConfirmResponse} MsgChannelOpenConfirmResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgChannelOpenConfirmResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgChannelOpenConfirmResponse message. + * @function verify + * @memberof ibc.core.channel.v1.MsgChannelOpenConfirmResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgChannelOpenConfirmResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgChannelOpenConfirmResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.MsgChannelOpenConfirmResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.MsgChannelOpenConfirmResponse} MsgChannelOpenConfirmResponse + */ + MsgChannelOpenConfirmResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.MsgChannelOpenConfirmResponse) + return object; + return new $root.ibc.core.channel.v1.MsgChannelOpenConfirmResponse(); + }; + + /** + * Creates a plain object from a MsgChannelOpenConfirmResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.MsgChannelOpenConfirmResponse + * @static + * @param {ibc.core.channel.v1.MsgChannelOpenConfirmResponse} message MsgChannelOpenConfirmResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgChannelOpenConfirmResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgChannelOpenConfirmResponse to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.MsgChannelOpenConfirmResponse + * @instance + * @returns {Object.} JSON object + */ + MsgChannelOpenConfirmResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgChannelOpenConfirmResponse; + })(); + + v1.MsgChannelCloseInit = (function() { + + /** + * Properties of a MsgChannelCloseInit. + * @memberof ibc.core.channel.v1 + * @interface IMsgChannelCloseInit + * @property {string|null} [port_id] MsgChannelCloseInit port_id + * @property {string|null} [channel_id] MsgChannelCloseInit channel_id + * @property {string|null} [signer] MsgChannelCloseInit signer + */ + + /** + * Constructs a new MsgChannelCloseInit. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a MsgChannelCloseInit. + * @implements IMsgChannelCloseInit + * @constructor + * @param {ibc.core.channel.v1.IMsgChannelCloseInit=} [properties] Properties to set + */ + function MsgChannelCloseInit(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgChannelCloseInit port_id. + * @member {string} port_id + * @memberof ibc.core.channel.v1.MsgChannelCloseInit + * @instance + */ + MsgChannelCloseInit.prototype.port_id = ""; + + /** + * MsgChannelCloseInit channel_id. + * @member {string} channel_id + * @memberof ibc.core.channel.v1.MsgChannelCloseInit + * @instance + */ + MsgChannelCloseInit.prototype.channel_id = ""; + + /** + * MsgChannelCloseInit signer. + * @member {string} signer + * @memberof ibc.core.channel.v1.MsgChannelCloseInit + * @instance + */ + MsgChannelCloseInit.prototype.signer = ""; + + /** + * Encodes the specified MsgChannelCloseInit message. Does not implicitly {@link ibc.core.channel.v1.MsgChannelCloseInit.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.MsgChannelCloseInit + * @static + * @param {ibc.core.channel.v1.IMsgChannelCloseInit} message MsgChannelCloseInit message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgChannelCloseInit.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); + if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); + if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.signer); + return writer; + }; + + /** + * Encodes the specified MsgChannelCloseInit message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgChannelCloseInit.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.MsgChannelCloseInit + * @static + * @param {ibc.core.channel.v1.IMsgChannelCloseInit} message MsgChannelCloseInit message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgChannelCloseInit.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgChannelCloseInit message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.MsgChannelCloseInit + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.MsgChannelCloseInit} MsgChannelCloseInit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgChannelCloseInit.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgChannelCloseInit(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.port_id = reader.string(); + break; + case 2: + message.channel_id = reader.string(); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgChannelCloseInit message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.MsgChannelCloseInit + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.MsgChannelCloseInit} MsgChannelCloseInit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgChannelCloseInit.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgChannelCloseInit message. + * @function verify + * @memberof ibc.core.channel.v1.MsgChannelCloseInit + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgChannelCloseInit.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.port_id != null && message.hasOwnProperty("port_id")) + if (!$util.isString(message.port_id)) + return "port_id: string expected"; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + if (!$util.isString(message.channel_id)) + return "channel_id: string expected"; + if (message.signer != null && message.hasOwnProperty("signer")) + if (!$util.isString(message.signer)) + return "signer: string expected"; + return null; + }; + + /** + * Creates a MsgChannelCloseInit message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.MsgChannelCloseInit + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.MsgChannelCloseInit} MsgChannelCloseInit + */ + MsgChannelCloseInit.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.MsgChannelCloseInit) + return object; + let message = new $root.ibc.core.channel.v1.MsgChannelCloseInit(); + if (object.port_id != null) + message.port_id = String(object.port_id); + if (object.channel_id != null) + message.channel_id = String(object.channel_id); + if (object.signer != null) + message.signer = String(object.signer); + return message; + }; + + /** + * Creates a plain object from a MsgChannelCloseInit message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.MsgChannelCloseInit + * @static + * @param {ibc.core.channel.v1.MsgChannelCloseInit} message MsgChannelCloseInit + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgChannelCloseInit.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.port_id = ""; + object.channel_id = ""; + object.signer = ""; + } + if (message.port_id != null && message.hasOwnProperty("port_id")) + object.port_id = message.port_id; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + object.channel_id = message.channel_id; + if (message.signer != null && message.hasOwnProperty("signer")) + object.signer = message.signer; + return object; + }; + + /** + * Converts this MsgChannelCloseInit to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.MsgChannelCloseInit + * @instance + * @returns {Object.} JSON object + */ + MsgChannelCloseInit.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgChannelCloseInit; + })(); + + v1.MsgChannelCloseInitResponse = (function() { + + /** + * Properties of a MsgChannelCloseInitResponse. + * @memberof ibc.core.channel.v1 + * @interface IMsgChannelCloseInitResponse + */ + + /** + * Constructs a new MsgChannelCloseInitResponse. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a MsgChannelCloseInitResponse. + * @implements IMsgChannelCloseInitResponse + * @constructor + * @param {ibc.core.channel.v1.IMsgChannelCloseInitResponse=} [properties] Properties to set + */ + function MsgChannelCloseInitResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgChannelCloseInitResponse message. Does not implicitly {@link ibc.core.channel.v1.MsgChannelCloseInitResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.MsgChannelCloseInitResponse + * @static + * @param {ibc.core.channel.v1.IMsgChannelCloseInitResponse} message MsgChannelCloseInitResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgChannelCloseInitResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgChannelCloseInitResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgChannelCloseInitResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.MsgChannelCloseInitResponse + * @static + * @param {ibc.core.channel.v1.IMsgChannelCloseInitResponse} message MsgChannelCloseInitResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgChannelCloseInitResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgChannelCloseInitResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.MsgChannelCloseInitResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.MsgChannelCloseInitResponse} MsgChannelCloseInitResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgChannelCloseInitResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgChannelCloseInitResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgChannelCloseInitResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.MsgChannelCloseInitResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.MsgChannelCloseInitResponse} MsgChannelCloseInitResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgChannelCloseInitResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgChannelCloseInitResponse message. + * @function verify + * @memberof ibc.core.channel.v1.MsgChannelCloseInitResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgChannelCloseInitResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgChannelCloseInitResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.MsgChannelCloseInitResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.MsgChannelCloseInitResponse} MsgChannelCloseInitResponse + */ + MsgChannelCloseInitResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.MsgChannelCloseInitResponse) + return object; + return new $root.ibc.core.channel.v1.MsgChannelCloseInitResponse(); + }; + + /** + * Creates a plain object from a MsgChannelCloseInitResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.MsgChannelCloseInitResponse + * @static + * @param {ibc.core.channel.v1.MsgChannelCloseInitResponse} message MsgChannelCloseInitResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgChannelCloseInitResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgChannelCloseInitResponse to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.MsgChannelCloseInitResponse + * @instance + * @returns {Object.} JSON object + */ + MsgChannelCloseInitResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgChannelCloseInitResponse; + })(); + + v1.MsgChannelCloseConfirm = (function() { + + /** + * Properties of a MsgChannelCloseConfirm. + * @memberof ibc.core.channel.v1 + * @interface IMsgChannelCloseConfirm + * @property {string|null} [port_id] MsgChannelCloseConfirm port_id + * @property {string|null} [channel_id] MsgChannelCloseConfirm channel_id + * @property {Uint8Array|null} [proof_init] MsgChannelCloseConfirm proof_init + * @property {ibc.core.client.v1.IHeight|null} [proof_height] MsgChannelCloseConfirm proof_height + * @property {string|null} [signer] MsgChannelCloseConfirm signer + */ + + /** + * Constructs a new MsgChannelCloseConfirm. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a MsgChannelCloseConfirm. + * @implements IMsgChannelCloseConfirm + * @constructor + * @param {ibc.core.channel.v1.IMsgChannelCloseConfirm=} [properties] Properties to set + */ + function MsgChannelCloseConfirm(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgChannelCloseConfirm port_id. + * @member {string} port_id + * @memberof ibc.core.channel.v1.MsgChannelCloseConfirm + * @instance + */ + MsgChannelCloseConfirm.prototype.port_id = ""; + + /** + * MsgChannelCloseConfirm channel_id. + * @member {string} channel_id + * @memberof ibc.core.channel.v1.MsgChannelCloseConfirm + * @instance + */ + MsgChannelCloseConfirm.prototype.channel_id = ""; + + /** + * MsgChannelCloseConfirm proof_init. + * @member {Uint8Array} proof_init + * @memberof ibc.core.channel.v1.MsgChannelCloseConfirm + * @instance + */ + MsgChannelCloseConfirm.prototype.proof_init = $util.newBuffer([]); + + /** + * MsgChannelCloseConfirm proof_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height + * @memberof ibc.core.channel.v1.MsgChannelCloseConfirm + * @instance + */ + MsgChannelCloseConfirm.prototype.proof_height = null; + + /** + * MsgChannelCloseConfirm signer. + * @member {string} signer + * @memberof ibc.core.channel.v1.MsgChannelCloseConfirm + * @instance + */ + MsgChannelCloseConfirm.prototype.signer = ""; + + /** + * Encodes the specified MsgChannelCloseConfirm message. Does not implicitly {@link ibc.core.channel.v1.MsgChannelCloseConfirm.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.MsgChannelCloseConfirm + * @static + * @param {ibc.core.channel.v1.IMsgChannelCloseConfirm} message MsgChannelCloseConfirm message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgChannelCloseConfirm.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); + if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); + if (message.proof_init != null && Object.hasOwnProperty.call(message, "proof_init")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.proof_init); + if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) + $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.signer); + return writer; + }; + + /** + * Encodes the specified MsgChannelCloseConfirm message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgChannelCloseConfirm.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.MsgChannelCloseConfirm + * @static + * @param {ibc.core.channel.v1.IMsgChannelCloseConfirm} message MsgChannelCloseConfirm message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgChannelCloseConfirm.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgChannelCloseConfirm message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.MsgChannelCloseConfirm + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.MsgChannelCloseConfirm} MsgChannelCloseConfirm + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgChannelCloseConfirm.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgChannelCloseConfirm(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.port_id = reader.string(); + break; + case 2: + message.channel_id = reader.string(); + break; + case 3: + message.proof_init = reader.bytes(); + break; + case 4: + message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + case 5: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgChannelCloseConfirm message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.MsgChannelCloseConfirm + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.MsgChannelCloseConfirm} MsgChannelCloseConfirm + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgChannelCloseConfirm.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgChannelCloseConfirm message. + * @function verify + * @memberof ibc.core.channel.v1.MsgChannelCloseConfirm + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgChannelCloseConfirm.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.port_id != null && message.hasOwnProperty("port_id")) + if (!$util.isString(message.port_id)) + return "port_id: string expected"; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + if (!$util.isString(message.channel_id)) + return "channel_id: string expected"; + if (message.proof_init != null && message.hasOwnProperty("proof_init")) + if (!(message.proof_init && typeof message.proof_init.length === "number" || $util.isString(message.proof_init))) + return "proof_init: buffer expected"; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); + if (error) + return "proof_height." + error; + } + if (message.signer != null && message.hasOwnProperty("signer")) + if (!$util.isString(message.signer)) + return "signer: string expected"; + return null; + }; + + /** + * Creates a MsgChannelCloseConfirm message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.MsgChannelCloseConfirm + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.MsgChannelCloseConfirm} MsgChannelCloseConfirm + */ + MsgChannelCloseConfirm.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.MsgChannelCloseConfirm) + return object; + let message = new $root.ibc.core.channel.v1.MsgChannelCloseConfirm(); + if (object.port_id != null) + message.port_id = String(object.port_id); + if (object.channel_id != null) + message.channel_id = String(object.channel_id); + if (object.proof_init != null) + if (typeof object.proof_init === "string") + $util.base64.decode(object.proof_init, message.proof_init = $util.newBuffer($util.base64.length(object.proof_init)), 0); + else if (object.proof_init.length) + message.proof_init = object.proof_init; + if (object.proof_height != null) { + if (typeof object.proof_height !== "object") + throw TypeError(".ibc.core.channel.v1.MsgChannelCloseConfirm.proof_height: object expected"); + message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); + } + if (object.signer != null) + message.signer = String(object.signer); + return message; + }; + + /** + * Creates a plain object from a MsgChannelCloseConfirm message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.MsgChannelCloseConfirm + * @static + * @param {ibc.core.channel.v1.MsgChannelCloseConfirm} message MsgChannelCloseConfirm + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgChannelCloseConfirm.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.port_id = ""; + object.channel_id = ""; + if (options.bytes === String) + object.proof_init = ""; + else { + object.proof_init = []; + if (options.bytes !== Array) + object.proof_init = $util.newBuffer(object.proof_init); + } + object.proof_height = null; + object.signer = ""; + } + if (message.port_id != null && message.hasOwnProperty("port_id")) + object.port_id = message.port_id; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + object.channel_id = message.channel_id; + if (message.proof_init != null && message.hasOwnProperty("proof_init")) + object.proof_init = options.bytes === String ? $util.base64.encode(message.proof_init, 0, message.proof_init.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_init) : message.proof_init; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) + object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); + if (message.signer != null && message.hasOwnProperty("signer")) + object.signer = message.signer; + return object; + }; + + /** + * Converts this MsgChannelCloseConfirm to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.MsgChannelCloseConfirm + * @instance + * @returns {Object.} JSON object + */ + MsgChannelCloseConfirm.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgChannelCloseConfirm; + })(); + + v1.MsgChannelCloseConfirmResponse = (function() { + + /** + * Properties of a MsgChannelCloseConfirmResponse. + * @memberof ibc.core.channel.v1 + * @interface IMsgChannelCloseConfirmResponse + */ + + /** + * Constructs a new MsgChannelCloseConfirmResponse. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a MsgChannelCloseConfirmResponse. + * @implements IMsgChannelCloseConfirmResponse + * @constructor + * @param {ibc.core.channel.v1.IMsgChannelCloseConfirmResponse=} [properties] Properties to set + */ + function MsgChannelCloseConfirmResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgChannelCloseConfirmResponse message. Does not implicitly {@link ibc.core.channel.v1.MsgChannelCloseConfirmResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.MsgChannelCloseConfirmResponse + * @static + * @param {ibc.core.channel.v1.IMsgChannelCloseConfirmResponse} message MsgChannelCloseConfirmResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgChannelCloseConfirmResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgChannelCloseConfirmResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgChannelCloseConfirmResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.MsgChannelCloseConfirmResponse + * @static + * @param {ibc.core.channel.v1.IMsgChannelCloseConfirmResponse} message MsgChannelCloseConfirmResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgChannelCloseConfirmResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgChannelCloseConfirmResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.MsgChannelCloseConfirmResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.MsgChannelCloseConfirmResponse} MsgChannelCloseConfirmResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgChannelCloseConfirmResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgChannelCloseConfirmResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgChannelCloseConfirmResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.MsgChannelCloseConfirmResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.MsgChannelCloseConfirmResponse} MsgChannelCloseConfirmResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgChannelCloseConfirmResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgChannelCloseConfirmResponse message. + * @function verify + * @memberof ibc.core.channel.v1.MsgChannelCloseConfirmResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgChannelCloseConfirmResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgChannelCloseConfirmResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.MsgChannelCloseConfirmResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.MsgChannelCloseConfirmResponse} MsgChannelCloseConfirmResponse + */ + MsgChannelCloseConfirmResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.MsgChannelCloseConfirmResponse) + return object; + return new $root.ibc.core.channel.v1.MsgChannelCloseConfirmResponse(); + }; + + /** + * Creates a plain object from a MsgChannelCloseConfirmResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.MsgChannelCloseConfirmResponse + * @static + * @param {ibc.core.channel.v1.MsgChannelCloseConfirmResponse} message MsgChannelCloseConfirmResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgChannelCloseConfirmResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgChannelCloseConfirmResponse to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.MsgChannelCloseConfirmResponse + * @instance + * @returns {Object.} JSON object + */ + MsgChannelCloseConfirmResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgChannelCloseConfirmResponse; + })(); + + v1.MsgRecvPacket = (function() { + + /** + * Properties of a MsgRecvPacket. + * @memberof ibc.core.channel.v1 + * @interface IMsgRecvPacket + * @property {ibc.core.channel.v1.IPacket|null} [packet] MsgRecvPacket packet + * @property {Uint8Array|null} [proof_commitment] MsgRecvPacket proof_commitment + * @property {ibc.core.client.v1.IHeight|null} [proof_height] MsgRecvPacket proof_height + * @property {string|null} [signer] MsgRecvPacket signer + */ + + /** + * Constructs a new MsgRecvPacket. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a MsgRecvPacket. + * @implements IMsgRecvPacket + * @constructor + * @param {ibc.core.channel.v1.IMsgRecvPacket=} [properties] Properties to set + */ + function MsgRecvPacket(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgRecvPacket packet. + * @member {ibc.core.channel.v1.IPacket|null|undefined} packet + * @memberof ibc.core.channel.v1.MsgRecvPacket + * @instance + */ + MsgRecvPacket.prototype.packet = null; + + /** + * MsgRecvPacket proof_commitment. + * @member {Uint8Array} proof_commitment + * @memberof ibc.core.channel.v1.MsgRecvPacket + * @instance + */ + MsgRecvPacket.prototype.proof_commitment = $util.newBuffer([]); + + /** + * MsgRecvPacket proof_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height + * @memberof ibc.core.channel.v1.MsgRecvPacket + * @instance + */ + MsgRecvPacket.prototype.proof_height = null; + + /** + * MsgRecvPacket signer. + * @member {string} signer + * @memberof ibc.core.channel.v1.MsgRecvPacket + * @instance + */ + MsgRecvPacket.prototype.signer = ""; + + /** + * Encodes the specified MsgRecvPacket message. Does not implicitly {@link ibc.core.channel.v1.MsgRecvPacket.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.MsgRecvPacket + * @static + * @param {ibc.core.channel.v1.IMsgRecvPacket} message MsgRecvPacket message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgRecvPacket.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.packet != null && Object.hasOwnProperty.call(message, "packet")) + $root.ibc.core.channel.v1.Packet.encode(message.packet, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.proof_commitment != null && Object.hasOwnProperty.call(message, "proof_commitment")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proof_commitment); + if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) + $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.signer); + return writer; + }; + + /** + * Encodes the specified MsgRecvPacket message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgRecvPacket.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.MsgRecvPacket + * @static + * @param {ibc.core.channel.v1.IMsgRecvPacket} message MsgRecvPacket message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgRecvPacket.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgRecvPacket message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.MsgRecvPacket + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.MsgRecvPacket} MsgRecvPacket + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgRecvPacket.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgRecvPacket(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.packet = $root.ibc.core.channel.v1.Packet.decode(reader, reader.uint32()); + break; + case 2: + message.proof_commitment = reader.bytes(); + break; + case 3: + message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + case 4: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgRecvPacket message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.MsgRecvPacket + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.MsgRecvPacket} MsgRecvPacket + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgRecvPacket.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgRecvPacket message. + * @function verify + * @memberof ibc.core.channel.v1.MsgRecvPacket + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgRecvPacket.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.packet != null && message.hasOwnProperty("packet")) { + let error = $root.ibc.core.channel.v1.Packet.verify(message.packet); + if (error) + return "packet." + error; + } + if (message.proof_commitment != null && message.hasOwnProperty("proof_commitment")) + if (!(message.proof_commitment && typeof message.proof_commitment.length === "number" || $util.isString(message.proof_commitment))) + return "proof_commitment: buffer expected"; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); + if (error) + return "proof_height." + error; + } + if (message.signer != null && message.hasOwnProperty("signer")) + if (!$util.isString(message.signer)) + return "signer: string expected"; + return null; + }; + + /** + * Creates a MsgRecvPacket message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.MsgRecvPacket + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.MsgRecvPacket} MsgRecvPacket + */ + MsgRecvPacket.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.MsgRecvPacket) + return object; + let message = new $root.ibc.core.channel.v1.MsgRecvPacket(); + if (object.packet != null) { + if (typeof object.packet !== "object") + throw TypeError(".ibc.core.channel.v1.MsgRecvPacket.packet: object expected"); + message.packet = $root.ibc.core.channel.v1.Packet.fromObject(object.packet); + } + if (object.proof_commitment != null) + if (typeof object.proof_commitment === "string") + $util.base64.decode(object.proof_commitment, message.proof_commitment = $util.newBuffer($util.base64.length(object.proof_commitment)), 0); + else if (object.proof_commitment.length) + message.proof_commitment = object.proof_commitment; + if (object.proof_height != null) { + if (typeof object.proof_height !== "object") + throw TypeError(".ibc.core.channel.v1.MsgRecvPacket.proof_height: object expected"); + message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); + } + if (object.signer != null) + message.signer = String(object.signer); + return message; + }; + + /** + * Creates a plain object from a MsgRecvPacket message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.MsgRecvPacket + * @static + * @param {ibc.core.channel.v1.MsgRecvPacket} message MsgRecvPacket + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgRecvPacket.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.packet = null; + if (options.bytes === String) + object.proof_commitment = ""; + else { + object.proof_commitment = []; + if (options.bytes !== Array) + object.proof_commitment = $util.newBuffer(object.proof_commitment); + } + object.proof_height = null; + object.signer = ""; + } + if (message.packet != null && message.hasOwnProperty("packet")) + object.packet = $root.ibc.core.channel.v1.Packet.toObject(message.packet, options); + if (message.proof_commitment != null && message.hasOwnProperty("proof_commitment")) + object.proof_commitment = options.bytes === String ? $util.base64.encode(message.proof_commitment, 0, message.proof_commitment.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_commitment) : message.proof_commitment; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) + object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); + if (message.signer != null && message.hasOwnProperty("signer")) + object.signer = message.signer; + return object; + }; + + /** + * Converts this MsgRecvPacket to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.MsgRecvPacket + * @instance + * @returns {Object.} JSON object + */ + MsgRecvPacket.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgRecvPacket; + })(); + + v1.MsgRecvPacketResponse = (function() { + + /** + * Properties of a MsgRecvPacketResponse. + * @memberof ibc.core.channel.v1 + * @interface IMsgRecvPacketResponse + */ + + /** + * Constructs a new MsgRecvPacketResponse. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a MsgRecvPacketResponse. + * @implements IMsgRecvPacketResponse + * @constructor + * @param {ibc.core.channel.v1.IMsgRecvPacketResponse=} [properties] Properties to set + */ + function MsgRecvPacketResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgRecvPacketResponse message. Does not implicitly {@link ibc.core.channel.v1.MsgRecvPacketResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.MsgRecvPacketResponse + * @static + * @param {ibc.core.channel.v1.IMsgRecvPacketResponse} message MsgRecvPacketResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgRecvPacketResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgRecvPacketResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgRecvPacketResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.MsgRecvPacketResponse + * @static + * @param {ibc.core.channel.v1.IMsgRecvPacketResponse} message MsgRecvPacketResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgRecvPacketResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgRecvPacketResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.MsgRecvPacketResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.MsgRecvPacketResponse} MsgRecvPacketResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgRecvPacketResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgRecvPacketResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgRecvPacketResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.MsgRecvPacketResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.MsgRecvPacketResponse} MsgRecvPacketResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgRecvPacketResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgRecvPacketResponse message. + * @function verify + * @memberof ibc.core.channel.v1.MsgRecvPacketResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgRecvPacketResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgRecvPacketResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.MsgRecvPacketResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.MsgRecvPacketResponse} MsgRecvPacketResponse + */ + MsgRecvPacketResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.MsgRecvPacketResponse) + return object; + return new $root.ibc.core.channel.v1.MsgRecvPacketResponse(); + }; + + /** + * Creates a plain object from a MsgRecvPacketResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.MsgRecvPacketResponse + * @static + * @param {ibc.core.channel.v1.MsgRecvPacketResponse} message MsgRecvPacketResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgRecvPacketResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgRecvPacketResponse to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.MsgRecvPacketResponse + * @instance + * @returns {Object.} JSON object + */ + MsgRecvPacketResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgRecvPacketResponse; + })(); + + v1.MsgTimeout = (function() { + + /** + * Properties of a MsgTimeout. + * @memberof ibc.core.channel.v1 + * @interface IMsgTimeout + * @property {ibc.core.channel.v1.IPacket|null} [packet] MsgTimeout packet + * @property {Uint8Array|null} [proof_unreceived] MsgTimeout proof_unreceived + * @property {ibc.core.client.v1.IHeight|null} [proof_height] MsgTimeout proof_height + * @property {Long|null} [next_sequence_recv] MsgTimeout next_sequence_recv + * @property {string|null} [signer] MsgTimeout signer + */ + + /** + * Constructs a new MsgTimeout. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a MsgTimeout. + * @implements IMsgTimeout + * @constructor + * @param {ibc.core.channel.v1.IMsgTimeout=} [properties] Properties to set + */ + function MsgTimeout(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgTimeout packet. + * @member {ibc.core.channel.v1.IPacket|null|undefined} packet + * @memberof ibc.core.channel.v1.MsgTimeout + * @instance + */ + MsgTimeout.prototype.packet = null; + + /** + * MsgTimeout proof_unreceived. + * @member {Uint8Array} proof_unreceived + * @memberof ibc.core.channel.v1.MsgTimeout + * @instance + */ + MsgTimeout.prototype.proof_unreceived = $util.newBuffer([]); + + /** + * MsgTimeout proof_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height + * @memberof ibc.core.channel.v1.MsgTimeout + * @instance + */ + MsgTimeout.prototype.proof_height = null; + + /** + * MsgTimeout next_sequence_recv. + * @member {Long} next_sequence_recv + * @memberof ibc.core.channel.v1.MsgTimeout + * @instance + */ + MsgTimeout.prototype.next_sequence_recv = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * MsgTimeout signer. + * @member {string} signer + * @memberof ibc.core.channel.v1.MsgTimeout + * @instance + */ + MsgTimeout.prototype.signer = ""; + + /** + * Encodes the specified MsgTimeout message. Does not implicitly {@link ibc.core.channel.v1.MsgTimeout.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.MsgTimeout + * @static + * @param {ibc.core.channel.v1.IMsgTimeout} message MsgTimeout message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgTimeout.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.packet != null && Object.hasOwnProperty.call(message, "packet")) + $root.ibc.core.channel.v1.Packet.encode(message.packet, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.proof_unreceived != null && Object.hasOwnProperty.call(message, "proof_unreceived")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proof_unreceived); + if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) + $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.next_sequence_recv != null && Object.hasOwnProperty.call(message, "next_sequence_recv")) + writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.next_sequence_recv); + if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.signer); + return writer; + }; + + /** + * Encodes the specified MsgTimeout message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgTimeout.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.MsgTimeout + * @static + * @param {ibc.core.channel.v1.IMsgTimeout} message MsgTimeout message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgTimeout.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgTimeout message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.MsgTimeout + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.MsgTimeout} MsgTimeout + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgTimeout.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgTimeout(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.packet = $root.ibc.core.channel.v1.Packet.decode(reader, reader.uint32()); + break; + case 2: + message.proof_unreceived = reader.bytes(); + break; + case 3: + message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + case 4: + message.next_sequence_recv = reader.uint64(); + break; + case 5: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgTimeout message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.MsgTimeout + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.MsgTimeout} MsgTimeout + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgTimeout.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgTimeout message. + * @function verify + * @memberof ibc.core.channel.v1.MsgTimeout + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgTimeout.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.packet != null && message.hasOwnProperty("packet")) { + let error = $root.ibc.core.channel.v1.Packet.verify(message.packet); + if (error) + return "packet." + error; + } + if (message.proof_unreceived != null && message.hasOwnProperty("proof_unreceived")) + if (!(message.proof_unreceived && typeof message.proof_unreceived.length === "number" || $util.isString(message.proof_unreceived))) + return "proof_unreceived: buffer expected"; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); + if (error) + return "proof_height." + error; + } + if (message.next_sequence_recv != null && message.hasOwnProperty("next_sequence_recv")) + if (!$util.isInteger(message.next_sequence_recv) && !(message.next_sequence_recv && $util.isInteger(message.next_sequence_recv.low) && $util.isInteger(message.next_sequence_recv.high))) + return "next_sequence_recv: integer|Long expected"; + if (message.signer != null && message.hasOwnProperty("signer")) + if (!$util.isString(message.signer)) + return "signer: string expected"; + return null; + }; + + /** + * Creates a MsgTimeout message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.MsgTimeout + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.MsgTimeout} MsgTimeout + */ + MsgTimeout.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.MsgTimeout) + return object; + let message = new $root.ibc.core.channel.v1.MsgTimeout(); + if (object.packet != null) { + if (typeof object.packet !== "object") + throw TypeError(".ibc.core.channel.v1.MsgTimeout.packet: object expected"); + message.packet = $root.ibc.core.channel.v1.Packet.fromObject(object.packet); + } + if (object.proof_unreceived != null) + if (typeof object.proof_unreceived === "string") + $util.base64.decode(object.proof_unreceived, message.proof_unreceived = $util.newBuffer($util.base64.length(object.proof_unreceived)), 0); + else if (object.proof_unreceived.length) + message.proof_unreceived = object.proof_unreceived; + if (object.proof_height != null) { + if (typeof object.proof_height !== "object") + throw TypeError(".ibc.core.channel.v1.MsgTimeout.proof_height: object expected"); + message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); + } + if (object.next_sequence_recv != null) + if ($util.Long) + (message.next_sequence_recv = $util.Long.fromValue(object.next_sequence_recv)).unsigned = true; + else if (typeof object.next_sequence_recv === "string") + message.next_sequence_recv = parseInt(object.next_sequence_recv, 10); + else if (typeof object.next_sequence_recv === "number") + message.next_sequence_recv = object.next_sequence_recv; + else if (typeof object.next_sequence_recv === "object") + message.next_sequence_recv = new $util.LongBits(object.next_sequence_recv.low >>> 0, object.next_sequence_recv.high >>> 0).toNumber(true); + if (object.signer != null) + message.signer = String(object.signer); + return message; + }; + + /** + * Creates a plain object from a MsgTimeout message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.MsgTimeout + * @static + * @param {ibc.core.channel.v1.MsgTimeout} message MsgTimeout + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgTimeout.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.packet = null; + if (options.bytes === String) + object.proof_unreceived = ""; + else { + object.proof_unreceived = []; + if (options.bytes !== Array) + object.proof_unreceived = $util.newBuffer(object.proof_unreceived); + } + object.proof_height = null; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.next_sequence_recv = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.next_sequence_recv = options.longs === String ? "0" : 0; + object.signer = ""; + } + if (message.packet != null && message.hasOwnProperty("packet")) + object.packet = $root.ibc.core.channel.v1.Packet.toObject(message.packet, options); + if (message.proof_unreceived != null && message.hasOwnProperty("proof_unreceived")) + object.proof_unreceived = options.bytes === String ? $util.base64.encode(message.proof_unreceived, 0, message.proof_unreceived.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_unreceived) : message.proof_unreceived; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) + object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); + if (message.next_sequence_recv != null && message.hasOwnProperty("next_sequence_recv")) + if (typeof message.next_sequence_recv === "number") + object.next_sequence_recv = options.longs === String ? String(message.next_sequence_recv) : message.next_sequence_recv; + else + object.next_sequence_recv = options.longs === String ? $util.Long.prototype.toString.call(message.next_sequence_recv) : options.longs === Number ? new $util.LongBits(message.next_sequence_recv.low >>> 0, message.next_sequence_recv.high >>> 0).toNumber(true) : message.next_sequence_recv; + if (message.signer != null && message.hasOwnProperty("signer")) + object.signer = message.signer; + return object; + }; + + /** + * Converts this MsgTimeout to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.MsgTimeout + * @instance + * @returns {Object.} JSON object + */ + MsgTimeout.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgTimeout; + })(); + + v1.MsgTimeoutResponse = (function() { + + /** + * Properties of a MsgTimeoutResponse. + * @memberof ibc.core.channel.v1 + * @interface IMsgTimeoutResponse + */ + + /** + * Constructs a new MsgTimeoutResponse. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a MsgTimeoutResponse. + * @implements IMsgTimeoutResponse + * @constructor + * @param {ibc.core.channel.v1.IMsgTimeoutResponse=} [properties] Properties to set + */ + function MsgTimeoutResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgTimeoutResponse message. Does not implicitly {@link ibc.core.channel.v1.MsgTimeoutResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.MsgTimeoutResponse + * @static + * @param {ibc.core.channel.v1.IMsgTimeoutResponse} message MsgTimeoutResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgTimeoutResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgTimeoutResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgTimeoutResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.MsgTimeoutResponse + * @static + * @param {ibc.core.channel.v1.IMsgTimeoutResponse} message MsgTimeoutResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgTimeoutResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgTimeoutResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.MsgTimeoutResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.MsgTimeoutResponse} MsgTimeoutResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgTimeoutResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgTimeoutResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgTimeoutResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.MsgTimeoutResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.MsgTimeoutResponse} MsgTimeoutResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgTimeoutResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgTimeoutResponse message. + * @function verify + * @memberof ibc.core.channel.v1.MsgTimeoutResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgTimeoutResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgTimeoutResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.MsgTimeoutResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.MsgTimeoutResponse} MsgTimeoutResponse + */ + MsgTimeoutResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.MsgTimeoutResponse) + return object; + return new $root.ibc.core.channel.v1.MsgTimeoutResponse(); + }; + + /** + * Creates a plain object from a MsgTimeoutResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.MsgTimeoutResponse + * @static + * @param {ibc.core.channel.v1.MsgTimeoutResponse} message MsgTimeoutResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgTimeoutResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgTimeoutResponse to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.MsgTimeoutResponse + * @instance + * @returns {Object.} JSON object + */ + MsgTimeoutResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgTimeoutResponse; + })(); + + v1.MsgTimeoutOnClose = (function() { + + /** + * Properties of a MsgTimeoutOnClose. + * @memberof ibc.core.channel.v1 + * @interface IMsgTimeoutOnClose + * @property {ibc.core.channel.v1.IPacket|null} [packet] MsgTimeoutOnClose packet + * @property {Uint8Array|null} [proof_unreceived] MsgTimeoutOnClose proof_unreceived + * @property {Uint8Array|null} [proof_close] MsgTimeoutOnClose proof_close + * @property {ibc.core.client.v1.IHeight|null} [proof_height] MsgTimeoutOnClose proof_height + * @property {Long|null} [next_sequence_recv] MsgTimeoutOnClose next_sequence_recv + * @property {string|null} [signer] MsgTimeoutOnClose signer + */ + + /** + * Constructs a new MsgTimeoutOnClose. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a MsgTimeoutOnClose. + * @implements IMsgTimeoutOnClose + * @constructor + * @param {ibc.core.channel.v1.IMsgTimeoutOnClose=} [properties] Properties to set + */ + function MsgTimeoutOnClose(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgTimeoutOnClose packet. + * @member {ibc.core.channel.v1.IPacket|null|undefined} packet + * @memberof ibc.core.channel.v1.MsgTimeoutOnClose + * @instance + */ + MsgTimeoutOnClose.prototype.packet = null; + + /** + * MsgTimeoutOnClose proof_unreceived. + * @member {Uint8Array} proof_unreceived + * @memberof ibc.core.channel.v1.MsgTimeoutOnClose + * @instance + */ + MsgTimeoutOnClose.prototype.proof_unreceived = $util.newBuffer([]); + + /** + * MsgTimeoutOnClose proof_close. + * @member {Uint8Array} proof_close + * @memberof ibc.core.channel.v1.MsgTimeoutOnClose + * @instance + */ + MsgTimeoutOnClose.prototype.proof_close = $util.newBuffer([]); + + /** + * MsgTimeoutOnClose proof_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height + * @memberof ibc.core.channel.v1.MsgTimeoutOnClose + * @instance + */ + MsgTimeoutOnClose.prototype.proof_height = null; + + /** + * MsgTimeoutOnClose next_sequence_recv. + * @member {Long} next_sequence_recv + * @memberof ibc.core.channel.v1.MsgTimeoutOnClose + * @instance + */ + MsgTimeoutOnClose.prototype.next_sequence_recv = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * MsgTimeoutOnClose signer. + * @member {string} signer + * @memberof ibc.core.channel.v1.MsgTimeoutOnClose + * @instance + */ + MsgTimeoutOnClose.prototype.signer = ""; + + /** + * Encodes the specified MsgTimeoutOnClose message. Does not implicitly {@link ibc.core.channel.v1.MsgTimeoutOnClose.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.MsgTimeoutOnClose + * @static + * @param {ibc.core.channel.v1.IMsgTimeoutOnClose} message MsgTimeoutOnClose message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgTimeoutOnClose.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.packet != null && Object.hasOwnProperty.call(message, "packet")) + $root.ibc.core.channel.v1.Packet.encode(message.packet, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.proof_unreceived != null && Object.hasOwnProperty.call(message, "proof_unreceived")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proof_unreceived); + if (message.proof_close != null && Object.hasOwnProperty.call(message, "proof_close")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.proof_close); + if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) + $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.next_sequence_recv != null && Object.hasOwnProperty.call(message, "next_sequence_recv")) + writer.uint32(/* id 5, wireType 0 =*/40).uint64(message.next_sequence_recv); + if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.signer); + return writer; + }; + + /** + * Encodes the specified MsgTimeoutOnClose message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgTimeoutOnClose.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.MsgTimeoutOnClose + * @static + * @param {ibc.core.channel.v1.IMsgTimeoutOnClose} message MsgTimeoutOnClose message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgTimeoutOnClose.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgTimeoutOnClose message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.MsgTimeoutOnClose + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.MsgTimeoutOnClose} MsgTimeoutOnClose + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgTimeoutOnClose.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgTimeoutOnClose(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.packet = $root.ibc.core.channel.v1.Packet.decode(reader, reader.uint32()); + break; + case 2: + message.proof_unreceived = reader.bytes(); + break; + case 3: + message.proof_close = reader.bytes(); + break; + case 4: + message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + case 5: + message.next_sequence_recv = reader.uint64(); + break; + case 6: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgTimeoutOnClose message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.MsgTimeoutOnClose + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.MsgTimeoutOnClose} MsgTimeoutOnClose + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgTimeoutOnClose.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgTimeoutOnClose message. + * @function verify + * @memberof ibc.core.channel.v1.MsgTimeoutOnClose + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgTimeoutOnClose.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.packet != null && message.hasOwnProperty("packet")) { + let error = $root.ibc.core.channel.v1.Packet.verify(message.packet); + if (error) + return "packet." + error; + } + if (message.proof_unreceived != null && message.hasOwnProperty("proof_unreceived")) + if (!(message.proof_unreceived && typeof message.proof_unreceived.length === "number" || $util.isString(message.proof_unreceived))) + return "proof_unreceived: buffer expected"; + if (message.proof_close != null && message.hasOwnProperty("proof_close")) + if (!(message.proof_close && typeof message.proof_close.length === "number" || $util.isString(message.proof_close))) + return "proof_close: buffer expected"; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); + if (error) + return "proof_height." + error; + } + if (message.next_sequence_recv != null && message.hasOwnProperty("next_sequence_recv")) + if (!$util.isInteger(message.next_sequence_recv) && !(message.next_sequence_recv && $util.isInteger(message.next_sequence_recv.low) && $util.isInteger(message.next_sequence_recv.high))) + return "next_sequence_recv: integer|Long expected"; + if (message.signer != null && message.hasOwnProperty("signer")) + if (!$util.isString(message.signer)) + return "signer: string expected"; + return null; + }; + + /** + * Creates a MsgTimeoutOnClose message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.MsgTimeoutOnClose + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.MsgTimeoutOnClose} MsgTimeoutOnClose + */ + MsgTimeoutOnClose.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.MsgTimeoutOnClose) + return object; + let message = new $root.ibc.core.channel.v1.MsgTimeoutOnClose(); + if (object.packet != null) { + if (typeof object.packet !== "object") + throw TypeError(".ibc.core.channel.v1.MsgTimeoutOnClose.packet: object expected"); + message.packet = $root.ibc.core.channel.v1.Packet.fromObject(object.packet); + } + if (object.proof_unreceived != null) + if (typeof object.proof_unreceived === "string") + $util.base64.decode(object.proof_unreceived, message.proof_unreceived = $util.newBuffer($util.base64.length(object.proof_unreceived)), 0); + else if (object.proof_unreceived.length) + message.proof_unreceived = object.proof_unreceived; + if (object.proof_close != null) + if (typeof object.proof_close === "string") + $util.base64.decode(object.proof_close, message.proof_close = $util.newBuffer($util.base64.length(object.proof_close)), 0); + else if (object.proof_close.length) + message.proof_close = object.proof_close; + if (object.proof_height != null) { + if (typeof object.proof_height !== "object") + throw TypeError(".ibc.core.channel.v1.MsgTimeoutOnClose.proof_height: object expected"); + message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); + } + if (object.next_sequence_recv != null) + if ($util.Long) + (message.next_sequence_recv = $util.Long.fromValue(object.next_sequence_recv)).unsigned = true; + else if (typeof object.next_sequence_recv === "string") + message.next_sequence_recv = parseInt(object.next_sequence_recv, 10); + else if (typeof object.next_sequence_recv === "number") + message.next_sequence_recv = object.next_sequence_recv; + else if (typeof object.next_sequence_recv === "object") + message.next_sequence_recv = new $util.LongBits(object.next_sequence_recv.low >>> 0, object.next_sequence_recv.high >>> 0).toNumber(true); + if (object.signer != null) + message.signer = String(object.signer); + return message; + }; + + /** + * Creates a plain object from a MsgTimeoutOnClose message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.MsgTimeoutOnClose + * @static + * @param {ibc.core.channel.v1.MsgTimeoutOnClose} message MsgTimeoutOnClose + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgTimeoutOnClose.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.packet = null; + if (options.bytes === String) + object.proof_unreceived = ""; + else { + object.proof_unreceived = []; + if (options.bytes !== Array) + object.proof_unreceived = $util.newBuffer(object.proof_unreceived); + } + if (options.bytes === String) + object.proof_close = ""; + else { + object.proof_close = []; + if (options.bytes !== Array) + object.proof_close = $util.newBuffer(object.proof_close); + } + object.proof_height = null; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.next_sequence_recv = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.next_sequence_recv = options.longs === String ? "0" : 0; + object.signer = ""; + } + if (message.packet != null && message.hasOwnProperty("packet")) + object.packet = $root.ibc.core.channel.v1.Packet.toObject(message.packet, options); + if (message.proof_unreceived != null && message.hasOwnProperty("proof_unreceived")) + object.proof_unreceived = options.bytes === String ? $util.base64.encode(message.proof_unreceived, 0, message.proof_unreceived.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_unreceived) : message.proof_unreceived; + if (message.proof_close != null && message.hasOwnProperty("proof_close")) + object.proof_close = options.bytes === String ? $util.base64.encode(message.proof_close, 0, message.proof_close.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_close) : message.proof_close; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) + object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); + if (message.next_sequence_recv != null && message.hasOwnProperty("next_sequence_recv")) + if (typeof message.next_sequence_recv === "number") + object.next_sequence_recv = options.longs === String ? String(message.next_sequence_recv) : message.next_sequence_recv; + else + object.next_sequence_recv = options.longs === String ? $util.Long.prototype.toString.call(message.next_sequence_recv) : options.longs === Number ? new $util.LongBits(message.next_sequence_recv.low >>> 0, message.next_sequence_recv.high >>> 0).toNumber(true) : message.next_sequence_recv; + if (message.signer != null && message.hasOwnProperty("signer")) + object.signer = message.signer; + return object; + }; + + /** + * Converts this MsgTimeoutOnClose to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.MsgTimeoutOnClose + * @instance + * @returns {Object.} JSON object + */ + MsgTimeoutOnClose.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgTimeoutOnClose; + })(); + + v1.MsgTimeoutOnCloseResponse = (function() { + + /** + * Properties of a MsgTimeoutOnCloseResponse. + * @memberof ibc.core.channel.v1 + * @interface IMsgTimeoutOnCloseResponse + */ + + /** + * Constructs a new MsgTimeoutOnCloseResponse. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a MsgTimeoutOnCloseResponse. + * @implements IMsgTimeoutOnCloseResponse + * @constructor + * @param {ibc.core.channel.v1.IMsgTimeoutOnCloseResponse=} [properties] Properties to set + */ + function MsgTimeoutOnCloseResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgTimeoutOnCloseResponse message. Does not implicitly {@link ibc.core.channel.v1.MsgTimeoutOnCloseResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.MsgTimeoutOnCloseResponse + * @static + * @param {ibc.core.channel.v1.IMsgTimeoutOnCloseResponse} message MsgTimeoutOnCloseResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgTimeoutOnCloseResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgTimeoutOnCloseResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgTimeoutOnCloseResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.MsgTimeoutOnCloseResponse + * @static + * @param {ibc.core.channel.v1.IMsgTimeoutOnCloseResponse} message MsgTimeoutOnCloseResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgTimeoutOnCloseResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgTimeoutOnCloseResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.MsgTimeoutOnCloseResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.MsgTimeoutOnCloseResponse} MsgTimeoutOnCloseResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgTimeoutOnCloseResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgTimeoutOnCloseResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgTimeoutOnCloseResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.MsgTimeoutOnCloseResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.MsgTimeoutOnCloseResponse} MsgTimeoutOnCloseResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgTimeoutOnCloseResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgTimeoutOnCloseResponse message. + * @function verify + * @memberof ibc.core.channel.v1.MsgTimeoutOnCloseResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgTimeoutOnCloseResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgTimeoutOnCloseResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.MsgTimeoutOnCloseResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.MsgTimeoutOnCloseResponse} MsgTimeoutOnCloseResponse + */ + MsgTimeoutOnCloseResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.MsgTimeoutOnCloseResponse) + return object; + return new $root.ibc.core.channel.v1.MsgTimeoutOnCloseResponse(); + }; + + /** + * Creates a plain object from a MsgTimeoutOnCloseResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.MsgTimeoutOnCloseResponse + * @static + * @param {ibc.core.channel.v1.MsgTimeoutOnCloseResponse} message MsgTimeoutOnCloseResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgTimeoutOnCloseResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgTimeoutOnCloseResponse to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.MsgTimeoutOnCloseResponse + * @instance + * @returns {Object.} JSON object + */ + MsgTimeoutOnCloseResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgTimeoutOnCloseResponse; + })(); + + v1.MsgAcknowledgement = (function() { + + /** + * Properties of a MsgAcknowledgement. + * @memberof ibc.core.channel.v1 + * @interface IMsgAcknowledgement + * @property {ibc.core.channel.v1.IPacket|null} [packet] MsgAcknowledgement packet + * @property {Uint8Array|null} [acknowledgement] MsgAcknowledgement acknowledgement + * @property {Uint8Array|null} [proof_acked] MsgAcknowledgement proof_acked + * @property {ibc.core.client.v1.IHeight|null} [proof_height] MsgAcknowledgement proof_height + * @property {string|null} [signer] MsgAcknowledgement signer + */ + + /** + * Constructs a new MsgAcknowledgement. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a MsgAcknowledgement. + * @implements IMsgAcknowledgement + * @constructor + * @param {ibc.core.channel.v1.IMsgAcknowledgement=} [properties] Properties to set + */ + function MsgAcknowledgement(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgAcknowledgement packet. + * @member {ibc.core.channel.v1.IPacket|null|undefined} packet + * @memberof ibc.core.channel.v1.MsgAcknowledgement + * @instance + */ + MsgAcknowledgement.prototype.packet = null; + + /** + * MsgAcknowledgement acknowledgement. + * @member {Uint8Array} acknowledgement + * @memberof ibc.core.channel.v1.MsgAcknowledgement + * @instance + */ + MsgAcknowledgement.prototype.acknowledgement = $util.newBuffer([]); + + /** + * MsgAcknowledgement proof_acked. + * @member {Uint8Array} proof_acked + * @memberof ibc.core.channel.v1.MsgAcknowledgement + * @instance + */ + MsgAcknowledgement.prototype.proof_acked = $util.newBuffer([]); + + /** + * MsgAcknowledgement proof_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height + * @memberof ibc.core.channel.v1.MsgAcknowledgement + * @instance + */ + MsgAcknowledgement.prototype.proof_height = null; + + /** + * MsgAcknowledgement signer. + * @member {string} signer + * @memberof ibc.core.channel.v1.MsgAcknowledgement + * @instance + */ + MsgAcknowledgement.prototype.signer = ""; + + /** + * Encodes the specified MsgAcknowledgement message. Does not implicitly {@link ibc.core.channel.v1.MsgAcknowledgement.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.MsgAcknowledgement + * @static + * @param {ibc.core.channel.v1.IMsgAcknowledgement} message MsgAcknowledgement message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgAcknowledgement.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.packet != null && Object.hasOwnProperty.call(message, "packet")) + $root.ibc.core.channel.v1.Packet.encode(message.packet, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.acknowledgement != null && Object.hasOwnProperty.call(message, "acknowledgement")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.acknowledgement); + if (message.proof_acked != null && Object.hasOwnProperty.call(message, "proof_acked")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.proof_acked); + if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) + $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.signer); + return writer; + }; + + /** + * Encodes the specified MsgAcknowledgement message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgAcknowledgement.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.MsgAcknowledgement + * @static + * @param {ibc.core.channel.v1.IMsgAcknowledgement} message MsgAcknowledgement message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgAcknowledgement.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgAcknowledgement message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.MsgAcknowledgement + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.MsgAcknowledgement} MsgAcknowledgement + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgAcknowledgement.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgAcknowledgement(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.packet = $root.ibc.core.channel.v1.Packet.decode(reader, reader.uint32()); + break; + case 2: + message.acknowledgement = reader.bytes(); + break; + case 3: + message.proof_acked = reader.bytes(); + break; + case 4: + message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + case 5: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgAcknowledgement message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.MsgAcknowledgement + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.MsgAcknowledgement} MsgAcknowledgement + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgAcknowledgement.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgAcknowledgement message. + * @function verify + * @memberof ibc.core.channel.v1.MsgAcknowledgement + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgAcknowledgement.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.packet != null && message.hasOwnProperty("packet")) { + let error = $root.ibc.core.channel.v1.Packet.verify(message.packet); + if (error) + return "packet." + error; + } + if (message.acknowledgement != null && message.hasOwnProperty("acknowledgement")) + if (!(message.acknowledgement && typeof message.acknowledgement.length === "number" || $util.isString(message.acknowledgement))) + return "acknowledgement: buffer expected"; + if (message.proof_acked != null && message.hasOwnProperty("proof_acked")) + if (!(message.proof_acked && typeof message.proof_acked.length === "number" || $util.isString(message.proof_acked))) + return "proof_acked: buffer expected"; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); + if (error) + return "proof_height." + error; + } + if (message.signer != null && message.hasOwnProperty("signer")) + if (!$util.isString(message.signer)) + return "signer: string expected"; + return null; + }; + + /** + * Creates a MsgAcknowledgement message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.MsgAcknowledgement + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.MsgAcknowledgement} MsgAcknowledgement + */ + MsgAcknowledgement.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.MsgAcknowledgement) + return object; + let message = new $root.ibc.core.channel.v1.MsgAcknowledgement(); + if (object.packet != null) { + if (typeof object.packet !== "object") + throw TypeError(".ibc.core.channel.v1.MsgAcknowledgement.packet: object expected"); + message.packet = $root.ibc.core.channel.v1.Packet.fromObject(object.packet); + } + if (object.acknowledgement != null) + if (typeof object.acknowledgement === "string") + $util.base64.decode(object.acknowledgement, message.acknowledgement = $util.newBuffer($util.base64.length(object.acknowledgement)), 0); + else if (object.acknowledgement.length) + message.acknowledgement = object.acknowledgement; + if (object.proof_acked != null) + if (typeof object.proof_acked === "string") + $util.base64.decode(object.proof_acked, message.proof_acked = $util.newBuffer($util.base64.length(object.proof_acked)), 0); + else if (object.proof_acked.length) + message.proof_acked = object.proof_acked; + if (object.proof_height != null) { + if (typeof object.proof_height !== "object") + throw TypeError(".ibc.core.channel.v1.MsgAcknowledgement.proof_height: object expected"); + message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); + } + if (object.signer != null) + message.signer = String(object.signer); + return message; + }; + + /** + * Creates a plain object from a MsgAcknowledgement message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.MsgAcknowledgement + * @static + * @param {ibc.core.channel.v1.MsgAcknowledgement} message MsgAcknowledgement + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgAcknowledgement.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.packet = null; + if (options.bytes === String) + object.acknowledgement = ""; + else { + object.acknowledgement = []; + if (options.bytes !== Array) + object.acknowledgement = $util.newBuffer(object.acknowledgement); + } + if (options.bytes === String) + object.proof_acked = ""; + else { + object.proof_acked = []; + if (options.bytes !== Array) + object.proof_acked = $util.newBuffer(object.proof_acked); + } + object.proof_height = null; + object.signer = ""; + } + if (message.packet != null && message.hasOwnProperty("packet")) + object.packet = $root.ibc.core.channel.v1.Packet.toObject(message.packet, options); + if (message.acknowledgement != null && message.hasOwnProperty("acknowledgement")) + object.acknowledgement = options.bytes === String ? $util.base64.encode(message.acknowledgement, 0, message.acknowledgement.length) : options.bytes === Array ? Array.prototype.slice.call(message.acknowledgement) : message.acknowledgement; + if (message.proof_acked != null && message.hasOwnProperty("proof_acked")) + object.proof_acked = options.bytes === String ? $util.base64.encode(message.proof_acked, 0, message.proof_acked.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_acked) : message.proof_acked; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) + object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); + if (message.signer != null && message.hasOwnProperty("signer")) + object.signer = message.signer; + return object; + }; + + /** + * Converts this MsgAcknowledgement to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.MsgAcknowledgement + * @instance + * @returns {Object.} JSON object + */ + MsgAcknowledgement.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgAcknowledgement; + })(); + + v1.MsgAcknowledgementResponse = (function() { + + /** + * Properties of a MsgAcknowledgementResponse. + * @memberof ibc.core.channel.v1 + * @interface IMsgAcknowledgementResponse + */ + + /** + * Constructs a new MsgAcknowledgementResponse. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a MsgAcknowledgementResponse. + * @implements IMsgAcknowledgementResponse + * @constructor + * @param {ibc.core.channel.v1.IMsgAcknowledgementResponse=} [properties] Properties to set + */ + function MsgAcknowledgementResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgAcknowledgementResponse message. Does not implicitly {@link ibc.core.channel.v1.MsgAcknowledgementResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.MsgAcknowledgementResponse + * @static + * @param {ibc.core.channel.v1.IMsgAcknowledgementResponse} message MsgAcknowledgementResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgAcknowledgementResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgAcknowledgementResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgAcknowledgementResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.MsgAcknowledgementResponse + * @static + * @param {ibc.core.channel.v1.IMsgAcknowledgementResponse} message MsgAcknowledgementResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgAcknowledgementResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgAcknowledgementResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.MsgAcknowledgementResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.MsgAcknowledgementResponse} MsgAcknowledgementResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgAcknowledgementResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgAcknowledgementResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgAcknowledgementResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.MsgAcknowledgementResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.MsgAcknowledgementResponse} MsgAcknowledgementResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgAcknowledgementResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgAcknowledgementResponse message. + * @function verify + * @memberof ibc.core.channel.v1.MsgAcknowledgementResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgAcknowledgementResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgAcknowledgementResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.MsgAcknowledgementResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.MsgAcknowledgementResponse} MsgAcknowledgementResponse + */ + MsgAcknowledgementResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.MsgAcknowledgementResponse) + return object; + return new $root.ibc.core.channel.v1.MsgAcknowledgementResponse(); + }; + + /** + * Creates a plain object from a MsgAcknowledgementResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.MsgAcknowledgementResponse + * @static + * @param {ibc.core.channel.v1.MsgAcknowledgementResponse} message MsgAcknowledgementResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgAcknowledgementResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgAcknowledgementResponse to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.MsgAcknowledgementResponse + * @instance + * @returns {Object.} JSON object + */ + MsgAcknowledgementResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgAcknowledgementResponse; + })(); + + v1.Query = (function() { + + /** + * Constructs a new Query service. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a Query + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Query(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Query.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Query; + + /** + * Callback as used by {@link ibc.core.channel.v1.Query#channel}. + * @memberof ibc.core.channel.v1.Query + * @typedef ChannelCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.channel.v1.QueryChannelResponse} [response] QueryChannelResponse + */ + + /** + * Calls Channel. + * @function channel + * @memberof ibc.core.channel.v1.Query + * @instance + * @param {ibc.core.channel.v1.IQueryChannelRequest} request QueryChannelRequest message or plain object + * @param {ibc.core.channel.v1.Query.ChannelCallback} callback Node-style callback called with the error, if any, and QueryChannelResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.channel = function channel(request, callback) { + return this.rpcCall(channel, $root.ibc.core.channel.v1.QueryChannelRequest, $root.ibc.core.channel.v1.QueryChannelResponse, request, callback); + }, "name", { value: "Channel" }); + + /** + * Calls Channel. + * @function channel + * @memberof ibc.core.channel.v1.Query + * @instance + * @param {ibc.core.channel.v1.IQueryChannelRequest} request QueryChannelRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.channel.v1.Query#channels}. + * @memberof ibc.core.channel.v1.Query + * @typedef ChannelsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.channel.v1.QueryChannelsResponse} [response] QueryChannelsResponse + */ + + /** + * Calls Channels. + * @function channels + * @memberof ibc.core.channel.v1.Query + * @instance + * @param {ibc.core.channel.v1.IQueryChannelsRequest} request QueryChannelsRequest message or plain object + * @param {ibc.core.channel.v1.Query.ChannelsCallback} callback Node-style callback called with the error, if any, and QueryChannelsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.channels = function channels(request, callback) { + return this.rpcCall(channels, $root.ibc.core.channel.v1.QueryChannelsRequest, $root.ibc.core.channel.v1.QueryChannelsResponse, request, callback); + }, "name", { value: "Channels" }); + + /** + * Calls Channels. + * @function channels + * @memberof ibc.core.channel.v1.Query + * @instance + * @param {ibc.core.channel.v1.IQueryChannelsRequest} request QueryChannelsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.channel.v1.Query#connectionChannels}. + * @memberof ibc.core.channel.v1.Query + * @typedef ConnectionChannelsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.channel.v1.QueryConnectionChannelsResponse} [response] QueryConnectionChannelsResponse + */ + + /** + * Calls ConnectionChannels. + * @function connectionChannels + * @memberof ibc.core.channel.v1.Query + * @instance + * @param {ibc.core.channel.v1.IQueryConnectionChannelsRequest} request QueryConnectionChannelsRequest message or plain object + * @param {ibc.core.channel.v1.Query.ConnectionChannelsCallback} callback Node-style callback called with the error, if any, and QueryConnectionChannelsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.connectionChannels = function connectionChannels(request, callback) { + return this.rpcCall(connectionChannels, $root.ibc.core.channel.v1.QueryConnectionChannelsRequest, $root.ibc.core.channel.v1.QueryConnectionChannelsResponse, request, callback); + }, "name", { value: "ConnectionChannels" }); + + /** + * Calls ConnectionChannels. + * @function connectionChannels + * @memberof ibc.core.channel.v1.Query + * @instance + * @param {ibc.core.channel.v1.IQueryConnectionChannelsRequest} request QueryConnectionChannelsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.channel.v1.Query#channelClientState}. + * @memberof ibc.core.channel.v1.Query + * @typedef ChannelClientStateCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.channel.v1.QueryChannelClientStateResponse} [response] QueryChannelClientStateResponse + */ + + /** + * Calls ChannelClientState. + * @function channelClientState + * @memberof ibc.core.channel.v1.Query + * @instance + * @param {ibc.core.channel.v1.IQueryChannelClientStateRequest} request QueryChannelClientStateRequest message or plain object + * @param {ibc.core.channel.v1.Query.ChannelClientStateCallback} callback Node-style callback called with the error, if any, and QueryChannelClientStateResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.channelClientState = function channelClientState(request, callback) { + return this.rpcCall(channelClientState, $root.ibc.core.channel.v1.QueryChannelClientStateRequest, $root.ibc.core.channel.v1.QueryChannelClientStateResponse, request, callback); + }, "name", { value: "ChannelClientState" }); + + /** + * Calls ChannelClientState. + * @function channelClientState + * @memberof ibc.core.channel.v1.Query + * @instance + * @param {ibc.core.channel.v1.IQueryChannelClientStateRequest} request QueryChannelClientStateRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.channel.v1.Query#channelConsensusState}. + * @memberof ibc.core.channel.v1.Query + * @typedef ChannelConsensusStateCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.channel.v1.QueryChannelConsensusStateResponse} [response] QueryChannelConsensusStateResponse + */ + + /** + * Calls ChannelConsensusState. + * @function channelConsensusState + * @memberof ibc.core.channel.v1.Query + * @instance + * @param {ibc.core.channel.v1.IQueryChannelConsensusStateRequest} request QueryChannelConsensusStateRequest message or plain object + * @param {ibc.core.channel.v1.Query.ChannelConsensusStateCallback} callback Node-style callback called with the error, if any, and QueryChannelConsensusStateResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.channelConsensusState = function channelConsensusState(request, callback) { + return this.rpcCall(channelConsensusState, $root.ibc.core.channel.v1.QueryChannelConsensusStateRequest, $root.ibc.core.channel.v1.QueryChannelConsensusStateResponse, request, callback); + }, "name", { value: "ChannelConsensusState" }); + + /** + * Calls ChannelConsensusState. + * @function channelConsensusState + * @memberof ibc.core.channel.v1.Query + * @instance + * @param {ibc.core.channel.v1.IQueryChannelConsensusStateRequest} request QueryChannelConsensusStateRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.channel.v1.Query#packetCommitment}. + * @memberof ibc.core.channel.v1.Query + * @typedef PacketCommitmentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.channel.v1.QueryPacketCommitmentResponse} [response] QueryPacketCommitmentResponse + */ + + /** + * Calls PacketCommitment. + * @function packetCommitment + * @memberof ibc.core.channel.v1.Query + * @instance + * @param {ibc.core.channel.v1.IQueryPacketCommitmentRequest} request QueryPacketCommitmentRequest message or plain object + * @param {ibc.core.channel.v1.Query.PacketCommitmentCallback} callback Node-style callback called with the error, if any, and QueryPacketCommitmentResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.packetCommitment = function packetCommitment(request, callback) { + return this.rpcCall(packetCommitment, $root.ibc.core.channel.v1.QueryPacketCommitmentRequest, $root.ibc.core.channel.v1.QueryPacketCommitmentResponse, request, callback); + }, "name", { value: "PacketCommitment" }); + + /** + * Calls PacketCommitment. + * @function packetCommitment + * @memberof ibc.core.channel.v1.Query + * @instance + * @param {ibc.core.channel.v1.IQueryPacketCommitmentRequest} request QueryPacketCommitmentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.channel.v1.Query#packetCommitments}. + * @memberof ibc.core.channel.v1.Query + * @typedef PacketCommitmentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.channel.v1.QueryPacketCommitmentsResponse} [response] QueryPacketCommitmentsResponse + */ + + /** + * Calls PacketCommitments. + * @function packetCommitments + * @memberof ibc.core.channel.v1.Query + * @instance + * @param {ibc.core.channel.v1.IQueryPacketCommitmentsRequest} request QueryPacketCommitmentsRequest message or plain object + * @param {ibc.core.channel.v1.Query.PacketCommitmentsCallback} callback Node-style callback called with the error, if any, and QueryPacketCommitmentsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.packetCommitments = function packetCommitments(request, callback) { + return this.rpcCall(packetCommitments, $root.ibc.core.channel.v1.QueryPacketCommitmentsRequest, $root.ibc.core.channel.v1.QueryPacketCommitmentsResponse, request, callback); + }, "name", { value: "PacketCommitments" }); + + /** + * Calls PacketCommitments. + * @function packetCommitments + * @memberof ibc.core.channel.v1.Query + * @instance + * @param {ibc.core.channel.v1.IQueryPacketCommitmentsRequest} request QueryPacketCommitmentsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.channel.v1.Query#packetReceipt}. + * @memberof ibc.core.channel.v1.Query + * @typedef PacketReceiptCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.channel.v1.QueryPacketReceiptResponse} [response] QueryPacketReceiptResponse + */ + + /** + * Calls PacketReceipt. + * @function packetReceipt + * @memberof ibc.core.channel.v1.Query + * @instance + * @param {ibc.core.channel.v1.IQueryPacketReceiptRequest} request QueryPacketReceiptRequest message or plain object + * @param {ibc.core.channel.v1.Query.PacketReceiptCallback} callback Node-style callback called with the error, if any, and QueryPacketReceiptResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.packetReceipt = function packetReceipt(request, callback) { + return this.rpcCall(packetReceipt, $root.ibc.core.channel.v1.QueryPacketReceiptRequest, $root.ibc.core.channel.v1.QueryPacketReceiptResponse, request, callback); + }, "name", { value: "PacketReceipt" }); + + /** + * Calls PacketReceipt. + * @function packetReceipt + * @memberof ibc.core.channel.v1.Query + * @instance + * @param {ibc.core.channel.v1.IQueryPacketReceiptRequest} request QueryPacketReceiptRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.channel.v1.Query#packetAcknowledgement}. + * @memberof ibc.core.channel.v1.Query + * @typedef PacketAcknowledgementCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.channel.v1.QueryPacketAcknowledgementResponse} [response] QueryPacketAcknowledgementResponse + */ + + /** + * Calls PacketAcknowledgement. + * @function packetAcknowledgement + * @memberof ibc.core.channel.v1.Query + * @instance + * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementRequest} request QueryPacketAcknowledgementRequest message or plain object + * @param {ibc.core.channel.v1.Query.PacketAcknowledgementCallback} callback Node-style callback called with the error, if any, and QueryPacketAcknowledgementResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.packetAcknowledgement = function packetAcknowledgement(request, callback) { + return this.rpcCall(packetAcknowledgement, $root.ibc.core.channel.v1.QueryPacketAcknowledgementRequest, $root.ibc.core.channel.v1.QueryPacketAcknowledgementResponse, request, callback); + }, "name", { value: "PacketAcknowledgement" }); + + /** + * Calls PacketAcknowledgement. + * @function packetAcknowledgement + * @memberof ibc.core.channel.v1.Query + * @instance + * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementRequest} request QueryPacketAcknowledgementRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.channel.v1.Query#packetAcknowledgements}. + * @memberof ibc.core.channel.v1.Query + * @typedef PacketAcknowledgementsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.channel.v1.QueryPacketAcknowledgementsResponse} [response] QueryPacketAcknowledgementsResponse + */ + + /** + * Calls PacketAcknowledgements. + * @function packetAcknowledgements + * @memberof ibc.core.channel.v1.Query + * @instance + * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementsRequest} request QueryPacketAcknowledgementsRequest message or plain object + * @param {ibc.core.channel.v1.Query.PacketAcknowledgementsCallback} callback Node-style callback called with the error, if any, and QueryPacketAcknowledgementsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.packetAcknowledgements = function packetAcknowledgements(request, callback) { + return this.rpcCall(packetAcknowledgements, $root.ibc.core.channel.v1.QueryPacketAcknowledgementsRequest, $root.ibc.core.channel.v1.QueryPacketAcknowledgementsResponse, request, callback); + }, "name", { value: "PacketAcknowledgements" }); + + /** + * Calls PacketAcknowledgements. + * @function packetAcknowledgements + * @memberof ibc.core.channel.v1.Query + * @instance + * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementsRequest} request QueryPacketAcknowledgementsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.channel.v1.Query#unreceivedPackets}. + * @memberof ibc.core.channel.v1.Query + * @typedef UnreceivedPacketsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.channel.v1.QueryUnreceivedPacketsResponse} [response] QueryUnreceivedPacketsResponse + */ + + /** + * Calls UnreceivedPackets. + * @function unreceivedPackets + * @memberof ibc.core.channel.v1.Query + * @instance + * @param {ibc.core.channel.v1.IQueryUnreceivedPacketsRequest} request QueryUnreceivedPacketsRequest message or plain object + * @param {ibc.core.channel.v1.Query.UnreceivedPacketsCallback} callback Node-style callback called with the error, if any, and QueryUnreceivedPacketsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.unreceivedPackets = function unreceivedPackets(request, callback) { + return this.rpcCall(unreceivedPackets, $root.ibc.core.channel.v1.QueryUnreceivedPacketsRequest, $root.ibc.core.channel.v1.QueryUnreceivedPacketsResponse, request, callback); + }, "name", { value: "UnreceivedPackets" }); + + /** + * Calls UnreceivedPackets. + * @function unreceivedPackets + * @memberof ibc.core.channel.v1.Query + * @instance + * @param {ibc.core.channel.v1.IQueryUnreceivedPacketsRequest} request QueryUnreceivedPacketsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.channel.v1.Query#unreceivedAcks}. + * @memberof ibc.core.channel.v1.Query + * @typedef UnreceivedAcksCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.channel.v1.QueryUnreceivedAcksResponse} [response] QueryUnreceivedAcksResponse + */ + + /** + * Calls UnreceivedAcks. + * @function unreceivedAcks + * @memberof ibc.core.channel.v1.Query + * @instance + * @param {ibc.core.channel.v1.IQueryUnreceivedAcksRequest} request QueryUnreceivedAcksRequest message or plain object + * @param {ibc.core.channel.v1.Query.UnreceivedAcksCallback} callback Node-style callback called with the error, if any, and QueryUnreceivedAcksResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.unreceivedAcks = function unreceivedAcks(request, callback) { + return this.rpcCall(unreceivedAcks, $root.ibc.core.channel.v1.QueryUnreceivedAcksRequest, $root.ibc.core.channel.v1.QueryUnreceivedAcksResponse, request, callback); + }, "name", { value: "UnreceivedAcks" }); + + /** + * Calls UnreceivedAcks. + * @function unreceivedAcks + * @memberof ibc.core.channel.v1.Query + * @instance + * @param {ibc.core.channel.v1.IQueryUnreceivedAcksRequest} request QueryUnreceivedAcksRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.channel.v1.Query#nextSequenceReceive}. + * @memberof ibc.core.channel.v1.Query + * @typedef NextSequenceReceiveCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.channel.v1.QueryNextSequenceReceiveResponse} [response] QueryNextSequenceReceiveResponse + */ + + /** + * Calls NextSequenceReceive. + * @function nextSequenceReceive + * @memberof ibc.core.channel.v1.Query + * @instance + * @param {ibc.core.channel.v1.IQueryNextSequenceReceiveRequest} request QueryNextSequenceReceiveRequest message or plain object + * @param {ibc.core.channel.v1.Query.NextSequenceReceiveCallback} callback Node-style callback called with the error, if any, and QueryNextSequenceReceiveResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.nextSequenceReceive = function nextSequenceReceive(request, callback) { + return this.rpcCall(nextSequenceReceive, $root.ibc.core.channel.v1.QueryNextSequenceReceiveRequest, $root.ibc.core.channel.v1.QueryNextSequenceReceiveResponse, request, callback); + }, "name", { value: "NextSequenceReceive" }); + + /** + * Calls NextSequenceReceive. + * @function nextSequenceReceive + * @memberof ibc.core.channel.v1.Query + * @instance + * @param {ibc.core.channel.v1.IQueryNextSequenceReceiveRequest} request QueryNextSequenceReceiveRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Query; + })(); + + v1.QueryChannelRequest = (function() { + + /** + * Properties of a QueryChannelRequest. + * @memberof ibc.core.channel.v1 + * @interface IQueryChannelRequest + * @property {string|null} [port_id] QueryChannelRequest port_id + * @property {string|null} [channel_id] QueryChannelRequest channel_id + */ + + /** + * Constructs a new QueryChannelRequest. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a QueryChannelRequest. + * @implements IQueryChannelRequest + * @constructor + * @param {ibc.core.channel.v1.IQueryChannelRequest=} [properties] Properties to set + */ + function QueryChannelRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryChannelRequest port_id. + * @member {string} port_id + * @memberof ibc.core.channel.v1.QueryChannelRequest + * @instance + */ + QueryChannelRequest.prototype.port_id = ""; + + /** + * QueryChannelRequest channel_id. + * @member {string} channel_id + * @memberof ibc.core.channel.v1.QueryChannelRequest + * @instance + */ + QueryChannelRequest.prototype.channel_id = ""; + + /** + * Encodes the specified QueryChannelRequest message. Does not implicitly {@link ibc.core.channel.v1.QueryChannelRequest.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.QueryChannelRequest + * @static + * @param {ibc.core.channel.v1.IQueryChannelRequest} message QueryChannelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryChannelRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); + if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); + return writer; + }; + + /** + * Encodes the specified QueryChannelRequest message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryChannelRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.QueryChannelRequest + * @static + * @param {ibc.core.channel.v1.IQueryChannelRequest} message QueryChannelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryChannelRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryChannelRequest message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.QueryChannelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.QueryChannelRequest} QueryChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryChannelRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryChannelRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.port_id = reader.string(); + break; + case 2: + message.channel_id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryChannelRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.QueryChannelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.QueryChannelRequest} QueryChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryChannelRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryChannelRequest message. + * @function verify + * @memberof ibc.core.channel.v1.QueryChannelRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryChannelRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.port_id != null && message.hasOwnProperty("port_id")) + if (!$util.isString(message.port_id)) + return "port_id: string expected"; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + if (!$util.isString(message.channel_id)) + return "channel_id: string expected"; + return null; + }; + + /** + * Creates a QueryChannelRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.QueryChannelRequest + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.QueryChannelRequest} QueryChannelRequest + */ + QueryChannelRequest.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.QueryChannelRequest) + return object; + let message = new $root.ibc.core.channel.v1.QueryChannelRequest(); + if (object.port_id != null) + message.port_id = String(object.port_id); + if (object.channel_id != null) + message.channel_id = String(object.channel_id); + return message; + }; + + /** + * Creates a plain object from a QueryChannelRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.QueryChannelRequest + * @static + * @param {ibc.core.channel.v1.QueryChannelRequest} message QueryChannelRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryChannelRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.port_id = ""; + object.channel_id = ""; + } + if (message.port_id != null && message.hasOwnProperty("port_id")) + object.port_id = message.port_id; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + object.channel_id = message.channel_id; + return object; + }; + + /** + * Converts this QueryChannelRequest to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.QueryChannelRequest + * @instance + * @returns {Object.} JSON object + */ + QueryChannelRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryChannelRequest; + })(); + + v1.QueryChannelResponse = (function() { + + /** + * Properties of a QueryChannelResponse. + * @memberof ibc.core.channel.v1 + * @interface IQueryChannelResponse + * @property {ibc.core.channel.v1.IChannel|null} [channel] QueryChannelResponse channel + * @property {Uint8Array|null} [proof] QueryChannelResponse proof + * @property {ibc.core.client.v1.IHeight|null} [proof_height] QueryChannelResponse proof_height + */ + + /** + * Constructs a new QueryChannelResponse. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a QueryChannelResponse. + * @implements IQueryChannelResponse + * @constructor + * @param {ibc.core.channel.v1.IQueryChannelResponse=} [properties] Properties to set + */ + function QueryChannelResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryChannelResponse channel. + * @member {ibc.core.channel.v1.IChannel|null|undefined} channel + * @memberof ibc.core.channel.v1.QueryChannelResponse + * @instance + */ + QueryChannelResponse.prototype.channel = null; + + /** + * QueryChannelResponse proof. + * @member {Uint8Array} proof + * @memberof ibc.core.channel.v1.QueryChannelResponse + * @instance + */ + QueryChannelResponse.prototype.proof = $util.newBuffer([]); + + /** + * QueryChannelResponse proof_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height + * @memberof ibc.core.channel.v1.QueryChannelResponse + * @instance + */ + QueryChannelResponse.prototype.proof_height = null; + + /** + * Encodes the specified QueryChannelResponse message. Does not implicitly {@link ibc.core.channel.v1.QueryChannelResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.QueryChannelResponse + * @static + * @param {ibc.core.channel.v1.IQueryChannelResponse} message QueryChannelResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryChannelResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.channel != null && Object.hasOwnProperty.call(message, "channel")) + $root.ibc.core.channel.v1.Channel.encode(message.channel, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proof); + if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) + $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryChannelResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryChannelResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.QueryChannelResponse + * @static + * @param {ibc.core.channel.v1.IQueryChannelResponse} message QueryChannelResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryChannelResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryChannelResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.QueryChannelResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.QueryChannelResponse} QueryChannelResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryChannelResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryChannelResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.channel = $root.ibc.core.channel.v1.Channel.decode(reader, reader.uint32()); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryChannelResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.QueryChannelResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.QueryChannelResponse} QueryChannelResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryChannelResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryChannelResponse message. + * @function verify + * @memberof ibc.core.channel.v1.QueryChannelResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryChannelResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.channel != null && message.hasOwnProperty("channel")) { + let error = $root.ibc.core.channel.v1.Channel.verify(message.channel); + if (error) + return "channel." + error; + } + if (message.proof != null && message.hasOwnProperty("proof")) + if (!(message.proof && typeof message.proof.length === "number" || $util.isString(message.proof))) + return "proof: buffer expected"; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); + if (error) + return "proof_height." + error; + } + return null; + }; + + /** + * Creates a QueryChannelResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.QueryChannelResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.QueryChannelResponse} QueryChannelResponse + */ + QueryChannelResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.QueryChannelResponse) + return object; + let message = new $root.ibc.core.channel.v1.QueryChannelResponse(); + if (object.channel != null) { + if (typeof object.channel !== "object") + throw TypeError(".ibc.core.channel.v1.QueryChannelResponse.channel: object expected"); + message.channel = $root.ibc.core.channel.v1.Channel.fromObject(object.channel); + } + if (object.proof != null) + if (typeof object.proof === "string") + $util.base64.decode(object.proof, message.proof = $util.newBuffer($util.base64.length(object.proof)), 0); + else if (object.proof.length) + message.proof = object.proof; + if (object.proof_height != null) { + if (typeof object.proof_height !== "object") + throw TypeError(".ibc.core.channel.v1.QueryChannelResponse.proof_height: object expected"); + message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); + } + return message; + }; + + /** + * Creates a plain object from a QueryChannelResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.QueryChannelResponse + * @static + * @param {ibc.core.channel.v1.QueryChannelResponse} message QueryChannelResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryChannelResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.channel = null; + if (options.bytes === String) + object.proof = ""; + else { + object.proof = []; + if (options.bytes !== Array) + object.proof = $util.newBuffer(object.proof); + } + object.proof_height = null; + } + if (message.channel != null && message.hasOwnProperty("channel")) + object.channel = $root.ibc.core.channel.v1.Channel.toObject(message.channel, options); + if (message.proof != null && message.hasOwnProperty("proof")) + object.proof = options.bytes === String ? $util.base64.encode(message.proof, 0, message.proof.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof) : message.proof; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) + object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); + return object; + }; + + /** + * Converts this QueryChannelResponse to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.QueryChannelResponse + * @instance + * @returns {Object.} JSON object + */ + QueryChannelResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryChannelResponse; + })(); + + v1.QueryChannelsRequest = (function() { + + /** + * Properties of a QueryChannelsRequest. + * @memberof ibc.core.channel.v1 + * @interface IQueryChannelsRequest + * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryChannelsRequest pagination + */ + + /** + * Constructs a new QueryChannelsRequest. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a QueryChannelsRequest. + * @implements IQueryChannelsRequest + * @constructor + * @param {ibc.core.channel.v1.IQueryChannelsRequest=} [properties] Properties to set + */ + function QueryChannelsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryChannelsRequest pagination. + * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination + * @memberof ibc.core.channel.v1.QueryChannelsRequest + * @instance + */ + QueryChannelsRequest.prototype.pagination = null; + + /** + * Encodes the specified QueryChannelsRequest message. Does not implicitly {@link ibc.core.channel.v1.QueryChannelsRequest.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.QueryChannelsRequest + * @static + * @param {ibc.core.channel.v1.IQueryChannelsRequest} message QueryChannelsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryChannelsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryChannelsRequest message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryChannelsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.QueryChannelsRequest + * @static + * @param {ibc.core.channel.v1.IQueryChannelsRequest} message QueryChannelsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryChannelsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryChannelsRequest message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.QueryChannelsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.QueryChannelsRequest} QueryChannelsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryChannelsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryChannelsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryChannelsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.QueryChannelsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.QueryChannelsRequest} QueryChannelsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryChannelsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryChannelsRequest message. + * @function verify + * @memberof ibc.core.channel.v1.QueryChannelsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryChannelsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryChannelsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.QueryChannelsRequest + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.QueryChannelsRequest} QueryChannelsRequest + */ + QueryChannelsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.QueryChannelsRequest) + return object; + let message = new $root.ibc.core.channel.v1.QueryChannelsRequest(); + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".ibc.core.channel.v1.QueryChannelsRequest.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryChannelsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.QueryChannelsRequest + * @static + * @param {ibc.core.channel.v1.QueryChannelsRequest} message QueryChannelsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryChannelsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.pagination = null; + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryChannelsRequest to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.QueryChannelsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryChannelsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryChannelsRequest; + })(); + + v1.QueryChannelsResponse = (function() { + + /** + * Properties of a QueryChannelsResponse. + * @memberof ibc.core.channel.v1 + * @interface IQueryChannelsResponse + * @property {Array.|null} [channels] QueryChannelsResponse channels + * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryChannelsResponse pagination + * @property {ibc.core.client.v1.IHeight|null} [height] QueryChannelsResponse height + */ + + /** + * Constructs a new QueryChannelsResponse. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a QueryChannelsResponse. + * @implements IQueryChannelsResponse + * @constructor + * @param {ibc.core.channel.v1.IQueryChannelsResponse=} [properties] Properties to set + */ + function QueryChannelsResponse(properties) { + this.channels = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryChannelsResponse channels. + * @member {Array.} channels + * @memberof ibc.core.channel.v1.QueryChannelsResponse + * @instance + */ + QueryChannelsResponse.prototype.channels = $util.emptyArray; + + /** + * QueryChannelsResponse pagination. + * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination + * @memberof ibc.core.channel.v1.QueryChannelsResponse + * @instance + */ + QueryChannelsResponse.prototype.pagination = null; + + /** + * QueryChannelsResponse height. + * @member {ibc.core.client.v1.IHeight|null|undefined} height + * @memberof ibc.core.channel.v1.QueryChannelsResponse + * @instance + */ + QueryChannelsResponse.prototype.height = null; + + /** + * Encodes the specified QueryChannelsResponse message. Does not implicitly {@link ibc.core.channel.v1.QueryChannelsResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.QueryChannelsResponse + * @static + * @param {ibc.core.channel.v1.IQueryChannelsResponse} message QueryChannelsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryChannelsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.channels != null && message.channels.length) + for (let i = 0; i < message.channels.length; ++i) + $root.ibc.core.channel.v1.IdentifiedChannel.encode(message.channels[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + $root.ibc.core.client.v1.Height.encode(message.height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryChannelsResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryChannelsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.QueryChannelsResponse + * @static + * @param {ibc.core.channel.v1.IQueryChannelsResponse} message QueryChannelsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryChannelsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryChannelsResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.QueryChannelsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.QueryChannelsResponse} QueryChannelsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryChannelsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryChannelsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.channels && message.channels.length)) + message.channels = []; + message.channels.push($root.ibc.core.channel.v1.IdentifiedChannel.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); + break; + case 3: + message.height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryChannelsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.QueryChannelsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.QueryChannelsResponse} QueryChannelsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryChannelsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryChannelsResponse message. + * @function verify + * @memberof ibc.core.channel.v1.QueryChannelsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryChannelsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.channels != null && message.hasOwnProperty("channels")) { + if (!Array.isArray(message.channels)) + return "channels: array expected"; + for (let i = 0; i < message.channels.length; ++i) { + let error = $root.ibc.core.channel.v1.IdentifiedChannel.verify(message.channels[i]); + if (error) + return "channels." + error; + } + } + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); + if (error) + return "pagination." + error; + } + if (message.height != null && message.hasOwnProperty("height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.height); + if (error) + return "height." + error; + } + return null; + }; + + /** + * Creates a QueryChannelsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.QueryChannelsResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.QueryChannelsResponse} QueryChannelsResponse + */ + QueryChannelsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.QueryChannelsResponse) + return object; + let message = new $root.ibc.core.channel.v1.QueryChannelsResponse(); + if (object.channels) { + if (!Array.isArray(object.channels)) + throw TypeError(".ibc.core.channel.v1.QueryChannelsResponse.channels: array expected"); + message.channels = []; + for (let i = 0; i < object.channels.length; ++i) { + if (typeof object.channels[i] !== "object") + throw TypeError(".ibc.core.channel.v1.QueryChannelsResponse.channels: object expected"); + message.channels[i] = $root.ibc.core.channel.v1.IdentifiedChannel.fromObject(object.channels[i]); + } + } + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".ibc.core.channel.v1.QueryChannelsResponse.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); + } + if (object.height != null) { + if (typeof object.height !== "object") + throw TypeError(".ibc.core.channel.v1.QueryChannelsResponse.height: object expected"); + message.height = $root.ibc.core.client.v1.Height.fromObject(object.height); + } + return message; + }; + + /** + * Creates a plain object from a QueryChannelsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.QueryChannelsResponse + * @static + * @param {ibc.core.channel.v1.QueryChannelsResponse} message QueryChannelsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryChannelsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.channels = []; + if (options.defaults) { + object.pagination = null; + object.height = null; + } + if (message.channels && message.channels.length) { + object.channels = []; + for (let j = 0; j < message.channels.length; ++j) + object.channels[j] = $root.ibc.core.channel.v1.IdentifiedChannel.toObject(message.channels[j], options); + } + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); + if (message.height != null && message.hasOwnProperty("height")) + object.height = $root.ibc.core.client.v1.Height.toObject(message.height, options); + return object; + }; + + /** + * Converts this QueryChannelsResponse to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.QueryChannelsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryChannelsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryChannelsResponse; + })(); + + v1.QueryConnectionChannelsRequest = (function() { + + /** + * Properties of a QueryConnectionChannelsRequest. + * @memberof ibc.core.channel.v1 + * @interface IQueryConnectionChannelsRequest + * @property {string|null} [connection] QueryConnectionChannelsRequest connection + * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryConnectionChannelsRequest pagination + */ + + /** + * Constructs a new QueryConnectionChannelsRequest. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a QueryConnectionChannelsRequest. + * @implements IQueryConnectionChannelsRequest + * @constructor + * @param {ibc.core.channel.v1.IQueryConnectionChannelsRequest=} [properties] Properties to set + */ + function QueryConnectionChannelsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryConnectionChannelsRequest connection. + * @member {string} connection + * @memberof ibc.core.channel.v1.QueryConnectionChannelsRequest + * @instance + */ + QueryConnectionChannelsRequest.prototype.connection = ""; + + /** + * QueryConnectionChannelsRequest pagination. + * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination + * @memberof ibc.core.channel.v1.QueryConnectionChannelsRequest + * @instance + */ + QueryConnectionChannelsRequest.prototype.pagination = null; + + /** + * Encodes the specified QueryConnectionChannelsRequest message. Does not implicitly {@link ibc.core.channel.v1.QueryConnectionChannelsRequest.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.QueryConnectionChannelsRequest + * @static + * @param {ibc.core.channel.v1.IQueryConnectionChannelsRequest} message QueryConnectionChannelsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryConnectionChannelsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.connection != null && Object.hasOwnProperty.call(message, "connection")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.connection); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryConnectionChannelsRequest message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryConnectionChannelsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.QueryConnectionChannelsRequest + * @static + * @param {ibc.core.channel.v1.IQueryConnectionChannelsRequest} message QueryConnectionChannelsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryConnectionChannelsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryConnectionChannelsRequest message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.QueryConnectionChannelsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.QueryConnectionChannelsRequest} QueryConnectionChannelsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryConnectionChannelsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryConnectionChannelsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connection = reader.string(); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryConnectionChannelsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.QueryConnectionChannelsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.QueryConnectionChannelsRequest} QueryConnectionChannelsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryConnectionChannelsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryConnectionChannelsRequest message. + * @function verify + * @memberof ibc.core.channel.v1.QueryConnectionChannelsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryConnectionChannelsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.connection != null && message.hasOwnProperty("connection")) + if (!$util.isString(message.connection)) + return "connection: string expected"; + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryConnectionChannelsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.QueryConnectionChannelsRequest + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.QueryConnectionChannelsRequest} QueryConnectionChannelsRequest + */ + QueryConnectionChannelsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.QueryConnectionChannelsRequest) + return object; + let message = new $root.ibc.core.channel.v1.QueryConnectionChannelsRequest(); + if (object.connection != null) + message.connection = String(object.connection); + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".ibc.core.channel.v1.QueryConnectionChannelsRequest.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryConnectionChannelsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.QueryConnectionChannelsRequest + * @static + * @param {ibc.core.channel.v1.QueryConnectionChannelsRequest} message QueryConnectionChannelsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryConnectionChannelsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.connection = ""; + object.pagination = null; + } + if (message.connection != null && message.hasOwnProperty("connection")) + object.connection = message.connection; + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryConnectionChannelsRequest to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.QueryConnectionChannelsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryConnectionChannelsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryConnectionChannelsRequest; + })(); + + v1.QueryConnectionChannelsResponse = (function() { + + /** + * Properties of a QueryConnectionChannelsResponse. + * @memberof ibc.core.channel.v1 + * @interface IQueryConnectionChannelsResponse + * @property {Array.|null} [channels] QueryConnectionChannelsResponse channels + * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryConnectionChannelsResponse pagination + * @property {ibc.core.client.v1.IHeight|null} [height] QueryConnectionChannelsResponse height + */ + + /** + * Constructs a new QueryConnectionChannelsResponse. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a QueryConnectionChannelsResponse. + * @implements IQueryConnectionChannelsResponse + * @constructor + * @param {ibc.core.channel.v1.IQueryConnectionChannelsResponse=} [properties] Properties to set + */ + function QueryConnectionChannelsResponse(properties) { + this.channels = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryConnectionChannelsResponse channels. + * @member {Array.} channels + * @memberof ibc.core.channel.v1.QueryConnectionChannelsResponse + * @instance + */ + QueryConnectionChannelsResponse.prototype.channels = $util.emptyArray; + + /** + * QueryConnectionChannelsResponse pagination. + * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination + * @memberof ibc.core.channel.v1.QueryConnectionChannelsResponse + * @instance + */ + QueryConnectionChannelsResponse.prototype.pagination = null; + + /** + * QueryConnectionChannelsResponse height. + * @member {ibc.core.client.v1.IHeight|null|undefined} height + * @memberof ibc.core.channel.v1.QueryConnectionChannelsResponse + * @instance + */ + QueryConnectionChannelsResponse.prototype.height = null; + + /** + * Encodes the specified QueryConnectionChannelsResponse message. Does not implicitly {@link ibc.core.channel.v1.QueryConnectionChannelsResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.QueryConnectionChannelsResponse + * @static + * @param {ibc.core.channel.v1.IQueryConnectionChannelsResponse} message QueryConnectionChannelsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryConnectionChannelsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.channels != null && message.channels.length) + for (let i = 0; i < message.channels.length; ++i) + $root.ibc.core.channel.v1.IdentifiedChannel.encode(message.channels[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + $root.ibc.core.client.v1.Height.encode(message.height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryConnectionChannelsResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryConnectionChannelsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.QueryConnectionChannelsResponse + * @static + * @param {ibc.core.channel.v1.IQueryConnectionChannelsResponse} message QueryConnectionChannelsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryConnectionChannelsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryConnectionChannelsResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.QueryConnectionChannelsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.QueryConnectionChannelsResponse} QueryConnectionChannelsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryConnectionChannelsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryConnectionChannelsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.channels && message.channels.length)) + message.channels = []; + message.channels.push($root.ibc.core.channel.v1.IdentifiedChannel.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); + break; + case 3: + message.height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryConnectionChannelsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.QueryConnectionChannelsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.QueryConnectionChannelsResponse} QueryConnectionChannelsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryConnectionChannelsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryConnectionChannelsResponse message. + * @function verify + * @memberof ibc.core.channel.v1.QueryConnectionChannelsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryConnectionChannelsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.channels != null && message.hasOwnProperty("channels")) { + if (!Array.isArray(message.channels)) + return "channels: array expected"; + for (let i = 0; i < message.channels.length; ++i) { + let error = $root.ibc.core.channel.v1.IdentifiedChannel.verify(message.channels[i]); + if (error) + return "channels." + error; + } + } + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); + if (error) + return "pagination." + error; + } + if (message.height != null && message.hasOwnProperty("height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.height); + if (error) + return "height." + error; + } + return null; + }; + + /** + * Creates a QueryConnectionChannelsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.QueryConnectionChannelsResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.QueryConnectionChannelsResponse} QueryConnectionChannelsResponse + */ + QueryConnectionChannelsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.QueryConnectionChannelsResponse) + return object; + let message = new $root.ibc.core.channel.v1.QueryConnectionChannelsResponse(); + if (object.channels) { + if (!Array.isArray(object.channels)) + throw TypeError(".ibc.core.channel.v1.QueryConnectionChannelsResponse.channels: array expected"); + message.channels = []; + for (let i = 0; i < object.channels.length; ++i) { + if (typeof object.channels[i] !== "object") + throw TypeError(".ibc.core.channel.v1.QueryConnectionChannelsResponse.channels: object expected"); + message.channels[i] = $root.ibc.core.channel.v1.IdentifiedChannel.fromObject(object.channels[i]); + } + } + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".ibc.core.channel.v1.QueryConnectionChannelsResponse.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); + } + if (object.height != null) { + if (typeof object.height !== "object") + throw TypeError(".ibc.core.channel.v1.QueryConnectionChannelsResponse.height: object expected"); + message.height = $root.ibc.core.client.v1.Height.fromObject(object.height); + } + return message; + }; + + /** + * Creates a plain object from a QueryConnectionChannelsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.QueryConnectionChannelsResponse + * @static + * @param {ibc.core.channel.v1.QueryConnectionChannelsResponse} message QueryConnectionChannelsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryConnectionChannelsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.channels = []; + if (options.defaults) { + object.pagination = null; + object.height = null; + } + if (message.channels && message.channels.length) { + object.channels = []; + for (let j = 0; j < message.channels.length; ++j) + object.channels[j] = $root.ibc.core.channel.v1.IdentifiedChannel.toObject(message.channels[j], options); + } + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); + if (message.height != null && message.hasOwnProperty("height")) + object.height = $root.ibc.core.client.v1.Height.toObject(message.height, options); + return object; + }; + + /** + * Converts this QueryConnectionChannelsResponse to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.QueryConnectionChannelsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryConnectionChannelsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryConnectionChannelsResponse; + })(); + + v1.QueryChannelClientStateRequest = (function() { + + /** + * Properties of a QueryChannelClientStateRequest. + * @memberof ibc.core.channel.v1 + * @interface IQueryChannelClientStateRequest + * @property {string|null} [port_id] QueryChannelClientStateRequest port_id + * @property {string|null} [channel_id] QueryChannelClientStateRequest channel_id + */ + + /** + * Constructs a new QueryChannelClientStateRequest. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a QueryChannelClientStateRequest. + * @implements IQueryChannelClientStateRequest + * @constructor + * @param {ibc.core.channel.v1.IQueryChannelClientStateRequest=} [properties] Properties to set + */ + function QueryChannelClientStateRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryChannelClientStateRequest port_id. + * @member {string} port_id + * @memberof ibc.core.channel.v1.QueryChannelClientStateRequest + * @instance + */ + QueryChannelClientStateRequest.prototype.port_id = ""; + + /** + * QueryChannelClientStateRequest channel_id. + * @member {string} channel_id + * @memberof ibc.core.channel.v1.QueryChannelClientStateRequest + * @instance + */ + QueryChannelClientStateRequest.prototype.channel_id = ""; + + /** + * Encodes the specified QueryChannelClientStateRequest message. Does not implicitly {@link ibc.core.channel.v1.QueryChannelClientStateRequest.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.QueryChannelClientStateRequest + * @static + * @param {ibc.core.channel.v1.IQueryChannelClientStateRequest} message QueryChannelClientStateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryChannelClientStateRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); + if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); + return writer; + }; + + /** + * Encodes the specified QueryChannelClientStateRequest message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryChannelClientStateRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.QueryChannelClientStateRequest + * @static + * @param {ibc.core.channel.v1.IQueryChannelClientStateRequest} message QueryChannelClientStateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryChannelClientStateRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryChannelClientStateRequest message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.QueryChannelClientStateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.QueryChannelClientStateRequest} QueryChannelClientStateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryChannelClientStateRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryChannelClientStateRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.port_id = reader.string(); + break; + case 2: + message.channel_id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryChannelClientStateRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.QueryChannelClientStateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.QueryChannelClientStateRequest} QueryChannelClientStateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryChannelClientStateRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryChannelClientStateRequest message. + * @function verify + * @memberof ibc.core.channel.v1.QueryChannelClientStateRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryChannelClientStateRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.port_id != null && message.hasOwnProperty("port_id")) + if (!$util.isString(message.port_id)) + return "port_id: string expected"; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + if (!$util.isString(message.channel_id)) + return "channel_id: string expected"; + return null; + }; + + /** + * Creates a QueryChannelClientStateRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.QueryChannelClientStateRequest + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.QueryChannelClientStateRequest} QueryChannelClientStateRequest + */ + QueryChannelClientStateRequest.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.QueryChannelClientStateRequest) + return object; + let message = new $root.ibc.core.channel.v1.QueryChannelClientStateRequest(); + if (object.port_id != null) + message.port_id = String(object.port_id); + if (object.channel_id != null) + message.channel_id = String(object.channel_id); + return message; + }; + + /** + * Creates a plain object from a QueryChannelClientStateRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.QueryChannelClientStateRequest + * @static + * @param {ibc.core.channel.v1.QueryChannelClientStateRequest} message QueryChannelClientStateRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryChannelClientStateRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.port_id = ""; + object.channel_id = ""; + } + if (message.port_id != null && message.hasOwnProperty("port_id")) + object.port_id = message.port_id; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + object.channel_id = message.channel_id; + return object; + }; + + /** + * Converts this QueryChannelClientStateRequest to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.QueryChannelClientStateRequest + * @instance + * @returns {Object.} JSON object + */ + QueryChannelClientStateRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryChannelClientStateRequest; + })(); + + v1.QueryChannelClientStateResponse = (function() { + + /** + * Properties of a QueryChannelClientStateResponse. + * @memberof ibc.core.channel.v1 + * @interface IQueryChannelClientStateResponse + * @property {ibc.core.client.v1.IIdentifiedClientState|null} [identified_client_state] QueryChannelClientStateResponse identified_client_state + * @property {Uint8Array|null} [proof] QueryChannelClientStateResponse proof + * @property {ibc.core.client.v1.IHeight|null} [proof_height] QueryChannelClientStateResponse proof_height + */ + + /** + * Constructs a new QueryChannelClientStateResponse. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a QueryChannelClientStateResponse. + * @implements IQueryChannelClientStateResponse + * @constructor + * @param {ibc.core.channel.v1.IQueryChannelClientStateResponse=} [properties] Properties to set + */ + function QueryChannelClientStateResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryChannelClientStateResponse identified_client_state. + * @member {ibc.core.client.v1.IIdentifiedClientState|null|undefined} identified_client_state + * @memberof ibc.core.channel.v1.QueryChannelClientStateResponse + * @instance + */ + QueryChannelClientStateResponse.prototype.identified_client_state = null; + + /** + * QueryChannelClientStateResponse proof. + * @member {Uint8Array} proof + * @memberof ibc.core.channel.v1.QueryChannelClientStateResponse + * @instance + */ + QueryChannelClientStateResponse.prototype.proof = $util.newBuffer([]); + + /** + * QueryChannelClientStateResponse proof_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height + * @memberof ibc.core.channel.v1.QueryChannelClientStateResponse + * @instance + */ + QueryChannelClientStateResponse.prototype.proof_height = null; + + /** + * Encodes the specified QueryChannelClientStateResponse message. Does not implicitly {@link ibc.core.channel.v1.QueryChannelClientStateResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.QueryChannelClientStateResponse + * @static + * @param {ibc.core.channel.v1.IQueryChannelClientStateResponse} message QueryChannelClientStateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryChannelClientStateResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.identified_client_state != null && Object.hasOwnProperty.call(message, "identified_client_state")) + $root.ibc.core.client.v1.IdentifiedClientState.encode(message.identified_client_state, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proof); + if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) + $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryChannelClientStateResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryChannelClientStateResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.QueryChannelClientStateResponse + * @static + * @param {ibc.core.channel.v1.IQueryChannelClientStateResponse} message QueryChannelClientStateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryChannelClientStateResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryChannelClientStateResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.QueryChannelClientStateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.QueryChannelClientStateResponse} QueryChannelClientStateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryChannelClientStateResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryChannelClientStateResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.identified_client_state = $root.ibc.core.client.v1.IdentifiedClientState.decode(reader, reader.uint32()); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryChannelClientStateResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.QueryChannelClientStateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.QueryChannelClientStateResponse} QueryChannelClientStateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryChannelClientStateResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryChannelClientStateResponse message. + * @function verify + * @memberof ibc.core.channel.v1.QueryChannelClientStateResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryChannelClientStateResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.identified_client_state != null && message.hasOwnProperty("identified_client_state")) { + let error = $root.ibc.core.client.v1.IdentifiedClientState.verify(message.identified_client_state); + if (error) + return "identified_client_state." + error; + } + if (message.proof != null && message.hasOwnProperty("proof")) + if (!(message.proof && typeof message.proof.length === "number" || $util.isString(message.proof))) + return "proof: buffer expected"; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); + if (error) + return "proof_height." + error; + } + return null; + }; + + /** + * Creates a QueryChannelClientStateResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.QueryChannelClientStateResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.QueryChannelClientStateResponse} QueryChannelClientStateResponse + */ + QueryChannelClientStateResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.QueryChannelClientStateResponse) + return object; + let message = new $root.ibc.core.channel.v1.QueryChannelClientStateResponse(); + if (object.identified_client_state != null) { + if (typeof object.identified_client_state !== "object") + throw TypeError(".ibc.core.channel.v1.QueryChannelClientStateResponse.identified_client_state: object expected"); + message.identified_client_state = $root.ibc.core.client.v1.IdentifiedClientState.fromObject(object.identified_client_state); + } + if (object.proof != null) + if (typeof object.proof === "string") + $util.base64.decode(object.proof, message.proof = $util.newBuffer($util.base64.length(object.proof)), 0); + else if (object.proof.length) + message.proof = object.proof; + if (object.proof_height != null) { + if (typeof object.proof_height !== "object") + throw TypeError(".ibc.core.channel.v1.QueryChannelClientStateResponse.proof_height: object expected"); + message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); + } + return message; + }; + + /** + * Creates a plain object from a QueryChannelClientStateResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.QueryChannelClientStateResponse + * @static + * @param {ibc.core.channel.v1.QueryChannelClientStateResponse} message QueryChannelClientStateResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryChannelClientStateResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.identified_client_state = null; + if (options.bytes === String) + object.proof = ""; + else { + object.proof = []; + if (options.bytes !== Array) + object.proof = $util.newBuffer(object.proof); + } + object.proof_height = null; + } + if (message.identified_client_state != null && message.hasOwnProperty("identified_client_state")) + object.identified_client_state = $root.ibc.core.client.v1.IdentifiedClientState.toObject(message.identified_client_state, options); + if (message.proof != null && message.hasOwnProperty("proof")) + object.proof = options.bytes === String ? $util.base64.encode(message.proof, 0, message.proof.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof) : message.proof; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) + object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); + return object; + }; + + /** + * Converts this QueryChannelClientStateResponse to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.QueryChannelClientStateResponse + * @instance + * @returns {Object.} JSON object + */ + QueryChannelClientStateResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryChannelClientStateResponse; + })(); + + v1.QueryChannelConsensusStateRequest = (function() { + + /** + * Properties of a QueryChannelConsensusStateRequest. + * @memberof ibc.core.channel.v1 + * @interface IQueryChannelConsensusStateRequest + * @property {string|null} [port_id] QueryChannelConsensusStateRequest port_id + * @property {string|null} [channel_id] QueryChannelConsensusStateRequest channel_id + * @property {Long|null} [revision_number] QueryChannelConsensusStateRequest revision_number + * @property {Long|null} [revision_height] QueryChannelConsensusStateRequest revision_height + */ + + /** + * Constructs a new QueryChannelConsensusStateRequest. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a QueryChannelConsensusStateRequest. + * @implements IQueryChannelConsensusStateRequest + * @constructor + * @param {ibc.core.channel.v1.IQueryChannelConsensusStateRequest=} [properties] Properties to set + */ + function QueryChannelConsensusStateRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryChannelConsensusStateRequest port_id. + * @member {string} port_id + * @memberof ibc.core.channel.v1.QueryChannelConsensusStateRequest + * @instance + */ + QueryChannelConsensusStateRequest.prototype.port_id = ""; + + /** + * QueryChannelConsensusStateRequest channel_id. + * @member {string} channel_id + * @memberof ibc.core.channel.v1.QueryChannelConsensusStateRequest + * @instance + */ + QueryChannelConsensusStateRequest.prototype.channel_id = ""; + + /** + * QueryChannelConsensusStateRequest revision_number. + * @member {Long} revision_number + * @memberof ibc.core.channel.v1.QueryChannelConsensusStateRequest + * @instance + */ + QueryChannelConsensusStateRequest.prototype.revision_number = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * QueryChannelConsensusStateRequest revision_height. + * @member {Long} revision_height + * @memberof ibc.core.channel.v1.QueryChannelConsensusStateRequest + * @instance + */ + QueryChannelConsensusStateRequest.prototype.revision_height = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified QueryChannelConsensusStateRequest message. Does not implicitly {@link ibc.core.channel.v1.QueryChannelConsensusStateRequest.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.QueryChannelConsensusStateRequest + * @static + * @param {ibc.core.channel.v1.IQueryChannelConsensusStateRequest} message QueryChannelConsensusStateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryChannelConsensusStateRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); + if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); + if (message.revision_number != null && Object.hasOwnProperty.call(message, "revision_number")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.revision_number); + if (message.revision_height != null && Object.hasOwnProperty.call(message, "revision_height")) + writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.revision_height); + return writer; + }; + + /** + * Encodes the specified QueryChannelConsensusStateRequest message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryChannelConsensusStateRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.QueryChannelConsensusStateRequest + * @static + * @param {ibc.core.channel.v1.IQueryChannelConsensusStateRequest} message QueryChannelConsensusStateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryChannelConsensusStateRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryChannelConsensusStateRequest message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.QueryChannelConsensusStateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.QueryChannelConsensusStateRequest} QueryChannelConsensusStateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryChannelConsensusStateRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryChannelConsensusStateRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.port_id = reader.string(); + break; + case 2: + message.channel_id = reader.string(); + break; + case 3: + message.revision_number = reader.uint64(); + break; + case 4: + message.revision_height = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryChannelConsensusStateRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.QueryChannelConsensusStateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.QueryChannelConsensusStateRequest} QueryChannelConsensusStateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryChannelConsensusStateRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryChannelConsensusStateRequest message. + * @function verify + * @memberof ibc.core.channel.v1.QueryChannelConsensusStateRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryChannelConsensusStateRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.port_id != null && message.hasOwnProperty("port_id")) + if (!$util.isString(message.port_id)) + return "port_id: string expected"; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + if (!$util.isString(message.channel_id)) + return "channel_id: string expected"; + if (message.revision_number != null && message.hasOwnProperty("revision_number")) + if (!$util.isInteger(message.revision_number) && !(message.revision_number && $util.isInteger(message.revision_number.low) && $util.isInteger(message.revision_number.high))) + return "revision_number: integer|Long expected"; + if (message.revision_height != null && message.hasOwnProperty("revision_height")) + if (!$util.isInteger(message.revision_height) && !(message.revision_height && $util.isInteger(message.revision_height.low) && $util.isInteger(message.revision_height.high))) + return "revision_height: integer|Long expected"; + return null; + }; + + /** + * Creates a QueryChannelConsensusStateRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.QueryChannelConsensusStateRequest + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.QueryChannelConsensusStateRequest} QueryChannelConsensusStateRequest + */ + QueryChannelConsensusStateRequest.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.QueryChannelConsensusStateRequest) + return object; + let message = new $root.ibc.core.channel.v1.QueryChannelConsensusStateRequest(); + if (object.port_id != null) + message.port_id = String(object.port_id); + if (object.channel_id != null) + message.channel_id = String(object.channel_id); + if (object.revision_number != null) + if ($util.Long) + (message.revision_number = $util.Long.fromValue(object.revision_number)).unsigned = true; + else if (typeof object.revision_number === "string") + message.revision_number = parseInt(object.revision_number, 10); + else if (typeof object.revision_number === "number") + message.revision_number = object.revision_number; + else if (typeof object.revision_number === "object") + message.revision_number = new $util.LongBits(object.revision_number.low >>> 0, object.revision_number.high >>> 0).toNumber(true); + if (object.revision_height != null) + if ($util.Long) + (message.revision_height = $util.Long.fromValue(object.revision_height)).unsigned = true; + else if (typeof object.revision_height === "string") + message.revision_height = parseInt(object.revision_height, 10); + else if (typeof object.revision_height === "number") + message.revision_height = object.revision_height; + else if (typeof object.revision_height === "object") + message.revision_height = new $util.LongBits(object.revision_height.low >>> 0, object.revision_height.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a QueryChannelConsensusStateRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.QueryChannelConsensusStateRequest + * @static + * @param {ibc.core.channel.v1.QueryChannelConsensusStateRequest} message QueryChannelConsensusStateRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryChannelConsensusStateRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.port_id = ""; + object.channel_id = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.revision_number = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.revision_number = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.revision_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.revision_height = options.longs === String ? "0" : 0; + } + if (message.port_id != null && message.hasOwnProperty("port_id")) + object.port_id = message.port_id; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + object.channel_id = message.channel_id; + if (message.revision_number != null && message.hasOwnProperty("revision_number")) + if (typeof message.revision_number === "number") + object.revision_number = options.longs === String ? String(message.revision_number) : message.revision_number; + else + object.revision_number = options.longs === String ? $util.Long.prototype.toString.call(message.revision_number) : options.longs === Number ? new $util.LongBits(message.revision_number.low >>> 0, message.revision_number.high >>> 0).toNumber(true) : message.revision_number; + if (message.revision_height != null && message.hasOwnProperty("revision_height")) + if (typeof message.revision_height === "number") + object.revision_height = options.longs === String ? String(message.revision_height) : message.revision_height; + else + object.revision_height = options.longs === String ? $util.Long.prototype.toString.call(message.revision_height) : options.longs === Number ? new $util.LongBits(message.revision_height.low >>> 0, message.revision_height.high >>> 0).toNumber(true) : message.revision_height; + return object; + }; + + /** + * Converts this QueryChannelConsensusStateRequest to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.QueryChannelConsensusStateRequest + * @instance + * @returns {Object.} JSON object + */ + QueryChannelConsensusStateRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryChannelConsensusStateRequest; + })(); + + v1.QueryChannelConsensusStateResponse = (function() { + + /** + * Properties of a QueryChannelConsensusStateResponse. + * @memberof ibc.core.channel.v1 + * @interface IQueryChannelConsensusStateResponse + * @property {google.protobuf.IAny|null} [consensus_state] QueryChannelConsensusStateResponse consensus_state + * @property {string|null} [client_id] QueryChannelConsensusStateResponse client_id + * @property {Uint8Array|null} [proof] QueryChannelConsensusStateResponse proof + * @property {ibc.core.client.v1.IHeight|null} [proof_height] QueryChannelConsensusStateResponse proof_height + */ + + /** + * Constructs a new QueryChannelConsensusStateResponse. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a QueryChannelConsensusStateResponse. + * @implements IQueryChannelConsensusStateResponse + * @constructor + * @param {ibc.core.channel.v1.IQueryChannelConsensusStateResponse=} [properties] Properties to set + */ + function QueryChannelConsensusStateResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryChannelConsensusStateResponse consensus_state. + * @member {google.protobuf.IAny|null|undefined} consensus_state + * @memberof ibc.core.channel.v1.QueryChannelConsensusStateResponse + * @instance + */ + QueryChannelConsensusStateResponse.prototype.consensus_state = null; + + /** + * QueryChannelConsensusStateResponse client_id. + * @member {string} client_id + * @memberof ibc.core.channel.v1.QueryChannelConsensusStateResponse + * @instance + */ + QueryChannelConsensusStateResponse.prototype.client_id = ""; + + /** + * QueryChannelConsensusStateResponse proof. + * @member {Uint8Array} proof + * @memberof ibc.core.channel.v1.QueryChannelConsensusStateResponse + * @instance + */ + QueryChannelConsensusStateResponse.prototype.proof = $util.newBuffer([]); + + /** + * QueryChannelConsensusStateResponse proof_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height + * @memberof ibc.core.channel.v1.QueryChannelConsensusStateResponse + * @instance + */ + QueryChannelConsensusStateResponse.prototype.proof_height = null; + + /** + * Encodes the specified QueryChannelConsensusStateResponse message. Does not implicitly {@link ibc.core.channel.v1.QueryChannelConsensusStateResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.QueryChannelConsensusStateResponse + * @static + * @param {ibc.core.channel.v1.IQueryChannelConsensusStateResponse} message QueryChannelConsensusStateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryChannelConsensusStateResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.consensus_state != null && Object.hasOwnProperty.call(message, "consensus_state")) + $root.google.protobuf.Any.encode(message.consensus_state, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.client_id); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.proof); + if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) + $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryChannelConsensusStateResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryChannelConsensusStateResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.QueryChannelConsensusStateResponse + * @static + * @param {ibc.core.channel.v1.IQueryChannelConsensusStateResponse} message QueryChannelConsensusStateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryChannelConsensusStateResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryChannelConsensusStateResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.QueryChannelConsensusStateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.QueryChannelConsensusStateResponse} QueryChannelConsensusStateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryChannelConsensusStateResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryChannelConsensusStateResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.consensus_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 2: + message.client_id = reader.string(); + break; + case 3: + message.proof = reader.bytes(); + break; + case 4: + message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryChannelConsensusStateResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.QueryChannelConsensusStateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.QueryChannelConsensusStateResponse} QueryChannelConsensusStateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryChannelConsensusStateResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryChannelConsensusStateResponse message. + * @function verify + * @memberof ibc.core.channel.v1.QueryChannelConsensusStateResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryChannelConsensusStateResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) { + let error = $root.google.protobuf.Any.verify(message.consensus_state); + if (error) + return "consensus_state." + error; + } + if (message.client_id != null && message.hasOwnProperty("client_id")) + if (!$util.isString(message.client_id)) + return "client_id: string expected"; + if (message.proof != null && message.hasOwnProperty("proof")) + if (!(message.proof && typeof message.proof.length === "number" || $util.isString(message.proof))) + return "proof: buffer expected"; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); + if (error) + return "proof_height." + error; + } + return null; + }; + + /** + * Creates a QueryChannelConsensusStateResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.QueryChannelConsensusStateResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.QueryChannelConsensusStateResponse} QueryChannelConsensusStateResponse + */ + QueryChannelConsensusStateResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.QueryChannelConsensusStateResponse) + return object; + let message = new $root.ibc.core.channel.v1.QueryChannelConsensusStateResponse(); + if (object.consensus_state != null) { + if (typeof object.consensus_state !== "object") + throw TypeError(".ibc.core.channel.v1.QueryChannelConsensusStateResponse.consensus_state: object expected"); + message.consensus_state = $root.google.protobuf.Any.fromObject(object.consensus_state); + } + if (object.client_id != null) + message.client_id = String(object.client_id); + if (object.proof != null) + if (typeof object.proof === "string") + $util.base64.decode(object.proof, message.proof = $util.newBuffer($util.base64.length(object.proof)), 0); + else if (object.proof.length) + message.proof = object.proof; + if (object.proof_height != null) { + if (typeof object.proof_height !== "object") + throw TypeError(".ibc.core.channel.v1.QueryChannelConsensusStateResponse.proof_height: object expected"); + message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); + } + return message; + }; + + /** + * Creates a plain object from a QueryChannelConsensusStateResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.QueryChannelConsensusStateResponse + * @static + * @param {ibc.core.channel.v1.QueryChannelConsensusStateResponse} message QueryChannelConsensusStateResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryChannelConsensusStateResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.consensus_state = null; + object.client_id = ""; + if (options.bytes === String) + object.proof = ""; + else { + object.proof = []; + if (options.bytes !== Array) + object.proof = $util.newBuffer(object.proof); + } + object.proof_height = null; + } + if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) + object.consensus_state = $root.google.protobuf.Any.toObject(message.consensus_state, options); + if (message.client_id != null && message.hasOwnProperty("client_id")) + object.client_id = message.client_id; + if (message.proof != null && message.hasOwnProperty("proof")) + object.proof = options.bytes === String ? $util.base64.encode(message.proof, 0, message.proof.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof) : message.proof; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) + object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); + return object; + }; + + /** + * Converts this QueryChannelConsensusStateResponse to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.QueryChannelConsensusStateResponse + * @instance + * @returns {Object.} JSON object + */ + QueryChannelConsensusStateResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryChannelConsensusStateResponse; + })(); + + v1.QueryPacketCommitmentRequest = (function() { + + /** + * Properties of a QueryPacketCommitmentRequest. + * @memberof ibc.core.channel.v1 + * @interface IQueryPacketCommitmentRequest + * @property {string|null} [port_id] QueryPacketCommitmentRequest port_id + * @property {string|null} [channel_id] QueryPacketCommitmentRequest channel_id + * @property {Long|null} [sequence] QueryPacketCommitmentRequest sequence + */ + + /** + * Constructs a new QueryPacketCommitmentRequest. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a QueryPacketCommitmentRequest. + * @implements IQueryPacketCommitmentRequest + * @constructor + * @param {ibc.core.channel.v1.IQueryPacketCommitmentRequest=} [properties] Properties to set + */ + function QueryPacketCommitmentRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryPacketCommitmentRequest port_id. + * @member {string} port_id + * @memberof ibc.core.channel.v1.QueryPacketCommitmentRequest + * @instance + */ + QueryPacketCommitmentRequest.prototype.port_id = ""; + + /** + * QueryPacketCommitmentRequest channel_id. + * @member {string} channel_id + * @memberof ibc.core.channel.v1.QueryPacketCommitmentRequest + * @instance + */ + QueryPacketCommitmentRequest.prototype.channel_id = ""; + + /** + * QueryPacketCommitmentRequest sequence. + * @member {Long} sequence + * @memberof ibc.core.channel.v1.QueryPacketCommitmentRequest + * @instance + */ + QueryPacketCommitmentRequest.prototype.sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified QueryPacketCommitmentRequest message. Does not implicitly {@link ibc.core.channel.v1.QueryPacketCommitmentRequest.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.QueryPacketCommitmentRequest + * @static + * @param {ibc.core.channel.v1.IQueryPacketCommitmentRequest} message QueryPacketCommitmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryPacketCommitmentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); + if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); + if (message.sequence != null && Object.hasOwnProperty.call(message, "sequence")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.sequence); + return writer; + }; + + /** + * Encodes the specified QueryPacketCommitmentRequest message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryPacketCommitmentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.QueryPacketCommitmentRequest + * @static + * @param {ibc.core.channel.v1.IQueryPacketCommitmentRequest} message QueryPacketCommitmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryPacketCommitmentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryPacketCommitmentRequest message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.QueryPacketCommitmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.QueryPacketCommitmentRequest} QueryPacketCommitmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryPacketCommitmentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryPacketCommitmentRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.port_id = reader.string(); + break; + case 2: + message.channel_id = reader.string(); + break; + case 3: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryPacketCommitmentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.QueryPacketCommitmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.QueryPacketCommitmentRequest} QueryPacketCommitmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryPacketCommitmentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryPacketCommitmentRequest message. + * @function verify + * @memberof ibc.core.channel.v1.QueryPacketCommitmentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryPacketCommitmentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.port_id != null && message.hasOwnProperty("port_id")) + if (!$util.isString(message.port_id)) + return "port_id: string expected"; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + if (!$util.isString(message.channel_id)) + return "channel_id: string expected"; + if (message.sequence != null && message.hasOwnProperty("sequence")) + if (!$util.isInteger(message.sequence) && !(message.sequence && $util.isInteger(message.sequence.low) && $util.isInteger(message.sequence.high))) + return "sequence: integer|Long expected"; + return null; + }; + + /** + * Creates a QueryPacketCommitmentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.QueryPacketCommitmentRequest + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.QueryPacketCommitmentRequest} QueryPacketCommitmentRequest + */ + QueryPacketCommitmentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.QueryPacketCommitmentRequest) + return object; + let message = new $root.ibc.core.channel.v1.QueryPacketCommitmentRequest(); + if (object.port_id != null) + message.port_id = String(object.port_id); + if (object.channel_id != null) + message.channel_id = String(object.channel_id); + if (object.sequence != null) + if ($util.Long) + (message.sequence = $util.Long.fromValue(object.sequence)).unsigned = true; + else if (typeof object.sequence === "string") + message.sequence = parseInt(object.sequence, 10); + else if (typeof object.sequence === "number") + message.sequence = object.sequence; + else if (typeof object.sequence === "object") + message.sequence = new $util.LongBits(object.sequence.low >>> 0, object.sequence.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a QueryPacketCommitmentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.QueryPacketCommitmentRequest + * @static + * @param {ibc.core.channel.v1.QueryPacketCommitmentRequest} message QueryPacketCommitmentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryPacketCommitmentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.port_id = ""; + object.channel_id = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.sequence = options.longs === String ? "0" : 0; + } + if (message.port_id != null && message.hasOwnProperty("port_id")) + object.port_id = message.port_id; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + object.channel_id = message.channel_id; + if (message.sequence != null && message.hasOwnProperty("sequence")) + if (typeof message.sequence === "number") + object.sequence = options.longs === String ? String(message.sequence) : message.sequence; + else + object.sequence = options.longs === String ? $util.Long.prototype.toString.call(message.sequence) : options.longs === Number ? new $util.LongBits(message.sequence.low >>> 0, message.sequence.high >>> 0).toNumber(true) : message.sequence; + return object; + }; + + /** + * Converts this QueryPacketCommitmentRequest to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.QueryPacketCommitmentRequest + * @instance + * @returns {Object.} JSON object + */ + QueryPacketCommitmentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryPacketCommitmentRequest; + })(); + + v1.QueryPacketCommitmentResponse = (function() { + + /** + * Properties of a QueryPacketCommitmentResponse. + * @memberof ibc.core.channel.v1 + * @interface IQueryPacketCommitmentResponse + * @property {Uint8Array|null} [commitment] QueryPacketCommitmentResponse commitment + * @property {Uint8Array|null} [proof] QueryPacketCommitmentResponse proof + * @property {ibc.core.client.v1.IHeight|null} [proof_height] QueryPacketCommitmentResponse proof_height + */ + + /** + * Constructs a new QueryPacketCommitmentResponse. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a QueryPacketCommitmentResponse. + * @implements IQueryPacketCommitmentResponse + * @constructor + * @param {ibc.core.channel.v1.IQueryPacketCommitmentResponse=} [properties] Properties to set + */ + function QueryPacketCommitmentResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryPacketCommitmentResponse commitment. + * @member {Uint8Array} commitment + * @memberof ibc.core.channel.v1.QueryPacketCommitmentResponse + * @instance + */ + QueryPacketCommitmentResponse.prototype.commitment = $util.newBuffer([]); + + /** + * QueryPacketCommitmentResponse proof. + * @member {Uint8Array} proof + * @memberof ibc.core.channel.v1.QueryPacketCommitmentResponse + * @instance + */ + QueryPacketCommitmentResponse.prototype.proof = $util.newBuffer([]); + + /** + * QueryPacketCommitmentResponse proof_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height + * @memberof ibc.core.channel.v1.QueryPacketCommitmentResponse + * @instance + */ + QueryPacketCommitmentResponse.prototype.proof_height = null; + + /** + * Encodes the specified QueryPacketCommitmentResponse message. Does not implicitly {@link ibc.core.channel.v1.QueryPacketCommitmentResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.QueryPacketCommitmentResponse + * @static + * @param {ibc.core.channel.v1.IQueryPacketCommitmentResponse} message QueryPacketCommitmentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryPacketCommitmentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commitment != null && Object.hasOwnProperty.call(message, "commitment")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.commitment); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proof); + if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) + $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryPacketCommitmentResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryPacketCommitmentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.QueryPacketCommitmentResponse + * @static + * @param {ibc.core.channel.v1.IQueryPacketCommitmentResponse} message QueryPacketCommitmentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryPacketCommitmentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryPacketCommitmentResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.QueryPacketCommitmentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.QueryPacketCommitmentResponse} QueryPacketCommitmentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryPacketCommitmentResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryPacketCommitmentResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commitment = reader.bytes(); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryPacketCommitmentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.QueryPacketCommitmentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.QueryPacketCommitmentResponse} QueryPacketCommitmentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryPacketCommitmentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryPacketCommitmentResponse message. + * @function verify + * @memberof ibc.core.channel.v1.QueryPacketCommitmentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryPacketCommitmentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.commitment != null && message.hasOwnProperty("commitment")) + if (!(message.commitment && typeof message.commitment.length === "number" || $util.isString(message.commitment))) + return "commitment: buffer expected"; + if (message.proof != null && message.hasOwnProperty("proof")) + if (!(message.proof && typeof message.proof.length === "number" || $util.isString(message.proof))) + return "proof: buffer expected"; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); + if (error) + return "proof_height." + error; + } + return null; + }; + + /** + * Creates a QueryPacketCommitmentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.QueryPacketCommitmentResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.QueryPacketCommitmentResponse} QueryPacketCommitmentResponse + */ + QueryPacketCommitmentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.QueryPacketCommitmentResponse) + return object; + let message = new $root.ibc.core.channel.v1.QueryPacketCommitmentResponse(); + if (object.commitment != null) + if (typeof object.commitment === "string") + $util.base64.decode(object.commitment, message.commitment = $util.newBuffer($util.base64.length(object.commitment)), 0); + else if (object.commitment.length) + message.commitment = object.commitment; + if (object.proof != null) + if (typeof object.proof === "string") + $util.base64.decode(object.proof, message.proof = $util.newBuffer($util.base64.length(object.proof)), 0); + else if (object.proof.length) + message.proof = object.proof; + if (object.proof_height != null) { + if (typeof object.proof_height !== "object") + throw TypeError(".ibc.core.channel.v1.QueryPacketCommitmentResponse.proof_height: object expected"); + message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); + } + return message; + }; + + /** + * Creates a plain object from a QueryPacketCommitmentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.QueryPacketCommitmentResponse + * @static + * @param {ibc.core.channel.v1.QueryPacketCommitmentResponse} message QueryPacketCommitmentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryPacketCommitmentResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if (options.bytes === String) + object.commitment = ""; + else { + object.commitment = []; + if (options.bytes !== Array) + object.commitment = $util.newBuffer(object.commitment); + } + if (options.bytes === String) + object.proof = ""; + else { + object.proof = []; + if (options.bytes !== Array) + object.proof = $util.newBuffer(object.proof); + } + object.proof_height = null; + } + if (message.commitment != null && message.hasOwnProperty("commitment")) + object.commitment = options.bytes === String ? $util.base64.encode(message.commitment, 0, message.commitment.length) : options.bytes === Array ? Array.prototype.slice.call(message.commitment) : message.commitment; + if (message.proof != null && message.hasOwnProperty("proof")) + object.proof = options.bytes === String ? $util.base64.encode(message.proof, 0, message.proof.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof) : message.proof; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) + object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); + return object; + }; + + /** + * Converts this QueryPacketCommitmentResponse to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.QueryPacketCommitmentResponse + * @instance + * @returns {Object.} JSON object + */ + QueryPacketCommitmentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryPacketCommitmentResponse; + })(); + + v1.QueryPacketCommitmentsRequest = (function() { + + /** + * Properties of a QueryPacketCommitmentsRequest. + * @memberof ibc.core.channel.v1 + * @interface IQueryPacketCommitmentsRequest + * @property {string|null} [port_id] QueryPacketCommitmentsRequest port_id + * @property {string|null} [channel_id] QueryPacketCommitmentsRequest channel_id + * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryPacketCommitmentsRequest pagination + */ + + /** + * Constructs a new QueryPacketCommitmentsRequest. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a QueryPacketCommitmentsRequest. + * @implements IQueryPacketCommitmentsRequest + * @constructor + * @param {ibc.core.channel.v1.IQueryPacketCommitmentsRequest=} [properties] Properties to set + */ + function QueryPacketCommitmentsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryPacketCommitmentsRequest port_id. + * @member {string} port_id + * @memberof ibc.core.channel.v1.QueryPacketCommitmentsRequest + * @instance + */ + QueryPacketCommitmentsRequest.prototype.port_id = ""; + + /** + * QueryPacketCommitmentsRequest channel_id. + * @member {string} channel_id + * @memberof ibc.core.channel.v1.QueryPacketCommitmentsRequest + * @instance + */ + QueryPacketCommitmentsRequest.prototype.channel_id = ""; + + /** + * QueryPacketCommitmentsRequest pagination. + * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination + * @memberof ibc.core.channel.v1.QueryPacketCommitmentsRequest + * @instance + */ + QueryPacketCommitmentsRequest.prototype.pagination = null; + + /** + * Encodes the specified QueryPacketCommitmentsRequest message. Does not implicitly {@link ibc.core.channel.v1.QueryPacketCommitmentsRequest.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.QueryPacketCommitmentsRequest + * @static + * @param {ibc.core.channel.v1.IQueryPacketCommitmentsRequest} message QueryPacketCommitmentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryPacketCommitmentsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); + if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryPacketCommitmentsRequest message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryPacketCommitmentsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.QueryPacketCommitmentsRequest + * @static + * @param {ibc.core.channel.v1.IQueryPacketCommitmentsRequest} message QueryPacketCommitmentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryPacketCommitmentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryPacketCommitmentsRequest message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.QueryPacketCommitmentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.QueryPacketCommitmentsRequest} QueryPacketCommitmentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryPacketCommitmentsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryPacketCommitmentsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.port_id = reader.string(); + break; + case 2: + message.channel_id = reader.string(); + break; + case 3: + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryPacketCommitmentsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.QueryPacketCommitmentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.QueryPacketCommitmentsRequest} QueryPacketCommitmentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryPacketCommitmentsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryPacketCommitmentsRequest message. + * @function verify + * @memberof ibc.core.channel.v1.QueryPacketCommitmentsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryPacketCommitmentsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.port_id != null && message.hasOwnProperty("port_id")) + if (!$util.isString(message.port_id)) + return "port_id: string expected"; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + if (!$util.isString(message.channel_id)) + return "channel_id: string expected"; + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryPacketCommitmentsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.QueryPacketCommitmentsRequest + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.QueryPacketCommitmentsRequest} QueryPacketCommitmentsRequest + */ + QueryPacketCommitmentsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.QueryPacketCommitmentsRequest) + return object; + let message = new $root.ibc.core.channel.v1.QueryPacketCommitmentsRequest(); + if (object.port_id != null) + message.port_id = String(object.port_id); + if (object.channel_id != null) + message.channel_id = String(object.channel_id); + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".ibc.core.channel.v1.QueryPacketCommitmentsRequest.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryPacketCommitmentsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.QueryPacketCommitmentsRequest + * @static + * @param {ibc.core.channel.v1.QueryPacketCommitmentsRequest} message QueryPacketCommitmentsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryPacketCommitmentsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.port_id = ""; + object.channel_id = ""; + object.pagination = null; + } + if (message.port_id != null && message.hasOwnProperty("port_id")) + object.port_id = message.port_id; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + object.channel_id = message.channel_id; + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryPacketCommitmentsRequest to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.QueryPacketCommitmentsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryPacketCommitmentsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryPacketCommitmentsRequest; + })(); + + v1.QueryPacketCommitmentsResponse = (function() { + + /** + * Properties of a QueryPacketCommitmentsResponse. + * @memberof ibc.core.channel.v1 + * @interface IQueryPacketCommitmentsResponse + * @property {Array.|null} [commitments] QueryPacketCommitmentsResponse commitments + * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryPacketCommitmentsResponse pagination + * @property {ibc.core.client.v1.IHeight|null} [height] QueryPacketCommitmentsResponse height + */ + + /** + * Constructs a new QueryPacketCommitmentsResponse. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a QueryPacketCommitmentsResponse. + * @implements IQueryPacketCommitmentsResponse + * @constructor + * @param {ibc.core.channel.v1.IQueryPacketCommitmentsResponse=} [properties] Properties to set + */ + function QueryPacketCommitmentsResponse(properties) { + this.commitments = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryPacketCommitmentsResponse commitments. + * @member {Array.} commitments + * @memberof ibc.core.channel.v1.QueryPacketCommitmentsResponse + * @instance + */ + QueryPacketCommitmentsResponse.prototype.commitments = $util.emptyArray; + + /** + * QueryPacketCommitmentsResponse pagination. + * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination + * @memberof ibc.core.channel.v1.QueryPacketCommitmentsResponse + * @instance + */ + QueryPacketCommitmentsResponse.prototype.pagination = null; + + /** + * QueryPacketCommitmentsResponse height. + * @member {ibc.core.client.v1.IHeight|null|undefined} height + * @memberof ibc.core.channel.v1.QueryPacketCommitmentsResponse + * @instance + */ + QueryPacketCommitmentsResponse.prototype.height = null; + + /** + * Encodes the specified QueryPacketCommitmentsResponse message. Does not implicitly {@link ibc.core.channel.v1.QueryPacketCommitmentsResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.QueryPacketCommitmentsResponse + * @static + * @param {ibc.core.channel.v1.IQueryPacketCommitmentsResponse} message QueryPacketCommitmentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryPacketCommitmentsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commitments != null && message.commitments.length) + for (let i = 0; i < message.commitments.length; ++i) + $root.ibc.core.channel.v1.PacketState.encode(message.commitments[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + $root.ibc.core.client.v1.Height.encode(message.height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryPacketCommitmentsResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryPacketCommitmentsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.QueryPacketCommitmentsResponse + * @static + * @param {ibc.core.channel.v1.IQueryPacketCommitmentsResponse} message QueryPacketCommitmentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryPacketCommitmentsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryPacketCommitmentsResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.QueryPacketCommitmentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.QueryPacketCommitmentsResponse} QueryPacketCommitmentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryPacketCommitmentsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryPacketCommitmentsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.commitments && message.commitments.length)) + message.commitments = []; + message.commitments.push($root.ibc.core.channel.v1.PacketState.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); + break; + case 3: + message.height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryPacketCommitmentsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.QueryPacketCommitmentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.QueryPacketCommitmentsResponse} QueryPacketCommitmentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryPacketCommitmentsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryPacketCommitmentsResponse message. + * @function verify + * @memberof ibc.core.channel.v1.QueryPacketCommitmentsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryPacketCommitmentsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.commitments != null && message.hasOwnProperty("commitments")) { + if (!Array.isArray(message.commitments)) + return "commitments: array expected"; + for (let i = 0; i < message.commitments.length; ++i) { + let error = $root.ibc.core.channel.v1.PacketState.verify(message.commitments[i]); + if (error) + return "commitments." + error; + } + } + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); + if (error) + return "pagination." + error; + } + if (message.height != null && message.hasOwnProperty("height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.height); + if (error) + return "height." + error; + } + return null; + }; + + /** + * Creates a QueryPacketCommitmentsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.QueryPacketCommitmentsResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.QueryPacketCommitmentsResponse} QueryPacketCommitmentsResponse + */ + QueryPacketCommitmentsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.QueryPacketCommitmentsResponse) + return object; + let message = new $root.ibc.core.channel.v1.QueryPacketCommitmentsResponse(); + if (object.commitments) { + if (!Array.isArray(object.commitments)) + throw TypeError(".ibc.core.channel.v1.QueryPacketCommitmentsResponse.commitments: array expected"); + message.commitments = []; + for (let i = 0; i < object.commitments.length; ++i) { + if (typeof object.commitments[i] !== "object") + throw TypeError(".ibc.core.channel.v1.QueryPacketCommitmentsResponse.commitments: object expected"); + message.commitments[i] = $root.ibc.core.channel.v1.PacketState.fromObject(object.commitments[i]); + } + } + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".ibc.core.channel.v1.QueryPacketCommitmentsResponse.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); + } + if (object.height != null) { + if (typeof object.height !== "object") + throw TypeError(".ibc.core.channel.v1.QueryPacketCommitmentsResponse.height: object expected"); + message.height = $root.ibc.core.client.v1.Height.fromObject(object.height); + } + return message; + }; + + /** + * Creates a plain object from a QueryPacketCommitmentsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.QueryPacketCommitmentsResponse + * @static + * @param {ibc.core.channel.v1.QueryPacketCommitmentsResponse} message QueryPacketCommitmentsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryPacketCommitmentsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.commitments = []; + if (options.defaults) { + object.pagination = null; + object.height = null; + } + if (message.commitments && message.commitments.length) { + object.commitments = []; + for (let j = 0; j < message.commitments.length; ++j) + object.commitments[j] = $root.ibc.core.channel.v1.PacketState.toObject(message.commitments[j], options); + } + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); + if (message.height != null && message.hasOwnProperty("height")) + object.height = $root.ibc.core.client.v1.Height.toObject(message.height, options); + return object; + }; + + /** + * Converts this QueryPacketCommitmentsResponse to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.QueryPacketCommitmentsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryPacketCommitmentsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryPacketCommitmentsResponse; + })(); + + v1.QueryPacketReceiptRequest = (function() { + + /** + * Properties of a QueryPacketReceiptRequest. + * @memberof ibc.core.channel.v1 + * @interface IQueryPacketReceiptRequest + * @property {string|null} [port_id] QueryPacketReceiptRequest port_id + * @property {string|null} [channel_id] QueryPacketReceiptRequest channel_id + * @property {Long|null} [sequence] QueryPacketReceiptRequest sequence + */ + + /** + * Constructs a new QueryPacketReceiptRequest. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a QueryPacketReceiptRequest. + * @implements IQueryPacketReceiptRequest + * @constructor + * @param {ibc.core.channel.v1.IQueryPacketReceiptRequest=} [properties] Properties to set + */ + function QueryPacketReceiptRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryPacketReceiptRequest port_id. + * @member {string} port_id + * @memberof ibc.core.channel.v1.QueryPacketReceiptRequest + * @instance + */ + QueryPacketReceiptRequest.prototype.port_id = ""; + + /** + * QueryPacketReceiptRequest channel_id. + * @member {string} channel_id + * @memberof ibc.core.channel.v1.QueryPacketReceiptRequest + * @instance + */ + QueryPacketReceiptRequest.prototype.channel_id = ""; + + /** + * QueryPacketReceiptRequest sequence. + * @member {Long} sequence + * @memberof ibc.core.channel.v1.QueryPacketReceiptRequest + * @instance + */ + QueryPacketReceiptRequest.prototype.sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified QueryPacketReceiptRequest message. Does not implicitly {@link ibc.core.channel.v1.QueryPacketReceiptRequest.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.QueryPacketReceiptRequest + * @static + * @param {ibc.core.channel.v1.IQueryPacketReceiptRequest} message QueryPacketReceiptRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryPacketReceiptRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); + if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); + if (message.sequence != null && Object.hasOwnProperty.call(message, "sequence")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.sequence); + return writer; + }; + + /** + * Encodes the specified QueryPacketReceiptRequest message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryPacketReceiptRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.QueryPacketReceiptRequest + * @static + * @param {ibc.core.channel.v1.IQueryPacketReceiptRequest} message QueryPacketReceiptRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryPacketReceiptRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryPacketReceiptRequest message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.QueryPacketReceiptRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.QueryPacketReceiptRequest} QueryPacketReceiptRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryPacketReceiptRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryPacketReceiptRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.port_id = reader.string(); + break; + case 2: + message.channel_id = reader.string(); + break; + case 3: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryPacketReceiptRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.QueryPacketReceiptRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.QueryPacketReceiptRequest} QueryPacketReceiptRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryPacketReceiptRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryPacketReceiptRequest message. + * @function verify + * @memberof ibc.core.channel.v1.QueryPacketReceiptRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryPacketReceiptRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.port_id != null && message.hasOwnProperty("port_id")) + if (!$util.isString(message.port_id)) + return "port_id: string expected"; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + if (!$util.isString(message.channel_id)) + return "channel_id: string expected"; + if (message.sequence != null && message.hasOwnProperty("sequence")) + if (!$util.isInteger(message.sequence) && !(message.sequence && $util.isInteger(message.sequence.low) && $util.isInteger(message.sequence.high))) + return "sequence: integer|Long expected"; + return null; + }; + + /** + * Creates a QueryPacketReceiptRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.QueryPacketReceiptRequest + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.QueryPacketReceiptRequest} QueryPacketReceiptRequest + */ + QueryPacketReceiptRequest.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.QueryPacketReceiptRequest) + return object; + let message = new $root.ibc.core.channel.v1.QueryPacketReceiptRequest(); + if (object.port_id != null) + message.port_id = String(object.port_id); + if (object.channel_id != null) + message.channel_id = String(object.channel_id); + if (object.sequence != null) + if ($util.Long) + (message.sequence = $util.Long.fromValue(object.sequence)).unsigned = true; + else if (typeof object.sequence === "string") + message.sequence = parseInt(object.sequence, 10); + else if (typeof object.sequence === "number") + message.sequence = object.sequence; + else if (typeof object.sequence === "object") + message.sequence = new $util.LongBits(object.sequence.low >>> 0, object.sequence.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a QueryPacketReceiptRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.QueryPacketReceiptRequest + * @static + * @param {ibc.core.channel.v1.QueryPacketReceiptRequest} message QueryPacketReceiptRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryPacketReceiptRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.port_id = ""; + object.channel_id = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.sequence = options.longs === String ? "0" : 0; + } + if (message.port_id != null && message.hasOwnProperty("port_id")) + object.port_id = message.port_id; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + object.channel_id = message.channel_id; + if (message.sequence != null && message.hasOwnProperty("sequence")) + if (typeof message.sequence === "number") + object.sequence = options.longs === String ? String(message.sequence) : message.sequence; + else + object.sequence = options.longs === String ? $util.Long.prototype.toString.call(message.sequence) : options.longs === Number ? new $util.LongBits(message.sequence.low >>> 0, message.sequence.high >>> 0).toNumber(true) : message.sequence; + return object; + }; + + /** + * Converts this QueryPacketReceiptRequest to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.QueryPacketReceiptRequest + * @instance + * @returns {Object.} JSON object + */ + QueryPacketReceiptRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryPacketReceiptRequest; + })(); + + v1.QueryPacketReceiptResponse = (function() { + + /** + * Properties of a QueryPacketReceiptResponse. + * @memberof ibc.core.channel.v1 + * @interface IQueryPacketReceiptResponse + * @property {boolean|null} [received] QueryPacketReceiptResponse received + * @property {Uint8Array|null} [proof] QueryPacketReceiptResponse proof + * @property {ibc.core.client.v1.IHeight|null} [proof_height] QueryPacketReceiptResponse proof_height + */ + + /** + * Constructs a new QueryPacketReceiptResponse. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a QueryPacketReceiptResponse. + * @implements IQueryPacketReceiptResponse + * @constructor + * @param {ibc.core.channel.v1.IQueryPacketReceiptResponse=} [properties] Properties to set + */ + function QueryPacketReceiptResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryPacketReceiptResponse received. + * @member {boolean} received + * @memberof ibc.core.channel.v1.QueryPacketReceiptResponse + * @instance + */ + QueryPacketReceiptResponse.prototype.received = false; + + /** + * QueryPacketReceiptResponse proof. + * @member {Uint8Array} proof + * @memberof ibc.core.channel.v1.QueryPacketReceiptResponse + * @instance + */ + QueryPacketReceiptResponse.prototype.proof = $util.newBuffer([]); + + /** + * QueryPacketReceiptResponse proof_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height + * @memberof ibc.core.channel.v1.QueryPacketReceiptResponse + * @instance + */ + QueryPacketReceiptResponse.prototype.proof_height = null; + + /** + * Encodes the specified QueryPacketReceiptResponse message. Does not implicitly {@link ibc.core.channel.v1.QueryPacketReceiptResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.QueryPacketReceiptResponse + * @static + * @param {ibc.core.channel.v1.IQueryPacketReceiptResponse} message QueryPacketReceiptResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryPacketReceiptResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.received != null && Object.hasOwnProperty.call(message, "received")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.received); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.proof); + if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) + $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryPacketReceiptResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryPacketReceiptResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.QueryPacketReceiptResponse + * @static + * @param {ibc.core.channel.v1.IQueryPacketReceiptResponse} message QueryPacketReceiptResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryPacketReceiptResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryPacketReceiptResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.QueryPacketReceiptResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.QueryPacketReceiptResponse} QueryPacketReceiptResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryPacketReceiptResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryPacketReceiptResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.received = reader.bool(); + break; + case 3: + message.proof = reader.bytes(); + break; + case 4: + message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryPacketReceiptResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.QueryPacketReceiptResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.QueryPacketReceiptResponse} QueryPacketReceiptResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryPacketReceiptResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryPacketReceiptResponse message. + * @function verify + * @memberof ibc.core.channel.v1.QueryPacketReceiptResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryPacketReceiptResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.received != null && message.hasOwnProperty("received")) + if (typeof message.received !== "boolean") + return "received: boolean expected"; + if (message.proof != null && message.hasOwnProperty("proof")) + if (!(message.proof && typeof message.proof.length === "number" || $util.isString(message.proof))) + return "proof: buffer expected"; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); + if (error) + return "proof_height." + error; + } + return null; + }; + + /** + * Creates a QueryPacketReceiptResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.QueryPacketReceiptResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.QueryPacketReceiptResponse} QueryPacketReceiptResponse + */ + QueryPacketReceiptResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.QueryPacketReceiptResponse) + return object; + let message = new $root.ibc.core.channel.v1.QueryPacketReceiptResponse(); + if (object.received != null) + message.received = Boolean(object.received); + if (object.proof != null) + if (typeof object.proof === "string") + $util.base64.decode(object.proof, message.proof = $util.newBuffer($util.base64.length(object.proof)), 0); + else if (object.proof.length) + message.proof = object.proof; + if (object.proof_height != null) { + if (typeof object.proof_height !== "object") + throw TypeError(".ibc.core.channel.v1.QueryPacketReceiptResponse.proof_height: object expected"); + message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); + } + return message; + }; + + /** + * Creates a plain object from a QueryPacketReceiptResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.QueryPacketReceiptResponse + * @static + * @param {ibc.core.channel.v1.QueryPacketReceiptResponse} message QueryPacketReceiptResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryPacketReceiptResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.received = false; + if (options.bytes === String) + object.proof = ""; + else { + object.proof = []; + if (options.bytes !== Array) + object.proof = $util.newBuffer(object.proof); + } + object.proof_height = null; + } + if (message.received != null && message.hasOwnProperty("received")) + object.received = message.received; + if (message.proof != null && message.hasOwnProperty("proof")) + object.proof = options.bytes === String ? $util.base64.encode(message.proof, 0, message.proof.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof) : message.proof; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) + object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); + return object; + }; + + /** + * Converts this QueryPacketReceiptResponse to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.QueryPacketReceiptResponse + * @instance + * @returns {Object.} JSON object + */ + QueryPacketReceiptResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryPacketReceiptResponse; + })(); + + v1.QueryPacketAcknowledgementRequest = (function() { + + /** + * Properties of a QueryPacketAcknowledgementRequest. + * @memberof ibc.core.channel.v1 + * @interface IQueryPacketAcknowledgementRequest + * @property {string|null} [port_id] QueryPacketAcknowledgementRequest port_id + * @property {string|null} [channel_id] QueryPacketAcknowledgementRequest channel_id + * @property {Long|null} [sequence] QueryPacketAcknowledgementRequest sequence + */ + + /** + * Constructs a new QueryPacketAcknowledgementRequest. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a QueryPacketAcknowledgementRequest. + * @implements IQueryPacketAcknowledgementRequest + * @constructor + * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementRequest=} [properties] Properties to set + */ + function QueryPacketAcknowledgementRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryPacketAcknowledgementRequest port_id. + * @member {string} port_id + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementRequest + * @instance + */ + QueryPacketAcknowledgementRequest.prototype.port_id = ""; + + /** + * QueryPacketAcknowledgementRequest channel_id. + * @member {string} channel_id + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementRequest + * @instance + */ + QueryPacketAcknowledgementRequest.prototype.channel_id = ""; + + /** + * QueryPacketAcknowledgementRequest sequence. + * @member {Long} sequence + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementRequest + * @instance + */ + QueryPacketAcknowledgementRequest.prototype.sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified QueryPacketAcknowledgementRequest message. Does not implicitly {@link ibc.core.channel.v1.QueryPacketAcknowledgementRequest.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementRequest + * @static + * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementRequest} message QueryPacketAcknowledgementRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryPacketAcknowledgementRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); + if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); + if (message.sequence != null && Object.hasOwnProperty.call(message, "sequence")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.sequence); + return writer; + }; + + /** + * Encodes the specified QueryPacketAcknowledgementRequest message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryPacketAcknowledgementRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementRequest + * @static + * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementRequest} message QueryPacketAcknowledgementRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryPacketAcknowledgementRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryPacketAcknowledgementRequest message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.QueryPacketAcknowledgementRequest} QueryPacketAcknowledgementRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryPacketAcknowledgementRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryPacketAcknowledgementRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.port_id = reader.string(); + break; + case 2: + message.channel_id = reader.string(); + break; + case 3: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryPacketAcknowledgementRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.QueryPacketAcknowledgementRequest} QueryPacketAcknowledgementRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryPacketAcknowledgementRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryPacketAcknowledgementRequest message. + * @function verify + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryPacketAcknowledgementRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.port_id != null && message.hasOwnProperty("port_id")) + if (!$util.isString(message.port_id)) + return "port_id: string expected"; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + if (!$util.isString(message.channel_id)) + return "channel_id: string expected"; + if (message.sequence != null && message.hasOwnProperty("sequence")) + if (!$util.isInteger(message.sequence) && !(message.sequence && $util.isInteger(message.sequence.low) && $util.isInteger(message.sequence.high))) + return "sequence: integer|Long expected"; + return null; + }; + + /** + * Creates a QueryPacketAcknowledgementRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementRequest + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.QueryPacketAcknowledgementRequest} QueryPacketAcknowledgementRequest + */ + QueryPacketAcknowledgementRequest.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.QueryPacketAcknowledgementRequest) + return object; + let message = new $root.ibc.core.channel.v1.QueryPacketAcknowledgementRequest(); + if (object.port_id != null) + message.port_id = String(object.port_id); + if (object.channel_id != null) + message.channel_id = String(object.channel_id); + if (object.sequence != null) + if ($util.Long) + (message.sequence = $util.Long.fromValue(object.sequence)).unsigned = true; + else if (typeof object.sequence === "string") + message.sequence = parseInt(object.sequence, 10); + else if (typeof object.sequence === "number") + message.sequence = object.sequence; + else if (typeof object.sequence === "object") + message.sequence = new $util.LongBits(object.sequence.low >>> 0, object.sequence.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a QueryPacketAcknowledgementRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementRequest + * @static + * @param {ibc.core.channel.v1.QueryPacketAcknowledgementRequest} message QueryPacketAcknowledgementRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryPacketAcknowledgementRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.port_id = ""; + object.channel_id = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.sequence = options.longs === String ? "0" : 0; + } + if (message.port_id != null && message.hasOwnProperty("port_id")) + object.port_id = message.port_id; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + object.channel_id = message.channel_id; + if (message.sequence != null && message.hasOwnProperty("sequence")) + if (typeof message.sequence === "number") + object.sequence = options.longs === String ? String(message.sequence) : message.sequence; + else + object.sequence = options.longs === String ? $util.Long.prototype.toString.call(message.sequence) : options.longs === Number ? new $util.LongBits(message.sequence.low >>> 0, message.sequence.high >>> 0).toNumber(true) : message.sequence; + return object; + }; + + /** + * Converts this QueryPacketAcknowledgementRequest to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementRequest + * @instance + * @returns {Object.} JSON object + */ + QueryPacketAcknowledgementRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryPacketAcknowledgementRequest; + })(); + + v1.QueryPacketAcknowledgementResponse = (function() { + + /** + * Properties of a QueryPacketAcknowledgementResponse. + * @memberof ibc.core.channel.v1 + * @interface IQueryPacketAcknowledgementResponse + * @property {Uint8Array|null} [acknowledgement] QueryPacketAcknowledgementResponse acknowledgement + * @property {Uint8Array|null} [proof] QueryPacketAcknowledgementResponse proof + * @property {ibc.core.client.v1.IHeight|null} [proof_height] QueryPacketAcknowledgementResponse proof_height + */ + + /** + * Constructs a new QueryPacketAcknowledgementResponse. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a QueryPacketAcknowledgementResponse. + * @implements IQueryPacketAcknowledgementResponse + * @constructor + * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementResponse=} [properties] Properties to set + */ + function QueryPacketAcknowledgementResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryPacketAcknowledgementResponse acknowledgement. + * @member {Uint8Array} acknowledgement + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementResponse + * @instance + */ + QueryPacketAcknowledgementResponse.prototype.acknowledgement = $util.newBuffer([]); + + /** + * QueryPacketAcknowledgementResponse proof. + * @member {Uint8Array} proof + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementResponse + * @instance + */ + QueryPacketAcknowledgementResponse.prototype.proof = $util.newBuffer([]); + + /** + * QueryPacketAcknowledgementResponse proof_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementResponse + * @instance + */ + QueryPacketAcknowledgementResponse.prototype.proof_height = null; + + /** + * Encodes the specified QueryPacketAcknowledgementResponse message. Does not implicitly {@link ibc.core.channel.v1.QueryPacketAcknowledgementResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementResponse + * @static + * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementResponse} message QueryPacketAcknowledgementResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryPacketAcknowledgementResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.acknowledgement != null && Object.hasOwnProperty.call(message, "acknowledgement")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.acknowledgement); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proof); + if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) + $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryPacketAcknowledgementResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryPacketAcknowledgementResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementResponse + * @static + * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementResponse} message QueryPacketAcknowledgementResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryPacketAcknowledgementResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryPacketAcknowledgementResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.QueryPacketAcknowledgementResponse} QueryPacketAcknowledgementResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryPacketAcknowledgementResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryPacketAcknowledgementResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.acknowledgement = reader.bytes(); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryPacketAcknowledgementResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.QueryPacketAcknowledgementResponse} QueryPacketAcknowledgementResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryPacketAcknowledgementResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryPacketAcknowledgementResponse message. + * @function verify + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryPacketAcknowledgementResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.acknowledgement != null && message.hasOwnProperty("acknowledgement")) + if (!(message.acknowledgement && typeof message.acknowledgement.length === "number" || $util.isString(message.acknowledgement))) + return "acknowledgement: buffer expected"; + if (message.proof != null && message.hasOwnProperty("proof")) + if (!(message.proof && typeof message.proof.length === "number" || $util.isString(message.proof))) + return "proof: buffer expected"; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); + if (error) + return "proof_height." + error; + } + return null; + }; + + /** + * Creates a QueryPacketAcknowledgementResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.QueryPacketAcknowledgementResponse} QueryPacketAcknowledgementResponse + */ + QueryPacketAcknowledgementResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.QueryPacketAcknowledgementResponse) + return object; + let message = new $root.ibc.core.channel.v1.QueryPacketAcknowledgementResponse(); + if (object.acknowledgement != null) + if (typeof object.acknowledgement === "string") + $util.base64.decode(object.acknowledgement, message.acknowledgement = $util.newBuffer($util.base64.length(object.acknowledgement)), 0); + else if (object.acknowledgement.length) + message.acknowledgement = object.acknowledgement; + if (object.proof != null) + if (typeof object.proof === "string") + $util.base64.decode(object.proof, message.proof = $util.newBuffer($util.base64.length(object.proof)), 0); + else if (object.proof.length) + message.proof = object.proof; + if (object.proof_height != null) { + if (typeof object.proof_height !== "object") + throw TypeError(".ibc.core.channel.v1.QueryPacketAcknowledgementResponse.proof_height: object expected"); + message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); + } + return message; + }; + + /** + * Creates a plain object from a QueryPacketAcknowledgementResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementResponse + * @static + * @param {ibc.core.channel.v1.QueryPacketAcknowledgementResponse} message QueryPacketAcknowledgementResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryPacketAcknowledgementResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if (options.bytes === String) + object.acknowledgement = ""; + else { + object.acknowledgement = []; + if (options.bytes !== Array) + object.acknowledgement = $util.newBuffer(object.acknowledgement); + } + if (options.bytes === String) + object.proof = ""; + else { + object.proof = []; + if (options.bytes !== Array) + object.proof = $util.newBuffer(object.proof); + } + object.proof_height = null; + } + if (message.acknowledgement != null && message.hasOwnProperty("acknowledgement")) + object.acknowledgement = options.bytes === String ? $util.base64.encode(message.acknowledgement, 0, message.acknowledgement.length) : options.bytes === Array ? Array.prototype.slice.call(message.acknowledgement) : message.acknowledgement; + if (message.proof != null && message.hasOwnProperty("proof")) + object.proof = options.bytes === String ? $util.base64.encode(message.proof, 0, message.proof.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof) : message.proof; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) + object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); + return object; + }; + + /** + * Converts this QueryPacketAcknowledgementResponse to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementResponse + * @instance + * @returns {Object.} JSON object + */ + QueryPacketAcknowledgementResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryPacketAcknowledgementResponse; + })(); + + v1.QueryPacketAcknowledgementsRequest = (function() { + + /** + * Properties of a QueryPacketAcknowledgementsRequest. + * @memberof ibc.core.channel.v1 + * @interface IQueryPacketAcknowledgementsRequest + * @property {string|null} [port_id] QueryPacketAcknowledgementsRequest port_id + * @property {string|null} [channel_id] QueryPacketAcknowledgementsRequest channel_id + * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryPacketAcknowledgementsRequest pagination + */ + + /** + * Constructs a new QueryPacketAcknowledgementsRequest. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a QueryPacketAcknowledgementsRequest. + * @implements IQueryPacketAcknowledgementsRequest + * @constructor + * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementsRequest=} [properties] Properties to set + */ + function QueryPacketAcknowledgementsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryPacketAcknowledgementsRequest port_id. + * @member {string} port_id + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsRequest + * @instance + */ + QueryPacketAcknowledgementsRequest.prototype.port_id = ""; + + /** + * QueryPacketAcknowledgementsRequest channel_id. + * @member {string} channel_id + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsRequest + * @instance + */ + QueryPacketAcknowledgementsRequest.prototype.channel_id = ""; + + /** + * QueryPacketAcknowledgementsRequest pagination. + * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsRequest + * @instance + */ + QueryPacketAcknowledgementsRequest.prototype.pagination = null; + + /** + * Encodes the specified QueryPacketAcknowledgementsRequest message. Does not implicitly {@link ibc.core.channel.v1.QueryPacketAcknowledgementsRequest.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsRequest + * @static + * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementsRequest} message QueryPacketAcknowledgementsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryPacketAcknowledgementsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); + if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryPacketAcknowledgementsRequest message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryPacketAcknowledgementsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsRequest + * @static + * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementsRequest} message QueryPacketAcknowledgementsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryPacketAcknowledgementsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryPacketAcknowledgementsRequest message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.QueryPacketAcknowledgementsRequest} QueryPacketAcknowledgementsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryPacketAcknowledgementsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryPacketAcknowledgementsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.port_id = reader.string(); + break; + case 2: + message.channel_id = reader.string(); + break; + case 3: + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryPacketAcknowledgementsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.QueryPacketAcknowledgementsRequest} QueryPacketAcknowledgementsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryPacketAcknowledgementsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryPacketAcknowledgementsRequest message. + * @function verify + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryPacketAcknowledgementsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.port_id != null && message.hasOwnProperty("port_id")) + if (!$util.isString(message.port_id)) + return "port_id: string expected"; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + if (!$util.isString(message.channel_id)) + return "channel_id: string expected"; + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryPacketAcknowledgementsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsRequest + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.QueryPacketAcknowledgementsRequest} QueryPacketAcknowledgementsRequest + */ + QueryPacketAcknowledgementsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.QueryPacketAcknowledgementsRequest) + return object; + let message = new $root.ibc.core.channel.v1.QueryPacketAcknowledgementsRequest(); + if (object.port_id != null) + message.port_id = String(object.port_id); + if (object.channel_id != null) + message.channel_id = String(object.channel_id); + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".ibc.core.channel.v1.QueryPacketAcknowledgementsRequest.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryPacketAcknowledgementsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsRequest + * @static + * @param {ibc.core.channel.v1.QueryPacketAcknowledgementsRequest} message QueryPacketAcknowledgementsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryPacketAcknowledgementsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.port_id = ""; + object.channel_id = ""; + object.pagination = null; + } + if (message.port_id != null && message.hasOwnProperty("port_id")) + object.port_id = message.port_id; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + object.channel_id = message.channel_id; + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryPacketAcknowledgementsRequest to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryPacketAcknowledgementsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryPacketAcknowledgementsRequest; + })(); + + v1.QueryPacketAcknowledgementsResponse = (function() { + + /** + * Properties of a QueryPacketAcknowledgementsResponse. + * @memberof ibc.core.channel.v1 + * @interface IQueryPacketAcknowledgementsResponse + * @property {Array.|null} [acknowledgements] QueryPacketAcknowledgementsResponse acknowledgements + * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryPacketAcknowledgementsResponse pagination + * @property {ibc.core.client.v1.IHeight|null} [height] QueryPacketAcknowledgementsResponse height + */ + + /** + * Constructs a new QueryPacketAcknowledgementsResponse. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a QueryPacketAcknowledgementsResponse. + * @implements IQueryPacketAcknowledgementsResponse + * @constructor + * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementsResponse=} [properties] Properties to set + */ + function QueryPacketAcknowledgementsResponse(properties) { + this.acknowledgements = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryPacketAcknowledgementsResponse acknowledgements. + * @member {Array.} acknowledgements + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsResponse + * @instance + */ + QueryPacketAcknowledgementsResponse.prototype.acknowledgements = $util.emptyArray; + + /** + * QueryPacketAcknowledgementsResponse pagination. + * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsResponse + * @instance + */ + QueryPacketAcknowledgementsResponse.prototype.pagination = null; + + /** + * QueryPacketAcknowledgementsResponse height. + * @member {ibc.core.client.v1.IHeight|null|undefined} height + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsResponse + * @instance + */ + QueryPacketAcknowledgementsResponse.prototype.height = null; + + /** + * Encodes the specified QueryPacketAcknowledgementsResponse message. Does not implicitly {@link ibc.core.channel.v1.QueryPacketAcknowledgementsResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsResponse + * @static + * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementsResponse} message QueryPacketAcknowledgementsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryPacketAcknowledgementsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.acknowledgements != null && message.acknowledgements.length) + for (let i = 0; i < message.acknowledgements.length; ++i) + $root.ibc.core.channel.v1.PacketState.encode(message.acknowledgements[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + $root.ibc.core.client.v1.Height.encode(message.height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryPacketAcknowledgementsResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryPacketAcknowledgementsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsResponse + * @static + * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementsResponse} message QueryPacketAcknowledgementsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryPacketAcknowledgementsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryPacketAcknowledgementsResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.QueryPacketAcknowledgementsResponse} QueryPacketAcknowledgementsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryPacketAcknowledgementsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryPacketAcknowledgementsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.acknowledgements && message.acknowledgements.length)) + message.acknowledgements = []; + message.acknowledgements.push($root.ibc.core.channel.v1.PacketState.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); + break; + case 3: + message.height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryPacketAcknowledgementsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.QueryPacketAcknowledgementsResponse} QueryPacketAcknowledgementsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryPacketAcknowledgementsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryPacketAcknowledgementsResponse message. + * @function verify + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryPacketAcknowledgementsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.acknowledgements != null && message.hasOwnProperty("acknowledgements")) { + if (!Array.isArray(message.acknowledgements)) + return "acknowledgements: array expected"; + for (let i = 0; i < message.acknowledgements.length; ++i) { + let error = $root.ibc.core.channel.v1.PacketState.verify(message.acknowledgements[i]); + if (error) + return "acknowledgements." + error; + } + } + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); + if (error) + return "pagination." + error; + } + if (message.height != null && message.hasOwnProperty("height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.height); + if (error) + return "height." + error; + } + return null; + }; + + /** + * Creates a QueryPacketAcknowledgementsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.QueryPacketAcknowledgementsResponse} QueryPacketAcknowledgementsResponse + */ + QueryPacketAcknowledgementsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.QueryPacketAcknowledgementsResponse) + return object; + let message = new $root.ibc.core.channel.v1.QueryPacketAcknowledgementsResponse(); + if (object.acknowledgements) { + if (!Array.isArray(object.acknowledgements)) + throw TypeError(".ibc.core.channel.v1.QueryPacketAcknowledgementsResponse.acknowledgements: array expected"); + message.acknowledgements = []; + for (let i = 0; i < object.acknowledgements.length; ++i) { + if (typeof object.acknowledgements[i] !== "object") + throw TypeError(".ibc.core.channel.v1.QueryPacketAcknowledgementsResponse.acknowledgements: object expected"); + message.acknowledgements[i] = $root.ibc.core.channel.v1.PacketState.fromObject(object.acknowledgements[i]); + } + } + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".ibc.core.channel.v1.QueryPacketAcknowledgementsResponse.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); + } + if (object.height != null) { + if (typeof object.height !== "object") + throw TypeError(".ibc.core.channel.v1.QueryPacketAcknowledgementsResponse.height: object expected"); + message.height = $root.ibc.core.client.v1.Height.fromObject(object.height); + } + return message; + }; + + /** + * Creates a plain object from a QueryPacketAcknowledgementsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsResponse + * @static + * @param {ibc.core.channel.v1.QueryPacketAcknowledgementsResponse} message QueryPacketAcknowledgementsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryPacketAcknowledgementsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.acknowledgements = []; + if (options.defaults) { + object.pagination = null; + object.height = null; + } + if (message.acknowledgements && message.acknowledgements.length) { + object.acknowledgements = []; + for (let j = 0; j < message.acknowledgements.length; ++j) + object.acknowledgements[j] = $root.ibc.core.channel.v1.PacketState.toObject(message.acknowledgements[j], options); + } + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); + if (message.height != null && message.hasOwnProperty("height")) + object.height = $root.ibc.core.client.v1.Height.toObject(message.height, options); + return object; + }; + + /** + * Converts this QueryPacketAcknowledgementsResponse to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryPacketAcknowledgementsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryPacketAcknowledgementsResponse; + })(); + + v1.QueryUnreceivedPacketsRequest = (function() { + + /** + * Properties of a QueryUnreceivedPacketsRequest. + * @memberof ibc.core.channel.v1 + * @interface IQueryUnreceivedPacketsRequest + * @property {string|null} [port_id] QueryUnreceivedPacketsRequest port_id + * @property {string|null} [channel_id] QueryUnreceivedPacketsRequest channel_id + * @property {Array.|null} [packet_commitment_sequences] QueryUnreceivedPacketsRequest packet_commitment_sequences + */ + + /** + * Constructs a new QueryUnreceivedPacketsRequest. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a QueryUnreceivedPacketsRequest. + * @implements IQueryUnreceivedPacketsRequest + * @constructor + * @param {ibc.core.channel.v1.IQueryUnreceivedPacketsRequest=} [properties] Properties to set + */ + function QueryUnreceivedPacketsRequest(properties) { + this.packet_commitment_sequences = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryUnreceivedPacketsRequest port_id. + * @member {string} port_id + * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsRequest + * @instance + */ + QueryUnreceivedPacketsRequest.prototype.port_id = ""; + + /** + * QueryUnreceivedPacketsRequest channel_id. + * @member {string} channel_id + * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsRequest + * @instance + */ + QueryUnreceivedPacketsRequest.prototype.channel_id = ""; + + /** + * QueryUnreceivedPacketsRequest packet_commitment_sequences. + * @member {Array.} packet_commitment_sequences + * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsRequest + * @instance + */ + QueryUnreceivedPacketsRequest.prototype.packet_commitment_sequences = $util.emptyArray; + + /** + * Encodes the specified QueryUnreceivedPacketsRequest message. Does not implicitly {@link ibc.core.channel.v1.QueryUnreceivedPacketsRequest.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsRequest + * @static + * @param {ibc.core.channel.v1.IQueryUnreceivedPacketsRequest} message QueryUnreceivedPacketsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryUnreceivedPacketsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); + if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); + if (message.packet_commitment_sequences != null && message.packet_commitment_sequences.length) { + writer.uint32(/* id 3, wireType 2 =*/26).fork(); + for (let i = 0; i < message.packet_commitment_sequences.length; ++i) + writer.uint64(message.packet_commitment_sequences[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified QueryUnreceivedPacketsRequest message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryUnreceivedPacketsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsRequest + * @static + * @param {ibc.core.channel.v1.IQueryUnreceivedPacketsRequest} message QueryUnreceivedPacketsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryUnreceivedPacketsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryUnreceivedPacketsRequest message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.QueryUnreceivedPacketsRequest} QueryUnreceivedPacketsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryUnreceivedPacketsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryUnreceivedPacketsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.port_id = reader.string(); + break; + case 2: + message.channel_id = reader.string(); + break; + case 3: + if (!(message.packet_commitment_sequences && message.packet_commitment_sequences.length)) + message.packet_commitment_sequences = []; + if ((tag & 7) === 2) { + let end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.packet_commitment_sequences.push(reader.uint64()); + } else + message.packet_commitment_sequences.push(reader.uint64()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryUnreceivedPacketsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.QueryUnreceivedPacketsRequest} QueryUnreceivedPacketsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryUnreceivedPacketsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryUnreceivedPacketsRequest message. + * @function verify + * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryUnreceivedPacketsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.port_id != null && message.hasOwnProperty("port_id")) + if (!$util.isString(message.port_id)) + return "port_id: string expected"; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + if (!$util.isString(message.channel_id)) + return "channel_id: string expected"; + if (message.packet_commitment_sequences != null && message.hasOwnProperty("packet_commitment_sequences")) { + if (!Array.isArray(message.packet_commitment_sequences)) + return "packet_commitment_sequences: array expected"; + for (let i = 0; i < message.packet_commitment_sequences.length; ++i) + if (!$util.isInteger(message.packet_commitment_sequences[i]) && !(message.packet_commitment_sequences[i] && $util.isInteger(message.packet_commitment_sequences[i].low) && $util.isInteger(message.packet_commitment_sequences[i].high))) + return "packet_commitment_sequences: integer|Long[] expected"; + } + return null; + }; + + /** + * Creates a QueryUnreceivedPacketsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsRequest + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.QueryUnreceivedPacketsRequest} QueryUnreceivedPacketsRequest + */ + QueryUnreceivedPacketsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.QueryUnreceivedPacketsRequest) + return object; + let message = new $root.ibc.core.channel.v1.QueryUnreceivedPacketsRequest(); + if (object.port_id != null) + message.port_id = String(object.port_id); + if (object.channel_id != null) + message.channel_id = String(object.channel_id); + if (object.packet_commitment_sequences) { + if (!Array.isArray(object.packet_commitment_sequences)) + throw TypeError(".ibc.core.channel.v1.QueryUnreceivedPacketsRequest.packet_commitment_sequences: array expected"); + message.packet_commitment_sequences = []; + for (let i = 0; i < object.packet_commitment_sequences.length; ++i) + if ($util.Long) + (message.packet_commitment_sequences[i] = $util.Long.fromValue(object.packet_commitment_sequences[i])).unsigned = true; + else if (typeof object.packet_commitment_sequences[i] === "string") + message.packet_commitment_sequences[i] = parseInt(object.packet_commitment_sequences[i], 10); + else if (typeof object.packet_commitment_sequences[i] === "number") + message.packet_commitment_sequences[i] = object.packet_commitment_sequences[i]; + else if (typeof object.packet_commitment_sequences[i] === "object") + message.packet_commitment_sequences[i] = new $util.LongBits(object.packet_commitment_sequences[i].low >>> 0, object.packet_commitment_sequences[i].high >>> 0).toNumber(true); + } + return message; + }; + + /** + * Creates a plain object from a QueryUnreceivedPacketsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsRequest + * @static + * @param {ibc.core.channel.v1.QueryUnreceivedPacketsRequest} message QueryUnreceivedPacketsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryUnreceivedPacketsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.packet_commitment_sequences = []; + if (options.defaults) { + object.port_id = ""; + object.channel_id = ""; + } + if (message.port_id != null && message.hasOwnProperty("port_id")) + object.port_id = message.port_id; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + object.channel_id = message.channel_id; + if (message.packet_commitment_sequences && message.packet_commitment_sequences.length) { + object.packet_commitment_sequences = []; + for (let j = 0; j < message.packet_commitment_sequences.length; ++j) + if (typeof message.packet_commitment_sequences[j] === "number") + object.packet_commitment_sequences[j] = options.longs === String ? String(message.packet_commitment_sequences[j]) : message.packet_commitment_sequences[j]; + else + object.packet_commitment_sequences[j] = options.longs === String ? $util.Long.prototype.toString.call(message.packet_commitment_sequences[j]) : options.longs === Number ? new $util.LongBits(message.packet_commitment_sequences[j].low >>> 0, message.packet_commitment_sequences[j].high >>> 0).toNumber(true) : message.packet_commitment_sequences[j]; + } + return object; + }; + + /** + * Converts this QueryUnreceivedPacketsRequest to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryUnreceivedPacketsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryUnreceivedPacketsRequest; + })(); + + v1.QueryUnreceivedPacketsResponse = (function() { + + /** + * Properties of a QueryUnreceivedPacketsResponse. + * @memberof ibc.core.channel.v1 + * @interface IQueryUnreceivedPacketsResponse + * @property {Array.|null} [sequences] QueryUnreceivedPacketsResponse sequences + * @property {ibc.core.client.v1.IHeight|null} [height] QueryUnreceivedPacketsResponse height + */ + + /** + * Constructs a new QueryUnreceivedPacketsResponse. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a QueryUnreceivedPacketsResponse. + * @implements IQueryUnreceivedPacketsResponse + * @constructor + * @param {ibc.core.channel.v1.IQueryUnreceivedPacketsResponse=} [properties] Properties to set + */ + function QueryUnreceivedPacketsResponse(properties) { + this.sequences = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryUnreceivedPacketsResponse sequences. + * @member {Array.} sequences + * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsResponse + * @instance + */ + QueryUnreceivedPacketsResponse.prototype.sequences = $util.emptyArray; + + /** + * QueryUnreceivedPacketsResponse height. + * @member {ibc.core.client.v1.IHeight|null|undefined} height + * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsResponse + * @instance + */ + QueryUnreceivedPacketsResponse.prototype.height = null; + + /** + * Encodes the specified QueryUnreceivedPacketsResponse message. Does not implicitly {@link ibc.core.channel.v1.QueryUnreceivedPacketsResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsResponse + * @static + * @param {ibc.core.channel.v1.IQueryUnreceivedPacketsResponse} message QueryUnreceivedPacketsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryUnreceivedPacketsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sequences != null && message.sequences.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (let i = 0; i < message.sequences.length; ++i) + writer.uint64(message.sequences[i]); + writer.ldelim(); + } + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + $root.ibc.core.client.v1.Height.encode(message.height, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryUnreceivedPacketsResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryUnreceivedPacketsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsResponse + * @static + * @param {ibc.core.channel.v1.IQueryUnreceivedPacketsResponse} message QueryUnreceivedPacketsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryUnreceivedPacketsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryUnreceivedPacketsResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.QueryUnreceivedPacketsResponse} QueryUnreceivedPacketsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryUnreceivedPacketsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryUnreceivedPacketsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.sequences && message.sequences.length)) + message.sequences = []; + if ((tag & 7) === 2) { + let end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.sequences.push(reader.uint64()); + } else + message.sequences.push(reader.uint64()); + break; + case 2: + message.height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryUnreceivedPacketsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.QueryUnreceivedPacketsResponse} QueryUnreceivedPacketsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryUnreceivedPacketsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryUnreceivedPacketsResponse message. + * @function verify + * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryUnreceivedPacketsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sequences != null && message.hasOwnProperty("sequences")) { + if (!Array.isArray(message.sequences)) + return "sequences: array expected"; + for (let i = 0; i < message.sequences.length; ++i) + if (!$util.isInteger(message.sequences[i]) && !(message.sequences[i] && $util.isInteger(message.sequences[i].low) && $util.isInteger(message.sequences[i].high))) + return "sequences: integer|Long[] expected"; + } + if (message.height != null && message.hasOwnProperty("height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.height); + if (error) + return "height." + error; + } + return null; + }; + + /** + * Creates a QueryUnreceivedPacketsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.QueryUnreceivedPacketsResponse} QueryUnreceivedPacketsResponse + */ + QueryUnreceivedPacketsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.QueryUnreceivedPacketsResponse) + return object; + let message = new $root.ibc.core.channel.v1.QueryUnreceivedPacketsResponse(); + if (object.sequences) { + if (!Array.isArray(object.sequences)) + throw TypeError(".ibc.core.channel.v1.QueryUnreceivedPacketsResponse.sequences: array expected"); + message.sequences = []; + for (let i = 0; i < object.sequences.length; ++i) + if ($util.Long) + (message.sequences[i] = $util.Long.fromValue(object.sequences[i])).unsigned = true; + else if (typeof object.sequences[i] === "string") + message.sequences[i] = parseInt(object.sequences[i], 10); + else if (typeof object.sequences[i] === "number") + message.sequences[i] = object.sequences[i]; + else if (typeof object.sequences[i] === "object") + message.sequences[i] = new $util.LongBits(object.sequences[i].low >>> 0, object.sequences[i].high >>> 0).toNumber(true); + } + if (object.height != null) { + if (typeof object.height !== "object") + throw TypeError(".ibc.core.channel.v1.QueryUnreceivedPacketsResponse.height: object expected"); + message.height = $root.ibc.core.client.v1.Height.fromObject(object.height); + } + return message; + }; + + /** + * Creates a plain object from a QueryUnreceivedPacketsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsResponse + * @static + * @param {ibc.core.channel.v1.QueryUnreceivedPacketsResponse} message QueryUnreceivedPacketsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryUnreceivedPacketsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.sequences = []; + if (options.defaults) + object.height = null; + if (message.sequences && message.sequences.length) { + object.sequences = []; + for (let j = 0; j < message.sequences.length; ++j) + if (typeof message.sequences[j] === "number") + object.sequences[j] = options.longs === String ? String(message.sequences[j]) : message.sequences[j]; + else + object.sequences[j] = options.longs === String ? $util.Long.prototype.toString.call(message.sequences[j]) : options.longs === Number ? new $util.LongBits(message.sequences[j].low >>> 0, message.sequences[j].high >>> 0).toNumber(true) : message.sequences[j]; + } + if (message.height != null && message.hasOwnProperty("height")) + object.height = $root.ibc.core.client.v1.Height.toObject(message.height, options); + return object; + }; + + /** + * Converts this QueryUnreceivedPacketsResponse to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryUnreceivedPacketsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryUnreceivedPacketsResponse; + })(); + + v1.QueryUnreceivedAcksRequest = (function() { + + /** + * Properties of a QueryUnreceivedAcksRequest. + * @memberof ibc.core.channel.v1 + * @interface IQueryUnreceivedAcksRequest + * @property {string|null} [port_id] QueryUnreceivedAcksRequest port_id + * @property {string|null} [channel_id] QueryUnreceivedAcksRequest channel_id + * @property {Array.|null} [packet_ack_sequences] QueryUnreceivedAcksRequest packet_ack_sequences + */ + + /** + * Constructs a new QueryUnreceivedAcksRequest. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a QueryUnreceivedAcksRequest. + * @implements IQueryUnreceivedAcksRequest + * @constructor + * @param {ibc.core.channel.v1.IQueryUnreceivedAcksRequest=} [properties] Properties to set + */ + function QueryUnreceivedAcksRequest(properties) { + this.packet_ack_sequences = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryUnreceivedAcksRequest port_id. + * @member {string} port_id + * @memberof ibc.core.channel.v1.QueryUnreceivedAcksRequest + * @instance + */ + QueryUnreceivedAcksRequest.prototype.port_id = ""; + + /** + * QueryUnreceivedAcksRequest channel_id. + * @member {string} channel_id + * @memberof ibc.core.channel.v1.QueryUnreceivedAcksRequest + * @instance + */ + QueryUnreceivedAcksRequest.prototype.channel_id = ""; + + /** + * QueryUnreceivedAcksRequest packet_ack_sequences. + * @member {Array.} packet_ack_sequences + * @memberof ibc.core.channel.v1.QueryUnreceivedAcksRequest + * @instance + */ + QueryUnreceivedAcksRequest.prototype.packet_ack_sequences = $util.emptyArray; + + /** + * Encodes the specified QueryUnreceivedAcksRequest message. Does not implicitly {@link ibc.core.channel.v1.QueryUnreceivedAcksRequest.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.QueryUnreceivedAcksRequest + * @static + * @param {ibc.core.channel.v1.IQueryUnreceivedAcksRequest} message QueryUnreceivedAcksRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryUnreceivedAcksRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); + if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); + if (message.packet_ack_sequences != null && message.packet_ack_sequences.length) { + writer.uint32(/* id 3, wireType 2 =*/26).fork(); + for (let i = 0; i < message.packet_ack_sequences.length; ++i) + writer.uint64(message.packet_ack_sequences[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified QueryUnreceivedAcksRequest message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryUnreceivedAcksRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.QueryUnreceivedAcksRequest + * @static + * @param {ibc.core.channel.v1.IQueryUnreceivedAcksRequest} message QueryUnreceivedAcksRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryUnreceivedAcksRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryUnreceivedAcksRequest message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.QueryUnreceivedAcksRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.QueryUnreceivedAcksRequest} QueryUnreceivedAcksRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryUnreceivedAcksRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryUnreceivedAcksRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.port_id = reader.string(); + break; + case 2: + message.channel_id = reader.string(); + break; + case 3: + if (!(message.packet_ack_sequences && message.packet_ack_sequences.length)) + message.packet_ack_sequences = []; + if ((tag & 7) === 2) { + let end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.packet_ack_sequences.push(reader.uint64()); + } else + message.packet_ack_sequences.push(reader.uint64()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryUnreceivedAcksRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.QueryUnreceivedAcksRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.QueryUnreceivedAcksRequest} QueryUnreceivedAcksRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryUnreceivedAcksRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryUnreceivedAcksRequest message. + * @function verify + * @memberof ibc.core.channel.v1.QueryUnreceivedAcksRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryUnreceivedAcksRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.port_id != null && message.hasOwnProperty("port_id")) + if (!$util.isString(message.port_id)) + return "port_id: string expected"; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + if (!$util.isString(message.channel_id)) + return "channel_id: string expected"; + if (message.packet_ack_sequences != null && message.hasOwnProperty("packet_ack_sequences")) { + if (!Array.isArray(message.packet_ack_sequences)) + return "packet_ack_sequences: array expected"; + for (let i = 0; i < message.packet_ack_sequences.length; ++i) + if (!$util.isInteger(message.packet_ack_sequences[i]) && !(message.packet_ack_sequences[i] && $util.isInteger(message.packet_ack_sequences[i].low) && $util.isInteger(message.packet_ack_sequences[i].high))) + return "packet_ack_sequences: integer|Long[] expected"; + } + return null; + }; + + /** + * Creates a QueryUnreceivedAcksRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.QueryUnreceivedAcksRequest + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.QueryUnreceivedAcksRequest} QueryUnreceivedAcksRequest + */ + QueryUnreceivedAcksRequest.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.QueryUnreceivedAcksRequest) + return object; + let message = new $root.ibc.core.channel.v1.QueryUnreceivedAcksRequest(); + if (object.port_id != null) + message.port_id = String(object.port_id); + if (object.channel_id != null) + message.channel_id = String(object.channel_id); + if (object.packet_ack_sequences) { + if (!Array.isArray(object.packet_ack_sequences)) + throw TypeError(".ibc.core.channel.v1.QueryUnreceivedAcksRequest.packet_ack_sequences: array expected"); + message.packet_ack_sequences = []; + for (let i = 0; i < object.packet_ack_sequences.length; ++i) + if ($util.Long) + (message.packet_ack_sequences[i] = $util.Long.fromValue(object.packet_ack_sequences[i])).unsigned = true; + else if (typeof object.packet_ack_sequences[i] === "string") + message.packet_ack_sequences[i] = parseInt(object.packet_ack_sequences[i], 10); + else if (typeof object.packet_ack_sequences[i] === "number") + message.packet_ack_sequences[i] = object.packet_ack_sequences[i]; + else if (typeof object.packet_ack_sequences[i] === "object") + message.packet_ack_sequences[i] = new $util.LongBits(object.packet_ack_sequences[i].low >>> 0, object.packet_ack_sequences[i].high >>> 0).toNumber(true); + } + return message; + }; + + /** + * Creates a plain object from a QueryUnreceivedAcksRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.QueryUnreceivedAcksRequest + * @static + * @param {ibc.core.channel.v1.QueryUnreceivedAcksRequest} message QueryUnreceivedAcksRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryUnreceivedAcksRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.packet_ack_sequences = []; + if (options.defaults) { + object.port_id = ""; + object.channel_id = ""; + } + if (message.port_id != null && message.hasOwnProperty("port_id")) + object.port_id = message.port_id; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + object.channel_id = message.channel_id; + if (message.packet_ack_sequences && message.packet_ack_sequences.length) { + object.packet_ack_sequences = []; + for (let j = 0; j < message.packet_ack_sequences.length; ++j) + if (typeof message.packet_ack_sequences[j] === "number") + object.packet_ack_sequences[j] = options.longs === String ? String(message.packet_ack_sequences[j]) : message.packet_ack_sequences[j]; + else + object.packet_ack_sequences[j] = options.longs === String ? $util.Long.prototype.toString.call(message.packet_ack_sequences[j]) : options.longs === Number ? new $util.LongBits(message.packet_ack_sequences[j].low >>> 0, message.packet_ack_sequences[j].high >>> 0).toNumber(true) : message.packet_ack_sequences[j]; + } + return object; + }; + + /** + * Converts this QueryUnreceivedAcksRequest to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.QueryUnreceivedAcksRequest + * @instance + * @returns {Object.} JSON object + */ + QueryUnreceivedAcksRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryUnreceivedAcksRequest; + })(); + + v1.QueryUnreceivedAcksResponse = (function() { + + /** + * Properties of a QueryUnreceivedAcksResponse. + * @memberof ibc.core.channel.v1 + * @interface IQueryUnreceivedAcksResponse + * @property {Array.|null} [sequences] QueryUnreceivedAcksResponse sequences + * @property {ibc.core.client.v1.IHeight|null} [height] QueryUnreceivedAcksResponse height + */ + + /** + * Constructs a new QueryUnreceivedAcksResponse. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a QueryUnreceivedAcksResponse. + * @implements IQueryUnreceivedAcksResponse + * @constructor + * @param {ibc.core.channel.v1.IQueryUnreceivedAcksResponse=} [properties] Properties to set + */ + function QueryUnreceivedAcksResponse(properties) { + this.sequences = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryUnreceivedAcksResponse sequences. + * @member {Array.} sequences + * @memberof ibc.core.channel.v1.QueryUnreceivedAcksResponse + * @instance + */ + QueryUnreceivedAcksResponse.prototype.sequences = $util.emptyArray; + + /** + * QueryUnreceivedAcksResponse height. + * @member {ibc.core.client.v1.IHeight|null|undefined} height + * @memberof ibc.core.channel.v1.QueryUnreceivedAcksResponse + * @instance + */ + QueryUnreceivedAcksResponse.prototype.height = null; + + /** + * Encodes the specified QueryUnreceivedAcksResponse message. Does not implicitly {@link ibc.core.channel.v1.QueryUnreceivedAcksResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.QueryUnreceivedAcksResponse + * @static + * @param {ibc.core.channel.v1.IQueryUnreceivedAcksResponse} message QueryUnreceivedAcksResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryUnreceivedAcksResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sequences != null && message.sequences.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (let i = 0; i < message.sequences.length; ++i) + writer.uint64(message.sequences[i]); + writer.ldelim(); + } + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + $root.ibc.core.client.v1.Height.encode(message.height, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryUnreceivedAcksResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryUnreceivedAcksResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.QueryUnreceivedAcksResponse + * @static + * @param {ibc.core.channel.v1.IQueryUnreceivedAcksResponse} message QueryUnreceivedAcksResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryUnreceivedAcksResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryUnreceivedAcksResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.QueryUnreceivedAcksResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.QueryUnreceivedAcksResponse} QueryUnreceivedAcksResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryUnreceivedAcksResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryUnreceivedAcksResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.sequences && message.sequences.length)) + message.sequences = []; + if ((tag & 7) === 2) { + let end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.sequences.push(reader.uint64()); + } else + message.sequences.push(reader.uint64()); + break; + case 2: + message.height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryUnreceivedAcksResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.QueryUnreceivedAcksResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.QueryUnreceivedAcksResponse} QueryUnreceivedAcksResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryUnreceivedAcksResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryUnreceivedAcksResponse message. + * @function verify + * @memberof ibc.core.channel.v1.QueryUnreceivedAcksResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryUnreceivedAcksResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sequences != null && message.hasOwnProperty("sequences")) { + if (!Array.isArray(message.sequences)) + return "sequences: array expected"; + for (let i = 0; i < message.sequences.length; ++i) + if (!$util.isInteger(message.sequences[i]) && !(message.sequences[i] && $util.isInteger(message.sequences[i].low) && $util.isInteger(message.sequences[i].high))) + return "sequences: integer|Long[] expected"; + } + if (message.height != null && message.hasOwnProperty("height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.height); + if (error) + return "height." + error; + } + return null; + }; + + /** + * Creates a QueryUnreceivedAcksResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.QueryUnreceivedAcksResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.QueryUnreceivedAcksResponse} QueryUnreceivedAcksResponse + */ + QueryUnreceivedAcksResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.QueryUnreceivedAcksResponse) + return object; + let message = new $root.ibc.core.channel.v1.QueryUnreceivedAcksResponse(); + if (object.sequences) { + if (!Array.isArray(object.sequences)) + throw TypeError(".ibc.core.channel.v1.QueryUnreceivedAcksResponse.sequences: array expected"); + message.sequences = []; + for (let i = 0; i < object.sequences.length; ++i) + if ($util.Long) + (message.sequences[i] = $util.Long.fromValue(object.sequences[i])).unsigned = true; + else if (typeof object.sequences[i] === "string") + message.sequences[i] = parseInt(object.sequences[i], 10); + else if (typeof object.sequences[i] === "number") + message.sequences[i] = object.sequences[i]; + else if (typeof object.sequences[i] === "object") + message.sequences[i] = new $util.LongBits(object.sequences[i].low >>> 0, object.sequences[i].high >>> 0).toNumber(true); + } + if (object.height != null) { + if (typeof object.height !== "object") + throw TypeError(".ibc.core.channel.v1.QueryUnreceivedAcksResponse.height: object expected"); + message.height = $root.ibc.core.client.v1.Height.fromObject(object.height); + } + return message; + }; + + /** + * Creates a plain object from a QueryUnreceivedAcksResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.QueryUnreceivedAcksResponse + * @static + * @param {ibc.core.channel.v1.QueryUnreceivedAcksResponse} message QueryUnreceivedAcksResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryUnreceivedAcksResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.sequences = []; + if (options.defaults) + object.height = null; + if (message.sequences && message.sequences.length) { + object.sequences = []; + for (let j = 0; j < message.sequences.length; ++j) + if (typeof message.sequences[j] === "number") + object.sequences[j] = options.longs === String ? String(message.sequences[j]) : message.sequences[j]; + else + object.sequences[j] = options.longs === String ? $util.Long.prototype.toString.call(message.sequences[j]) : options.longs === Number ? new $util.LongBits(message.sequences[j].low >>> 0, message.sequences[j].high >>> 0).toNumber(true) : message.sequences[j]; + } + if (message.height != null && message.hasOwnProperty("height")) + object.height = $root.ibc.core.client.v1.Height.toObject(message.height, options); + return object; + }; + + /** + * Converts this QueryUnreceivedAcksResponse to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.QueryUnreceivedAcksResponse + * @instance + * @returns {Object.} JSON object + */ + QueryUnreceivedAcksResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryUnreceivedAcksResponse; + })(); + + v1.QueryNextSequenceReceiveRequest = (function() { + + /** + * Properties of a QueryNextSequenceReceiveRequest. + * @memberof ibc.core.channel.v1 + * @interface IQueryNextSequenceReceiveRequest + * @property {string|null} [port_id] QueryNextSequenceReceiveRequest port_id + * @property {string|null} [channel_id] QueryNextSequenceReceiveRequest channel_id + */ + + /** + * Constructs a new QueryNextSequenceReceiveRequest. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a QueryNextSequenceReceiveRequest. + * @implements IQueryNextSequenceReceiveRequest + * @constructor + * @param {ibc.core.channel.v1.IQueryNextSequenceReceiveRequest=} [properties] Properties to set + */ + function QueryNextSequenceReceiveRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryNextSequenceReceiveRequest port_id. + * @member {string} port_id + * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveRequest + * @instance + */ + QueryNextSequenceReceiveRequest.prototype.port_id = ""; + + /** + * QueryNextSequenceReceiveRequest channel_id. + * @member {string} channel_id + * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveRequest + * @instance + */ + QueryNextSequenceReceiveRequest.prototype.channel_id = ""; + + /** + * Encodes the specified QueryNextSequenceReceiveRequest message. Does not implicitly {@link ibc.core.channel.v1.QueryNextSequenceReceiveRequest.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveRequest + * @static + * @param {ibc.core.channel.v1.IQueryNextSequenceReceiveRequest} message QueryNextSequenceReceiveRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryNextSequenceReceiveRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); + if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); + return writer; + }; + + /** + * Encodes the specified QueryNextSequenceReceiveRequest message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryNextSequenceReceiveRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveRequest + * @static + * @param {ibc.core.channel.v1.IQueryNextSequenceReceiveRequest} message QueryNextSequenceReceiveRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryNextSequenceReceiveRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryNextSequenceReceiveRequest message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.QueryNextSequenceReceiveRequest} QueryNextSequenceReceiveRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryNextSequenceReceiveRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryNextSequenceReceiveRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.port_id = reader.string(); + break; + case 2: + message.channel_id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryNextSequenceReceiveRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.QueryNextSequenceReceiveRequest} QueryNextSequenceReceiveRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryNextSequenceReceiveRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryNextSequenceReceiveRequest message. + * @function verify + * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryNextSequenceReceiveRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.port_id != null && message.hasOwnProperty("port_id")) + if (!$util.isString(message.port_id)) + return "port_id: string expected"; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + if (!$util.isString(message.channel_id)) + return "channel_id: string expected"; + return null; + }; + + /** + * Creates a QueryNextSequenceReceiveRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveRequest + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.QueryNextSequenceReceiveRequest} QueryNextSequenceReceiveRequest + */ + QueryNextSequenceReceiveRequest.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.QueryNextSequenceReceiveRequest) + return object; + let message = new $root.ibc.core.channel.v1.QueryNextSequenceReceiveRequest(); + if (object.port_id != null) + message.port_id = String(object.port_id); + if (object.channel_id != null) + message.channel_id = String(object.channel_id); + return message; + }; + + /** + * Creates a plain object from a QueryNextSequenceReceiveRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveRequest + * @static + * @param {ibc.core.channel.v1.QueryNextSequenceReceiveRequest} message QueryNextSequenceReceiveRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryNextSequenceReceiveRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.port_id = ""; + object.channel_id = ""; + } + if (message.port_id != null && message.hasOwnProperty("port_id")) + object.port_id = message.port_id; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + object.channel_id = message.channel_id; + return object; + }; + + /** + * Converts this QueryNextSequenceReceiveRequest to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveRequest + * @instance + * @returns {Object.} JSON object + */ + QueryNextSequenceReceiveRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryNextSequenceReceiveRequest; + })(); + + v1.QueryNextSequenceReceiveResponse = (function() { + + /** + * Properties of a QueryNextSequenceReceiveResponse. + * @memberof ibc.core.channel.v1 + * @interface IQueryNextSequenceReceiveResponse + * @property {Long|null} [next_sequence_receive] QueryNextSequenceReceiveResponse next_sequence_receive + * @property {Uint8Array|null} [proof] QueryNextSequenceReceiveResponse proof + * @property {ibc.core.client.v1.IHeight|null} [proof_height] QueryNextSequenceReceiveResponse proof_height + */ + + /** + * Constructs a new QueryNextSequenceReceiveResponse. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a QueryNextSequenceReceiveResponse. + * @implements IQueryNextSequenceReceiveResponse + * @constructor + * @param {ibc.core.channel.v1.IQueryNextSequenceReceiveResponse=} [properties] Properties to set + */ + function QueryNextSequenceReceiveResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryNextSequenceReceiveResponse next_sequence_receive. + * @member {Long} next_sequence_receive + * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveResponse + * @instance + */ + QueryNextSequenceReceiveResponse.prototype.next_sequence_receive = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * QueryNextSequenceReceiveResponse proof. + * @member {Uint8Array} proof + * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveResponse + * @instance + */ + QueryNextSequenceReceiveResponse.prototype.proof = $util.newBuffer([]); + + /** + * QueryNextSequenceReceiveResponse proof_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height + * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveResponse + * @instance + */ + QueryNextSequenceReceiveResponse.prototype.proof_height = null; + + /** + * Encodes the specified QueryNextSequenceReceiveResponse message. Does not implicitly {@link ibc.core.channel.v1.QueryNextSequenceReceiveResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveResponse + * @static + * @param {ibc.core.channel.v1.IQueryNextSequenceReceiveResponse} message QueryNextSequenceReceiveResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryNextSequenceReceiveResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.next_sequence_receive != null && Object.hasOwnProperty.call(message, "next_sequence_receive")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.next_sequence_receive); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proof); + if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) + $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryNextSequenceReceiveResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryNextSequenceReceiveResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveResponse + * @static + * @param {ibc.core.channel.v1.IQueryNextSequenceReceiveResponse} message QueryNextSequenceReceiveResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryNextSequenceReceiveResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryNextSequenceReceiveResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.QueryNextSequenceReceiveResponse} QueryNextSequenceReceiveResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryNextSequenceReceiveResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryNextSequenceReceiveResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.next_sequence_receive = reader.uint64(); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryNextSequenceReceiveResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.QueryNextSequenceReceiveResponse} QueryNextSequenceReceiveResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryNextSequenceReceiveResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryNextSequenceReceiveResponse message. + * @function verify + * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryNextSequenceReceiveResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.next_sequence_receive != null && message.hasOwnProperty("next_sequence_receive")) + if (!$util.isInteger(message.next_sequence_receive) && !(message.next_sequence_receive && $util.isInteger(message.next_sequence_receive.low) && $util.isInteger(message.next_sequence_receive.high))) + return "next_sequence_receive: integer|Long expected"; + if (message.proof != null && message.hasOwnProperty("proof")) + if (!(message.proof && typeof message.proof.length === "number" || $util.isString(message.proof))) + return "proof: buffer expected"; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); + if (error) + return "proof_height." + error; + } + return null; + }; + + /** + * Creates a QueryNextSequenceReceiveResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.QueryNextSequenceReceiveResponse} QueryNextSequenceReceiveResponse + */ + QueryNextSequenceReceiveResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.QueryNextSequenceReceiveResponse) + return object; + let message = new $root.ibc.core.channel.v1.QueryNextSequenceReceiveResponse(); + if (object.next_sequence_receive != null) + if ($util.Long) + (message.next_sequence_receive = $util.Long.fromValue(object.next_sequence_receive)).unsigned = true; + else if (typeof object.next_sequence_receive === "string") + message.next_sequence_receive = parseInt(object.next_sequence_receive, 10); + else if (typeof object.next_sequence_receive === "number") + message.next_sequence_receive = object.next_sequence_receive; + else if (typeof object.next_sequence_receive === "object") + message.next_sequence_receive = new $util.LongBits(object.next_sequence_receive.low >>> 0, object.next_sequence_receive.high >>> 0).toNumber(true); + if (object.proof != null) + if (typeof object.proof === "string") + $util.base64.decode(object.proof, message.proof = $util.newBuffer($util.base64.length(object.proof)), 0); + else if (object.proof.length) + message.proof = object.proof; + if (object.proof_height != null) { + if (typeof object.proof_height !== "object") + throw TypeError(".ibc.core.channel.v1.QueryNextSequenceReceiveResponse.proof_height: object expected"); + message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); + } + return message; + }; + + /** + * Creates a plain object from a QueryNextSequenceReceiveResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveResponse + * @static + * @param {ibc.core.channel.v1.QueryNextSequenceReceiveResponse} message QueryNextSequenceReceiveResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryNextSequenceReceiveResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.next_sequence_receive = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.next_sequence_receive = options.longs === String ? "0" : 0; + if (options.bytes === String) + object.proof = ""; + else { + object.proof = []; + if (options.bytes !== Array) + object.proof = $util.newBuffer(object.proof); + } + object.proof_height = null; + } + if (message.next_sequence_receive != null && message.hasOwnProperty("next_sequence_receive")) + if (typeof message.next_sequence_receive === "number") + object.next_sequence_receive = options.longs === String ? String(message.next_sequence_receive) : message.next_sequence_receive; + else + object.next_sequence_receive = options.longs === String ? $util.Long.prototype.toString.call(message.next_sequence_receive) : options.longs === Number ? new $util.LongBits(message.next_sequence_receive.low >>> 0, message.next_sequence_receive.high >>> 0).toNumber(true) : message.next_sequence_receive; + if (message.proof != null && message.hasOwnProperty("proof")) + object.proof = options.bytes === String ? $util.base64.encode(message.proof, 0, message.proof.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof) : message.proof; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) + object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); + return object; + }; + + /** + * Converts this QueryNextSequenceReceiveResponse to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveResponse + * @instance + * @returns {Object.} JSON object + */ + QueryNextSequenceReceiveResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryNextSequenceReceiveResponse; + })(); + + v1.GenesisState = (function() { + + /** + * Properties of a GenesisState. + * @memberof ibc.core.channel.v1 + * @interface IGenesisState + * @property {Array.|null} [channels] GenesisState channels + * @property {Array.|null} [acknowledgements] GenesisState acknowledgements + * @property {Array.|null} [commitments] GenesisState commitments + * @property {Array.|null} [receipts] GenesisState receipts + * @property {Array.|null} [send_sequences] GenesisState send_sequences + * @property {Array.|null} [recv_sequences] GenesisState recv_sequences + * @property {Array.|null} [ack_sequences] GenesisState ack_sequences + * @property {Long|null} [next_channel_sequence] GenesisState next_channel_sequence + */ + + /** + * Constructs a new GenesisState. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a GenesisState. + * @implements IGenesisState + * @constructor + * @param {ibc.core.channel.v1.IGenesisState=} [properties] Properties to set + */ + function GenesisState(properties) { + this.channels = []; + this.acknowledgements = []; + this.commitments = []; + this.receipts = []; + this.send_sequences = []; + this.recv_sequences = []; + this.ack_sequences = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenesisState channels. + * @member {Array.} channels + * @memberof ibc.core.channel.v1.GenesisState + * @instance + */ + GenesisState.prototype.channels = $util.emptyArray; + + /** + * GenesisState acknowledgements. + * @member {Array.} acknowledgements + * @memberof ibc.core.channel.v1.GenesisState + * @instance + */ + GenesisState.prototype.acknowledgements = $util.emptyArray; + + /** + * GenesisState commitments. + * @member {Array.} commitments + * @memberof ibc.core.channel.v1.GenesisState + * @instance + */ + GenesisState.prototype.commitments = $util.emptyArray; + + /** + * GenesisState receipts. + * @member {Array.} receipts + * @memberof ibc.core.channel.v1.GenesisState + * @instance + */ + GenesisState.prototype.receipts = $util.emptyArray; + + /** + * GenesisState send_sequences. + * @member {Array.} send_sequences + * @memberof ibc.core.channel.v1.GenesisState + * @instance + */ + GenesisState.prototype.send_sequences = $util.emptyArray; + + /** + * GenesisState recv_sequences. + * @member {Array.} recv_sequences + * @memberof ibc.core.channel.v1.GenesisState + * @instance + */ + GenesisState.prototype.recv_sequences = $util.emptyArray; + + /** + * GenesisState ack_sequences. + * @member {Array.} ack_sequences + * @memberof ibc.core.channel.v1.GenesisState + * @instance + */ + GenesisState.prototype.ack_sequences = $util.emptyArray; + + /** + * GenesisState next_channel_sequence. + * @member {Long} next_channel_sequence + * @memberof ibc.core.channel.v1.GenesisState + * @instance + */ + GenesisState.prototype.next_channel_sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified GenesisState message. Does not implicitly {@link ibc.core.channel.v1.GenesisState.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.GenesisState + * @static + * @param {ibc.core.channel.v1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.channels != null && message.channels.length) + for (let i = 0; i < message.channels.length; ++i) + $root.ibc.core.channel.v1.IdentifiedChannel.encode(message.channels[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.acknowledgements != null && message.acknowledgements.length) + for (let i = 0; i < message.acknowledgements.length; ++i) + $root.ibc.core.channel.v1.PacketState.encode(message.acknowledgements[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.commitments != null && message.commitments.length) + for (let i = 0; i < message.commitments.length; ++i) + $root.ibc.core.channel.v1.PacketState.encode(message.commitments[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.receipts != null && message.receipts.length) + for (let i = 0; i < message.receipts.length; ++i) + $root.ibc.core.channel.v1.PacketState.encode(message.receipts[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.send_sequences != null && message.send_sequences.length) + for (let i = 0; i < message.send_sequences.length; ++i) + $root.ibc.core.channel.v1.PacketSequence.encode(message.send_sequences[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.recv_sequences != null && message.recv_sequences.length) + for (let i = 0; i < message.recv_sequences.length; ++i) + $root.ibc.core.channel.v1.PacketSequence.encode(message.recv_sequences[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.ack_sequences != null && message.ack_sequences.length) + for (let i = 0; i < message.ack_sequences.length; ++i) + $root.ibc.core.channel.v1.PacketSequence.encode(message.ack_sequences[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.next_channel_sequence != null && Object.hasOwnProperty.call(message, "next_channel_sequence")) + writer.uint32(/* id 8, wireType 0 =*/64).uint64(message.next_channel_sequence); + return writer; + }; + + /** + * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link ibc.core.channel.v1.GenesisState.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.GenesisState + * @static + * @param {ibc.core.channel.v1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.GenesisState(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.channels && message.channels.length)) + message.channels = []; + message.channels.push($root.ibc.core.channel.v1.IdentifiedChannel.decode(reader, reader.uint32())); + break; + case 2: + if (!(message.acknowledgements && message.acknowledgements.length)) + message.acknowledgements = []; + message.acknowledgements.push($root.ibc.core.channel.v1.PacketState.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.commitments && message.commitments.length)) + message.commitments = []; + message.commitments.push($root.ibc.core.channel.v1.PacketState.decode(reader, reader.uint32())); + break; + case 4: + if (!(message.receipts && message.receipts.length)) + message.receipts = []; + message.receipts.push($root.ibc.core.channel.v1.PacketState.decode(reader, reader.uint32())); + break; + case 5: + if (!(message.send_sequences && message.send_sequences.length)) + message.send_sequences = []; + message.send_sequences.push($root.ibc.core.channel.v1.PacketSequence.decode(reader, reader.uint32())); + break; + case 6: + if (!(message.recv_sequences && message.recv_sequences.length)) + message.recv_sequences = []; + message.recv_sequences.push($root.ibc.core.channel.v1.PacketSequence.decode(reader, reader.uint32())); + break; + case 7: + if (!(message.ack_sequences && message.ack_sequences.length)) + message.ack_sequences = []; + message.ack_sequences.push($root.ibc.core.channel.v1.PacketSequence.decode(reader, reader.uint32())); + break; + case 8: + message.next_channel_sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenesisState message. + * @function verify + * @memberof ibc.core.channel.v1.GenesisState + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenesisState.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.channels != null && message.hasOwnProperty("channels")) { + if (!Array.isArray(message.channels)) + return "channels: array expected"; + for (let i = 0; i < message.channels.length; ++i) { + let error = $root.ibc.core.channel.v1.IdentifiedChannel.verify(message.channels[i]); + if (error) + return "channels." + error; + } + } + if (message.acknowledgements != null && message.hasOwnProperty("acknowledgements")) { + if (!Array.isArray(message.acknowledgements)) + return "acknowledgements: array expected"; + for (let i = 0; i < message.acknowledgements.length; ++i) { + let error = $root.ibc.core.channel.v1.PacketState.verify(message.acknowledgements[i]); + if (error) + return "acknowledgements." + error; + } + } + if (message.commitments != null && message.hasOwnProperty("commitments")) { + if (!Array.isArray(message.commitments)) + return "commitments: array expected"; + for (let i = 0; i < message.commitments.length; ++i) { + let error = $root.ibc.core.channel.v1.PacketState.verify(message.commitments[i]); + if (error) + return "commitments." + error; + } + } + if (message.receipts != null && message.hasOwnProperty("receipts")) { + if (!Array.isArray(message.receipts)) + return "receipts: array expected"; + for (let i = 0; i < message.receipts.length; ++i) { + let error = $root.ibc.core.channel.v1.PacketState.verify(message.receipts[i]); + if (error) + return "receipts." + error; + } + } + if (message.send_sequences != null && message.hasOwnProperty("send_sequences")) { + if (!Array.isArray(message.send_sequences)) + return "send_sequences: array expected"; + for (let i = 0; i < message.send_sequences.length; ++i) { + let error = $root.ibc.core.channel.v1.PacketSequence.verify(message.send_sequences[i]); + if (error) + return "send_sequences." + error; + } + } + if (message.recv_sequences != null && message.hasOwnProperty("recv_sequences")) { + if (!Array.isArray(message.recv_sequences)) + return "recv_sequences: array expected"; + for (let i = 0; i < message.recv_sequences.length; ++i) { + let error = $root.ibc.core.channel.v1.PacketSequence.verify(message.recv_sequences[i]); + if (error) + return "recv_sequences." + error; + } + } + if (message.ack_sequences != null && message.hasOwnProperty("ack_sequences")) { + if (!Array.isArray(message.ack_sequences)) + return "ack_sequences: array expected"; + for (let i = 0; i < message.ack_sequences.length; ++i) { + let error = $root.ibc.core.channel.v1.PacketSequence.verify(message.ack_sequences[i]); + if (error) + return "ack_sequences." + error; + } + } + if (message.next_channel_sequence != null && message.hasOwnProperty("next_channel_sequence")) + if (!$util.isInteger(message.next_channel_sequence) && !(message.next_channel_sequence && $util.isInteger(message.next_channel_sequence.low) && $util.isInteger(message.next_channel_sequence.high))) + return "next_channel_sequence: integer|Long expected"; + return null; + }; + + /** + * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.GenesisState + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.GenesisState} GenesisState + */ + GenesisState.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.GenesisState) + return object; + let message = new $root.ibc.core.channel.v1.GenesisState(); + if (object.channels) { + if (!Array.isArray(object.channels)) + throw TypeError(".ibc.core.channel.v1.GenesisState.channels: array expected"); + message.channels = []; + for (let i = 0; i < object.channels.length; ++i) { + if (typeof object.channels[i] !== "object") + throw TypeError(".ibc.core.channel.v1.GenesisState.channels: object expected"); + message.channels[i] = $root.ibc.core.channel.v1.IdentifiedChannel.fromObject(object.channels[i]); + } + } + if (object.acknowledgements) { + if (!Array.isArray(object.acknowledgements)) + throw TypeError(".ibc.core.channel.v1.GenesisState.acknowledgements: array expected"); + message.acknowledgements = []; + for (let i = 0; i < object.acknowledgements.length; ++i) { + if (typeof object.acknowledgements[i] !== "object") + throw TypeError(".ibc.core.channel.v1.GenesisState.acknowledgements: object expected"); + message.acknowledgements[i] = $root.ibc.core.channel.v1.PacketState.fromObject(object.acknowledgements[i]); + } + } + if (object.commitments) { + if (!Array.isArray(object.commitments)) + throw TypeError(".ibc.core.channel.v1.GenesisState.commitments: array expected"); + message.commitments = []; + for (let i = 0; i < object.commitments.length; ++i) { + if (typeof object.commitments[i] !== "object") + throw TypeError(".ibc.core.channel.v1.GenesisState.commitments: object expected"); + message.commitments[i] = $root.ibc.core.channel.v1.PacketState.fromObject(object.commitments[i]); + } + } + if (object.receipts) { + if (!Array.isArray(object.receipts)) + throw TypeError(".ibc.core.channel.v1.GenesisState.receipts: array expected"); + message.receipts = []; + for (let i = 0; i < object.receipts.length; ++i) { + if (typeof object.receipts[i] !== "object") + throw TypeError(".ibc.core.channel.v1.GenesisState.receipts: object expected"); + message.receipts[i] = $root.ibc.core.channel.v1.PacketState.fromObject(object.receipts[i]); + } + } + if (object.send_sequences) { + if (!Array.isArray(object.send_sequences)) + throw TypeError(".ibc.core.channel.v1.GenesisState.send_sequences: array expected"); + message.send_sequences = []; + for (let i = 0; i < object.send_sequences.length; ++i) { + if (typeof object.send_sequences[i] !== "object") + throw TypeError(".ibc.core.channel.v1.GenesisState.send_sequences: object expected"); + message.send_sequences[i] = $root.ibc.core.channel.v1.PacketSequence.fromObject(object.send_sequences[i]); + } + } + if (object.recv_sequences) { + if (!Array.isArray(object.recv_sequences)) + throw TypeError(".ibc.core.channel.v1.GenesisState.recv_sequences: array expected"); + message.recv_sequences = []; + for (let i = 0; i < object.recv_sequences.length; ++i) { + if (typeof object.recv_sequences[i] !== "object") + throw TypeError(".ibc.core.channel.v1.GenesisState.recv_sequences: object expected"); + message.recv_sequences[i] = $root.ibc.core.channel.v1.PacketSequence.fromObject(object.recv_sequences[i]); + } + } + if (object.ack_sequences) { + if (!Array.isArray(object.ack_sequences)) + throw TypeError(".ibc.core.channel.v1.GenesisState.ack_sequences: array expected"); + message.ack_sequences = []; + for (let i = 0; i < object.ack_sequences.length; ++i) { + if (typeof object.ack_sequences[i] !== "object") + throw TypeError(".ibc.core.channel.v1.GenesisState.ack_sequences: object expected"); + message.ack_sequences[i] = $root.ibc.core.channel.v1.PacketSequence.fromObject(object.ack_sequences[i]); + } + } + if (object.next_channel_sequence != null) + if ($util.Long) + (message.next_channel_sequence = $util.Long.fromValue(object.next_channel_sequence)).unsigned = true; + else if (typeof object.next_channel_sequence === "string") + message.next_channel_sequence = parseInt(object.next_channel_sequence, 10); + else if (typeof object.next_channel_sequence === "number") + message.next_channel_sequence = object.next_channel_sequence; + else if (typeof object.next_channel_sequence === "object") + message.next_channel_sequence = new $util.LongBits(object.next_channel_sequence.low >>> 0, object.next_channel_sequence.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a GenesisState message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.GenesisState + * @static + * @param {ibc.core.channel.v1.GenesisState} message GenesisState + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenesisState.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) { + object.channels = []; + object.acknowledgements = []; + object.commitments = []; + object.receipts = []; + object.send_sequences = []; + object.recv_sequences = []; + object.ack_sequences = []; + } + if (options.defaults) + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.next_channel_sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.next_channel_sequence = options.longs === String ? "0" : 0; + if (message.channels && message.channels.length) { + object.channels = []; + for (let j = 0; j < message.channels.length; ++j) + object.channels[j] = $root.ibc.core.channel.v1.IdentifiedChannel.toObject(message.channels[j], options); + } + if (message.acknowledgements && message.acknowledgements.length) { + object.acknowledgements = []; + for (let j = 0; j < message.acknowledgements.length; ++j) + object.acknowledgements[j] = $root.ibc.core.channel.v1.PacketState.toObject(message.acknowledgements[j], options); + } + if (message.commitments && message.commitments.length) { + object.commitments = []; + for (let j = 0; j < message.commitments.length; ++j) + object.commitments[j] = $root.ibc.core.channel.v1.PacketState.toObject(message.commitments[j], options); + } + if (message.receipts && message.receipts.length) { + object.receipts = []; + for (let j = 0; j < message.receipts.length; ++j) + object.receipts[j] = $root.ibc.core.channel.v1.PacketState.toObject(message.receipts[j], options); + } + if (message.send_sequences && message.send_sequences.length) { + object.send_sequences = []; + for (let j = 0; j < message.send_sequences.length; ++j) + object.send_sequences[j] = $root.ibc.core.channel.v1.PacketSequence.toObject(message.send_sequences[j], options); + } + if (message.recv_sequences && message.recv_sequences.length) { + object.recv_sequences = []; + for (let j = 0; j < message.recv_sequences.length; ++j) + object.recv_sequences[j] = $root.ibc.core.channel.v1.PacketSequence.toObject(message.recv_sequences[j], options); + } + if (message.ack_sequences && message.ack_sequences.length) { + object.ack_sequences = []; + for (let j = 0; j < message.ack_sequences.length; ++j) + object.ack_sequences[j] = $root.ibc.core.channel.v1.PacketSequence.toObject(message.ack_sequences[j], options); + } + if (message.next_channel_sequence != null && message.hasOwnProperty("next_channel_sequence")) + if (typeof message.next_channel_sequence === "number") + object.next_channel_sequence = options.longs === String ? String(message.next_channel_sequence) : message.next_channel_sequence; + else + object.next_channel_sequence = options.longs === String ? $util.Long.prototype.toString.call(message.next_channel_sequence) : options.longs === Number ? new $util.LongBits(message.next_channel_sequence.low >>> 0, message.next_channel_sequence.high >>> 0).toNumber(true) : message.next_channel_sequence; + return object; + }; + + /** + * Converts this GenesisState to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.GenesisState + * @instance + * @returns {Object.} JSON object + */ + GenesisState.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenesisState; + })(); + + v1.PacketSequence = (function() { + + /** + * Properties of a PacketSequence. + * @memberof ibc.core.channel.v1 + * @interface IPacketSequence + * @property {string|null} [port_id] PacketSequence port_id + * @property {string|null} [channel_id] PacketSequence channel_id + * @property {Long|null} [sequence] PacketSequence sequence + */ + + /** + * Constructs a new PacketSequence. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a PacketSequence. + * @implements IPacketSequence + * @constructor + * @param {ibc.core.channel.v1.IPacketSequence=} [properties] Properties to set + */ + function PacketSequence(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PacketSequence port_id. + * @member {string} port_id + * @memberof ibc.core.channel.v1.PacketSequence + * @instance + */ + PacketSequence.prototype.port_id = ""; + + /** + * PacketSequence channel_id. + * @member {string} channel_id + * @memberof ibc.core.channel.v1.PacketSequence + * @instance + */ + PacketSequence.prototype.channel_id = ""; + + /** + * PacketSequence sequence. + * @member {Long} sequence + * @memberof ibc.core.channel.v1.PacketSequence + * @instance + */ + PacketSequence.prototype.sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified PacketSequence message. Does not implicitly {@link ibc.core.channel.v1.PacketSequence.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.PacketSequence + * @static + * @param {ibc.core.channel.v1.IPacketSequence} message PacketSequence message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PacketSequence.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); + if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); + if (message.sequence != null && Object.hasOwnProperty.call(message, "sequence")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.sequence); + return writer; + }; + + /** + * Encodes the specified PacketSequence message, length delimited. Does not implicitly {@link ibc.core.channel.v1.PacketSequence.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.PacketSequence + * @static + * @param {ibc.core.channel.v1.IPacketSequence} message PacketSequence message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PacketSequence.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PacketSequence message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.PacketSequence + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.PacketSequence} PacketSequence + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PacketSequence.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.PacketSequence(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.port_id = reader.string(); + break; + case 2: + message.channel_id = reader.string(); + break; + case 3: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PacketSequence message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.PacketSequence + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.PacketSequence} PacketSequence + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PacketSequence.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PacketSequence message. + * @function verify + * @memberof ibc.core.channel.v1.PacketSequence + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PacketSequence.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.port_id != null && message.hasOwnProperty("port_id")) + if (!$util.isString(message.port_id)) + return "port_id: string expected"; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + if (!$util.isString(message.channel_id)) + return "channel_id: string expected"; + if (message.sequence != null && message.hasOwnProperty("sequence")) + if (!$util.isInteger(message.sequence) && !(message.sequence && $util.isInteger(message.sequence.low) && $util.isInteger(message.sequence.high))) + return "sequence: integer|Long expected"; + return null; + }; + + /** + * Creates a PacketSequence message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.PacketSequence + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.PacketSequence} PacketSequence + */ + PacketSequence.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.PacketSequence) + return object; + let message = new $root.ibc.core.channel.v1.PacketSequence(); + if (object.port_id != null) + message.port_id = String(object.port_id); + if (object.channel_id != null) + message.channel_id = String(object.channel_id); + if (object.sequence != null) + if ($util.Long) + (message.sequence = $util.Long.fromValue(object.sequence)).unsigned = true; + else if (typeof object.sequence === "string") + message.sequence = parseInt(object.sequence, 10); + else if (typeof object.sequence === "number") + message.sequence = object.sequence; + else if (typeof object.sequence === "object") + message.sequence = new $util.LongBits(object.sequence.low >>> 0, object.sequence.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a PacketSequence message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.PacketSequence + * @static + * @param {ibc.core.channel.v1.PacketSequence} message PacketSequence + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PacketSequence.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.port_id = ""; + object.channel_id = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.sequence = options.longs === String ? "0" : 0; + } + if (message.port_id != null && message.hasOwnProperty("port_id")) + object.port_id = message.port_id; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + object.channel_id = message.channel_id; + if (message.sequence != null && message.hasOwnProperty("sequence")) + if (typeof message.sequence === "number") + object.sequence = options.longs === String ? String(message.sequence) : message.sequence; + else + object.sequence = options.longs === String ? $util.Long.prototype.toString.call(message.sequence) : options.longs === Number ? new $util.LongBits(message.sequence.low >>> 0, message.sequence.high >>> 0).toNumber(true) : message.sequence; + return object; + }; + + /** + * Converts this PacketSequence to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.PacketSequence + * @instance + * @returns {Object.} JSON object + */ + PacketSequence.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PacketSequence; + })(); + + v1.Channel = (function() { + + /** + * Properties of a Channel. + * @memberof ibc.core.channel.v1 + * @interface IChannel + * @property {ibc.core.channel.v1.State|null} [state] Channel state + * @property {ibc.core.channel.v1.Order|null} [ordering] Channel ordering + * @property {ibc.core.channel.v1.ICounterparty|null} [counterparty] Channel counterparty + * @property {Array.|null} [connection_hops] Channel connection_hops + * @property {string|null} [version] Channel version + */ + + /** + * Constructs a new Channel. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a Channel. + * @implements IChannel + * @constructor + * @param {ibc.core.channel.v1.IChannel=} [properties] Properties to set + */ + function Channel(properties) { + this.connection_hops = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Channel state. + * @member {ibc.core.channel.v1.State} state + * @memberof ibc.core.channel.v1.Channel + * @instance + */ + Channel.prototype.state = 0; + + /** + * Channel ordering. + * @member {ibc.core.channel.v1.Order} ordering + * @memberof ibc.core.channel.v1.Channel + * @instance + */ + Channel.prototype.ordering = 0; + + /** + * Channel counterparty. + * @member {ibc.core.channel.v1.ICounterparty|null|undefined} counterparty + * @memberof ibc.core.channel.v1.Channel + * @instance + */ + Channel.prototype.counterparty = null; + + /** + * Channel connection_hops. + * @member {Array.} connection_hops + * @memberof ibc.core.channel.v1.Channel + * @instance + */ + Channel.prototype.connection_hops = $util.emptyArray; + + /** + * Channel version. + * @member {string} version + * @memberof ibc.core.channel.v1.Channel + * @instance + */ + Channel.prototype.version = ""; + + /** + * Encodes the specified Channel message. Does not implicitly {@link ibc.core.channel.v1.Channel.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.Channel + * @static + * @param {ibc.core.channel.v1.IChannel} message Channel message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Channel.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); + if (message.ordering != null && Object.hasOwnProperty.call(message, "ordering")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.ordering); + if (message.counterparty != null && Object.hasOwnProperty.call(message, "counterparty")) + $root.ibc.core.channel.v1.Counterparty.encode(message.counterparty, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.connection_hops != null && message.connection_hops.length) + for (let i = 0; i < message.connection_hops.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.connection_hops[i]); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.version); + return writer; + }; + + /** + * Encodes the specified Channel message, length delimited. Does not implicitly {@link ibc.core.channel.v1.Channel.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.Channel + * @static + * @param {ibc.core.channel.v1.IChannel} message Channel message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Channel.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Channel message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.Channel + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.Channel} Channel + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Channel.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.Channel(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.state = reader.int32(); + break; + case 2: + message.ordering = reader.int32(); + break; + case 3: + message.counterparty = $root.ibc.core.channel.v1.Counterparty.decode(reader, reader.uint32()); + break; + case 4: + if (!(message.connection_hops && message.connection_hops.length)) + message.connection_hops = []; + message.connection_hops.push(reader.string()); + break; + case 5: + message.version = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Channel message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.Channel + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.Channel} Channel + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Channel.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Channel message. + * @function verify + * @memberof ibc.core.channel.v1.Channel + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Channel.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.ordering != null && message.hasOwnProperty("ordering")) + switch (message.ordering) { + default: + return "ordering: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.counterparty != null && message.hasOwnProperty("counterparty")) { + let error = $root.ibc.core.channel.v1.Counterparty.verify(message.counterparty); + if (error) + return "counterparty." + error; + } + if (message.connection_hops != null && message.hasOwnProperty("connection_hops")) { + if (!Array.isArray(message.connection_hops)) + return "connection_hops: array expected"; + for (let i = 0; i < message.connection_hops.length; ++i) + if (!$util.isString(message.connection_hops[i])) + return "connection_hops: string[] expected"; + } + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + return null; + }; + + /** + * Creates a Channel message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.Channel + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.Channel} Channel + */ + Channel.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.Channel) + return object; + let message = new $root.ibc.core.channel.v1.Channel(); + switch (object.state) { + case "STATE_UNINITIALIZED_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "STATE_INIT": + case 1: + message.state = 1; + break; + case "STATE_TRYOPEN": + case 2: + message.state = 2; + break; + case "STATE_OPEN": + case 3: + message.state = 3; + break; + case "STATE_CLOSED": + case 4: + message.state = 4; + break; + } + switch (object.ordering) { + case "ORDER_NONE_UNSPECIFIED": + case 0: + message.ordering = 0; + break; + case "ORDER_UNORDERED": + case 1: + message.ordering = 1; + break; + case "ORDER_ORDERED": + case 2: + message.ordering = 2; + break; + } + if (object.counterparty != null) { + if (typeof object.counterparty !== "object") + throw TypeError(".ibc.core.channel.v1.Channel.counterparty: object expected"); + message.counterparty = $root.ibc.core.channel.v1.Counterparty.fromObject(object.counterparty); + } + if (object.connection_hops) { + if (!Array.isArray(object.connection_hops)) + throw TypeError(".ibc.core.channel.v1.Channel.connection_hops: array expected"); + message.connection_hops = []; + for (let i = 0; i < object.connection_hops.length; ++i) + message.connection_hops[i] = String(object.connection_hops[i]); + } + if (object.version != null) + message.version = String(object.version); + return message; + }; + + /** + * Creates a plain object from a Channel message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.Channel + * @static + * @param {ibc.core.channel.v1.Channel} message Channel + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Channel.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.connection_hops = []; + if (options.defaults) { + object.state = options.enums === String ? "STATE_UNINITIALIZED_UNSPECIFIED" : 0; + object.ordering = options.enums === String ? "ORDER_NONE_UNSPECIFIED" : 0; + object.counterparty = null; + object.version = ""; + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.ibc.core.channel.v1.State[message.state] : message.state; + if (message.ordering != null && message.hasOwnProperty("ordering")) + object.ordering = options.enums === String ? $root.ibc.core.channel.v1.Order[message.ordering] : message.ordering; + if (message.counterparty != null && message.hasOwnProperty("counterparty")) + object.counterparty = $root.ibc.core.channel.v1.Counterparty.toObject(message.counterparty, options); + if (message.connection_hops && message.connection_hops.length) { + object.connection_hops = []; + for (let j = 0; j < message.connection_hops.length; ++j) + object.connection_hops[j] = message.connection_hops[j]; + } + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + return object; + }; + + /** + * Converts this Channel to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.Channel + * @instance + * @returns {Object.} JSON object + */ + Channel.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Channel; + })(); + + v1.IdentifiedChannel = (function() { + + /** + * Properties of an IdentifiedChannel. + * @memberof ibc.core.channel.v1 + * @interface IIdentifiedChannel + * @property {ibc.core.channel.v1.State|null} [state] IdentifiedChannel state + * @property {ibc.core.channel.v1.Order|null} [ordering] IdentifiedChannel ordering + * @property {ibc.core.channel.v1.ICounterparty|null} [counterparty] IdentifiedChannel counterparty + * @property {Array.|null} [connection_hops] IdentifiedChannel connection_hops + * @property {string|null} [version] IdentifiedChannel version + * @property {string|null} [port_id] IdentifiedChannel port_id + * @property {string|null} [channel_id] IdentifiedChannel channel_id + */ + + /** + * Constructs a new IdentifiedChannel. + * @memberof ibc.core.channel.v1 + * @classdesc Represents an IdentifiedChannel. + * @implements IIdentifiedChannel + * @constructor + * @param {ibc.core.channel.v1.IIdentifiedChannel=} [properties] Properties to set + */ + function IdentifiedChannel(properties) { + this.connection_hops = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * IdentifiedChannel state. + * @member {ibc.core.channel.v1.State} state + * @memberof ibc.core.channel.v1.IdentifiedChannel + * @instance + */ + IdentifiedChannel.prototype.state = 0; + + /** + * IdentifiedChannel ordering. + * @member {ibc.core.channel.v1.Order} ordering + * @memberof ibc.core.channel.v1.IdentifiedChannel + * @instance + */ + IdentifiedChannel.prototype.ordering = 0; + + /** + * IdentifiedChannel counterparty. + * @member {ibc.core.channel.v1.ICounterparty|null|undefined} counterparty + * @memberof ibc.core.channel.v1.IdentifiedChannel + * @instance + */ + IdentifiedChannel.prototype.counterparty = null; + + /** + * IdentifiedChannel connection_hops. + * @member {Array.} connection_hops + * @memberof ibc.core.channel.v1.IdentifiedChannel + * @instance + */ + IdentifiedChannel.prototype.connection_hops = $util.emptyArray; + + /** + * IdentifiedChannel version. + * @member {string} version + * @memberof ibc.core.channel.v1.IdentifiedChannel + * @instance + */ + IdentifiedChannel.prototype.version = ""; + + /** + * IdentifiedChannel port_id. + * @member {string} port_id + * @memberof ibc.core.channel.v1.IdentifiedChannel + * @instance + */ + IdentifiedChannel.prototype.port_id = ""; + + /** + * IdentifiedChannel channel_id. + * @member {string} channel_id + * @memberof ibc.core.channel.v1.IdentifiedChannel + * @instance + */ + IdentifiedChannel.prototype.channel_id = ""; + + /** + * Encodes the specified IdentifiedChannel message. Does not implicitly {@link ibc.core.channel.v1.IdentifiedChannel.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.IdentifiedChannel + * @static + * @param {ibc.core.channel.v1.IIdentifiedChannel} message IdentifiedChannel message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IdentifiedChannel.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); + if (message.ordering != null && Object.hasOwnProperty.call(message, "ordering")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.ordering); + if (message.counterparty != null && Object.hasOwnProperty.call(message, "counterparty")) + $root.ibc.core.channel.v1.Counterparty.encode(message.counterparty, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.connection_hops != null && message.connection_hops.length) + for (let i = 0; i < message.connection_hops.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.connection_hops[i]); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.version); + if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.port_id); + if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.channel_id); + return writer; + }; + + /** + * Encodes the specified IdentifiedChannel message, length delimited. Does not implicitly {@link ibc.core.channel.v1.IdentifiedChannel.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.IdentifiedChannel + * @static + * @param {ibc.core.channel.v1.IIdentifiedChannel} message IdentifiedChannel message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IdentifiedChannel.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an IdentifiedChannel message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.IdentifiedChannel + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.IdentifiedChannel} IdentifiedChannel + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IdentifiedChannel.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.IdentifiedChannel(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.state = reader.int32(); + break; + case 2: + message.ordering = reader.int32(); + break; + case 3: + message.counterparty = $root.ibc.core.channel.v1.Counterparty.decode(reader, reader.uint32()); + break; + case 4: + if (!(message.connection_hops && message.connection_hops.length)) + message.connection_hops = []; + message.connection_hops.push(reader.string()); + break; + case 5: + message.version = reader.string(); + break; + case 6: + message.port_id = reader.string(); + break; + case 7: + message.channel_id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an IdentifiedChannel message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.IdentifiedChannel + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.IdentifiedChannel} IdentifiedChannel + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IdentifiedChannel.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IdentifiedChannel message. + * @function verify + * @memberof ibc.core.channel.v1.IdentifiedChannel + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IdentifiedChannel.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.ordering != null && message.hasOwnProperty("ordering")) + switch (message.ordering) { + default: + return "ordering: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.counterparty != null && message.hasOwnProperty("counterparty")) { + let error = $root.ibc.core.channel.v1.Counterparty.verify(message.counterparty); + if (error) + return "counterparty." + error; + } + if (message.connection_hops != null && message.hasOwnProperty("connection_hops")) { + if (!Array.isArray(message.connection_hops)) + return "connection_hops: array expected"; + for (let i = 0; i < message.connection_hops.length; ++i) + if (!$util.isString(message.connection_hops[i])) + return "connection_hops: string[] expected"; + } + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + if (message.port_id != null && message.hasOwnProperty("port_id")) + if (!$util.isString(message.port_id)) + return "port_id: string expected"; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + if (!$util.isString(message.channel_id)) + return "channel_id: string expected"; + return null; + }; + + /** + * Creates an IdentifiedChannel message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.IdentifiedChannel + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.IdentifiedChannel} IdentifiedChannel + */ + IdentifiedChannel.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.IdentifiedChannel) + return object; + let message = new $root.ibc.core.channel.v1.IdentifiedChannel(); + switch (object.state) { + case "STATE_UNINITIALIZED_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "STATE_INIT": + case 1: + message.state = 1; + break; + case "STATE_TRYOPEN": + case 2: + message.state = 2; + break; + case "STATE_OPEN": + case 3: + message.state = 3; + break; + case "STATE_CLOSED": + case 4: + message.state = 4; + break; + } + switch (object.ordering) { + case "ORDER_NONE_UNSPECIFIED": + case 0: + message.ordering = 0; + break; + case "ORDER_UNORDERED": + case 1: + message.ordering = 1; + break; + case "ORDER_ORDERED": + case 2: + message.ordering = 2; + break; + } + if (object.counterparty != null) { + if (typeof object.counterparty !== "object") + throw TypeError(".ibc.core.channel.v1.IdentifiedChannel.counterparty: object expected"); + message.counterparty = $root.ibc.core.channel.v1.Counterparty.fromObject(object.counterparty); + } + if (object.connection_hops) { + if (!Array.isArray(object.connection_hops)) + throw TypeError(".ibc.core.channel.v1.IdentifiedChannel.connection_hops: array expected"); + message.connection_hops = []; + for (let i = 0; i < object.connection_hops.length; ++i) + message.connection_hops[i] = String(object.connection_hops[i]); + } + if (object.version != null) + message.version = String(object.version); + if (object.port_id != null) + message.port_id = String(object.port_id); + if (object.channel_id != null) + message.channel_id = String(object.channel_id); + return message; + }; + + /** + * Creates a plain object from an IdentifiedChannel message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.IdentifiedChannel + * @static + * @param {ibc.core.channel.v1.IdentifiedChannel} message IdentifiedChannel + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IdentifiedChannel.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.connection_hops = []; + if (options.defaults) { + object.state = options.enums === String ? "STATE_UNINITIALIZED_UNSPECIFIED" : 0; + object.ordering = options.enums === String ? "ORDER_NONE_UNSPECIFIED" : 0; + object.counterparty = null; + object.version = ""; + object.port_id = ""; + object.channel_id = ""; + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.ibc.core.channel.v1.State[message.state] : message.state; + if (message.ordering != null && message.hasOwnProperty("ordering")) + object.ordering = options.enums === String ? $root.ibc.core.channel.v1.Order[message.ordering] : message.ordering; + if (message.counterparty != null && message.hasOwnProperty("counterparty")) + object.counterparty = $root.ibc.core.channel.v1.Counterparty.toObject(message.counterparty, options); + if (message.connection_hops && message.connection_hops.length) { + object.connection_hops = []; + for (let j = 0; j < message.connection_hops.length; ++j) + object.connection_hops[j] = message.connection_hops[j]; + } + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + if (message.port_id != null && message.hasOwnProperty("port_id")) + object.port_id = message.port_id; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + object.channel_id = message.channel_id; + return object; + }; + + /** + * Converts this IdentifiedChannel to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.IdentifiedChannel + * @instance + * @returns {Object.} JSON object + */ + IdentifiedChannel.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return IdentifiedChannel; + })(); + + /** + * State enum. + * @name ibc.core.channel.v1.State + * @enum {number} + * @property {number} STATE_UNINITIALIZED_UNSPECIFIED=0 STATE_UNINITIALIZED_UNSPECIFIED value + * @property {number} STATE_INIT=1 STATE_INIT value + * @property {number} STATE_TRYOPEN=2 STATE_TRYOPEN value + * @property {number} STATE_OPEN=3 STATE_OPEN value + * @property {number} STATE_CLOSED=4 STATE_CLOSED value + */ + v1.State = (function() { + const valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNINITIALIZED_UNSPECIFIED"] = 0; + values[valuesById[1] = "STATE_INIT"] = 1; + values[valuesById[2] = "STATE_TRYOPEN"] = 2; + values[valuesById[3] = "STATE_OPEN"] = 3; + values[valuesById[4] = "STATE_CLOSED"] = 4; + return values; + })(); + + /** + * Order enum. + * @name ibc.core.channel.v1.Order + * @enum {number} + * @property {number} ORDER_NONE_UNSPECIFIED=0 ORDER_NONE_UNSPECIFIED value + * @property {number} ORDER_UNORDERED=1 ORDER_UNORDERED value + * @property {number} ORDER_ORDERED=2 ORDER_ORDERED value + */ + v1.Order = (function() { + const valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ORDER_NONE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ORDER_UNORDERED"] = 1; + values[valuesById[2] = "ORDER_ORDERED"] = 2; + return values; + })(); + + v1.Counterparty = (function() { + + /** + * Properties of a Counterparty. + * @memberof ibc.core.channel.v1 + * @interface ICounterparty + * @property {string|null} [port_id] Counterparty port_id + * @property {string|null} [channel_id] Counterparty channel_id + */ + + /** + * Constructs a new Counterparty. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a Counterparty. + * @implements ICounterparty + * @constructor + * @param {ibc.core.channel.v1.ICounterparty=} [properties] Properties to set + */ + function Counterparty(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Counterparty port_id. + * @member {string} port_id + * @memberof ibc.core.channel.v1.Counterparty + * @instance + */ + Counterparty.prototype.port_id = ""; + + /** + * Counterparty channel_id. + * @member {string} channel_id + * @memberof ibc.core.channel.v1.Counterparty + * @instance + */ + Counterparty.prototype.channel_id = ""; + + /** + * Encodes the specified Counterparty message. Does not implicitly {@link ibc.core.channel.v1.Counterparty.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.Counterparty + * @static + * @param {ibc.core.channel.v1.ICounterparty} message Counterparty message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Counterparty.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); + if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); + return writer; + }; + + /** + * Encodes the specified Counterparty message, length delimited. Does not implicitly {@link ibc.core.channel.v1.Counterparty.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.Counterparty + * @static + * @param {ibc.core.channel.v1.ICounterparty} message Counterparty message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Counterparty.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Counterparty message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.Counterparty + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.Counterparty} Counterparty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Counterparty.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.Counterparty(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.port_id = reader.string(); + break; + case 2: + message.channel_id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Counterparty message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.Counterparty + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.Counterparty} Counterparty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Counterparty.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Counterparty message. + * @function verify + * @memberof ibc.core.channel.v1.Counterparty + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Counterparty.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.port_id != null && message.hasOwnProperty("port_id")) + if (!$util.isString(message.port_id)) + return "port_id: string expected"; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + if (!$util.isString(message.channel_id)) + return "channel_id: string expected"; + return null; + }; + + /** + * Creates a Counterparty message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.Counterparty + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.Counterparty} Counterparty + */ + Counterparty.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.Counterparty) + return object; + let message = new $root.ibc.core.channel.v1.Counterparty(); + if (object.port_id != null) + message.port_id = String(object.port_id); + if (object.channel_id != null) + message.channel_id = String(object.channel_id); + return message; + }; + + /** + * Creates a plain object from a Counterparty message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.Counterparty + * @static + * @param {ibc.core.channel.v1.Counterparty} message Counterparty + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Counterparty.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.port_id = ""; + object.channel_id = ""; + } + if (message.port_id != null && message.hasOwnProperty("port_id")) + object.port_id = message.port_id; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + object.channel_id = message.channel_id; + return object; + }; + + /** + * Converts this Counterparty to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.Counterparty + * @instance + * @returns {Object.} JSON object + */ + Counterparty.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Counterparty; + })(); + + v1.Packet = (function() { + + /** + * Properties of a Packet. + * @memberof ibc.core.channel.v1 + * @interface IPacket + * @property {Long|null} [sequence] Packet sequence + * @property {string|null} [source_port] Packet source_port + * @property {string|null} [source_channel] Packet source_channel + * @property {string|null} [destination_port] Packet destination_port + * @property {string|null} [destination_channel] Packet destination_channel + * @property {Uint8Array|null} [data] Packet data + * @property {ibc.core.client.v1.IHeight|null} [timeout_height] Packet timeout_height + * @property {Long|null} [timeout_timestamp] Packet timeout_timestamp + */ + + /** + * Constructs a new Packet. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a Packet. + * @implements IPacket + * @constructor + * @param {ibc.core.channel.v1.IPacket=} [properties] Properties to set + */ + function Packet(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Packet sequence. + * @member {Long} sequence + * @memberof ibc.core.channel.v1.Packet + * @instance + */ + Packet.prototype.sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Packet source_port. + * @member {string} source_port + * @memberof ibc.core.channel.v1.Packet + * @instance + */ + Packet.prototype.source_port = ""; + + /** + * Packet source_channel. + * @member {string} source_channel + * @memberof ibc.core.channel.v1.Packet + * @instance + */ + Packet.prototype.source_channel = ""; + + /** + * Packet destination_port. + * @member {string} destination_port + * @memberof ibc.core.channel.v1.Packet + * @instance + */ + Packet.prototype.destination_port = ""; + + /** + * Packet destination_channel. + * @member {string} destination_channel + * @memberof ibc.core.channel.v1.Packet + * @instance + */ + Packet.prototype.destination_channel = ""; + + /** + * Packet data. + * @member {Uint8Array} data + * @memberof ibc.core.channel.v1.Packet + * @instance + */ + Packet.prototype.data = $util.newBuffer([]); + + /** + * Packet timeout_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} timeout_height + * @memberof ibc.core.channel.v1.Packet + * @instance + */ + Packet.prototype.timeout_height = null; + + /** + * Packet timeout_timestamp. + * @member {Long} timeout_timestamp + * @memberof ibc.core.channel.v1.Packet + * @instance + */ + Packet.prototype.timeout_timestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified Packet message. Does not implicitly {@link ibc.core.channel.v1.Packet.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.Packet + * @static + * @param {ibc.core.channel.v1.IPacket} message Packet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Packet.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sequence != null && Object.hasOwnProperty.call(message, "sequence")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.sequence); + if (message.source_port != null && Object.hasOwnProperty.call(message, "source_port")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.source_port); + if (message.source_channel != null && Object.hasOwnProperty.call(message, "source_channel")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.source_channel); + if (message.destination_port != null && Object.hasOwnProperty.call(message, "destination_port")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.destination_port); + if (message.destination_channel != null && Object.hasOwnProperty.call(message, "destination_channel")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.destination_channel); + if (message.data != null && Object.hasOwnProperty.call(message, "data")) + writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.data); + if (message.timeout_height != null && Object.hasOwnProperty.call(message, "timeout_height")) + $root.ibc.core.client.v1.Height.encode(message.timeout_height, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.timeout_timestamp != null && Object.hasOwnProperty.call(message, "timeout_timestamp")) + writer.uint32(/* id 8, wireType 0 =*/64).uint64(message.timeout_timestamp); + return writer; + }; + + /** + * Encodes the specified Packet message, length delimited. Does not implicitly {@link ibc.core.channel.v1.Packet.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.Packet + * @static + * @param {ibc.core.channel.v1.IPacket} message Packet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Packet.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Packet message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.Packet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.Packet} Packet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Packet.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.Packet(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sequence = reader.uint64(); + break; + case 2: + message.source_port = reader.string(); + break; + case 3: + message.source_channel = reader.string(); + break; + case 4: + message.destination_port = reader.string(); + break; + case 5: + message.destination_channel = reader.string(); + break; + case 6: + message.data = reader.bytes(); + break; + case 7: + message.timeout_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + case 8: + message.timeout_timestamp = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Packet message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.Packet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.Packet} Packet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Packet.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Packet message. + * @function verify + * @memberof ibc.core.channel.v1.Packet + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Packet.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sequence != null && message.hasOwnProperty("sequence")) + if (!$util.isInteger(message.sequence) && !(message.sequence && $util.isInteger(message.sequence.low) && $util.isInteger(message.sequence.high))) + return "sequence: integer|Long expected"; + if (message.source_port != null && message.hasOwnProperty("source_port")) + if (!$util.isString(message.source_port)) + return "source_port: string expected"; + if (message.source_channel != null && message.hasOwnProperty("source_channel")) + if (!$util.isString(message.source_channel)) + return "source_channel: string expected"; + if (message.destination_port != null && message.hasOwnProperty("destination_port")) + if (!$util.isString(message.destination_port)) + return "destination_port: string expected"; + if (message.destination_channel != null && message.hasOwnProperty("destination_channel")) + if (!$util.isString(message.destination_channel)) + return "destination_channel: string expected"; + if (message.data != null && message.hasOwnProperty("data")) + if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) + return "data: buffer expected"; + if (message.timeout_height != null && message.hasOwnProperty("timeout_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.timeout_height); + if (error) + return "timeout_height." + error; + } + if (message.timeout_timestamp != null && message.hasOwnProperty("timeout_timestamp")) + if (!$util.isInteger(message.timeout_timestamp) && !(message.timeout_timestamp && $util.isInteger(message.timeout_timestamp.low) && $util.isInteger(message.timeout_timestamp.high))) + return "timeout_timestamp: integer|Long expected"; + return null; + }; + + /** + * Creates a Packet message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.Packet + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.Packet} Packet + */ + Packet.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.Packet) + return object; + let message = new $root.ibc.core.channel.v1.Packet(); + if (object.sequence != null) + if ($util.Long) + (message.sequence = $util.Long.fromValue(object.sequence)).unsigned = true; + else if (typeof object.sequence === "string") + message.sequence = parseInt(object.sequence, 10); + else if (typeof object.sequence === "number") + message.sequence = object.sequence; + else if (typeof object.sequence === "object") + message.sequence = new $util.LongBits(object.sequence.low >>> 0, object.sequence.high >>> 0).toNumber(true); + if (object.source_port != null) + message.source_port = String(object.source_port); + if (object.source_channel != null) + message.source_channel = String(object.source_channel); + if (object.destination_port != null) + message.destination_port = String(object.destination_port); + if (object.destination_channel != null) + message.destination_channel = String(object.destination_channel); + if (object.data != null) + if (typeof object.data === "string") + $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); + else if (object.data.length) + message.data = object.data; + if (object.timeout_height != null) { + if (typeof object.timeout_height !== "object") + throw TypeError(".ibc.core.channel.v1.Packet.timeout_height: object expected"); + message.timeout_height = $root.ibc.core.client.v1.Height.fromObject(object.timeout_height); + } + if (object.timeout_timestamp != null) + if ($util.Long) + (message.timeout_timestamp = $util.Long.fromValue(object.timeout_timestamp)).unsigned = true; + else if (typeof object.timeout_timestamp === "string") + message.timeout_timestamp = parseInt(object.timeout_timestamp, 10); + else if (typeof object.timeout_timestamp === "number") + message.timeout_timestamp = object.timeout_timestamp; + else if (typeof object.timeout_timestamp === "object") + message.timeout_timestamp = new $util.LongBits(object.timeout_timestamp.low >>> 0, object.timeout_timestamp.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a Packet message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.Packet + * @static + * @param {ibc.core.channel.v1.Packet} message Packet + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Packet.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.sequence = options.longs === String ? "0" : 0; + object.source_port = ""; + object.source_channel = ""; + object.destination_port = ""; + object.destination_channel = ""; + if (options.bytes === String) + object.data = ""; + else { + object.data = []; + if (options.bytes !== Array) + object.data = $util.newBuffer(object.data); + } + object.timeout_height = null; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.timeout_timestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.timeout_timestamp = options.longs === String ? "0" : 0; + } + if (message.sequence != null && message.hasOwnProperty("sequence")) + if (typeof message.sequence === "number") + object.sequence = options.longs === String ? String(message.sequence) : message.sequence; + else + object.sequence = options.longs === String ? $util.Long.prototype.toString.call(message.sequence) : options.longs === Number ? new $util.LongBits(message.sequence.low >>> 0, message.sequence.high >>> 0).toNumber(true) : message.sequence; + if (message.source_port != null && message.hasOwnProperty("source_port")) + object.source_port = message.source_port; + if (message.source_channel != null && message.hasOwnProperty("source_channel")) + object.source_channel = message.source_channel; + if (message.destination_port != null && message.hasOwnProperty("destination_port")) + object.destination_port = message.destination_port; + if (message.destination_channel != null && message.hasOwnProperty("destination_channel")) + object.destination_channel = message.destination_channel; + if (message.data != null && message.hasOwnProperty("data")) + object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; + if (message.timeout_height != null && message.hasOwnProperty("timeout_height")) + object.timeout_height = $root.ibc.core.client.v1.Height.toObject(message.timeout_height, options); + if (message.timeout_timestamp != null && message.hasOwnProperty("timeout_timestamp")) + if (typeof message.timeout_timestamp === "number") + object.timeout_timestamp = options.longs === String ? String(message.timeout_timestamp) : message.timeout_timestamp; + else + object.timeout_timestamp = options.longs === String ? $util.Long.prototype.toString.call(message.timeout_timestamp) : options.longs === Number ? new $util.LongBits(message.timeout_timestamp.low >>> 0, message.timeout_timestamp.high >>> 0).toNumber(true) : message.timeout_timestamp; + return object; + }; + + /** + * Converts this Packet to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.Packet + * @instance + * @returns {Object.} JSON object + */ + Packet.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Packet; + })(); + + v1.PacketState = (function() { + + /** + * Properties of a PacketState. + * @memberof ibc.core.channel.v1 + * @interface IPacketState + * @property {string|null} [port_id] PacketState port_id + * @property {string|null} [channel_id] PacketState channel_id + * @property {Long|null} [sequence] PacketState sequence + * @property {Uint8Array|null} [data] PacketState data + */ + + /** + * Constructs a new PacketState. + * @memberof ibc.core.channel.v1 + * @classdesc Represents a PacketState. + * @implements IPacketState + * @constructor + * @param {ibc.core.channel.v1.IPacketState=} [properties] Properties to set + */ + function PacketState(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PacketState port_id. + * @member {string} port_id + * @memberof ibc.core.channel.v1.PacketState + * @instance + */ + PacketState.prototype.port_id = ""; + + /** + * PacketState channel_id. + * @member {string} channel_id + * @memberof ibc.core.channel.v1.PacketState + * @instance + */ + PacketState.prototype.channel_id = ""; + + /** + * PacketState sequence. + * @member {Long} sequence + * @memberof ibc.core.channel.v1.PacketState + * @instance + */ + PacketState.prototype.sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * PacketState data. + * @member {Uint8Array} data + * @memberof ibc.core.channel.v1.PacketState + * @instance + */ + PacketState.prototype.data = $util.newBuffer([]); + + /** + * Encodes the specified PacketState message. Does not implicitly {@link ibc.core.channel.v1.PacketState.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.PacketState + * @static + * @param {ibc.core.channel.v1.IPacketState} message PacketState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PacketState.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); + if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); + if (message.sequence != null && Object.hasOwnProperty.call(message, "sequence")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.sequence); + if (message.data != null && Object.hasOwnProperty.call(message, "data")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.data); + return writer; + }; + + /** + * Encodes the specified PacketState message, length delimited. Does not implicitly {@link ibc.core.channel.v1.PacketState.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.PacketState + * @static + * @param {ibc.core.channel.v1.IPacketState} message PacketState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PacketState.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PacketState message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.PacketState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.PacketState} PacketState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PacketState.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.PacketState(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.port_id = reader.string(); + break; + case 2: + message.channel_id = reader.string(); + break; + case 3: + message.sequence = reader.uint64(); + break; + case 4: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PacketState message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.PacketState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.PacketState} PacketState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PacketState.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PacketState message. + * @function verify + * @memberof ibc.core.channel.v1.PacketState + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PacketState.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.port_id != null && message.hasOwnProperty("port_id")) + if (!$util.isString(message.port_id)) + return "port_id: string expected"; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + if (!$util.isString(message.channel_id)) + return "channel_id: string expected"; + if (message.sequence != null && message.hasOwnProperty("sequence")) + if (!$util.isInteger(message.sequence) && !(message.sequence && $util.isInteger(message.sequence.low) && $util.isInteger(message.sequence.high))) + return "sequence: integer|Long expected"; + if (message.data != null && message.hasOwnProperty("data")) + if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) + return "data: buffer expected"; + return null; + }; + + /** + * Creates a PacketState message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.PacketState + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.PacketState} PacketState + */ + PacketState.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.PacketState) + return object; + let message = new $root.ibc.core.channel.v1.PacketState(); + if (object.port_id != null) + message.port_id = String(object.port_id); + if (object.channel_id != null) + message.channel_id = String(object.channel_id); + if (object.sequence != null) + if ($util.Long) + (message.sequence = $util.Long.fromValue(object.sequence)).unsigned = true; + else if (typeof object.sequence === "string") + message.sequence = parseInt(object.sequence, 10); + else if (typeof object.sequence === "number") + message.sequence = object.sequence; + else if (typeof object.sequence === "object") + message.sequence = new $util.LongBits(object.sequence.low >>> 0, object.sequence.high >>> 0).toNumber(true); + if (object.data != null) + if (typeof object.data === "string") + $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); + else if (object.data.length) + message.data = object.data; + return message; + }; + + /** + * Creates a plain object from a PacketState message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.PacketState + * @static + * @param {ibc.core.channel.v1.PacketState} message PacketState + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PacketState.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.port_id = ""; + object.channel_id = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.sequence = options.longs === String ? "0" : 0; + if (options.bytes === String) + object.data = ""; + else { + object.data = []; + if (options.bytes !== Array) + object.data = $util.newBuffer(object.data); + } + } + if (message.port_id != null && message.hasOwnProperty("port_id")) + object.port_id = message.port_id; + if (message.channel_id != null && message.hasOwnProperty("channel_id")) + object.channel_id = message.channel_id; + if (message.sequence != null && message.hasOwnProperty("sequence")) + if (typeof message.sequence === "number") + object.sequence = options.longs === String ? String(message.sequence) : message.sequence; + else + object.sequence = options.longs === String ? $util.Long.prototype.toString.call(message.sequence) : options.longs === Number ? new $util.LongBits(message.sequence.low >>> 0, message.sequence.high >>> 0).toNumber(true) : message.sequence; + if (message.data != null && message.hasOwnProperty("data")) + object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; + return object; + }; + + /** + * Converts this PacketState to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.PacketState + * @instance + * @returns {Object.} JSON object + */ + PacketState.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PacketState; + })(); + + v1.Acknowledgement = (function() { + + /** + * Properties of an Acknowledgement. + * @memberof ibc.core.channel.v1 + * @interface IAcknowledgement + * @property {Uint8Array|null} [result] Acknowledgement result + * @property {string|null} [error] Acknowledgement error + */ + + /** + * Constructs a new Acknowledgement. + * @memberof ibc.core.channel.v1 + * @classdesc Represents an Acknowledgement. + * @implements IAcknowledgement + * @constructor + * @param {ibc.core.channel.v1.IAcknowledgement=} [properties] Properties to set + */ + function Acknowledgement(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Acknowledgement result. + * @member {Uint8Array} result + * @memberof ibc.core.channel.v1.Acknowledgement + * @instance + */ + Acknowledgement.prototype.result = $util.newBuffer([]); + + /** + * Acknowledgement error. + * @member {string} error + * @memberof ibc.core.channel.v1.Acknowledgement + * @instance + */ + Acknowledgement.prototype.error = ""; + + // OneOf field names bound to virtual getters and setters + let $oneOfFields; + + /** + * Acknowledgement response. + * @member {"result"|"error"|undefined} response + * @memberof ibc.core.channel.v1.Acknowledgement + * @instance + */ + Object.defineProperty(Acknowledgement.prototype, "response", { + get: $util.oneOfGetter($oneOfFields = ["result", "error"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Encodes the specified Acknowledgement message. Does not implicitly {@link ibc.core.channel.v1.Acknowledgement.verify|verify} messages. + * @function encode + * @memberof ibc.core.channel.v1.Acknowledgement + * @static + * @param {ibc.core.channel.v1.IAcknowledgement} message Acknowledgement message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Acknowledgement.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.result != null && Object.hasOwnProperty.call(message, "result")) + writer.uint32(/* id 21, wireType 2 =*/170).bytes(message.result); + if (message.error != null && Object.hasOwnProperty.call(message, "error")) + writer.uint32(/* id 22, wireType 2 =*/178).string(message.error); + return writer; + }; + + /** + * Encodes the specified Acknowledgement message, length delimited. Does not implicitly {@link ibc.core.channel.v1.Acknowledgement.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.channel.v1.Acknowledgement + * @static + * @param {ibc.core.channel.v1.IAcknowledgement} message Acknowledgement message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Acknowledgement.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Acknowledgement message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.channel.v1.Acknowledgement + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.channel.v1.Acknowledgement} Acknowledgement + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Acknowledgement.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.Acknowledgement(); + while (reader.pos < end) { + let 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; + }; + + /** + * Decodes an Acknowledgement message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.channel.v1.Acknowledgement + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.channel.v1.Acknowledgement} Acknowledgement + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Acknowledgement.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Acknowledgement message. + * @function verify + * @memberof ibc.core.channel.v1.Acknowledgement + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Acknowledgement.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + let properties = {}; + if (message.result != null && message.hasOwnProperty("result")) { + properties.response = 1; + if (!(message.result && typeof message.result.length === "number" || $util.isString(message.result))) + return "result: buffer expected"; + } + if (message.error != null && message.hasOwnProperty("error")) { + if (properties.response === 1) + return "response: multiple values"; + properties.response = 1; + if (!$util.isString(message.error)) + return "error: string expected"; + } + return null; + }; + + /** + * Creates an Acknowledgement message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.channel.v1.Acknowledgement + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.channel.v1.Acknowledgement} Acknowledgement + */ + Acknowledgement.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.channel.v1.Acknowledgement) + return object; + let message = new $root.ibc.core.channel.v1.Acknowledgement(); + if (object.result != null) + if (typeof object.result === "string") + $util.base64.decode(object.result, message.result = $util.newBuffer($util.base64.length(object.result)), 0); + else if (object.result.length) + message.result = object.result; + if (object.error != null) + message.error = String(object.error); + return message; + }; + + /** + * Creates a plain object from an Acknowledgement message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.channel.v1.Acknowledgement + * @static + * @param {ibc.core.channel.v1.Acknowledgement} message Acknowledgement + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Acknowledgement.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (message.result != null && message.hasOwnProperty("result")) { + object.result = options.bytes === String ? $util.base64.encode(message.result, 0, message.result.length) : options.bytes === Array ? Array.prototype.slice.call(message.result) : message.result; + if (options.oneofs) + object.response = "result"; + } + if (message.error != null && message.hasOwnProperty("error")) { + object.error = message.error; + if (options.oneofs) + object.response = "error"; + } + return object; + }; + + /** + * Converts this Acknowledgement to JSON. + * @function toJSON + * @memberof ibc.core.channel.v1.Acknowledgement + * @instance + * @returns {Object.} JSON object + */ + Acknowledgement.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Acknowledgement; + })(); + + return v1; + })(); + + return channel; + })(); + + core.client = (function() { + + /** + * Namespace client. + * @memberof ibc.core + * @namespace + */ + const client = {}; + + client.v1 = (function() { + + /** + * Namespace v1. + * @memberof ibc.core.client + * @namespace + */ + const v1 = {}; + + v1.Msg = (function() { + + /** + * Constructs a new Msg service. + * @memberof ibc.core.client.v1 + * @classdesc Represents a Msg + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Msg(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Msg.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Msg; + + /** + * Callback as used by {@link ibc.core.client.v1.Msg#createClient}. + * @memberof ibc.core.client.v1.Msg + * @typedef CreateClientCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.client.v1.MsgCreateClientResponse} [response] MsgCreateClientResponse + */ + + /** + * Calls CreateClient. + * @function createClient + * @memberof ibc.core.client.v1.Msg + * @instance + * @param {ibc.core.client.v1.IMsgCreateClient} request MsgCreateClient message or plain object + * @param {ibc.core.client.v1.Msg.CreateClientCallback} callback Node-style callback called with the error, if any, and MsgCreateClientResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.createClient = function createClient(request, callback) { + return this.rpcCall(createClient, $root.ibc.core.client.v1.MsgCreateClient, $root.ibc.core.client.v1.MsgCreateClientResponse, request, callback); + }, "name", { value: "CreateClient" }); + + /** + * Calls CreateClient. + * @function createClient + * @memberof ibc.core.client.v1.Msg + * @instance + * @param {ibc.core.client.v1.IMsgCreateClient} request MsgCreateClient message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.client.v1.Msg#updateClient}. + * @memberof ibc.core.client.v1.Msg + * @typedef UpdateClientCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.client.v1.MsgUpdateClientResponse} [response] MsgUpdateClientResponse + */ + + /** + * Calls UpdateClient. + * @function updateClient + * @memberof ibc.core.client.v1.Msg + * @instance + * @param {ibc.core.client.v1.IMsgUpdateClient} request MsgUpdateClient message or plain object + * @param {ibc.core.client.v1.Msg.UpdateClientCallback} callback Node-style callback called with the error, if any, and MsgUpdateClientResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.updateClient = function updateClient(request, callback) { + return this.rpcCall(updateClient, $root.ibc.core.client.v1.MsgUpdateClient, $root.ibc.core.client.v1.MsgUpdateClientResponse, request, callback); + }, "name", { value: "UpdateClient" }); + + /** + * Calls UpdateClient. + * @function updateClient + * @memberof ibc.core.client.v1.Msg + * @instance + * @param {ibc.core.client.v1.IMsgUpdateClient} request MsgUpdateClient message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.client.v1.Msg#upgradeClient}. + * @memberof ibc.core.client.v1.Msg + * @typedef UpgradeClientCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.client.v1.MsgUpgradeClientResponse} [response] MsgUpgradeClientResponse + */ + + /** + * Calls UpgradeClient. + * @function upgradeClient + * @memberof ibc.core.client.v1.Msg + * @instance + * @param {ibc.core.client.v1.IMsgUpgradeClient} request MsgUpgradeClient message or plain object + * @param {ibc.core.client.v1.Msg.UpgradeClientCallback} callback Node-style callback called with the error, if any, and MsgUpgradeClientResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.upgradeClient = function upgradeClient(request, callback) { + return this.rpcCall(upgradeClient, $root.ibc.core.client.v1.MsgUpgradeClient, $root.ibc.core.client.v1.MsgUpgradeClientResponse, request, callback); + }, "name", { value: "UpgradeClient" }); + + /** + * Calls UpgradeClient. + * @function upgradeClient + * @memberof ibc.core.client.v1.Msg + * @instance + * @param {ibc.core.client.v1.IMsgUpgradeClient} request MsgUpgradeClient message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.client.v1.Msg#submitMisbehaviour}. + * @memberof ibc.core.client.v1.Msg + * @typedef SubmitMisbehaviourCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.client.v1.MsgSubmitMisbehaviourResponse} [response] MsgSubmitMisbehaviourResponse + */ + + /** + * Calls SubmitMisbehaviour. + * @function submitMisbehaviour + * @memberof ibc.core.client.v1.Msg + * @instance + * @param {ibc.core.client.v1.IMsgSubmitMisbehaviour} request MsgSubmitMisbehaviour message or plain object + * @param {ibc.core.client.v1.Msg.SubmitMisbehaviourCallback} callback Node-style callback called with the error, if any, and MsgSubmitMisbehaviourResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.submitMisbehaviour = function submitMisbehaviour(request, callback) { + return this.rpcCall(submitMisbehaviour, $root.ibc.core.client.v1.MsgSubmitMisbehaviour, $root.ibc.core.client.v1.MsgSubmitMisbehaviourResponse, request, callback); + }, "name", { value: "SubmitMisbehaviour" }); + + /** + * Calls SubmitMisbehaviour. + * @function submitMisbehaviour + * @memberof ibc.core.client.v1.Msg + * @instance + * @param {ibc.core.client.v1.IMsgSubmitMisbehaviour} request MsgSubmitMisbehaviour message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Msg; + })(); + + v1.MsgCreateClient = (function() { + + /** + * Properties of a MsgCreateClient. + * @memberof ibc.core.client.v1 + * @interface IMsgCreateClient + * @property {google.protobuf.IAny|null} [client_state] MsgCreateClient client_state + * @property {google.protobuf.IAny|null} [consensus_state] MsgCreateClient consensus_state + * @property {string|null} [signer] MsgCreateClient signer + */ + + /** + * Constructs a new MsgCreateClient. + * @memberof ibc.core.client.v1 + * @classdesc Represents a MsgCreateClient. + * @implements IMsgCreateClient + * @constructor + * @param {ibc.core.client.v1.IMsgCreateClient=} [properties] Properties to set + */ + function MsgCreateClient(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgCreateClient client_state. + * @member {google.protobuf.IAny|null|undefined} client_state + * @memberof ibc.core.client.v1.MsgCreateClient + * @instance + */ + MsgCreateClient.prototype.client_state = null; + + /** + * MsgCreateClient consensus_state. + * @member {google.protobuf.IAny|null|undefined} consensus_state + * @memberof ibc.core.client.v1.MsgCreateClient + * @instance + */ + MsgCreateClient.prototype.consensus_state = null; + + /** + * MsgCreateClient signer. + * @member {string} signer + * @memberof ibc.core.client.v1.MsgCreateClient + * @instance + */ + MsgCreateClient.prototype.signer = ""; + + /** + * Encodes the specified MsgCreateClient message. Does not implicitly {@link ibc.core.client.v1.MsgCreateClient.verify|verify} messages. + * @function encode + * @memberof ibc.core.client.v1.MsgCreateClient + * @static + * @param {ibc.core.client.v1.IMsgCreateClient} message MsgCreateClient message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgCreateClient.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.client_state != null && Object.hasOwnProperty.call(message, "client_state")) + $root.google.protobuf.Any.encode(message.client_state, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.consensus_state != null && Object.hasOwnProperty.call(message, "consensus_state")) + $root.google.protobuf.Any.encode(message.consensus_state, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.signer); + return writer; + }; + + /** + * Encodes the specified MsgCreateClient message, length delimited. Does not implicitly {@link ibc.core.client.v1.MsgCreateClient.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.client.v1.MsgCreateClient + * @static + * @param {ibc.core.client.v1.IMsgCreateClient} message MsgCreateClient message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgCreateClient.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgCreateClient message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.client.v1.MsgCreateClient + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.client.v1.MsgCreateClient} MsgCreateClient + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgCreateClient.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.MsgCreateClient(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.client_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 2: + message.consensus_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgCreateClient message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.client.v1.MsgCreateClient + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.client.v1.MsgCreateClient} MsgCreateClient + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgCreateClient.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgCreateClient message. + * @function verify + * @memberof ibc.core.client.v1.MsgCreateClient + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgCreateClient.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.client_state != null && message.hasOwnProperty("client_state")) { + let error = $root.google.protobuf.Any.verify(message.client_state); + if (error) + return "client_state." + error; + } + if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) { + let error = $root.google.protobuf.Any.verify(message.consensus_state); + if (error) + return "consensus_state." + error; + } + if (message.signer != null && message.hasOwnProperty("signer")) + if (!$util.isString(message.signer)) + return "signer: string expected"; + return null; + }; + + /** + * Creates a MsgCreateClient message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.client.v1.MsgCreateClient + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.client.v1.MsgCreateClient} MsgCreateClient + */ + MsgCreateClient.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.client.v1.MsgCreateClient) + return object; + let message = new $root.ibc.core.client.v1.MsgCreateClient(); + if (object.client_state != null) { + if (typeof object.client_state !== "object") + throw TypeError(".ibc.core.client.v1.MsgCreateClient.client_state: object expected"); + message.client_state = $root.google.protobuf.Any.fromObject(object.client_state); + } + if (object.consensus_state != null) { + if (typeof object.consensus_state !== "object") + throw TypeError(".ibc.core.client.v1.MsgCreateClient.consensus_state: object expected"); + message.consensus_state = $root.google.protobuf.Any.fromObject(object.consensus_state); + } + if (object.signer != null) + message.signer = String(object.signer); + return message; + }; + + /** + * Creates a plain object from a MsgCreateClient message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.client.v1.MsgCreateClient + * @static + * @param {ibc.core.client.v1.MsgCreateClient} message MsgCreateClient + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgCreateClient.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.client_state = null; + object.consensus_state = null; + object.signer = ""; + } + if (message.client_state != null && message.hasOwnProperty("client_state")) + object.client_state = $root.google.protobuf.Any.toObject(message.client_state, options); + if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) + object.consensus_state = $root.google.protobuf.Any.toObject(message.consensus_state, options); + if (message.signer != null && message.hasOwnProperty("signer")) + object.signer = message.signer; + return object; + }; + + /** + * Converts this MsgCreateClient to JSON. + * @function toJSON + * @memberof ibc.core.client.v1.MsgCreateClient + * @instance + * @returns {Object.} JSON object + */ + MsgCreateClient.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgCreateClient; + })(); + + v1.MsgCreateClientResponse = (function() { + + /** + * Properties of a MsgCreateClientResponse. + * @memberof ibc.core.client.v1 + * @interface IMsgCreateClientResponse + */ + + /** + * Constructs a new MsgCreateClientResponse. + * @memberof ibc.core.client.v1 + * @classdesc Represents a MsgCreateClientResponse. + * @implements IMsgCreateClientResponse + * @constructor + * @param {ibc.core.client.v1.IMsgCreateClientResponse=} [properties] Properties to set + */ + function MsgCreateClientResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgCreateClientResponse message. Does not implicitly {@link ibc.core.client.v1.MsgCreateClientResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.client.v1.MsgCreateClientResponse + * @static + * @param {ibc.core.client.v1.IMsgCreateClientResponse} message MsgCreateClientResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgCreateClientResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgCreateClientResponse message, length delimited. Does not implicitly {@link ibc.core.client.v1.MsgCreateClientResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.client.v1.MsgCreateClientResponse + * @static + * @param {ibc.core.client.v1.IMsgCreateClientResponse} message MsgCreateClientResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgCreateClientResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgCreateClientResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.client.v1.MsgCreateClientResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.client.v1.MsgCreateClientResponse} MsgCreateClientResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgCreateClientResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.MsgCreateClientResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgCreateClientResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.client.v1.MsgCreateClientResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.client.v1.MsgCreateClientResponse} MsgCreateClientResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgCreateClientResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgCreateClientResponse message. + * @function verify + * @memberof ibc.core.client.v1.MsgCreateClientResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgCreateClientResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgCreateClientResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.client.v1.MsgCreateClientResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.client.v1.MsgCreateClientResponse} MsgCreateClientResponse + */ + MsgCreateClientResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.client.v1.MsgCreateClientResponse) + return object; + return new $root.ibc.core.client.v1.MsgCreateClientResponse(); + }; + + /** + * Creates a plain object from a MsgCreateClientResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.client.v1.MsgCreateClientResponse + * @static + * @param {ibc.core.client.v1.MsgCreateClientResponse} message MsgCreateClientResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgCreateClientResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgCreateClientResponse to JSON. + * @function toJSON + * @memberof ibc.core.client.v1.MsgCreateClientResponse + * @instance + * @returns {Object.} JSON object + */ + MsgCreateClientResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgCreateClientResponse; + })(); + + v1.MsgUpdateClient = (function() { + + /** + * Properties of a MsgUpdateClient. + * @memberof ibc.core.client.v1 + * @interface IMsgUpdateClient + * @property {string|null} [client_id] MsgUpdateClient client_id + * @property {google.protobuf.IAny|null} [header] MsgUpdateClient header + * @property {string|null} [signer] MsgUpdateClient signer + */ + + /** + * Constructs a new MsgUpdateClient. + * @memberof ibc.core.client.v1 + * @classdesc Represents a MsgUpdateClient. + * @implements IMsgUpdateClient + * @constructor + * @param {ibc.core.client.v1.IMsgUpdateClient=} [properties] Properties to set + */ + function MsgUpdateClient(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgUpdateClient client_id. + * @member {string} client_id + * @memberof ibc.core.client.v1.MsgUpdateClient + * @instance + */ + MsgUpdateClient.prototype.client_id = ""; + + /** + * MsgUpdateClient header. + * @member {google.protobuf.IAny|null|undefined} header + * @memberof ibc.core.client.v1.MsgUpdateClient + * @instance + */ + MsgUpdateClient.prototype.header = null; + + /** + * MsgUpdateClient signer. + * @member {string} signer + * @memberof ibc.core.client.v1.MsgUpdateClient + * @instance + */ + MsgUpdateClient.prototype.signer = ""; + + /** + * Encodes the specified MsgUpdateClient message. Does not implicitly {@link ibc.core.client.v1.MsgUpdateClient.verify|verify} messages. + * @function encode + * @memberof ibc.core.client.v1.MsgUpdateClient + * @static + * @param {ibc.core.client.v1.IMsgUpdateClient} message MsgUpdateClient message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgUpdateClient.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); + if (message.header != null && Object.hasOwnProperty.call(message, "header")) + $root.google.protobuf.Any.encode(message.header, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.signer); + return writer; + }; + + /** + * Encodes the specified MsgUpdateClient message, length delimited. Does not implicitly {@link ibc.core.client.v1.MsgUpdateClient.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.client.v1.MsgUpdateClient + * @static + * @param {ibc.core.client.v1.IMsgUpdateClient} message MsgUpdateClient message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgUpdateClient.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgUpdateClient message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.client.v1.MsgUpdateClient + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.client.v1.MsgUpdateClient} MsgUpdateClient + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgUpdateClient.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.MsgUpdateClient(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.client_id = reader.string(); + break; + case 2: + message.header = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgUpdateClient message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.client.v1.MsgUpdateClient + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.client.v1.MsgUpdateClient} MsgUpdateClient + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgUpdateClient.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgUpdateClient message. + * @function verify + * @memberof ibc.core.client.v1.MsgUpdateClient + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgUpdateClient.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.client_id != null && message.hasOwnProperty("client_id")) + if (!$util.isString(message.client_id)) + return "client_id: string expected"; + if (message.header != null && message.hasOwnProperty("header")) { + let error = $root.google.protobuf.Any.verify(message.header); + if (error) + return "header." + error; + } + if (message.signer != null && message.hasOwnProperty("signer")) + if (!$util.isString(message.signer)) + return "signer: string expected"; + return null; + }; + + /** + * Creates a MsgUpdateClient message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.client.v1.MsgUpdateClient + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.client.v1.MsgUpdateClient} MsgUpdateClient + */ + MsgUpdateClient.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.client.v1.MsgUpdateClient) + return object; + let message = new $root.ibc.core.client.v1.MsgUpdateClient(); + if (object.client_id != null) + message.client_id = String(object.client_id); + if (object.header != null) { + if (typeof object.header !== "object") + throw TypeError(".ibc.core.client.v1.MsgUpdateClient.header: object expected"); + message.header = $root.google.protobuf.Any.fromObject(object.header); + } + if (object.signer != null) + message.signer = String(object.signer); + return message; + }; + + /** + * Creates a plain object from a MsgUpdateClient message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.client.v1.MsgUpdateClient + * @static + * @param {ibc.core.client.v1.MsgUpdateClient} message MsgUpdateClient + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgUpdateClient.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.client_id = ""; + object.header = null; + object.signer = ""; + } + if (message.client_id != null && message.hasOwnProperty("client_id")) + object.client_id = message.client_id; + if (message.header != null && message.hasOwnProperty("header")) + object.header = $root.google.protobuf.Any.toObject(message.header, options); + if (message.signer != null && message.hasOwnProperty("signer")) + object.signer = message.signer; + return object; + }; + + /** + * Converts this MsgUpdateClient to JSON. + * @function toJSON + * @memberof ibc.core.client.v1.MsgUpdateClient + * @instance + * @returns {Object.} JSON object + */ + MsgUpdateClient.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgUpdateClient; + })(); + + v1.MsgUpdateClientResponse = (function() { + + /** + * Properties of a MsgUpdateClientResponse. + * @memberof ibc.core.client.v1 + * @interface IMsgUpdateClientResponse + */ + + /** + * Constructs a new MsgUpdateClientResponse. + * @memberof ibc.core.client.v1 + * @classdesc Represents a MsgUpdateClientResponse. + * @implements IMsgUpdateClientResponse + * @constructor + * @param {ibc.core.client.v1.IMsgUpdateClientResponse=} [properties] Properties to set + */ + function MsgUpdateClientResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgUpdateClientResponse message. Does not implicitly {@link ibc.core.client.v1.MsgUpdateClientResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.client.v1.MsgUpdateClientResponse + * @static + * @param {ibc.core.client.v1.IMsgUpdateClientResponse} message MsgUpdateClientResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgUpdateClientResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgUpdateClientResponse message, length delimited. Does not implicitly {@link ibc.core.client.v1.MsgUpdateClientResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.client.v1.MsgUpdateClientResponse + * @static + * @param {ibc.core.client.v1.IMsgUpdateClientResponse} message MsgUpdateClientResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgUpdateClientResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgUpdateClientResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.client.v1.MsgUpdateClientResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.client.v1.MsgUpdateClientResponse} MsgUpdateClientResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgUpdateClientResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.MsgUpdateClientResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgUpdateClientResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.client.v1.MsgUpdateClientResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.client.v1.MsgUpdateClientResponse} MsgUpdateClientResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgUpdateClientResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgUpdateClientResponse message. + * @function verify + * @memberof ibc.core.client.v1.MsgUpdateClientResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgUpdateClientResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgUpdateClientResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.client.v1.MsgUpdateClientResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.client.v1.MsgUpdateClientResponse} MsgUpdateClientResponse + */ + MsgUpdateClientResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.client.v1.MsgUpdateClientResponse) + return object; + return new $root.ibc.core.client.v1.MsgUpdateClientResponse(); + }; + + /** + * Creates a plain object from a MsgUpdateClientResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.client.v1.MsgUpdateClientResponse + * @static + * @param {ibc.core.client.v1.MsgUpdateClientResponse} message MsgUpdateClientResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgUpdateClientResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgUpdateClientResponse to JSON. + * @function toJSON + * @memberof ibc.core.client.v1.MsgUpdateClientResponse + * @instance + * @returns {Object.} JSON object + */ + MsgUpdateClientResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgUpdateClientResponse; + })(); + + v1.MsgUpgradeClient = (function() { + + /** + * Properties of a MsgUpgradeClient. + * @memberof ibc.core.client.v1 + * @interface IMsgUpgradeClient + * @property {string|null} [client_id] MsgUpgradeClient client_id + * @property {google.protobuf.IAny|null} [client_state] MsgUpgradeClient client_state + * @property {google.protobuf.IAny|null} [consensus_state] MsgUpgradeClient consensus_state + * @property {Uint8Array|null} [proof_upgrade_client] MsgUpgradeClient proof_upgrade_client + * @property {Uint8Array|null} [proof_upgrade_consensus_state] MsgUpgradeClient proof_upgrade_consensus_state + * @property {string|null} [signer] MsgUpgradeClient signer + */ + + /** + * Constructs a new MsgUpgradeClient. + * @memberof ibc.core.client.v1 + * @classdesc Represents a MsgUpgradeClient. + * @implements IMsgUpgradeClient + * @constructor + * @param {ibc.core.client.v1.IMsgUpgradeClient=} [properties] Properties to set + */ + function MsgUpgradeClient(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgUpgradeClient client_id. + * @member {string} client_id + * @memberof ibc.core.client.v1.MsgUpgradeClient + * @instance + */ + MsgUpgradeClient.prototype.client_id = ""; + + /** + * MsgUpgradeClient client_state. + * @member {google.protobuf.IAny|null|undefined} client_state + * @memberof ibc.core.client.v1.MsgUpgradeClient + * @instance + */ + MsgUpgradeClient.prototype.client_state = null; + + /** + * MsgUpgradeClient consensus_state. + * @member {google.protobuf.IAny|null|undefined} consensus_state + * @memberof ibc.core.client.v1.MsgUpgradeClient + * @instance + */ + MsgUpgradeClient.prototype.consensus_state = null; + + /** + * MsgUpgradeClient proof_upgrade_client. + * @member {Uint8Array} proof_upgrade_client + * @memberof ibc.core.client.v1.MsgUpgradeClient + * @instance + */ + MsgUpgradeClient.prototype.proof_upgrade_client = $util.newBuffer([]); + + /** + * MsgUpgradeClient proof_upgrade_consensus_state. + * @member {Uint8Array} proof_upgrade_consensus_state + * @memberof ibc.core.client.v1.MsgUpgradeClient + * @instance + */ + MsgUpgradeClient.prototype.proof_upgrade_consensus_state = $util.newBuffer([]); + + /** + * MsgUpgradeClient signer. + * @member {string} signer + * @memberof ibc.core.client.v1.MsgUpgradeClient + * @instance + */ + MsgUpgradeClient.prototype.signer = ""; + + /** + * Encodes the specified MsgUpgradeClient message. Does not implicitly {@link ibc.core.client.v1.MsgUpgradeClient.verify|verify} messages. + * @function encode + * @memberof ibc.core.client.v1.MsgUpgradeClient + * @static + * @param {ibc.core.client.v1.IMsgUpgradeClient} message MsgUpgradeClient message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgUpgradeClient.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); + if (message.client_state != null && Object.hasOwnProperty.call(message, "client_state")) + $root.google.protobuf.Any.encode(message.client_state, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.consensus_state != null && Object.hasOwnProperty.call(message, "consensus_state")) + $root.google.protobuf.Any.encode(message.consensus_state, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.proof_upgrade_client != null && Object.hasOwnProperty.call(message, "proof_upgrade_client")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.proof_upgrade_client); + if (message.proof_upgrade_consensus_state != null && Object.hasOwnProperty.call(message, "proof_upgrade_consensus_state")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.proof_upgrade_consensus_state); + if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.signer); + return writer; + }; + + /** + * Encodes the specified MsgUpgradeClient message, length delimited. Does not implicitly {@link ibc.core.client.v1.MsgUpgradeClient.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.client.v1.MsgUpgradeClient + * @static + * @param {ibc.core.client.v1.IMsgUpgradeClient} message MsgUpgradeClient message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgUpgradeClient.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgUpgradeClient message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.client.v1.MsgUpgradeClient + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.client.v1.MsgUpgradeClient} MsgUpgradeClient + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgUpgradeClient.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.MsgUpgradeClient(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.client_id = reader.string(); + break; + case 2: + message.client_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 3: + message.consensus_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 4: + message.proof_upgrade_client = reader.bytes(); + break; + case 5: + message.proof_upgrade_consensus_state = reader.bytes(); + break; + case 6: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgUpgradeClient message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.client.v1.MsgUpgradeClient + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.client.v1.MsgUpgradeClient} MsgUpgradeClient + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgUpgradeClient.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgUpgradeClient message. + * @function verify + * @memberof ibc.core.client.v1.MsgUpgradeClient + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgUpgradeClient.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.client_id != null && message.hasOwnProperty("client_id")) + if (!$util.isString(message.client_id)) + return "client_id: string expected"; + if (message.client_state != null && message.hasOwnProperty("client_state")) { + let error = $root.google.protobuf.Any.verify(message.client_state); + if (error) + return "client_state." + error; + } + if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) { + let error = $root.google.protobuf.Any.verify(message.consensus_state); + if (error) + return "consensus_state." + error; + } + if (message.proof_upgrade_client != null && message.hasOwnProperty("proof_upgrade_client")) + if (!(message.proof_upgrade_client && typeof message.proof_upgrade_client.length === "number" || $util.isString(message.proof_upgrade_client))) + return "proof_upgrade_client: buffer expected"; + if (message.proof_upgrade_consensus_state != null && message.hasOwnProperty("proof_upgrade_consensus_state")) + if (!(message.proof_upgrade_consensus_state && typeof message.proof_upgrade_consensus_state.length === "number" || $util.isString(message.proof_upgrade_consensus_state))) + return "proof_upgrade_consensus_state: buffer expected"; + if (message.signer != null && message.hasOwnProperty("signer")) + if (!$util.isString(message.signer)) + return "signer: string expected"; + return null; + }; + + /** + * Creates a MsgUpgradeClient message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.client.v1.MsgUpgradeClient + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.client.v1.MsgUpgradeClient} MsgUpgradeClient + */ + MsgUpgradeClient.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.client.v1.MsgUpgradeClient) + return object; + let message = new $root.ibc.core.client.v1.MsgUpgradeClient(); + if (object.client_id != null) + message.client_id = String(object.client_id); + if (object.client_state != null) { + if (typeof object.client_state !== "object") + throw TypeError(".ibc.core.client.v1.MsgUpgradeClient.client_state: object expected"); + message.client_state = $root.google.protobuf.Any.fromObject(object.client_state); + } + if (object.consensus_state != null) { + if (typeof object.consensus_state !== "object") + throw TypeError(".ibc.core.client.v1.MsgUpgradeClient.consensus_state: object expected"); + message.consensus_state = $root.google.protobuf.Any.fromObject(object.consensus_state); + } + if (object.proof_upgrade_client != null) + if (typeof object.proof_upgrade_client === "string") + $util.base64.decode(object.proof_upgrade_client, message.proof_upgrade_client = $util.newBuffer($util.base64.length(object.proof_upgrade_client)), 0); + else if (object.proof_upgrade_client.length) + message.proof_upgrade_client = object.proof_upgrade_client; + if (object.proof_upgrade_consensus_state != null) + if (typeof object.proof_upgrade_consensus_state === "string") + $util.base64.decode(object.proof_upgrade_consensus_state, message.proof_upgrade_consensus_state = $util.newBuffer($util.base64.length(object.proof_upgrade_consensus_state)), 0); + else if (object.proof_upgrade_consensus_state.length) + message.proof_upgrade_consensus_state = object.proof_upgrade_consensus_state; + if (object.signer != null) + message.signer = String(object.signer); + return message; + }; + + /** + * Creates a plain object from a MsgUpgradeClient message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.client.v1.MsgUpgradeClient + * @static + * @param {ibc.core.client.v1.MsgUpgradeClient} message MsgUpgradeClient + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgUpgradeClient.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.client_id = ""; + object.client_state = null; + object.consensus_state = null; + if (options.bytes === String) + object.proof_upgrade_client = ""; + else { + object.proof_upgrade_client = []; + if (options.bytes !== Array) + object.proof_upgrade_client = $util.newBuffer(object.proof_upgrade_client); + } + if (options.bytes === String) + object.proof_upgrade_consensus_state = ""; + else { + object.proof_upgrade_consensus_state = []; + if (options.bytes !== Array) + object.proof_upgrade_consensus_state = $util.newBuffer(object.proof_upgrade_consensus_state); + } + object.signer = ""; + } + if (message.client_id != null && message.hasOwnProperty("client_id")) + object.client_id = message.client_id; + if (message.client_state != null && message.hasOwnProperty("client_state")) + object.client_state = $root.google.protobuf.Any.toObject(message.client_state, options); + if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) + object.consensus_state = $root.google.protobuf.Any.toObject(message.consensus_state, options); + if (message.proof_upgrade_client != null && message.hasOwnProperty("proof_upgrade_client")) + object.proof_upgrade_client = options.bytes === String ? $util.base64.encode(message.proof_upgrade_client, 0, message.proof_upgrade_client.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_upgrade_client) : message.proof_upgrade_client; + if (message.proof_upgrade_consensus_state != null && message.hasOwnProperty("proof_upgrade_consensus_state")) + object.proof_upgrade_consensus_state = options.bytes === String ? $util.base64.encode(message.proof_upgrade_consensus_state, 0, message.proof_upgrade_consensus_state.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_upgrade_consensus_state) : message.proof_upgrade_consensus_state; + if (message.signer != null && message.hasOwnProperty("signer")) + object.signer = message.signer; + return object; + }; + + /** + * Converts this MsgUpgradeClient to JSON. + * @function toJSON + * @memberof ibc.core.client.v1.MsgUpgradeClient + * @instance + * @returns {Object.} JSON object + */ + MsgUpgradeClient.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgUpgradeClient; + })(); + + v1.MsgUpgradeClientResponse = (function() { + + /** + * Properties of a MsgUpgradeClientResponse. + * @memberof ibc.core.client.v1 + * @interface IMsgUpgradeClientResponse + */ + + /** + * Constructs a new MsgUpgradeClientResponse. + * @memberof ibc.core.client.v1 + * @classdesc Represents a MsgUpgradeClientResponse. + * @implements IMsgUpgradeClientResponse + * @constructor + * @param {ibc.core.client.v1.IMsgUpgradeClientResponse=} [properties] Properties to set + */ + function MsgUpgradeClientResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgUpgradeClientResponse message. Does not implicitly {@link ibc.core.client.v1.MsgUpgradeClientResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.client.v1.MsgUpgradeClientResponse + * @static + * @param {ibc.core.client.v1.IMsgUpgradeClientResponse} message MsgUpgradeClientResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgUpgradeClientResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgUpgradeClientResponse message, length delimited. Does not implicitly {@link ibc.core.client.v1.MsgUpgradeClientResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.client.v1.MsgUpgradeClientResponse + * @static + * @param {ibc.core.client.v1.IMsgUpgradeClientResponse} message MsgUpgradeClientResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgUpgradeClientResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgUpgradeClientResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.client.v1.MsgUpgradeClientResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.client.v1.MsgUpgradeClientResponse} MsgUpgradeClientResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgUpgradeClientResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.MsgUpgradeClientResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgUpgradeClientResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.client.v1.MsgUpgradeClientResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.client.v1.MsgUpgradeClientResponse} MsgUpgradeClientResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgUpgradeClientResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgUpgradeClientResponse message. + * @function verify + * @memberof ibc.core.client.v1.MsgUpgradeClientResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgUpgradeClientResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgUpgradeClientResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.client.v1.MsgUpgradeClientResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.client.v1.MsgUpgradeClientResponse} MsgUpgradeClientResponse + */ + MsgUpgradeClientResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.client.v1.MsgUpgradeClientResponse) + return object; + return new $root.ibc.core.client.v1.MsgUpgradeClientResponse(); + }; + + /** + * Creates a plain object from a MsgUpgradeClientResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.client.v1.MsgUpgradeClientResponse + * @static + * @param {ibc.core.client.v1.MsgUpgradeClientResponse} message MsgUpgradeClientResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgUpgradeClientResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgUpgradeClientResponse to JSON. + * @function toJSON + * @memberof ibc.core.client.v1.MsgUpgradeClientResponse + * @instance + * @returns {Object.} JSON object + */ + MsgUpgradeClientResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgUpgradeClientResponse; + })(); + + v1.MsgSubmitMisbehaviour = (function() { + + /** + * Properties of a MsgSubmitMisbehaviour. + * @memberof ibc.core.client.v1 + * @interface IMsgSubmitMisbehaviour + * @property {string|null} [client_id] MsgSubmitMisbehaviour client_id + * @property {google.protobuf.IAny|null} [misbehaviour] MsgSubmitMisbehaviour misbehaviour + * @property {string|null} [signer] MsgSubmitMisbehaviour signer + */ + + /** + * Constructs a new MsgSubmitMisbehaviour. + * @memberof ibc.core.client.v1 + * @classdesc Represents a MsgSubmitMisbehaviour. + * @implements IMsgSubmitMisbehaviour + * @constructor + * @param {ibc.core.client.v1.IMsgSubmitMisbehaviour=} [properties] Properties to set + */ + function MsgSubmitMisbehaviour(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgSubmitMisbehaviour client_id. + * @member {string} client_id + * @memberof ibc.core.client.v1.MsgSubmitMisbehaviour + * @instance + */ + MsgSubmitMisbehaviour.prototype.client_id = ""; + + /** + * MsgSubmitMisbehaviour misbehaviour. + * @member {google.protobuf.IAny|null|undefined} misbehaviour + * @memberof ibc.core.client.v1.MsgSubmitMisbehaviour + * @instance + */ + MsgSubmitMisbehaviour.prototype.misbehaviour = null; + + /** + * MsgSubmitMisbehaviour signer. + * @member {string} signer + * @memberof ibc.core.client.v1.MsgSubmitMisbehaviour + * @instance + */ + MsgSubmitMisbehaviour.prototype.signer = ""; + + /** + * Encodes the specified MsgSubmitMisbehaviour message. Does not implicitly {@link ibc.core.client.v1.MsgSubmitMisbehaviour.verify|verify} messages. + * @function encode + * @memberof ibc.core.client.v1.MsgSubmitMisbehaviour + * @static + * @param {ibc.core.client.v1.IMsgSubmitMisbehaviour} message MsgSubmitMisbehaviour message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgSubmitMisbehaviour.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); + if (message.misbehaviour != null && Object.hasOwnProperty.call(message, "misbehaviour")) + $root.google.protobuf.Any.encode(message.misbehaviour, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.signer); + return writer; + }; + + /** + * Encodes the specified MsgSubmitMisbehaviour message, length delimited. Does not implicitly {@link ibc.core.client.v1.MsgSubmitMisbehaviour.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.client.v1.MsgSubmitMisbehaviour + * @static + * @param {ibc.core.client.v1.IMsgSubmitMisbehaviour} message MsgSubmitMisbehaviour message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgSubmitMisbehaviour.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgSubmitMisbehaviour message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.client.v1.MsgSubmitMisbehaviour + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.client.v1.MsgSubmitMisbehaviour} MsgSubmitMisbehaviour + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgSubmitMisbehaviour.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.MsgSubmitMisbehaviour(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.client_id = reader.string(); + break; + case 2: + message.misbehaviour = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgSubmitMisbehaviour message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.client.v1.MsgSubmitMisbehaviour + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.client.v1.MsgSubmitMisbehaviour} MsgSubmitMisbehaviour + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgSubmitMisbehaviour.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgSubmitMisbehaviour message. + * @function verify + * @memberof ibc.core.client.v1.MsgSubmitMisbehaviour + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgSubmitMisbehaviour.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.client_id != null && message.hasOwnProperty("client_id")) + if (!$util.isString(message.client_id)) + return "client_id: string expected"; + if (message.misbehaviour != null && message.hasOwnProperty("misbehaviour")) { + let error = $root.google.protobuf.Any.verify(message.misbehaviour); + if (error) + return "misbehaviour." + error; + } + if (message.signer != null && message.hasOwnProperty("signer")) + if (!$util.isString(message.signer)) + return "signer: string expected"; + return null; + }; + + /** + * Creates a MsgSubmitMisbehaviour message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.client.v1.MsgSubmitMisbehaviour + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.client.v1.MsgSubmitMisbehaviour} MsgSubmitMisbehaviour + */ + MsgSubmitMisbehaviour.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.client.v1.MsgSubmitMisbehaviour) + return object; + let message = new $root.ibc.core.client.v1.MsgSubmitMisbehaviour(); + if (object.client_id != null) + message.client_id = String(object.client_id); + if (object.misbehaviour != null) { + if (typeof object.misbehaviour !== "object") + throw TypeError(".ibc.core.client.v1.MsgSubmitMisbehaviour.misbehaviour: object expected"); + message.misbehaviour = $root.google.protobuf.Any.fromObject(object.misbehaviour); + } + if (object.signer != null) + message.signer = String(object.signer); + return message; + }; + + /** + * Creates a plain object from a MsgSubmitMisbehaviour message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.client.v1.MsgSubmitMisbehaviour + * @static + * @param {ibc.core.client.v1.MsgSubmitMisbehaviour} message MsgSubmitMisbehaviour + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgSubmitMisbehaviour.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.client_id = ""; + object.misbehaviour = null; + object.signer = ""; + } + if (message.client_id != null && message.hasOwnProperty("client_id")) + object.client_id = message.client_id; + if (message.misbehaviour != null && message.hasOwnProperty("misbehaviour")) + object.misbehaviour = $root.google.protobuf.Any.toObject(message.misbehaviour, options); + if (message.signer != null && message.hasOwnProperty("signer")) + object.signer = message.signer; + return object; + }; + + /** + * Converts this MsgSubmitMisbehaviour to JSON. + * @function toJSON + * @memberof ibc.core.client.v1.MsgSubmitMisbehaviour + * @instance + * @returns {Object.} JSON object + */ + MsgSubmitMisbehaviour.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgSubmitMisbehaviour; + })(); + + v1.MsgSubmitMisbehaviourResponse = (function() { + + /** + * Properties of a MsgSubmitMisbehaviourResponse. + * @memberof ibc.core.client.v1 + * @interface IMsgSubmitMisbehaviourResponse + */ + + /** + * Constructs a new MsgSubmitMisbehaviourResponse. + * @memberof ibc.core.client.v1 + * @classdesc Represents a MsgSubmitMisbehaviourResponse. + * @implements IMsgSubmitMisbehaviourResponse + * @constructor + * @param {ibc.core.client.v1.IMsgSubmitMisbehaviourResponse=} [properties] Properties to set + */ + function MsgSubmitMisbehaviourResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgSubmitMisbehaviourResponse message. Does not implicitly {@link ibc.core.client.v1.MsgSubmitMisbehaviourResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.client.v1.MsgSubmitMisbehaviourResponse + * @static + * @param {ibc.core.client.v1.IMsgSubmitMisbehaviourResponse} message MsgSubmitMisbehaviourResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgSubmitMisbehaviourResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgSubmitMisbehaviourResponse message, length delimited. Does not implicitly {@link ibc.core.client.v1.MsgSubmitMisbehaviourResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.client.v1.MsgSubmitMisbehaviourResponse + * @static + * @param {ibc.core.client.v1.IMsgSubmitMisbehaviourResponse} message MsgSubmitMisbehaviourResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgSubmitMisbehaviourResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgSubmitMisbehaviourResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.client.v1.MsgSubmitMisbehaviourResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.client.v1.MsgSubmitMisbehaviourResponse} MsgSubmitMisbehaviourResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgSubmitMisbehaviourResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.MsgSubmitMisbehaviourResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgSubmitMisbehaviourResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.client.v1.MsgSubmitMisbehaviourResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.client.v1.MsgSubmitMisbehaviourResponse} MsgSubmitMisbehaviourResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgSubmitMisbehaviourResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgSubmitMisbehaviourResponse message. + * @function verify + * @memberof ibc.core.client.v1.MsgSubmitMisbehaviourResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgSubmitMisbehaviourResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgSubmitMisbehaviourResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.client.v1.MsgSubmitMisbehaviourResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.client.v1.MsgSubmitMisbehaviourResponse} MsgSubmitMisbehaviourResponse + */ + MsgSubmitMisbehaviourResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.client.v1.MsgSubmitMisbehaviourResponse) + return object; + return new $root.ibc.core.client.v1.MsgSubmitMisbehaviourResponse(); + }; + + /** + * Creates a plain object from a MsgSubmitMisbehaviourResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.client.v1.MsgSubmitMisbehaviourResponse + * @static + * @param {ibc.core.client.v1.MsgSubmitMisbehaviourResponse} message MsgSubmitMisbehaviourResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgSubmitMisbehaviourResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgSubmitMisbehaviourResponse to JSON. + * @function toJSON + * @memberof ibc.core.client.v1.MsgSubmitMisbehaviourResponse + * @instance + * @returns {Object.} JSON object + */ + MsgSubmitMisbehaviourResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgSubmitMisbehaviourResponse; + })(); + + v1.IdentifiedClientState = (function() { + + /** + * Properties of an IdentifiedClientState. + * @memberof ibc.core.client.v1 + * @interface IIdentifiedClientState + * @property {string|null} [client_id] IdentifiedClientState client_id + * @property {google.protobuf.IAny|null} [client_state] IdentifiedClientState client_state + */ + + /** + * Constructs a new IdentifiedClientState. + * @memberof ibc.core.client.v1 + * @classdesc Represents an IdentifiedClientState. + * @implements IIdentifiedClientState + * @constructor + * @param {ibc.core.client.v1.IIdentifiedClientState=} [properties] Properties to set + */ + function IdentifiedClientState(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * IdentifiedClientState client_id. + * @member {string} client_id + * @memberof ibc.core.client.v1.IdentifiedClientState + * @instance + */ + IdentifiedClientState.prototype.client_id = ""; + + /** + * IdentifiedClientState client_state. + * @member {google.protobuf.IAny|null|undefined} client_state + * @memberof ibc.core.client.v1.IdentifiedClientState + * @instance + */ + IdentifiedClientState.prototype.client_state = null; + + /** + * Encodes the specified IdentifiedClientState message. Does not implicitly {@link ibc.core.client.v1.IdentifiedClientState.verify|verify} messages. + * @function encode + * @memberof ibc.core.client.v1.IdentifiedClientState + * @static + * @param {ibc.core.client.v1.IIdentifiedClientState} message IdentifiedClientState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IdentifiedClientState.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); + if (message.client_state != null && Object.hasOwnProperty.call(message, "client_state")) + $root.google.protobuf.Any.encode(message.client_state, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified IdentifiedClientState message, length delimited. Does not implicitly {@link ibc.core.client.v1.IdentifiedClientState.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.client.v1.IdentifiedClientState + * @static + * @param {ibc.core.client.v1.IIdentifiedClientState} message IdentifiedClientState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IdentifiedClientState.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an IdentifiedClientState message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.client.v1.IdentifiedClientState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.client.v1.IdentifiedClientState} IdentifiedClientState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IdentifiedClientState.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.IdentifiedClientState(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.client_id = reader.string(); + break; + case 2: + message.client_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an IdentifiedClientState message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.client.v1.IdentifiedClientState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.client.v1.IdentifiedClientState} IdentifiedClientState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IdentifiedClientState.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IdentifiedClientState message. + * @function verify + * @memberof ibc.core.client.v1.IdentifiedClientState + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IdentifiedClientState.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.client_id != null && message.hasOwnProperty("client_id")) + if (!$util.isString(message.client_id)) + return "client_id: string expected"; + if (message.client_state != null && message.hasOwnProperty("client_state")) { + let error = $root.google.protobuf.Any.verify(message.client_state); + if (error) + return "client_state." + error; + } + return null; + }; + + /** + * Creates an IdentifiedClientState message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.client.v1.IdentifiedClientState + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.client.v1.IdentifiedClientState} IdentifiedClientState + */ + IdentifiedClientState.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.client.v1.IdentifiedClientState) + return object; + let message = new $root.ibc.core.client.v1.IdentifiedClientState(); + if (object.client_id != null) + message.client_id = String(object.client_id); + if (object.client_state != null) { + if (typeof object.client_state !== "object") + throw TypeError(".ibc.core.client.v1.IdentifiedClientState.client_state: object expected"); + message.client_state = $root.google.protobuf.Any.fromObject(object.client_state); + } + return message; + }; + + /** + * Creates a plain object from an IdentifiedClientState message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.client.v1.IdentifiedClientState + * @static + * @param {ibc.core.client.v1.IdentifiedClientState} message IdentifiedClientState + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IdentifiedClientState.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.client_id = ""; + object.client_state = null; + } + if (message.client_id != null && message.hasOwnProperty("client_id")) + object.client_id = message.client_id; + if (message.client_state != null && message.hasOwnProperty("client_state")) + object.client_state = $root.google.protobuf.Any.toObject(message.client_state, options); + return object; + }; + + /** + * Converts this IdentifiedClientState to JSON. + * @function toJSON + * @memberof ibc.core.client.v1.IdentifiedClientState + * @instance + * @returns {Object.} JSON object + */ + IdentifiedClientState.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return IdentifiedClientState; + })(); + + v1.ConsensusStateWithHeight = (function() { + + /** + * Properties of a ConsensusStateWithHeight. + * @memberof ibc.core.client.v1 + * @interface IConsensusStateWithHeight + * @property {ibc.core.client.v1.IHeight|null} [height] ConsensusStateWithHeight height + * @property {google.protobuf.IAny|null} [consensus_state] ConsensusStateWithHeight consensus_state + */ + + /** + * Constructs a new ConsensusStateWithHeight. + * @memberof ibc.core.client.v1 + * @classdesc Represents a ConsensusStateWithHeight. + * @implements IConsensusStateWithHeight + * @constructor + * @param {ibc.core.client.v1.IConsensusStateWithHeight=} [properties] Properties to set + */ + function ConsensusStateWithHeight(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConsensusStateWithHeight height. + * @member {ibc.core.client.v1.IHeight|null|undefined} height + * @memberof ibc.core.client.v1.ConsensusStateWithHeight + * @instance + */ + ConsensusStateWithHeight.prototype.height = null; + + /** + * ConsensusStateWithHeight consensus_state. + * @member {google.protobuf.IAny|null|undefined} consensus_state + * @memberof ibc.core.client.v1.ConsensusStateWithHeight + * @instance + */ + ConsensusStateWithHeight.prototype.consensus_state = null; + + /** + * Encodes the specified ConsensusStateWithHeight message. Does not implicitly {@link ibc.core.client.v1.ConsensusStateWithHeight.verify|verify} messages. + * @function encode + * @memberof ibc.core.client.v1.ConsensusStateWithHeight + * @static + * @param {ibc.core.client.v1.IConsensusStateWithHeight} message ConsensusStateWithHeight message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConsensusStateWithHeight.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + $root.ibc.core.client.v1.Height.encode(message.height, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.consensus_state != null && Object.hasOwnProperty.call(message, "consensus_state")) + $root.google.protobuf.Any.encode(message.consensus_state, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ConsensusStateWithHeight message, length delimited. Does not implicitly {@link ibc.core.client.v1.ConsensusStateWithHeight.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.client.v1.ConsensusStateWithHeight + * @static + * @param {ibc.core.client.v1.IConsensusStateWithHeight} message ConsensusStateWithHeight message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConsensusStateWithHeight.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConsensusStateWithHeight message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.client.v1.ConsensusStateWithHeight + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.client.v1.ConsensusStateWithHeight} ConsensusStateWithHeight + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConsensusStateWithHeight.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.ConsensusStateWithHeight(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + case 2: + message.consensus_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConsensusStateWithHeight message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.client.v1.ConsensusStateWithHeight + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.client.v1.ConsensusStateWithHeight} ConsensusStateWithHeight + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConsensusStateWithHeight.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConsensusStateWithHeight message. + * @function verify + * @memberof ibc.core.client.v1.ConsensusStateWithHeight + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConsensusStateWithHeight.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.height != null && message.hasOwnProperty("height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.height); + if (error) + return "height." + error; + } + if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) { + let error = $root.google.protobuf.Any.verify(message.consensus_state); + if (error) + return "consensus_state." + error; + } + return null; + }; + + /** + * Creates a ConsensusStateWithHeight message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.client.v1.ConsensusStateWithHeight + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.client.v1.ConsensusStateWithHeight} ConsensusStateWithHeight + */ + ConsensusStateWithHeight.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.client.v1.ConsensusStateWithHeight) + return object; + let message = new $root.ibc.core.client.v1.ConsensusStateWithHeight(); + if (object.height != null) { + if (typeof object.height !== "object") + throw TypeError(".ibc.core.client.v1.ConsensusStateWithHeight.height: object expected"); + message.height = $root.ibc.core.client.v1.Height.fromObject(object.height); + } + if (object.consensus_state != null) { + if (typeof object.consensus_state !== "object") + throw TypeError(".ibc.core.client.v1.ConsensusStateWithHeight.consensus_state: object expected"); + message.consensus_state = $root.google.protobuf.Any.fromObject(object.consensus_state); + } + return message; + }; + + /** + * Creates a plain object from a ConsensusStateWithHeight message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.client.v1.ConsensusStateWithHeight + * @static + * @param {ibc.core.client.v1.ConsensusStateWithHeight} message ConsensusStateWithHeight + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConsensusStateWithHeight.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.height = null; + object.consensus_state = null; + } + if (message.height != null && message.hasOwnProperty("height")) + object.height = $root.ibc.core.client.v1.Height.toObject(message.height, options); + if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) + object.consensus_state = $root.google.protobuf.Any.toObject(message.consensus_state, options); + return object; + }; + + /** + * Converts this ConsensusStateWithHeight to JSON. + * @function toJSON + * @memberof ibc.core.client.v1.ConsensusStateWithHeight + * @instance + * @returns {Object.} JSON object + */ + ConsensusStateWithHeight.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ConsensusStateWithHeight; + })(); + + v1.ClientConsensusStates = (function() { + + /** + * Properties of a ClientConsensusStates. + * @memberof ibc.core.client.v1 + * @interface IClientConsensusStates + * @property {string|null} [client_id] ClientConsensusStates client_id + * @property {Array.|null} [consensus_states] ClientConsensusStates consensus_states + */ + + /** + * Constructs a new ClientConsensusStates. + * @memberof ibc.core.client.v1 + * @classdesc Represents a ClientConsensusStates. + * @implements IClientConsensusStates + * @constructor + * @param {ibc.core.client.v1.IClientConsensusStates=} [properties] Properties to set + */ + function ClientConsensusStates(properties) { + this.consensus_states = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ClientConsensusStates client_id. + * @member {string} client_id + * @memberof ibc.core.client.v1.ClientConsensusStates + * @instance + */ + ClientConsensusStates.prototype.client_id = ""; + + /** + * ClientConsensusStates consensus_states. + * @member {Array.} consensus_states + * @memberof ibc.core.client.v1.ClientConsensusStates + * @instance + */ + ClientConsensusStates.prototype.consensus_states = $util.emptyArray; + + /** + * Encodes the specified ClientConsensusStates message. Does not implicitly {@link ibc.core.client.v1.ClientConsensusStates.verify|verify} messages. + * @function encode + * @memberof ibc.core.client.v1.ClientConsensusStates + * @static + * @param {ibc.core.client.v1.IClientConsensusStates} message ClientConsensusStates message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClientConsensusStates.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); + if (message.consensus_states != null && message.consensus_states.length) + for (let i = 0; i < message.consensus_states.length; ++i) + $root.ibc.core.client.v1.ConsensusStateWithHeight.encode(message.consensus_states[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ClientConsensusStates message, length delimited. Does not implicitly {@link ibc.core.client.v1.ClientConsensusStates.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.client.v1.ClientConsensusStates + * @static + * @param {ibc.core.client.v1.IClientConsensusStates} message ClientConsensusStates message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClientConsensusStates.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ClientConsensusStates message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.client.v1.ClientConsensusStates + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.client.v1.ClientConsensusStates} ClientConsensusStates + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClientConsensusStates.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.ClientConsensusStates(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.client_id = reader.string(); + break; + case 2: + if (!(message.consensus_states && message.consensus_states.length)) + message.consensus_states = []; + message.consensus_states.push($root.ibc.core.client.v1.ConsensusStateWithHeight.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ClientConsensusStates message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.client.v1.ClientConsensusStates + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.client.v1.ClientConsensusStates} ClientConsensusStates + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClientConsensusStates.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ClientConsensusStates message. + * @function verify + * @memberof ibc.core.client.v1.ClientConsensusStates + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ClientConsensusStates.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.client_id != null && message.hasOwnProperty("client_id")) + if (!$util.isString(message.client_id)) + return "client_id: string expected"; + if (message.consensus_states != null && message.hasOwnProperty("consensus_states")) { + if (!Array.isArray(message.consensus_states)) + return "consensus_states: array expected"; + for (let i = 0; i < message.consensus_states.length; ++i) { + let error = $root.ibc.core.client.v1.ConsensusStateWithHeight.verify(message.consensus_states[i]); + if (error) + return "consensus_states." + error; + } + } + return null; + }; + + /** + * Creates a ClientConsensusStates message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.client.v1.ClientConsensusStates + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.client.v1.ClientConsensusStates} ClientConsensusStates + */ + ClientConsensusStates.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.client.v1.ClientConsensusStates) + return object; + let message = new $root.ibc.core.client.v1.ClientConsensusStates(); + if (object.client_id != null) + message.client_id = String(object.client_id); + if (object.consensus_states) { + if (!Array.isArray(object.consensus_states)) + throw TypeError(".ibc.core.client.v1.ClientConsensusStates.consensus_states: array expected"); + message.consensus_states = []; + for (let i = 0; i < object.consensus_states.length; ++i) { + if (typeof object.consensus_states[i] !== "object") + throw TypeError(".ibc.core.client.v1.ClientConsensusStates.consensus_states: object expected"); + message.consensus_states[i] = $root.ibc.core.client.v1.ConsensusStateWithHeight.fromObject(object.consensus_states[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ClientConsensusStates message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.client.v1.ClientConsensusStates + * @static + * @param {ibc.core.client.v1.ClientConsensusStates} message ClientConsensusStates + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ClientConsensusStates.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.consensus_states = []; + if (options.defaults) + object.client_id = ""; + if (message.client_id != null && message.hasOwnProperty("client_id")) + object.client_id = message.client_id; + if (message.consensus_states && message.consensus_states.length) { + object.consensus_states = []; + for (let j = 0; j < message.consensus_states.length; ++j) + object.consensus_states[j] = $root.ibc.core.client.v1.ConsensusStateWithHeight.toObject(message.consensus_states[j], options); + } + return object; + }; + + /** + * Converts this ClientConsensusStates to JSON. + * @function toJSON + * @memberof ibc.core.client.v1.ClientConsensusStates + * @instance + * @returns {Object.} JSON object + */ + ClientConsensusStates.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ClientConsensusStates; + })(); + + v1.ClientUpdateProposal = (function() { + + /** + * Properties of a ClientUpdateProposal. + * @memberof ibc.core.client.v1 + * @interface IClientUpdateProposal + * @property {string|null} [title] ClientUpdateProposal title + * @property {string|null} [description] ClientUpdateProposal description + * @property {string|null} [client_id] ClientUpdateProposal client_id + * @property {google.protobuf.IAny|null} [header] ClientUpdateProposal header + */ + + /** + * Constructs a new ClientUpdateProposal. + * @memberof ibc.core.client.v1 + * @classdesc Represents a ClientUpdateProposal. + * @implements IClientUpdateProposal + * @constructor + * @param {ibc.core.client.v1.IClientUpdateProposal=} [properties] Properties to set + */ + function ClientUpdateProposal(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ClientUpdateProposal title. + * @member {string} title + * @memberof ibc.core.client.v1.ClientUpdateProposal + * @instance + */ + ClientUpdateProposal.prototype.title = ""; + + /** + * ClientUpdateProposal description. + * @member {string} description + * @memberof ibc.core.client.v1.ClientUpdateProposal + * @instance + */ + ClientUpdateProposal.prototype.description = ""; + + /** + * ClientUpdateProposal client_id. + * @member {string} client_id + * @memberof ibc.core.client.v1.ClientUpdateProposal + * @instance + */ + ClientUpdateProposal.prototype.client_id = ""; + + /** + * ClientUpdateProposal header. + * @member {google.protobuf.IAny|null|undefined} header + * @memberof ibc.core.client.v1.ClientUpdateProposal + * @instance + */ + ClientUpdateProposal.prototype.header = null; + + /** + * Encodes the specified ClientUpdateProposal message. Does not implicitly {@link ibc.core.client.v1.ClientUpdateProposal.verify|verify} messages. + * @function encode + * @memberof ibc.core.client.v1.ClientUpdateProposal + * @static + * @param {ibc.core.client.v1.IClientUpdateProposal} message ClientUpdateProposal message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClientUpdateProposal.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.client_id); + if (message.header != null && Object.hasOwnProperty.call(message, "header")) + $root.google.protobuf.Any.encode(message.header, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ClientUpdateProposal message, length delimited. Does not implicitly {@link ibc.core.client.v1.ClientUpdateProposal.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.client.v1.ClientUpdateProposal + * @static + * @param {ibc.core.client.v1.IClientUpdateProposal} message ClientUpdateProposal message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClientUpdateProposal.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ClientUpdateProposal message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.client.v1.ClientUpdateProposal + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.client.v1.ClientUpdateProposal} ClientUpdateProposal + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClientUpdateProposal.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.ClientUpdateProposal(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.client_id = reader.string(); + break; + case 4: + message.header = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ClientUpdateProposal message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.client.v1.ClientUpdateProposal + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.client.v1.ClientUpdateProposal} ClientUpdateProposal + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClientUpdateProposal.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ClientUpdateProposal message. + * @function verify + * @memberof ibc.core.client.v1.ClientUpdateProposal + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ClientUpdateProposal.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.client_id != null && message.hasOwnProperty("client_id")) + if (!$util.isString(message.client_id)) + return "client_id: string expected"; + if (message.header != null && message.hasOwnProperty("header")) { + let error = $root.google.protobuf.Any.verify(message.header); + if (error) + return "header." + error; + } + return null; + }; + + /** + * Creates a ClientUpdateProposal message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.client.v1.ClientUpdateProposal + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.client.v1.ClientUpdateProposal} ClientUpdateProposal + */ + ClientUpdateProposal.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.client.v1.ClientUpdateProposal) + return object; + let message = new $root.ibc.core.client.v1.ClientUpdateProposal(); + if (object.title != null) + message.title = String(object.title); + if (object.description != null) + message.description = String(object.description); + if (object.client_id != null) + message.client_id = String(object.client_id); + if (object.header != null) { + if (typeof object.header !== "object") + throw TypeError(".ibc.core.client.v1.ClientUpdateProposal.header: object expected"); + message.header = $root.google.protobuf.Any.fromObject(object.header); + } + return message; + }; + + /** + * Creates a plain object from a ClientUpdateProposal message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.client.v1.ClientUpdateProposal + * @static + * @param {ibc.core.client.v1.ClientUpdateProposal} message ClientUpdateProposal + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ClientUpdateProposal.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.title = ""; + object.description = ""; + object.client_id = ""; + object.header = null; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.client_id != null && message.hasOwnProperty("client_id")) + object.client_id = message.client_id; + if (message.header != null && message.hasOwnProperty("header")) + object.header = $root.google.protobuf.Any.toObject(message.header, options); + return object; + }; + + /** + * Converts this ClientUpdateProposal to JSON. + * @function toJSON + * @memberof ibc.core.client.v1.ClientUpdateProposal + * @instance + * @returns {Object.} JSON object + */ + ClientUpdateProposal.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ClientUpdateProposal; + })(); + + v1.Height = (function() { + + /** + * Properties of an Height. + * @memberof ibc.core.client.v1 + * @interface IHeight + * @property {Long|null} [revision_number] Height revision_number + * @property {Long|null} [revision_height] Height revision_height + */ + + /** + * Constructs a new Height. + * @memberof ibc.core.client.v1 + * @classdesc Represents an Height. + * @implements IHeight + * @constructor + * @param {ibc.core.client.v1.IHeight=} [properties] Properties to set + */ + function Height(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Height revision_number. + * @member {Long} revision_number + * @memberof ibc.core.client.v1.Height + * @instance + */ + Height.prototype.revision_number = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Height revision_height. + * @member {Long} revision_height + * @memberof ibc.core.client.v1.Height + * @instance + */ + Height.prototype.revision_height = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified Height message. Does not implicitly {@link ibc.core.client.v1.Height.verify|verify} messages. + * @function encode + * @memberof ibc.core.client.v1.Height + * @static + * @param {ibc.core.client.v1.IHeight} message Height message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Height.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.revision_number != null && Object.hasOwnProperty.call(message, "revision_number")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.revision_number); + if (message.revision_height != null && Object.hasOwnProperty.call(message, "revision_height")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.revision_height); + return writer; + }; + + /** + * Encodes the specified Height message, length delimited. Does not implicitly {@link ibc.core.client.v1.Height.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.client.v1.Height + * @static + * @param {ibc.core.client.v1.IHeight} message Height message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Height.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Height message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.client.v1.Height + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.client.v1.Height} Height + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Height.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.Height(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.revision_number = reader.uint64(); + break; + case 2: + message.revision_height = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Height message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.client.v1.Height + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.client.v1.Height} Height + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Height.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Height message. + * @function verify + * @memberof ibc.core.client.v1.Height + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Height.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.revision_number != null && message.hasOwnProperty("revision_number")) + if (!$util.isInteger(message.revision_number) && !(message.revision_number && $util.isInteger(message.revision_number.low) && $util.isInteger(message.revision_number.high))) + return "revision_number: integer|Long expected"; + if (message.revision_height != null && message.hasOwnProperty("revision_height")) + if (!$util.isInteger(message.revision_height) && !(message.revision_height && $util.isInteger(message.revision_height.low) && $util.isInteger(message.revision_height.high))) + return "revision_height: integer|Long expected"; + return null; + }; + + /** + * Creates an Height message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.client.v1.Height + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.client.v1.Height} Height + */ + Height.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.client.v1.Height) + return object; + let message = new $root.ibc.core.client.v1.Height(); + if (object.revision_number != null) + if ($util.Long) + (message.revision_number = $util.Long.fromValue(object.revision_number)).unsigned = true; + else if (typeof object.revision_number === "string") + message.revision_number = parseInt(object.revision_number, 10); + else if (typeof object.revision_number === "number") + message.revision_number = object.revision_number; + else if (typeof object.revision_number === "object") + message.revision_number = new $util.LongBits(object.revision_number.low >>> 0, object.revision_number.high >>> 0).toNumber(true); + if (object.revision_height != null) + if ($util.Long) + (message.revision_height = $util.Long.fromValue(object.revision_height)).unsigned = true; + else if (typeof object.revision_height === "string") + message.revision_height = parseInt(object.revision_height, 10); + else if (typeof object.revision_height === "number") + message.revision_height = object.revision_height; + else if (typeof object.revision_height === "object") + message.revision_height = new $util.LongBits(object.revision_height.low >>> 0, object.revision_height.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from an Height message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.client.v1.Height + * @static + * @param {ibc.core.client.v1.Height} message Height + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Height.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.revision_number = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.revision_number = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.revision_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.revision_height = options.longs === String ? "0" : 0; + } + if (message.revision_number != null && message.hasOwnProperty("revision_number")) + if (typeof message.revision_number === "number") + object.revision_number = options.longs === String ? String(message.revision_number) : message.revision_number; + else + object.revision_number = options.longs === String ? $util.Long.prototype.toString.call(message.revision_number) : options.longs === Number ? new $util.LongBits(message.revision_number.low >>> 0, message.revision_number.high >>> 0).toNumber(true) : message.revision_number; + if (message.revision_height != null && message.hasOwnProperty("revision_height")) + if (typeof message.revision_height === "number") + object.revision_height = options.longs === String ? String(message.revision_height) : message.revision_height; + else + object.revision_height = options.longs === String ? $util.Long.prototype.toString.call(message.revision_height) : options.longs === Number ? new $util.LongBits(message.revision_height.low >>> 0, message.revision_height.high >>> 0).toNumber(true) : message.revision_height; + return object; + }; + + /** + * Converts this Height to JSON. + * @function toJSON + * @memberof ibc.core.client.v1.Height + * @instance + * @returns {Object.} JSON object + */ + Height.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Height; + })(); + + v1.Params = (function() { + + /** + * Properties of a Params. + * @memberof ibc.core.client.v1 + * @interface IParams + * @property {Array.|null} [allowed_clients] Params allowed_clients + */ + + /** + * Constructs a new Params. + * @memberof ibc.core.client.v1 + * @classdesc Represents a Params. + * @implements IParams + * @constructor + * @param {ibc.core.client.v1.IParams=} [properties] Properties to set + */ + function Params(properties) { + this.allowed_clients = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Params allowed_clients. + * @member {Array.} allowed_clients + * @memberof ibc.core.client.v1.Params + * @instance + */ + Params.prototype.allowed_clients = $util.emptyArray; + + /** + * Encodes the specified Params message. Does not implicitly {@link ibc.core.client.v1.Params.verify|verify} messages. + * @function encode + * @memberof ibc.core.client.v1.Params + * @static + * @param {ibc.core.client.v1.IParams} message Params message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Params.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.allowed_clients != null && message.allowed_clients.length) + for (let i = 0; i < message.allowed_clients.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.allowed_clients[i]); + return writer; + }; + + /** + * Encodes the specified Params message, length delimited. Does not implicitly {@link ibc.core.client.v1.Params.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.client.v1.Params + * @static + * @param {ibc.core.client.v1.IParams} message Params message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Params.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Params message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.client.v1.Params + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.client.v1.Params} Params + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Params.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.Params(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.allowed_clients && message.allowed_clients.length)) + message.allowed_clients = []; + message.allowed_clients.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Params message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.client.v1.Params + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.client.v1.Params} Params + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Params.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Params message. + * @function verify + * @memberof ibc.core.client.v1.Params + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Params.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.allowed_clients != null && message.hasOwnProperty("allowed_clients")) { + if (!Array.isArray(message.allowed_clients)) + return "allowed_clients: array expected"; + for (let i = 0; i < message.allowed_clients.length; ++i) + if (!$util.isString(message.allowed_clients[i])) + return "allowed_clients: string[] expected"; + } + return null; + }; + + /** + * Creates a Params message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.client.v1.Params + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.client.v1.Params} Params + */ + Params.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.client.v1.Params) + return object; + let message = new $root.ibc.core.client.v1.Params(); + if (object.allowed_clients) { + if (!Array.isArray(object.allowed_clients)) + throw TypeError(".ibc.core.client.v1.Params.allowed_clients: array expected"); + message.allowed_clients = []; + for (let i = 0; i < object.allowed_clients.length; ++i) + message.allowed_clients[i] = String(object.allowed_clients[i]); + } + return message; + }; + + /** + * Creates a plain object from a Params message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.client.v1.Params + * @static + * @param {ibc.core.client.v1.Params} message Params + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Params.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.allowed_clients = []; + if (message.allowed_clients && message.allowed_clients.length) { + object.allowed_clients = []; + for (let j = 0; j < message.allowed_clients.length; ++j) + object.allowed_clients[j] = message.allowed_clients[j]; + } + return object; + }; + + /** + * Converts this Params to JSON. + * @function toJSON + * @memberof ibc.core.client.v1.Params + * @instance + * @returns {Object.} JSON object + */ + Params.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Params; + })(); + + v1.Query = (function() { + + /** + * Constructs a new Query service. + * @memberof ibc.core.client.v1 + * @classdesc Represents a Query + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Query(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Query.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Query; + + /** + * Callback as used by {@link ibc.core.client.v1.Query#clientState}. + * @memberof ibc.core.client.v1.Query + * @typedef ClientStateCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.client.v1.QueryClientStateResponse} [response] QueryClientStateResponse + */ + + /** + * Calls ClientState. + * @function clientState + * @memberof ibc.core.client.v1.Query + * @instance + * @param {ibc.core.client.v1.IQueryClientStateRequest} request QueryClientStateRequest message or plain object + * @param {ibc.core.client.v1.Query.ClientStateCallback} callback Node-style callback called with the error, if any, and QueryClientStateResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.clientState = function clientState(request, callback) { + return this.rpcCall(clientState, $root.ibc.core.client.v1.QueryClientStateRequest, $root.ibc.core.client.v1.QueryClientStateResponse, request, callback); + }, "name", { value: "ClientState" }); + + /** + * Calls ClientState. + * @function clientState + * @memberof ibc.core.client.v1.Query + * @instance + * @param {ibc.core.client.v1.IQueryClientStateRequest} request QueryClientStateRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.client.v1.Query#clientStates}. + * @memberof ibc.core.client.v1.Query + * @typedef ClientStatesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.client.v1.QueryClientStatesResponse} [response] QueryClientStatesResponse + */ + + /** + * Calls ClientStates. + * @function clientStates + * @memberof ibc.core.client.v1.Query + * @instance + * @param {ibc.core.client.v1.IQueryClientStatesRequest} request QueryClientStatesRequest message or plain object + * @param {ibc.core.client.v1.Query.ClientStatesCallback} callback Node-style callback called with the error, if any, and QueryClientStatesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.clientStates = function clientStates(request, callback) { + return this.rpcCall(clientStates, $root.ibc.core.client.v1.QueryClientStatesRequest, $root.ibc.core.client.v1.QueryClientStatesResponse, request, callback); + }, "name", { value: "ClientStates" }); + + /** + * Calls ClientStates. + * @function clientStates + * @memberof ibc.core.client.v1.Query + * @instance + * @param {ibc.core.client.v1.IQueryClientStatesRequest} request QueryClientStatesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.client.v1.Query#consensusState}. + * @memberof ibc.core.client.v1.Query + * @typedef ConsensusStateCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.client.v1.QueryConsensusStateResponse} [response] QueryConsensusStateResponse + */ + + /** + * Calls ConsensusState. + * @function consensusState + * @memberof ibc.core.client.v1.Query + * @instance + * @param {ibc.core.client.v1.IQueryConsensusStateRequest} request QueryConsensusStateRequest message or plain object + * @param {ibc.core.client.v1.Query.ConsensusStateCallback} callback Node-style callback called with the error, if any, and QueryConsensusStateResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.consensusState = function consensusState(request, callback) { + return this.rpcCall(consensusState, $root.ibc.core.client.v1.QueryConsensusStateRequest, $root.ibc.core.client.v1.QueryConsensusStateResponse, request, callback); + }, "name", { value: "ConsensusState" }); + + /** + * Calls ConsensusState. + * @function consensusState + * @memberof ibc.core.client.v1.Query + * @instance + * @param {ibc.core.client.v1.IQueryConsensusStateRequest} request QueryConsensusStateRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.client.v1.Query#consensusStates}. + * @memberof ibc.core.client.v1.Query + * @typedef ConsensusStatesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.client.v1.QueryConsensusStatesResponse} [response] QueryConsensusStatesResponse + */ + + /** + * Calls ConsensusStates. + * @function consensusStates + * @memberof ibc.core.client.v1.Query + * @instance + * @param {ibc.core.client.v1.IQueryConsensusStatesRequest} request QueryConsensusStatesRequest message or plain object + * @param {ibc.core.client.v1.Query.ConsensusStatesCallback} callback Node-style callback called with the error, if any, and QueryConsensusStatesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.consensusStates = function consensusStates(request, callback) { + return this.rpcCall(consensusStates, $root.ibc.core.client.v1.QueryConsensusStatesRequest, $root.ibc.core.client.v1.QueryConsensusStatesResponse, request, callback); + }, "name", { value: "ConsensusStates" }); + + /** + * Calls ConsensusStates. + * @function consensusStates + * @memberof ibc.core.client.v1.Query + * @instance + * @param {ibc.core.client.v1.IQueryConsensusStatesRequest} request QueryConsensusStatesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.client.v1.Query#clientParams}. + * @memberof ibc.core.client.v1.Query + * @typedef ClientParamsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.client.v1.QueryClientParamsResponse} [response] QueryClientParamsResponse + */ + + /** + * Calls ClientParams. + * @function clientParams + * @memberof ibc.core.client.v1.Query + * @instance + * @param {ibc.core.client.v1.IQueryClientParamsRequest} request QueryClientParamsRequest message or plain object + * @param {ibc.core.client.v1.Query.ClientParamsCallback} callback Node-style callback called with the error, if any, and QueryClientParamsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.clientParams = function clientParams(request, callback) { + return this.rpcCall(clientParams, $root.ibc.core.client.v1.QueryClientParamsRequest, $root.ibc.core.client.v1.QueryClientParamsResponse, request, callback); + }, "name", { value: "ClientParams" }); + + /** + * Calls ClientParams. + * @function clientParams + * @memberof ibc.core.client.v1.Query + * @instance + * @param {ibc.core.client.v1.IQueryClientParamsRequest} request QueryClientParamsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Query; + })(); + + v1.QueryClientStateRequest = (function() { + + /** + * Properties of a QueryClientStateRequest. + * @memberof ibc.core.client.v1 + * @interface IQueryClientStateRequest + * @property {string|null} [client_id] QueryClientStateRequest client_id + */ + + /** + * Constructs a new QueryClientStateRequest. + * @memberof ibc.core.client.v1 + * @classdesc Represents a QueryClientStateRequest. + * @implements IQueryClientStateRequest + * @constructor + * @param {ibc.core.client.v1.IQueryClientStateRequest=} [properties] Properties to set + */ + function QueryClientStateRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryClientStateRequest client_id. + * @member {string} client_id + * @memberof ibc.core.client.v1.QueryClientStateRequest + * @instance + */ + QueryClientStateRequest.prototype.client_id = ""; + + /** + * Encodes the specified QueryClientStateRequest message. Does not implicitly {@link ibc.core.client.v1.QueryClientStateRequest.verify|verify} messages. + * @function encode + * @memberof ibc.core.client.v1.QueryClientStateRequest + * @static + * @param {ibc.core.client.v1.IQueryClientStateRequest} message QueryClientStateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryClientStateRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); + return writer; + }; + + /** + * Encodes the specified QueryClientStateRequest message, length delimited. Does not implicitly {@link ibc.core.client.v1.QueryClientStateRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.client.v1.QueryClientStateRequest + * @static + * @param {ibc.core.client.v1.IQueryClientStateRequest} message QueryClientStateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryClientStateRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryClientStateRequest message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.client.v1.QueryClientStateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.client.v1.QueryClientStateRequest} QueryClientStateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryClientStateRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.QueryClientStateRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.client_id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryClientStateRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.client.v1.QueryClientStateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.client.v1.QueryClientStateRequest} QueryClientStateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryClientStateRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryClientStateRequest message. + * @function verify + * @memberof ibc.core.client.v1.QueryClientStateRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryClientStateRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.client_id != null && message.hasOwnProperty("client_id")) + if (!$util.isString(message.client_id)) + return "client_id: string expected"; + return null; + }; + + /** + * Creates a QueryClientStateRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.client.v1.QueryClientStateRequest + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.client.v1.QueryClientStateRequest} QueryClientStateRequest + */ + QueryClientStateRequest.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.client.v1.QueryClientStateRequest) + return object; + let message = new $root.ibc.core.client.v1.QueryClientStateRequest(); + if (object.client_id != null) + message.client_id = String(object.client_id); + return message; + }; + + /** + * Creates a plain object from a QueryClientStateRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.client.v1.QueryClientStateRequest + * @static + * @param {ibc.core.client.v1.QueryClientStateRequest} message QueryClientStateRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryClientStateRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.client_id = ""; + if (message.client_id != null && message.hasOwnProperty("client_id")) + object.client_id = message.client_id; + return object; + }; + + /** + * Converts this QueryClientStateRequest to JSON. + * @function toJSON + * @memberof ibc.core.client.v1.QueryClientStateRequest + * @instance + * @returns {Object.} JSON object + */ + QueryClientStateRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryClientStateRequest; + })(); + + v1.QueryClientStateResponse = (function() { + + /** + * Properties of a QueryClientStateResponse. + * @memberof ibc.core.client.v1 + * @interface IQueryClientStateResponse + * @property {google.protobuf.IAny|null} [client_state] QueryClientStateResponse client_state + * @property {Uint8Array|null} [proof] QueryClientStateResponse proof + * @property {ibc.core.client.v1.IHeight|null} [proof_height] QueryClientStateResponse proof_height + */ + + /** + * Constructs a new QueryClientStateResponse. + * @memberof ibc.core.client.v1 + * @classdesc Represents a QueryClientStateResponse. + * @implements IQueryClientStateResponse + * @constructor + * @param {ibc.core.client.v1.IQueryClientStateResponse=} [properties] Properties to set + */ + function QueryClientStateResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryClientStateResponse client_state. + * @member {google.protobuf.IAny|null|undefined} client_state + * @memberof ibc.core.client.v1.QueryClientStateResponse + * @instance + */ + QueryClientStateResponse.prototype.client_state = null; + + /** + * QueryClientStateResponse proof. + * @member {Uint8Array} proof + * @memberof ibc.core.client.v1.QueryClientStateResponse + * @instance + */ + QueryClientStateResponse.prototype.proof = $util.newBuffer([]); + + /** + * QueryClientStateResponse proof_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height + * @memberof ibc.core.client.v1.QueryClientStateResponse + * @instance + */ + QueryClientStateResponse.prototype.proof_height = null; + + /** + * Encodes the specified QueryClientStateResponse message. Does not implicitly {@link ibc.core.client.v1.QueryClientStateResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.client.v1.QueryClientStateResponse + * @static + * @param {ibc.core.client.v1.IQueryClientStateResponse} message QueryClientStateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryClientStateResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.client_state != null && Object.hasOwnProperty.call(message, "client_state")) + $root.google.protobuf.Any.encode(message.client_state, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proof); + if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) + $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryClientStateResponse message, length delimited. Does not implicitly {@link ibc.core.client.v1.QueryClientStateResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.client.v1.QueryClientStateResponse + * @static + * @param {ibc.core.client.v1.IQueryClientStateResponse} message QueryClientStateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryClientStateResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryClientStateResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.client.v1.QueryClientStateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.client.v1.QueryClientStateResponse} QueryClientStateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryClientStateResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.QueryClientStateResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.client_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryClientStateResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.client.v1.QueryClientStateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.client.v1.QueryClientStateResponse} QueryClientStateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryClientStateResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryClientStateResponse message. + * @function verify + * @memberof ibc.core.client.v1.QueryClientStateResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryClientStateResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.client_state != null && message.hasOwnProperty("client_state")) { + let error = $root.google.protobuf.Any.verify(message.client_state); + if (error) + return "client_state." + error; + } + if (message.proof != null && message.hasOwnProperty("proof")) + if (!(message.proof && typeof message.proof.length === "number" || $util.isString(message.proof))) + return "proof: buffer expected"; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); + if (error) + return "proof_height." + error; + } + return null; + }; + + /** + * Creates a QueryClientStateResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.client.v1.QueryClientStateResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.client.v1.QueryClientStateResponse} QueryClientStateResponse + */ + QueryClientStateResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.client.v1.QueryClientStateResponse) + return object; + let message = new $root.ibc.core.client.v1.QueryClientStateResponse(); + if (object.client_state != null) { + if (typeof object.client_state !== "object") + throw TypeError(".ibc.core.client.v1.QueryClientStateResponse.client_state: object expected"); + message.client_state = $root.google.protobuf.Any.fromObject(object.client_state); + } + if (object.proof != null) + if (typeof object.proof === "string") + $util.base64.decode(object.proof, message.proof = $util.newBuffer($util.base64.length(object.proof)), 0); + else if (object.proof.length) + message.proof = object.proof; + if (object.proof_height != null) { + if (typeof object.proof_height !== "object") + throw TypeError(".ibc.core.client.v1.QueryClientStateResponse.proof_height: object expected"); + message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); + } + return message; + }; + + /** + * Creates a plain object from a QueryClientStateResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.client.v1.QueryClientStateResponse + * @static + * @param {ibc.core.client.v1.QueryClientStateResponse} message QueryClientStateResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryClientStateResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.client_state = null; + if (options.bytes === String) + object.proof = ""; + else { + object.proof = []; + if (options.bytes !== Array) + object.proof = $util.newBuffer(object.proof); + } + object.proof_height = null; + } + if (message.client_state != null && message.hasOwnProperty("client_state")) + object.client_state = $root.google.protobuf.Any.toObject(message.client_state, options); + if (message.proof != null && message.hasOwnProperty("proof")) + object.proof = options.bytes === String ? $util.base64.encode(message.proof, 0, message.proof.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof) : message.proof; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) + object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); + return object; + }; + + /** + * Converts this QueryClientStateResponse to JSON. + * @function toJSON + * @memberof ibc.core.client.v1.QueryClientStateResponse + * @instance + * @returns {Object.} JSON object + */ + QueryClientStateResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryClientStateResponse; + })(); + + v1.QueryClientStatesRequest = (function() { + + /** + * Properties of a QueryClientStatesRequest. + * @memberof ibc.core.client.v1 + * @interface IQueryClientStatesRequest + * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryClientStatesRequest pagination + */ + + /** + * Constructs a new QueryClientStatesRequest. + * @memberof ibc.core.client.v1 + * @classdesc Represents a QueryClientStatesRequest. + * @implements IQueryClientStatesRequest + * @constructor + * @param {ibc.core.client.v1.IQueryClientStatesRequest=} [properties] Properties to set + */ + function QueryClientStatesRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryClientStatesRequest pagination. + * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination + * @memberof ibc.core.client.v1.QueryClientStatesRequest + * @instance + */ + QueryClientStatesRequest.prototype.pagination = null; + + /** + * Encodes the specified QueryClientStatesRequest message. Does not implicitly {@link ibc.core.client.v1.QueryClientStatesRequest.verify|verify} messages. + * @function encode + * @memberof ibc.core.client.v1.QueryClientStatesRequest + * @static + * @param {ibc.core.client.v1.IQueryClientStatesRequest} message QueryClientStatesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryClientStatesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryClientStatesRequest message, length delimited. Does not implicitly {@link ibc.core.client.v1.QueryClientStatesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.client.v1.QueryClientStatesRequest + * @static + * @param {ibc.core.client.v1.IQueryClientStatesRequest} message QueryClientStatesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryClientStatesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryClientStatesRequest message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.client.v1.QueryClientStatesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.client.v1.QueryClientStatesRequest} QueryClientStatesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryClientStatesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.QueryClientStatesRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryClientStatesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.client.v1.QueryClientStatesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.client.v1.QueryClientStatesRequest} QueryClientStatesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryClientStatesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryClientStatesRequest message. + * @function verify + * @memberof ibc.core.client.v1.QueryClientStatesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryClientStatesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryClientStatesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.client.v1.QueryClientStatesRequest + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.client.v1.QueryClientStatesRequest} QueryClientStatesRequest + */ + QueryClientStatesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.client.v1.QueryClientStatesRequest) + return object; + let message = new $root.ibc.core.client.v1.QueryClientStatesRequest(); + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".ibc.core.client.v1.QueryClientStatesRequest.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryClientStatesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.client.v1.QueryClientStatesRequest + * @static + * @param {ibc.core.client.v1.QueryClientStatesRequest} message QueryClientStatesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryClientStatesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.pagination = null; + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryClientStatesRequest to JSON. + * @function toJSON + * @memberof ibc.core.client.v1.QueryClientStatesRequest + * @instance + * @returns {Object.} JSON object + */ + QueryClientStatesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryClientStatesRequest; + })(); + + v1.QueryClientStatesResponse = (function() { + + /** + * Properties of a QueryClientStatesResponse. + * @memberof ibc.core.client.v1 + * @interface IQueryClientStatesResponse + * @property {Array.|null} [client_states] QueryClientStatesResponse client_states + * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryClientStatesResponse pagination + */ + + /** + * Constructs a new QueryClientStatesResponse. + * @memberof ibc.core.client.v1 + * @classdesc Represents a QueryClientStatesResponse. + * @implements IQueryClientStatesResponse + * @constructor + * @param {ibc.core.client.v1.IQueryClientStatesResponse=} [properties] Properties to set + */ + function QueryClientStatesResponse(properties) { + this.client_states = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryClientStatesResponse client_states. + * @member {Array.} client_states + * @memberof ibc.core.client.v1.QueryClientStatesResponse + * @instance + */ + QueryClientStatesResponse.prototype.client_states = $util.emptyArray; + + /** + * QueryClientStatesResponse pagination. + * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination + * @memberof ibc.core.client.v1.QueryClientStatesResponse + * @instance + */ + QueryClientStatesResponse.prototype.pagination = null; + + /** + * Encodes the specified QueryClientStatesResponse message. Does not implicitly {@link ibc.core.client.v1.QueryClientStatesResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.client.v1.QueryClientStatesResponse + * @static + * @param {ibc.core.client.v1.IQueryClientStatesResponse} message QueryClientStatesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryClientStatesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.client_states != null && message.client_states.length) + for (let i = 0; i < message.client_states.length; ++i) + $root.ibc.core.client.v1.IdentifiedClientState.encode(message.client_states[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryClientStatesResponse message, length delimited. Does not implicitly {@link ibc.core.client.v1.QueryClientStatesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.client.v1.QueryClientStatesResponse + * @static + * @param {ibc.core.client.v1.IQueryClientStatesResponse} message QueryClientStatesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryClientStatesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryClientStatesResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.client.v1.QueryClientStatesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.client.v1.QueryClientStatesResponse} QueryClientStatesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryClientStatesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.QueryClientStatesResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.client_states && message.client_states.length)) + message.client_states = []; + message.client_states.push($root.ibc.core.client.v1.IdentifiedClientState.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryClientStatesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.client.v1.QueryClientStatesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.client.v1.QueryClientStatesResponse} QueryClientStatesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryClientStatesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryClientStatesResponse message. + * @function verify + * @memberof ibc.core.client.v1.QueryClientStatesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryClientStatesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.client_states != null && message.hasOwnProperty("client_states")) { + if (!Array.isArray(message.client_states)) + return "client_states: array expected"; + for (let i = 0; i < message.client_states.length; ++i) { + let error = $root.ibc.core.client.v1.IdentifiedClientState.verify(message.client_states[i]); + if (error) + return "client_states." + error; + } + } + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryClientStatesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.client.v1.QueryClientStatesResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.client.v1.QueryClientStatesResponse} QueryClientStatesResponse + */ + QueryClientStatesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.client.v1.QueryClientStatesResponse) + return object; + let message = new $root.ibc.core.client.v1.QueryClientStatesResponse(); + if (object.client_states) { + if (!Array.isArray(object.client_states)) + throw TypeError(".ibc.core.client.v1.QueryClientStatesResponse.client_states: array expected"); + message.client_states = []; + for (let i = 0; i < object.client_states.length; ++i) { + if (typeof object.client_states[i] !== "object") + throw TypeError(".ibc.core.client.v1.QueryClientStatesResponse.client_states: object expected"); + message.client_states[i] = $root.ibc.core.client.v1.IdentifiedClientState.fromObject(object.client_states[i]); + } + } + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".ibc.core.client.v1.QueryClientStatesResponse.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryClientStatesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.client.v1.QueryClientStatesResponse + * @static + * @param {ibc.core.client.v1.QueryClientStatesResponse} message QueryClientStatesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryClientStatesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.client_states = []; + if (options.defaults) + object.pagination = null; + if (message.client_states && message.client_states.length) { + object.client_states = []; + for (let j = 0; j < message.client_states.length; ++j) + object.client_states[j] = $root.ibc.core.client.v1.IdentifiedClientState.toObject(message.client_states[j], options); + } + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryClientStatesResponse to JSON. + * @function toJSON + * @memberof ibc.core.client.v1.QueryClientStatesResponse + * @instance + * @returns {Object.} JSON object + */ + QueryClientStatesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryClientStatesResponse; + })(); + + v1.QueryConsensusStateRequest = (function() { + + /** + * Properties of a QueryConsensusStateRequest. + * @memberof ibc.core.client.v1 + * @interface IQueryConsensusStateRequest + * @property {string|null} [client_id] QueryConsensusStateRequest client_id + * @property {Long|null} [revision_number] QueryConsensusStateRequest revision_number + * @property {Long|null} [revision_height] QueryConsensusStateRequest revision_height + * @property {boolean|null} [latest_height] QueryConsensusStateRequest latest_height + */ + + /** + * Constructs a new QueryConsensusStateRequest. + * @memberof ibc.core.client.v1 + * @classdesc Represents a QueryConsensusStateRequest. + * @implements IQueryConsensusStateRequest + * @constructor + * @param {ibc.core.client.v1.IQueryConsensusStateRequest=} [properties] Properties to set + */ + function QueryConsensusStateRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryConsensusStateRequest client_id. + * @member {string} client_id + * @memberof ibc.core.client.v1.QueryConsensusStateRequest + * @instance + */ + QueryConsensusStateRequest.prototype.client_id = ""; + + /** + * QueryConsensusStateRequest revision_number. + * @member {Long} revision_number + * @memberof ibc.core.client.v1.QueryConsensusStateRequest + * @instance + */ + QueryConsensusStateRequest.prototype.revision_number = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * QueryConsensusStateRequest revision_height. + * @member {Long} revision_height + * @memberof ibc.core.client.v1.QueryConsensusStateRequest + * @instance + */ + QueryConsensusStateRequest.prototype.revision_height = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * QueryConsensusStateRequest latest_height. + * @member {boolean} latest_height + * @memberof ibc.core.client.v1.QueryConsensusStateRequest + * @instance + */ + QueryConsensusStateRequest.prototype.latest_height = false; + + /** + * Encodes the specified QueryConsensusStateRequest message. Does not implicitly {@link ibc.core.client.v1.QueryConsensusStateRequest.verify|verify} messages. + * @function encode + * @memberof ibc.core.client.v1.QueryConsensusStateRequest + * @static + * @param {ibc.core.client.v1.IQueryConsensusStateRequest} message QueryConsensusStateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryConsensusStateRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); + if (message.revision_number != null && Object.hasOwnProperty.call(message, "revision_number")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.revision_number); + if (message.revision_height != null && Object.hasOwnProperty.call(message, "revision_height")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.revision_height); + if (message.latest_height != null && Object.hasOwnProperty.call(message, "latest_height")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.latest_height); + return writer; + }; + + /** + * Encodes the specified QueryConsensusStateRequest message, length delimited. Does not implicitly {@link ibc.core.client.v1.QueryConsensusStateRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.client.v1.QueryConsensusStateRequest + * @static + * @param {ibc.core.client.v1.IQueryConsensusStateRequest} message QueryConsensusStateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryConsensusStateRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryConsensusStateRequest message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.client.v1.QueryConsensusStateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.client.v1.QueryConsensusStateRequest} QueryConsensusStateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryConsensusStateRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.QueryConsensusStateRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.client_id = reader.string(); + break; + case 2: + message.revision_number = reader.uint64(); + break; + case 3: + message.revision_height = reader.uint64(); + break; + case 4: + message.latest_height = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryConsensusStateRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.client.v1.QueryConsensusStateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.client.v1.QueryConsensusStateRequest} QueryConsensusStateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryConsensusStateRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryConsensusStateRequest message. + * @function verify + * @memberof ibc.core.client.v1.QueryConsensusStateRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryConsensusStateRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.client_id != null && message.hasOwnProperty("client_id")) + if (!$util.isString(message.client_id)) + return "client_id: string expected"; + if (message.revision_number != null && message.hasOwnProperty("revision_number")) + if (!$util.isInteger(message.revision_number) && !(message.revision_number && $util.isInteger(message.revision_number.low) && $util.isInteger(message.revision_number.high))) + return "revision_number: integer|Long expected"; + if (message.revision_height != null && message.hasOwnProperty("revision_height")) + if (!$util.isInteger(message.revision_height) && !(message.revision_height && $util.isInteger(message.revision_height.low) && $util.isInteger(message.revision_height.high))) + return "revision_height: integer|Long expected"; + if (message.latest_height != null && message.hasOwnProperty("latest_height")) + if (typeof message.latest_height !== "boolean") + return "latest_height: boolean expected"; + return null; + }; + + /** + * Creates a QueryConsensusStateRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.client.v1.QueryConsensusStateRequest + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.client.v1.QueryConsensusStateRequest} QueryConsensusStateRequest + */ + QueryConsensusStateRequest.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.client.v1.QueryConsensusStateRequest) + return object; + let message = new $root.ibc.core.client.v1.QueryConsensusStateRequest(); + if (object.client_id != null) + message.client_id = String(object.client_id); + if (object.revision_number != null) + if ($util.Long) + (message.revision_number = $util.Long.fromValue(object.revision_number)).unsigned = true; + else if (typeof object.revision_number === "string") + message.revision_number = parseInt(object.revision_number, 10); + else if (typeof object.revision_number === "number") + message.revision_number = object.revision_number; + else if (typeof object.revision_number === "object") + message.revision_number = new $util.LongBits(object.revision_number.low >>> 0, object.revision_number.high >>> 0).toNumber(true); + if (object.revision_height != null) + if ($util.Long) + (message.revision_height = $util.Long.fromValue(object.revision_height)).unsigned = true; + else if (typeof object.revision_height === "string") + message.revision_height = parseInt(object.revision_height, 10); + else if (typeof object.revision_height === "number") + message.revision_height = object.revision_height; + else if (typeof object.revision_height === "object") + message.revision_height = new $util.LongBits(object.revision_height.low >>> 0, object.revision_height.high >>> 0).toNumber(true); + if (object.latest_height != null) + message.latest_height = Boolean(object.latest_height); + return message; + }; + + /** + * Creates a plain object from a QueryConsensusStateRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.client.v1.QueryConsensusStateRequest + * @static + * @param {ibc.core.client.v1.QueryConsensusStateRequest} message QueryConsensusStateRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryConsensusStateRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.client_id = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.revision_number = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.revision_number = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.revision_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.revision_height = options.longs === String ? "0" : 0; + object.latest_height = false; + } + if (message.client_id != null && message.hasOwnProperty("client_id")) + object.client_id = message.client_id; + if (message.revision_number != null && message.hasOwnProperty("revision_number")) + if (typeof message.revision_number === "number") + object.revision_number = options.longs === String ? String(message.revision_number) : message.revision_number; + else + object.revision_number = options.longs === String ? $util.Long.prototype.toString.call(message.revision_number) : options.longs === Number ? new $util.LongBits(message.revision_number.low >>> 0, message.revision_number.high >>> 0).toNumber(true) : message.revision_number; + if (message.revision_height != null && message.hasOwnProperty("revision_height")) + if (typeof message.revision_height === "number") + object.revision_height = options.longs === String ? String(message.revision_height) : message.revision_height; + else + object.revision_height = options.longs === String ? $util.Long.prototype.toString.call(message.revision_height) : options.longs === Number ? new $util.LongBits(message.revision_height.low >>> 0, message.revision_height.high >>> 0).toNumber(true) : message.revision_height; + if (message.latest_height != null && message.hasOwnProperty("latest_height")) + object.latest_height = message.latest_height; + return object; + }; + + /** + * Converts this QueryConsensusStateRequest to JSON. + * @function toJSON + * @memberof ibc.core.client.v1.QueryConsensusStateRequest + * @instance + * @returns {Object.} JSON object + */ + QueryConsensusStateRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryConsensusStateRequest; + })(); + + v1.QueryConsensusStateResponse = (function() { + + /** + * Properties of a QueryConsensusStateResponse. + * @memberof ibc.core.client.v1 + * @interface IQueryConsensusStateResponse + * @property {google.protobuf.IAny|null} [consensus_state] QueryConsensusStateResponse consensus_state + * @property {Uint8Array|null} [proof] QueryConsensusStateResponse proof + * @property {ibc.core.client.v1.IHeight|null} [proof_height] QueryConsensusStateResponse proof_height + */ + + /** + * Constructs a new QueryConsensusStateResponse. + * @memberof ibc.core.client.v1 + * @classdesc Represents a QueryConsensusStateResponse. + * @implements IQueryConsensusStateResponse + * @constructor + * @param {ibc.core.client.v1.IQueryConsensusStateResponse=} [properties] Properties to set + */ + function QueryConsensusStateResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryConsensusStateResponse consensus_state. + * @member {google.protobuf.IAny|null|undefined} consensus_state + * @memberof ibc.core.client.v1.QueryConsensusStateResponse + * @instance + */ + QueryConsensusStateResponse.prototype.consensus_state = null; + + /** + * QueryConsensusStateResponse proof. + * @member {Uint8Array} proof + * @memberof ibc.core.client.v1.QueryConsensusStateResponse + * @instance + */ + QueryConsensusStateResponse.prototype.proof = $util.newBuffer([]); + + /** + * QueryConsensusStateResponse proof_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height + * @memberof ibc.core.client.v1.QueryConsensusStateResponse + * @instance + */ + QueryConsensusStateResponse.prototype.proof_height = null; + + /** + * Encodes the specified QueryConsensusStateResponse message. Does not implicitly {@link ibc.core.client.v1.QueryConsensusStateResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.client.v1.QueryConsensusStateResponse + * @static + * @param {ibc.core.client.v1.IQueryConsensusStateResponse} message QueryConsensusStateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryConsensusStateResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.consensus_state != null && Object.hasOwnProperty.call(message, "consensus_state")) + $root.google.protobuf.Any.encode(message.consensus_state, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proof); + if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) + $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryConsensusStateResponse message, length delimited. Does not implicitly {@link ibc.core.client.v1.QueryConsensusStateResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.client.v1.QueryConsensusStateResponse + * @static + * @param {ibc.core.client.v1.IQueryConsensusStateResponse} message QueryConsensusStateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryConsensusStateResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryConsensusStateResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.client.v1.QueryConsensusStateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.client.v1.QueryConsensusStateResponse} QueryConsensusStateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryConsensusStateResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.QueryConsensusStateResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.consensus_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryConsensusStateResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.client.v1.QueryConsensusStateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.client.v1.QueryConsensusStateResponse} QueryConsensusStateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryConsensusStateResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryConsensusStateResponse message. + * @function verify + * @memberof ibc.core.client.v1.QueryConsensusStateResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryConsensusStateResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) { + let error = $root.google.protobuf.Any.verify(message.consensus_state); + if (error) + return "consensus_state." + error; + } + if (message.proof != null && message.hasOwnProperty("proof")) + if (!(message.proof && typeof message.proof.length === "number" || $util.isString(message.proof))) + return "proof: buffer expected"; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); + if (error) + return "proof_height." + error; + } + return null; + }; + + /** + * Creates a QueryConsensusStateResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.client.v1.QueryConsensusStateResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.client.v1.QueryConsensusStateResponse} QueryConsensusStateResponse + */ + QueryConsensusStateResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.client.v1.QueryConsensusStateResponse) + return object; + let message = new $root.ibc.core.client.v1.QueryConsensusStateResponse(); + if (object.consensus_state != null) { + if (typeof object.consensus_state !== "object") + throw TypeError(".ibc.core.client.v1.QueryConsensusStateResponse.consensus_state: object expected"); + message.consensus_state = $root.google.protobuf.Any.fromObject(object.consensus_state); + } + if (object.proof != null) + if (typeof object.proof === "string") + $util.base64.decode(object.proof, message.proof = $util.newBuffer($util.base64.length(object.proof)), 0); + else if (object.proof.length) + message.proof = object.proof; + if (object.proof_height != null) { + if (typeof object.proof_height !== "object") + throw TypeError(".ibc.core.client.v1.QueryConsensusStateResponse.proof_height: object expected"); + message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); + } + return message; + }; + + /** + * Creates a plain object from a QueryConsensusStateResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.client.v1.QueryConsensusStateResponse + * @static + * @param {ibc.core.client.v1.QueryConsensusStateResponse} message QueryConsensusStateResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryConsensusStateResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.consensus_state = null; + if (options.bytes === String) + object.proof = ""; + else { + object.proof = []; + if (options.bytes !== Array) + object.proof = $util.newBuffer(object.proof); + } + object.proof_height = null; + } + if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) + object.consensus_state = $root.google.protobuf.Any.toObject(message.consensus_state, options); + if (message.proof != null && message.hasOwnProperty("proof")) + object.proof = options.bytes === String ? $util.base64.encode(message.proof, 0, message.proof.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof) : message.proof; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) + object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); + return object; + }; + + /** + * Converts this QueryConsensusStateResponse to JSON. + * @function toJSON + * @memberof ibc.core.client.v1.QueryConsensusStateResponse + * @instance + * @returns {Object.} JSON object + */ + QueryConsensusStateResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryConsensusStateResponse; + })(); + + v1.QueryConsensusStatesRequest = (function() { + + /** + * Properties of a QueryConsensusStatesRequest. + * @memberof ibc.core.client.v1 + * @interface IQueryConsensusStatesRequest + * @property {string|null} [client_id] QueryConsensusStatesRequest client_id + * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryConsensusStatesRequest pagination + */ + + /** + * Constructs a new QueryConsensusStatesRequest. + * @memberof ibc.core.client.v1 + * @classdesc Represents a QueryConsensusStatesRequest. + * @implements IQueryConsensusStatesRequest + * @constructor + * @param {ibc.core.client.v1.IQueryConsensusStatesRequest=} [properties] Properties to set + */ + function QueryConsensusStatesRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryConsensusStatesRequest client_id. + * @member {string} client_id + * @memberof ibc.core.client.v1.QueryConsensusStatesRequest + * @instance + */ + QueryConsensusStatesRequest.prototype.client_id = ""; + + /** + * QueryConsensusStatesRequest pagination. + * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination + * @memberof ibc.core.client.v1.QueryConsensusStatesRequest + * @instance + */ + QueryConsensusStatesRequest.prototype.pagination = null; + + /** + * Encodes the specified QueryConsensusStatesRequest message. Does not implicitly {@link ibc.core.client.v1.QueryConsensusStatesRequest.verify|verify} messages. + * @function encode + * @memberof ibc.core.client.v1.QueryConsensusStatesRequest + * @static + * @param {ibc.core.client.v1.IQueryConsensusStatesRequest} message QueryConsensusStatesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryConsensusStatesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryConsensusStatesRequest message, length delimited. Does not implicitly {@link ibc.core.client.v1.QueryConsensusStatesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.client.v1.QueryConsensusStatesRequest + * @static + * @param {ibc.core.client.v1.IQueryConsensusStatesRequest} message QueryConsensusStatesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryConsensusStatesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryConsensusStatesRequest message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.client.v1.QueryConsensusStatesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.client.v1.QueryConsensusStatesRequest} QueryConsensusStatesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryConsensusStatesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.QueryConsensusStatesRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.client_id = reader.string(); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryConsensusStatesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.client.v1.QueryConsensusStatesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.client.v1.QueryConsensusStatesRequest} QueryConsensusStatesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryConsensusStatesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryConsensusStatesRequest message. + * @function verify + * @memberof ibc.core.client.v1.QueryConsensusStatesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryConsensusStatesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.client_id != null && message.hasOwnProperty("client_id")) + if (!$util.isString(message.client_id)) + return "client_id: string expected"; + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryConsensusStatesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.client.v1.QueryConsensusStatesRequest + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.client.v1.QueryConsensusStatesRequest} QueryConsensusStatesRequest + */ + QueryConsensusStatesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.client.v1.QueryConsensusStatesRequest) + return object; + let message = new $root.ibc.core.client.v1.QueryConsensusStatesRequest(); + if (object.client_id != null) + message.client_id = String(object.client_id); + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".ibc.core.client.v1.QueryConsensusStatesRequest.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryConsensusStatesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.client.v1.QueryConsensusStatesRequest + * @static + * @param {ibc.core.client.v1.QueryConsensusStatesRequest} message QueryConsensusStatesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryConsensusStatesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.client_id = ""; + object.pagination = null; + } + if (message.client_id != null && message.hasOwnProperty("client_id")) + object.client_id = message.client_id; + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryConsensusStatesRequest to JSON. + * @function toJSON + * @memberof ibc.core.client.v1.QueryConsensusStatesRequest + * @instance + * @returns {Object.} JSON object + */ + QueryConsensusStatesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryConsensusStatesRequest; + })(); + + v1.QueryConsensusStatesResponse = (function() { + + /** + * Properties of a QueryConsensusStatesResponse. + * @memberof ibc.core.client.v1 + * @interface IQueryConsensusStatesResponse + * @property {Array.|null} [consensus_states] QueryConsensusStatesResponse consensus_states + * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryConsensusStatesResponse pagination + */ + + /** + * Constructs a new QueryConsensusStatesResponse. + * @memberof ibc.core.client.v1 + * @classdesc Represents a QueryConsensusStatesResponse. + * @implements IQueryConsensusStatesResponse + * @constructor + * @param {ibc.core.client.v1.IQueryConsensusStatesResponse=} [properties] Properties to set + */ + function QueryConsensusStatesResponse(properties) { + this.consensus_states = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryConsensusStatesResponse consensus_states. + * @member {Array.} consensus_states + * @memberof ibc.core.client.v1.QueryConsensusStatesResponse + * @instance + */ + QueryConsensusStatesResponse.prototype.consensus_states = $util.emptyArray; + + /** + * QueryConsensusStatesResponse pagination. + * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination + * @memberof ibc.core.client.v1.QueryConsensusStatesResponse + * @instance + */ + QueryConsensusStatesResponse.prototype.pagination = null; + + /** + * Encodes the specified QueryConsensusStatesResponse message. Does not implicitly {@link ibc.core.client.v1.QueryConsensusStatesResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.client.v1.QueryConsensusStatesResponse + * @static + * @param {ibc.core.client.v1.IQueryConsensusStatesResponse} message QueryConsensusStatesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryConsensusStatesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.consensus_states != null && message.consensus_states.length) + for (let i = 0; i < message.consensus_states.length; ++i) + $root.ibc.core.client.v1.ConsensusStateWithHeight.encode(message.consensus_states[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryConsensusStatesResponse message, length delimited. Does not implicitly {@link ibc.core.client.v1.QueryConsensusStatesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.client.v1.QueryConsensusStatesResponse + * @static + * @param {ibc.core.client.v1.IQueryConsensusStatesResponse} message QueryConsensusStatesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryConsensusStatesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryConsensusStatesResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.client.v1.QueryConsensusStatesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.client.v1.QueryConsensusStatesResponse} QueryConsensusStatesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryConsensusStatesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.QueryConsensusStatesResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.consensus_states && message.consensus_states.length)) + message.consensus_states = []; + message.consensus_states.push($root.ibc.core.client.v1.ConsensusStateWithHeight.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryConsensusStatesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.client.v1.QueryConsensusStatesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.client.v1.QueryConsensusStatesResponse} QueryConsensusStatesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryConsensusStatesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryConsensusStatesResponse message. + * @function verify + * @memberof ibc.core.client.v1.QueryConsensusStatesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryConsensusStatesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.consensus_states != null && message.hasOwnProperty("consensus_states")) { + if (!Array.isArray(message.consensus_states)) + return "consensus_states: array expected"; + for (let i = 0; i < message.consensus_states.length; ++i) { + let error = $root.ibc.core.client.v1.ConsensusStateWithHeight.verify(message.consensus_states[i]); + if (error) + return "consensus_states." + error; + } + } + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryConsensusStatesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.client.v1.QueryConsensusStatesResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.client.v1.QueryConsensusStatesResponse} QueryConsensusStatesResponse + */ + QueryConsensusStatesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.client.v1.QueryConsensusStatesResponse) + return object; + let message = new $root.ibc.core.client.v1.QueryConsensusStatesResponse(); + if (object.consensus_states) { + if (!Array.isArray(object.consensus_states)) + throw TypeError(".ibc.core.client.v1.QueryConsensusStatesResponse.consensus_states: array expected"); + message.consensus_states = []; + for (let i = 0; i < object.consensus_states.length; ++i) { + if (typeof object.consensus_states[i] !== "object") + throw TypeError(".ibc.core.client.v1.QueryConsensusStatesResponse.consensus_states: object expected"); + message.consensus_states[i] = $root.ibc.core.client.v1.ConsensusStateWithHeight.fromObject(object.consensus_states[i]); + } + } + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".ibc.core.client.v1.QueryConsensusStatesResponse.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryConsensusStatesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.client.v1.QueryConsensusStatesResponse + * @static + * @param {ibc.core.client.v1.QueryConsensusStatesResponse} message QueryConsensusStatesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryConsensusStatesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.consensus_states = []; + if (options.defaults) + object.pagination = null; + if (message.consensus_states && message.consensus_states.length) { + object.consensus_states = []; + for (let j = 0; j < message.consensus_states.length; ++j) + object.consensus_states[j] = $root.ibc.core.client.v1.ConsensusStateWithHeight.toObject(message.consensus_states[j], options); + } + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryConsensusStatesResponse to JSON. + * @function toJSON + * @memberof ibc.core.client.v1.QueryConsensusStatesResponse + * @instance + * @returns {Object.} JSON object + */ + QueryConsensusStatesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryConsensusStatesResponse; + })(); + + v1.QueryClientParamsRequest = (function() { + + /** + * Properties of a QueryClientParamsRequest. + * @memberof ibc.core.client.v1 + * @interface IQueryClientParamsRequest + */ + + /** + * Constructs a new QueryClientParamsRequest. + * @memberof ibc.core.client.v1 + * @classdesc Represents a QueryClientParamsRequest. + * @implements IQueryClientParamsRequest + * @constructor + * @param {ibc.core.client.v1.IQueryClientParamsRequest=} [properties] Properties to set + */ + function QueryClientParamsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified QueryClientParamsRequest message. Does not implicitly {@link ibc.core.client.v1.QueryClientParamsRequest.verify|verify} messages. + * @function encode + * @memberof ibc.core.client.v1.QueryClientParamsRequest + * @static + * @param {ibc.core.client.v1.IQueryClientParamsRequest} message QueryClientParamsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryClientParamsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified QueryClientParamsRequest message, length delimited. Does not implicitly {@link ibc.core.client.v1.QueryClientParamsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.client.v1.QueryClientParamsRequest + * @static + * @param {ibc.core.client.v1.IQueryClientParamsRequest} message QueryClientParamsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryClientParamsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryClientParamsRequest message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.client.v1.QueryClientParamsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.client.v1.QueryClientParamsRequest} QueryClientParamsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryClientParamsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.QueryClientParamsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryClientParamsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.client.v1.QueryClientParamsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.client.v1.QueryClientParamsRequest} QueryClientParamsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryClientParamsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryClientParamsRequest message. + * @function verify + * @memberof ibc.core.client.v1.QueryClientParamsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryClientParamsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a QueryClientParamsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.client.v1.QueryClientParamsRequest + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.client.v1.QueryClientParamsRequest} QueryClientParamsRequest + */ + QueryClientParamsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.client.v1.QueryClientParamsRequest) + return object; + return new $root.ibc.core.client.v1.QueryClientParamsRequest(); + }; + + /** + * Creates a plain object from a QueryClientParamsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.client.v1.QueryClientParamsRequest + * @static + * @param {ibc.core.client.v1.QueryClientParamsRequest} message QueryClientParamsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryClientParamsRequest.toObject = function toObject() { + return {}; + }; + + /** + * Converts this QueryClientParamsRequest to JSON. + * @function toJSON + * @memberof ibc.core.client.v1.QueryClientParamsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryClientParamsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryClientParamsRequest; + })(); + + v1.QueryClientParamsResponse = (function() { + + /** + * Properties of a QueryClientParamsResponse. + * @memberof ibc.core.client.v1 + * @interface IQueryClientParamsResponse + * @property {ibc.core.client.v1.IParams|null} [params] QueryClientParamsResponse params + */ + + /** + * Constructs a new QueryClientParamsResponse. + * @memberof ibc.core.client.v1 + * @classdesc Represents a QueryClientParamsResponse. + * @implements IQueryClientParamsResponse + * @constructor + * @param {ibc.core.client.v1.IQueryClientParamsResponse=} [properties] Properties to set + */ + function QueryClientParamsResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryClientParamsResponse params. + * @member {ibc.core.client.v1.IParams|null|undefined} params + * @memberof ibc.core.client.v1.QueryClientParamsResponse + * @instance + */ + QueryClientParamsResponse.prototype.params = null; + + /** + * Encodes the specified QueryClientParamsResponse message. Does not implicitly {@link ibc.core.client.v1.QueryClientParamsResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.client.v1.QueryClientParamsResponse + * @static + * @param {ibc.core.client.v1.IQueryClientParamsResponse} message QueryClientParamsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryClientParamsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.params != null && Object.hasOwnProperty.call(message, "params")) + $root.ibc.core.client.v1.Params.encode(message.params, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryClientParamsResponse message, length delimited. Does not implicitly {@link ibc.core.client.v1.QueryClientParamsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.client.v1.QueryClientParamsResponse + * @static + * @param {ibc.core.client.v1.IQueryClientParamsResponse} message QueryClientParamsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryClientParamsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryClientParamsResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.client.v1.QueryClientParamsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.client.v1.QueryClientParamsResponse} QueryClientParamsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryClientParamsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.QueryClientParamsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = $root.ibc.core.client.v1.Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryClientParamsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.client.v1.QueryClientParamsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.client.v1.QueryClientParamsResponse} QueryClientParamsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryClientParamsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryClientParamsResponse message. + * @function verify + * @memberof ibc.core.client.v1.QueryClientParamsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryClientParamsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.params != null && message.hasOwnProperty("params")) { + let error = $root.ibc.core.client.v1.Params.verify(message.params); + if (error) + return "params." + error; + } + return null; + }; + + /** + * Creates a QueryClientParamsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.client.v1.QueryClientParamsResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.client.v1.QueryClientParamsResponse} QueryClientParamsResponse + */ + QueryClientParamsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.client.v1.QueryClientParamsResponse) + return object; + let message = new $root.ibc.core.client.v1.QueryClientParamsResponse(); + if (object.params != null) { + if (typeof object.params !== "object") + throw TypeError(".ibc.core.client.v1.QueryClientParamsResponse.params: object expected"); + message.params = $root.ibc.core.client.v1.Params.fromObject(object.params); + } + return message; + }; + + /** + * Creates a plain object from a QueryClientParamsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.client.v1.QueryClientParamsResponse + * @static + * @param {ibc.core.client.v1.QueryClientParamsResponse} message QueryClientParamsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryClientParamsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.params = null; + if (message.params != null && message.hasOwnProperty("params")) + object.params = $root.ibc.core.client.v1.Params.toObject(message.params, options); + return object; + }; + + /** + * Converts this QueryClientParamsResponse to JSON. + * @function toJSON + * @memberof ibc.core.client.v1.QueryClientParamsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryClientParamsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryClientParamsResponse; + })(); + + v1.GenesisState = (function() { + + /** + * Properties of a GenesisState. + * @memberof ibc.core.client.v1 + * @interface IGenesisState + * @property {Array.|null} [clients] GenesisState clients + * @property {Array.|null} [clients_consensus] GenesisState clients_consensus + * @property {Array.|null} [clients_metadata] GenesisState clients_metadata + * @property {ibc.core.client.v1.IParams|null} [params] GenesisState params + * @property {boolean|null} [create_localhost] GenesisState create_localhost + * @property {Long|null} [next_client_sequence] GenesisState next_client_sequence + */ + + /** + * Constructs a new GenesisState. + * @memberof ibc.core.client.v1 + * @classdesc Represents a GenesisState. + * @implements IGenesisState + * @constructor + * @param {ibc.core.client.v1.IGenesisState=} [properties] Properties to set + */ + function GenesisState(properties) { + this.clients = []; + this.clients_consensus = []; + this.clients_metadata = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenesisState clients. + * @member {Array.} clients + * @memberof ibc.core.client.v1.GenesisState + * @instance + */ + GenesisState.prototype.clients = $util.emptyArray; + + /** + * GenesisState clients_consensus. + * @member {Array.} clients_consensus + * @memberof ibc.core.client.v1.GenesisState + * @instance + */ + GenesisState.prototype.clients_consensus = $util.emptyArray; + + /** + * GenesisState clients_metadata. + * @member {Array.} clients_metadata + * @memberof ibc.core.client.v1.GenesisState + * @instance + */ + GenesisState.prototype.clients_metadata = $util.emptyArray; + + /** + * GenesisState params. + * @member {ibc.core.client.v1.IParams|null|undefined} params + * @memberof ibc.core.client.v1.GenesisState + * @instance + */ + GenesisState.prototype.params = null; + + /** + * GenesisState create_localhost. + * @member {boolean} create_localhost + * @memberof ibc.core.client.v1.GenesisState + * @instance + */ + GenesisState.prototype.create_localhost = false; + + /** + * GenesisState next_client_sequence. + * @member {Long} next_client_sequence + * @memberof ibc.core.client.v1.GenesisState + * @instance + */ + GenesisState.prototype.next_client_sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified GenesisState message. Does not implicitly {@link ibc.core.client.v1.GenesisState.verify|verify} messages. + * @function encode + * @memberof ibc.core.client.v1.GenesisState + * @static + * @param {ibc.core.client.v1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.clients != null && message.clients.length) + for (let i = 0; i < message.clients.length; ++i) + $root.ibc.core.client.v1.IdentifiedClientState.encode(message.clients[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.clients_consensus != null && message.clients_consensus.length) + for (let i = 0; i < message.clients_consensus.length; ++i) + $root.ibc.core.client.v1.ClientConsensusStates.encode(message.clients_consensus[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.clients_metadata != null && message.clients_metadata.length) + for (let i = 0; i < message.clients_metadata.length; ++i) + $root.ibc.core.client.v1.IdentifiedGenesisMetadata.encode(message.clients_metadata[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.params != null && Object.hasOwnProperty.call(message, "params")) + $root.ibc.core.client.v1.Params.encode(message.params, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.create_localhost != null && Object.hasOwnProperty.call(message, "create_localhost")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.create_localhost); + if (message.next_client_sequence != null && Object.hasOwnProperty.call(message, "next_client_sequence")) + writer.uint32(/* id 6, wireType 0 =*/48).uint64(message.next_client_sequence); + return writer; + }; + + /** + * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link ibc.core.client.v1.GenesisState.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.client.v1.GenesisState + * @static + * @param {ibc.core.client.v1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.client.v1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.client.v1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.GenesisState(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.clients && message.clients.length)) + message.clients = []; + message.clients.push($root.ibc.core.client.v1.IdentifiedClientState.decode(reader, reader.uint32())); + break; + case 2: + if (!(message.clients_consensus && message.clients_consensus.length)) + message.clients_consensus = []; + message.clients_consensus.push($root.ibc.core.client.v1.ClientConsensusStates.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.clients_metadata && message.clients_metadata.length)) + message.clients_metadata = []; + message.clients_metadata.push($root.ibc.core.client.v1.IdentifiedGenesisMetadata.decode(reader, reader.uint32())); + break; + case 4: + message.params = $root.ibc.core.client.v1.Params.decode(reader, reader.uint32()); + break; + case 5: + message.create_localhost = reader.bool(); + break; + case 6: + message.next_client_sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.client.v1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.client.v1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenesisState message. + * @function verify + * @memberof ibc.core.client.v1.GenesisState + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenesisState.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.clients != null && message.hasOwnProperty("clients")) { + if (!Array.isArray(message.clients)) + return "clients: array expected"; + for (let i = 0; i < message.clients.length; ++i) { + let error = $root.ibc.core.client.v1.IdentifiedClientState.verify(message.clients[i]); + if (error) + return "clients." + error; + } + } + if (message.clients_consensus != null && message.hasOwnProperty("clients_consensus")) { + if (!Array.isArray(message.clients_consensus)) + return "clients_consensus: array expected"; + for (let i = 0; i < message.clients_consensus.length; ++i) { + let error = $root.ibc.core.client.v1.ClientConsensusStates.verify(message.clients_consensus[i]); + if (error) + return "clients_consensus." + error; + } + } + if (message.clients_metadata != null && message.hasOwnProperty("clients_metadata")) { + if (!Array.isArray(message.clients_metadata)) + return "clients_metadata: array expected"; + for (let i = 0; i < message.clients_metadata.length; ++i) { + let error = $root.ibc.core.client.v1.IdentifiedGenesisMetadata.verify(message.clients_metadata[i]); + if (error) + return "clients_metadata." + error; + } + } + if (message.params != null && message.hasOwnProperty("params")) { + let error = $root.ibc.core.client.v1.Params.verify(message.params); + if (error) + return "params." + error; + } + if (message.create_localhost != null && message.hasOwnProperty("create_localhost")) + if (typeof message.create_localhost !== "boolean") + return "create_localhost: boolean expected"; + if (message.next_client_sequence != null && message.hasOwnProperty("next_client_sequence")) + if (!$util.isInteger(message.next_client_sequence) && !(message.next_client_sequence && $util.isInteger(message.next_client_sequence.low) && $util.isInteger(message.next_client_sequence.high))) + return "next_client_sequence: integer|Long expected"; + return null; + }; + + /** + * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.client.v1.GenesisState + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.client.v1.GenesisState} GenesisState + */ + GenesisState.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.client.v1.GenesisState) + return object; + let message = new $root.ibc.core.client.v1.GenesisState(); + if (object.clients) { + if (!Array.isArray(object.clients)) + throw TypeError(".ibc.core.client.v1.GenesisState.clients: array expected"); + message.clients = []; + for (let i = 0; i < object.clients.length; ++i) { + if (typeof object.clients[i] !== "object") + throw TypeError(".ibc.core.client.v1.GenesisState.clients: object expected"); + message.clients[i] = $root.ibc.core.client.v1.IdentifiedClientState.fromObject(object.clients[i]); + } + } + if (object.clients_consensus) { + if (!Array.isArray(object.clients_consensus)) + throw TypeError(".ibc.core.client.v1.GenesisState.clients_consensus: array expected"); + message.clients_consensus = []; + for (let i = 0; i < object.clients_consensus.length; ++i) { + if (typeof object.clients_consensus[i] !== "object") + throw TypeError(".ibc.core.client.v1.GenesisState.clients_consensus: object expected"); + message.clients_consensus[i] = $root.ibc.core.client.v1.ClientConsensusStates.fromObject(object.clients_consensus[i]); + } + } + if (object.clients_metadata) { + if (!Array.isArray(object.clients_metadata)) + throw TypeError(".ibc.core.client.v1.GenesisState.clients_metadata: array expected"); + message.clients_metadata = []; + for (let i = 0; i < object.clients_metadata.length; ++i) { + if (typeof object.clients_metadata[i] !== "object") + throw TypeError(".ibc.core.client.v1.GenesisState.clients_metadata: object expected"); + message.clients_metadata[i] = $root.ibc.core.client.v1.IdentifiedGenesisMetadata.fromObject(object.clients_metadata[i]); + } + } + if (object.params != null) { + if (typeof object.params !== "object") + throw TypeError(".ibc.core.client.v1.GenesisState.params: object expected"); + message.params = $root.ibc.core.client.v1.Params.fromObject(object.params); + } + if (object.create_localhost != null) + message.create_localhost = Boolean(object.create_localhost); + if (object.next_client_sequence != null) + if ($util.Long) + (message.next_client_sequence = $util.Long.fromValue(object.next_client_sequence)).unsigned = true; + else if (typeof object.next_client_sequence === "string") + message.next_client_sequence = parseInt(object.next_client_sequence, 10); + else if (typeof object.next_client_sequence === "number") + message.next_client_sequence = object.next_client_sequence; + else if (typeof object.next_client_sequence === "object") + message.next_client_sequence = new $util.LongBits(object.next_client_sequence.low >>> 0, object.next_client_sequence.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a GenesisState message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.client.v1.GenesisState + * @static + * @param {ibc.core.client.v1.GenesisState} message GenesisState + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenesisState.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) { + object.clients = []; + object.clients_consensus = []; + object.clients_metadata = []; + } + if (options.defaults) { + object.params = null; + object.create_localhost = false; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.next_client_sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.next_client_sequence = options.longs === String ? "0" : 0; + } + if (message.clients && message.clients.length) { + object.clients = []; + for (let j = 0; j < message.clients.length; ++j) + object.clients[j] = $root.ibc.core.client.v1.IdentifiedClientState.toObject(message.clients[j], options); + } + if (message.clients_consensus && message.clients_consensus.length) { + object.clients_consensus = []; + for (let j = 0; j < message.clients_consensus.length; ++j) + object.clients_consensus[j] = $root.ibc.core.client.v1.ClientConsensusStates.toObject(message.clients_consensus[j], options); + } + if (message.clients_metadata && message.clients_metadata.length) { + object.clients_metadata = []; + for (let j = 0; j < message.clients_metadata.length; ++j) + object.clients_metadata[j] = $root.ibc.core.client.v1.IdentifiedGenesisMetadata.toObject(message.clients_metadata[j], options); + } + if (message.params != null && message.hasOwnProperty("params")) + object.params = $root.ibc.core.client.v1.Params.toObject(message.params, options); + if (message.create_localhost != null && message.hasOwnProperty("create_localhost")) + object.create_localhost = message.create_localhost; + if (message.next_client_sequence != null && message.hasOwnProperty("next_client_sequence")) + if (typeof message.next_client_sequence === "number") + object.next_client_sequence = options.longs === String ? String(message.next_client_sequence) : message.next_client_sequence; + else + object.next_client_sequence = options.longs === String ? $util.Long.prototype.toString.call(message.next_client_sequence) : options.longs === Number ? new $util.LongBits(message.next_client_sequence.low >>> 0, message.next_client_sequence.high >>> 0).toNumber(true) : message.next_client_sequence; + return object; + }; + + /** + * Converts this GenesisState to JSON. + * @function toJSON + * @memberof ibc.core.client.v1.GenesisState + * @instance + * @returns {Object.} JSON object + */ + GenesisState.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenesisState; + })(); + + v1.GenesisMetadata = (function() { + + /** + * Properties of a GenesisMetadata. + * @memberof ibc.core.client.v1 + * @interface IGenesisMetadata + * @property {Uint8Array|null} [key] GenesisMetadata key + * @property {Uint8Array|null} [value] GenesisMetadata value + */ + + /** + * Constructs a new GenesisMetadata. + * @memberof ibc.core.client.v1 + * @classdesc Represents a GenesisMetadata. + * @implements IGenesisMetadata + * @constructor + * @param {ibc.core.client.v1.IGenesisMetadata=} [properties] Properties to set + */ + function GenesisMetadata(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenesisMetadata key. + * @member {Uint8Array} key + * @memberof ibc.core.client.v1.GenesisMetadata + * @instance + */ + GenesisMetadata.prototype.key = $util.newBuffer([]); + + /** + * GenesisMetadata value. + * @member {Uint8Array} value + * @memberof ibc.core.client.v1.GenesisMetadata + * @instance + */ + GenesisMetadata.prototype.value = $util.newBuffer([]); + + /** + * Encodes the specified GenesisMetadata message. Does not implicitly {@link ibc.core.client.v1.GenesisMetadata.verify|verify} messages. + * @function encode + * @memberof ibc.core.client.v1.GenesisMetadata + * @static + * @param {ibc.core.client.v1.IGenesisMetadata} message GenesisMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value); + return writer; + }; + + /** + * Encodes the specified GenesisMetadata message, length delimited. Does not implicitly {@link ibc.core.client.v1.GenesisMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.client.v1.GenesisMetadata + * @static + * @param {ibc.core.client.v1.IGenesisMetadata} message GenesisMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenesisMetadata message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.client.v1.GenesisMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.client.v1.GenesisMetadata} GenesisMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.GenesisMetadata(); + while (reader.pos < end) { + let 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; + }; + + /** + * Decodes a GenesisMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.client.v1.GenesisMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.client.v1.GenesisMetadata} GenesisMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenesisMetadata message. + * @function verify + * @memberof ibc.core.client.v1.GenesisMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenesisMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) + return "key: buffer expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) + return "value: buffer expected"; + return null; + }; + + /** + * Creates a GenesisMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.client.v1.GenesisMetadata + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.client.v1.GenesisMetadata} GenesisMetadata + */ + GenesisMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.client.v1.GenesisMetadata) + return object; + let message = new $root.ibc.core.client.v1.GenesisMetadata(); + if (object.key != null) + if (typeof object.key === "string") + $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); + else if (object.key.length) + message.key = object.key; + if (object.value != null) + if (typeof object.value === "string") + $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); + else if (object.value.length) + message.value = object.value; + return message; + }; + + /** + * Creates a plain object from a GenesisMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.client.v1.GenesisMetadata + * @static + * @param {ibc.core.client.v1.GenesisMetadata} message GenesisMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenesisMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if (options.bytes === String) + object.key = ""; + else { + object.key = []; + if (options.bytes !== Array) + object.key = $util.newBuffer(object.key); + } + if (options.bytes === String) + object.value = ""; + else { + object.value = []; + if (options.bytes !== Array) + object.value = $util.newBuffer(object.value); + } + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; + return object; + }; + + /** + * Converts this GenesisMetadata to JSON. + * @function toJSON + * @memberof ibc.core.client.v1.GenesisMetadata + * @instance + * @returns {Object.} JSON object + */ + GenesisMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenesisMetadata; + })(); + + v1.IdentifiedGenesisMetadata = (function() { + + /** + * Properties of an IdentifiedGenesisMetadata. + * @memberof ibc.core.client.v1 + * @interface IIdentifiedGenesisMetadata + * @property {string|null} [client_id] IdentifiedGenesisMetadata client_id + * @property {Array.|null} [client_metadata] IdentifiedGenesisMetadata client_metadata + */ + + /** + * Constructs a new IdentifiedGenesisMetadata. + * @memberof ibc.core.client.v1 + * @classdesc Represents an IdentifiedGenesisMetadata. + * @implements IIdentifiedGenesisMetadata + * @constructor + * @param {ibc.core.client.v1.IIdentifiedGenesisMetadata=} [properties] Properties to set + */ + function IdentifiedGenesisMetadata(properties) { + this.client_metadata = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * IdentifiedGenesisMetadata client_id. + * @member {string} client_id + * @memberof ibc.core.client.v1.IdentifiedGenesisMetadata + * @instance + */ + IdentifiedGenesisMetadata.prototype.client_id = ""; + + /** + * IdentifiedGenesisMetadata client_metadata. + * @member {Array.} client_metadata + * @memberof ibc.core.client.v1.IdentifiedGenesisMetadata + * @instance + */ + IdentifiedGenesisMetadata.prototype.client_metadata = $util.emptyArray; + + /** + * Encodes the specified IdentifiedGenesisMetadata message. Does not implicitly {@link ibc.core.client.v1.IdentifiedGenesisMetadata.verify|verify} messages. + * @function encode + * @memberof ibc.core.client.v1.IdentifiedGenesisMetadata + * @static + * @param {ibc.core.client.v1.IIdentifiedGenesisMetadata} message IdentifiedGenesisMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IdentifiedGenesisMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); + if (message.client_metadata != null && message.client_metadata.length) + for (let i = 0; i < message.client_metadata.length; ++i) + $root.ibc.core.client.v1.GenesisMetadata.encode(message.client_metadata[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified IdentifiedGenesisMetadata message, length delimited. Does not implicitly {@link ibc.core.client.v1.IdentifiedGenesisMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.client.v1.IdentifiedGenesisMetadata + * @static + * @param {ibc.core.client.v1.IIdentifiedGenesisMetadata} message IdentifiedGenesisMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IdentifiedGenesisMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an IdentifiedGenesisMetadata message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.client.v1.IdentifiedGenesisMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.client.v1.IdentifiedGenesisMetadata} IdentifiedGenesisMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IdentifiedGenesisMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.IdentifiedGenesisMetadata(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.client_id = reader.string(); + break; + case 2: + if (!(message.client_metadata && message.client_metadata.length)) + message.client_metadata = []; + message.client_metadata.push($root.ibc.core.client.v1.GenesisMetadata.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an IdentifiedGenesisMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.client.v1.IdentifiedGenesisMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.client.v1.IdentifiedGenesisMetadata} IdentifiedGenesisMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IdentifiedGenesisMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IdentifiedGenesisMetadata message. + * @function verify + * @memberof ibc.core.client.v1.IdentifiedGenesisMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IdentifiedGenesisMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.client_id != null && message.hasOwnProperty("client_id")) + if (!$util.isString(message.client_id)) + return "client_id: string expected"; + if (message.client_metadata != null && message.hasOwnProperty("client_metadata")) { + if (!Array.isArray(message.client_metadata)) + return "client_metadata: array expected"; + for (let i = 0; i < message.client_metadata.length; ++i) { + let error = $root.ibc.core.client.v1.GenesisMetadata.verify(message.client_metadata[i]); + if (error) + return "client_metadata." + error; + } + } + return null; + }; + + /** + * Creates an IdentifiedGenesisMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.client.v1.IdentifiedGenesisMetadata + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.client.v1.IdentifiedGenesisMetadata} IdentifiedGenesisMetadata + */ + IdentifiedGenesisMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.client.v1.IdentifiedGenesisMetadata) + return object; + let message = new $root.ibc.core.client.v1.IdentifiedGenesisMetadata(); + if (object.client_id != null) + message.client_id = String(object.client_id); + if (object.client_metadata) { + if (!Array.isArray(object.client_metadata)) + throw TypeError(".ibc.core.client.v1.IdentifiedGenesisMetadata.client_metadata: array expected"); + message.client_metadata = []; + for (let i = 0; i < object.client_metadata.length; ++i) { + if (typeof object.client_metadata[i] !== "object") + throw TypeError(".ibc.core.client.v1.IdentifiedGenesisMetadata.client_metadata: object expected"); + message.client_metadata[i] = $root.ibc.core.client.v1.GenesisMetadata.fromObject(object.client_metadata[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an IdentifiedGenesisMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.client.v1.IdentifiedGenesisMetadata + * @static + * @param {ibc.core.client.v1.IdentifiedGenesisMetadata} message IdentifiedGenesisMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IdentifiedGenesisMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.client_metadata = []; + if (options.defaults) + object.client_id = ""; + if (message.client_id != null && message.hasOwnProperty("client_id")) + object.client_id = message.client_id; + if (message.client_metadata && message.client_metadata.length) { + object.client_metadata = []; + for (let j = 0; j < message.client_metadata.length; ++j) + object.client_metadata[j] = $root.ibc.core.client.v1.GenesisMetadata.toObject(message.client_metadata[j], options); + } + return object; + }; + + /** + * Converts this IdentifiedGenesisMetadata to JSON. + * @function toJSON + * @memberof ibc.core.client.v1.IdentifiedGenesisMetadata + * @instance + * @returns {Object.} JSON object + */ + IdentifiedGenesisMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return IdentifiedGenesisMetadata; + })(); + + return v1; + })(); + + return client; + })(); + + core.commitment = (function() { + + /** + * Namespace commitment. + * @memberof ibc.core + * @namespace + */ + const commitment = {}; + + commitment.v1 = (function() { + + /** + * Namespace v1. + * @memberof ibc.core.commitment + * @namespace + */ + const v1 = {}; + + v1.MerkleRoot = (function() { + + /** + * Properties of a MerkleRoot. + * @memberof ibc.core.commitment.v1 + * @interface IMerkleRoot + * @property {Uint8Array|null} [hash] MerkleRoot hash + */ + + /** + * Constructs a new MerkleRoot. + * @memberof ibc.core.commitment.v1 + * @classdesc Represents a MerkleRoot. + * @implements IMerkleRoot + * @constructor + * @param {ibc.core.commitment.v1.IMerkleRoot=} [properties] Properties to set + */ + function MerkleRoot(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MerkleRoot hash. + * @member {Uint8Array} hash + * @memberof ibc.core.commitment.v1.MerkleRoot + * @instance + */ + MerkleRoot.prototype.hash = $util.newBuffer([]); + + /** + * Encodes the specified MerkleRoot message. Does not implicitly {@link ibc.core.commitment.v1.MerkleRoot.verify|verify} messages. + * @function encode + * @memberof ibc.core.commitment.v1.MerkleRoot + * @static + * @param {ibc.core.commitment.v1.IMerkleRoot} message MerkleRoot message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MerkleRoot.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.hash != null && Object.hasOwnProperty.call(message, "hash")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.hash); + return writer; + }; + + /** + * Encodes the specified MerkleRoot message, length delimited. Does not implicitly {@link ibc.core.commitment.v1.MerkleRoot.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.commitment.v1.MerkleRoot + * @static + * @param {ibc.core.commitment.v1.IMerkleRoot} message MerkleRoot message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MerkleRoot.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MerkleRoot message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.commitment.v1.MerkleRoot + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.commitment.v1.MerkleRoot} MerkleRoot + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MerkleRoot.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.commitment.v1.MerkleRoot(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MerkleRoot message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.commitment.v1.MerkleRoot + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.commitment.v1.MerkleRoot} MerkleRoot + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MerkleRoot.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MerkleRoot message. + * @function verify + * @memberof ibc.core.commitment.v1.MerkleRoot + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MerkleRoot.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.hash != null && message.hasOwnProperty("hash")) + if (!(message.hash && typeof message.hash.length === "number" || $util.isString(message.hash))) + return "hash: buffer expected"; + return null; + }; + + /** + * Creates a MerkleRoot message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.commitment.v1.MerkleRoot + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.commitment.v1.MerkleRoot} MerkleRoot + */ + MerkleRoot.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.commitment.v1.MerkleRoot) + return object; + let message = new $root.ibc.core.commitment.v1.MerkleRoot(); + if (object.hash != null) + if (typeof object.hash === "string") + $util.base64.decode(object.hash, message.hash = $util.newBuffer($util.base64.length(object.hash)), 0); + else if (object.hash.length) + message.hash = object.hash; + return message; + }; + + /** + * Creates a plain object from a MerkleRoot message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.commitment.v1.MerkleRoot + * @static + * @param {ibc.core.commitment.v1.MerkleRoot} message MerkleRoot + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MerkleRoot.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + if (options.bytes === String) + object.hash = ""; + else { + object.hash = []; + if (options.bytes !== Array) + object.hash = $util.newBuffer(object.hash); + } + if (message.hash != null && message.hasOwnProperty("hash")) + object.hash = options.bytes === String ? $util.base64.encode(message.hash, 0, message.hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.hash) : message.hash; + return object; + }; + + /** + * Converts this MerkleRoot to JSON. + * @function toJSON + * @memberof ibc.core.commitment.v1.MerkleRoot + * @instance + * @returns {Object.} JSON object + */ + MerkleRoot.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MerkleRoot; + })(); + + v1.MerklePrefix = (function() { + + /** + * Properties of a MerklePrefix. + * @memberof ibc.core.commitment.v1 + * @interface IMerklePrefix + * @property {Uint8Array|null} [key_prefix] MerklePrefix key_prefix + */ + + /** + * Constructs a new MerklePrefix. + * @memberof ibc.core.commitment.v1 + * @classdesc Represents a MerklePrefix. + * @implements IMerklePrefix + * @constructor + * @param {ibc.core.commitment.v1.IMerklePrefix=} [properties] Properties to set + */ + function MerklePrefix(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MerklePrefix key_prefix. + * @member {Uint8Array} key_prefix + * @memberof ibc.core.commitment.v1.MerklePrefix + * @instance + */ + MerklePrefix.prototype.key_prefix = $util.newBuffer([]); + + /** + * Encodes the specified MerklePrefix message. Does not implicitly {@link ibc.core.commitment.v1.MerklePrefix.verify|verify} messages. + * @function encode + * @memberof ibc.core.commitment.v1.MerklePrefix + * @static + * @param {ibc.core.commitment.v1.IMerklePrefix} message MerklePrefix message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MerklePrefix.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key_prefix != null && Object.hasOwnProperty.call(message, "key_prefix")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key_prefix); + return writer; + }; + + /** + * Encodes the specified MerklePrefix message, length delimited. Does not implicitly {@link ibc.core.commitment.v1.MerklePrefix.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.commitment.v1.MerklePrefix + * @static + * @param {ibc.core.commitment.v1.IMerklePrefix} message MerklePrefix message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MerklePrefix.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MerklePrefix message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.commitment.v1.MerklePrefix + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.commitment.v1.MerklePrefix} MerklePrefix + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MerklePrefix.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.commitment.v1.MerklePrefix(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key_prefix = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MerklePrefix message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.commitment.v1.MerklePrefix + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.commitment.v1.MerklePrefix} MerklePrefix + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MerklePrefix.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MerklePrefix message. + * @function verify + * @memberof ibc.core.commitment.v1.MerklePrefix + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MerklePrefix.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key_prefix != null && message.hasOwnProperty("key_prefix")) + if (!(message.key_prefix && typeof message.key_prefix.length === "number" || $util.isString(message.key_prefix))) + return "key_prefix: buffer expected"; + return null; + }; + + /** + * Creates a MerklePrefix message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.commitment.v1.MerklePrefix + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.commitment.v1.MerklePrefix} MerklePrefix + */ + MerklePrefix.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.commitment.v1.MerklePrefix) + return object; + let message = new $root.ibc.core.commitment.v1.MerklePrefix(); + if (object.key_prefix != null) + if (typeof object.key_prefix === "string") + $util.base64.decode(object.key_prefix, message.key_prefix = $util.newBuffer($util.base64.length(object.key_prefix)), 0); + else if (object.key_prefix.length) + message.key_prefix = object.key_prefix; + return message; + }; + + /** + * Creates a plain object from a MerklePrefix message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.commitment.v1.MerklePrefix + * @static + * @param {ibc.core.commitment.v1.MerklePrefix} message MerklePrefix + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MerklePrefix.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + if (options.bytes === String) + object.key_prefix = ""; + else { + object.key_prefix = []; + if (options.bytes !== Array) + object.key_prefix = $util.newBuffer(object.key_prefix); + } + if (message.key_prefix != null && message.hasOwnProperty("key_prefix")) + object.key_prefix = options.bytes === String ? $util.base64.encode(message.key_prefix, 0, message.key_prefix.length) : options.bytes === Array ? Array.prototype.slice.call(message.key_prefix) : message.key_prefix; + return object; + }; + + /** + * Converts this MerklePrefix to JSON. + * @function toJSON + * @memberof ibc.core.commitment.v1.MerklePrefix + * @instance + * @returns {Object.} JSON object + */ + MerklePrefix.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MerklePrefix; + })(); + + v1.MerklePath = (function() { + + /** + * Properties of a MerklePath. + * @memberof ibc.core.commitment.v1 + * @interface IMerklePath + * @property {Array.|null} [key_path] MerklePath key_path + */ + + /** + * Constructs a new MerklePath. + * @memberof ibc.core.commitment.v1 + * @classdesc Represents a MerklePath. + * @implements IMerklePath + * @constructor + * @param {ibc.core.commitment.v1.IMerklePath=} [properties] Properties to set + */ + function MerklePath(properties) { + this.key_path = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MerklePath key_path. + * @member {Array.} key_path + * @memberof ibc.core.commitment.v1.MerklePath + * @instance + */ + MerklePath.prototype.key_path = $util.emptyArray; + + /** + * Encodes the specified MerklePath message. Does not implicitly {@link ibc.core.commitment.v1.MerklePath.verify|verify} messages. + * @function encode + * @memberof ibc.core.commitment.v1.MerklePath + * @static + * @param {ibc.core.commitment.v1.IMerklePath} message MerklePath message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MerklePath.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key_path != null && message.key_path.length) + for (let i = 0; i < message.key_path.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key_path[i]); + return writer; + }; + + /** + * Encodes the specified MerklePath message, length delimited. Does not implicitly {@link ibc.core.commitment.v1.MerklePath.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.commitment.v1.MerklePath + * @static + * @param {ibc.core.commitment.v1.IMerklePath} message MerklePath message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MerklePath.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MerklePath message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.commitment.v1.MerklePath + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.commitment.v1.MerklePath} MerklePath + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MerklePath.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.commitment.v1.MerklePath(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.key_path && message.key_path.length)) + message.key_path = []; + message.key_path.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MerklePath message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.commitment.v1.MerklePath + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.commitment.v1.MerklePath} MerklePath + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MerklePath.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MerklePath message. + * @function verify + * @memberof ibc.core.commitment.v1.MerklePath + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MerklePath.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key_path != null && message.hasOwnProperty("key_path")) { + if (!Array.isArray(message.key_path)) + return "key_path: array expected"; + for (let i = 0; i < message.key_path.length; ++i) + if (!$util.isString(message.key_path[i])) + return "key_path: string[] expected"; + } + return null; + }; + + /** + * Creates a MerklePath message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.commitment.v1.MerklePath + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.commitment.v1.MerklePath} MerklePath + */ + MerklePath.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.commitment.v1.MerklePath) + return object; + let message = new $root.ibc.core.commitment.v1.MerklePath(); + if (object.key_path) { + if (!Array.isArray(object.key_path)) + throw TypeError(".ibc.core.commitment.v1.MerklePath.key_path: array expected"); + message.key_path = []; + for (let i = 0; i < object.key_path.length; ++i) + message.key_path[i] = String(object.key_path[i]); + } + return message; + }; + + /** + * Creates a plain object from a MerklePath message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.commitment.v1.MerklePath + * @static + * @param {ibc.core.commitment.v1.MerklePath} message MerklePath + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MerklePath.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.key_path = []; + if (message.key_path && message.key_path.length) { + object.key_path = []; + for (let j = 0; j < message.key_path.length; ++j) + object.key_path[j] = message.key_path[j]; + } + return object; + }; + + /** + * Converts this MerklePath to JSON. + * @function toJSON + * @memberof ibc.core.commitment.v1.MerklePath + * @instance + * @returns {Object.} JSON object + */ + MerklePath.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MerklePath; + })(); + + v1.MerkleProof = (function() { + + /** + * Properties of a MerkleProof. + * @memberof ibc.core.commitment.v1 + * @interface IMerkleProof + * @property {Array.|null} [proofs] MerkleProof proofs + */ + + /** + * Constructs a new MerkleProof. + * @memberof ibc.core.commitment.v1 + * @classdesc Represents a MerkleProof. + * @implements IMerkleProof + * @constructor + * @param {ibc.core.commitment.v1.IMerkleProof=} [properties] Properties to set + */ + function MerkleProof(properties) { + this.proofs = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MerkleProof proofs. + * @member {Array.} proofs + * @memberof ibc.core.commitment.v1.MerkleProof + * @instance + */ + MerkleProof.prototype.proofs = $util.emptyArray; + + /** + * Encodes the specified MerkleProof message. Does not implicitly {@link ibc.core.commitment.v1.MerkleProof.verify|verify} messages. + * @function encode + * @memberof ibc.core.commitment.v1.MerkleProof + * @static + * @param {ibc.core.commitment.v1.IMerkleProof} message MerkleProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MerkleProof.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.proofs != null && message.proofs.length) + for (let i = 0; i < message.proofs.length; ++i) + $root.ics23.CommitmentProof.encode(message.proofs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MerkleProof message, length delimited. Does not implicitly {@link ibc.core.commitment.v1.MerkleProof.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.commitment.v1.MerkleProof + * @static + * @param {ibc.core.commitment.v1.IMerkleProof} message MerkleProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MerkleProof.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MerkleProof message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.commitment.v1.MerkleProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.commitment.v1.MerkleProof} MerkleProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MerkleProof.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.commitment.v1.MerkleProof(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.proofs && message.proofs.length)) + message.proofs = []; + message.proofs.push($root.ics23.CommitmentProof.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MerkleProof message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.commitment.v1.MerkleProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.commitment.v1.MerkleProof} MerkleProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MerkleProof.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MerkleProof message. + * @function verify + * @memberof ibc.core.commitment.v1.MerkleProof + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MerkleProof.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.proofs != null && message.hasOwnProperty("proofs")) { + if (!Array.isArray(message.proofs)) + return "proofs: array expected"; + for (let i = 0; i < message.proofs.length; ++i) { + let error = $root.ics23.CommitmentProof.verify(message.proofs[i]); + if (error) + return "proofs." + error; + } + } + return null; + }; + + /** + * Creates a MerkleProof message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.commitment.v1.MerkleProof + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.commitment.v1.MerkleProof} MerkleProof + */ + MerkleProof.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.commitment.v1.MerkleProof) + return object; + let message = new $root.ibc.core.commitment.v1.MerkleProof(); + if (object.proofs) { + if (!Array.isArray(object.proofs)) + throw TypeError(".ibc.core.commitment.v1.MerkleProof.proofs: array expected"); + message.proofs = []; + for (let i = 0; i < object.proofs.length; ++i) { + if (typeof object.proofs[i] !== "object") + throw TypeError(".ibc.core.commitment.v1.MerkleProof.proofs: object expected"); + message.proofs[i] = $root.ics23.CommitmentProof.fromObject(object.proofs[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a MerkleProof message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.commitment.v1.MerkleProof + * @static + * @param {ibc.core.commitment.v1.MerkleProof} message MerkleProof + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MerkleProof.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.proofs = []; + if (message.proofs && message.proofs.length) { + object.proofs = []; + for (let j = 0; j < message.proofs.length; ++j) + object.proofs[j] = $root.ics23.CommitmentProof.toObject(message.proofs[j], options); + } + return object; + }; + + /** + * Converts this MerkleProof to JSON. + * @function toJSON + * @memberof ibc.core.commitment.v1.MerkleProof + * @instance + * @returns {Object.} JSON object + */ + MerkleProof.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MerkleProof; + })(); + + return v1; + })(); + + return commitment; + })(); + + core.connection = (function() { + + /** + * Namespace connection. + * @memberof ibc.core + * @namespace + */ + const connection = {}; + + connection.v1 = (function() { + + /** + * Namespace v1. + * @memberof ibc.core.connection + * @namespace + */ + const v1 = {}; + + v1.Msg = (function() { + + /** + * Constructs a new Msg service. + * @memberof ibc.core.connection.v1 + * @classdesc Represents a Msg + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Msg(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Msg.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Msg; + + /** + * Callback as used by {@link ibc.core.connection.v1.Msg#connectionOpenInit}. + * @memberof ibc.core.connection.v1.Msg + * @typedef ConnectionOpenInitCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.connection.v1.MsgConnectionOpenInitResponse} [response] MsgConnectionOpenInitResponse + */ + + /** + * Calls ConnectionOpenInit. + * @function connectionOpenInit + * @memberof ibc.core.connection.v1.Msg + * @instance + * @param {ibc.core.connection.v1.IMsgConnectionOpenInit} request MsgConnectionOpenInit message or plain object + * @param {ibc.core.connection.v1.Msg.ConnectionOpenInitCallback} callback Node-style callback called with the error, if any, and MsgConnectionOpenInitResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.connectionOpenInit = function connectionOpenInit(request, callback) { + return this.rpcCall(connectionOpenInit, $root.ibc.core.connection.v1.MsgConnectionOpenInit, $root.ibc.core.connection.v1.MsgConnectionOpenInitResponse, request, callback); + }, "name", { value: "ConnectionOpenInit" }); + + /** + * Calls ConnectionOpenInit. + * @function connectionOpenInit + * @memberof ibc.core.connection.v1.Msg + * @instance + * @param {ibc.core.connection.v1.IMsgConnectionOpenInit} request MsgConnectionOpenInit message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.connection.v1.Msg#connectionOpenTry}. + * @memberof ibc.core.connection.v1.Msg + * @typedef ConnectionOpenTryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.connection.v1.MsgConnectionOpenTryResponse} [response] MsgConnectionOpenTryResponse + */ + + /** + * Calls ConnectionOpenTry. + * @function connectionOpenTry + * @memberof ibc.core.connection.v1.Msg + * @instance + * @param {ibc.core.connection.v1.IMsgConnectionOpenTry} request MsgConnectionOpenTry message or plain object + * @param {ibc.core.connection.v1.Msg.ConnectionOpenTryCallback} callback Node-style callback called with the error, if any, and MsgConnectionOpenTryResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.connectionOpenTry = function connectionOpenTry(request, callback) { + return this.rpcCall(connectionOpenTry, $root.ibc.core.connection.v1.MsgConnectionOpenTry, $root.ibc.core.connection.v1.MsgConnectionOpenTryResponse, request, callback); + }, "name", { value: "ConnectionOpenTry" }); + + /** + * Calls ConnectionOpenTry. + * @function connectionOpenTry + * @memberof ibc.core.connection.v1.Msg + * @instance + * @param {ibc.core.connection.v1.IMsgConnectionOpenTry} request MsgConnectionOpenTry message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.connection.v1.Msg#connectionOpenAck}. + * @memberof ibc.core.connection.v1.Msg + * @typedef ConnectionOpenAckCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.connection.v1.MsgConnectionOpenAckResponse} [response] MsgConnectionOpenAckResponse + */ + + /** + * Calls ConnectionOpenAck. + * @function connectionOpenAck + * @memberof ibc.core.connection.v1.Msg + * @instance + * @param {ibc.core.connection.v1.IMsgConnectionOpenAck} request MsgConnectionOpenAck message or plain object + * @param {ibc.core.connection.v1.Msg.ConnectionOpenAckCallback} callback Node-style callback called with the error, if any, and MsgConnectionOpenAckResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.connectionOpenAck = function connectionOpenAck(request, callback) { + return this.rpcCall(connectionOpenAck, $root.ibc.core.connection.v1.MsgConnectionOpenAck, $root.ibc.core.connection.v1.MsgConnectionOpenAckResponse, request, callback); + }, "name", { value: "ConnectionOpenAck" }); + + /** + * Calls ConnectionOpenAck. + * @function connectionOpenAck + * @memberof ibc.core.connection.v1.Msg + * @instance + * @param {ibc.core.connection.v1.IMsgConnectionOpenAck} request MsgConnectionOpenAck message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.connection.v1.Msg#connectionOpenConfirm}. + * @memberof ibc.core.connection.v1.Msg + * @typedef ConnectionOpenConfirmCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.connection.v1.MsgConnectionOpenConfirmResponse} [response] MsgConnectionOpenConfirmResponse + */ + + /** + * Calls ConnectionOpenConfirm. + * @function connectionOpenConfirm + * @memberof ibc.core.connection.v1.Msg + * @instance + * @param {ibc.core.connection.v1.IMsgConnectionOpenConfirm} request MsgConnectionOpenConfirm message or plain object + * @param {ibc.core.connection.v1.Msg.ConnectionOpenConfirmCallback} callback Node-style callback called with the error, if any, and MsgConnectionOpenConfirmResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Msg.prototype.connectionOpenConfirm = function connectionOpenConfirm(request, callback) { + return this.rpcCall(connectionOpenConfirm, $root.ibc.core.connection.v1.MsgConnectionOpenConfirm, $root.ibc.core.connection.v1.MsgConnectionOpenConfirmResponse, request, callback); + }, "name", { value: "ConnectionOpenConfirm" }); + + /** + * Calls ConnectionOpenConfirm. + * @function connectionOpenConfirm + * @memberof ibc.core.connection.v1.Msg + * @instance + * @param {ibc.core.connection.v1.IMsgConnectionOpenConfirm} request MsgConnectionOpenConfirm message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Msg; + })(); + + v1.MsgConnectionOpenInit = (function() { + + /** + * Properties of a MsgConnectionOpenInit. + * @memberof ibc.core.connection.v1 + * @interface IMsgConnectionOpenInit + * @property {string|null} [client_id] MsgConnectionOpenInit client_id + * @property {ibc.core.connection.v1.ICounterparty|null} [counterparty] MsgConnectionOpenInit counterparty + * @property {ibc.core.connection.v1.IVersion|null} [version] MsgConnectionOpenInit version + * @property {Long|null} [delay_period] MsgConnectionOpenInit delay_period + * @property {string|null} [signer] MsgConnectionOpenInit signer + */ + + /** + * Constructs a new MsgConnectionOpenInit. + * @memberof ibc.core.connection.v1 + * @classdesc Represents a MsgConnectionOpenInit. + * @implements IMsgConnectionOpenInit + * @constructor + * @param {ibc.core.connection.v1.IMsgConnectionOpenInit=} [properties] Properties to set + */ + function MsgConnectionOpenInit(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgConnectionOpenInit client_id. + * @member {string} client_id + * @memberof ibc.core.connection.v1.MsgConnectionOpenInit + * @instance + */ + MsgConnectionOpenInit.prototype.client_id = ""; + + /** + * MsgConnectionOpenInit counterparty. + * @member {ibc.core.connection.v1.ICounterparty|null|undefined} counterparty + * @memberof ibc.core.connection.v1.MsgConnectionOpenInit + * @instance + */ + MsgConnectionOpenInit.prototype.counterparty = null; + + /** + * MsgConnectionOpenInit version. + * @member {ibc.core.connection.v1.IVersion|null|undefined} version + * @memberof ibc.core.connection.v1.MsgConnectionOpenInit + * @instance + */ + MsgConnectionOpenInit.prototype.version = null; + + /** + * MsgConnectionOpenInit delay_period. + * @member {Long} delay_period + * @memberof ibc.core.connection.v1.MsgConnectionOpenInit + * @instance + */ + MsgConnectionOpenInit.prototype.delay_period = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * MsgConnectionOpenInit signer. + * @member {string} signer + * @memberof ibc.core.connection.v1.MsgConnectionOpenInit + * @instance + */ + MsgConnectionOpenInit.prototype.signer = ""; + + /** + * Encodes the specified MsgConnectionOpenInit message. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenInit.verify|verify} messages. + * @function encode + * @memberof ibc.core.connection.v1.MsgConnectionOpenInit + * @static + * @param {ibc.core.connection.v1.IMsgConnectionOpenInit} message MsgConnectionOpenInit message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgConnectionOpenInit.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); + if (message.counterparty != null && Object.hasOwnProperty.call(message, "counterparty")) + $root.ibc.core.connection.v1.Counterparty.encode(message.counterparty, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + $root.ibc.core.connection.v1.Version.encode(message.version, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.delay_period != null && Object.hasOwnProperty.call(message, "delay_period")) + writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.delay_period); + if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.signer); + return writer; + }; + + /** + * Encodes the specified MsgConnectionOpenInit message, length delimited. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenInit.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.connection.v1.MsgConnectionOpenInit + * @static + * @param {ibc.core.connection.v1.IMsgConnectionOpenInit} message MsgConnectionOpenInit message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgConnectionOpenInit.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgConnectionOpenInit message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.connection.v1.MsgConnectionOpenInit + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.connection.v1.MsgConnectionOpenInit} MsgConnectionOpenInit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgConnectionOpenInit.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.MsgConnectionOpenInit(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.client_id = reader.string(); + break; + case 2: + message.counterparty = $root.ibc.core.connection.v1.Counterparty.decode(reader, reader.uint32()); + break; + case 3: + message.version = $root.ibc.core.connection.v1.Version.decode(reader, reader.uint32()); + break; + case 4: + message.delay_period = reader.uint64(); + break; + case 5: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgConnectionOpenInit message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.connection.v1.MsgConnectionOpenInit + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.connection.v1.MsgConnectionOpenInit} MsgConnectionOpenInit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgConnectionOpenInit.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgConnectionOpenInit message. + * @function verify + * @memberof ibc.core.connection.v1.MsgConnectionOpenInit + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgConnectionOpenInit.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.client_id != null && message.hasOwnProperty("client_id")) + if (!$util.isString(message.client_id)) + return "client_id: string expected"; + if (message.counterparty != null && message.hasOwnProperty("counterparty")) { + let error = $root.ibc.core.connection.v1.Counterparty.verify(message.counterparty); + if (error) + return "counterparty." + error; + } + if (message.version != null && message.hasOwnProperty("version")) { + let error = $root.ibc.core.connection.v1.Version.verify(message.version); + if (error) + return "version." + error; + } + if (message.delay_period != null && message.hasOwnProperty("delay_period")) + if (!$util.isInteger(message.delay_period) && !(message.delay_period && $util.isInteger(message.delay_period.low) && $util.isInteger(message.delay_period.high))) + return "delay_period: integer|Long expected"; + if (message.signer != null && message.hasOwnProperty("signer")) + if (!$util.isString(message.signer)) + return "signer: string expected"; + return null; + }; + + /** + * Creates a MsgConnectionOpenInit message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.connection.v1.MsgConnectionOpenInit + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.connection.v1.MsgConnectionOpenInit} MsgConnectionOpenInit + */ + MsgConnectionOpenInit.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.connection.v1.MsgConnectionOpenInit) + return object; + let message = new $root.ibc.core.connection.v1.MsgConnectionOpenInit(); + if (object.client_id != null) + message.client_id = String(object.client_id); + if (object.counterparty != null) { + if (typeof object.counterparty !== "object") + throw TypeError(".ibc.core.connection.v1.MsgConnectionOpenInit.counterparty: object expected"); + message.counterparty = $root.ibc.core.connection.v1.Counterparty.fromObject(object.counterparty); + } + if (object.version != null) { + if (typeof object.version !== "object") + throw TypeError(".ibc.core.connection.v1.MsgConnectionOpenInit.version: object expected"); + message.version = $root.ibc.core.connection.v1.Version.fromObject(object.version); + } + if (object.delay_period != null) + if ($util.Long) + (message.delay_period = $util.Long.fromValue(object.delay_period)).unsigned = true; + else if (typeof object.delay_period === "string") + message.delay_period = parseInt(object.delay_period, 10); + else if (typeof object.delay_period === "number") + message.delay_period = object.delay_period; + else if (typeof object.delay_period === "object") + message.delay_period = new $util.LongBits(object.delay_period.low >>> 0, object.delay_period.high >>> 0).toNumber(true); + if (object.signer != null) + message.signer = String(object.signer); + return message; + }; + + /** + * Creates a plain object from a MsgConnectionOpenInit message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.connection.v1.MsgConnectionOpenInit + * @static + * @param {ibc.core.connection.v1.MsgConnectionOpenInit} message MsgConnectionOpenInit + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgConnectionOpenInit.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.client_id = ""; + object.counterparty = null; + object.version = null; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.delay_period = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.delay_period = options.longs === String ? "0" : 0; + object.signer = ""; + } + if (message.client_id != null && message.hasOwnProperty("client_id")) + object.client_id = message.client_id; + if (message.counterparty != null && message.hasOwnProperty("counterparty")) + object.counterparty = $root.ibc.core.connection.v1.Counterparty.toObject(message.counterparty, options); + if (message.version != null && message.hasOwnProperty("version")) + object.version = $root.ibc.core.connection.v1.Version.toObject(message.version, options); + if (message.delay_period != null && message.hasOwnProperty("delay_period")) + if (typeof message.delay_period === "number") + object.delay_period = options.longs === String ? String(message.delay_period) : message.delay_period; + else + object.delay_period = options.longs === String ? $util.Long.prototype.toString.call(message.delay_period) : options.longs === Number ? new $util.LongBits(message.delay_period.low >>> 0, message.delay_period.high >>> 0).toNumber(true) : message.delay_period; + if (message.signer != null && message.hasOwnProperty("signer")) + object.signer = message.signer; + return object; + }; + + /** + * Converts this MsgConnectionOpenInit to JSON. + * @function toJSON + * @memberof ibc.core.connection.v1.MsgConnectionOpenInit + * @instance + * @returns {Object.} JSON object + */ + MsgConnectionOpenInit.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgConnectionOpenInit; + })(); + + v1.MsgConnectionOpenInitResponse = (function() { + + /** + * Properties of a MsgConnectionOpenInitResponse. + * @memberof ibc.core.connection.v1 + * @interface IMsgConnectionOpenInitResponse + */ + + /** + * Constructs a new MsgConnectionOpenInitResponse. + * @memberof ibc.core.connection.v1 + * @classdesc Represents a MsgConnectionOpenInitResponse. + * @implements IMsgConnectionOpenInitResponse + * @constructor + * @param {ibc.core.connection.v1.IMsgConnectionOpenInitResponse=} [properties] Properties to set + */ + function MsgConnectionOpenInitResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgConnectionOpenInitResponse message. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenInitResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.connection.v1.MsgConnectionOpenInitResponse + * @static + * @param {ibc.core.connection.v1.IMsgConnectionOpenInitResponse} message MsgConnectionOpenInitResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgConnectionOpenInitResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgConnectionOpenInitResponse message, length delimited. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenInitResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.connection.v1.MsgConnectionOpenInitResponse + * @static + * @param {ibc.core.connection.v1.IMsgConnectionOpenInitResponse} message MsgConnectionOpenInitResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgConnectionOpenInitResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgConnectionOpenInitResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.connection.v1.MsgConnectionOpenInitResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.connection.v1.MsgConnectionOpenInitResponse} MsgConnectionOpenInitResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgConnectionOpenInitResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.MsgConnectionOpenInitResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgConnectionOpenInitResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.connection.v1.MsgConnectionOpenInitResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.connection.v1.MsgConnectionOpenInitResponse} MsgConnectionOpenInitResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgConnectionOpenInitResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgConnectionOpenInitResponse message. + * @function verify + * @memberof ibc.core.connection.v1.MsgConnectionOpenInitResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgConnectionOpenInitResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgConnectionOpenInitResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.connection.v1.MsgConnectionOpenInitResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.connection.v1.MsgConnectionOpenInitResponse} MsgConnectionOpenInitResponse + */ + MsgConnectionOpenInitResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.connection.v1.MsgConnectionOpenInitResponse) + return object; + return new $root.ibc.core.connection.v1.MsgConnectionOpenInitResponse(); + }; + + /** + * Creates a plain object from a MsgConnectionOpenInitResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.connection.v1.MsgConnectionOpenInitResponse + * @static + * @param {ibc.core.connection.v1.MsgConnectionOpenInitResponse} message MsgConnectionOpenInitResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgConnectionOpenInitResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgConnectionOpenInitResponse to JSON. + * @function toJSON + * @memberof ibc.core.connection.v1.MsgConnectionOpenInitResponse + * @instance + * @returns {Object.} JSON object + */ + MsgConnectionOpenInitResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgConnectionOpenInitResponse; + })(); + + v1.MsgConnectionOpenTry = (function() { + + /** + * Properties of a MsgConnectionOpenTry. + * @memberof ibc.core.connection.v1 + * @interface IMsgConnectionOpenTry + * @property {string|null} [client_id] MsgConnectionOpenTry client_id + * @property {string|null} [previous_connection_id] MsgConnectionOpenTry previous_connection_id + * @property {google.protobuf.IAny|null} [client_state] MsgConnectionOpenTry client_state + * @property {ibc.core.connection.v1.ICounterparty|null} [counterparty] MsgConnectionOpenTry counterparty + * @property {Long|null} [delay_period] MsgConnectionOpenTry delay_period + * @property {Array.|null} [counterparty_versions] MsgConnectionOpenTry counterparty_versions + * @property {ibc.core.client.v1.IHeight|null} [proof_height] MsgConnectionOpenTry proof_height + * @property {Uint8Array|null} [proof_init] MsgConnectionOpenTry proof_init + * @property {Uint8Array|null} [proof_client] MsgConnectionOpenTry proof_client + * @property {Uint8Array|null} [proof_consensus] MsgConnectionOpenTry proof_consensus + * @property {ibc.core.client.v1.IHeight|null} [consensus_height] MsgConnectionOpenTry consensus_height + * @property {string|null} [signer] MsgConnectionOpenTry signer + */ + + /** + * Constructs a new MsgConnectionOpenTry. + * @memberof ibc.core.connection.v1 + * @classdesc Represents a MsgConnectionOpenTry. + * @implements IMsgConnectionOpenTry + * @constructor + * @param {ibc.core.connection.v1.IMsgConnectionOpenTry=} [properties] Properties to set + */ + function MsgConnectionOpenTry(properties) { + this.counterparty_versions = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgConnectionOpenTry client_id. + * @member {string} client_id + * @memberof ibc.core.connection.v1.MsgConnectionOpenTry + * @instance + */ + MsgConnectionOpenTry.prototype.client_id = ""; + + /** + * MsgConnectionOpenTry previous_connection_id. + * @member {string} previous_connection_id + * @memberof ibc.core.connection.v1.MsgConnectionOpenTry + * @instance + */ + MsgConnectionOpenTry.prototype.previous_connection_id = ""; + + /** + * MsgConnectionOpenTry client_state. + * @member {google.protobuf.IAny|null|undefined} client_state + * @memberof ibc.core.connection.v1.MsgConnectionOpenTry + * @instance + */ + MsgConnectionOpenTry.prototype.client_state = null; + + /** + * MsgConnectionOpenTry counterparty. + * @member {ibc.core.connection.v1.ICounterparty|null|undefined} counterparty + * @memberof ibc.core.connection.v1.MsgConnectionOpenTry + * @instance + */ + MsgConnectionOpenTry.prototype.counterparty = null; + + /** + * MsgConnectionOpenTry delay_period. + * @member {Long} delay_period + * @memberof ibc.core.connection.v1.MsgConnectionOpenTry + * @instance + */ + MsgConnectionOpenTry.prototype.delay_period = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * MsgConnectionOpenTry counterparty_versions. + * @member {Array.} counterparty_versions + * @memberof ibc.core.connection.v1.MsgConnectionOpenTry + * @instance + */ + MsgConnectionOpenTry.prototype.counterparty_versions = $util.emptyArray; + + /** + * MsgConnectionOpenTry proof_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height + * @memberof ibc.core.connection.v1.MsgConnectionOpenTry + * @instance + */ + MsgConnectionOpenTry.prototype.proof_height = null; + + /** + * MsgConnectionOpenTry proof_init. + * @member {Uint8Array} proof_init + * @memberof ibc.core.connection.v1.MsgConnectionOpenTry + * @instance + */ + MsgConnectionOpenTry.prototype.proof_init = $util.newBuffer([]); + + /** + * MsgConnectionOpenTry proof_client. + * @member {Uint8Array} proof_client + * @memberof ibc.core.connection.v1.MsgConnectionOpenTry + * @instance + */ + MsgConnectionOpenTry.prototype.proof_client = $util.newBuffer([]); + + /** + * MsgConnectionOpenTry proof_consensus. + * @member {Uint8Array} proof_consensus + * @memberof ibc.core.connection.v1.MsgConnectionOpenTry + * @instance + */ + MsgConnectionOpenTry.prototype.proof_consensus = $util.newBuffer([]); + + /** + * MsgConnectionOpenTry consensus_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} consensus_height + * @memberof ibc.core.connection.v1.MsgConnectionOpenTry + * @instance + */ + MsgConnectionOpenTry.prototype.consensus_height = null; + + /** + * MsgConnectionOpenTry signer. + * @member {string} signer + * @memberof ibc.core.connection.v1.MsgConnectionOpenTry + * @instance + */ + MsgConnectionOpenTry.prototype.signer = ""; + + /** + * Encodes the specified MsgConnectionOpenTry message. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenTry.verify|verify} messages. + * @function encode + * @memberof ibc.core.connection.v1.MsgConnectionOpenTry + * @static + * @param {ibc.core.connection.v1.IMsgConnectionOpenTry} message MsgConnectionOpenTry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgConnectionOpenTry.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); + if (message.previous_connection_id != null && Object.hasOwnProperty.call(message, "previous_connection_id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.previous_connection_id); + if (message.client_state != null && Object.hasOwnProperty.call(message, "client_state")) + $root.google.protobuf.Any.encode(message.client_state, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.counterparty != null && Object.hasOwnProperty.call(message, "counterparty")) + $root.ibc.core.connection.v1.Counterparty.encode(message.counterparty, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.delay_period != null && Object.hasOwnProperty.call(message, "delay_period")) + writer.uint32(/* id 5, wireType 0 =*/40).uint64(message.delay_period); + if (message.counterparty_versions != null && message.counterparty_versions.length) + for (let i = 0; i < message.counterparty_versions.length; ++i) + $root.ibc.core.connection.v1.Version.encode(message.counterparty_versions[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) + $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.proof_init != null && Object.hasOwnProperty.call(message, "proof_init")) + writer.uint32(/* id 8, wireType 2 =*/66).bytes(message.proof_init); + if (message.proof_client != null && Object.hasOwnProperty.call(message, "proof_client")) + writer.uint32(/* id 9, wireType 2 =*/74).bytes(message.proof_client); + if (message.proof_consensus != null && Object.hasOwnProperty.call(message, "proof_consensus")) + writer.uint32(/* id 10, wireType 2 =*/82).bytes(message.proof_consensus); + if (message.consensus_height != null && Object.hasOwnProperty.call(message, "consensus_height")) + $root.ibc.core.client.v1.Height.encode(message.consensus_height, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.signer); + return writer; + }; + + /** + * Encodes the specified MsgConnectionOpenTry message, length delimited. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenTry.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.connection.v1.MsgConnectionOpenTry + * @static + * @param {ibc.core.connection.v1.IMsgConnectionOpenTry} message MsgConnectionOpenTry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgConnectionOpenTry.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgConnectionOpenTry message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.connection.v1.MsgConnectionOpenTry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.connection.v1.MsgConnectionOpenTry} MsgConnectionOpenTry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgConnectionOpenTry.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.MsgConnectionOpenTry(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.client_id = reader.string(); + break; + case 2: + message.previous_connection_id = reader.string(); + break; + case 3: + message.client_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 4: + message.counterparty = $root.ibc.core.connection.v1.Counterparty.decode(reader, reader.uint32()); + break; + case 5: + message.delay_period = reader.uint64(); + break; + case 6: + if (!(message.counterparty_versions && message.counterparty_versions.length)) + message.counterparty_versions = []; + message.counterparty_versions.push($root.ibc.core.connection.v1.Version.decode(reader, reader.uint32())); + break; + case 7: + message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + case 8: + message.proof_init = reader.bytes(); + break; + case 9: + message.proof_client = reader.bytes(); + break; + case 10: + message.proof_consensus = reader.bytes(); + break; + case 11: + message.consensus_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + case 12: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgConnectionOpenTry message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.connection.v1.MsgConnectionOpenTry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.connection.v1.MsgConnectionOpenTry} MsgConnectionOpenTry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgConnectionOpenTry.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgConnectionOpenTry message. + * @function verify + * @memberof ibc.core.connection.v1.MsgConnectionOpenTry + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgConnectionOpenTry.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.client_id != null && message.hasOwnProperty("client_id")) + if (!$util.isString(message.client_id)) + return "client_id: string expected"; + if (message.previous_connection_id != null && message.hasOwnProperty("previous_connection_id")) + if (!$util.isString(message.previous_connection_id)) + return "previous_connection_id: string expected"; + if (message.client_state != null && message.hasOwnProperty("client_state")) { + let error = $root.google.protobuf.Any.verify(message.client_state); + if (error) + return "client_state." + error; + } + if (message.counterparty != null && message.hasOwnProperty("counterparty")) { + let error = $root.ibc.core.connection.v1.Counterparty.verify(message.counterparty); + if (error) + return "counterparty." + error; + } + if (message.delay_period != null && message.hasOwnProperty("delay_period")) + if (!$util.isInteger(message.delay_period) && !(message.delay_period && $util.isInteger(message.delay_period.low) && $util.isInteger(message.delay_period.high))) + return "delay_period: integer|Long expected"; + if (message.counterparty_versions != null && message.hasOwnProperty("counterparty_versions")) { + if (!Array.isArray(message.counterparty_versions)) + return "counterparty_versions: array expected"; + for (let i = 0; i < message.counterparty_versions.length; ++i) { + let error = $root.ibc.core.connection.v1.Version.verify(message.counterparty_versions[i]); + if (error) + return "counterparty_versions." + error; + } + } + if (message.proof_height != null && message.hasOwnProperty("proof_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); + if (error) + return "proof_height." + error; + } + if (message.proof_init != null && message.hasOwnProperty("proof_init")) + if (!(message.proof_init && typeof message.proof_init.length === "number" || $util.isString(message.proof_init))) + return "proof_init: buffer expected"; + if (message.proof_client != null && message.hasOwnProperty("proof_client")) + if (!(message.proof_client && typeof message.proof_client.length === "number" || $util.isString(message.proof_client))) + return "proof_client: buffer expected"; + if (message.proof_consensus != null && message.hasOwnProperty("proof_consensus")) + if (!(message.proof_consensus && typeof message.proof_consensus.length === "number" || $util.isString(message.proof_consensus))) + return "proof_consensus: buffer expected"; + if (message.consensus_height != null && message.hasOwnProperty("consensus_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.consensus_height); + if (error) + return "consensus_height." + error; + } + if (message.signer != null && message.hasOwnProperty("signer")) + if (!$util.isString(message.signer)) + return "signer: string expected"; + return null; + }; + + /** + * Creates a MsgConnectionOpenTry message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.connection.v1.MsgConnectionOpenTry + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.connection.v1.MsgConnectionOpenTry} MsgConnectionOpenTry + */ + MsgConnectionOpenTry.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.connection.v1.MsgConnectionOpenTry) + return object; + let message = new $root.ibc.core.connection.v1.MsgConnectionOpenTry(); + if (object.client_id != null) + message.client_id = String(object.client_id); + if (object.previous_connection_id != null) + message.previous_connection_id = String(object.previous_connection_id); + if (object.client_state != null) { + if (typeof object.client_state !== "object") + throw TypeError(".ibc.core.connection.v1.MsgConnectionOpenTry.client_state: object expected"); + message.client_state = $root.google.protobuf.Any.fromObject(object.client_state); + } + if (object.counterparty != null) { + if (typeof object.counterparty !== "object") + throw TypeError(".ibc.core.connection.v1.MsgConnectionOpenTry.counterparty: object expected"); + message.counterparty = $root.ibc.core.connection.v1.Counterparty.fromObject(object.counterparty); + } + if (object.delay_period != null) + if ($util.Long) + (message.delay_period = $util.Long.fromValue(object.delay_period)).unsigned = true; + else if (typeof object.delay_period === "string") + message.delay_period = parseInt(object.delay_period, 10); + else if (typeof object.delay_period === "number") + message.delay_period = object.delay_period; + else if (typeof object.delay_period === "object") + message.delay_period = new $util.LongBits(object.delay_period.low >>> 0, object.delay_period.high >>> 0).toNumber(true); + if (object.counterparty_versions) { + if (!Array.isArray(object.counterparty_versions)) + throw TypeError(".ibc.core.connection.v1.MsgConnectionOpenTry.counterparty_versions: array expected"); + message.counterparty_versions = []; + for (let i = 0; i < object.counterparty_versions.length; ++i) { + if (typeof object.counterparty_versions[i] !== "object") + throw TypeError(".ibc.core.connection.v1.MsgConnectionOpenTry.counterparty_versions: object expected"); + message.counterparty_versions[i] = $root.ibc.core.connection.v1.Version.fromObject(object.counterparty_versions[i]); + } + } + if (object.proof_height != null) { + if (typeof object.proof_height !== "object") + throw TypeError(".ibc.core.connection.v1.MsgConnectionOpenTry.proof_height: object expected"); + message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); + } + if (object.proof_init != null) + if (typeof object.proof_init === "string") + $util.base64.decode(object.proof_init, message.proof_init = $util.newBuffer($util.base64.length(object.proof_init)), 0); + else if (object.proof_init.length) + message.proof_init = object.proof_init; + if (object.proof_client != null) + if (typeof object.proof_client === "string") + $util.base64.decode(object.proof_client, message.proof_client = $util.newBuffer($util.base64.length(object.proof_client)), 0); + else if (object.proof_client.length) + message.proof_client = object.proof_client; + if (object.proof_consensus != null) + if (typeof object.proof_consensus === "string") + $util.base64.decode(object.proof_consensus, message.proof_consensus = $util.newBuffer($util.base64.length(object.proof_consensus)), 0); + else if (object.proof_consensus.length) + message.proof_consensus = object.proof_consensus; + if (object.consensus_height != null) { + if (typeof object.consensus_height !== "object") + throw TypeError(".ibc.core.connection.v1.MsgConnectionOpenTry.consensus_height: object expected"); + message.consensus_height = $root.ibc.core.client.v1.Height.fromObject(object.consensus_height); + } + if (object.signer != null) + message.signer = String(object.signer); + return message; + }; + + /** + * Creates a plain object from a MsgConnectionOpenTry message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.connection.v1.MsgConnectionOpenTry + * @static + * @param {ibc.core.connection.v1.MsgConnectionOpenTry} message MsgConnectionOpenTry + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgConnectionOpenTry.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.counterparty_versions = []; + if (options.defaults) { + object.client_id = ""; + object.previous_connection_id = ""; + object.client_state = null; + object.counterparty = null; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.delay_period = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.delay_period = options.longs === String ? "0" : 0; + object.proof_height = null; + if (options.bytes === String) + object.proof_init = ""; + else { + object.proof_init = []; + if (options.bytes !== Array) + object.proof_init = $util.newBuffer(object.proof_init); + } + if (options.bytes === String) + object.proof_client = ""; + else { + object.proof_client = []; + if (options.bytes !== Array) + object.proof_client = $util.newBuffer(object.proof_client); + } + if (options.bytes === String) + object.proof_consensus = ""; + else { + object.proof_consensus = []; + if (options.bytes !== Array) + object.proof_consensus = $util.newBuffer(object.proof_consensus); + } + object.consensus_height = null; + object.signer = ""; + } + if (message.client_id != null && message.hasOwnProperty("client_id")) + object.client_id = message.client_id; + if (message.previous_connection_id != null && message.hasOwnProperty("previous_connection_id")) + object.previous_connection_id = message.previous_connection_id; + if (message.client_state != null && message.hasOwnProperty("client_state")) + object.client_state = $root.google.protobuf.Any.toObject(message.client_state, options); + if (message.counterparty != null && message.hasOwnProperty("counterparty")) + object.counterparty = $root.ibc.core.connection.v1.Counterparty.toObject(message.counterparty, options); + if (message.delay_period != null && message.hasOwnProperty("delay_period")) + if (typeof message.delay_period === "number") + object.delay_period = options.longs === String ? String(message.delay_period) : message.delay_period; + else + object.delay_period = options.longs === String ? $util.Long.prototype.toString.call(message.delay_period) : options.longs === Number ? new $util.LongBits(message.delay_period.low >>> 0, message.delay_period.high >>> 0).toNumber(true) : message.delay_period; + if (message.counterparty_versions && message.counterparty_versions.length) { + object.counterparty_versions = []; + for (let j = 0; j < message.counterparty_versions.length; ++j) + object.counterparty_versions[j] = $root.ibc.core.connection.v1.Version.toObject(message.counterparty_versions[j], options); + } + if (message.proof_height != null && message.hasOwnProperty("proof_height")) + object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); + if (message.proof_init != null && message.hasOwnProperty("proof_init")) + object.proof_init = options.bytes === String ? $util.base64.encode(message.proof_init, 0, message.proof_init.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_init) : message.proof_init; + if (message.proof_client != null && message.hasOwnProperty("proof_client")) + object.proof_client = options.bytes === String ? $util.base64.encode(message.proof_client, 0, message.proof_client.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_client) : message.proof_client; + if (message.proof_consensus != null && message.hasOwnProperty("proof_consensus")) + object.proof_consensus = options.bytes === String ? $util.base64.encode(message.proof_consensus, 0, message.proof_consensus.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_consensus) : message.proof_consensus; + if (message.consensus_height != null && message.hasOwnProperty("consensus_height")) + object.consensus_height = $root.ibc.core.client.v1.Height.toObject(message.consensus_height, options); + if (message.signer != null && message.hasOwnProperty("signer")) + object.signer = message.signer; + return object; + }; + + /** + * Converts this MsgConnectionOpenTry to JSON. + * @function toJSON + * @memberof ibc.core.connection.v1.MsgConnectionOpenTry + * @instance + * @returns {Object.} JSON object + */ + MsgConnectionOpenTry.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgConnectionOpenTry; + })(); + + v1.MsgConnectionOpenTryResponse = (function() { + + /** + * Properties of a MsgConnectionOpenTryResponse. + * @memberof ibc.core.connection.v1 + * @interface IMsgConnectionOpenTryResponse + */ + + /** + * Constructs a new MsgConnectionOpenTryResponse. + * @memberof ibc.core.connection.v1 + * @classdesc Represents a MsgConnectionOpenTryResponse. + * @implements IMsgConnectionOpenTryResponse + * @constructor + * @param {ibc.core.connection.v1.IMsgConnectionOpenTryResponse=} [properties] Properties to set + */ + function MsgConnectionOpenTryResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgConnectionOpenTryResponse message. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenTryResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.connection.v1.MsgConnectionOpenTryResponse + * @static + * @param {ibc.core.connection.v1.IMsgConnectionOpenTryResponse} message MsgConnectionOpenTryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgConnectionOpenTryResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgConnectionOpenTryResponse message, length delimited. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenTryResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.connection.v1.MsgConnectionOpenTryResponse + * @static + * @param {ibc.core.connection.v1.IMsgConnectionOpenTryResponse} message MsgConnectionOpenTryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgConnectionOpenTryResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgConnectionOpenTryResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.connection.v1.MsgConnectionOpenTryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.connection.v1.MsgConnectionOpenTryResponse} MsgConnectionOpenTryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgConnectionOpenTryResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.MsgConnectionOpenTryResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgConnectionOpenTryResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.connection.v1.MsgConnectionOpenTryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.connection.v1.MsgConnectionOpenTryResponse} MsgConnectionOpenTryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgConnectionOpenTryResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgConnectionOpenTryResponse message. + * @function verify + * @memberof ibc.core.connection.v1.MsgConnectionOpenTryResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgConnectionOpenTryResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgConnectionOpenTryResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.connection.v1.MsgConnectionOpenTryResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.connection.v1.MsgConnectionOpenTryResponse} MsgConnectionOpenTryResponse + */ + MsgConnectionOpenTryResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.connection.v1.MsgConnectionOpenTryResponse) + return object; + return new $root.ibc.core.connection.v1.MsgConnectionOpenTryResponse(); + }; + + /** + * Creates a plain object from a MsgConnectionOpenTryResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.connection.v1.MsgConnectionOpenTryResponse + * @static + * @param {ibc.core.connection.v1.MsgConnectionOpenTryResponse} message MsgConnectionOpenTryResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgConnectionOpenTryResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgConnectionOpenTryResponse to JSON. + * @function toJSON + * @memberof ibc.core.connection.v1.MsgConnectionOpenTryResponse + * @instance + * @returns {Object.} JSON object + */ + MsgConnectionOpenTryResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgConnectionOpenTryResponse; + })(); + + v1.MsgConnectionOpenAck = (function() { + + /** + * Properties of a MsgConnectionOpenAck. + * @memberof ibc.core.connection.v1 + * @interface IMsgConnectionOpenAck + * @property {string|null} [connection_id] MsgConnectionOpenAck connection_id + * @property {string|null} [counterparty_connection_id] MsgConnectionOpenAck counterparty_connection_id + * @property {ibc.core.connection.v1.IVersion|null} [version] MsgConnectionOpenAck version + * @property {google.protobuf.IAny|null} [client_state] MsgConnectionOpenAck client_state + * @property {ibc.core.client.v1.IHeight|null} [proof_height] MsgConnectionOpenAck proof_height + * @property {Uint8Array|null} [proof_try] MsgConnectionOpenAck proof_try + * @property {Uint8Array|null} [proof_client] MsgConnectionOpenAck proof_client + * @property {Uint8Array|null} [proof_consensus] MsgConnectionOpenAck proof_consensus + * @property {ibc.core.client.v1.IHeight|null} [consensus_height] MsgConnectionOpenAck consensus_height + * @property {string|null} [signer] MsgConnectionOpenAck signer + */ + + /** + * Constructs a new MsgConnectionOpenAck. + * @memberof ibc.core.connection.v1 + * @classdesc Represents a MsgConnectionOpenAck. + * @implements IMsgConnectionOpenAck + * @constructor + * @param {ibc.core.connection.v1.IMsgConnectionOpenAck=} [properties] Properties to set + */ + function MsgConnectionOpenAck(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgConnectionOpenAck connection_id. + * @member {string} connection_id + * @memberof ibc.core.connection.v1.MsgConnectionOpenAck + * @instance + */ + MsgConnectionOpenAck.prototype.connection_id = ""; + + /** + * MsgConnectionOpenAck counterparty_connection_id. + * @member {string} counterparty_connection_id + * @memberof ibc.core.connection.v1.MsgConnectionOpenAck + * @instance + */ + MsgConnectionOpenAck.prototype.counterparty_connection_id = ""; + + /** + * MsgConnectionOpenAck version. + * @member {ibc.core.connection.v1.IVersion|null|undefined} version + * @memberof ibc.core.connection.v1.MsgConnectionOpenAck + * @instance + */ + MsgConnectionOpenAck.prototype.version = null; + + /** + * MsgConnectionOpenAck client_state. + * @member {google.protobuf.IAny|null|undefined} client_state + * @memberof ibc.core.connection.v1.MsgConnectionOpenAck + * @instance + */ + MsgConnectionOpenAck.prototype.client_state = null; + + /** + * MsgConnectionOpenAck proof_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height + * @memberof ibc.core.connection.v1.MsgConnectionOpenAck + * @instance + */ + MsgConnectionOpenAck.prototype.proof_height = null; + + /** + * MsgConnectionOpenAck proof_try. + * @member {Uint8Array} proof_try + * @memberof ibc.core.connection.v1.MsgConnectionOpenAck + * @instance + */ + MsgConnectionOpenAck.prototype.proof_try = $util.newBuffer([]); + + /** + * MsgConnectionOpenAck proof_client. + * @member {Uint8Array} proof_client + * @memberof ibc.core.connection.v1.MsgConnectionOpenAck + * @instance + */ + MsgConnectionOpenAck.prototype.proof_client = $util.newBuffer([]); + + /** + * MsgConnectionOpenAck proof_consensus. + * @member {Uint8Array} proof_consensus + * @memberof ibc.core.connection.v1.MsgConnectionOpenAck + * @instance + */ + MsgConnectionOpenAck.prototype.proof_consensus = $util.newBuffer([]); + + /** + * MsgConnectionOpenAck consensus_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} consensus_height + * @memberof ibc.core.connection.v1.MsgConnectionOpenAck + * @instance + */ + MsgConnectionOpenAck.prototype.consensus_height = null; + + /** + * MsgConnectionOpenAck signer. + * @member {string} signer + * @memberof ibc.core.connection.v1.MsgConnectionOpenAck + * @instance + */ + MsgConnectionOpenAck.prototype.signer = ""; + + /** + * Encodes the specified MsgConnectionOpenAck message. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenAck.verify|verify} messages. + * @function encode + * @memberof ibc.core.connection.v1.MsgConnectionOpenAck + * @static + * @param {ibc.core.connection.v1.IMsgConnectionOpenAck} message MsgConnectionOpenAck message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgConnectionOpenAck.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.connection_id != null && Object.hasOwnProperty.call(message, "connection_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.connection_id); + if (message.counterparty_connection_id != null && Object.hasOwnProperty.call(message, "counterparty_connection_id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.counterparty_connection_id); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + $root.ibc.core.connection.v1.Version.encode(message.version, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.client_state != null && Object.hasOwnProperty.call(message, "client_state")) + $root.google.protobuf.Any.encode(message.client_state, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) + $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.proof_try != null && Object.hasOwnProperty.call(message, "proof_try")) + writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.proof_try); + if (message.proof_client != null && Object.hasOwnProperty.call(message, "proof_client")) + writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.proof_client); + if (message.proof_consensus != null && Object.hasOwnProperty.call(message, "proof_consensus")) + writer.uint32(/* id 8, wireType 2 =*/66).bytes(message.proof_consensus); + if (message.consensus_height != null && Object.hasOwnProperty.call(message, "consensus_height")) + $root.ibc.core.client.v1.Height.encode(message.consensus_height, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.signer); + return writer; + }; + + /** + * Encodes the specified MsgConnectionOpenAck message, length delimited. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenAck.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.connection.v1.MsgConnectionOpenAck + * @static + * @param {ibc.core.connection.v1.IMsgConnectionOpenAck} message MsgConnectionOpenAck message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgConnectionOpenAck.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgConnectionOpenAck message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.connection.v1.MsgConnectionOpenAck + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.connection.v1.MsgConnectionOpenAck} MsgConnectionOpenAck + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgConnectionOpenAck.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.MsgConnectionOpenAck(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connection_id = reader.string(); + break; + case 2: + message.counterparty_connection_id = reader.string(); + break; + case 3: + message.version = $root.ibc.core.connection.v1.Version.decode(reader, reader.uint32()); + break; + case 4: + message.client_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 5: + message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + case 6: + message.proof_try = reader.bytes(); + break; + case 7: + message.proof_client = reader.bytes(); + break; + case 8: + message.proof_consensus = reader.bytes(); + break; + case 9: + message.consensus_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + case 10: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgConnectionOpenAck message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.connection.v1.MsgConnectionOpenAck + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.connection.v1.MsgConnectionOpenAck} MsgConnectionOpenAck + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgConnectionOpenAck.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgConnectionOpenAck message. + * @function verify + * @memberof ibc.core.connection.v1.MsgConnectionOpenAck + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgConnectionOpenAck.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.connection_id != null && message.hasOwnProperty("connection_id")) + if (!$util.isString(message.connection_id)) + return "connection_id: string expected"; + if (message.counterparty_connection_id != null && message.hasOwnProperty("counterparty_connection_id")) + if (!$util.isString(message.counterparty_connection_id)) + return "counterparty_connection_id: string expected"; + if (message.version != null && message.hasOwnProperty("version")) { + let error = $root.ibc.core.connection.v1.Version.verify(message.version); + if (error) + return "version." + error; + } + if (message.client_state != null && message.hasOwnProperty("client_state")) { + let error = $root.google.protobuf.Any.verify(message.client_state); + if (error) + return "client_state." + error; + } + if (message.proof_height != null && message.hasOwnProperty("proof_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); + if (error) + return "proof_height." + error; + } + if (message.proof_try != null && message.hasOwnProperty("proof_try")) + if (!(message.proof_try && typeof message.proof_try.length === "number" || $util.isString(message.proof_try))) + return "proof_try: buffer expected"; + if (message.proof_client != null && message.hasOwnProperty("proof_client")) + if (!(message.proof_client && typeof message.proof_client.length === "number" || $util.isString(message.proof_client))) + return "proof_client: buffer expected"; + if (message.proof_consensus != null && message.hasOwnProperty("proof_consensus")) + if (!(message.proof_consensus && typeof message.proof_consensus.length === "number" || $util.isString(message.proof_consensus))) + return "proof_consensus: buffer expected"; + if (message.consensus_height != null && message.hasOwnProperty("consensus_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.consensus_height); + if (error) + return "consensus_height." + error; + } + if (message.signer != null && message.hasOwnProperty("signer")) + if (!$util.isString(message.signer)) + return "signer: string expected"; + return null; + }; + + /** + * Creates a MsgConnectionOpenAck message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.connection.v1.MsgConnectionOpenAck + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.connection.v1.MsgConnectionOpenAck} MsgConnectionOpenAck + */ + MsgConnectionOpenAck.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.connection.v1.MsgConnectionOpenAck) + return object; + let message = new $root.ibc.core.connection.v1.MsgConnectionOpenAck(); + if (object.connection_id != null) + message.connection_id = String(object.connection_id); + if (object.counterparty_connection_id != null) + message.counterparty_connection_id = String(object.counterparty_connection_id); + if (object.version != null) { + if (typeof object.version !== "object") + throw TypeError(".ibc.core.connection.v1.MsgConnectionOpenAck.version: object expected"); + message.version = $root.ibc.core.connection.v1.Version.fromObject(object.version); + } + if (object.client_state != null) { + if (typeof object.client_state !== "object") + throw TypeError(".ibc.core.connection.v1.MsgConnectionOpenAck.client_state: object expected"); + message.client_state = $root.google.protobuf.Any.fromObject(object.client_state); + } + if (object.proof_height != null) { + if (typeof object.proof_height !== "object") + throw TypeError(".ibc.core.connection.v1.MsgConnectionOpenAck.proof_height: object expected"); + message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); + } + if (object.proof_try != null) + if (typeof object.proof_try === "string") + $util.base64.decode(object.proof_try, message.proof_try = $util.newBuffer($util.base64.length(object.proof_try)), 0); + else if (object.proof_try.length) + message.proof_try = object.proof_try; + if (object.proof_client != null) + if (typeof object.proof_client === "string") + $util.base64.decode(object.proof_client, message.proof_client = $util.newBuffer($util.base64.length(object.proof_client)), 0); + else if (object.proof_client.length) + message.proof_client = object.proof_client; + if (object.proof_consensus != null) + if (typeof object.proof_consensus === "string") + $util.base64.decode(object.proof_consensus, message.proof_consensus = $util.newBuffer($util.base64.length(object.proof_consensus)), 0); + else if (object.proof_consensus.length) + message.proof_consensus = object.proof_consensus; + if (object.consensus_height != null) { + if (typeof object.consensus_height !== "object") + throw TypeError(".ibc.core.connection.v1.MsgConnectionOpenAck.consensus_height: object expected"); + message.consensus_height = $root.ibc.core.client.v1.Height.fromObject(object.consensus_height); + } + if (object.signer != null) + message.signer = String(object.signer); + return message; + }; + + /** + * Creates a plain object from a MsgConnectionOpenAck message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.connection.v1.MsgConnectionOpenAck + * @static + * @param {ibc.core.connection.v1.MsgConnectionOpenAck} message MsgConnectionOpenAck + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgConnectionOpenAck.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.connection_id = ""; + object.counterparty_connection_id = ""; + object.version = null; + object.client_state = null; + object.proof_height = null; + if (options.bytes === String) + object.proof_try = ""; + else { + object.proof_try = []; + if (options.bytes !== Array) + object.proof_try = $util.newBuffer(object.proof_try); + } + if (options.bytes === String) + object.proof_client = ""; + else { + object.proof_client = []; + if (options.bytes !== Array) + object.proof_client = $util.newBuffer(object.proof_client); + } + if (options.bytes === String) + object.proof_consensus = ""; + else { + object.proof_consensus = []; + if (options.bytes !== Array) + object.proof_consensus = $util.newBuffer(object.proof_consensus); + } + object.consensus_height = null; + object.signer = ""; + } + if (message.connection_id != null && message.hasOwnProperty("connection_id")) + object.connection_id = message.connection_id; + if (message.counterparty_connection_id != null && message.hasOwnProperty("counterparty_connection_id")) + object.counterparty_connection_id = message.counterparty_connection_id; + if (message.version != null && message.hasOwnProperty("version")) + object.version = $root.ibc.core.connection.v1.Version.toObject(message.version, options); + if (message.client_state != null && message.hasOwnProperty("client_state")) + object.client_state = $root.google.protobuf.Any.toObject(message.client_state, options); + if (message.proof_height != null && message.hasOwnProperty("proof_height")) + object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); + if (message.proof_try != null && message.hasOwnProperty("proof_try")) + object.proof_try = options.bytes === String ? $util.base64.encode(message.proof_try, 0, message.proof_try.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_try) : message.proof_try; + if (message.proof_client != null && message.hasOwnProperty("proof_client")) + object.proof_client = options.bytes === String ? $util.base64.encode(message.proof_client, 0, message.proof_client.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_client) : message.proof_client; + if (message.proof_consensus != null && message.hasOwnProperty("proof_consensus")) + object.proof_consensus = options.bytes === String ? $util.base64.encode(message.proof_consensus, 0, message.proof_consensus.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_consensus) : message.proof_consensus; + if (message.consensus_height != null && message.hasOwnProperty("consensus_height")) + object.consensus_height = $root.ibc.core.client.v1.Height.toObject(message.consensus_height, options); + if (message.signer != null && message.hasOwnProperty("signer")) + object.signer = message.signer; + return object; + }; + + /** + * Converts this MsgConnectionOpenAck to JSON. + * @function toJSON + * @memberof ibc.core.connection.v1.MsgConnectionOpenAck + * @instance + * @returns {Object.} JSON object + */ + MsgConnectionOpenAck.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgConnectionOpenAck; + })(); + + v1.MsgConnectionOpenAckResponse = (function() { + + /** + * Properties of a MsgConnectionOpenAckResponse. + * @memberof ibc.core.connection.v1 + * @interface IMsgConnectionOpenAckResponse + */ + + /** + * Constructs a new MsgConnectionOpenAckResponse. + * @memberof ibc.core.connection.v1 + * @classdesc Represents a MsgConnectionOpenAckResponse. + * @implements IMsgConnectionOpenAckResponse + * @constructor + * @param {ibc.core.connection.v1.IMsgConnectionOpenAckResponse=} [properties] Properties to set + */ + function MsgConnectionOpenAckResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgConnectionOpenAckResponse message. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenAckResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.connection.v1.MsgConnectionOpenAckResponse + * @static + * @param {ibc.core.connection.v1.IMsgConnectionOpenAckResponse} message MsgConnectionOpenAckResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgConnectionOpenAckResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgConnectionOpenAckResponse message, length delimited. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenAckResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.connection.v1.MsgConnectionOpenAckResponse + * @static + * @param {ibc.core.connection.v1.IMsgConnectionOpenAckResponse} message MsgConnectionOpenAckResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgConnectionOpenAckResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgConnectionOpenAckResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.connection.v1.MsgConnectionOpenAckResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.connection.v1.MsgConnectionOpenAckResponse} MsgConnectionOpenAckResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgConnectionOpenAckResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.MsgConnectionOpenAckResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgConnectionOpenAckResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.connection.v1.MsgConnectionOpenAckResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.connection.v1.MsgConnectionOpenAckResponse} MsgConnectionOpenAckResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgConnectionOpenAckResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgConnectionOpenAckResponse message. + * @function verify + * @memberof ibc.core.connection.v1.MsgConnectionOpenAckResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgConnectionOpenAckResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgConnectionOpenAckResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.connection.v1.MsgConnectionOpenAckResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.connection.v1.MsgConnectionOpenAckResponse} MsgConnectionOpenAckResponse + */ + MsgConnectionOpenAckResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.connection.v1.MsgConnectionOpenAckResponse) + return object; + return new $root.ibc.core.connection.v1.MsgConnectionOpenAckResponse(); + }; + + /** + * Creates a plain object from a MsgConnectionOpenAckResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.connection.v1.MsgConnectionOpenAckResponse + * @static + * @param {ibc.core.connection.v1.MsgConnectionOpenAckResponse} message MsgConnectionOpenAckResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgConnectionOpenAckResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgConnectionOpenAckResponse to JSON. + * @function toJSON + * @memberof ibc.core.connection.v1.MsgConnectionOpenAckResponse + * @instance + * @returns {Object.} JSON object + */ + MsgConnectionOpenAckResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgConnectionOpenAckResponse; + })(); + + v1.MsgConnectionOpenConfirm = (function() { + + /** + * Properties of a MsgConnectionOpenConfirm. + * @memberof ibc.core.connection.v1 + * @interface IMsgConnectionOpenConfirm + * @property {string|null} [connection_id] MsgConnectionOpenConfirm connection_id + * @property {Uint8Array|null} [proof_ack] MsgConnectionOpenConfirm proof_ack + * @property {ibc.core.client.v1.IHeight|null} [proof_height] MsgConnectionOpenConfirm proof_height + * @property {string|null} [signer] MsgConnectionOpenConfirm signer + */ + + /** + * Constructs a new MsgConnectionOpenConfirm. + * @memberof ibc.core.connection.v1 + * @classdesc Represents a MsgConnectionOpenConfirm. + * @implements IMsgConnectionOpenConfirm + * @constructor + * @param {ibc.core.connection.v1.IMsgConnectionOpenConfirm=} [properties] Properties to set + */ + function MsgConnectionOpenConfirm(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgConnectionOpenConfirm connection_id. + * @member {string} connection_id + * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirm + * @instance + */ + MsgConnectionOpenConfirm.prototype.connection_id = ""; + + /** + * MsgConnectionOpenConfirm proof_ack. + * @member {Uint8Array} proof_ack + * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirm + * @instance + */ + MsgConnectionOpenConfirm.prototype.proof_ack = $util.newBuffer([]); + + /** + * MsgConnectionOpenConfirm proof_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height + * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirm + * @instance + */ + MsgConnectionOpenConfirm.prototype.proof_height = null; + + /** + * MsgConnectionOpenConfirm signer. + * @member {string} signer + * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirm + * @instance + */ + MsgConnectionOpenConfirm.prototype.signer = ""; + + /** + * Encodes the specified MsgConnectionOpenConfirm message. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenConfirm.verify|verify} messages. + * @function encode + * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirm + * @static + * @param {ibc.core.connection.v1.IMsgConnectionOpenConfirm} message MsgConnectionOpenConfirm message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgConnectionOpenConfirm.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.connection_id != null && Object.hasOwnProperty.call(message, "connection_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.connection_id); + if (message.proof_ack != null && Object.hasOwnProperty.call(message, "proof_ack")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proof_ack); + if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) + $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.signer); + return writer; + }; + + /** + * Encodes the specified MsgConnectionOpenConfirm message, length delimited. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenConfirm.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirm + * @static + * @param {ibc.core.connection.v1.IMsgConnectionOpenConfirm} message MsgConnectionOpenConfirm message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgConnectionOpenConfirm.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgConnectionOpenConfirm message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirm + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.connection.v1.MsgConnectionOpenConfirm} MsgConnectionOpenConfirm + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgConnectionOpenConfirm.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.MsgConnectionOpenConfirm(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connection_id = reader.string(); + break; + case 2: + message.proof_ack = reader.bytes(); + break; + case 3: + message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + case 4: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgConnectionOpenConfirm message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirm + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.connection.v1.MsgConnectionOpenConfirm} MsgConnectionOpenConfirm + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgConnectionOpenConfirm.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgConnectionOpenConfirm message. + * @function verify + * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirm + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgConnectionOpenConfirm.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.connection_id != null && message.hasOwnProperty("connection_id")) + if (!$util.isString(message.connection_id)) + return "connection_id: string expected"; + if (message.proof_ack != null && message.hasOwnProperty("proof_ack")) + if (!(message.proof_ack && typeof message.proof_ack.length === "number" || $util.isString(message.proof_ack))) + return "proof_ack: buffer expected"; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); + if (error) + return "proof_height." + error; + } + if (message.signer != null && message.hasOwnProperty("signer")) + if (!$util.isString(message.signer)) + return "signer: string expected"; + return null; + }; + + /** + * Creates a MsgConnectionOpenConfirm message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirm + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.connection.v1.MsgConnectionOpenConfirm} MsgConnectionOpenConfirm + */ + MsgConnectionOpenConfirm.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.connection.v1.MsgConnectionOpenConfirm) + return object; + let message = new $root.ibc.core.connection.v1.MsgConnectionOpenConfirm(); + if (object.connection_id != null) + message.connection_id = String(object.connection_id); + if (object.proof_ack != null) + if (typeof object.proof_ack === "string") + $util.base64.decode(object.proof_ack, message.proof_ack = $util.newBuffer($util.base64.length(object.proof_ack)), 0); + else if (object.proof_ack.length) + message.proof_ack = object.proof_ack; + if (object.proof_height != null) { + if (typeof object.proof_height !== "object") + throw TypeError(".ibc.core.connection.v1.MsgConnectionOpenConfirm.proof_height: object expected"); + message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); + } + if (object.signer != null) + message.signer = String(object.signer); + return message; + }; + + /** + * Creates a plain object from a MsgConnectionOpenConfirm message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirm + * @static + * @param {ibc.core.connection.v1.MsgConnectionOpenConfirm} message MsgConnectionOpenConfirm + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgConnectionOpenConfirm.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.connection_id = ""; + if (options.bytes === String) + object.proof_ack = ""; + else { + object.proof_ack = []; + if (options.bytes !== Array) + object.proof_ack = $util.newBuffer(object.proof_ack); + } + object.proof_height = null; + object.signer = ""; + } + if (message.connection_id != null && message.hasOwnProperty("connection_id")) + object.connection_id = message.connection_id; + if (message.proof_ack != null && message.hasOwnProperty("proof_ack")) + object.proof_ack = options.bytes === String ? $util.base64.encode(message.proof_ack, 0, message.proof_ack.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_ack) : message.proof_ack; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) + object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); + if (message.signer != null && message.hasOwnProperty("signer")) + object.signer = message.signer; + return object; + }; + + /** + * Converts this MsgConnectionOpenConfirm to JSON. + * @function toJSON + * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirm + * @instance + * @returns {Object.} JSON object + */ + MsgConnectionOpenConfirm.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgConnectionOpenConfirm; + })(); + + v1.MsgConnectionOpenConfirmResponse = (function() { + + /** + * Properties of a MsgConnectionOpenConfirmResponse. + * @memberof ibc.core.connection.v1 + * @interface IMsgConnectionOpenConfirmResponse + */ + + /** + * Constructs a new MsgConnectionOpenConfirmResponse. + * @memberof ibc.core.connection.v1 + * @classdesc Represents a MsgConnectionOpenConfirmResponse. + * @implements IMsgConnectionOpenConfirmResponse + * @constructor + * @param {ibc.core.connection.v1.IMsgConnectionOpenConfirmResponse=} [properties] Properties to set + */ + function MsgConnectionOpenConfirmResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified MsgConnectionOpenConfirmResponse message. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenConfirmResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirmResponse + * @static + * @param {ibc.core.connection.v1.IMsgConnectionOpenConfirmResponse} message MsgConnectionOpenConfirmResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgConnectionOpenConfirmResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified MsgConnectionOpenConfirmResponse message, length delimited. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenConfirmResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirmResponse + * @static + * @param {ibc.core.connection.v1.IMsgConnectionOpenConfirmResponse} message MsgConnectionOpenConfirmResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgConnectionOpenConfirmResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgConnectionOpenConfirmResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirmResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.connection.v1.MsgConnectionOpenConfirmResponse} MsgConnectionOpenConfirmResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgConnectionOpenConfirmResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.MsgConnectionOpenConfirmResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgConnectionOpenConfirmResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirmResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.connection.v1.MsgConnectionOpenConfirmResponse} MsgConnectionOpenConfirmResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgConnectionOpenConfirmResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgConnectionOpenConfirmResponse message. + * @function verify + * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirmResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgConnectionOpenConfirmResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a MsgConnectionOpenConfirmResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirmResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.connection.v1.MsgConnectionOpenConfirmResponse} MsgConnectionOpenConfirmResponse + */ + MsgConnectionOpenConfirmResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.connection.v1.MsgConnectionOpenConfirmResponse) + return object; + return new $root.ibc.core.connection.v1.MsgConnectionOpenConfirmResponse(); + }; + + /** + * Creates a plain object from a MsgConnectionOpenConfirmResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirmResponse + * @static + * @param {ibc.core.connection.v1.MsgConnectionOpenConfirmResponse} message MsgConnectionOpenConfirmResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgConnectionOpenConfirmResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this MsgConnectionOpenConfirmResponse to JSON. + * @function toJSON + * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirmResponse + * @instance + * @returns {Object.} JSON object + */ + MsgConnectionOpenConfirmResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgConnectionOpenConfirmResponse; + })(); + + v1.Query = (function() { + + /** + * Constructs a new Query service. + * @memberof ibc.core.connection.v1 + * @classdesc Represents a Query + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Query(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Query.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Query; + + /** + * Callback as used by {@link ibc.core.connection.v1.Query#connection}. + * @memberof ibc.core.connection.v1.Query + * @typedef ConnectionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.connection.v1.QueryConnectionResponse} [response] QueryConnectionResponse + */ + + /** + * Calls Connection. + * @function connection + * @memberof ibc.core.connection.v1.Query + * @instance + * @param {ibc.core.connection.v1.IQueryConnectionRequest} request QueryConnectionRequest message or plain object + * @param {ibc.core.connection.v1.Query.ConnectionCallback} callback Node-style callback called with the error, if any, and QueryConnectionResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.connection = function connection(request, callback) { + return this.rpcCall(connection, $root.ibc.core.connection.v1.QueryConnectionRequest, $root.ibc.core.connection.v1.QueryConnectionResponse, request, callback); + }, "name", { value: "Connection" }); + + /** + * Calls Connection. + * @function connection + * @memberof ibc.core.connection.v1.Query + * @instance + * @param {ibc.core.connection.v1.IQueryConnectionRequest} request QueryConnectionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.connection.v1.Query#connections}. + * @memberof ibc.core.connection.v1.Query + * @typedef ConnectionsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.connection.v1.QueryConnectionsResponse} [response] QueryConnectionsResponse + */ + + /** + * Calls Connections. + * @function connections + * @memberof ibc.core.connection.v1.Query + * @instance + * @param {ibc.core.connection.v1.IQueryConnectionsRequest} request QueryConnectionsRequest message or plain object + * @param {ibc.core.connection.v1.Query.ConnectionsCallback} callback Node-style callback called with the error, if any, and QueryConnectionsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.connections = function connections(request, callback) { + return this.rpcCall(connections, $root.ibc.core.connection.v1.QueryConnectionsRequest, $root.ibc.core.connection.v1.QueryConnectionsResponse, request, callback); + }, "name", { value: "Connections" }); + + /** + * Calls Connections. + * @function connections + * @memberof ibc.core.connection.v1.Query + * @instance + * @param {ibc.core.connection.v1.IQueryConnectionsRequest} request QueryConnectionsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.connection.v1.Query#clientConnections}. + * @memberof ibc.core.connection.v1.Query + * @typedef ClientConnectionsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.connection.v1.QueryClientConnectionsResponse} [response] QueryClientConnectionsResponse + */ + + /** + * Calls ClientConnections. + * @function clientConnections + * @memberof ibc.core.connection.v1.Query + * @instance + * @param {ibc.core.connection.v1.IQueryClientConnectionsRequest} request QueryClientConnectionsRequest message or plain object + * @param {ibc.core.connection.v1.Query.ClientConnectionsCallback} callback Node-style callback called with the error, if any, and QueryClientConnectionsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.clientConnections = function clientConnections(request, callback) { + return this.rpcCall(clientConnections, $root.ibc.core.connection.v1.QueryClientConnectionsRequest, $root.ibc.core.connection.v1.QueryClientConnectionsResponse, request, callback); + }, "name", { value: "ClientConnections" }); + + /** + * Calls ClientConnections. + * @function clientConnections + * @memberof ibc.core.connection.v1.Query + * @instance + * @param {ibc.core.connection.v1.IQueryClientConnectionsRequest} request QueryClientConnectionsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.connection.v1.Query#connectionClientState}. + * @memberof ibc.core.connection.v1.Query + * @typedef ConnectionClientStateCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.connection.v1.QueryConnectionClientStateResponse} [response] QueryConnectionClientStateResponse + */ + + /** + * Calls ConnectionClientState. + * @function connectionClientState + * @memberof ibc.core.connection.v1.Query + * @instance + * @param {ibc.core.connection.v1.IQueryConnectionClientStateRequest} request QueryConnectionClientStateRequest message or plain object + * @param {ibc.core.connection.v1.Query.ConnectionClientStateCallback} callback Node-style callback called with the error, if any, and QueryConnectionClientStateResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.connectionClientState = function connectionClientState(request, callback) { + return this.rpcCall(connectionClientState, $root.ibc.core.connection.v1.QueryConnectionClientStateRequest, $root.ibc.core.connection.v1.QueryConnectionClientStateResponse, request, callback); + }, "name", { value: "ConnectionClientState" }); + + /** + * Calls ConnectionClientState. + * @function connectionClientState + * @memberof ibc.core.connection.v1.Query + * @instance + * @param {ibc.core.connection.v1.IQueryConnectionClientStateRequest} request QueryConnectionClientStateRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link ibc.core.connection.v1.Query#connectionConsensusState}. + * @memberof ibc.core.connection.v1.Query + * @typedef ConnectionConsensusStateCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {ibc.core.connection.v1.QueryConnectionConsensusStateResponse} [response] QueryConnectionConsensusStateResponse + */ + + /** + * Calls ConnectionConsensusState. + * @function connectionConsensusState + * @memberof ibc.core.connection.v1.Query + * @instance + * @param {ibc.core.connection.v1.IQueryConnectionConsensusStateRequest} request QueryConnectionConsensusStateRequest message or plain object + * @param {ibc.core.connection.v1.Query.ConnectionConsensusStateCallback} callback Node-style callback called with the error, if any, and QueryConnectionConsensusStateResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Query.prototype.connectionConsensusState = function connectionConsensusState(request, callback) { + return this.rpcCall(connectionConsensusState, $root.ibc.core.connection.v1.QueryConnectionConsensusStateRequest, $root.ibc.core.connection.v1.QueryConnectionConsensusStateResponse, request, callback); + }, "name", { value: "ConnectionConsensusState" }); + + /** + * Calls ConnectionConsensusState. + * @function connectionConsensusState + * @memberof ibc.core.connection.v1.Query + * @instance + * @param {ibc.core.connection.v1.IQueryConnectionConsensusStateRequest} request QueryConnectionConsensusStateRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Query; + })(); + + v1.QueryConnectionRequest = (function() { + + /** + * Properties of a QueryConnectionRequest. + * @memberof ibc.core.connection.v1 + * @interface IQueryConnectionRequest + * @property {string|null} [connection_id] QueryConnectionRequest connection_id + */ + + /** + * Constructs a new QueryConnectionRequest. + * @memberof ibc.core.connection.v1 + * @classdesc Represents a QueryConnectionRequest. + * @implements IQueryConnectionRequest + * @constructor + * @param {ibc.core.connection.v1.IQueryConnectionRequest=} [properties] Properties to set + */ + function QueryConnectionRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryConnectionRequest connection_id. + * @member {string} connection_id + * @memberof ibc.core.connection.v1.QueryConnectionRequest + * @instance + */ + QueryConnectionRequest.prototype.connection_id = ""; + + /** + * Encodes the specified QueryConnectionRequest message. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionRequest.verify|verify} messages. + * @function encode + * @memberof ibc.core.connection.v1.QueryConnectionRequest + * @static + * @param {ibc.core.connection.v1.IQueryConnectionRequest} message QueryConnectionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryConnectionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.connection_id != null && Object.hasOwnProperty.call(message, "connection_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.connection_id); + return writer; + }; + + /** + * Encodes the specified QueryConnectionRequest message, length delimited. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.connection.v1.QueryConnectionRequest + * @static + * @param {ibc.core.connection.v1.IQueryConnectionRequest} message QueryConnectionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryConnectionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryConnectionRequest message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.connection.v1.QueryConnectionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.connection.v1.QueryConnectionRequest} QueryConnectionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryConnectionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.QueryConnectionRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connection_id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryConnectionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.connection.v1.QueryConnectionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.connection.v1.QueryConnectionRequest} QueryConnectionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryConnectionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryConnectionRequest message. + * @function verify + * @memberof ibc.core.connection.v1.QueryConnectionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryConnectionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.connection_id != null && message.hasOwnProperty("connection_id")) + if (!$util.isString(message.connection_id)) + return "connection_id: string expected"; + return null; + }; + + /** + * Creates a QueryConnectionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.connection.v1.QueryConnectionRequest + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.connection.v1.QueryConnectionRequest} QueryConnectionRequest + */ + QueryConnectionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.connection.v1.QueryConnectionRequest) + return object; + let message = new $root.ibc.core.connection.v1.QueryConnectionRequest(); + if (object.connection_id != null) + message.connection_id = String(object.connection_id); + return message; + }; + + /** + * Creates a plain object from a QueryConnectionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.connection.v1.QueryConnectionRequest + * @static + * @param {ibc.core.connection.v1.QueryConnectionRequest} message QueryConnectionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryConnectionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.connection_id = ""; + if (message.connection_id != null && message.hasOwnProperty("connection_id")) + object.connection_id = message.connection_id; + return object; + }; + + /** + * Converts this QueryConnectionRequest to JSON. + * @function toJSON + * @memberof ibc.core.connection.v1.QueryConnectionRequest + * @instance + * @returns {Object.} JSON object + */ + QueryConnectionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryConnectionRequest; + })(); + + v1.QueryConnectionResponse = (function() { + + /** + * Properties of a QueryConnectionResponse. + * @memberof ibc.core.connection.v1 + * @interface IQueryConnectionResponse + * @property {ibc.core.connection.v1.IConnectionEnd|null} [connection] QueryConnectionResponse connection + * @property {Uint8Array|null} [proof] QueryConnectionResponse proof + * @property {ibc.core.client.v1.IHeight|null} [proof_height] QueryConnectionResponse proof_height + */ + + /** + * Constructs a new QueryConnectionResponse. + * @memberof ibc.core.connection.v1 + * @classdesc Represents a QueryConnectionResponse. + * @implements IQueryConnectionResponse + * @constructor + * @param {ibc.core.connection.v1.IQueryConnectionResponse=} [properties] Properties to set + */ + function QueryConnectionResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryConnectionResponse connection. + * @member {ibc.core.connection.v1.IConnectionEnd|null|undefined} connection + * @memberof ibc.core.connection.v1.QueryConnectionResponse + * @instance + */ + QueryConnectionResponse.prototype.connection = null; + + /** + * QueryConnectionResponse proof. + * @member {Uint8Array} proof + * @memberof ibc.core.connection.v1.QueryConnectionResponse + * @instance + */ + QueryConnectionResponse.prototype.proof = $util.newBuffer([]); + + /** + * QueryConnectionResponse proof_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height + * @memberof ibc.core.connection.v1.QueryConnectionResponse + * @instance + */ + QueryConnectionResponse.prototype.proof_height = null; + + /** + * Encodes the specified QueryConnectionResponse message. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.connection.v1.QueryConnectionResponse + * @static + * @param {ibc.core.connection.v1.IQueryConnectionResponse} message QueryConnectionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryConnectionResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.connection != null && Object.hasOwnProperty.call(message, "connection")) + $root.ibc.core.connection.v1.ConnectionEnd.encode(message.connection, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proof); + if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) + $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryConnectionResponse message, length delimited. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.connection.v1.QueryConnectionResponse + * @static + * @param {ibc.core.connection.v1.IQueryConnectionResponse} message QueryConnectionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryConnectionResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryConnectionResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.connection.v1.QueryConnectionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.connection.v1.QueryConnectionResponse} QueryConnectionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryConnectionResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.QueryConnectionResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connection = $root.ibc.core.connection.v1.ConnectionEnd.decode(reader, reader.uint32()); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryConnectionResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.connection.v1.QueryConnectionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.connection.v1.QueryConnectionResponse} QueryConnectionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryConnectionResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryConnectionResponse message. + * @function verify + * @memberof ibc.core.connection.v1.QueryConnectionResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryConnectionResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.connection != null && message.hasOwnProperty("connection")) { + let error = $root.ibc.core.connection.v1.ConnectionEnd.verify(message.connection); + if (error) + return "connection." + error; + } + if (message.proof != null && message.hasOwnProperty("proof")) + if (!(message.proof && typeof message.proof.length === "number" || $util.isString(message.proof))) + return "proof: buffer expected"; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); + if (error) + return "proof_height." + error; + } + return null; + }; + + /** + * Creates a QueryConnectionResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.connection.v1.QueryConnectionResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.connection.v1.QueryConnectionResponse} QueryConnectionResponse + */ + QueryConnectionResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.connection.v1.QueryConnectionResponse) + return object; + let message = new $root.ibc.core.connection.v1.QueryConnectionResponse(); + if (object.connection != null) { + if (typeof object.connection !== "object") + throw TypeError(".ibc.core.connection.v1.QueryConnectionResponse.connection: object expected"); + message.connection = $root.ibc.core.connection.v1.ConnectionEnd.fromObject(object.connection); + } + if (object.proof != null) + if (typeof object.proof === "string") + $util.base64.decode(object.proof, message.proof = $util.newBuffer($util.base64.length(object.proof)), 0); + else if (object.proof.length) + message.proof = object.proof; + if (object.proof_height != null) { + if (typeof object.proof_height !== "object") + throw TypeError(".ibc.core.connection.v1.QueryConnectionResponse.proof_height: object expected"); + message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); + } + return message; + }; + + /** + * Creates a plain object from a QueryConnectionResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.connection.v1.QueryConnectionResponse + * @static + * @param {ibc.core.connection.v1.QueryConnectionResponse} message QueryConnectionResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryConnectionResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.connection = null; + if (options.bytes === String) + object.proof = ""; + else { + object.proof = []; + if (options.bytes !== Array) + object.proof = $util.newBuffer(object.proof); + } + object.proof_height = null; + } + if (message.connection != null && message.hasOwnProperty("connection")) + object.connection = $root.ibc.core.connection.v1.ConnectionEnd.toObject(message.connection, options); + if (message.proof != null && message.hasOwnProperty("proof")) + object.proof = options.bytes === String ? $util.base64.encode(message.proof, 0, message.proof.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof) : message.proof; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) + object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); + return object; + }; + + /** + * Converts this QueryConnectionResponse to JSON. + * @function toJSON + * @memberof ibc.core.connection.v1.QueryConnectionResponse + * @instance + * @returns {Object.} JSON object + */ + QueryConnectionResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryConnectionResponse; + })(); + + v1.QueryConnectionsRequest = (function() { + + /** + * Properties of a QueryConnectionsRequest. + * @memberof ibc.core.connection.v1 + * @interface IQueryConnectionsRequest + * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryConnectionsRequest pagination + */ + + /** + * Constructs a new QueryConnectionsRequest. + * @memberof ibc.core.connection.v1 + * @classdesc Represents a QueryConnectionsRequest. + * @implements IQueryConnectionsRequest + * @constructor + * @param {ibc.core.connection.v1.IQueryConnectionsRequest=} [properties] Properties to set + */ + function QueryConnectionsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryConnectionsRequest pagination. + * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination + * @memberof ibc.core.connection.v1.QueryConnectionsRequest + * @instance + */ + QueryConnectionsRequest.prototype.pagination = null; + + /** + * Encodes the specified QueryConnectionsRequest message. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionsRequest.verify|verify} messages. + * @function encode + * @memberof ibc.core.connection.v1.QueryConnectionsRequest + * @static + * @param {ibc.core.connection.v1.IQueryConnectionsRequest} message QueryConnectionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryConnectionsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryConnectionsRequest message, length delimited. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.connection.v1.QueryConnectionsRequest + * @static + * @param {ibc.core.connection.v1.IQueryConnectionsRequest} message QueryConnectionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryConnectionsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryConnectionsRequest message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.connection.v1.QueryConnectionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.connection.v1.QueryConnectionsRequest} QueryConnectionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryConnectionsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.QueryConnectionsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryConnectionsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.connection.v1.QueryConnectionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.connection.v1.QueryConnectionsRequest} QueryConnectionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryConnectionsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryConnectionsRequest message. + * @function verify + * @memberof ibc.core.connection.v1.QueryConnectionsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryConnectionsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); + if (error) + return "pagination." + error; + } + return null; + }; + + /** + * Creates a QueryConnectionsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.connection.v1.QueryConnectionsRequest + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.connection.v1.QueryConnectionsRequest} QueryConnectionsRequest + */ + QueryConnectionsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.connection.v1.QueryConnectionsRequest) + return object; + let message = new $root.ibc.core.connection.v1.QueryConnectionsRequest(); + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".ibc.core.connection.v1.QueryConnectionsRequest.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); + } + return message; + }; + + /** + * Creates a plain object from a QueryConnectionsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.connection.v1.QueryConnectionsRequest + * @static + * @param {ibc.core.connection.v1.QueryConnectionsRequest} message QueryConnectionsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryConnectionsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.pagination = null; + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); + return object; + }; + + /** + * Converts this QueryConnectionsRequest to JSON. + * @function toJSON + * @memberof ibc.core.connection.v1.QueryConnectionsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryConnectionsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryConnectionsRequest; + })(); + + v1.QueryConnectionsResponse = (function() { + + /** + * Properties of a QueryConnectionsResponse. + * @memberof ibc.core.connection.v1 + * @interface IQueryConnectionsResponse + * @property {Array.|null} [connections] QueryConnectionsResponse connections + * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryConnectionsResponse pagination + * @property {ibc.core.client.v1.IHeight|null} [height] QueryConnectionsResponse height + */ + + /** + * Constructs a new QueryConnectionsResponse. + * @memberof ibc.core.connection.v1 + * @classdesc Represents a QueryConnectionsResponse. + * @implements IQueryConnectionsResponse + * @constructor + * @param {ibc.core.connection.v1.IQueryConnectionsResponse=} [properties] Properties to set + */ + function QueryConnectionsResponse(properties) { + this.connections = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryConnectionsResponse connections. + * @member {Array.} connections + * @memberof ibc.core.connection.v1.QueryConnectionsResponse + * @instance + */ + QueryConnectionsResponse.prototype.connections = $util.emptyArray; + + /** + * QueryConnectionsResponse pagination. + * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination + * @memberof ibc.core.connection.v1.QueryConnectionsResponse + * @instance + */ + QueryConnectionsResponse.prototype.pagination = null; + + /** + * QueryConnectionsResponse height. + * @member {ibc.core.client.v1.IHeight|null|undefined} height + * @memberof ibc.core.connection.v1.QueryConnectionsResponse + * @instance + */ + QueryConnectionsResponse.prototype.height = null; + + /** + * Encodes the specified QueryConnectionsResponse message. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionsResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.connection.v1.QueryConnectionsResponse + * @static + * @param {ibc.core.connection.v1.IQueryConnectionsResponse} message QueryConnectionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryConnectionsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.connections != null && message.connections.length) + for (let i = 0; i < message.connections.length; ++i) + $root.ibc.core.connection.v1.IdentifiedConnection.encode(message.connections[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) + $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + $root.ibc.core.client.v1.Height.encode(message.height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryConnectionsResponse message, length delimited. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.connection.v1.QueryConnectionsResponse + * @static + * @param {ibc.core.connection.v1.IQueryConnectionsResponse} message QueryConnectionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryConnectionsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryConnectionsResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.connection.v1.QueryConnectionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.connection.v1.QueryConnectionsResponse} QueryConnectionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryConnectionsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.QueryConnectionsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.connections && message.connections.length)) + message.connections = []; + message.connections.push($root.ibc.core.connection.v1.IdentifiedConnection.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); + break; + case 3: + message.height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryConnectionsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.connection.v1.QueryConnectionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.connection.v1.QueryConnectionsResponse} QueryConnectionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryConnectionsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryConnectionsResponse message. + * @function verify + * @memberof ibc.core.connection.v1.QueryConnectionsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryConnectionsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.connections != null && message.hasOwnProperty("connections")) { + if (!Array.isArray(message.connections)) + return "connections: array expected"; + for (let i = 0; i < message.connections.length; ++i) { + let error = $root.ibc.core.connection.v1.IdentifiedConnection.verify(message.connections[i]); + if (error) + return "connections." + error; + } + } + if (message.pagination != null && message.hasOwnProperty("pagination")) { + let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); + if (error) + return "pagination." + error; + } + if (message.height != null && message.hasOwnProperty("height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.height); + if (error) + return "height." + error; + } + return null; + }; + + /** + * Creates a QueryConnectionsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.connection.v1.QueryConnectionsResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.connection.v1.QueryConnectionsResponse} QueryConnectionsResponse + */ + QueryConnectionsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.connection.v1.QueryConnectionsResponse) + return object; + let message = new $root.ibc.core.connection.v1.QueryConnectionsResponse(); + if (object.connections) { + if (!Array.isArray(object.connections)) + throw TypeError(".ibc.core.connection.v1.QueryConnectionsResponse.connections: array expected"); + message.connections = []; + for (let i = 0; i < object.connections.length; ++i) { + if (typeof object.connections[i] !== "object") + throw TypeError(".ibc.core.connection.v1.QueryConnectionsResponse.connections: object expected"); + message.connections[i] = $root.ibc.core.connection.v1.IdentifiedConnection.fromObject(object.connections[i]); + } + } + if (object.pagination != null) { + if (typeof object.pagination !== "object") + throw TypeError(".ibc.core.connection.v1.QueryConnectionsResponse.pagination: object expected"); + message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); + } + if (object.height != null) { + if (typeof object.height !== "object") + throw TypeError(".ibc.core.connection.v1.QueryConnectionsResponse.height: object expected"); + message.height = $root.ibc.core.client.v1.Height.fromObject(object.height); + } + return message; + }; + + /** + * Creates a plain object from a QueryConnectionsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.connection.v1.QueryConnectionsResponse + * @static + * @param {ibc.core.connection.v1.QueryConnectionsResponse} message QueryConnectionsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryConnectionsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.connections = []; + if (options.defaults) { + object.pagination = null; + object.height = null; + } + if (message.connections && message.connections.length) { + object.connections = []; + for (let j = 0; j < message.connections.length; ++j) + object.connections[j] = $root.ibc.core.connection.v1.IdentifiedConnection.toObject(message.connections[j], options); + } + if (message.pagination != null && message.hasOwnProperty("pagination")) + object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); + if (message.height != null && message.hasOwnProperty("height")) + object.height = $root.ibc.core.client.v1.Height.toObject(message.height, options); + return object; + }; + + /** + * Converts this QueryConnectionsResponse to JSON. + * @function toJSON + * @memberof ibc.core.connection.v1.QueryConnectionsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryConnectionsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryConnectionsResponse; + })(); + + v1.QueryClientConnectionsRequest = (function() { + + /** + * Properties of a QueryClientConnectionsRequest. + * @memberof ibc.core.connection.v1 + * @interface IQueryClientConnectionsRequest + * @property {string|null} [client_id] QueryClientConnectionsRequest client_id + */ + + /** + * Constructs a new QueryClientConnectionsRequest. + * @memberof ibc.core.connection.v1 + * @classdesc Represents a QueryClientConnectionsRequest. + * @implements IQueryClientConnectionsRequest + * @constructor + * @param {ibc.core.connection.v1.IQueryClientConnectionsRequest=} [properties] Properties to set + */ + function QueryClientConnectionsRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryClientConnectionsRequest client_id. + * @member {string} client_id + * @memberof ibc.core.connection.v1.QueryClientConnectionsRequest + * @instance + */ + QueryClientConnectionsRequest.prototype.client_id = ""; + + /** + * Encodes the specified QueryClientConnectionsRequest message. Does not implicitly {@link ibc.core.connection.v1.QueryClientConnectionsRequest.verify|verify} messages. + * @function encode + * @memberof ibc.core.connection.v1.QueryClientConnectionsRequest + * @static + * @param {ibc.core.connection.v1.IQueryClientConnectionsRequest} message QueryClientConnectionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryClientConnectionsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); + return writer; + }; + + /** + * Encodes the specified QueryClientConnectionsRequest message, length delimited. Does not implicitly {@link ibc.core.connection.v1.QueryClientConnectionsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.connection.v1.QueryClientConnectionsRequest + * @static + * @param {ibc.core.connection.v1.IQueryClientConnectionsRequest} message QueryClientConnectionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryClientConnectionsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryClientConnectionsRequest message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.connection.v1.QueryClientConnectionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.connection.v1.QueryClientConnectionsRequest} QueryClientConnectionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryClientConnectionsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.QueryClientConnectionsRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.client_id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryClientConnectionsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.connection.v1.QueryClientConnectionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.connection.v1.QueryClientConnectionsRequest} QueryClientConnectionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryClientConnectionsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryClientConnectionsRequest message. + * @function verify + * @memberof ibc.core.connection.v1.QueryClientConnectionsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryClientConnectionsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.client_id != null && message.hasOwnProperty("client_id")) + if (!$util.isString(message.client_id)) + return "client_id: string expected"; + return null; + }; + + /** + * Creates a QueryClientConnectionsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.connection.v1.QueryClientConnectionsRequest + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.connection.v1.QueryClientConnectionsRequest} QueryClientConnectionsRequest + */ + QueryClientConnectionsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.connection.v1.QueryClientConnectionsRequest) + return object; + let message = new $root.ibc.core.connection.v1.QueryClientConnectionsRequest(); + if (object.client_id != null) + message.client_id = String(object.client_id); + return message; + }; + + /** + * Creates a plain object from a QueryClientConnectionsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.connection.v1.QueryClientConnectionsRequest + * @static + * @param {ibc.core.connection.v1.QueryClientConnectionsRequest} message QueryClientConnectionsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryClientConnectionsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.client_id = ""; + if (message.client_id != null && message.hasOwnProperty("client_id")) + object.client_id = message.client_id; + return object; + }; + + /** + * Converts this QueryClientConnectionsRequest to JSON. + * @function toJSON + * @memberof ibc.core.connection.v1.QueryClientConnectionsRequest + * @instance + * @returns {Object.} JSON object + */ + QueryClientConnectionsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryClientConnectionsRequest; + })(); + + v1.QueryClientConnectionsResponse = (function() { + + /** + * Properties of a QueryClientConnectionsResponse. + * @memberof ibc.core.connection.v1 + * @interface IQueryClientConnectionsResponse + * @property {Array.|null} [connection_paths] QueryClientConnectionsResponse connection_paths + * @property {Uint8Array|null} [proof] QueryClientConnectionsResponse proof + * @property {ibc.core.client.v1.IHeight|null} [proof_height] QueryClientConnectionsResponse proof_height + */ + + /** + * Constructs a new QueryClientConnectionsResponse. + * @memberof ibc.core.connection.v1 + * @classdesc Represents a QueryClientConnectionsResponse. + * @implements IQueryClientConnectionsResponse + * @constructor + * @param {ibc.core.connection.v1.IQueryClientConnectionsResponse=} [properties] Properties to set + */ + function QueryClientConnectionsResponse(properties) { + this.connection_paths = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryClientConnectionsResponse connection_paths. + * @member {Array.} connection_paths + * @memberof ibc.core.connection.v1.QueryClientConnectionsResponse + * @instance + */ + QueryClientConnectionsResponse.prototype.connection_paths = $util.emptyArray; + + /** + * QueryClientConnectionsResponse proof. + * @member {Uint8Array} proof + * @memberof ibc.core.connection.v1.QueryClientConnectionsResponse + * @instance + */ + QueryClientConnectionsResponse.prototype.proof = $util.newBuffer([]); + + /** + * QueryClientConnectionsResponse proof_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height + * @memberof ibc.core.connection.v1.QueryClientConnectionsResponse + * @instance + */ + QueryClientConnectionsResponse.prototype.proof_height = null; + + /** + * Encodes the specified QueryClientConnectionsResponse message. Does not implicitly {@link ibc.core.connection.v1.QueryClientConnectionsResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.connection.v1.QueryClientConnectionsResponse + * @static + * @param {ibc.core.connection.v1.IQueryClientConnectionsResponse} message QueryClientConnectionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryClientConnectionsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.connection_paths != null && message.connection_paths.length) + for (let i = 0; i < message.connection_paths.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.connection_paths[i]); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proof); + if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) + $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryClientConnectionsResponse message, length delimited. Does not implicitly {@link ibc.core.connection.v1.QueryClientConnectionsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.connection.v1.QueryClientConnectionsResponse + * @static + * @param {ibc.core.connection.v1.IQueryClientConnectionsResponse} message QueryClientConnectionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryClientConnectionsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryClientConnectionsResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.connection.v1.QueryClientConnectionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.connection.v1.QueryClientConnectionsResponse} QueryClientConnectionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryClientConnectionsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.QueryClientConnectionsResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.connection_paths && message.connection_paths.length)) + message.connection_paths = []; + message.connection_paths.push(reader.string()); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryClientConnectionsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.connection.v1.QueryClientConnectionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.connection.v1.QueryClientConnectionsResponse} QueryClientConnectionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryClientConnectionsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryClientConnectionsResponse message. + * @function verify + * @memberof ibc.core.connection.v1.QueryClientConnectionsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryClientConnectionsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.connection_paths != null && message.hasOwnProperty("connection_paths")) { + if (!Array.isArray(message.connection_paths)) + return "connection_paths: array expected"; + for (let i = 0; i < message.connection_paths.length; ++i) + if (!$util.isString(message.connection_paths[i])) + return "connection_paths: string[] expected"; + } + if (message.proof != null && message.hasOwnProperty("proof")) + if (!(message.proof && typeof message.proof.length === "number" || $util.isString(message.proof))) + return "proof: buffer expected"; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); + if (error) + return "proof_height." + error; + } + return null; + }; + + /** + * Creates a QueryClientConnectionsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.connection.v1.QueryClientConnectionsResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.connection.v1.QueryClientConnectionsResponse} QueryClientConnectionsResponse + */ + QueryClientConnectionsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.connection.v1.QueryClientConnectionsResponse) + return object; + let message = new $root.ibc.core.connection.v1.QueryClientConnectionsResponse(); + if (object.connection_paths) { + if (!Array.isArray(object.connection_paths)) + throw TypeError(".ibc.core.connection.v1.QueryClientConnectionsResponse.connection_paths: array expected"); + message.connection_paths = []; + for (let i = 0; i < object.connection_paths.length; ++i) + message.connection_paths[i] = String(object.connection_paths[i]); + } + if (object.proof != null) + if (typeof object.proof === "string") + $util.base64.decode(object.proof, message.proof = $util.newBuffer($util.base64.length(object.proof)), 0); + else if (object.proof.length) + message.proof = object.proof; + if (object.proof_height != null) { + if (typeof object.proof_height !== "object") + throw TypeError(".ibc.core.connection.v1.QueryClientConnectionsResponse.proof_height: object expected"); + message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); + } + return message; + }; + + /** + * Creates a plain object from a QueryClientConnectionsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.connection.v1.QueryClientConnectionsResponse + * @static + * @param {ibc.core.connection.v1.QueryClientConnectionsResponse} message QueryClientConnectionsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryClientConnectionsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.connection_paths = []; + if (options.defaults) { + if (options.bytes === String) + object.proof = ""; + else { + object.proof = []; + if (options.bytes !== Array) + object.proof = $util.newBuffer(object.proof); + } + object.proof_height = null; + } + if (message.connection_paths && message.connection_paths.length) { + object.connection_paths = []; + for (let j = 0; j < message.connection_paths.length; ++j) + object.connection_paths[j] = message.connection_paths[j]; + } + if (message.proof != null && message.hasOwnProperty("proof")) + object.proof = options.bytes === String ? $util.base64.encode(message.proof, 0, message.proof.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof) : message.proof; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) + object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); + return object; + }; + + /** + * Converts this QueryClientConnectionsResponse to JSON. + * @function toJSON + * @memberof ibc.core.connection.v1.QueryClientConnectionsResponse + * @instance + * @returns {Object.} JSON object + */ + QueryClientConnectionsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryClientConnectionsResponse; + })(); + + v1.QueryConnectionClientStateRequest = (function() { + + /** + * Properties of a QueryConnectionClientStateRequest. + * @memberof ibc.core.connection.v1 + * @interface IQueryConnectionClientStateRequest + * @property {string|null} [connection_id] QueryConnectionClientStateRequest connection_id + */ + + /** + * Constructs a new QueryConnectionClientStateRequest. + * @memberof ibc.core.connection.v1 + * @classdesc Represents a QueryConnectionClientStateRequest. + * @implements IQueryConnectionClientStateRequest + * @constructor + * @param {ibc.core.connection.v1.IQueryConnectionClientStateRequest=} [properties] Properties to set + */ + function QueryConnectionClientStateRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryConnectionClientStateRequest connection_id. + * @member {string} connection_id + * @memberof ibc.core.connection.v1.QueryConnectionClientStateRequest + * @instance + */ + QueryConnectionClientStateRequest.prototype.connection_id = ""; + + /** + * Encodes the specified QueryConnectionClientStateRequest message. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionClientStateRequest.verify|verify} messages. + * @function encode + * @memberof ibc.core.connection.v1.QueryConnectionClientStateRequest + * @static + * @param {ibc.core.connection.v1.IQueryConnectionClientStateRequest} message QueryConnectionClientStateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryConnectionClientStateRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.connection_id != null && Object.hasOwnProperty.call(message, "connection_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.connection_id); + return writer; + }; + + /** + * Encodes the specified QueryConnectionClientStateRequest message, length delimited. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionClientStateRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.connection.v1.QueryConnectionClientStateRequest + * @static + * @param {ibc.core.connection.v1.IQueryConnectionClientStateRequest} message QueryConnectionClientStateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryConnectionClientStateRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryConnectionClientStateRequest message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.connection.v1.QueryConnectionClientStateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.connection.v1.QueryConnectionClientStateRequest} QueryConnectionClientStateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryConnectionClientStateRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.QueryConnectionClientStateRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connection_id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryConnectionClientStateRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.connection.v1.QueryConnectionClientStateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.connection.v1.QueryConnectionClientStateRequest} QueryConnectionClientStateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryConnectionClientStateRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryConnectionClientStateRequest message. + * @function verify + * @memberof ibc.core.connection.v1.QueryConnectionClientStateRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryConnectionClientStateRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.connection_id != null && message.hasOwnProperty("connection_id")) + if (!$util.isString(message.connection_id)) + return "connection_id: string expected"; + return null; + }; + + /** + * Creates a QueryConnectionClientStateRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.connection.v1.QueryConnectionClientStateRequest + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.connection.v1.QueryConnectionClientStateRequest} QueryConnectionClientStateRequest + */ + QueryConnectionClientStateRequest.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.connection.v1.QueryConnectionClientStateRequest) + return object; + let message = new $root.ibc.core.connection.v1.QueryConnectionClientStateRequest(); + if (object.connection_id != null) + message.connection_id = String(object.connection_id); + return message; + }; + + /** + * Creates a plain object from a QueryConnectionClientStateRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.connection.v1.QueryConnectionClientStateRequest + * @static + * @param {ibc.core.connection.v1.QueryConnectionClientStateRequest} message QueryConnectionClientStateRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryConnectionClientStateRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.connection_id = ""; + if (message.connection_id != null && message.hasOwnProperty("connection_id")) + object.connection_id = message.connection_id; + return object; + }; + + /** + * Converts this QueryConnectionClientStateRequest to JSON. + * @function toJSON + * @memberof ibc.core.connection.v1.QueryConnectionClientStateRequest + * @instance + * @returns {Object.} JSON object + */ + QueryConnectionClientStateRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryConnectionClientStateRequest; + })(); + + v1.QueryConnectionClientStateResponse = (function() { + + /** + * Properties of a QueryConnectionClientStateResponse. + * @memberof ibc.core.connection.v1 + * @interface IQueryConnectionClientStateResponse + * @property {ibc.core.client.v1.IIdentifiedClientState|null} [identified_client_state] QueryConnectionClientStateResponse identified_client_state + * @property {Uint8Array|null} [proof] QueryConnectionClientStateResponse proof + * @property {ibc.core.client.v1.IHeight|null} [proof_height] QueryConnectionClientStateResponse proof_height + */ + + /** + * Constructs a new QueryConnectionClientStateResponse. + * @memberof ibc.core.connection.v1 + * @classdesc Represents a QueryConnectionClientStateResponse. + * @implements IQueryConnectionClientStateResponse + * @constructor + * @param {ibc.core.connection.v1.IQueryConnectionClientStateResponse=} [properties] Properties to set + */ + function QueryConnectionClientStateResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryConnectionClientStateResponse identified_client_state. + * @member {ibc.core.client.v1.IIdentifiedClientState|null|undefined} identified_client_state + * @memberof ibc.core.connection.v1.QueryConnectionClientStateResponse + * @instance + */ + QueryConnectionClientStateResponse.prototype.identified_client_state = null; + + /** + * QueryConnectionClientStateResponse proof. + * @member {Uint8Array} proof + * @memberof ibc.core.connection.v1.QueryConnectionClientStateResponse + * @instance + */ + QueryConnectionClientStateResponse.prototype.proof = $util.newBuffer([]); + + /** + * QueryConnectionClientStateResponse proof_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height + * @memberof ibc.core.connection.v1.QueryConnectionClientStateResponse + * @instance + */ + QueryConnectionClientStateResponse.prototype.proof_height = null; + + /** + * Encodes the specified QueryConnectionClientStateResponse message. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionClientStateResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.connection.v1.QueryConnectionClientStateResponse + * @static + * @param {ibc.core.connection.v1.IQueryConnectionClientStateResponse} message QueryConnectionClientStateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryConnectionClientStateResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.identified_client_state != null && Object.hasOwnProperty.call(message, "identified_client_state")) + $root.ibc.core.client.v1.IdentifiedClientState.encode(message.identified_client_state, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proof); + if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) + $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryConnectionClientStateResponse message, length delimited. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionClientStateResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.connection.v1.QueryConnectionClientStateResponse + * @static + * @param {ibc.core.connection.v1.IQueryConnectionClientStateResponse} message QueryConnectionClientStateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryConnectionClientStateResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryConnectionClientStateResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.connection.v1.QueryConnectionClientStateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.connection.v1.QueryConnectionClientStateResponse} QueryConnectionClientStateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryConnectionClientStateResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.QueryConnectionClientStateResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.identified_client_state = $root.ibc.core.client.v1.IdentifiedClientState.decode(reader, reader.uint32()); + break; + case 2: + message.proof = reader.bytes(); + break; + case 3: + message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryConnectionClientStateResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.connection.v1.QueryConnectionClientStateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.connection.v1.QueryConnectionClientStateResponse} QueryConnectionClientStateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryConnectionClientStateResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryConnectionClientStateResponse message. + * @function verify + * @memberof ibc.core.connection.v1.QueryConnectionClientStateResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryConnectionClientStateResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.identified_client_state != null && message.hasOwnProperty("identified_client_state")) { + let error = $root.ibc.core.client.v1.IdentifiedClientState.verify(message.identified_client_state); + if (error) + return "identified_client_state." + error; + } + if (message.proof != null && message.hasOwnProperty("proof")) + if (!(message.proof && typeof message.proof.length === "number" || $util.isString(message.proof))) + return "proof: buffer expected"; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); + if (error) + return "proof_height." + error; + } + return null; + }; + + /** + * Creates a QueryConnectionClientStateResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.connection.v1.QueryConnectionClientStateResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.connection.v1.QueryConnectionClientStateResponse} QueryConnectionClientStateResponse + */ + QueryConnectionClientStateResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.connection.v1.QueryConnectionClientStateResponse) + return object; + let message = new $root.ibc.core.connection.v1.QueryConnectionClientStateResponse(); + if (object.identified_client_state != null) { + if (typeof object.identified_client_state !== "object") + throw TypeError(".ibc.core.connection.v1.QueryConnectionClientStateResponse.identified_client_state: object expected"); + message.identified_client_state = $root.ibc.core.client.v1.IdentifiedClientState.fromObject(object.identified_client_state); + } + if (object.proof != null) + if (typeof object.proof === "string") + $util.base64.decode(object.proof, message.proof = $util.newBuffer($util.base64.length(object.proof)), 0); + else if (object.proof.length) + message.proof = object.proof; + if (object.proof_height != null) { + if (typeof object.proof_height !== "object") + throw TypeError(".ibc.core.connection.v1.QueryConnectionClientStateResponse.proof_height: object expected"); + message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); + } + return message; + }; + + /** + * Creates a plain object from a QueryConnectionClientStateResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.connection.v1.QueryConnectionClientStateResponse + * @static + * @param {ibc.core.connection.v1.QueryConnectionClientStateResponse} message QueryConnectionClientStateResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryConnectionClientStateResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.identified_client_state = null; + if (options.bytes === String) + object.proof = ""; + else { + object.proof = []; + if (options.bytes !== Array) + object.proof = $util.newBuffer(object.proof); + } + object.proof_height = null; + } + if (message.identified_client_state != null && message.hasOwnProperty("identified_client_state")) + object.identified_client_state = $root.ibc.core.client.v1.IdentifiedClientState.toObject(message.identified_client_state, options); + if (message.proof != null && message.hasOwnProperty("proof")) + object.proof = options.bytes === String ? $util.base64.encode(message.proof, 0, message.proof.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof) : message.proof; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) + object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); + return object; + }; + + /** + * Converts this QueryConnectionClientStateResponse to JSON. + * @function toJSON + * @memberof ibc.core.connection.v1.QueryConnectionClientStateResponse + * @instance + * @returns {Object.} JSON object + */ + QueryConnectionClientStateResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryConnectionClientStateResponse; + })(); + + v1.QueryConnectionConsensusStateRequest = (function() { + + /** + * Properties of a QueryConnectionConsensusStateRequest. + * @memberof ibc.core.connection.v1 + * @interface IQueryConnectionConsensusStateRequest + * @property {string|null} [connection_id] QueryConnectionConsensusStateRequest connection_id + * @property {Long|null} [revision_number] QueryConnectionConsensusStateRequest revision_number + * @property {Long|null} [revision_height] QueryConnectionConsensusStateRequest revision_height + */ + + /** + * Constructs a new QueryConnectionConsensusStateRequest. + * @memberof ibc.core.connection.v1 + * @classdesc Represents a QueryConnectionConsensusStateRequest. + * @implements IQueryConnectionConsensusStateRequest + * @constructor + * @param {ibc.core.connection.v1.IQueryConnectionConsensusStateRequest=} [properties] Properties to set + */ + function QueryConnectionConsensusStateRequest(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryConnectionConsensusStateRequest connection_id. + * @member {string} connection_id + * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateRequest + * @instance + */ + QueryConnectionConsensusStateRequest.prototype.connection_id = ""; + + /** + * QueryConnectionConsensusStateRequest revision_number. + * @member {Long} revision_number + * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateRequest + * @instance + */ + QueryConnectionConsensusStateRequest.prototype.revision_number = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * QueryConnectionConsensusStateRequest revision_height. + * @member {Long} revision_height + * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateRequest + * @instance + */ + QueryConnectionConsensusStateRequest.prototype.revision_height = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified QueryConnectionConsensusStateRequest message. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionConsensusStateRequest.verify|verify} messages. + * @function encode + * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateRequest + * @static + * @param {ibc.core.connection.v1.IQueryConnectionConsensusStateRequest} message QueryConnectionConsensusStateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryConnectionConsensusStateRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.connection_id != null && Object.hasOwnProperty.call(message, "connection_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.connection_id); + if (message.revision_number != null && Object.hasOwnProperty.call(message, "revision_number")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.revision_number); + if (message.revision_height != null && Object.hasOwnProperty.call(message, "revision_height")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.revision_height); + return writer; + }; + + /** + * Encodes the specified QueryConnectionConsensusStateRequest message, length delimited. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionConsensusStateRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateRequest + * @static + * @param {ibc.core.connection.v1.IQueryConnectionConsensusStateRequest} message QueryConnectionConsensusStateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryConnectionConsensusStateRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryConnectionConsensusStateRequest message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.connection.v1.QueryConnectionConsensusStateRequest} QueryConnectionConsensusStateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryConnectionConsensusStateRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.QueryConnectionConsensusStateRequest(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connection_id = reader.string(); + break; + case 2: + message.revision_number = reader.uint64(); + break; + case 3: + message.revision_height = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryConnectionConsensusStateRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.connection.v1.QueryConnectionConsensusStateRequest} QueryConnectionConsensusStateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryConnectionConsensusStateRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryConnectionConsensusStateRequest message. + * @function verify + * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryConnectionConsensusStateRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.connection_id != null && message.hasOwnProperty("connection_id")) + if (!$util.isString(message.connection_id)) + return "connection_id: string expected"; + if (message.revision_number != null && message.hasOwnProperty("revision_number")) + if (!$util.isInteger(message.revision_number) && !(message.revision_number && $util.isInteger(message.revision_number.low) && $util.isInteger(message.revision_number.high))) + return "revision_number: integer|Long expected"; + if (message.revision_height != null && message.hasOwnProperty("revision_height")) + if (!$util.isInteger(message.revision_height) && !(message.revision_height && $util.isInteger(message.revision_height.low) && $util.isInteger(message.revision_height.high))) + return "revision_height: integer|Long expected"; + return null; + }; + + /** + * Creates a QueryConnectionConsensusStateRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateRequest + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.connection.v1.QueryConnectionConsensusStateRequest} QueryConnectionConsensusStateRequest + */ + QueryConnectionConsensusStateRequest.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.connection.v1.QueryConnectionConsensusStateRequest) + return object; + let message = new $root.ibc.core.connection.v1.QueryConnectionConsensusStateRequest(); + if (object.connection_id != null) + message.connection_id = String(object.connection_id); + if (object.revision_number != null) + if ($util.Long) + (message.revision_number = $util.Long.fromValue(object.revision_number)).unsigned = true; + else if (typeof object.revision_number === "string") + message.revision_number = parseInt(object.revision_number, 10); + else if (typeof object.revision_number === "number") + message.revision_number = object.revision_number; + else if (typeof object.revision_number === "object") + message.revision_number = new $util.LongBits(object.revision_number.low >>> 0, object.revision_number.high >>> 0).toNumber(true); + if (object.revision_height != null) + if ($util.Long) + (message.revision_height = $util.Long.fromValue(object.revision_height)).unsigned = true; + else if (typeof object.revision_height === "string") + message.revision_height = parseInt(object.revision_height, 10); + else if (typeof object.revision_height === "number") + message.revision_height = object.revision_height; + else if (typeof object.revision_height === "object") + message.revision_height = new $util.LongBits(object.revision_height.low >>> 0, object.revision_height.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a QueryConnectionConsensusStateRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateRequest + * @static + * @param {ibc.core.connection.v1.QueryConnectionConsensusStateRequest} message QueryConnectionConsensusStateRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryConnectionConsensusStateRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.connection_id = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.revision_number = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.revision_number = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.revision_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.revision_height = options.longs === String ? "0" : 0; + } + if (message.connection_id != null && message.hasOwnProperty("connection_id")) + object.connection_id = message.connection_id; + if (message.revision_number != null && message.hasOwnProperty("revision_number")) + if (typeof message.revision_number === "number") + object.revision_number = options.longs === String ? String(message.revision_number) : message.revision_number; + else + object.revision_number = options.longs === String ? $util.Long.prototype.toString.call(message.revision_number) : options.longs === Number ? new $util.LongBits(message.revision_number.low >>> 0, message.revision_number.high >>> 0).toNumber(true) : message.revision_number; + if (message.revision_height != null && message.hasOwnProperty("revision_height")) + if (typeof message.revision_height === "number") + object.revision_height = options.longs === String ? String(message.revision_height) : message.revision_height; + else + object.revision_height = options.longs === String ? $util.Long.prototype.toString.call(message.revision_height) : options.longs === Number ? new $util.LongBits(message.revision_height.low >>> 0, message.revision_height.high >>> 0).toNumber(true) : message.revision_height; + return object; + }; + + /** + * Converts this QueryConnectionConsensusStateRequest to JSON. + * @function toJSON + * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateRequest + * @instance + * @returns {Object.} JSON object + */ + QueryConnectionConsensusStateRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryConnectionConsensusStateRequest; + })(); + + v1.QueryConnectionConsensusStateResponse = (function() { + + /** + * Properties of a QueryConnectionConsensusStateResponse. + * @memberof ibc.core.connection.v1 + * @interface IQueryConnectionConsensusStateResponse + * @property {google.protobuf.IAny|null} [consensus_state] QueryConnectionConsensusStateResponse consensus_state + * @property {string|null} [client_id] QueryConnectionConsensusStateResponse client_id + * @property {Uint8Array|null} [proof] QueryConnectionConsensusStateResponse proof + * @property {ibc.core.client.v1.IHeight|null} [proof_height] QueryConnectionConsensusStateResponse proof_height + */ + + /** + * Constructs a new QueryConnectionConsensusStateResponse. + * @memberof ibc.core.connection.v1 + * @classdesc Represents a QueryConnectionConsensusStateResponse. + * @implements IQueryConnectionConsensusStateResponse + * @constructor + * @param {ibc.core.connection.v1.IQueryConnectionConsensusStateResponse=} [properties] Properties to set + */ + function QueryConnectionConsensusStateResponse(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryConnectionConsensusStateResponse consensus_state. + * @member {google.protobuf.IAny|null|undefined} consensus_state + * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateResponse + * @instance + */ + QueryConnectionConsensusStateResponse.prototype.consensus_state = null; + + /** + * QueryConnectionConsensusStateResponse client_id. + * @member {string} client_id + * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateResponse + * @instance + */ + QueryConnectionConsensusStateResponse.prototype.client_id = ""; + + /** + * QueryConnectionConsensusStateResponse proof. + * @member {Uint8Array} proof + * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateResponse + * @instance + */ + QueryConnectionConsensusStateResponse.prototype.proof = $util.newBuffer([]); + + /** + * QueryConnectionConsensusStateResponse proof_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height + * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateResponse + * @instance + */ + QueryConnectionConsensusStateResponse.prototype.proof_height = null; + + /** + * Encodes the specified QueryConnectionConsensusStateResponse message. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionConsensusStateResponse.verify|verify} messages. + * @function encode + * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateResponse + * @static + * @param {ibc.core.connection.v1.IQueryConnectionConsensusStateResponse} message QueryConnectionConsensusStateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryConnectionConsensusStateResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.consensus_state != null && Object.hasOwnProperty.call(message, "consensus_state")) + $root.google.protobuf.Any.encode(message.consensus_state, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.client_id); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.proof); + if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) + $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryConnectionConsensusStateResponse message, length delimited. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionConsensusStateResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateResponse + * @static + * @param {ibc.core.connection.v1.IQueryConnectionConsensusStateResponse} message QueryConnectionConsensusStateResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryConnectionConsensusStateResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryConnectionConsensusStateResponse message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.connection.v1.QueryConnectionConsensusStateResponse} QueryConnectionConsensusStateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryConnectionConsensusStateResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.QueryConnectionConsensusStateResponse(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.consensus_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 2: + message.client_id = reader.string(); + break; + case 3: + message.proof = reader.bytes(); + break; + case 4: + message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryConnectionConsensusStateResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.connection.v1.QueryConnectionConsensusStateResponse} QueryConnectionConsensusStateResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryConnectionConsensusStateResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryConnectionConsensusStateResponse message. + * @function verify + * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryConnectionConsensusStateResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) { + let error = $root.google.protobuf.Any.verify(message.consensus_state); + if (error) + return "consensus_state." + error; + } + if (message.client_id != null && message.hasOwnProperty("client_id")) + if (!$util.isString(message.client_id)) + return "client_id: string expected"; + if (message.proof != null && message.hasOwnProperty("proof")) + if (!(message.proof && typeof message.proof.length === "number" || $util.isString(message.proof))) + return "proof: buffer expected"; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); + if (error) + return "proof_height." + error; + } + return null; + }; + + /** + * Creates a QueryConnectionConsensusStateResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateResponse + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.connection.v1.QueryConnectionConsensusStateResponse} QueryConnectionConsensusStateResponse + */ + QueryConnectionConsensusStateResponse.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.connection.v1.QueryConnectionConsensusStateResponse) + return object; + let message = new $root.ibc.core.connection.v1.QueryConnectionConsensusStateResponse(); + if (object.consensus_state != null) { + if (typeof object.consensus_state !== "object") + throw TypeError(".ibc.core.connection.v1.QueryConnectionConsensusStateResponse.consensus_state: object expected"); + message.consensus_state = $root.google.protobuf.Any.fromObject(object.consensus_state); + } + if (object.client_id != null) + message.client_id = String(object.client_id); + if (object.proof != null) + if (typeof object.proof === "string") + $util.base64.decode(object.proof, message.proof = $util.newBuffer($util.base64.length(object.proof)), 0); + else if (object.proof.length) + message.proof = object.proof; + if (object.proof_height != null) { + if (typeof object.proof_height !== "object") + throw TypeError(".ibc.core.connection.v1.QueryConnectionConsensusStateResponse.proof_height: object expected"); + message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); + } + return message; + }; + + /** + * Creates a plain object from a QueryConnectionConsensusStateResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateResponse + * @static + * @param {ibc.core.connection.v1.QueryConnectionConsensusStateResponse} message QueryConnectionConsensusStateResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryConnectionConsensusStateResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.consensus_state = null; + object.client_id = ""; + if (options.bytes === String) + object.proof = ""; + else { + object.proof = []; + if (options.bytes !== Array) + object.proof = $util.newBuffer(object.proof); + } + object.proof_height = null; + } + if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) + object.consensus_state = $root.google.protobuf.Any.toObject(message.consensus_state, options); + if (message.client_id != null && message.hasOwnProperty("client_id")) + object.client_id = message.client_id; + if (message.proof != null && message.hasOwnProperty("proof")) + object.proof = options.bytes === String ? $util.base64.encode(message.proof, 0, message.proof.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof) : message.proof; + if (message.proof_height != null && message.hasOwnProperty("proof_height")) + object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); + return object; + }; + + /** + * Converts this QueryConnectionConsensusStateResponse to JSON. + * @function toJSON + * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateResponse + * @instance + * @returns {Object.} JSON object + */ + QueryConnectionConsensusStateResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryConnectionConsensusStateResponse; + })(); + + v1.ConnectionEnd = (function() { + + /** + * Properties of a ConnectionEnd. + * @memberof ibc.core.connection.v1 + * @interface IConnectionEnd + * @property {string|null} [client_id] ConnectionEnd client_id + * @property {Array.|null} [versions] ConnectionEnd versions + * @property {ibc.core.connection.v1.State|null} [state] ConnectionEnd state + * @property {ibc.core.connection.v1.ICounterparty|null} [counterparty] ConnectionEnd counterparty + * @property {Long|null} [delay_period] ConnectionEnd delay_period + */ + + /** + * Constructs a new ConnectionEnd. + * @memberof ibc.core.connection.v1 + * @classdesc Represents a ConnectionEnd. + * @implements IConnectionEnd + * @constructor + * @param {ibc.core.connection.v1.IConnectionEnd=} [properties] Properties to set + */ + function ConnectionEnd(properties) { + this.versions = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConnectionEnd client_id. + * @member {string} client_id + * @memberof ibc.core.connection.v1.ConnectionEnd + * @instance + */ + ConnectionEnd.prototype.client_id = ""; + + /** + * ConnectionEnd versions. + * @member {Array.} versions + * @memberof ibc.core.connection.v1.ConnectionEnd + * @instance + */ + ConnectionEnd.prototype.versions = $util.emptyArray; + + /** + * ConnectionEnd state. + * @member {ibc.core.connection.v1.State} state + * @memberof ibc.core.connection.v1.ConnectionEnd + * @instance + */ + ConnectionEnd.prototype.state = 0; + + /** + * ConnectionEnd counterparty. + * @member {ibc.core.connection.v1.ICounterparty|null|undefined} counterparty + * @memberof ibc.core.connection.v1.ConnectionEnd + * @instance + */ + ConnectionEnd.prototype.counterparty = null; + + /** + * ConnectionEnd delay_period. + * @member {Long} delay_period + * @memberof ibc.core.connection.v1.ConnectionEnd + * @instance + */ + ConnectionEnd.prototype.delay_period = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified ConnectionEnd message. Does not implicitly {@link ibc.core.connection.v1.ConnectionEnd.verify|verify} messages. + * @function encode + * @memberof ibc.core.connection.v1.ConnectionEnd + * @static + * @param {ibc.core.connection.v1.IConnectionEnd} message ConnectionEnd message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConnectionEnd.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); + if (message.versions != null && message.versions.length) + for (let i = 0; i < message.versions.length; ++i) + $root.ibc.core.connection.v1.Version.encode(message.versions[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.state); + if (message.counterparty != null && Object.hasOwnProperty.call(message, "counterparty")) + $root.ibc.core.connection.v1.Counterparty.encode(message.counterparty, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.delay_period != null && Object.hasOwnProperty.call(message, "delay_period")) + writer.uint32(/* id 5, wireType 0 =*/40).uint64(message.delay_period); + return writer; + }; + + /** + * Encodes the specified ConnectionEnd message, length delimited. Does not implicitly {@link ibc.core.connection.v1.ConnectionEnd.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.connection.v1.ConnectionEnd + * @static + * @param {ibc.core.connection.v1.IConnectionEnd} message ConnectionEnd message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConnectionEnd.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConnectionEnd message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.connection.v1.ConnectionEnd + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.connection.v1.ConnectionEnd} ConnectionEnd + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConnectionEnd.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.ConnectionEnd(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.client_id = reader.string(); + break; + case 2: + if (!(message.versions && message.versions.length)) + message.versions = []; + message.versions.push($root.ibc.core.connection.v1.Version.decode(reader, reader.uint32())); + break; + case 3: + message.state = reader.int32(); + break; + case 4: + message.counterparty = $root.ibc.core.connection.v1.Counterparty.decode(reader, reader.uint32()); + break; + case 5: + message.delay_period = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConnectionEnd message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.connection.v1.ConnectionEnd + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.connection.v1.ConnectionEnd} ConnectionEnd + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConnectionEnd.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConnectionEnd message. + * @function verify + * @memberof ibc.core.connection.v1.ConnectionEnd + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConnectionEnd.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.client_id != null && message.hasOwnProperty("client_id")) + if (!$util.isString(message.client_id)) + return "client_id: string expected"; + if (message.versions != null && message.hasOwnProperty("versions")) { + if (!Array.isArray(message.versions)) + return "versions: array expected"; + for (let i = 0; i < message.versions.length; ++i) { + let error = $root.ibc.core.connection.v1.Version.verify(message.versions[i]); + if (error) + return "versions." + error; + } + } + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.counterparty != null && message.hasOwnProperty("counterparty")) { + let error = $root.ibc.core.connection.v1.Counterparty.verify(message.counterparty); + if (error) + return "counterparty." + error; + } + if (message.delay_period != null && message.hasOwnProperty("delay_period")) + if (!$util.isInteger(message.delay_period) && !(message.delay_period && $util.isInteger(message.delay_period.low) && $util.isInteger(message.delay_period.high))) + return "delay_period: integer|Long expected"; + return null; + }; + + /** + * Creates a ConnectionEnd message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.connection.v1.ConnectionEnd + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.connection.v1.ConnectionEnd} ConnectionEnd + */ + ConnectionEnd.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.connection.v1.ConnectionEnd) + return object; + let message = new $root.ibc.core.connection.v1.ConnectionEnd(); + if (object.client_id != null) + message.client_id = String(object.client_id); + if (object.versions) { + if (!Array.isArray(object.versions)) + throw TypeError(".ibc.core.connection.v1.ConnectionEnd.versions: array expected"); + message.versions = []; + for (let i = 0; i < object.versions.length; ++i) { + if (typeof object.versions[i] !== "object") + throw TypeError(".ibc.core.connection.v1.ConnectionEnd.versions: object expected"); + message.versions[i] = $root.ibc.core.connection.v1.Version.fromObject(object.versions[i]); + } + } + switch (object.state) { + case "STATE_UNINITIALIZED_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "STATE_INIT": + case 1: + message.state = 1; + break; + case "STATE_TRYOPEN": + case 2: + message.state = 2; + break; + case "STATE_OPEN": + case 3: + message.state = 3; + break; + } + if (object.counterparty != null) { + if (typeof object.counterparty !== "object") + throw TypeError(".ibc.core.connection.v1.ConnectionEnd.counterparty: object expected"); + message.counterparty = $root.ibc.core.connection.v1.Counterparty.fromObject(object.counterparty); + } + if (object.delay_period != null) + if ($util.Long) + (message.delay_period = $util.Long.fromValue(object.delay_period)).unsigned = true; + else if (typeof object.delay_period === "string") + message.delay_period = parseInt(object.delay_period, 10); + else if (typeof object.delay_period === "number") + message.delay_period = object.delay_period; + else if (typeof object.delay_period === "object") + message.delay_period = new $util.LongBits(object.delay_period.low >>> 0, object.delay_period.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a ConnectionEnd message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.connection.v1.ConnectionEnd + * @static + * @param {ibc.core.connection.v1.ConnectionEnd} message ConnectionEnd + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConnectionEnd.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.versions = []; + if (options.defaults) { + object.client_id = ""; + object.state = options.enums === String ? "STATE_UNINITIALIZED_UNSPECIFIED" : 0; + object.counterparty = null; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.delay_period = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.delay_period = options.longs === String ? "0" : 0; + } + if (message.client_id != null && message.hasOwnProperty("client_id")) + object.client_id = message.client_id; + if (message.versions && message.versions.length) { + object.versions = []; + for (let j = 0; j < message.versions.length; ++j) + object.versions[j] = $root.ibc.core.connection.v1.Version.toObject(message.versions[j], options); + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.ibc.core.connection.v1.State[message.state] : message.state; + if (message.counterparty != null && message.hasOwnProperty("counterparty")) + object.counterparty = $root.ibc.core.connection.v1.Counterparty.toObject(message.counterparty, options); + if (message.delay_period != null && message.hasOwnProperty("delay_period")) + if (typeof message.delay_period === "number") + object.delay_period = options.longs === String ? String(message.delay_period) : message.delay_period; + else + object.delay_period = options.longs === String ? $util.Long.prototype.toString.call(message.delay_period) : options.longs === Number ? new $util.LongBits(message.delay_period.low >>> 0, message.delay_period.high >>> 0).toNumber(true) : message.delay_period; + return object; + }; + + /** + * Converts this ConnectionEnd to JSON. + * @function toJSON + * @memberof ibc.core.connection.v1.ConnectionEnd + * @instance + * @returns {Object.} JSON object + */ + ConnectionEnd.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ConnectionEnd; + })(); + + v1.IdentifiedConnection = (function() { + + /** + * Properties of an IdentifiedConnection. + * @memberof ibc.core.connection.v1 + * @interface IIdentifiedConnection + * @property {string|null} [id] IdentifiedConnection id + * @property {string|null} [client_id] IdentifiedConnection client_id + * @property {Array.|null} [versions] IdentifiedConnection versions + * @property {ibc.core.connection.v1.State|null} [state] IdentifiedConnection state + * @property {ibc.core.connection.v1.ICounterparty|null} [counterparty] IdentifiedConnection counterparty + * @property {Long|null} [delay_period] IdentifiedConnection delay_period + */ + + /** + * Constructs a new IdentifiedConnection. + * @memberof ibc.core.connection.v1 + * @classdesc Represents an IdentifiedConnection. + * @implements IIdentifiedConnection + * @constructor + * @param {ibc.core.connection.v1.IIdentifiedConnection=} [properties] Properties to set + */ + function IdentifiedConnection(properties) { + this.versions = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * IdentifiedConnection id. + * @member {string} id + * @memberof ibc.core.connection.v1.IdentifiedConnection + * @instance + */ + IdentifiedConnection.prototype.id = ""; + + /** + * IdentifiedConnection client_id. + * @member {string} client_id + * @memberof ibc.core.connection.v1.IdentifiedConnection + * @instance + */ + IdentifiedConnection.prototype.client_id = ""; + + /** + * IdentifiedConnection versions. + * @member {Array.} versions + * @memberof ibc.core.connection.v1.IdentifiedConnection + * @instance + */ + IdentifiedConnection.prototype.versions = $util.emptyArray; + + /** + * IdentifiedConnection state. + * @member {ibc.core.connection.v1.State} state + * @memberof ibc.core.connection.v1.IdentifiedConnection + * @instance + */ + IdentifiedConnection.prototype.state = 0; + + /** + * IdentifiedConnection counterparty. + * @member {ibc.core.connection.v1.ICounterparty|null|undefined} counterparty + * @memberof ibc.core.connection.v1.IdentifiedConnection + * @instance + */ + IdentifiedConnection.prototype.counterparty = null; + + /** + * IdentifiedConnection delay_period. + * @member {Long} delay_period + * @memberof ibc.core.connection.v1.IdentifiedConnection + * @instance + */ + IdentifiedConnection.prototype.delay_period = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified IdentifiedConnection message. Does not implicitly {@link ibc.core.connection.v1.IdentifiedConnection.verify|verify} messages. + * @function encode + * @memberof ibc.core.connection.v1.IdentifiedConnection + * @static + * @param {ibc.core.connection.v1.IIdentifiedConnection} message IdentifiedConnection message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IdentifiedConnection.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.client_id); + if (message.versions != null && message.versions.length) + for (let i = 0; i < message.versions.length; ++i) + $root.ibc.core.connection.v1.Version.encode(message.versions[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.state); + if (message.counterparty != null && Object.hasOwnProperty.call(message, "counterparty")) + $root.ibc.core.connection.v1.Counterparty.encode(message.counterparty, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.delay_period != null && Object.hasOwnProperty.call(message, "delay_period")) + writer.uint32(/* id 6, wireType 0 =*/48).uint64(message.delay_period); + return writer; + }; + + /** + * Encodes the specified IdentifiedConnection message, length delimited. Does not implicitly {@link ibc.core.connection.v1.IdentifiedConnection.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.connection.v1.IdentifiedConnection + * @static + * @param {ibc.core.connection.v1.IIdentifiedConnection} message IdentifiedConnection message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IdentifiedConnection.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an IdentifiedConnection message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.connection.v1.IdentifiedConnection + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.connection.v1.IdentifiedConnection} IdentifiedConnection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IdentifiedConnection.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.IdentifiedConnection(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.client_id = reader.string(); + break; + case 3: + if (!(message.versions && message.versions.length)) + message.versions = []; + message.versions.push($root.ibc.core.connection.v1.Version.decode(reader, reader.uint32())); + break; + case 4: + message.state = reader.int32(); + break; + case 5: + message.counterparty = $root.ibc.core.connection.v1.Counterparty.decode(reader, reader.uint32()); + break; + case 6: + message.delay_period = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an IdentifiedConnection message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.connection.v1.IdentifiedConnection + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.connection.v1.IdentifiedConnection} IdentifiedConnection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IdentifiedConnection.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IdentifiedConnection message. + * @function verify + * @memberof ibc.core.connection.v1.IdentifiedConnection + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IdentifiedConnection.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.client_id != null && message.hasOwnProperty("client_id")) + if (!$util.isString(message.client_id)) + return "client_id: string expected"; + if (message.versions != null && message.hasOwnProperty("versions")) { + if (!Array.isArray(message.versions)) + return "versions: array expected"; + for (let i = 0; i < message.versions.length; ++i) { + let error = $root.ibc.core.connection.v1.Version.verify(message.versions[i]); + if (error) + return "versions." + error; + } + } + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.counterparty != null && message.hasOwnProperty("counterparty")) { + let error = $root.ibc.core.connection.v1.Counterparty.verify(message.counterparty); + if (error) + return "counterparty." + error; + } + if (message.delay_period != null && message.hasOwnProperty("delay_period")) + if (!$util.isInteger(message.delay_period) && !(message.delay_period && $util.isInteger(message.delay_period.low) && $util.isInteger(message.delay_period.high))) + return "delay_period: integer|Long expected"; + return null; + }; + + /** + * Creates an IdentifiedConnection message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.connection.v1.IdentifiedConnection + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.connection.v1.IdentifiedConnection} IdentifiedConnection + */ + IdentifiedConnection.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.connection.v1.IdentifiedConnection) + return object; + let message = new $root.ibc.core.connection.v1.IdentifiedConnection(); + if (object.id != null) + message.id = String(object.id); + if (object.client_id != null) + message.client_id = String(object.client_id); + if (object.versions) { + if (!Array.isArray(object.versions)) + throw TypeError(".ibc.core.connection.v1.IdentifiedConnection.versions: array expected"); + message.versions = []; + for (let i = 0; i < object.versions.length; ++i) { + if (typeof object.versions[i] !== "object") + throw TypeError(".ibc.core.connection.v1.IdentifiedConnection.versions: object expected"); + message.versions[i] = $root.ibc.core.connection.v1.Version.fromObject(object.versions[i]); + } + } + switch (object.state) { + case "STATE_UNINITIALIZED_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "STATE_INIT": + case 1: + message.state = 1; + break; + case "STATE_TRYOPEN": + case 2: + message.state = 2; + break; + case "STATE_OPEN": + case 3: + message.state = 3; + break; + } + if (object.counterparty != null) { + if (typeof object.counterparty !== "object") + throw TypeError(".ibc.core.connection.v1.IdentifiedConnection.counterparty: object expected"); + message.counterparty = $root.ibc.core.connection.v1.Counterparty.fromObject(object.counterparty); + } + if (object.delay_period != null) + if ($util.Long) + (message.delay_period = $util.Long.fromValue(object.delay_period)).unsigned = true; + else if (typeof object.delay_period === "string") + message.delay_period = parseInt(object.delay_period, 10); + else if (typeof object.delay_period === "number") + message.delay_period = object.delay_period; + else if (typeof object.delay_period === "object") + message.delay_period = new $util.LongBits(object.delay_period.low >>> 0, object.delay_period.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from an IdentifiedConnection message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.connection.v1.IdentifiedConnection + * @static + * @param {ibc.core.connection.v1.IdentifiedConnection} message IdentifiedConnection + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IdentifiedConnection.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.versions = []; + if (options.defaults) { + object.id = ""; + object.client_id = ""; + object.state = options.enums === String ? "STATE_UNINITIALIZED_UNSPECIFIED" : 0; + object.counterparty = null; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.delay_period = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.delay_period = options.longs === String ? "0" : 0; + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.client_id != null && message.hasOwnProperty("client_id")) + object.client_id = message.client_id; + if (message.versions && message.versions.length) { + object.versions = []; + for (let j = 0; j < message.versions.length; ++j) + object.versions[j] = $root.ibc.core.connection.v1.Version.toObject(message.versions[j], options); + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.ibc.core.connection.v1.State[message.state] : message.state; + if (message.counterparty != null && message.hasOwnProperty("counterparty")) + object.counterparty = $root.ibc.core.connection.v1.Counterparty.toObject(message.counterparty, options); + if (message.delay_period != null && message.hasOwnProperty("delay_period")) + if (typeof message.delay_period === "number") + object.delay_period = options.longs === String ? String(message.delay_period) : message.delay_period; + else + object.delay_period = options.longs === String ? $util.Long.prototype.toString.call(message.delay_period) : options.longs === Number ? new $util.LongBits(message.delay_period.low >>> 0, message.delay_period.high >>> 0).toNumber(true) : message.delay_period; + return object; + }; + + /** + * Converts this IdentifiedConnection to JSON. + * @function toJSON + * @memberof ibc.core.connection.v1.IdentifiedConnection + * @instance + * @returns {Object.} JSON object + */ + IdentifiedConnection.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return IdentifiedConnection; + })(); + + /** + * State enum. + * @name ibc.core.connection.v1.State + * @enum {number} + * @property {number} STATE_UNINITIALIZED_UNSPECIFIED=0 STATE_UNINITIALIZED_UNSPECIFIED value + * @property {number} STATE_INIT=1 STATE_INIT value + * @property {number} STATE_TRYOPEN=2 STATE_TRYOPEN value + * @property {number} STATE_OPEN=3 STATE_OPEN value + */ + v1.State = (function() { + const valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNINITIALIZED_UNSPECIFIED"] = 0; + values[valuesById[1] = "STATE_INIT"] = 1; + values[valuesById[2] = "STATE_TRYOPEN"] = 2; + values[valuesById[3] = "STATE_OPEN"] = 3; + return values; + })(); + + v1.Counterparty = (function() { + + /** + * Properties of a Counterparty. + * @memberof ibc.core.connection.v1 + * @interface ICounterparty + * @property {string|null} [client_id] Counterparty client_id + * @property {string|null} [connection_id] Counterparty connection_id + * @property {ibc.core.commitment.v1.IMerklePrefix|null} [prefix] Counterparty prefix + */ + + /** + * Constructs a new Counterparty. + * @memberof ibc.core.connection.v1 + * @classdesc Represents a Counterparty. + * @implements ICounterparty + * @constructor + * @param {ibc.core.connection.v1.ICounterparty=} [properties] Properties to set + */ + function Counterparty(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Counterparty client_id. + * @member {string} client_id + * @memberof ibc.core.connection.v1.Counterparty + * @instance + */ + Counterparty.prototype.client_id = ""; + + /** + * Counterparty connection_id. + * @member {string} connection_id + * @memberof ibc.core.connection.v1.Counterparty + * @instance + */ + Counterparty.prototype.connection_id = ""; + + /** + * Counterparty prefix. + * @member {ibc.core.commitment.v1.IMerklePrefix|null|undefined} prefix + * @memberof ibc.core.connection.v1.Counterparty + * @instance + */ + Counterparty.prototype.prefix = null; + + /** + * Encodes the specified Counterparty message. Does not implicitly {@link ibc.core.connection.v1.Counterparty.verify|verify} messages. + * @function encode + * @memberof ibc.core.connection.v1.Counterparty + * @static + * @param {ibc.core.connection.v1.ICounterparty} message Counterparty message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Counterparty.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); + if (message.connection_id != null && Object.hasOwnProperty.call(message, "connection_id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.connection_id); + if (message.prefix != null && Object.hasOwnProperty.call(message, "prefix")) + $root.ibc.core.commitment.v1.MerklePrefix.encode(message.prefix, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Counterparty message, length delimited. Does not implicitly {@link ibc.core.connection.v1.Counterparty.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.connection.v1.Counterparty + * @static + * @param {ibc.core.connection.v1.ICounterparty} message Counterparty message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Counterparty.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Counterparty message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.connection.v1.Counterparty + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.connection.v1.Counterparty} Counterparty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Counterparty.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.Counterparty(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.client_id = reader.string(); + break; + case 2: + message.connection_id = reader.string(); + break; + case 3: + message.prefix = $root.ibc.core.commitment.v1.MerklePrefix.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Counterparty message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.connection.v1.Counterparty + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.connection.v1.Counterparty} Counterparty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Counterparty.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Counterparty message. + * @function verify + * @memberof ibc.core.connection.v1.Counterparty + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Counterparty.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.client_id != null && message.hasOwnProperty("client_id")) + if (!$util.isString(message.client_id)) + return "client_id: string expected"; + if (message.connection_id != null && message.hasOwnProperty("connection_id")) + if (!$util.isString(message.connection_id)) + return "connection_id: string expected"; + if (message.prefix != null && message.hasOwnProperty("prefix")) { + let error = $root.ibc.core.commitment.v1.MerklePrefix.verify(message.prefix); + if (error) + return "prefix." + error; + } + return null; + }; + + /** + * Creates a Counterparty message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.connection.v1.Counterparty + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.connection.v1.Counterparty} Counterparty + */ + Counterparty.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.connection.v1.Counterparty) + return object; + let message = new $root.ibc.core.connection.v1.Counterparty(); + if (object.client_id != null) + message.client_id = String(object.client_id); + if (object.connection_id != null) + message.connection_id = String(object.connection_id); + if (object.prefix != null) { + if (typeof object.prefix !== "object") + throw TypeError(".ibc.core.connection.v1.Counterparty.prefix: object expected"); + message.prefix = $root.ibc.core.commitment.v1.MerklePrefix.fromObject(object.prefix); + } + return message; + }; + + /** + * Creates a plain object from a Counterparty message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.connection.v1.Counterparty + * @static + * @param {ibc.core.connection.v1.Counterparty} message Counterparty + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Counterparty.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.client_id = ""; + object.connection_id = ""; + object.prefix = null; + } + if (message.client_id != null && message.hasOwnProperty("client_id")) + object.client_id = message.client_id; + if (message.connection_id != null && message.hasOwnProperty("connection_id")) + object.connection_id = message.connection_id; + if (message.prefix != null && message.hasOwnProperty("prefix")) + object.prefix = $root.ibc.core.commitment.v1.MerklePrefix.toObject(message.prefix, options); + return object; + }; + + /** + * Converts this Counterparty to JSON. + * @function toJSON + * @memberof ibc.core.connection.v1.Counterparty + * @instance + * @returns {Object.} JSON object + */ + Counterparty.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Counterparty; + })(); + + v1.ClientPaths = (function() { + + /** + * Properties of a ClientPaths. + * @memberof ibc.core.connection.v1 + * @interface IClientPaths + * @property {Array.|null} [paths] ClientPaths paths + */ + + /** + * Constructs a new ClientPaths. + * @memberof ibc.core.connection.v1 + * @classdesc Represents a ClientPaths. + * @implements IClientPaths + * @constructor + * @param {ibc.core.connection.v1.IClientPaths=} [properties] Properties to set + */ + function ClientPaths(properties) { + this.paths = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ClientPaths paths. + * @member {Array.} paths + * @memberof ibc.core.connection.v1.ClientPaths + * @instance + */ + ClientPaths.prototype.paths = $util.emptyArray; + + /** + * Encodes the specified ClientPaths message. Does not implicitly {@link ibc.core.connection.v1.ClientPaths.verify|verify} messages. + * @function encode + * @memberof ibc.core.connection.v1.ClientPaths + * @static + * @param {ibc.core.connection.v1.IClientPaths} message ClientPaths message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClientPaths.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.paths != null && message.paths.length) + for (let i = 0; i < message.paths.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.paths[i]); + return writer; + }; + + /** + * Encodes the specified ClientPaths message, length delimited. Does not implicitly {@link ibc.core.connection.v1.ClientPaths.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.connection.v1.ClientPaths + * @static + * @param {ibc.core.connection.v1.IClientPaths} message ClientPaths message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClientPaths.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ClientPaths message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.connection.v1.ClientPaths + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.connection.v1.ClientPaths} ClientPaths + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClientPaths.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.ClientPaths(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.paths && message.paths.length)) + message.paths = []; + message.paths.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ClientPaths message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.connection.v1.ClientPaths + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.connection.v1.ClientPaths} ClientPaths + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClientPaths.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ClientPaths message. + * @function verify + * @memberof ibc.core.connection.v1.ClientPaths + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ClientPaths.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.paths != null && message.hasOwnProperty("paths")) { + if (!Array.isArray(message.paths)) + return "paths: array expected"; + for (let i = 0; i < message.paths.length; ++i) + if (!$util.isString(message.paths[i])) + return "paths: string[] expected"; + } + return null; + }; + + /** + * Creates a ClientPaths message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.connection.v1.ClientPaths + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.connection.v1.ClientPaths} ClientPaths + */ + ClientPaths.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.connection.v1.ClientPaths) + return object; + let message = new $root.ibc.core.connection.v1.ClientPaths(); + if (object.paths) { + if (!Array.isArray(object.paths)) + throw TypeError(".ibc.core.connection.v1.ClientPaths.paths: array expected"); + message.paths = []; + for (let i = 0; i < object.paths.length; ++i) + message.paths[i] = String(object.paths[i]); + } + return message; + }; + + /** + * Creates a plain object from a ClientPaths message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.connection.v1.ClientPaths + * @static + * @param {ibc.core.connection.v1.ClientPaths} message ClientPaths + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ClientPaths.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.paths = []; + if (message.paths && message.paths.length) { + object.paths = []; + for (let j = 0; j < message.paths.length; ++j) + object.paths[j] = message.paths[j]; + } + return object; + }; + + /** + * Converts this ClientPaths to JSON. + * @function toJSON + * @memberof ibc.core.connection.v1.ClientPaths + * @instance + * @returns {Object.} JSON object + */ + ClientPaths.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ClientPaths; + })(); + + v1.ConnectionPaths = (function() { + + /** + * Properties of a ConnectionPaths. + * @memberof ibc.core.connection.v1 + * @interface IConnectionPaths + * @property {string|null} [client_id] ConnectionPaths client_id + * @property {Array.|null} [paths] ConnectionPaths paths + */ + + /** + * Constructs a new ConnectionPaths. + * @memberof ibc.core.connection.v1 + * @classdesc Represents a ConnectionPaths. + * @implements IConnectionPaths + * @constructor + * @param {ibc.core.connection.v1.IConnectionPaths=} [properties] Properties to set + */ + function ConnectionPaths(properties) { + this.paths = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConnectionPaths client_id. + * @member {string} client_id + * @memberof ibc.core.connection.v1.ConnectionPaths + * @instance + */ + ConnectionPaths.prototype.client_id = ""; + + /** + * ConnectionPaths paths. + * @member {Array.} paths + * @memberof ibc.core.connection.v1.ConnectionPaths + * @instance + */ + ConnectionPaths.prototype.paths = $util.emptyArray; + + /** + * Encodes the specified ConnectionPaths message. Does not implicitly {@link ibc.core.connection.v1.ConnectionPaths.verify|verify} messages. + * @function encode + * @memberof ibc.core.connection.v1.ConnectionPaths + * @static + * @param {ibc.core.connection.v1.IConnectionPaths} message ConnectionPaths message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConnectionPaths.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); + if (message.paths != null && message.paths.length) + for (let i = 0; i < message.paths.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.paths[i]); + return writer; + }; + + /** + * Encodes the specified ConnectionPaths message, length delimited. Does not implicitly {@link ibc.core.connection.v1.ConnectionPaths.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.connection.v1.ConnectionPaths + * @static + * @param {ibc.core.connection.v1.IConnectionPaths} message ConnectionPaths message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConnectionPaths.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConnectionPaths message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.connection.v1.ConnectionPaths + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.connection.v1.ConnectionPaths} ConnectionPaths + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConnectionPaths.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.ConnectionPaths(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.client_id = reader.string(); + break; + case 2: + if (!(message.paths && message.paths.length)) + message.paths = []; + message.paths.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConnectionPaths message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.connection.v1.ConnectionPaths + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.connection.v1.ConnectionPaths} ConnectionPaths + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConnectionPaths.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConnectionPaths message. + * @function verify + * @memberof ibc.core.connection.v1.ConnectionPaths + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConnectionPaths.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.client_id != null && message.hasOwnProperty("client_id")) + if (!$util.isString(message.client_id)) + return "client_id: string expected"; + if (message.paths != null && message.hasOwnProperty("paths")) { + if (!Array.isArray(message.paths)) + return "paths: array expected"; + for (let i = 0; i < message.paths.length; ++i) + if (!$util.isString(message.paths[i])) + return "paths: string[] expected"; + } + return null; + }; + + /** + * Creates a ConnectionPaths message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.connection.v1.ConnectionPaths + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.connection.v1.ConnectionPaths} ConnectionPaths + */ + ConnectionPaths.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.connection.v1.ConnectionPaths) + return object; + let message = new $root.ibc.core.connection.v1.ConnectionPaths(); + if (object.client_id != null) + message.client_id = String(object.client_id); + if (object.paths) { + if (!Array.isArray(object.paths)) + throw TypeError(".ibc.core.connection.v1.ConnectionPaths.paths: array expected"); + message.paths = []; + for (let i = 0; i < object.paths.length; ++i) + message.paths[i] = String(object.paths[i]); + } + return message; + }; + + /** + * Creates a plain object from a ConnectionPaths message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.connection.v1.ConnectionPaths + * @static + * @param {ibc.core.connection.v1.ConnectionPaths} message ConnectionPaths + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConnectionPaths.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.paths = []; + if (options.defaults) + object.client_id = ""; + if (message.client_id != null && message.hasOwnProperty("client_id")) + object.client_id = message.client_id; + if (message.paths && message.paths.length) { + object.paths = []; + for (let j = 0; j < message.paths.length; ++j) + object.paths[j] = message.paths[j]; + } + return object; + }; + + /** + * Converts this ConnectionPaths to JSON. + * @function toJSON + * @memberof ibc.core.connection.v1.ConnectionPaths + * @instance + * @returns {Object.} JSON object + */ + ConnectionPaths.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ConnectionPaths; + })(); + + v1.Version = (function() { + + /** + * Properties of a Version. + * @memberof ibc.core.connection.v1 + * @interface IVersion + * @property {string|null} [identifier] Version identifier + * @property {Array.|null} [features] Version features + */ + + /** + * Constructs a new Version. + * @memberof ibc.core.connection.v1 + * @classdesc Represents a Version. + * @implements IVersion + * @constructor + * @param {ibc.core.connection.v1.IVersion=} [properties] Properties to set + */ + function Version(properties) { + this.features = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Version identifier. + * @member {string} identifier + * @memberof ibc.core.connection.v1.Version + * @instance + */ + Version.prototype.identifier = ""; + + /** + * Version features. + * @member {Array.} features + * @memberof ibc.core.connection.v1.Version + * @instance + */ + Version.prototype.features = $util.emptyArray; + + /** + * Encodes the specified Version message. Does not implicitly {@link ibc.core.connection.v1.Version.verify|verify} messages. + * @function encode + * @memberof ibc.core.connection.v1.Version + * @static + * @param {ibc.core.connection.v1.IVersion} message Version message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Version.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.identifier != null && Object.hasOwnProperty.call(message, "identifier")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.identifier); + if (message.features != null && message.features.length) + for (let i = 0; i < message.features.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.features[i]); + return writer; + }; + + /** + * Encodes the specified Version message, length delimited. Does not implicitly {@link ibc.core.connection.v1.Version.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.connection.v1.Version + * @static + * @param {ibc.core.connection.v1.IVersion} message Version message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Version.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Version message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.connection.v1.Version + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.connection.v1.Version} Version + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Version.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.Version(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.identifier = reader.string(); + break; + case 2: + if (!(message.features && message.features.length)) + message.features = []; + message.features.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Version message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.connection.v1.Version + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.connection.v1.Version} Version + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Version.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Version message. + * @function verify + * @memberof ibc.core.connection.v1.Version + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Version.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.identifier != null && message.hasOwnProperty("identifier")) + if (!$util.isString(message.identifier)) + return "identifier: string expected"; + if (message.features != null && message.hasOwnProperty("features")) { + if (!Array.isArray(message.features)) + return "features: array expected"; + for (let i = 0; i < message.features.length; ++i) + if (!$util.isString(message.features[i])) + return "features: string[] expected"; + } + return null; + }; + + /** + * Creates a Version message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.connection.v1.Version + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.connection.v1.Version} Version + */ + Version.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.connection.v1.Version) + return object; + let message = new $root.ibc.core.connection.v1.Version(); + if (object.identifier != null) + message.identifier = String(object.identifier); + if (object.features) { + if (!Array.isArray(object.features)) + throw TypeError(".ibc.core.connection.v1.Version.features: array expected"); + message.features = []; + for (let i = 0; i < object.features.length; ++i) + message.features[i] = String(object.features[i]); + } + return message; + }; + + /** + * Creates a plain object from a Version message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.connection.v1.Version + * @static + * @param {ibc.core.connection.v1.Version} message Version + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Version.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.features = []; + if (options.defaults) + object.identifier = ""; + if (message.identifier != null && message.hasOwnProperty("identifier")) + object.identifier = message.identifier; + if (message.features && message.features.length) { + object.features = []; + for (let j = 0; j < message.features.length; ++j) + object.features[j] = message.features[j]; + } + return object; + }; + + /** + * Converts this Version to JSON. + * @function toJSON + * @memberof ibc.core.connection.v1.Version + * @instance + * @returns {Object.} JSON object + */ + Version.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Version; + })(); + + v1.GenesisState = (function() { + + /** + * Properties of a GenesisState. + * @memberof ibc.core.connection.v1 + * @interface IGenesisState + * @property {Array.|null} [connections] GenesisState connections + * @property {Array.|null} [client_connection_paths] GenesisState client_connection_paths + * @property {Long|null} [next_connection_sequence] GenesisState next_connection_sequence + */ + + /** + * Constructs a new GenesisState. + * @memberof ibc.core.connection.v1 + * @classdesc Represents a GenesisState. + * @implements IGenesisState + * @constructor + * @param {ibc.core.connection.v1.IGenesisState=} [properties] Properties to set + */ + function GenesisState(properties) { + this.connections = []; + this.client_connection_paths = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenesisState connections. + * @member {Array.} connections + * @memberof ibc.core.connection.v1.GenesisState + * @instance + */ + GenesisState.prototype.connections = $util.emptyArray; + + /** + * GenesisState client_connection_paths. + * @member {Array.} client_connection_paths + * @memberof ibc.core.connection.v1.GenesisState + * @instance + */ + GenesisState.prototype.client_connection_paths = $util.emptyArray; + + /** + * GenesisState next_connection_sequence. + * @member {Long} next_connection_sequence + * @memberof ibc.core.connection.v1.GenesisState + * @instance + */ + GenesisState.prototype.next_connection_sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified GenesisState message. Does not implicitly {@link ibc.core.connection.v1.GenesisState.verify|verify} messages. + * @function encode + * @memberof ibc.core.connection.v1.GenesisState + * @static + * @param {ibc.core.connection.v1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.connections != null && message.connections.length) + for (let i = 0; i < message.connections.length; ++i) + $root.ibc.core.connection.v1.IdentifiedConnection.encode(message.connections[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.client_connection_paths != null && message.client_connection_paths.length) + for (let i = 0; i < message.client_connection_paths.length; ++i) + $root.ibc.core.connection.v1.ConnectionPaths.encode(message.client_connection_paths[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.next_connection_sequence != null && Object.hasOwnProperty.call(message, "next_connection_sequence")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.next_connection_sequence); + return writer; + }; + + /** + * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link ibc.core.connection.v1.GenesisState.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.connection.v1.GenesisState + * @static + * @param {ibc.core.connection.v1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.connection.v1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.connection.v1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.GenesisState(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.connections && message.connections.length)) + message.connections = []; + message.connections.push($root.ibc.core.connection.v1.IdentifiedConnection.decode(reader, reader.uint32())); + break; + case 2: + if (!(message.client_connection_paths && message.client_connection_paths.length)) + message.client_connection_paths = []; + message.client_connection_paths.push($root.ibc.core.connection.v1.ConnectionPaths.decode(reader, reader.uint32())); + break; + case 3: + message.next_connection_sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.connection.v1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.connection.v1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenesisState message. + * @function verify + * @memberof ibc.core.connection.v1.GenesisState + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenesisState.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.connections != null && message.hasOwnProperty("connections")) { + if (!Array.isArray(message.connections)) + return "connections: array expected"; + for (let i = 0; i < message.connections.length; ++i) { + let error = $root.ibc.core.connection.v1.IdentifiedConnection.verify(message.connections[i]); + if (error) + return "connections." + error; + } + } + if (message.client_connection_paths != null && message.hasOwnProperty("client_connection_paths")) { + if (!Array.isArray(message.client_connection_paths)) + return "client_connection_paths: array expected"; + for (let i = 0; i < message.client_connection_paths.length; ++i) { + let error = $root.ibc.core.connection.v1.ConnectionPaths.verify(message.client_connection_paths[i]); + if (error) + return "client_connection_paths." + error; + } + } + if (message.next_connection_sequence != null && message.hasOwnProperty("next_connection_sequence")) + if (!$util.isInteger(message.next_connection_sequence) && !(message.next_connection_sequence && $util.isInteger(message.next_connection_sequence.low) && $util.isInteger(message.next_connection_sequence.high))) + return "next_connection_sequence: integer|Long expected"; + return null; + }; + + /** + * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.connection.v1.GenesisState + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.connection.v1.GenesisState} GenesisState + */ + GenesisState.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.connection.v1.GenesisState) + return object; + let message = new $root.ibc.core.connection.v1.GenesisState(); + if (object.connections) { + if (!Array.isArray(object.connections)) + throw TypeError(".ibc.core.connection.v1.GenesisState.connections: array expected"); + message.connections = []; + for (let i = 0; i < object.connections.length; ++i) { + if (typeof object.connections[i] !== "object") + throw TypeError(".ibc.core.connection.v1.GenesisState.connections: object expected"); + message.connections[i] = $root.ibc.core.connection.v1.IdentifiedConnection.fromObject(object.connections[i]); + } + } + if (object.client_connection_paths) { + if (!Array.isArray(object.client_connection_paths)) + throw TypeError(".ibc.core.connection.v1.GenesisState.client_connection_paths: array expected"); + message.client_connection_paths = []; + for (let i = 0; i < object.client_connection_paths.length; ++i) { + if (typeof object.client_connection_paths[i] !== "object") + throw TypeError(".ibc.core.connection.v1.GenesisState.client_connection_paths: object expected"); + message.client_connection_paths[i] = $root.ibc.core.connection.v1.ConnectionPaths.fromObject(object.client_connection_paths[i]); + } + } + if (object.next_connection_sequence != null) + if ($util.Long) + (message.next_connection_sequence = $util.Long.fromValue(object.next_connection_sequence)).unsigned = true; + else if (typeof object.next_connection_sequence === "string") + message.next_connection_sequence = parseInt(object.next_connection_sequence, 10); + else if (typeof object.next_connection_sequence === "number") + message.next_connection_sequence = object.next_connection_sequence; + else if (typeof object.next_connection_sequence === "object") + message.next_connection_sequence = new $util.LongBits(object.next_connection_sequence.low >>> 0, object.next_connection_sequence.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a GenesisState message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.connection.v1.GenesisState + * @static + * @param {ibc.core.connection.v1.GenesisState} message GenesisState + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenesisState.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) { + object.connections = []; + object.client_connection_paths = []; + } + if (options.defaults) + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.next_connection_sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.next_connection_sequence = options.longs === String ? "0" : 0; + if (message.connections && message.connections.length) { + object.connections = []; + for (let j = 0; j < message.connections.length; ++j) + object.connections[j] = $root.ibc.core.connection.v1.IdentifiedConnection.toObject(message.connections[j], options); + } + if (message.client_connection_paths && message.client_connection_paths.length) { + object.client_connection_paths = []; + for (let j = 0; j < message.client_connection_paths.length; ++j) + object.client_connection_paths[j] = $root.ibc.core.connection.v1.ConnectionPaths.toObject(message.client_connection_paths[j], options); + } + if (message.next_connection_sequence != null && message.hasOwnProperty("next_connection_sequence")) + if (typeof message.next_connection_sequence === "number") + object.next_connection_sequence = options.longs === String ? String(message.next_connection_sequence) : message.next_connection_sequence; + else + object.next_connection_sequence = options.longs === String ? $util.Long.prototype.toString.call(message.next_connection_sequence) : options.longs === Number ? new $util.LongBits(message.next_connection_sequence.low >>> 0, message.next_connection_sequence.high >>> 0).toNumber(true) : message.next_connection_sequence; + return object; + }; + + /** + * Converts this GenesisState to JSON. + * @function toJSON + * @memberof ibc.core.connection.v1.GenesisState + * @instance + * @returns {Object.} JSON object + */ + GenesisState.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenesisState; + })(); + + return v1; + })(); + + return connection; + })(); + + core.types = (function() { + + /** + * Namespace types. + * @memberof ibc.core + * @namespace + */ + const types = {}; + + types.v1 = (function() { + + /** + * Namespace v1. + * @memberof ibc.core.types + * @namespace + */ + const v1 = {}; + + v1.GenesisState = (function() { + + /** + * Properties of a GenesisState. + * @memberof ibc.core.types.v1 + * @interface IGenesisState + * @property {ibc.core.client.v1.IGenesisState|null} [client_genesis] GenesisState client_genesis + * @property {ibc.core.connection.v1.IGenesisState|null} [connection_genesis] GenesisState connection_genesis + * @property {ibc.core.channel.v1.IGenesisState|null} [channel_genesis] GenesisState channel_genesis + */ + + /** + * Constructs a new GenesisState. + * @memberof ibc.core.types.v1 + * @classdesc Represents a GenesisState. + * @implements IGenesisState + * @constructor + * @param {ibc.core.types.v1.IGenesisState=} [properties] Properties to set + */ + function GenesisState(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenesisState client_genesis. + * @member {ibc.core.client.v1.IGenesisState|null|undefined} client_genesis + * @memberof ibc.core.types.v1.GenesisState + * @instance + */ + GenesisState.prototype.client_genesis = null; + + /** + * GenesisState connection_genesis. + * @member {ibc.core.connection.v1.IGenesisState|null|undefined} connection_genesis + * @memberof ibc.core.types.v1.GenesisState + * @instance + */ + GenesisState.prototype.connection_genesis = null; + + /** + * GenesisState channel_genesis. + * @member {ibc.core.channel.v1.IGenesisState|null|undefined} channel_genesis + * @memberof ibc.core.types.v1.GenesisState + * @instance + */ + GenesisState.prototype.channel_genesis = null; + + /** + * Encodes the specified GenesisState message. Does not implicitly {@link ibc.core.types.v1.GenesisState.verify|verify} messages. + * @function encode + * @memberof ibc.core.types.v1.GenesisState + * @static + * @param {ibc.core.types.v1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.client_genesis != null && Object.hasOwnProperty.call(message, "client_genesis")) + $root.ibc.core.client.v1.GenesisState.encode(message.client_genesis, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.connection_genesis != null && Object.hasOwnProperty.call(message, "connection_genesis")) + $root.ibc.core.connection.v1.GenesisState.encode(message.connection_genesis, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.channel_genesis != null && Object.hasOwnProperty.call(message, "channel_genesis")) + $root.ibc.core.channel.v1.GenesisState.encode(message.channel_genesis, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link ibc.core.types.v1.GenesisState.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.core.types.v1.GenesisState + * @static + * @param {ibc.core.types.v1.IGenesisState} message GenesisState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenesisState.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer. + * @function decode + * @memberof ibc.core.types.v1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.core.types.v1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.types.v1.GenesisState(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.client_genesis = $root.ibc.core.client.v1.GenesisState.decode(reader, reader.uint32()); + break; + case 2: + message.connection_genesis = $root.ibc.core.connection.v1.GenesisState.decode(reader, reader.uint32()); + break; + case 3: + message.channel_genesis = $root.ibc.core.channel.v1.GenesisState.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenesisState message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.core.types.v1.GenesisState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.core.types.v1.GenesisState} GenesisState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenesisState.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenesisState message. + * @function verify + * @memberof ibc.core.types.v1.GenesisState + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenesisState.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.client_genesis != null && message.hasOwnProperty("client_genesis")) { + let error = $root.ibc.core.client.v1.GenesisState.verify(message.client_genesis); + if (error) + return "client_genesis." + error; + } + if (message.connection_genesis != null && message.hasOwnProperty("connection_genesis")) { + let error = $root.ibc.core.connection.v1.GenesisState.verify(message.connection_genesis); + if (error) + return "connection_genesis." + error; + } + if (message.channel_genesis != null && message.hasOwnProperty("channel_genesis")) { + let error = $root.ibc.core.channel.v1.GenesisState.verify(message.channel_genesis); + if (error) + return "channel_genesis." + error; + } + return null; + }; + + /** + * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.core.types.v1.GenesisState + * @static + * @param {Object.} object Plain object + * @returns {ibc.core.types.v1.GenesisState} GenesisState + */ + GenesisState.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.core.types.v1.GenesisState) + return object; + let message = new $root.ibc.core.types.v1.GenesisState(); + if (object.client_genesis != null) { + if (typeof object.client_genesis !== "object") + throw TypeError(".ibc.core.types.v1.GenesisState.client_genesis: object expected"); + message.client_genesis = $root.ibc.core.client.v1.GenesisState.fromObject(object.client_genesis); + } + if (object.connection_genesis != null) { + if (typeof object.connection_genesis !== "object") + throw TypeError(".ibc.core.types.v1.GenesisState.connection_genesis: object expected"); + message.connection_genesis = $root.ibc.core.connection.v1.GenesisState.fromObject(object.connection_genesis); + } + if (object.channel_genesis != null) { + if (typeof object.channel_genesis !== "object") + throw TypeError(".ibc.core.types.v1.GenesisState.channel_genesis: object expected"); + message.channel_genesis = $root.ibc.core.channel.v1.GenesisState.fromObject(object.channel_genesis); + } + return message; + }; + + /** + * Creates a plain object from a GenesisState message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.core.types.v1.GenesisState + * @static + * @param {ibc.core.types.v1.GenesisState} message GenesisState + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenesisState.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.client_genesis = null; + object.connection_genesis = null; + object.channel_genesis = null; + } + if (message.client_genesis != null && message.hasOwnProperty("client_genesis")) + object.client_genesis = $root.ibc.core.client.v1.GenesisState.toObject(message.client_genesis, options); + if (message.connection_genesis != null && message.hasOwnProperty("connection_genesis")) + object.connection_genesis = $root.ibc.core.connection.v1.GenesisState.toObject(message.connection_genesis, options); + if (message.channel_genesis != null && message.hasOwnProperty("channel_genesis")) + object.channel_genesis = $root.ibc.core.channel.v1.GenesisState.toObject(message.channel_genesis, options); + return object; + }; + + /** + * Converts this GenesisState to JSON. + * @function toJSON + * @memberof ibc.core.types.v1.GenesisState + * @instance + * @returns {Object.} JSON object + */ + GenesisState.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenesisState; + })(); + + return v1; + })(); + + return types; + })(); + + return core; + })(); + + ibc.lightclients = (function() { + + /** + * Namespace lightclients. + * @memberof ibc + * @namespace + */ + const lightclients = {}; + + lightclients.localhost = (function() { + + /** + * Namespace localhost. + * @memberof ibc.lightclients + * @namespace + */ + const localhost = {}; + + localhost.v1 = (function() { + + /** + * Namespace v1. + * @memberof ibc.lightclients.localhost + * @namespace + */ + const v1 = {}; + + v1.ClientState = (function() { + + /** + * Properties of a ClientState. + * @memberof ibc.lightclients.localhost.v1 + * @interface IClientState + * @property {string|null} [chain_id] ClientState chain_id + * @property {ibc.core.client.v1.IHeight|null} [height] ClientState height + */ + + /** + * Constructs a new ClientState. + * @memberof ibc.lightclients.localhost.v1 + * @classdesc Represents a ClientState. + * @implements IClientState + * @constructor + * @param {ibc.lightclients.localhost.v1.IClientState=} [properties] Properties to set + */ + function ClientState(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ClientState chain_id. + * @member {string} chain_id + * @memberof ibc.lightclients.localhost.v1.ClientState + * @instance + */ + ClientState.prototype.chain_id = ""; + + /** + * ClientState height. + * @member {ibc.core.client.v1.IHeight|null|undefined} height + * @memberof ibc.lightclients.localhost.v1.ClientState + * @instance + */ + ClientState.prototype.height = null; + + /** + * Encodes the specified ClientState message. Does not implicitly {@link ibc.lightclients.localhost.v1.ClientState.verify|verify} messages. + * @function encode + * @memberof ibc.lightclients.localhost.v1.ClientState + * @static + * @param {ibc.lightclients.localhost.v1.IClientState} message ClientState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClientState.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.chain_id != null && Object.hasOwnProperty.call(message, "chain_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.chain_id); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + $root.ibc.core.client.v1.Height.encode(message.height, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ClientState message, length delimited. Does not implicitly {@link ibc.lightclients.localhost.v1.ClientState.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.lightclients.localhost.v1.ClientState + * @static + * @param {ibc.lightclients.localhost.v1.IClientState} message ClientState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClientState.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ClientState message from the specified reader or buffer. + * @function decode + * @memberof ibc.lightclients.localhost.v1.ClientState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.lightclients.localhost.v1.ClientState} ClientState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClientState.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.localhost.v1.ClientState(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.chain_id = reader.string(); + break; + case 2: + message.height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ClientState message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.lightclients.localhost.v1.ClientState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.lightclients.localhost.v1.ClientState} ClientState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClientState.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ClientState message. + * @function verify + * @memberof ibc.lightclients.localhost.v1.ClientState + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ClientState.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.chain_id != null && message.hasOwnProperty("chain_id")) + if (!$util.isString(message.chain_id)) + return "chain_id: string expected"; + if (message.height != null && message.hasOwnProperty("height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.height); + if (error) + return "height." + error; + } + return null; + }; + + /** + * Creates a ClientState message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.lightclients.localhost.v1.ClientState + * @static + * @param {Object.} object Plain object + * @returns {ibc.lightclients.localhost.v1.ClientState} ClientState + */ + ClientState.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.lightclients.localhost.v1.ClientState) + return object; + let message = new $root.ibc.lightclients.localhost.v1.ClientState(); + if (object.chain_id != null) + message.chain_id = String(object.chain_id); + if (object.height != null) { + if (typeof object.height !== "object") + throw TypeError(".ibc.lightclients.localhost.v1.ClientState.height: object expected"); + message.height = $root.ibc.core.client.v1.Height.fromObject(object.height); + } + return message; + }; + + /** + * Creates a plain object from a ClientState message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.lightclients.localhost.v1.ClientState + * @static + * @param {ibc.lightclients.localhost.v1.ClientState} message ClientState + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ClientState.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.chain_id = ""; + object.height = null; + } + if (message.chain_id != null && message.hasOwnProperty("chain_id")) + object.chain_id = message.chain_id; + if (message.height != null && message.hasOwnProperty("height")) + object.height = $root.ibc.core.client.v1.Height.toObject(message.height, options); + return object; + }; + + /** + * Converts this ClientState to JSON. + * @function toJSON + * @memberof ibc.lightclients.localhost.v1.ClientState + * @instance + * @returns {Object.} JSON object + */ + ClientState.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ClientState; + })(); + + return v1; + })(); + + return localhost; + })(); + + lightclients.solomachine = (function() { + + /** + * Namespace solomachine. + * @memberof ibc.lightclients + * @namespace + */ + const solomachine = {}; + + solomachine.v1 = (function() { + + /** + * Namespace v1. + * @memberof ibc.lightclients.solomachine + * @namespace + */ + const v1 = {}; + + v1.ClientState = (function() { + + /** + * Properties of a ClientState. + * @memberof ibc.lightclients.solomachine.v1 + * @interface IClientState + * @property {Long|null} [sequence] ClientState sequence + * @property {Long|null} [frozen_sequence] ClientState frozen_sequence + * @property {ibc.lightclients.solomachine.v1.IConsensusState|null} [consensus_state] ClientState consensus_state + * @property {boolean|null} [allow_update_after_proposal] ClientState allow_update_after_proposal + */ + + /** + * Constructs a new ClientState. + * @memberof ibc.lightclients.solomachine.v1 + * @classdesc Represents a ClientState. + * @implements IClientState + * @constructor + * @param {ibc.lightclients.solomachine.v1.IClientState=} [properties] Properties to set + */ + function ClientState(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ClientState sequence. + * @member {Long} sequence + * @memberof ibc.lightclients.solomachine.v1.ClientState + * @instance + */ + ClientState.prototype.sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * ClientState frozen_sequence. + * @member {Long} frozen_sequence + * @memberof ibc.lightclients.solomachine.v1.ClientState + * @instance + */ + ClientState.prototype.frozen_sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * ClientState consensus_state. + * @member {ibc.lightclients.solomachine.v1.IConsensusState|null|undefined} consensus_state + * @memberof ibc.lightclients.solomachine.v1.ClientState + * @instance + */ + ClientState.prototype.consensus_state = null; + + /** + * ClientState allow_update_after_proposal. + * @member {boolean} allow_update_after_proposal + * @memberof ibc.lightclients.solomachine.v1.ClientState + * @instance + */ + ClientState.prototype.allow_update_after_proposal = false; + + /** + * Encodes the specified ClientState message. Does not implicitly {@link ibc.lightclients.solomachine.v1.ClientState.verify|verify} messages. + * @function encode + * @memberof ibc.lightclients.solomachine.v1.ClientState + * @static + * @param {ibc.lightclients.solomachine.v1.IClientState} message ClientState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClientState.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sequence != null && Object.hasOwnProperty.call(message, "sequence")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.sequence); + if (message.frozen_sequence != null && Object.hasOwnProperty.call(message, "frozen_sequence")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.frozen_sequence); + if (message.consensus_state != null && Object.hasOwnProperty.call(message, "consensus_state")) + $root.ibc.lightclients.solomachine.v1.ConsensusState.encode(message.consensus_state, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.allow_update_after_proposal != null && Object.hasOwnProperty.call(message, "allow_update_after_proposal")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.allow_update_after_proposal); + return writer; + }; + + /** + * Encodes the specified ClientState message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.ClientState.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.lightclients.solomachine.v1.ClientState + * @static + * @param {ibc.lightclients.solomachine.v1.IClientState} message ClientState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClientState.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ClientState message from the specified reader or buffer. + * @function decode + * @memberof ibc.lightclients.solomachine.v1.ClientState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.lightclients.solomachine.v1.ClientState} ClientState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClientState.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.ClientState(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sequence = reader.uint64(); + break; + case 2: + message.frozen_sequence = reader.uint64(); + break; + case 3: + message.consensus_state = $root.ibc.lightclients.solomachine.v1.ConsensusState.decode(reader, reader.uint32()); + break; + case 4: + message.allow_update_after_proposal = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ClientState message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.lightclients.solomachine.v1.ClientState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.lightclients.solomachine.v1.ClientState} ClientState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClientState.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ClientState message. + * @function verify + * @memberof ibc.lightclients.solomachine.v1.ClientState + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ClientState.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sequence != null && message.hasOwnProperty("sequence")) + if (!$util.isInteger(message.sequence) && !(message.sequence && $util.isInteger(message.sequence.low) && $util.isInteger(message.sequence.high))) + return "sequence: integer|Long expected"; + if (message.frozen_sequence != null && message.hasOwnProperty("frozen_sequence")) + if (!$util.isInteger(message.frozen_sequence) && !(message.frozen_sequence && $util.isInteger(message.frozen_sequence.low) && $util.isInteger(message.frozen_sequence.high))) + return "frozen_sequence: integer|Long expected"; + if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) { + let error = $root.ibc.lightclients.solomachine.v1.ConsensusState.verify(message.consensus_state); + if (error) + return "consensus_state." + error; + } + if (message.allow_update_after_proposal != null && message.hasOwnProperty("allow_update_after_proposal")) + if (typeof message.allow_update_after_proposal !== "boolean") + return "allow_update_after_proposal: boolean expected"; + return null; + }; + + /** + * Creates a ClientState message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.lightclients.solomachine.v1.ClientState + * @static + * @param {Object.} object Plain object + * @returns {ibc.lightclients.solomachine.v1.ClientState} ClientState + */ + ClientState.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.lightclients.solomachine.v1.ClientState) + return object; + let message = new $root.ibc.lightclients.solomachine.v1.ClientState(); + if (object.sequence != null) + if ($util.Long) + (message.sequence = $util.Long.fromValue(object.sequence)).unsigned = true; + else if (typeof object.sequence === "string") + message.sequence = parseInt(object.sequence, 10); + else if (typeof object.sequence === "number") + message.sequence = object.sequence; + else if (typeof object.sequence === "object") + message.sequence = new $util.LongBits(object.sequence.low >>> 0, object.sequence.high >>> 0).toNumber(true); + if (object.frozen_sequence != null) + if ($util.Long) + (message.frozen_sequence = $util.Long.fromValue(object.frozen_sequence)).unsigned = true; + else if (typeof object.frozen_sequence === "string") + message.frozen_sequence = parseInt(object.frozen_sequence, 10); + else if (typeof object.frozen_sequence === "number") + message.frozen_sequence = object.frozen_sequence; + else if (typeof object.frozen_sequence === "object") + message.frozen_sequence = new $util.LongBits(object.frozen_sequence.low >>> 0, object.frozen_sequence.high >>> 0).toNumber(true); + if (object.consensus_state != null) { + if (typeof object.consensus_state !== "object") + throw TypeError(".ibc.lightclients.solomachine.v1.ClientState.consensus_state: object expected"); + message.consensus_state = $root.ibc.lightclients.solomachine.v1.ConsensusState.fromObject(object.consensus_state); + } + if (object.allow_update_after_proposal != null) + message.allow_update_after_proposal = Boolean(object.allow_update_after_proposal); + return message; + }; + + /** + * Creates a plain object from a ClientState message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.lightclients.solomachine.v1.ClientState + * @static + * @param {ibc.lightclients.solomachine.v1.ClientState} message ClientState + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ClientState.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.sequence = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.frozen_sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.frozen_sequence = options.longs === String ? "0" : 0; + object.consensus_state = null; + object.allow_update_after_proposal = false; + } + if (message.sequence != null && message.hasOwnProperty("sequence")) + if (typeof message.sequence === "number") + object.sequence = options.longs === String ? String(message.sequence) : message.sequence; + else + object.sequence = options.longs === String ? $util.Long.prototype.toString.call(message.sequence) : options.longs === Number ? new $util.LongBits(message.sequence.low >>> 0, message.sequence.high >>> 0).toNumber(true) : message.sequence; + if (message.frozen_sequence != null && message.hasOwnProperty("frozen_sequence")) + if (typeof message.frozen_sequence === "number") + object.frozen_sequence = options.longs === String ? String(message.frozen_sequence) : message.frozen_sequence; + else + object.frozen_sequence = options.longs === String ? $util.Long.prototype.toString.call(message.frozen_sequence) : options.longs === Number ? new $util.LongBits(message.frozen_sequence.low >>> 0, message.frozen_sequence.high >>> 0).toNumber(true) : message.frozen_sequence; + if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) + object.consensus_state = $root.ibc.lightclients.solomachine.v1.ConsensusState.toObject(message.consensus_state, options); + if (message.allow_update_after_proposal != null && message.hasOwnProperty("allow_update_after_proposal")) + object.allow_update_after_proposal = message.allow_update_after_proposal; + return object; + }; + + /** + * Converts this ClientState to JSON. + * @function toJSON + * @memberof ibc.lightclients.solomachine.v1.ClientState + * @instance + * @returns {Object.} JSON object + */ + ClientState.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ClientState; + })(); + + v1.ConsensusState = (function() { + + /** + * Properties of a ConsensusState. + * @memberof ibc.lightclients.solomachine.v1 + * @interface IConsensusState + * @property {google.protobuf.IAny|null} [public_key] ConsensusState public_key + * @property {string|null} [diversifier] ConsensusState diversifier + * @property {Long|null} [timestamp] ConsensusState timestamp + */ + + /** + * Constructs a new ConsensusState. + * @memberof ibc.lightclients.solomachine.v1 + * @classdesc Represents a ConsensusState. + * @implements IConsensusState + * @constructor + * @param {ibc.lightclients.solomachine.v1.IConsensusState=} [properties] Properties to set + */ + function ConsensusState(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConsensusState public_key. + * @member {google.protobuf.IAny|null|undefined} public_key + * @memberof ibc.lightclients.solomachine.v1.ConsensusState + * @instance + */ + ConsensusState.prototype.public_key = null; + + /** + * ConsensusState diversifier. + * @member {string} diversifier + * @memberof ibc.lightclients.solomachine.v1.ConsensusState + * @instance + */ + ConsensusState.prototype.diversifier = ""; + + /** + * ConsensusState timestamp. + * @member {Long} timestamp + * @memberof ibc.lightclients.solomachine.v1.ConsensusState + * @instance + */ + ConsensusState.prototype.timestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified ConsensusState message. Does not implicitly {@link ibc.lightclients.solomachine.v1.ConsensusState.verify|verify} messages. + * @function encode + * @memberof ibc.lightclients.solomachine.v1.ConsensusState + * @static + * @param {ibc.lightclients.solomachine.v1.IConsensusState} message ConsensusState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConsensusState.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.public_key != null && Object.hasOwnProperty.call(message, "public_key")) + $root.google.protobuf.Any.encode(message.public_key, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.diversifier != null && Object.hasOwnProperty.call(message, "diversifier")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.diversifier); + if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.timestamp); + return writer; + }; + + /** + * Encodes the specified ConsensusState message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.ConsensusState.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.lightclients.solomachine.v1.ConsensusState + * @static + * @param {ibc.lightclients.solomachine.v1.IConsensusState} message ConsensusState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConsensusState.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConsensusState message from the specified reader or buffer. + * @function decode + * @memberof ibc.lightclients.solomachine.v1.ConsensusState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.lightclients.solomachine.v1.ConsensusState} ConsensusState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConsensusState.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.ConsensusState(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.public_key = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 2: + message.diversifier = reader.string(); + break; + case 3: + message.timestamp = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConsensusState message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.lightclients.solomachine.v1.ConsensusState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.lightclients.solomachine.v1.ConsensusState} ConsensusState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConsensusState.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConsensusState message. + * @function verify + * @memberof ibc.lightclients.solomachine.v1.ConsensusState + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConsensusState.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.public_key != null && message.hasOwnProperty("public_key")) { + let error = $root.google.protobuf.Any.verify(message.public_key); + if (error) + return "public_key." + error; + } + if (message.diversifier != null && message.hasOwnProperty("diversifier")) + if (!$util.isString(message.diversifier)) + return "diversifier: string expected"; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (!$util.isInteger(message.timestamp) && !(message.timestamp && $util.isInteger(message.timestamp.low) && $util.isInteger(message.timestamp.high))) + return "timestamp: integer|Long expected"; + return null; + }; + + /** + * Creates a ConsensusState message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.lightclients.solomachine.v1.ConsensusState + * @static + * @param {Object.} object Plain object + * @returns {ibc.lightclients.solomachine.v1.ConsensusState} ConsensusState + */ + ConsensusState.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.lightclients.solomachine.v1.ConsensusState) + return object; + let message = new $root.ibc.lightclients.solomachine.v1.ConsensusState(); + if (object.public_key != null) { + if (typeof object.public_key !== "object") + throw TypeError(".ibc.lightclients.solomachine.v1.ConsensusState.public_key: object expected"); + message.public_key = $root.google.protobuf.Any.fromObject(object.public_key); + } + if (object.diversifier != null) + message.diversifier = String(object.diversifier); + if (object.timestamp != null) + if ($util.Long) + (message.timestamp = $util.Long.fromValue(object.timestamp)).unsigned = true; + else if (typeof object.timestamp === "string") + message.timestamp = parseInt(object.timestamp, 10); + else if (typeof object.timestamp === "number") + message.timestamp = object.timestamp; + else if (typeof object.timestamp === "object") + message.timestamp = new $util.LongBits(object.timestamp.low >>> 0, object.timestamp.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a ConsensusState message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.lightclients.solomachine.v1.ConsensusState + * @static + * @param {ibc.lightclients.solomachine.v1.ConsensusState} message ConsensusState + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConsensusState.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.public_key = null; + object.diversifier = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.timestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.timestamp = options.longs === String ? "0" : 0; + } + if (message.public_key != null && message.hasOwnProperty("public_key")) + object.public_key = $root.google.protobuf.Any.toObject(message.public_key, options); + if (message.diversifier != null && message.hasOwnProperty("diversifier")) + object.diversifier = message.diversifier; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (typeof message.timestamp === "number") + object.timestamp = options.longs === String ? String(message.timestamp) : message.timestamp; + else + object.timestamp = options.longs === String ? $util.Long.prototype.toString.call(message.timestamp) : options.longs === Number ? new $util.LongBits(message.timestamp.low >>> 0, message.timestamp.high >>> 0).toNumber(true) : message.timestamp; + return object; + }; + + /** + * Converts this ConsensusState to JSON. + * @function toJSON + * @memberof ibc.lightclients.solomachine.v1.ConsensusState + * @instance + * @returns {Object.} JSON object + */ + ConsensusState.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ConsensusState; + })(); + + v1.Header = (function() { + + /** + * Properties of a Header. + * @memberof ibc.lightclients.solomachine.v1 + * @interface IHeader + * @property {Long|null} [sequence] Header sequence + * @property {Long|null} [timestamp] Header timestamp + * @property {Uint8Array|null} [signature] Header signature + * @property {google.protobuf.IAny|null} [new_public_key] Header new_public_key + * @property {string|null} [new_diversifier] Header new_diversifier + */ + + /** + * Constructs a new Header. + * @memberof ibc.lightclients.solomachine.v1 + * @classdesc Represents a Header. + * @implements IHeader + * @constructor + * @param {ibc.lightclients.solomachine.v1.IHeader=} [properties] Properties to set + */ + function Header(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Header sequence. + * @member {Long} sequence + * @memberof ibc.lightclients.solomachine.v1.Header + * @instance + */ + Header.prototype.sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Header timestamp. + * @member {Long} timestamp + * @memberof ibc.lightclients.solomachine.v1.Header + * @instance + */ + Header.prototype.timestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Header signature. + * @member {Uint8Array} signature + * @memberof ibc.lightclients.solomachine.v1.Header + * @instance + */ + Header.prototype.signature = $util.newBuffer([]); + + /** + * Header new_public_key. + * @member {google.protobuf.IAny|null|undefined} new_public_key + * @memberof ibc.lightclients.solomachine.v1.Header + * @instance + */ + Header.prototype.new_public_key = null; + + /** + * Header new_diversifier. + * @member {string} new_diversifier + * @memberof ibc.lightclients.solomachine.v1.Header + * @instance + */ + Header.prototype.new_diversifier = ""; + + /** + * Encodes the specified Header message. Does not implicitly {@link ibc.lightclients.solomachine.v1.Header.verify|verify} messages. + * @function encode + * @memberof ibc.lightclients.solomachine.v1.Header + * @static + * @param {ibc.lightclients.solomachine.v1.IHeader} message Header message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Header.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sequence != null && Object.hasOwnProperty.call(message, "sequence")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.sequence); + if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.timestamp); + if (message.signature != null && Object.hasOwnProperty.call(message, "signature")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.signature); + if (message.new_public_key != null && Object.hasOwnProperty.call(message, "new_public_key")) + $root.google.protobuf.Any.encode(message.new_public_key, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.new_diversifier != null && Object.hasOwnProperty.call(message, "new_diversifier")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.new_diversifier); + return writer; + }; + + /** + * Encodes the specified Header message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.Header.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.lightclients.solomachine.v1.Header + * @static + * @param {ibc.lightclients.solomachine.v1.IHeader} message Header message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Header.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Header message from the specified reader or buffer. + * @function decode + * @memberof ibc.lightclients.solomachine.v1.Header + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.lightclients.solomachine.v1.Header} Header + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Header.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.Header(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sequence = reader.uint64(); + break; + case 2: + message.timestamp = reader.uint64(); + break; + case 3: + message.signature = reader.bytes(); + break; + case 4: + message.new_public_key = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 5: + message.new_diversifier = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Header message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.lightclients.solomachine.v1.Header + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.lightclients.solomachine.v1.Header} Header + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Header.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Header message. + * @function verify + * @memberof ibc.lightclients.solomachine.v1.Header + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Header.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sequence != null && message.hasOwnProperty("sequence")) + if (!$util.isInteger(message.sequence) && !(message.sequence && $util.isInteger(message.sequence.low) && $util.isInteger(message.sequence.high))) + return "sequence: integer|Long expected"; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (!$util.isInteger(message.timestamp) && !(message.timestamp && $util.isInteger(message.timestamp.low) && $util.isInteger(message.timestamp.high))) + return "timestamp: integer|Long expected"; + if (message.signature != null && message.hasOwnProperty("signature")) + if (!(message.signature && typeof message.signature.length === "number" || $util.isString(message.signature))) + return "signature: buffer expected"; + if (message.new_public_key != null && message.hasOwnProperty("new_public_key")) { + let error = $root.google.protobuf.Any.verify(message.new_public_key); + if (error) + return "new_public_key." + error; + } + if (message.new_diversifier != null && message.hasOwnProperty("new_diversifier")) + if (!$util.isString(message.new_diversifier)) + return "new_diversifier: string expected"; + return null; + }; + + /** + * Creates a Header message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.lightclients.solomachine.v1.Header + * @static + * @param {Object.} object Plain object + * @returns {ibc.lightclients.solomachine.v1.Header} Header + */ + Header.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.lightclients.solomachine.v1.Header) + return object; + let message = new $root.ibc.lightclients.solomachine.v1.Header(); + if (object.sequence != null) + if ($util.Long) + (message.sequence = $util.Long.fromValue(object.sequence)).unsigned = true; + else if (typeof object.sequence === "string") + message.sequence = parseInt(object.sequence, 10); + else if (typeof object.sequence === "number") + message.sequence = object.sequence; + else if (typeof object.sequence === "object") + message.sequence = new $util.LongBits(object.sequence.low >>> 0, object.sequence.high >>> 0).toNumber(true); + if (object.timestamp != null) + if ($util.Long) + (message.timestamp = $util.Long.fromValue(object.timestamp)).unsigned = true; + else if (typeof object.timestamp === "string") + message.timestamp = parseInt(object.timestamp, 10); + else if (typeof object.timestamp === "number") + message.timestamp = object.timestamp; + else if (typeof object.timestamp === "object") + message.timestamp = new $util.LongBits(object.timestamp.low >>> 0, object.timestamp.high >>> 0).toNumber(true); + if (object.signature != null) + if (typeof object.signature === "string") + $util.base64.decode(object.signature, message.signature = $util.newBuffer($util.base64.length(object.signature)), 0); + else if (object.signature.length) + message.signature = object.signature; + if (object.new_public_key != null) { + if (typeof object.new_public_key !== "object") + throw TypeError(".ibc.lightclients.solomachine.v1.Header.new_public_key: object expected"); + message.new_public_key = $root.google.protobuf.Any.fromObject(object.new_public_key); + } + if (object.new_diversifier != null) + message.new_diversifier = String(object.new_diversifier); + return message; + }; + + /** + * Creates a plain object from a Header message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.lightclients.solomachine.v1.Header + * @static + * @param {ibc.lightclients.solomachine.v1.Header} message Header + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Header.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.sequence = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.timestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.timestamp = options.longs === String ? "0" : 0; + if (options.bytes === String) + object.signature = ""; + else { + object.signature = []; + if (options.bytes !== Array) + object.signature = $util.newBuffer(object.signature); + } + object.new_public_key = null; + object.new_diversifier = ""; + } + if (message.sequence != null && message.hasOwnProperty("sequence")) + if (typeof message.sequence === "number") + object.sequence = options.longs === String ? String(message.sequence) : message.sequence; + else + object.sequence = options.longs === String ? $util.Long.prototype.toString.call(message.sequence) : options.longs === Number ? new $util.LongBits(message.sequence.low >>> 0, message.sequence.high >>> 0).toNumber(true) : message.sequence; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (typeof message.timestamp === "number") + object.timestamp = options.longs === String ? String(message.timestamp) : message.timestamp; + else + object.timestamp = options.longs === String ? $util.Long.prototype.toString.call(message.timestamp) : options.longs === Number ? new $util.LongBits(message.timestamp.low >>> 0, message.timestamp.high >>> 0).toNumber(true) : message.timestamp; + if (message.signature != null && message.hasOwnProperty("signature")) + object.signature = options.bytes === String ? $util.base64.encode(message.signature, 0, message.signature.length) : options.bytes === Array ? Array.prototype.slice.call(message.signature) : message.signature; + if (message.new_public_key != null && message.hasOwnProperty("new_public_key")) + object.new_public_key = $root.google.protobuf.Any.toObject(message.new_public_key, options); + if (message.new_diversifier != null && message.hasOwnProperty("new_diversifier")) + object.new_diversifier = message.new_diversifier; + return object; + }; + + /** + * Converts this Header to JSON. + * @function toJSON + * @memberof ibc.lightclients.solomachine.v1.Header + * @instance + * @returns {Object.} JSON object + */ + Header.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Header; + })(); + + v1.Misbehaviour = (function() { + + /** + * Properties of a Misbehaviour. + * @memberof ibc.lightclients.solomachine.v1 + * @interface IMisbehaviour + * @property {string|null} [client_id] Misbehaviour client_id + * @property {Long|null} [sequence] Misbehaviour sequence + * @property {ibc.lightclients.solomachine.v1.ISignatureAndData|null} [signature_one] Misbehaviour signature_one + * @property {ibc.lightclients.solomachine.v1.ISignatureAndData|null} [signature_two] Misbehaviour signature_two + */ + + /** + * Constructs a new Misbehaviour. + * @memberof ibc.lightclients.solomachine.v1 + * @classdesc Represents a Misbehaviour. + * @implements IMisbehaviour + * @constructor + * @param {ibc.lightclients.solomachine.v1.IMisbehaviour=} [properties] Properties to set + */ + function Misbehaviour(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Misbehaviour client_id. + * @member {string} client_id + * @memberof ibc.lightclients.solomachine.v1.Misbehaviour + * @instance + */ + Misbehaviour.prototype.client_id = ""; + + /** + * Misbehaviour sequence. + * @member {Long} sequence + * @memberof ibc.lightclients.solomachine.v1.Misbehaviour + * @instance + */ + Misbehaviour.prototype.sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Misbehaviour signature_one. + * @member {ibc.lightclients.solomachine.v1.ISignatureAndData|null|undefined} signature_one + * @memberof ibc.lightclients.solomachine.v1.Misbehaviour + * @instance + */ + Misbehaviour.prototype.signature_one = null; + + /** + * Misbehaviour signature_two. + * @member {ibc.lightclients.solomachine.v1.ISignatureAndData|null|undefined} signature_two + * @memberof ibc.lightclients.solomachine.v1.Misbehaviour + * @instance + */ + Misbehaviour.prototype.signature_two = null; + + /** + * Encodes the specified Misbehaviour message. Does not implicitly {@link ibc.lightclients.solomachine.v1.Misbehaviour.verify|verify} messages. + * @function encode + * @memberof ibc.lightclients.solomachine.v1.Misbehaviour + * @static + * @param {ibc.lightclients.solomachine.v1.IMisbehaviour} message Misbehaviour message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Misbehaviour.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); + if (message.sequence != null && Object.hasOwnProperty.call(message, "sequence")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.sequence); + if (message.signature_one != null && Object.hasOwnProperty.call(message, "signature_one")) + $root.ibc.lightclients.solomachine.v1.SignatureAndData.encode(message.signature_one, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.signature_two != null && Object.hasOwnProperty.call(message, "signature_two")) + $root.ibc.lightclients.solomachine.v1.SignatureAndData.encode(message.signature_two, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Misbehaviour message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.Misbehaviour.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.lightclients.solomachine.v1.Misbehaviour + * @static + * @param {ibc.lightclients.solomachine.v1.IMisbehaviour} message Misbehaviour message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Misbehaviour.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Misbehaviour message from the specified reader or buffer. + * @function decode + * @memberof ibc.lightclients.solomachine.v1.Misbehaviour + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.lightclients.solomachine.v1.Misbehaviour} Misbehaviour + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Misbehaviour.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.Misbehaviour(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.client_id = reader.string(); + break; + case 2: + message.sequence = reader.uint64(); + break; + case 3: + message.signature_one = $root.ibc.lightclients.solomachine.v1.SignatureAndData.decode(reader, reader.uint32()); + break; + case 4: + message.signature_two = $root.ibc.lightclients.solomachine.v1.SignatureAndData.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Misbehaviour message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.lightclients.solomachine.v1.Misbehaviour + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.lightclients.solomachine.v1.Misbehaviour} Misbehaviour + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Misbehaviour.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Misbehaviour message. + * @function verify + * @memberof ibc.lightclients.solomachine.v1.Misbehaviour + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Misbehaviour.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.client_id != null && message.hasOwnProperty("client_id")) + if (!$util.isString(message.client_id)) + return "client_id: string expected"; + if (message.sequence != null && message.hasOwnProperty("sequence")) + if (!$util.isInteger(message.sequence) && !(message.sequence && $util.isInteger(message.sequence.low) && $util.isInteger(message.sequence.high))) + return "sequence: integer|Long expected"; + if (message.signature_one != null && message.hasOwnProperty("signature_one")) { + let error = $root.ibc.lightclients.solomachine.v1.SignatureAndData.verify(message.signature_one); + if (error) + return "signature_one." + error; + } + if (message.signature_two != null && message.hasOwnProperty("signature_two")) { + let error = $root.ibc.lightclients.solomachine.v1.SignatureAndData.verify(message.signature_two); + if (error) + return "signature_two." + error; + } + return null; + }; + + /** + * Creates a Misbehaviour message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.lightclients.solomachine.v1.Misbehaviour + * @static + * @param {Object.} object Plain object + * @returns {ibc.lightclients.solomachine.v1.Misbehaviour} Misbehaviour + */ + Misbehaviour.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.lightclients.solomachine.v1.Misbehaviour) + return object; + let message = new $root.ibc.lightclients.solomachine.v1.Misbehaviour(); + if (object.client_id != null) + message.client_id = String(object.client_id); + if (object.sequence != null) + if ($util.Long) + (message.sequence = $util.Long.fromValue(object.sequence)).unsigned = true; + else if (typeof object.sequence === "string") + message.sequence = parseInt(object.sequence, 10); + else if (typeof object.sequence === "number") + message.sequence = object.sequence; + else if (typeof object.sequence === "object") + message.sequence = new $util.LongBits(object.sequence.low >>> 0, object.sequence.high >>> 0).toNumber(true); + if (object.signature_one != null) { + if (typeof object.signature_one !== "object") + throw TypeError(".ibc.lightclients.solomachine.v1.Misbehaviour.signature_one: object expected"); + message.signature_one = $root.ibc.lightclients.solomachine.v1.SignatureAndData.fromObject(object.signature_one); + } + if (object.signature_two != null) { + if (typeof object.signature_two !== "object") + throw TypeError(".ibc.lightclients.solomachine.v1.Misbehaviour.signature_two: object expected"); + message.signature_two = $root.ibc.lightclients.solomachine.v1.SignatureAndData.fromObject(object.signature_two); + } + return message; + }; + + /** + * Creates a plain object from a Misbehaviour message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.lightclients.solomachine.v1.Misbehaviour + * @static + * @param {ibc.lightclients.solomachine.v1.Misbehaviour} message Misbehaviour + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Misbehaviour.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.client_id = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.sequence = options.longs === String ? "0" : 0; + object.signature_one = null; + object.signature_two = null; + } + if (message.client_id != null && message.hasOwnProperty("client_id")) + object.client_id = message.client_id; + if (message.sequence != null && message.hasOwnProperty("sequence")) + if (typeof message.sequence === "number") + object.sequence = options.longs === String ? String(message.sequence) : message.sequence; + else + object.sequence = options.longs === String ? $util.Long.prototype.toString.call(message.sequence) : options.longs === Number ? new $util.LongBits(message.sequence.low >>> 0, message.sequence.high >>> 0).toNumber(true) : message.sequence; + if (message.signature_one != null && message.hasOwnProperty("signature_one")) + object.signature_one = $root.ibc.lightclients.solomachine.v1.SignatureAndData.toObject(message.signature_one, options); + if (message.signature_two != null && message.hasOwnProperty("signature_two")) + object.signature_two = $root.ibc.lightclients.solomachine.v1.SignatureAndData.toObject(message.signature_two, options); + return object; + }; + + /** + * Converts this Misbehaviour to JSON. + * @function toJSON + * @memberof ibc.lightclients.solomachine.v1.Misbehaviour + * @instance + * @returns {Object.} JSON object + */ + Misbehaviour.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Misbehaviour; + })(); + + v1.SignatureAndData = (function() { + + /** + * Properties of a SignatureAndData. + * @memberof ibc.lightclients.solomachine.v1 + * @interface ISignatureAndData + * @property {Uint8Array|null} [signature] SignatureAndData signature + * @property {ibc.lightclients.solomachine.v1.DataType|null} [data_type] SignatureAndData data_type + * @property {Uint8Array|null} [data] SignatureAndData data + * @property {Long|null} [timestamp] SignatureAndData timestamp + */ + + /** + * Constructs a new SignatureAndData. + * @memberof ibc.lightclients.solomachine.v1 + * @classdesc Represents a SignatureAndData. + * @implements ISignatureAndData + * @constructor + * @param {ibc.lightclients.solomachine.v1.ISignatureAndData=} [properties] Properties to set + */ + function SignatureAndData(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SignatureAndData signature. + * @member {Uint8Array} signature + * @memberof ibc.lightclients.solomachine.v1.SignatureAndData + * @instance + */ + SignatureAndData.prototype.signature = $util.newBuffer([]); + + /** + * SignatureAndData data_type. + * @member {ibc.lightclients.solomachine.v1.DataType} data_type + * @memberof ibc.lightclients.solomachine.v1.SignatureAndData + * @instance + */ + SignatureAndData.prototype.data_type = 0; + + /** + * SignatureAndData data. + * @member {Uint8Array} data + * @memberof ibc.lightclients.solomachine.v1.SignatureAndData + * @instance + */ + SignatureAndData.prototype.data = $util.newBuffer([]); + + /** + * SignatureAndData timestamp. + * @member {Long} timestamp + * @memberof ibc.lightclients.solomachine.v1.SignatureAndData + * @instance + */ + SignatureAndData.prototype.timestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified SignatureAndData message. Does not implicitly {@link ibc.lightclients.solomachine.v1.SignatureAndData.verify|verify} messages. + * @function encode + * @memberof ibc.lightclients.solomachine.v1.SignatureAndData + * @static + * @param {ibc.lightclients.solomachine.v1.ISignatureAndData} message SignatureAndData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SignatureAndData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.signature != null && Object.hasOwnProperty.call(message, "signature")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.signature); + if (message.data_type != null && Object.hasOwnProperty.call(message, "data_type")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.data_type); + if (message.data != null && Object.hasOwnProperty.call(message, "data")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.data); + if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) + writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.timestamp); + return writer; + }; + + /** + * Encodes the specified SignatureAndData message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.SignatureAndData.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.lightclients.solomachine.v1.SignatureAndData + * @static + * @param {ibc.lightclients.solomachine.v1.ISignatureAndData} message SignatureAndData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SignatureAndData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SignatureAndData message from the specified reader or buffer. + * @function decode + * @memberof ibc.lightclients.solomachine.v1.SignatureAndData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.lightclients.solomachine.v1.SignatureAndData} SignatureAndData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SignatureAndData.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.SignatureAndData(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signature = reader.bytes(); + break; + case 2: + message.data_type = reader.int32(); + break; + case 3: + message.data = reader.bytes(); + break; + case 4: + message.timestamp = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SignatureAndData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.lightclients.solomachine.v1.SignatureAndData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.lightclients.solomachine.v1.SignatureAndData} SignatureAndData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SignatureAndData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SignatureAndData message. + * @function verify + * @memberof ibc.lightclients.solomachine.v1.SignatureAndData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SignatureAndData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.signature != null && message.hasOwnProperty("signature")) + if (!(message.signature && typeof message.signature.length === "number" || $util.isString(message.signature))) + return "signature: buffer expected"; + if (message.data_type != null && message.hasOwnProperty("data_type")) + switch (message.data_type) { + default: + return "data_type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + break; + } + if (message.data != null && message.hasOwnProperty("data")) + if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) + return "data: buffer expected"; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (!$util.isInteger(message.timestamp) && !(message.timestamp && $util.isInteger(message.timestamp.low) && $util.isInteger(message.timestamp.high))) + return "timestamp: integer|Long expected"; + return null; + }; + + /** + * Creates a SignatureAndData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.lightclients.solomachine.v1.SignatureAndData + * @static + * @param {Object.} object Plain object + * @returns {ibc.lightclients.solomachine.v1.SignatureAndData} SignatureAndData + */ + SignatureAndData.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.lightclients.solomachine.v1.SignatureAndData) + return object; + let message = new $root.ibc.lightclients.solomachine.v1.SignatureAndData(); + if (object.signature != null) + if (typeof object.signature === "string") + $util.base64.decode(object.signature, message.signature = $util.newBuffer($util.base64.length(object.signature)), 0); + else if (object.signature.length) + message.signature = object.signature; + switch (object.data_type) { + case "DATA_TYPE_UNINITIALIZED_UNSPECIFIED": + case 0: + message.data_type = 0; + break; + case "DATA_TYPE_CLIENT_STATE": + case 1: + message.data_type = 1; + break; + case "DATA_TYPE_CONSENSUS_STATE": + case 2: + message.data_type = 2; + break; + case "DATA_TYPE_CONNECTION_STATE": + case 3: + message.data_type = 3; + break; + case "DATA_TYPE_CHANNEL_STATE": + case 4: + message.data_type = 4; + break; + case "DATA_TYPE_PACKET_COMMITMENT": + case 5: + message.data_type = 5; + break; + case "DATA_TYPE_PACKET_ACKNOWLEDGEMENT": + case 6: + message.data_type = 6; + break; + case "DATA_TYPE_PACKET_RECEIPT_ABSENCE": + case 7: + message.data_type = 7; + break; + case "DATA_TYPE_NEXT_SEQUENCE_RECV": + case 8: + message.data_type = 8; + break; + case "DATA_TYPE_HEADER": + case 9: + message.data_type = 9; + break; + } + if (object.data != null) + if (typeof object.data === "string") + $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); + else if (object.data.length) + message.data = object.data; + if (object.timestamp != null) + if ($util.Long) + (message.timestamp = $util.Long.fromValue(object.timestamp)).unsigned = true; + else if (typeof object.timestamp === "string") + message.timestamp = parseInt(object.timestamp, 10); + else if (typeof object.timestamp === "number") + message.timestamp = object.timestamp; + else if (typeof object.timestamp === "object") + message.timestamp = new $util.LongBits(object.timestamp.low >>> 0, object.timestamp.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a SignatureAndData message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.lightclients.solomachine.v1.SignatureAndData + * @static + * @param {ibc.lightclients.solomachine.v1.SignatureAndData} message SignatureAndData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SignatureAndData.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if (options.bytes === String) + object.signature = ""; + else { + object.signature = []; + if (options.bytes !== Array) + object.signature = $util.newBuffer(object.signature); + } + object.data_type = options.enums === String ? "DATA_TYPE_UNINITIALIZED_UNSPECIFIED" : 0; + if (options.bytes === String) + object.data = ""; + else { + object.data = []; + if (options.bytes !== Array) + object.data = $util.newBuffer(object.data); + } + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.timestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.timestamp = options.longs === String ? "0" : 0; + } + if (message.signature != null && message.hasOwnProperty("signature")) + object.signature = options.bytes === String ? $util.base64.encode(message.signature, 0, message.signature.length) : options.bytes === Array ? Array.prototype.slice.call(message.signature) : message.signature; + if (message.data_type != null && message.hasOwnProperty("data_type")) + object.data_type = options.enums === String ? $root.ibc.lightclients.solomachine.v1.DataType[message.data_type] : message.data_type; + if (message.data != null && message.hasOwnProperty("data")) + object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (typeof message.timestamp === "number") + object.timestamp = options.longs === String ? String(message.timestamp) : message.timestamp; + else + object.timestamp = options.longs === String ? $util.Long.prototype.toString.call(message.timestamp) : options.longs === Number ? new $util.LongBits(message.timestamp.low >>> 0, message.timestamp.high >>> 0).toNumber(true) : message.timestamp; + return object; + }; + + /** + * Converts this SignatureAndData to JSON. + * @function toJSON + * @memberof ibc.lightclients.solomachine.v1.SignatureAndData + * @instance + * @returns {Object.} JSON object + */ + SignatureAndData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SignatureAndData; + })(); + + v1.TimestampedSignatureData = (function() { + + /** + * Properties of a TimestampedSignatureData. + * @memberof ibc.lightclients.solomachine.v1 + * @interface ITimestampedSignatureData + * @property {Uint8Array|null} [signature_data] TimestampedSignatureData signature_data + * @property {Long|null} [timestamp] TimestampedSignatureData timestamp + */ + + /** + * Constructs a new TimestampedSignatureData. + * @memberof ibc.lightclients.solomachine.v1 + * @classdesc Represents a TimestampedSignatureData. + * @implements ITimestampedSignatureData + * @constructor + * @param {ibc.lightclients.solomachine.v1.ITimestampedSignatureData=} [properties] Properties to set + */ + function TimestampedSignatureData(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TimestampedSignatureData signature_data. + * @member {Uint8Array} signature_data + * @memberof ibc.lightclients.solomachine.v1.TimestampedSignatureData + * @instance + */ + TimestampedSignatureData.prototype.signature_data = $util.newBuffer([]); + + /** + * TimestampedSignatureData timestamp. + * @member {Long} timestamp + * @memberof ibc.lightclients.solomachine.v1.TimestampedSignatureData + * @instance + */ + TimestampedSignatureData.prototype.timestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified TimestampedSignatureData message. Does not implicitly {@link ibc.lightclients.solomachine.v1.TimestampedSignatureData.verify|verify} messages. + * @function encode + * @memberof ibc.lightclients.solomachine.v1.TimestampedSignatureData + * @static + * @param {ibc.lightclients.solomachine.v1.ITimestampedSignatureData} message TimestampedSignatureData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TimestampedSignatureData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.signature_data != null && Object.hasOwnProperty.call(message, "signature_data")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.signature_data); + if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.timestamp); + return writer; + }; + + /** + * Encodes the specified TimestampedSignatureData message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.TimestampedSignatureData.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.lightclients.solomachine.v1.TimestampedSignatureData + * @static + * @param {ibc.lightclients.solomachine.v1.ITimestampedSignatureData} message TimestampedSignatureData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TimestampedSignatureData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TimestampedSignatureData message from the specified reader or buffer. + * @function decode + * @memberof ibc.lightclients.solomachine.v1.TimestampedSignatureData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.lightclients.solomachine.v1.TimestampedSignatureData} TimestampedSignatureData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TimestampedSignatureData.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.TimestampedSignatureData(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signature_data = reader.bytes(); + break; + case 2: + message.timestamp = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TimestampedSignatureData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.lightclients.solomachine.v1.TimestampedSignatureData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.lightclients.solomachine.v1.TimestampedSignatureData} TimestampedSignatureData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TimestampedSignatureData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TimestampedSignatureData message. + * @function verify + * @memberof ibc.lightclients.solomachine.v1.TimestampedSignatureData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TimestampedSignatureData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.signature_data != null && message.hasOwnProperty("signature_data")) + if (!(message.signature_data && typeof message.signature_data.length === "number" || $util.isString(message.signature_data))) + return "signature_data: buffer expected"; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (!$util.isInteger(message.timestamp) && !(message.timestamp && $util.isInteger(message.timestamp.low) && $util.isInteger(message.timestamp.high))) + return "timestamp: integer|Long expected"; + return null; + }; + + /** + * Creates a TimestampedSignatureData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.lightclients.solomachine.v1.TimestampedSignatureData + * @static + * @param {Object.} object Plain object + * @returns {ibc.lightclients.solomachine.v1.TimestampedSignatureData} TimestampedSignatureData + */ + TimestampedSignatureData.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.lightclients.solomachine.v1.TimestampedSignatureData) + return object; + let message = new $root.ibc.lightclients.solomachine.v1.TimestampedSignatureData(); + if (object.signature_data != null) + if (typeof object.signature_data === "string") + $util.base64.decode(object.signature_data, message.signature_data = $util.newBuffer($util.base64.length(object.signature_data)), 0); + else if (object.signature_data.length) + message.signature_data = object.signature_data; + if (object.timestamp != null) + if ($util.Long) + (message.timestamp = $util.Long.fromValue(object.timestamp)).unsigned = true; + else if (typeof object.timestamp === "string") + message.timestamp = parseInt(object.timestamp, 10); + else if (typeof object.timestamp === "number") + message.timestamp = object.timestamp; + else if (typeof object.timestamp === "object") + message.timestamp = new $util.LongBits(object.timestamp.low >>> 0, object.timestamp.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a TimestampedSignatureData message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.lightclients.solomachine.v1.TimestampedSignatureData + * @static + * @param {ibc.lightclients.solomachine.v1.TimestampedSignatureData} message TimestampedSignatureData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TimestampedSignatureData.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if (options.bytes === String) + object.signature_data = ""; + else { + object.signature_data = []; + if (options.bytes !== Array) + object.signature_data = $util.newBuffer(object.signature_data); + } + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.timestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.timestamp = options.longs === String ? "0" : 0; + } + if (message.signature_data != null && message.hasOwnProperty("signature_data")) + object.signature_data = options.bytes === String ? $util.base64.encode(message.signature_data, 0, message.signature_data.length) : options.bytes === Array ? Array.prototype.slice.call(message.signature_data) : message.signature_data; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (typeof message.timestamp === "number") + object.timestamp = options.longs === String ? String(message.timestamp) : message.timestamp; + else + object.timestamp = options.longs === String ? $util.Long.prototype.toString.call(message.timestamp) : options.longs === Number ? new $util.LongBits(message.timestamp.low >>> 0, message.timestamp.high >>> 0).toNumber(true) : message.timestamp; + return object; + }; + + /** + * Converts this TimestampedSignatureData to JSON. + * @function toJSON + * @memberof ibc.lightclients.solomachine.v1.TimestampedSignatureData + * @instance + * @returns {Object.} JSON object + */ + TimestampedSignatureData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TimestampedSignatureData; + })(); + + v1.SignBytes = (function() { + + /** + * Properties of a SignBytes. + * @memberof ibc.lightclients.solomachine.v1 + * @interface ISignBytes + * @property {Long|null} [sequence] SignBytes sequence + * @property {Long|null} [timestamp] SignBytes timestamp + * @property {string|null} [diversifier] SignBytes diversifier + * @property {ibc.lightclients.solomachine.v1.DataType|null} [data_type] SignBytes data_type + * @property {Uint8Array|null} [data] SignBytes data + */ + + /** + * Constructs a new SignBytes. + * @memberof ibc.lightclients.solomachine.v1 + * @classdesc Represents a SignBytes. + * @implements ISignBytes + * @constructor + * @param {ibc.lightclients.solomachine.v1.ISignBytes=} [properties] Properties to set + */ + function SignBytes(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SignBytes sequence. + * @member {Long} sequence + * @memberof ibc.lightclients.solomachine.v1.SignBytes + * @instance + */ + SignBytes.prototype.sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * SignBytes timestamp. + * @member {Long} timestamp + * @memberof ibc.lightclients.solomachine.v1.SignBytes + * @instance + */ + SignBytes.prototype.timestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * SignBytes diversifier. + * @member {string} diversifier + * @memberof ibc.lightclients.solomachine.v1.SignBytes + * @instance + */ + SignBytes.prototype.diversifier = ""; + + /** + * SignBytes data_type. + * @member {ibc.lightclients.solomachine.v1.DataType} data_type + * @memberof ibc.lightclients.solomachine.v1.SignBytes + * @instance + */ + SignBytes.prototype.data_type = 0; + + /** + * SignBytes data. + * @member {Uint8Array} data + * @memberof ibc.lightclients.solomachine.v1.SignBytes + * @instance + */ + SignBytes.prototype.data = $util.newBuffer([]); + + /** + * Encodes the specified SignBytes message. Does not implicitly {@link ibc.lightclients.solomachine.v1.SignBytes.verify|verify} messages. + * @function encode + * @memberof ibc.lightclients.solomachine.v1.SignBytes + * @static + * @param {ibc.lightclients.solomachine.v1.ISignBytes} message SignBytes message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SignBytes.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sequence != null && Object.hasOwnProperty.call(message, "sequence")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.sequence); + if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.timestamp); + if (message.diversifier != null && Object.hasOwnProperty.call(message, "diversifier")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.diversifier); + if (message.data_type != null && Object.hasOwnProperty.call(message, "data_type")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.data_type); + if (message.data != null && Object.hasOwnProperty.call(message, "data")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.data); + return writer; + }; + + /** + * Encodes the specified SignBytes message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.SignBytes.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.lightclients.solomachine.v1.SignBytes + * @static + * @param {ibc.lightclients.solomachine.v1.ISignBytes} message SignBytes message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SignBytes.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SignBytes message from the specified reader or buffer. + * @function decode + * @memberof ibc.lightclients.solomachine.v1.SignBytes + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.lightclients.solomachine.v1.SignBytes} SignBytes + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SignBytes.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.SignBytes(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sequence = reader.uint64(); + break; + case 2: + message.timestamp = reader.uint64(); + break; + case 3: + message.diversifier = reader.string(); + break; + case 4: + message.data_type = reader.int32(); + break; + case 5: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SignBytes message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.lightclients.solomachine.v1.SignBytes + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.lightclients.solomachine.v1.SignBytes} SignBytes + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SignBytes.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SignBytes message. + * @function verify + * @memberof ibc.lightclients.solomachine.v1.SignBytes + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SignBytes.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sequence != null && message.hasOwnProperty("sequence")) + if (!$util.isInteger(message.sequence) && !(message.sequence && $util.isInteger(message.sequence.low) && $util.isInteger(message.sequence.high))) + return "sequence: integer|Long expected"; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (!$util.isInteger(message.timestamp) && !(message.timestamp && $util.isInteger(message.timestamp.low) && $util.isInteger(message.timestamp.high))) + return "timestamp: integer|Long expected"; + if (message.diversifier != null && message.hasOwnProperty("diversifier")) + if (!$util.isString(message.diversifier)) + return "diversifier: string expected"; + if (message.data_type != null && message.hasOwnProperty("data_type")) + switch (message.data_type) { + default: + return "data_type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + break; + } + if (message.data != null && message.hasOwnProperty("data")) + if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) + return "data: buffer expected"; + return null; + }; + + /** + * Creates a SignBytes message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.lightclients.solomachine.v1.SignBytes + * @static + * @param {Object.} object Plain object + * @returns {ibc.lightclients.solomachine.v1.SignBytes} SignBytes + */ + SignBytes.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.lightclients.solomachine.v1.SignBytes) + return object; + let message = new $root.ibc.lightclients.solomachine.v1.SignBytes(); + if (object.sequence != null) + if ($util.Long) + (message.sequence = $util.Long.fromValue(object.sequence)).unsigned = true; + else if (typeof object.sequence === "string") + message.sequence = parseInt(object.sequence, 10); + else if (typeof object.sequence === "number") + message.sequence = object.sequence; + else if (typeof object.sequence === "object") + message.sequence = new $util.LongBits(object.sequence.low >>> 0, object.sequence.high >>> 0).toNumber(true); + if (object.timestamp != null) + if ($util.Long) + (message.timestamp = $util.Long.fromValue(object.timestamp)).unsigned = true; + else if (typeof object.timestamp === "string") + message.timestamp = parseInt(object.timestamp, 10); + else if (typeof object.timestamp === "number") + message.timestamp = object.timestamp; + else if (typeof object.timestamp === "object") + message.timestamp = new $util.LongBits(object.timestamp.low >>> 0, object.timestamp.high >>> 0).toNumber(true); + if (object.diversifier != null) + message.diversifier = String(object.diversifier); + switch (object.data_type) { + case "DATA_TYPE_UNINITIALIZED_UNSPECIFIED": + case 0: + message.data_type = 0; + break; + case "DATA_TYPE_CLIENT_STATE": + case 1: + message.data_type = 1; + break; + case "DATA_TYPE_CONSENSUS_STATE": + case 2: + message.data_type = 2; + break; + case "DATA_TYPE_CONNECTION_STATE": + case 3: + message.data_type = 3; + break; + case "DATA_TYPE_CHANNEL_STATE": + case 4: + message.data_type = 4; + break; + case "DATA_TYPE_PACKET_COMMITMENT": + case 5: + message.data_type = 5; + break; + case "DATA_TYPE_PACKET_ACKNOWLEDGEMENT": + case 6: + message.data_type = 6; + break; + case "DATA_TYPE_PACKET_RECEIPT_ABSENCE": + case 7: + message.data_type = 7; + break; + case "DATA_TYPE_NEXT_SEQUENCE_RECV": + case 8: + message.data_type = 8; + break; + case "DATA_TYPE_HEADER": + case 9: + message.data_type = 9; + break; + } + if (object.data != null) + if (typeof object.data === "string") + $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); + else if (object.data.length) + message.data = object.data; + return message; + }; + + /** + * Creates a plain object from a SignBytes message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.lightclients.solomachine.v1.SignBytes + * @static + * @param {ibc.lightclients.solomachine.v1.SignBytes} message SignBytes + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SignBytes.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.sequence = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.timestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.timestamp = options.longs === String ? "0" : 0; + object.diversifier = ""; + object.data_type = options.enums === String ? "DATA_TYPE_UNINITIALIZED_UNSPECIFIED" : 0; + if (options.bytes === String) + object.data = ""; + else { + object.data = []; + if (options.bytes !== Array) + object.data = $util.newBuffer(object.data); + } + } + if (message.sequence != null && message.hasOwnProperty("sequence")) + if (typeof message.sequence === "number") + object.sequence = options.longs === String ? String(message.sequence) : message.sequence; + else + object.sequence = options.longs === String ? $util.Long.prototype.toString.call(message.sequence) : options.longs === Number ? new $util.LongBits(message.sequence.low >>> 0, message.sequence.high >>> 0).toNumber(true) : message.sequence; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (typeof message.timestamp === "number") + object.timestamp = options.longs === String ? String(message.timestamp) : message.timestamp; + else + object.timestamp = options.longs === String ? $util.Long.prototype.toString.call(message.timestamp) : options.longs === Number ? new $util.LongBits(message.timestamp.low >>> 0, message.timestamp.high >>> 0).toNumber(true) : message.timestamp; + if (message.diversifier != null && message.hasOwnProperty("diversifier")) + object.diversifier = message.diversifier; + if (message.data_type != null && message.hasOwnProperty("data_type")) + object.data_type = options.enums === String ? $root.ibc.lightclients.solomachine.v1.DataType[message.data_type] : message.data_type; + if (message.data != null && message.hasOwnProperty("data")) + object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; + return object; + }; + + /** + * Converts this SignBytes to JSON. + * @function toJSON + * @memberof ibc.lightclients.solomachine.v1.SignBytes + * @instance + * @returns {Object.} JSON object + */ + SignBytes.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SignBytes; + })(); + + /** + * DataType enum. + * @name ibc.lightclients.solomachine.v1.DataType + * @enum {number} + * @property {number} DATA_TYPE_UNINITIALIZED_UNSPECIFIED=0 DATA_TYPE_UNINITIALIZED_UNSPECIFIED value + * @property {number} DATA_TYPE_CLIENT_STATE=1 DATA_TYPE_CLIENT_STATE value + * @property {number} DATA_TYPE_CONSENSUS_STATE=2 DATA_TYPE_CONSENSUS_STATE value + * @property {number} DATA_TYPE_CONNECTION_STATE=3 DATA_TYPE_CONNECTION_STATE value + * @property {number} DATA_TYPE_CHANNEL_STATE=4 DATA_TYPE_CHANNEL_STATE value + * @property {number} DATA_TYPE_PACKET_COMMITMENT=5 DATA_TYPE_PACKET_COMMITMENT value + * @property {number} DATA_TYPE_PACKET_ACKNOWLEDGEMENT=6 DATA_TYPE_PACKET_ACKNOWLEDGEMENT value + * @property {number} DATA_TYPE_PACKET_RECEIPT_ABSENCE=7 DATA_TYPE_PACKET_RECEIPT_ABSENCE value + * @property {number} DATA_TYPE_NEXT_SEQUENCE_RECV=8 DATA_TYPE_NEXT_SEQUENCE_RECV value + * @property {number} DATA_TYPE_HEADER=9 DATA_TYPE_HEADER value + */ + v1.DataType = (function() { + const valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DATA_TYPE_UNINITIALIZED_UNSPECIFIED"] = 0; + values[valuesById[1] = "DATA_TYPE_CLIENT_STATE"] = 1; + values[valuesById[2] = "DATA_TYPE_CONSENSUS_STATE"] = 2; + values[valuesById[3] = "DATA_TYPE_CONNECTION_STATE"] = 3; + values[valuesById[4] = "DATA_TYPE_CHANNEL_STATE"] = 4; + values[valuesById[5] = "DATA_TYPE_PACKET_COMMITMENT"] = 5; + values[valuesById[6] = "DATA_TYPE_PACKET_ACKNOWLEDGEMENT"] = 6; + values[valuesById[7] = "DATA_TYPE_PACKET_RECEIPT_ABSENCE"] = 7; + values[valuesById[8] = "DATA_TYPE_NEXT_SEQUENCE_RECV"] = 8; + values[valuesById[9] = "DATA_TYPE_HEADER"] = 9; + return values; + })(); + + v1.HeaderData = (function() { + + /** + * Properties of a HeaderData. + * @memberof ibc.lightclients.solomachine.v1 + * @interface IHeaderData + * @property {google.protobuf.IAny|null} [new_pub_key] HeaderData new_pub_key + * @property {string|null} [new_diversifier] HeaderData new_diversifier + */ + + /** + * Constructs a new HeaderData. + * @memberof ibc.lightclients.solomachine.v1 + * @classdesc Represents a HeaderData. + * @implements IHeaderData + * @constructor + * @param {ibc.lightclients.solomachine.v1.IHeaderData=} [properties] Properties to set + */ + function HeaderData(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HeaderData new_pub_key. + * @member {google.protobuf.IAny|null|undefined} new_pub_key + * @memberof ibc.lightclients.solomachine.v1.HeaderData + * @instance + */ + HeaderData.prototype.new_pub_key = null; + + /** + * HeaderData new_diversifier. + * @member {string} new_diversifier + * @memberof ibc.lightclients.solomachine.v1.HeaderData + * @instance + */ + HeaderData.prototype.new_diversifier = ""; + + /** + * Encodes the specified HeaderData message. Does not implicitly {@link ibc.lightclients.solomachine.v1.HeaderData.verify|verify} messages. + * @function encode + * @memberof ibc.lightclients.solomachine.v1.HeaderData + * @static + * @param {ibc.lightclients.solomachine.v1.IHeaderData} message HeaderData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HeaderData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.new_pub_key != null && Object.hasOwnProperty.call(message, "new_pub_key")) + $root.google.protobuf.Any.encode(message.new_pub_key, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.new_diversifier != null && Object.hasOwnProperty.call(message, "new_diversifier")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.new_diversifier); + return writer; + }; + + /** + * Encodes the specified HeaderData message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.HeaderData.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.lightclients.solomachine.v1.HeaderData + * @static + * @param {ibc.lightclients.solomachine.v1.IHeaderData} message HeaderData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HeaderData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HeaderData message from the specified reader or buffer. + * @function decode + * @memberof ibc.lightclients.solomachine.v1.HeaderData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.lightclients.solomachine.v1.HeaderData} HeaderData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HeaderData.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.HeaderData(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.new_pub_key = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + case 2: + message.new_diversifier = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HeaderData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.lightclients.solomachine.v1.HeaderData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.lightclients.solomachine.v1.HeaderData} HeaderData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HeaderData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HeaderData message. + * @function verify + * @memberof ibc.lightclients.solomachine.v1.HeaderData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HeaderData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.new_pub_key != null && message.hasOwnProperty("new_pub_key")) { + let error = $root.google.protobuf.Any.verify(message.new_pub_key); + if (error) + return "new_pub_key." + error; + } + if (message.new_diversifier != null && message.hasOwnProperty("new_diversifier")) + if (!$util.isString(message.new_diversifier)) + return "new_diversifier: string expected"; + return null; + }; + + /** + * Creates a HeaderData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.lightclients.solomachine.v1.HeaderData + * @static + * @param {Object.} object Plain object + * @returns {ibc.lightclients.solomachine.v1.HeaderData} HeaderData + */ + HeaderData.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.lightclients.solomachine.v1.HeaderData) + return object; + let message = new $root.ibc.lightclients.solomachine.v1.HeaderData(); + if (object.new_pub_key != null) { + if (typeof object.new_pub_key !== "object") + throw TypeError(".ibc.lightclients.solomachine.v1.HeaderData.new_pub_key: object expected"); + message.new_pub_key = $root.google.protobuf.Any.fromObject(object.new_pub_key); + } + if (object.new_diversifier != null) + message.new_diversifier = String(object.new_diversifier); + return message; + }; + + /** + * Creates a plain object from a HeaderData message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.lightclients.solomachine.v1.HeaderData + * @static + * @param {ibc.lightclients.solomachine.v1.HeaderData} message HeaderData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HeaderData.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.new_pub_key = null; + object.new_diversifier = ""; + } + if (message.new_pub_key != null && message.hasOwnProperty("new_pub_key")) + object.new_pub_key = $root.google.protobuf.Any.toObject(message.new_pub_key, options); + if (message.new_diversifier != null && message.hasOwnProperty("new_diversifier")) + object.new_diversifier = message.new_diversifier; + return object; + }; + + /** + * Converts this HeaderData to JSON. + * @function toJSON + * @memberof ibc.lightclients.solomachine.v1.HeaderData + * @instance + * @returns {Object.} JSON object + */ + HeaderData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return HeaderData; + })(); + + v1.ClientStateData = (function() { + + /** + * Properties of a ClientStateData. + * @memberof ibc.lightclients.solomachine.v1 + * @interface IClientStateData + * @property {Uint8Array|null} [path] ClientStateData path + * @property {google.protobuf.IAny|null} [client_state] ClientStateData client_state + */ + + /** + * Constructs a new ClientStateData. + * @memberof ibc.lightclients.solomachine.v1 + * @classdesc Represents a ClientStateData. + * @implements IClientStateData + * @constructor + * @param {ibc.lightclients.solomachine.v1.IClientStateData=} [properties] Properties to set + */ + function ClientStateData(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ClientStateData path. + * @member {Uint8Array} path + * @memberof ibc.lightclients.solomachine.v1.ClientStateData + * @instance + */ + ClientStateData.prototype.path = $util.newBuffer([]); + + /** + * ClientStateData client_state. + * @member {google.protobuf.IAny|null|undefined} client_state + * @memberof ibc.lightclients.solomachine.v1.ClientStateData + * @instance + */ + ClientStateData.prototype.client_state = null; + + /** + * Encodes the specified ClientStateData message. Does not implicitly {@link ibc.lightclients.solomachine.v1.ClientStateData.verify|verify} messages. + * @function encode + * @memberof ibc.lightclients.solomachine.v1.ClientStateData + * @static + * @param {ibc.lightclients.solomachine.v1.IClientStateData} message ClientStateData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClientStateData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.path); + if (message.client_state != null && Object.hasOwnProperty.call(message, "client_state")) + $root.google.protobuf.Any.encode(message.client_state, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ClientStateData message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.ClientStateData.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.lightclients.solomachine.v1.ClientStateData + * @static + * @param {ibc.lightclients.solomachine.v1.IClientStateData} message ClientStateData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClientStateData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ClientStateData message from the specified reader or buffer. + * @function decode + * @memberof ibc.lightclients.solomachine.v1.ClientStateData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.lightclients.solomachine.v1.ClientStateData} ClientStateData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClientStateData.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.ClientStateData(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.bytes(); + break; + case 2: + message.client_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ClientStateData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.lightclients.solomachine.v1.ClientStateData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.lightclients.solomachine.v1.ClientStateData} ClientStateData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClientStateData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ClientStateData message. + * @function verify + * @memberof ibc.lightclients.solomachine.v1.ClientStateData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ClientStateData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!(message.path && typeof message.path.length === "number" || $util.isString(message.path))) + return "path: buffer expected"; + if (message.client_state != null && message.hasOwnProperty("client_state")) { + let error = $root.google.protobuf.Any.verify(message.client_state); + if (error) + return "client_state." + error; + } + return null; + }; + + /** + * Creates a ClientStateData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.lightclients.solomachine.v1.ClientStateData + * @static + * @param {Object.} object Plain object + * @returns {ibc.lightclients.solomachine.v1.ClientStateData} ClientStateData + */ + ClientStateData.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.lightclients.solomachine.v1.ClientStateData) + return object; + let message = new $root.ibc.lightclients.solomachine.v1.ClientStateData(); + if (object.path != null) + if (typeof object.path === "string") + $util.base64.decode(object.path, message.path = $util.newBuffer($util.base64.length(object.path)), 0); + else if (object.path.length) + message.path = object.path; + if (object.client_state != null) { + if (typeof object.client_state !== "object") + throw TypeError(".ibc.lightclients.solomachine.v1.ClientStateData.client_state: object expected"); + message.client_state = $root.google.protobuf.Any.fromObject(object.client_state); + } + return message; + }; + + /** + * Creates a plain object from a ClientStateData message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.lightclients.solomachine.v1.ClientStateData + * @static + * @param {ibc.lightclients.solomachine.v1.ClientStateData} message ClientStateData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ClientStateData.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if (options.bytes === String) + object.path = ""; + else { + object.path = []; + if (options.bytes !== Array) + object.path = $util.newBuffer(object.path); + } + object.client_state = null; + } + if (message.path != null && message.hasOwnProperty("path")) + object.path = options.bytes === String ? $util.base64.encode(message.path, 0, message.path.length) : options.bytes === Array ? Array.prototype.slice.call(message.path) : message.path; + if (message.client_state != null && message.hasOwnProperty("client_state")) + object.client_state = $root.google.protobuf.Any.toObject(message.client_state, options); + return object; + }; + + /** + * Converts this ClientStateData to JSON. + * @function toJSON + * @memberof ibc.lightclients.solomachine.v1.ClientStateData + * @instance + * @returns {Object.} JSON object + */ + ClientStateData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ClientStateData; + })(); + + v1.ConsensusStateData = (function() { + + /** + * Properties of a ConsensusStateData. + * @memberof ibc.lightclients.solomachine.v1 + * @interface IConsensusStateData + * @property {Uint8Array|null} [path] ConsensusStateData path + * @property {google.protobuf.IAny|null} [consensus_state] ConsensusStateData consensus_state + */ + + /** + * Constructs a new ConsensusStateData. + * @memberof ibc.lightclients.solomachine.v1 + * @classdesc Represents a ConsensusStateData. + * @implements IConsensusStateData + * @constructor + * @param {ibc.lightclients.solomachine.v1.IConsensusStateData=} [properties] Properties to set + */ + function ConsensusStateData(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConsensusStateData path. + * @member {Uint8Array} path + * @memberof ibc.lightclients.solomachine.v1.ConsensusStateData + * @instance + */ + ConsensusStateData.prototype.path = $util.newBuffer([]); + + /** + * ConsensusStateData consensus_state. + * @member {google.protobuf.IAny|null|undefined} consensus_state + * @memberof ibc.lightclients.solomachine.v1.ConsensusStateData + * @instance + */ + ConsensusStateData.prototype.consensus_state = null; + + /** + * Encodes the specified ConsensusStateData message. Does not implicitly {@link ibc.lightclients.solomachine.v1.ConsensusStateData.verify|verify} messages. + * @function encode + * @memberof ibc.lightclients.solomachine.v1.ConsensusStateData + * @static + * @param {ibc.lightclients.solomachine.v1.IConsensusStateData} message ConsensusStateData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConsensusStateData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.path); + if (message.consensus_state != null && Object.hasOwnProperty.call(message, "consensus_state")) + $root.google.protobuf.Any.encode(message.consensus_state, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ConsensusStateData message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.ConsensusStateData.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.lightclients.solomachine.v1.ConsensusStateData + * @static + * @param {ibc.lightclients.solomachine.v1.IConsensusStateData} message ConsensusStateData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConsensusStateData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConsensusStateData message from the specified reader or buffer. + * @function decode + * @memberof ibc.lightclients.solomachine.v1.ConsensusStateData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.lightclients.solomachine.v1.ConsensusStateData} ConsensusStateData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConsensusStateData.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.ConsensusStateData(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.bytes(); + break; + case 2: + message.consensus_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConsensusStateData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.lightclients.solomachine.v1.ConsensusStateData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.lightclients.solomachine.v1.ConsensusStateData} ConsensusStateData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConsensusStateData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConsensusStateData message. + * @function verify + * @memberof ibc.lightclients.solomachine.v1.ConsensusStateData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConsensusStateData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!(message.path && typeof message.path.length === "number" || $util.isString(message.path))) + return "path: buffer expected"; + if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) { + let error = $root.google.protobuf.Any.verify(message.consensus_state); + if (error) + return "consensus_state." + error; + } + return null; + }; + + /** + * Creates a ConsensusStateData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.lightclients.solomachine.v1.ConsensusStateData + * @static + * @param {Object.} object Plain object + * @returns {ibc.lightclients.solomachine.v1.ConsensusStateData} ConsensusStateData + */ + ConsensusStateData.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.lightclients.solomachine.v1.ConsensusStateData) + return object; + let message = new $root.ibc.lightclients.solomachine.v1.ConsensusStateData(); + if (object.path != null) + if (typeof object.path === "string") + $util.base64.decode(object.path, message.path = $util.newBuffer($util.base64.length(object.path)), 0); + else if (object.path.length) + message.path = object.path; + if (object.consensus_state != null) { + if (typeof object.consensus_state !== "object") + throw TypeError(".ibc.lightclients.solomachine.v1.ConsensusStateData.consensus_state: object expected"); + message.consensus_state = $root.google.protobuf.Any.fromObject(object.consensus_state); + } + return message; + }; + + /** + * Creates a plain object from a ConsensusStateData message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.lightclients.solomachine.v1.ConsensusStateData + * @static + * @param {ibc.lightclients.solomachine.v1.ConsensusStateData} message ConsensusStateData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConsensusStateData.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if (options.bytes === String) + object.path = ""; + else { + object.path = []; + if (options.bytes !== Array) + object.path = $util.newBuffer(object.path); + } + object.consensus_state = null; + } + if (message.path != null && message.hasOwnProperty("path")) + object.path = options.bytes === String ? $util.base64.encode(message.path, 0, message.path.length) : options.bytes === Array ? Array.prototype.slice.call(message.path) : message.path; + if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) + object.consensus_state = $root.google.protobuf.Any.toObject(message.consensus_state, options); + return object; + }; + + /** + * Converts this ConsensusStateData to JSON. + * @function toJSON + * @memberof ibc.lightclients.solomachine.v1.ConsensusStateData + * @instance + * @returns {Object.} JSON object + */ + ConsensusStateData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ConsensusStateData; + })(); + + v1.ConnectionStateData = (function() { + + /** + * Properties of a ConnectionStateData. + * @memberof ibc.lightclients.solomachine.v1 + * @interface IConnectionStateData + * @property {Uint8Array|null} [path] ConnectionStateData path + * @property {ibc.core.connection.v1.IConnectionEnd|null} [connection] ConnectionStateData connection + */ + + /** + * Constructs a new ConnectionStateData. + * @memberof ibc.lightclients.solomachine.v1 + * @classdesc Represents a ConnectionStateData. + * @implements IConnectionStateData + * @constructor + * @param {ibc.lightclients.solomachine.v1.IConnectionStateData=} [properties] Properties to set + */ + function ConnectionStateData(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConnectionStateData path. + * @member {Uint8Array} path + * @memberof ibc.lightclients.solomachine.v1.ConnectionStateData + * @instance + */ + ConnectionStateData.prototype.path = $util.newBuffer([]); + + /** + * ConnectionStateData connection. + * @member {ibc.core.connection.v1.IConnectionEnd|null|undefined} connection + * @memberof ibc.lightclients.solomachine.v1.ConnectionStateData + * @instance + */ + ConnectionStateData.prototype.connection = null; + + /** + * Encodes the specified ConnectionStateData message. Does not implicitly {@link ibc.lightclients.solomachine.v1.ConnectionStateData.verify|verify} messages. + * @function encode + * @memberof ibc.lightclients.solomachine.v1.ConnectionStateData + * @static + * @param {ibc.lightclients.solomachine.v1.IConnectionStateData} message ConnectionStateData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConnectionStateData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.path); + if (message.connection != null && Object.hasOwnProperty.call(message, "connection")) + $root.ibc.core.connection.v1.ConnectionEnd.encode(message.connection, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ConnectionStateData message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.ConnectionStateData.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.lightclients.solomachine.v1.ConnectionStateData + * @static + * @param {ibc.lightclients.solomachine.v1.IConnectionStateData} message ConnectionStateData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConnectionStateData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConnectionStateData message from the specified reader or buffer. + * @function decode + * @memberof ibc.lightclients.solomachine.v1.ConnectionStateData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.lightclients.solomachine.v1.ConnectionStateData} ConnectionStateData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConnectionStateData.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.ConnectionStateData(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.bytes(); + break; + case 2: + message.connection = $root.ibc.core.connection.v1.ConnectionEnd.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConnectionStateData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.lightclients.solomachine.v1.ConnectionStateData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.lightclients.solomachine.v1.ConnectionStateData} ConnectionStateData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConnectionStateData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConnectionStateData message. + * @function verify + * @memberof ibc.lightclients.solomachine.v1.ConnectionStateData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConnectionStateData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!(message.path && typeof message.path.length === "number" || $util.isString(message.path))) + return "path: buffer expected"; + if (message.connection != null && message.hasOwnProperty("connection")) { + let error = $root.ibc.core.connection.v1.ConnectionEnd.verify(message.connection); + if (error) + return "connection." + error; + } + return null; + }; + + /** + * Creates a ConnectionStateData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.lightclients.solomachine.v1.ConnectionStateData + * @static + * @param {Object.} object Plain object + * @returns {ibc.lightclients.solomachine.v1.ConnectionStateData} ConnectionStateData + */ + ConnectionStateData.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.lightclients.solomachine.v1.ConnectionStateData) + return object; + let message = new $root.ibc.lightclients.solomachine.v1.ConnectionStateData(); + if (object.path != null) + if (typeof object.path === "string") + $util.base64.decode(object.path, message.path = $util.newBuffer($util.base64.length(object.path)), 0); + else if (object.path.length) + message.path = object.path; + if (object.connection != null) { + if (typeof object.connection !== "object") + throw TypeError(".ibc.lightclients.solomachine.v1.ConnectionStateData.connection: object expected"); + message.connection = $root.ibc.core.connection.v1.ConnectionEnd.fromObject(object.connection); + } + return message; + }; + + /** + * Creates a plain object from a ConnectionStateData message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.lightclients.solomachine.v1.ConnectionStateData + * @static + * @param {ibc.lightclients.solomachine.v1.ConnectionStateData} message ConnectionStateData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConnectionStateData.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if (options.bytes === String) + object.path = ""; + else { + object.path = []; + if (options.bytes !== Array) + object.path = $util.newBuffer(object.path); + } + object.connection = null; + } + if (message.path != null && message.hasOwnProperty("path")) + object.path = options.bytes === String ? $util.base64.encode(message.path, 0, message.path.length) : options.bytes === Array ? Array.prototype.slice.call(message.path) : message.path; + if (message.connection != null && message.hasOwnProperty("connection")) + object.connection = $root.ibc.core.connection.v1.ConnectionEnd.toObject(message.connection, options); + return object; + }; + + /** + * Converts this ConnectionStateData to JSON. + * @function toJSON + * @memberof ibc.lightclients.solomachine.v1.ConnectionStateData + * @instance + * @returns {Object.} JSON object + */ + ConnectionStateData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ConnectionStateData; + })(); + + v1.ChannelStateData = (function() { + + /** + * Properties of a ChannelStateData. + * @memberof ibc.lightclients.solomachine.v1 + * @interface IChannelStateData + * @property {Uint8Array|null} [path] ChannelStateData path + * @property {ibc.core.channel.v1.IChannel|null} [channel] ChannelStateData channel + */ + + /** + * Constructs a new ChannelStateData. + * @memberof ibc.lightclients.solomachine.v1 + * @classdesc Represents a ChannelStateData. + * @implements IChannelStateData + * @constructor + * @param {ibc.lightclients.solomachine.v1.IChannelStateData=} [properties] Properties to set + */ + function ChannelStateData(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ChannelStateData path. + * @member {Uint8Array} path + * @memberof ibc.lightclients.solomachine.v1.ChannelStateData + * @instance + */ + ChannelStateData.prototype.path = $util.newBuffer([]); + + /** + * ChannelStateData channel. + * @member {ibc.core.channel.v1.IChannel|null|undefined} channel + * @memberof ibc.lightclients.solomachine.v1.ChannelStateData + * @instance + */ + ChannelStateData.prototype.channel = null; + + /** + * Encodes the specified ChannelStateData message. Does not implicitly {@link ibc.lightclients.solomachine.v1.ChannelStateData.verify|verify} messages. + * @function encode + * @memberof ibc.lightclients.solomachine.v1.ChannelStateData + * @static + * @param {ibc.lightclients.solomachine.v1.IChannelStateData} message ChannelStateData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ChannelStateData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.path); + if (message.channel != null && Object.hasOwnProperty.call(message, "channel")) + $root.ibc.core.channel.v1.Channel.encode(message.channel, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ChannelStateData message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.ChannelStateData.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.lightclients.solomachine.v1.ChannelStateData + * @static + * @param {ibc.lightclients.solomachine.v1.IChannelStateData} message ChannelStateData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ChannelStateData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ChannelStateData message from the specified reader or buffer. + * @function decode + * @memberof ibc.lightclients.solomachine.v1.ChannelStateData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.lightclients.solomachine.v1.ChannelStateData} ChannelStateData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ChannelStateData.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.ChannelStateData(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.bytes(); + break; + case 2: + message.channel = $root.ibc.core.channel.v1.Channel.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ChannelStateData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.lightclients.solomachine.v1.ChannelStateData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.lightclients.solomachine.v1.ChannelStateData} ChannelStateData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ChannelStateData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ChannelStateData message. + * @function verify + * @memberof ibc.lightclients.solomachine.v1.ChannelStateData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ChannelStateData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!(message.path && typeof message.path.length === "number" || $util.isString(message.path))) + return "path: buffer expected"; + if (message.channel != null && message.hasOwnProperty("channel")) { + let error = $root.ibc.core.channel.v1.Channel.verify(message.channel); + if (error) + return "channel." + error; + } + return null; + }; + + /** + * Creates a ChannelStateData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.lightclients.solomachine.v1.ChannelStateData + * @static + * @param {Object.} object Plain object + * @returns {ibc.lightclients.solomachine.v1.ChannelStateData} ChannelStateData + */ + ChannelStateData.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.lightclients.solomachine.v1.ChannelStateData) + return object; + let message = new $root.ibc.lightclients.solomachine.v1.ChannelStateData(); + if (object.path != null) + if (typeof object.path === "string") + $util.base64.decode(object.path, message.path = $util.newBuffer($util.base64.length(object.path)), 0); + else if (object.path.length) + message.path = object.path; + if (object.channel != null) { + if (typeof object.channel !== "object") + throw TypeError(".ibc.lightclients.solomachine.v1.ChannelStateData.channel: object expected"); + message.channel = $root.ibc.core.channel.v1.Channel.fromObject(object.channel); + } + return message; + }; + + /** + * Creates a plain object from a ChannelStateData message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.lightclients.solomachine.v1.ChannelStateData + * @static + * @param {ibc.lightclients.solomachine.v1.ChannelStateData} message ChannelStateData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ChannelStateData.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if (options.bytes === String) + object.path = ""; + else { + object.path = []; + if (options.bytes !== Array) + object.path = $util.newBuffer(object.path); + } + object.channel = null; + } + if (message.path != null && message.hasOwnProperty("path")) + object.path = options.bytes === String ? $util.base64.encode(message.path, 0, message.path.length) : options.bytes === Array ? Array.prototype.slice.call(message.path) : message.path; + if (message.channel != null && message.hasOwnProperty("channel")) + object.channel = $root.ibc.core.channel.v1.Channel.toObject(message.channel, options); + return object; + }; + + /** + * Converts this ChannelStateData to JSON. + * @function toJSON + * @memberof ibc.lightclients.solomachine.v1.ChannelStateData + * @instance + * @returns {Object.} JSON object + */ + ChannelStateData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ChannelStateData; + })(); + + v1.PacketCommitmentData = (function() { + + /** + * Properties of a PacketCommitmentData. + * @memberof ibc.lightclients.solomachine.v1 + * @interface IPacketCommitmentData + * @property {Uint8Array|null} [path] PacketCommitmentData path + * @property {Uint8Array|null} [commitment] PacketCommitmentData commitment + */ + + /** + * Constructs a new PacketCommitmentData. + * @memberof ibc.lightclients.solomachine.v1 + * @classdesc Represents a PacketCommitmentData. + * @implements IPacketCommitmentData + * @constructor + * @param {ibc.lightclients.solomachine.v1.IPacketCommitmentData=} [properties] Properties to set + */ + function PacketCommitmentData(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PacketCommitmentData path. + * @member {Uint8Array} path + * @memberof ibc.lightclients.solomachine.v1.PacketCommitmentData + * @instance + */ + PacketCommitmentData.prototype.path = $util.newBuffer([]); + + /** + * PacketCommitmentData commitment. + * @member {Uint8Array} commitment + * @memberof ibc.lightclients.solomachine.v1.PacketCommitmentData + * @instance + */ + PacketCommitmentData.prototype.commitment = $util.newBuffer([]); + + /** + * Encodes the specified PacketCommitmentData message. Does not implicitly {@link ibc.lightclients.solomachine.v1.PacketCommitmentData.verify|verify} messages. + * @function encode + * @memberof ibc.lightclients.solomachine.v1.PacketCommitmentData + * @static + * @param {ibc.lightclients.solomachine.v1.IPacketCommitmentData} message PacketCommitmentData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PacketCommitmentData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.path); + if (message.commitment != null && Object.hasOwnProperty.call(message, "commitment")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.commitment); + return writer; + }; + + /** + * Encodes the specified PacketCommitmentData message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.PacketCommitmentData.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.lightclients.solomachine.v1.PacketCommitmentData + * @static + * @param {ibc.lightclients.solomachine.v1.IPacketCommitmentData} message PacketCommitmentData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PacketCommitmentData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PacketCommitmentData message from the specified reader or buffer. + * @function decode + * @memberof ibc.lightclients.solomachine.v1.PacketCommitmentData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.lightclients.solomachine.v1.PacketCommitmentData} PacketCommitmentData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PacketCommitmentData.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.PacketCommitmentData(); + while (reader.pos < end) { + let 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; + }; + + /** + * Decodes a PacketCommitmentData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.lightclients.solomachine.v1.PacketCommitmentData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.lightclients.solomachine.v1.PacketCommitmentData} PacketCommitmentData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PacketCommitmentData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PacketCommitmentData message. + * @function verify + * @memberof ibc.lightclients.solomachine.v1.PacketCommitmentData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PacketCommitmentData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!(message.path && typeof message.path.length === "number" || $util.isString(message.path))) + return "path: buffer expected"; + if (message.commitment != null && message.hasOwnProperty("commitment")) + if (!(message.commitment && typeof message.commitment.length === "number" || $util.isString(message.commitment))) + return "commitment: buffer expected"; + return null; + }; + + /** + * Creates a PacketCommitmentData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.lightclients.solomachine.v1.PacketCommitmentData + * @static + * @param {Object.} object Plain object + * @returns {ibc.lightclients.solomachine.v1.PacketCommitmentData} PacketCommitmentData + */ + PacketCommitmentData.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.lightclients.solomachine.v1.PacketCommitmentData) + return object; + let message = new $root.ibc.lightclients.solomachine.v1.PacketCommitmentData(); + if (object.path != null) + if (typeof object.path === "string") + $util.base64.decode(object.path, message.path = $util.newBuffer($util.base64.length(object.path)), 0); + else if (object.path.length) + message.path = object.path; + if (object.commitment != null) + if (typeof object.commitment === "string") + $util.base64.decode(object.commitment, message.commitment = $util.newBuffer($util.base64.length(object.commitment)), 0); + else if (object.commitment.length) + message.commitment = object.commitment; + return message; + }; + + /** + * Creates a plain object from a PacketCommitmentData message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.lightclients.solomachine.v1.PacketCommitmentData + * @static + * @param {ibc.lightclients.solomachine.v1.PacketCommitmentData} message PacketCommitmentData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PacketCommitmentData.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if (options.bytes === String) + object.path = ""; + else { + object.path = []; + if (options.bytes !== Array) + object.path = $util.newBuffer(object.path); + } + if (options.bytes === String) + object.commitment = ""; + else { + object.commitment = []; + if (options.bytes !== Array) + object.commitment = $util.newBuffer(object.commitment); + } + } + if (message.path != null && message.hasOwnProperty("path")) + object.path = options.bytes === String ? $util.base64.encode(message.path, 0, message.path.length) : options.bytes === Array ? Array.prototype.slice.call(message.path) : message.path; + if (message.commitment != null && message.hasOwnProperty("commitment")) + object.commitment = options.bytes === String ? $util.base64.encode(message.commitment, 0, message.commitment.length) : options.bytes === Array ? Array.prototype.slice.call(message.commitment) : message.commitment; + return object; + }; + + /** + * Converts this PacketCommitmentData to JSON. + * @function toJSON + * @memberof ibc.lightclients.solomachine.v1.PacketCommitmentData + * @instance + * @returns {Object.} JSON object + */ + PacketCommitmentData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PacketCommitmentData; + })(); + + v1.PacketAcknowledgementData = (function() { + + /** + * Properties of a PacketAcknowledgementData. + * @memberof ibc.lightclients.solomachine.v1 + * @interface IPacketAcknowledgementData + * @property {Uint8Array|null} [path] PacketAcknowledgementData path + * @property {Uint8Array|null} [acknowledgement] PacketAcknowledgementData acknowledgement + */ + + /** + * Constructs a new PacketAcknowledgementData. + * @memberof ibc.lightclients.solomachine.v1 + * @classdesc Represents a PacketAcknowledgementData. + * @implements IPacketAcknowledgementData + * @constructor + * @param {ibc.lightclients.solomachine.v1.IPacketAcknowledgementData=} [properties] Properties to set + */ + function PacketAcknowledgementData(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PacketAcknowledgementData path. + * @member {Uint8Array} path + * @memberof ibc.lightclients.solomachine.v1.PacketAcknowledgementData + * @instance + */ + PacketAcknowledgementData.prototype.path = $util.newBuffer([]); + + /** + * PacketAcknowledgementData acknowledgement. + * @member {Uint8Array} acknowledgement + * @memberof ibc.lightclients.solomachine.v1.PacketAcknowledgementData + * @instance + */ + PacketAcknowledgementData.prototype.acknowledgement = $util.newBuffer([]); + + /** + * Encodes the specified PacketAcknowledgementData message. Does not implicitly {@link ibc.lightclients.solomachine.v1.PacketAcknowledgementData.verify|verify} messages. + * @function encode + * @memberof ibc.lightclients.solomachine.v1.PacketAcknowledgementData + * @static + * @param {ibc.lightclients.solomachine.v1.IPacketAcknowledgementData} message PacketAcknowledgementData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PacketAcknowledgementData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.path); + if (message.acknowledgement != null && Object.hasOwnProperty.call(message, "acknowledgement")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.acknowledgement); + return writer; + }; + + /** + * Encodes the specified PacketAcknowledgementData message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.PacketAcknowledgementData.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.lightclients.solomachine.v1.PacketAcknowledgementData + * @static + * @param {ibc.lightclients.solomachine.v1.IPacketAcknowledgementData} message PacketAcknowledgementData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PacketAcknowledgementData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PacketAcknowledgementData message from the specified reader or buffer. + * @function decode + * @memberof ibc.lightclients.solomachine.v1.PacketAcknowledgementData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.lightclients.solomachine.v1.PacketAcknowledgementData} PacketAcknowledgementData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PacketAcknowledgementData.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.PacketAcknowledgementData(); + while (reader.pos < end) { + let 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; + }; + + /** + * Decodes a PacketAcknowledgementData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.lightclients.solomachine.v1.PacketAcknowledgementData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.lightclients.solomachine.v1.PacketAcknowledgementData} PacketAcknowledgementData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PacketAcknowledgementData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PacketAcknowledgementData message. + * @function verify + * @memberof ibc.lightclients.solomachine.v1.PacketAcknowledgementData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PacketAcknowledgementData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!(message.path && typeof message.path.length === "number" || $util.isString(message.path))) + return "path: buffer expected"; + if (message.acknowledgement != null && message.hasOwnProperty("acknowledgement")) + if (!(message.acknowledgement && typeof message.acknowledgement.length === "number" || $util.isString(message.acknowledgement))) + return "acknowledgement: buffer expected"; + return null; + }; + + /** + * Creates a PacketAcknowledgementData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.lightclients.solomachine.v1.PacketAcknowledgementData + * @static + * @param {Object.} object Plain object + * @returns {ibc.lightclients.solomachine.v1.PacketAcknowledgementData} PacketAcknowledgementData + */ + PacketAcknowledgementData.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.lightclients.solomachine.v1.PacketAcknowledgementData) + return object; + let message = new $root.ibc.lightclients.solomachine.v1.PacketAcknowledgementData(); + if (object.path != null) + if (typeof object.path === "string") + $util.base64.decode(object.path, message.path = $util.newBuffer($util.base64.length(object.path)), 0); + else if (object.path.length) + message.path = object.path; + if (object.acknowledgement != null) + if (typeof object.acknowledgement === "string") + $util.base64.decode(object.acknowledgement, message.acknowledgement = $util.newBuffer($util.base64.length(object.acknowledgement)), 0); + else if (object.acknowledgement.length) + message.acknowledgement = object.acknowledgement; + return message; + }; + + /** + * Creates a plain object from a PacketAcknowledgementData message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.lightclients.solomachine.v1.PacketAcknowledgementData + * @static + * @param {ibc.lightclients.solomachine.v1.PacketAcknowledgementData} message PacketAcknowledgementData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PacketAcknowledgementData.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if (options.bytes === String) + object.path = ""; + else { + object.path = []; + if (options.bytes !== Array) + object.path = $util.newBuffer(object.path); + } + if (options.bytes === String) + object.acknowledgement = ""; + else { + object.acknowledgement = []; + if (options.bytes !== Array) + object.acknowledgement = $util.newBuffer(object.acknowledgement); + } + } + if (message.path != null && message.hasOwnProperty("path")) + object.path = options.bytes === String ? $util.base64.encode(message.path, 0, message.path.length) : options.bytes === Array ? Array.prototype.slice.call(message.path) : message.path; + if (message.acknowledgement != null && message.hasOwnProperty("acknowledgement")) + object.acknowledgement = options.bytes === String ? $util.base64.encode(message.acknowledgement, 0, message.acknowledgement.length) : options.bytes === Array ? Array.prototype.slice.call(message.acknowledgement) : message.acknowledgement; + return object; + }; + + /** + * Converts this PacketAcknowledgementData to JSON. + * @function toJSON + * @memberof ibc.lightclients.solomachine.v1.PacketAcknowledgementData + * @instance + * @returns {Object.} JSON object + */ + PacketAcknowledgementData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PacketAcknowledgementData; + })(); + + v1.PacketReceiptAbsenceData = (function() { + + /** + * Properties of a PacketReceiptAbsenceData. + * @memberof ibc.lightclients.solomachine.v1 + * @interface IPacketReceiptAbsenceData + * @property {Uint8Array|null} [path] PacketReceiptAbsenceData path + */ + + /** + * Constructs a new PacketReceiptAbsenceData. + * @memberof ibc.lightclients.solomachine.v1 + * @classdesc Represents a PacketReceiptAbsenceData. + * @implements IPacketReceiptAbsenceData + * @constructor + * @param {ibc.lightclients.solomachine.v1.IPacketReceiptAbsenceData=} [properties] Properties to set + */ + function PacketReceiptAbsenceData(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PacketReceiptAbsenceData path. + * @member {Uint8Array} path + * @memberof ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData + * @instance + */ + PacketReceiptAbsenceData.prototype.path = $util.newBuffer([]); + + /** + * Encodes the specified PacketReceiptAbsenceData message. Does not implicitly {@link ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData.verify|verify} messages. + * @function encode + * @memberof ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData + * @static + * @param {ibc.lightclients.solomachine.v1.IPacketReceiptAbsenceData} message PacketReceiptAbsenceData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PacketReceiptAbsenceData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.path); + return writer; + }; + + /** + * Encodes the specified PacketReceiptAbsenceData message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData + * @static + * @param {ibc.lightclients.solomachine.v1.IPacketReceiptAbsenceData} message PacketReceiptAbsenceData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PacketReceiptAbsenceData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PacketReceiptAbsenceData message from the specified reader or buffer. + * @function decode + * @memberof ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData} PacketReceiptAbsenceData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PacketReceiptAbsenceData.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PacketReceiptAbsenceData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData} PacketReceiptAbsenceData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PacketReceiptAbsenceData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PacketReceiptAbsenceData message. + * @function verify + * @memberof ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PacketReceiptAbsenceData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!(message.path && typeof message.path.length === "number" || $util.isString(message.path))) + return "path: buffer expected"; + return null; + }; + + /** + * Creates a PacketReceiptAbsenceData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData + * @static + * @param {Object.} object Plain object + * @returns {ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData} PacketReceiptAbsenceData + */ + PacketReceiptAbsenceData.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData) + return object; + let message = new $root.ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData(); + if (object.path != null) + if (typeof object.path === "string") + $util.base64.decode(object.path, message.path = $util.newBuffer($util.base64.length(object.path)), 0); + else if (object.path.length) + message.path = object.path; + return message; + }; + + /** + * Creates a plain object from a PacketReceiptAbsenceData message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData + * @static + * @param {ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData} message PacketReceiptAbsenceData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PacketReceiptAbsenceData.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + if (options.bytes === String) + object.path = ""; + else { + object.path = []; + if (options.bytes !== Array) + object.path = $util.newBuffer(object.path); + } + if (message.path != null && message.hasOwnProperty("path")) + object.path = options.bytes === String ? $util.base64.encode(message.path, 0, message.path.length) : options.bytes === Array ? Array.prototype.slice.call(message.path) : message.path; + return object; + }; + + /** + * Converts this PacketReceiptAbsenceData to JSON. + * @function toJSON + * @memberof ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData + * @instance + * @returns {Object.} JSON object + */ + PacketReceiptAbsenceData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PacketReceiptAbsenceData; + })(); + + v1.NextSequenceRecvData = (function() { + + /** + * Properties of a NextSequenceRecvData. + * @memberof ibc.lightclients.solomachine.v1 + * @interface INextSequenceRecvData + * @property {Uint8Array|null} [path] NextSequenceRecvData path + * @property {Long|null} [next_seq_recv] NextSequenceRecvData next_seq_recv + */ + + /** + * Constructs a new NextSequenceRecvData. + * @memberof ibc.lightclients.solomachine.v1 + * @classdesc Represents a NextSequenceRecvData. + * @implements INextSequenceRecvData + * @constructor + * @param {ibc.lightclients.solomachine.v1.INextSequenceRecvData=} [properties] Properties to set + */ + function NextSequenceRecvData(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NextSequenceRecvData path. + * @member {Uint8Array} path + * @memberof ibc.lightclients.solomachine.v1.NextSequenceRecvData + * @instance + */ + NextSequenceRecvData.prototype.path = $util.newBuffer([]); + + /** + * NextSequenceRecvData next_seq_recv. + * @member {Long} next_seq_recv + * @memberof ibc.lightclients.solomachine.v1.NextSequenceRecvData + * @instance + */ + NextSequenceRecvData.prototype.next_seq_recv = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified NextSequenceRecvData message. Does not implicitly {@link ibc.lightclients.solomachine.v1.NextSequenceRecvData.verify|verify} messages. + * @function encode + * @memberof ibc.lightclients.solomachine.v1.NextSequenceRecvData + * @static + * @param {ibc.lightclients.solomachine.v1.INextSequenceRecvData} message NextSequenceRecvData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NextSequenceRecvData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.path); + if (message.next_seq_recv != null && Object.hasOwnProperty.call(message, "next_seq_recv")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.next_seq_recv); + return writer; + }; + + /** + * Encodes the specified NextSequenceRecvData message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.NextSequenceRecvData.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.lightclients.solomachine.v1.NextSequenceRecvData + * @static + * @param {ibc.lightclients.solomachine.v1.INextSequenceRecvData} message NextSequenceRecvData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NextSequenceRecvData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NextSequenceRecvData message from the specified reader or buffer. + * @function decode + * @memberof ibc.lightclients.solomachine.v1.NextSequenceRecvData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.lightclients.solomachine.v1.NextSequenceRecvData} NextSequenceRecvData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NextSequenceRecvData.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.NextSequenceRecvData(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.path = reader.bytes(); + break; + case 2: + message.next_seq_recv = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NextSequenceRecvData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.lightclients.solomachine.v1.NextSequenceRecvData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.lightclients.solomachine.v1.NextSequenceRecvData} NextSequenceRecvData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NextSequenceRecvData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NextSequenceRecvData message. + * @function verify + * @memberof ibc.lightclients.solomachine.v1.NextSequenceRecvData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NextSequenceRecvData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!(message.path && typeof message.path.length === "number" || $util.isString(message.path))) + return "path: buffer expected"; + if (message.next_seq_recv != null && message.hasOwnProperty("next_seq_recv")) + if (!$util.isInteger(message.next_seq_recv) && !(message.next_seq_recv && $util.isInteger(message.next_seq_recv.low) && $util.isInteger(message.next_seq_recv.high))) + return "next_seq_recv: integer|Long expected"; + return null; + }; + + /** + * Creates a NextSequenceRecvData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.lightclients.solomachine.v1.NextSequenceRecvData + * @static + * @param {Object.} object Plain object + * @returns {ibc.lightclients.solomachine.v1.NextSequenceRecvData} NextSequenceRecvData + */ + NextSequenceRecvData.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.lightclients.solomachine.v1.NextSequenceRecvData) + return object; + let message = new $root.ibc.lightclients.solomachine.v1.NextSequenceRecvData(); + if (object.path != null) + if (typeof object.path === "string") + $util.base64.decode(object.path, message.path = $util.newBuffer($util.base64.length(object.path)), 0); + else if (object.path.length) + message.path = object.path; + if (object.next_seq_recv != null) + if ($util.Long) + (message.next_seq_recv = $util.Long.fromValue(object.next_seq_recv)).unsigned = true; + else if (typeof object.next_seq_recv === "string") + message.next_seq_recv = parseInt(object.next_seq_recv, 10); + else if (typeof object.next_seq_recv === "number") + message.next_seq_recv = object.next_seq_recv; + else if (typeof object.next_seq_recv === "object") + message.next_seq_recv = new $util.LongBits(object.next_seq_recv.low >>> 0, object.next_seq_recv.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a NextSequenceRecvData message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.lightclients.solomachine.v1.NextSequenceRecvData + * @static + * @param {ibc.lightclients.solomachine.v1.NextSequenceRecvData} message NextSequenceRecvData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NextSequenceRecvData.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if (options.bytes === String) + object.path = ""; + else { + object.path = []; + if (options.bytes !== Array) + object.path = $util.newBuffer(object.path); + } + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.next_seq_recv = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.next_seq_recv = options.longs === String ? "0" : 0; + } + if (message.path != null && message.hasOwnProperty("path")) + object.path = options.bytes === String ? $util.base64.encode(message.path, 0, message.path.length) : options.bytes === Array ? Array.prototype.slice.call(message.path) : message.path; + if (message.next_seq_recv != null && message.hasOwnProperty("next_seq_recv")) + if (typeof message.next_seq_recv === "number") + object.next_seq_recv = options.longs === String ? String(message.next_seq_recv) : message.next_seq_recv; + else + object.next_seq_recv = options.longs === String ? $util.Long.prototype.toString.call(message.next_seq_recv) : options.longs === Number ? new $util.LongBits(message.next_seq_recv.low >>> 0, message.next_seq_recv.high >>> 0).toNumber(true) : message.next_seq_recv; + return object; + }; + + /** + * Converts this NextSequenceRecvData to JSON. + * @function toJSON + * @memberof ibc.lightclients.solomachine.v1.NextSequenceRecvData + * @instance + * @returns {Object.} JSON object + */ + NextSequenceRecvData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return NextSequenceRecvData; + })(); + + return v1; + })(); + + return solomachine; + })(); + + lightclients.tendermint = (function() { + + /** + * Namespace tendermint. + * @memberof ibc.lightclients + * @namespace + */ + const tendermint = {}; + + tendermint.v1 = (function() { + + /** + * Namespace v1. + * @memberof ibc.lightclients.tendermint + * @namespace + */ + const v1 = {}; + + v1.ClientState = (function() { + + /** + * Properties of a ClientState. + * @memberof ibc.lightclients.tendermint.v1 + * @interface IClientState + * @property {string|null} [chain_id] ClientState chain_id + * @property {ibc.lightclients.tendermint.v1.IFraction|null} [trust_level] ClientState trust_level + * @property {google.protobuf.IDuration|null} [trusting_period] ClientState trusting_period + * @property {google.protobuf.IDuration|null} [unbonding_period] ClientState unbonding_period + * @property {google.protobuf.IDuration|null} [max_clock_drift] ClientState max_clock_drift + * @property {ibc.core.client.v1.IHeight|null} [frozen_height] ClientState frozen_height + * @property {ibc.core.client.v1.IHeight|null} [latest_height] ClientState latest_height + * @property {Array.|null} [proof_specs] ClientState proof_specs + * @property {Array.|null} [upgrade_path] ClientState upgrade_path + * @property {boolean|null} [allow_update_after_expiry] ClientState allow_update_after_expiry + * @property {boolean|null} [allow_update_after_misbehaviour] ClientState allow_update_after_misbehaviour + */ + + /** + * Constructs a new ClientState. + * @memberof ibc.lightclients.tendermint.v1 + * @classdesc Represents a ClientState. + * @implements IClientState + * @constructor + * @param {ibc.lightclients.tendermint.v1.IClientState=} [properties] Properties to set + */ + function ClientState(properties) { + this.proof_specs = []; + this.upgrade_path = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ClientState chain_id. + * @member {string} chain_id + * @memberof ibc.lightclients.tendermint.v1.ClientState + * @instance + */ + ClientState.prototype.chain_id = ""; + + /** + * ClientState trust_level. + * @member {ibc.lightclients.tendermint.v1.IFraction|null|undefined} trust_level + * @memberof ibc.lightclients.tendermint.v1.ClientState + * @instance + */ + ClientState.prototype.trust_level = null; + + /** + * ClientState trusting_period. + * @member {google.protobuf.IDuration|null|undefined} trusting_period + * @memberof ibc.lightclients.tendermint.v1.ClientState + * @instance + */ + ClientState.prototype.trusting_period = null; + + /** + * ClientState unbonding_period. + * @member {google.protobuf.IDuration|null|undefined} unbonding_period + * @memberof ibc.lightclients.tendermint.v1.ClientState + * @instance + */ + ClientState.prototype.unbonding_period = null; + + /** + * ClientState max_clock_drift. + * @member {google.protobuf.IDuration|null|undefined} max_clock_drift + * @memberof ibc.lightclients.tendermint.v1.ClientState + * @instance + */ + ClientState.prototype.max_clock_drift = null; + + /** + * ClientState frozen_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} frozen_height + * @memberof ibc.lightclients.tendermint.v1.ClientState + * @instance + */ + ClientState.prototype.frozen_height = null; + + /** + * ClientState latest_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} latest_height + * @memberof ibc.lightclients.tendermint.v1.ClientState + * @instance + */ + ClientState.prototype.latest_height = null; + + /** + * ClientState proof_specs. + * @member {Array.} proof_specs + * @memberof ibc.lightclients.tendermint.v1.ClientState + * @instance + */ + ClientState.prototype.proof_specs = $util.emptyArray; + + /** + * ClientState upgrade_path. + * @member {Array.} upgrade_path + * @memberof ibc.lightclients.tendermint.v1.ClientState + * @instance + */ + ClientState.prototype.upgrade_path = $util.emptyArray; + + /** + * ClientState allow_update_after_expiry. + * @member {boolean} allow_update_after_expiry + * @memberof ibc.lightclients.tendermint.v1.ClientState + * @instance + */ + ClientState.prototype.allow_update_after_expiry = false; + + /** + * ClientState allow_update_after_misbehaviour. + * @member {boolean} allow_update_after_misbehaviour + * @memberof ibc.lightclients.tendermint.v1.ClientState + * @instance + */ + ClientState.prototype.allow_update_after_misbehaviour = false; + + /** + * Encodes the specified ClientState message. Does not implicitly {@link ibc.lightclients.tendermint.v1.ClientState.verify|verify} messages. + * @function encode + * @memberof ibc.lightclients.tendermint.v1.ClientState + * @static + * @param {ibc.lightclients.tendermint.v1.IClientState} message ClientState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClientState.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.chain_id != null && Object.hasOwnProperty.call(message, "chain_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.chain_id); + if (message.trust_level != null && Object.hasOwnProperty.call(message, "trust_level")) + $root.ibc.lightclients.tendermint.v1.Fraction.encode(message.trust_level, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.trusting_period != null && Object.hasOwnProperty.call(message, "trusting_period")) + $root.google.protobuf.Duration.encode(message.trusting_period, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.unbonding_period != null && Object.hasOwnProperty.call(message, "unbonding_period")) + $root.google.protobuf.Duration.encode(message.unbonding_period, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.max_clock_drift != null && Object.hasOwnProperty.call(message, "max_clock_drift")) + $root.google.protobuf.Duration.encode(message.max_clock_drift, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.frozen_height != null && Object.hasOwnProperty.call(message, "frozen_height")) + $root.ibc.core.client.v1.Height.encode(message.frozen_height, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.latest_height != null && Object.hasOwnProperty.call(message, "latest_height")) + $root.ibc.core.client.v1.Height.encode(message.latest_height, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.proof_specs != null && message.proof_specs.length) + for (let i = 0; i < message.proof_specs.length; ++i) + $root.ics23.ProofSpec.encode(message.proof_specs[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.upgrade_path != null && message.upgrade_path.length) + for (let i = 0; i < message.upgrade_path.length; ++i) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.upgrade_path[i]); + if (message.allow_update_after_expiry != null && Object.hasOwnProperty.call(message, "allow_update_after_expiry")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.allow_update_after_expiry); + if (message.allow_update_after_misbehaviour != null && Object.hasOwnProperty.call(message, "allow_update_after_misbehaviour")) + writer.uint32(/* id 11, wireType 0 =*/88).bool(message.allow_update_after_misbehaviour); + return writer; + }; + + /** + * Encodes the specified ClientState message, length delimited. Does not implicitly {@link ibc.lightclients.tendermint.v1.ClientState.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.lightclients.tendermint.v1.ClientState + * @static + * @param {ibc.lightclients.tendermint.v1.IClientState} message ClientState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClientState.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ClientState message from the specified reader or buffer. + * @function decode + * @memberof ibc.lightclients.tendermint.v1.ClientState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.lightclients.tendermint.v1.ClientState} ClientState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClientState.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.tendermint.v1.ClientState(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.chain_id = reader.string(); + break; + case 2: + message.trust_level = $root.ibc.lightclients.tendermint.v1.Fraction.decode(reader, reader.uint32()); + break; + case 3: + message.trusting_period = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + case 4: + message.unbonding_period = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + case 5: + message.max_clock_drift = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + case 6: + message.frozen_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + case 7: + message.latest_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + case 8: + if (!(message.proof_specs && message.proof_specs.length)) + message.proof_specs = []; + message.proof_specs.push($root.ics23.ProofSpec.decode(reader, reader.uint32())); + break; + case 9: + if (!(message.upgrade_path && message.upgrade_path.length)) + message.upgrade_path = []; + message.upgrade_path.push(reader.string()); + break; + case 10: + message.allow_update_after_expiry = reader.bool(); + break; + case 11: + message.allow_update_after_misbehaviour = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ClientState message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.lightclients.tendermint.v1.ClientState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.lightclients.tendermint.v1.ClientState} ClientState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClientState.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ClientState message. + * @function verify + * @memberof ibc.lightclients.tendermint.v1.ClientState + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ClientState.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.chain_id != null && message.hasOwnProperty("chain_id")) + if (!$util.isString(message.chain_id)) + return "chain_id: string expected"; + if (message.trust_level != null && message.hasOwnProperty("trust_level")) { + let error = $root.ibc.lightclients.tendermint.v1.Fraction.verify(message.trust_level); + if (error) + return "trust_level." + error; + } + if (message.trusting_period != null && message.hasOwnProperty("trusting_period")) { + let error = $root.google.protobuf.Duration.verify(message.trusting_period); + if (error) + return "trusting_period." + error; + } + if (message.unbonding_period != null && message.hasOwnProperty("unbonding_period")) { + let error = $root.google.protobuf.Duration.verify(message.unbonding_period); + if (error) + return "unbonding_period." + error; + } + if (message.max_clock_drift != null && message.hasOwnProperty("max_clock_drift")) { + let error = $root.google.protobuf.Duration.verify(message.max_clock_drift); + if (error) + return "max_clock_drift." + error; + } + if (message.frozen_height != null && message.hasOwnProperty("frozen_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.frozen_height); + if (error) + return "frozen_height." + error; + } + if (message.latest_height != null && message.hasOwnProperty("latest_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.latest_height); + if (error) + return "latest_height." + error; + } + if (message.proof_specs != null && message.hasOwnProperty("proof_specs")) { + if (!Array.isArray(message.proof_specs)) + return "proof_specs: array expected"; + for (let i = 0; i < message.proof_specs.length; ++i) { + let error = $root.ics23.ProofSpec.verify(message.proof_specs[i]); + if (error) + return "proof_specs." + error; + } + } + if (message.upgrade_path != null && message.hasOwnProperty("upgrade_path")) { + if (!Array.isArray(message.upgrade_path)) + return "upgrade_path: array expected"; + for (let i = 0; i < message.upgrade_path.length; ++i) + if (!$util.isString(message.upgrade_path[i])) + return "upgrade_path: string[] expected"; + } + if (message.allow_update_after_expiry != null && message.hasOwnProperty("allow_update_after_expiry")) + if (typeof message.allow_update_after_expiry !== "boolean") + return "allow_update_after_expiry: boolean expected"; + if (message.allow_update_after_misbehaviour != null && message.hasOwnProperty("allow_update_after_misbehaviour")) + if (typeof message.allow_update_after_misbehaviour !== "boolean") + return "allow_update_after_misbehaviour: boolean expected"; + return null; + }; + + /** + * Creates a ClientState message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.lightclients.tendermint.v1.ClientState + * @static + * @param {Object.} object Plain object + * @returns {ibc.lightclients.tendermint.v1.ClientState} ClientState + */ + ClientState.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.lightclients.tendermint.v1.ClientState) + return object; + let message = new $root.ibc.lightclients.tendermint.v1.ClientState(); + if (object.chain_id != null) + message.chain_id = String(object.chain_id); + if (object.trust_level != null) { + if (typeof object.trust_level !== "object") + throw TypeError(".ibc.lightclients.tendermint.v1.ClientState.trust_level: object expected"); + message.trust_level = $root.ibc.lightclients.tendermint.v1.Fraction.fromObject(object.trust_level); + } + if (object.trusting_period != null) { + if (typeof object.trusting_period !== "object") + throw TypeError(".ibc.lightclients.tendermint.v1.ClientState.trusting_period: object expected"); + message.trusting_period = $root.google.protobuf.Duration.fromObject(object.trusting_period); + } + if (object.unbonding_period != null) { + if (typeof object.unbonding_period !== "object") + throw TypeError(".ibc.lightclients.tendermint.v1.ClientState.unbonding_period: object expected"); + message.unbonding_period = $root.google.protobuf.Duration.fromObject(object.unbonding_period); + } + if (object.max_clock_drift != null) { + if (typeof object.max_clock_drift !== "object") + throw TypeError(".ibc.lightclients.tendermint.v1.ClientState.max_clock_drift: object expected"); + message.max_clock_drift = $root.google.protobuf.Duration.fromObject(object.max_clock_drift); + } + if (object.frozen_height != null) { + if (typeof object.frozen_height !== "object") + throw TypeError(".ibc.lightclients.tendermint.v1.ClientState.frozen_height: object expected"); + message.frozen_height = $root.ibc.core.client.v1.Height.fromObject(object.frozen_height); + } + if (object.latest_height != null) { + if (typeof object.latest_height !== "object") + throw TypeError(".ibc.lightclients.tendermint.v1.ClientState.latest_height: object expected"); + message.latest_height = $root.ibc.core.client.v1.Height.fromObject(object.latest_height); + } + if (object.proof_specs) { + if (!Array.isArray(object.proof_specs)) + throw TypeError(".ibc.lightclients.tendermint.v1.ClientState.proof_specs: array expected"); + message.proof_specs = []; + for (let i = 0; i < object.proof_specs.length; ++i) { + if (typeof object.proof_specs[i] !== "object") + throw TypeError(".ibc.lightclients.tendermint.v1.ClientState.proof_specs: object expected"); + message.proof_specs[i] = $root.ics23.ProofSpec.fromObject(object.proof_specs[i]); + } + } + if (object.upgrade_path) { + if (!Array.isArray(object.upgrade_path)) + throw TypeError(".ibc.lightclients.tendermint.v1.ClientState.upgrade_path: array expected"); + message.upgrade_path = []; + for (let i = 0; i < object.upgrade_path.length; ++i) + message.upgrade_path[i] = String(object.upgrade_path[i]); + } + if (object.allow_update_after_expiry != null) + message.allow_update_after_expiry = Boolean(object.allow_update_after_expiry); + if (object.allow_update_after_misbehaviour != null) + message.allow_update_after_misbehaviour = Boolean(object.allow_update_after_misbehaviour); + return message; + }; + + /** + * Creates a plain object from a ClientState message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.lightclients.tendermint.v1.ClientState + * @static + * @param {ibc.lightclients.tendermint.v1.ClientState} message ClientState + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ClientState.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) { + object.proof_specs = []; + object.upgrade_path = []; + } + if (options.defaults) { + object.chain_id = ""; + object.trust_level = null; + object.trusting_period = null; + object.unbonding_period = null; + object.max_clock_drift = null; + object.frozen_height = null; + object.latest_height = null; + object.allow_update_after_expiry = false; + object.allow_update_after_misbehaviour = false; + } + if (message.chain_id != null && message.hasOwnProperty("chain_id")) + object.chain_id = message.chain_id; + if (message.trust_level != null && message.hasOwnProperty("trust_level")) + object.trust_level = $root.ibc.lightclients.tendermint.v1.Fraction.toObject(message.trust_level, options); + if (message.trusting_period != null && message.hasOwnProperty("trusting_period")) + object.trusting_period = $root.google.protobuf.Duration.toObject(message.trusting_period, options); + if (message.unbonding_period != null && message.hasOwnProperty("unbonding_period")) + object.unbonding_period = $root.google.protobuf.Duration.toObject(message.unbonding_period, options); + if (message.max_clock_drift != null && message.hasOwnProperty("max_clock_drift")) + object.max_clock_drift = $root.google.protobuf.Duration.toObject(message.max_clock_drift, options); + if (message.frozen_height != null && message.hasOwnProperty("frozen_height")) + object.frozen_height = $root.ibc.core.client.v1.Height.toObject(message.frozen_height, options); + if (message.latest_height != null && message.hasOwnProperty("latest_height")) + object.latest_height = $root.ibc.core.client.v1.Height.toObject(message.latest_height, options); + if (message.proof_specs && message.proof_specs.length) { + object.proof_specs = []; + for (let j = 0; j < message.proof_specs.length; ++j) + object.proof_specs[j] = $root.ics23.ProofSpec.toObject(message.proof_specs[j], options); + } + if (message.upgrade_path && message.upgrade_path.length) { + object.upgrade_path = []; + for (let j = 0; j < message.upgrade_path.length; ++j) + object.upgrade_path[j] = message.upgrade_path[j]; + } + if (message.allow_update_after_expiry != null && message.hasOwnProperty("allow_update_after_expiry")) + object.allow_update_after_expiry = message.allow_update_after_expiry; + if (message.allow_update_after_misbehaviour != null && message.hasOwnProperty("allow_update_after_misbehaviour")) + object.allow_update_after_misbehaviour = message.allow_update_after_misbehaviour; + return object; + }; + + /** + * Converts this ClientState to JSON. + * @function toJSON + * @memberof ibc.lightclients.tendermint.v1.ClientState + * @instance + * @returns {Object.} JSON object + */ + ClientState.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ClientState; + })(); + + v1.ConsensusState = (function() { + + /** + * Properties of a ConsensusState. + * @memberof ibc.lightclients.tendermint.v1 + * @interface IConsensusState + * @property {google.protobuf.ITimestamp|null} [timestamp] ConsensusState timestamp + * @property {ibc.core.commitment.v1.IMerkleRoot|null} [root] ConsensusState root + * @property {Uint8Array|null} [next_validators_hash] ConsensusState next_validators_hash + */ + + /** + * Constructs a new ConsensusState. + * @memberof ibc.lightclients.tendermint.v1 + * @classdesc Represents a ConsensusState. + * @implements IConsensusState + * @constructor + * @param {ibc.lightclients.tendermint.v1.IConsensusState=} [properties] Properties to set + */ + function ConsensusState(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConsensusState timestamp. + * @member {google.protobuf.ITimestamp|null|undefined} timestamp + * @memberof ibc.lightclients.tendermint.v1.ConsensusState + * @instance + */ + ConsensusState.prototype.timestamp = null; + + /** + * ConsensusState root. + * @member {ibc.core.commitment.v1.IMerkleRoot|null|undefined} root + * @memberof ibc.lightclients.tendermint.v1.ConsensusState + * @instance + */ + ConsensusState.prototype.root = null; + + /** + * ConsensusState next_validators_hash. + * @member {Uint8Array} next_validators_hash + * @memberof ibc.lightclients.tendermint.v1.ConsensusState + * @instance + */ + ConsensusState.prototype.next_validators_hash = $util.newBuffer([]); + + /** + * Encodes the specified ConsensusState message. Does not implicitly {@link ibc.lightclients.tendermint.v1.ConsensusState.verify|verify} messages. + * @function encode + * @memberof ibc.lightclients.tendermint.v1.ConsensusState + * @static + * @param {ibc.lightclients.tendermint.v1.IConsensusState} message ConsensusState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConsensusState.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) + $root.google.protobuf.Timestamp.encode(message.timestamp, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.root != null && Object.hasOwnProperty.call(message, "root")) + $root.ibc.core.commitment.v1.MerkleRoot.encode(message.root, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.next_validators_hash != null && Object.hasOwnProperty.call(message, "next_validators_hash")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.next_validators_hash); + return writer; + }; + + /** + * Encodes the specified ConsensusState message, length delimited. Does not implicitly {@link ibc.lightclients.tendermint.v1.ConsensusState.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.lightclients.tendermint.v1.ConsensusState + * @static + * @param {ibc.lightclients.tendermint.v1.IConsensusState} message ConsensusState message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConsensusState.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConsensusState message from the specified reader or buffer. + * @function decode + * @memberof ibc.lightclients.tendermint.v1.ConsensusState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.lightclients.tendermint.v1.ConsensusState} ConsensusState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConsensusState.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.tendermint.v1.ConsensusState(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.timestamp = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 2: + message.root = $root.ibc.core.commitment.v1.MerkleRoot.decode(reader, reader.uint32()); + break; + case 3: + message.next_validators_hash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConsensusState message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.lightclients.tendermint.v1.ConsensusState + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.lightclients.tendermint.v1.ConsensusState} ConsensusState + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConsensusState.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConsensusState message. + * @function verify + * @memberof ibc.lightclients.tendermint.v1.ConsensusState + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConsensusState.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) { + let error = $root.google.protobuf.Timestamp.verify(message.timestamp); + if (error) + return "timestamp." + error; + } + if (message.root != null && message.hasOwnProperty("root")) { + let error = $root.ibc.core.commitment.v1.MerkleRoot.verify(message.root); + if (error) + return "root." + error; + } + if (message.next_validators_hash != null && message.hasOwnProperty("next_validators_hash")) + if (!(message.next_validators_hash && typeof message.next_validators_hash.length === "number" || $util.isString(message.next_validators_hash))) + return "next_validators_hash: buffer expected"; + return null; + }; + + /** + * Creates a ConsensusState message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.lightclients.tendermint.v1.ConsensusState + * @static + * @param {Object.} object Plain object + * @returns {ibc.lightclients.tendermint.v1.ConsensusState} ConsensusState + */ + ConsensusState.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.lightclients.tendermint.v1.ConsensusState) + return object; + let message = new $root.ibc.lightclients.tendermint.v1.ConsensusState(); + if (object.timestamp != null) { + if (typeof object.timestamp !== "object") + throw TypeError(".ibc.lightclients.tendermint.v1.ConsensusState.timestamp: object expected"); + message.timestamp = $root.google.protobuf.Timestamp.fromObject(object.timestamp); + } + if (object.root != null) { + if (typeof object.root !== "object") + throw TypeError(".ibc.lightclients.tendermint.v1.ConsensusState.root: object expected"); + message.root = $root.ibc.core.commitment.v1.MerkleRoot.fromObject(object.root); + } + if (object.next_validators_hash != null) + if (typeof object.next_validators_hash === "string") + $util.base64.decode(object.next_validators_hash, message.next_validators_hash = $util.newBuffer($util.base64.length(object.next_validators_hash)), 0); + else if (object.next_validators_hash.length) + message.next_validators_hash = object.next_validators_hash; + return message; + }; + + /** + * Creates a plain object from a ConsensusState message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.lightclients.tendermint.v1.ConsensusState + * @static + * @param {ibc.lightclients.tendermint.v1.ConsensusState} message ConsensusState + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConsensusState.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.timestamp = null; + object.root = null; + if (options.bytes === String) + object.next_validators_hash = ""; + else { + object.next_validators_hash = []; + if (options.bytes !== Array) + object.next_validators_hash = $util.newBuffer(object.next_validators_hash); + } + } + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + object.timestamp = $root.google.protobuf.Timestamp.toObject(message.timestamp, options); + if (message.root != null && message.hasOwnProperty("root")) + object.root = $root.ibc.core.commitment.v1.MerkleRoot.toObject(message.root, options); + if (message.next_validators_hash != null && message.hasOwnProperty("next_validators_hash")) + object.next_validators_hash = options.bytes === String ? $util.base64.encode(message.next_validators_hash, 0, message.next_validators_hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.next_validators_hash) : message.next_validators_hash; + return object; + }; + + /** + * Converts this ConsensusState to JSON. + * @function toJSON + * @memberof ibc.lightclients.tendermint.v1.ConsensusState + * @instance + * @returns {Object.} JSON object + */ + ConsensusState.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ConsensusState; + })(); + + v1.Misbehaviour = (function() { + + /** + * Properties of a Misbehaviour. + * @memberof ibc.lightclients.tendermint.v1 + * @interface IMisbehaviour + * @property {string|null} [client_id] Misbehaviour client_id + * @property {ibc.lightclients.tendermint.v1.IHeader|null} [header_1] Misbehaviour header_1 + * @property {ibc.lightclients.tendermint.v1.IHeader|null} [header_2] Misbehaviour header_2 + */ + + /** + * Constructs a new Misbehaviour. + * @memberof ibc.lightclients.tendermint.v1 + * @classdesc Represents a Misbehaviour. + * @implements IMisbehaviour + * @constructor + * @param {ibc.lightclients.tendermint.v1.IMisbehaviour=} [properties] Properties to set + */ + function Misbehaviour(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Misbehaviour client_id. + * @member {string} client_id + * @memberof ibc.lightclients.tendermint.v1.Misbehaviour + * @instance + */ + Misbehaviour.prototype.client_id = ""; + + /** + * Misbehaviour header_1. + * @member {ibc.lightclients.tendermint.v1.IHeader|null|undefined} header_1 + * @memberof ibc.lightclients.tendermint.v1.Misbehaviour + * @instance + */ + Misbehaviour.prototype.header_1 = null; + + /** + * Misbehaviour header_2. + * @member {ibc.lightclients.tendermint.v1.IHeader|null|undefined} header_2 + * @memberof ibc.lightclients.tendermint.v1.Misbehaviour + * @instance + */ + Misbehaviour.prototype.header_2 = null; + + /** + * Encodes the specified Misbehaviour message. Does not implicitly {@link ibc.lightclients.tendermint.v1.Misbehaviour.verify|verify} messages. + * @function encode + * @memberof ibc.lightclients.tendermint.v1.Misbehaviour + * @static + * @param {ibc.lightclients.tendermint.v1.IMisbehaviour} message Misbehaviour message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Misbehaviour.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); + if (message.header_1 != null && Object.hasOwnProperty.call(message, "header_1")) + $root.ibc.lightclients.tendermint.v1.Header.encode(message.header_1, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.header_2 != null && Object.hasOwnProperty.call(message, "header_2")) + $root.ibc.lightclients.tendermint.v1.Header.encode(message.header_2, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Misbehaviour message, length delimited. Does not implicitly {@link ibc.lightclients.tendermint.v1.Misbehaviour.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.lightclients.tendermint.v1.Misbehaviour + * @static + * @param {ibc.lightclients.tendermint.v1.IMisbehaviour} message Misbehaviour message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Misbehaviour.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Misbehaviour message from the specified reader or buffer. + * @function decode + * @memberof ibc.lightclients.tendermint.v1.Misbehaviour + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.lightclients.tendermint.v1.Misbehaviour} Misbehaviour + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Misbehaviour.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.tendermint.v1.Misbehaviour(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.client_id = reader.string(); + break; + case 2: + message.header_1 = $root.ibc.lightclients.tendermint.v1.Header.decode(reader, reader.uint32()); + break; + case 3: + message.header_2 = $root.ibc.lightclients.tendermint.v1.Header.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Misbehaviour message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.lightclients.tendermint.v1.Misbehaviour + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.lightclients.tendermint.v1.Misbehaviour} Misbehaviour + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Misbehaviour.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Misbehaviour message. + * @function verify + * @memberof ibc.lightclients.tendermint.v1.Misbehaviour + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Misbehaviour.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.client_id != null && message.hasOwnProperty("client_id")) + if (!$util.isString(message.client_id)) + return "client_id: string expected"; + if (message.header_1 != null && message.hasOwnProperty("header_1")) { + let error = $root.ibc.lightclients.tendermint.v1.Header.verify(message.header_1); + if (error) + return "header_1." + error; + } + if (message.header_2 != null && message.hasOwnProperty("header_2")) { + let error = $root.ibc.lightclients.tendermint.v1.Header.verify(message.header_2); + if (error) + return "header_2." + error; + } + return null; + }; + + /** + * Creates a Misbehaviour message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.lightclients.tendermint.v1.Misbehaviour + * @static + * @param {Object.} object Plain object + * @returns {ibc.lightclients.tendermint.v1.Misbehaviour} Misbehaviour + */ + Misbehaviour.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.lightclients.tendermint.v1.Misbehaviour) + return object; + let message = new $root.ibc.lightclients.tendermint.v1.Misbehaviour(); + if (object.client_id != null) + message.client_id = String(object.client_id); + if (object.header_1 != null) { + if (typeof object.header_1 !== "object") + throw TypeError(".ibc.lightclients.tendermint.v1.Misbehaviour.header_1: object expected"); + message.header_1 = $root.ibc.lightclients.tendermint.v1.Header.fromObject(object.header_1); + } + if (object.header_2 != null) { + if (typeof object.header_2 !== "object") + throw TypeError(".ibc.lightclients.tendermint.v1.Misbehaviour.header_2: object expected"); + message.header_2 = $root.ibc.lightclients.tendermint.v1.Header.fromObject(object.header_2); + } + return message; + }; + + /** + * Creates a plain object from a Misbehaviour message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.lightclients.tendermint.v1.Misbehaviour + * @static + * @param {ibc.lightclients.tendermint.v1.Misbehaviour} message Misbehaviour + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Misbehaviour.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.client_id = ""; + object.header_1 = null; + object.header_2 = null; + } + if (message.client_id != null && message.hasOwnProperty("client_id")) + object.client_id = message.client_id; + if (message.header_1 != null && message.hasOwnProperty("header_1")) + object.header_1 = $root.ibc.lightclients.tendermint.v1.Header.toObject(message.header_1, options); + if (message.header_2 != null && message.hasOwnProperty("header_2")) + object.header_2 = $root.ibc.lightclients.tendermint.v1.Header.toObject(message.header_2, options); + return object; + }; + + /** + * Converts this Misbehaviour to JSON. + * @function toJSON + * @memberof ibc.lightclients.tendermint.v1.Misbehaviour + * @instance + * @returns {Object.} JSON object + */ + Misbehaviour.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Misbehaviour; + })(); + + v1.Header = (function() { + + /** + * Properties of a Header. + * @memberof ibc.lightclients.tendermint.v1 + * @interface IHeader + * @property {tendermint.types.ISignedHeader|null} [signed_header] Header signed_header + * @property {tendermint.types.IValidatorSet|null} [validator_set] Header validator_set + * @property {ibc.core.client.v1.IHeight|null} [trusted_height] Header trusted_height + * @property {tendermint.types.IValidatorSet|null} [trusted_validators] Header trusted_validators + */ + + /** + * Constructs a new Header. + * @memberof ibc.lightclients.tendermint.v1 + * @classdesc Represents a Header. + * @implements IHeader + * @constructor + * @param {ibc.lightclients.tendermint.v1.IHeader=} [properties] Properties to set + */ + function Header(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Header signed_header. + * @member {tendermint.types.ISignedHeader|null|undefined} signed_header + * @memberof ibc.lightclients.tendermint.v1.Header + * @instance + */ + Header.prototype.signed_header = null; + + /** + * Header validator_set. + * @member {tendermint.types.IValidatorSet|null|undefined} validator_set + * @memberof ibc.lightclients.tendermint.v1.Header + * @instance + */ + Header.prototype.validator_set = null; + + /** + * Header trusted_height. + * @member {ibc.core.client.v1.IHeight|null|undefined} trusted_height + * @memberof ibc.lightclients.tendermint.v1.Header + * @instance + */ + Header.prototype.trusted_height = null; + + /** + * Header trusted_validators. + * @member {tendermint.types.IValidatorSet|null|undefined} trusted_validators + * @memberof ibc.lightclients.tendermint.v1.Header + * @instance + */ + Header.prototype.trusted_validators = null; + + /** + * Encodes the specified Header message. Does not implicitly {@link ibc.lightclients.tendermint.v1.Header.verify|verify} messages. + * @function encode + * @memberof ibc.lightclients.tendermint.v1.Header + * @static + * @param {ibc.lightclients.tendermint.v1.IHeader} message Header message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Header.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.signed_header != null && Object.hasOwnProperty.call(message, "signed_header")) + $root.tendermint.types.SignedHeader.encode(message.signed_header, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.validator_set != null && Object.hasOwnProperty.call(message, "validator_set")) + $root.tendermint.types.ValidatorSet.encode(message.validator_set, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.trusted_height != null && Object.hasOwnProperty.call(message, "trusted_height")) + $root.ibc.core.client.v1.Height.encode(message.trusted_height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.trusted_validators != null && Object.hasOwnProperty.call(message, "trusted_validators")) + $root.tendermint.types.ValidatorSet.encode(message.trusted_validators, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Header message, length delimited. Does not implicitly {@link ibc.lightclients.tendermint.v1.Header.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.lightclients.tendermint.v1.Header + * @static + * @param {ibc.lightclients.tendermint.v1.IHeader} message Header message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Header.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Header message from the specified reader or buffer. + * @function decode + * @memberof ibc.lightclients.tendermint.v1.Header + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.lightclients.tendermint.v1.Header} Header + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Header.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.tendermint.v1.Header(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signed_header = $root.tendermint.types.SignedHeader.decode(reader, reader.uint32()); + break; + case 2: + message.validator_set = $root.tendermint.types.ValidatorSet.decode(reader, reader.uint32()); + break; + case 3: + message.trusted_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); + break; + case 4: + message.trusted_validators = $root.tendermint.types.ValidatorSet.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Header message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.lightclients.tendermint.v1.Header + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.lightclients.tendermint.v1.Header} Header + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Header.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Header message. + * @function verify + * @memberof ibc.lightclients.tendermint.v1.Header + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Header.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.signed_header != null && message.hasOwnProperty("signed_header")) { + let error = $root.tendermint.types.SignedHeader.verify(message.signed_header); + if (error) + return "signed_header." + error; + } + if (message.validator_set != null && message.hasOwnProperty("validator_set")) { + let error = $root.tendermint.types.ValidatorSet.verify(message.validator_set); + if (error) + return "validator_set." + error; + } + if (message.trusted_height != null && message.hasOwnProperty("trusted_height")) { + let error = $root.ibc.core.client.v1.Height.verify(message.trusted_height); + if (error) + return "trusted_height." + error; + } + if (message.trusted_validators != null && message.hasOwnProperty("trusted_validators")) { + let error = $root.tendermint.types.ValidatorSet.verify(message.trusted_validators); + if (error) + return "trusted_validators." + error; + } + return null; + }; + + /** + * Creates a Header message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.lightclients.tendermint.v1.Header + * @static + * @param {Object.} object Plain object + * @returns {ibc.lightclients.tendermint.v1.Header} Header + */ + Header.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.lightclients.tendermint.v1.Header) + return object; + let message = new $root.ibc.lightclients.tendermint.v1.Header(); + if (object.signed_header != null) { + if (typeof object.signed_header !== "object") + throw TypeError(".ibc.lightclients.tendermint.v1.Header.signed_header: object expected"); + message.signed_header = $root.tendermint.types.SignedHeader.fromObject(object.signed_header); + } + if (object.validator_set != null) { + if (typeof object.validator_set !== "object") + throw TypeError(".ibc.lightclients.tendermint.v1.Header.validator_set: object expected"); + message.validator_set = $root.tendermint.types.ValidatorSet.fromObject(object.validator_set); + } + if (object.trusted_height != null) { + if (typeof object.trusted_height !== "object") + throw TypeError(".ibc.lightclients.tendermint.v1.Header.trusted_height: object expected"); + message.trusted_height = $root.ibc.core.client.v1.Height.fromObject(object.trusted_height); + } + if (object.trusted_validators != null) { + if (typeof object.trusted_validators !== "object") + throw TypeError(".ibc.lightclients.tendermint.v1.Header.trusted_validators: object expected"); + message.trusted_validators = $root.tendermint.types.ValidatorSet.fromObject(object.trusted_validators); + } + return message; + }; + + /** + * Creates a plain object from a Header message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.lightclients.tendermint.v1.Header + * @static + * @param {ibc.lightclients.tendermint.v1.Header} message Header + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Header.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.signed_header = null; + object.validator_set = null; + object.trusted_height = null; + object.trusted_validators = null; + } + if (message.signed_header != null && message.hasOwnProperty("signed_header")) + object.signed_header = $root.tendermint.types.SignedHeader.toObject(message.signed_header, options); + if (message.validator_set != null && message.hasOwnProperty("validator_set")) + object.validator_set = $root.tendermint.types.ValidatorSet.toObject(message.validator_set, options); + if (message.trusted_height != null && message.hasOwnProperty("trusted_height")) + object.trusted_height = $root.ibc.core.client.v1.Height.toObject(message.trusted_height, options); + if (message.trusted_validators != null && message.hasOwnProperty("trusted_validators")) + object.trusted_validators = $root.tendermint.types.ValidatorSet.toObject(message.trusted_validators, options); + return object; + }; + + /** + * Converts this Header to JSON. + * @function toJSON + * @memberof ibc.lightclients.tendermint.v1.Header + * @instance + * @returns {Object.} JSON object + */ + Header.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Header; + })(); + + v1.Fraction = (function() { + + /** + * Properties of a Fraction. + * @memberof ibc.lightclients.tendermint.v1 + * @interface IFraction + * @property {Long|null} [numerator] Fraction numerator + * @property {Long|null} [denominator] Fraction denominator + */ + + /** + * Constructs a new Fraction. + * @memberof ibc.lightclients.tendermint.v1 + * @classdesc Represents a Fraction. + * @implements IFraction + * @constructor + * @param {ibc.lightclients.tendermint.v1.IFraction=} [properties] Properties to set + */ + function Fraction(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Fraction numerator. + * @member {Long} numerator + * @memberof ibc.lightclients.tendermint.v1.Fraction + * @instance + */ + Fraction.prototype.numerator = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Fraction denominator. + * @member {Long} denominator + * @memberof ibc.lightclients.tendermint.v1.Fraction + * @instance + */ + Fraction.prototype.denominator = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified Fraction message. Does not implicitly {@link ibc.lightclients.tendermint.v1.Fraction.verify|verify} messages. + * @function encode + * @memberof ibc.lightclients.tendermint.v1.Fraction + * @static + * @param {ibc.lightclients.tendermint.v1.IFraction} message Fraction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Fraction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.numerator != null && Object.hasOwnProperty.call(message, "numerator")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.numerator); + if (message.denominator != null && Object.hasOwnProperty.call(message, "denominator")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.denominator); + return writer; + }; + + /** + * Encodes the specified Fraction message, length delimited. Does not implicitly {@link ibc.lightclients.tendermint.v1.Fraction.verify|verify} messages. + * @function encodeDelimited + * @memberof ibc.lightclients.tendermint.v1.Fraction + * @static + * @param {ibc.lightclients.tendermint.v1.IFraction} message Fraction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Fraction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Fraction message from the specified reader or buffer. + * @function decode + * @memberof ibc.lightclients.tendermint.v1.Fraction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {ibc.lightclients.tendermint.v1.Fraction} Fraction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Fraction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.tendermint.v1.Fraction(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.numerator = reader.uint64(); + break; + case 2: + message.denominator = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Fraction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof ibc.lightclients.tendermint.v1.Fraction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {ibc.lightclients.tendermint.v1.Fraction} Fraction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Fraction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Fraction message. + * @function verify + * @memberof ibc.lightclients.tendermint.v1.Fraction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Fraction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.numerator != null && message.hasOwnProperty("numerator")) + if (!$util.isInteger(message.numerator) && !(message.numerator && $util.isInteger(message.numerator.low) && $util.isInteger(message.numerator.high))) + return "numerator: integer|Long expected"; + if (message.denominator != null && message.hasOwnProperty("denominator")) + if (!$util.isInteger(message.denominator) && !(message.denominator && $util.isInteger(message.denominator.low) && $util.isInteger(message.denominator.high))) + return "denominator: integer|Long expected"; + return null; + }; + + /** + * Creates a Fraction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof ibc.lightclients.tendermint.v1.Fraction + * @static + * @param {Object.} object Plain object + * @returns {ibc.lightclients.tendermint.v1.Fraction} Fraction + */ + Fraction.fromObject = function fromObject(object) { + if (object instanceof $root.ibc.lightclients.tendermint.v1.Fraction) + return object; + let message = new $root.ibc.lightclients.tendermint.v1.Fraction(); + if (object.numerator != null) + if ($util.Long) + (message.numerator = $util.Long.fromValue(object.numerator)).unsigned = true; + else if (typeof object.numerator === "string") + message.numerator = parseInt(object.numerator, 10); + else if (typeof object.numerator === "number") + message.numerator = object.numerator; + else if (typeof object.numerator === "object") + message.numerator = new $util.LongBits(object.numerator.low >>> 0, object.numerator.high >>> 0).toNumber(true); + if (object.denominator != null) + if ($util.Long) + (message.denominator = $util.Long.fromValue(object.denominator)).unsigned = true; + else if (typeof object.denominator === "string") + message.denominator = parseInt(object.denominator, 10); + else if (typeof object.denominator === "number") + message.denominator = object.denominator; + else if (typeof object.denominator === "object") + message.denominator = new $util.LongBits(object.denominator.low >>> 0, object.denominator.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a Fraction message. Also converts values to other types if specified. + * @function toObject + * @memberof ibc.lightclients.tendermint.v1.Fraction + * @static + * @param {ibc.lightclients.tendermint.v1.Fraction} message Fraction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Fraction.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.numerator = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.numerator = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.denominator = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.denominator = options.longs === String ? "0" : 0; + } + if (message.numerator != null && message.hasOwnProperty("numerator")) + if (typeof message.numerator === "number") + object.numerator = options.longs === String ? String(message.numerator) : message.numerator; + else + object.numerator = options.longs === String ? $util.Long.prototype.toString.call(message.numerator) : options.longs === Number ? new $util.LongBits(message.numerator.low >>> 0, message.numerator.high >>> 0).toNumber(true) : message.numerator; + if (message.denominator != null && message.hasOwnProperty("denominator")) + if (typeof message.denominator === "number") + object.denominator = options.longs === String ? String(message.denominator) : message.denominator; + else + object.denominator = options.longs === String ? $util.Long.prototype.toString.call(message.denominator) : options.longs === Number ? new $util.LongBits(message.denominator.low >>> 0, message.denominator.high >>> 0).toNumber(true) : message.denominator; + return object; + }; + + /** + * Converts this Fraction to JSON. + * @function toJSON + * @memberof ibc.lightclients.tendermint.v1.Fraction + * @instance + * @returns {Object.} JSON object + */ + Fraction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Fraction; + })(); + + return v1; + })(); + + return tendermint; + })(); + + return lightclients; + })(); + + return ibc; +})(); + +export const tendermint = $root.tendermint = (() => { + + /** + * Namespace tendermint. + * @exports tendermint + * @namespace + */ + const tendermint = {}; + + tendermint.abci = (function() { + + /** + * Namespace abci. + * @memberof tendermint + * @namespace + */ + const abci = {}; + + abci.Request = (function() { + + /** + * Properties of a Request. + * @memberof tendermint.abci + * @interface IRequest + * @property {tendermint.abci.IRequestEcho|null} [echo] Request echo + * @property {tendermint.abci.IRequestFlush|null} [flush] Request flush + * @property {tendermint.abci.IRequestInfo|null} [info] Request info + * @property {tendermint.abci.IRequestSetOption|null} [set_option] Request set_option + * @property {tendermint.abci.IRequestInitChain|null} [init_chain] Request init_chain + * @property {tendermint.abci.IRequestQuery|null} [query] Request query + * @property {tendermint.abci.IRequestBeginBlock|null} [begin_block] Request begin_block + * @property {tendermint.abci.IRequestCheckTx|null} [check_tx] Request check_tx + * @property {tendermint.abci.IRequestDeliverTx|null} [deliver_tx] Request deliver_tx + * @property {tendermint.abci.IRequestEndBlock|null} [end_block] Request end_block + * @property {tendermint.abci.IRequestCommit|null} [commit] Request commit + * @property {tendermint.abci.IRequestListSnapshots|null} [list_snapshots] Request list_snapshots + * @property {tendermint.abci.IRequestOfferSnapshot|null} [offer_snapshot] Request offer_snapshot + * @property {tendermint.abci.IRequestLoadSnapshotChunk|null} [load_snapshot_chunk] Request load_snapshot_chunk + * @property {tendermint.abci.IRequestApplySnapshotChunk|null} [apply_snapshot_chunk] Request apply_snapshot_chunk + */ + + /** + * Constructs a new Request. + * @memberof tendermint.abci + * @classdesc Represents a Request. + * @implements IRequest + * @constructor + * @param {tendermint.abci.IRequest=} [properties] Properties to set + */ + function Request(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Request echo. + * @member {tendermint.abci.IRequestEcho|null|undefined} echo + * @memberof tendermint.abci.Request + * @instance + */ + Request.prototype.echo = null; + + /** + * Request flush. + * @member {tendermint.abci.IRequestFlush|null|undefined} flush + * @memberof tendermint.abci.Request + * @instance + */ + Request.prototype.flush = null; + + /** + * Request info. + * @member {tendermint.abci.IRequestInfo|null|undefined} info + * @memberof tendermint.abci.Request + * @instance + */ + Request.prototype.info = null; + + /** + * Request set_option. + * @member {tendermint.abci.IRequestSetOption|null|undefined} set_option + * @memberof tendermint.abci.Request + * @instance + */ + Request.prototype.set_option = null; + + /** + * Request init_chain. + * @member {tendermint.abci.IRequestInitChain|null|undefined} init_chain + * @memberof tendermint.abci.Request + * @instance + */ + Request.prototype.init_chain = null; + + /** + * Request query. + * @member {tendermint.abci.IRequestQuery|null|undefined} query + * @memberof tendermint.abci.Request + * @instance + */ + Request.prototype.query = null; + + /** + * Request begin_block. + * @member {tendermint.abci.IRequestBeginBlock|null|undefined} begin_block + * @memberof tendermint.abci.Request + * @instance + */ + Request.prototype.begin_block = null; + + /** + * Request check_tx. + * @member {tendermint.abci.IRequestCheckTx|null|undefined} check_tx + * @memberof tendermint.abci.Request + * @instance + */ + Request.prototype.check_tx = null; + + /** + * Request deliver_tx. + * @member {tendermint.abci.IRequestDeliverTx|null|undefined} deliver_tx + * @memberof tendermint.abci.Request + * @instance + */ + Request.prototype.deliver_tx = null; + + /** + * Request end_block. + * @member {tendermint.abci.IRequestEndBlock|null|undefined} end_block + * @memberof tendermint.abci.Request + * @instance + */ + Request.prototype.end_block = null; + + /** + * Request commit. + * @member {tendermint.abci.IRequestCommit|null|undefined} commit + * @memberof tendermint.abci.Request + * @instance + */ + Request.prototype.commit = null; + + /** + * Request list_snapshots. + * @member {tendermint.abci.IRequestListSnapshots|null|undefined} list_snapshots + * @memberof tendermint.abci.Request + * @instance + */ + Request.prototype.list_snapshots = null; + + /** + * Request offer_snapshot. + * @member {tendermint.abci.IRequestOfferSnapshot|null|undefined} offer_snapshot + * @memberof tendermint.abci.Request + * @instance + */ + Request.prototype.offer_snapshot = null; + + /** + * Request load_snapshot_chunk. + * @member {tendermint.abci.IRequestLoadSnapshotChunk|null|undefined} load_snapshot_chunk + * @memberof tendermint.abci.Request + * @instance + */ + Request.prototype.load_snapshot_chunk = null; + + /** + * Request apply_snapshot_chunk. + * @member {tendermint.abci.IRequestApplySnapshotChunk|null|undefined} apply_snapshot_chunk + * @memberof tendermint.abci.Request + * @instance + */ + Request.prototype.apply_snapshot_chunk = null; + + // OneOf field names bound to virtual getters and setters + let $oneOfFields; + + /** + * Request value. + * @member {"echo"|"flush"|"info"|"set_option"|"init_chain"|"query"|"begin_block"|"check_tx"|"deliver_tx"|"end_block"|"commit"|"list_snapshots"|"offer_snapshot"|"load_snapshot_chunk"|"apply_snapshot_chunk"|undefined} value + * @memberof tendermint.abci.Request + * @instance + */ + Object.defineProperty(Request.prototype, "value", { + get: $util.oneOfGetter($oneOfFields = ["echo", "flush", "info", "set_option", "init_chain", "query", "begin_block", "check_tx", "deliver_tx", "end_block", "commit", "list_snapshots", "offer_snapshot", "load_snapshot_chunk", "apply_snapshot_chunk"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Encodes the specified Request message. Does not implicitly {@link tendermint.abci.Request.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.Request + * @static + * @param {tendermint.abci.IRequest} message Request message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Request.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.echo != null && Object.hasOwnProperty.call(message, "echo")) + $root.tendermint.abci.RequestEcho.encode(message.echo, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.flush != null && Object.hasOwnProperty.call(message, "flush")) + $root.tendermint.abci.RequestFlush.encode(message.flush, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.info != null && Object.hasOwnProperty.call(message, "info")) + $root.tendermint.abci.RequestInfo.encode(message.info, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.set_option != null && Object.hasOwnProperty.call(message, "set_option")) + $root.tendermint.abci.RequestSetOption.encode(message.set_option, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.init_chain != null && Object.hasOwnProperty.call(message, "init_chain")) + $root.tendermint.abci.RequestInitChain.encode(message.init_chain, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + $root.tendermint.abci.RequestQuery.encode(message.query, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.begin_block != null && Object.hasOwnProperty.call(message, "begin_block")) + $root.tendermint.abci.RequestBeginBlock.encode(message.begin_block, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.check_tx != null && Object.hasOwnProperty.call(message, "check_tx")) + $root.tendermint.abci.RequestCheckTx.encode(message.check_tx, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.deliver_tx != null && Object.hasOwnProperty.call(message, "deliver_tx")) + $root.tendermint.abci.RequestDeliverTx.encode(message.deliver_tx, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.end_block != null && Object.hasOwnProperty.call(message, "end_block")) + $root.tendermint.abci.RequestEndBlock.encode(message.end_block, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.commit != null && Object.hasOwnProperty.call(message, "commit")) + $root.tendermint.abci.RequestCommit.encode(message.commit, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.list_snapshots != null && Object.hasOwnProperty.call(message, "list_snapshots")) + $root.tendermint.abci.RequestListSnapshots.encode(message.list_snapshots, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.offer_snapshot != null && Object.hasOwnProperty.call(message, "offer_snapshot")) + $root.tendermint.abci.RequestOfferSnapshot.encode(message.offer_snapshot, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.load_snapshot_chunk != null && Object.hasOwnProperty.call(message, "load_snapshot_chunk")) + $root.tendermint.abci.RequestLoadSnapshotChunk.encode(message.load_snapshot_chunk, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.apply_snapshot_chunk != null && Object.hasOwnProperty.call(message, "apply_snapshot_chunk")) + $root.tendermint.abci.RequestApplySnapshotChunk.encode(message.apply_snapshot_chunk, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Request message, length delimited. Does not implicitly {@link tendermint.abci.Request.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.Request + * @static + * @param {tendermint.abci.IRequest} message Request message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Request.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Request message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.Request + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.Request} Request + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Request.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.Request(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.echo = $root.tendermint.abci.RequestEcho.decode(reader, reader.uint32()); + break; + case 2: + message.flush = $root.tendermint.abci.RequestFlush.decode(reader, reader.uint32()); + break; + case 3: + message.info = $root.tendermint.abci.RequestInfo.decode(reader, reader.uint32()); + break; + case 4: + message.set_option = $root.tendermint.abci.RequestSetOption.decode(reader, reader.uint32()); + break; + case 5: + message.init_chain = $root.tendermint.abci.RequestInitChain.decode(reader, reader.uint32()); + break; + case 6: + message.query = $root.tendermint.abci.RequestQuery.decode(reader, reader.uint32()); + break; + case 7: + message.begin_block = $root.tendermint.abci.RequestBeginBlock.decode(reader, reader.uint32()); + break; + case 8: + message.check_tx = $root.tendermint.abci.RequestCheckTx.decode(reader, reader.uint32()); + break; + case 9: + message.deliver_tx = $root.tendermint.abci.RequestDeliverTx.decode(reader, reader.uint32()); + break; + case 10: + message.end_block = $root.tendermint.abci.RequestEndBlock.decode(reader, reader.uint32()); + break; + case 11: + message.commit = $root.tendermint.abci.RequestCommit.decode(reader, reader.uint32()); + break; + case 12: + message.list_snapshots = $root.tendermint.abci.RequestListSnapshots.decode(reader, reader.uint32()); + break; + case 13: + message.offer_snapshot = $root.tendermint.abci.RequestOfferSnapshot.decode(reader, reader.uint32()); + break; + case 14: + message.load_snapshot_chunk = $root.tendermint.abci.RequestLoadSnapshotChunk.decode(reader, reader.uint32()); + break; + case 15: + message.apply_snapshot_chunk = $root.tendermint.abci.RequestApplySnapshotChunk.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Request message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.Request + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.Request} Request + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Request.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Request message. + * @function verify + * @memberof tendermint.abci.Request + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Request.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + let properties = {}; + if (message.echo != null && message.hasOwnProperty("echo")) { + properties.value = 1; + { + let error = $root.tendermint.abci.RequestEcho.verify(message.echo); + if (error) + return "echo." + error; + } + } + if (message.flush != null && message.hasOwnProperty("flush")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + { + let error = $root.tendermint.abci.RequestFlush.verify(message.flush); + if (error) + return "flush." + error; + } + } + if (message.info != null && message.hasOwnProperty("info")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + { + let error = $root.tendermint.abci.RequestInfo.verify(message.info); + if (error) + return "info." + error; + } + } + if (message.set_option != null && message.hasOwnProperty("set_option")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + { + let error = $root.tendermint.abci.RequestSetOption.verify(message.set_option); + if (error) + return "set_option." + error; + } + } + if (message.init_chain != null && message.hasOwnProperty("init_chain")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + { + let error = $root.tendermint.abci.RequestInitChain.verify(message.init_chain); + if (error) + return "init_chain." + error; + } + } + if (message.query != null && message.hasOwnProperty("query")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + { + let error = $root.tendermint.abci.RequestQuery.verify(message.query); + if (error) + return "query." + error; + } + } + if (message.begin_block != null && message.hasOwnProperty("begin_block")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + { + let error = $root.tendermint.abci.RequestBeginBlock.verify(message.begin_block); + if (error) + return "begin_block." + error; + } + } + if (message.check_tx != null && message.hasOwnProperty("check_tx")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + { + let error = $root.tendermint.abci.RequestCheckTx.verify(message.check_tx); + if (error) + return "check_tx." + error; + } + } + if (message.deliver_tx != null && message.hasOwnProperty("deliver_tx")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + { + let error = $root.tendermint.abci.RequestDeliverTx.verify(message.deliver_tx); + if (error) + return "deliver_tx." + error; + } + } + if (message.end_block != null && message.hasOwnProperty("end_block")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + { + let error = $root.tendermint.abci.RequestEndBlock.verify(message.end_block); + if (error) + return "end_block." + error; + } + } + if (message.commit != null && message.hasOwnProperty("commit")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + { + let error = $root.tendermint.abci.RequestCommit.verify(message.commit); + if (error) + return "commit." + error; + } + } + if (message.list_snapshots != null && message.hasOwnProperty("list_snapshots")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + { + let error = $root.tendermint.abci.RequestListSnapshots.verify(message.list_snapshots); + if (error) + return "list_snapshots." + error; + } + } + if (message.offer_snapshot != null && message.hasOwnProperty("offer_snapshot")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + { + let error = $root.tendermint.abci.RequestOfferSnapshot.verify(message.offer_snapshot); + if (error) + return "offer_snapshot." + error; + } + } + if (message.load_snapshot_chunk != null && message.hasOwnProperty("load_snapshot_chunk")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + { + let error = $root.tendermint.abci.RequestLoadSnapshotChunk.verify(message.load_snapshot_chunk); + if (error) + return "load_snapshot_chunk." + error; + } + } + if (message.apply_snapshot_chunk != null && message.hasOwnProperty("apply_snapshot_chunk")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + { + let error = $root.tendermint.abci.RequestApplySnapshotChunk.verify(message.apply_snapshot_chunk); + if (error) + return "apply_snapshot_chunk." + error; + } + } + return null; + }; + + /** + * Creates a Request message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.Request + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.Request} Request + */ + Request.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.Request) + return object; + let message = new $root.tendermint.abci.Request(); + if (object.echo != null) { + if (typeof object.echo !== "object") + throw TypeError(".tendermint.abci.Request.echo: object expected"); + message.echo = $root.tendermint.abci.RequestEcho.fromObject(object.echo); + } + if (object.flush != null) { + if (typeof object.flush !== "object") + throw TypeError(".tendermint.abci.Request.flush: object expected"); + message.flush = $root.tendermint.abci.RequestFlush.fromObject(object.flush); + } + if (object.info != null) { + if (typeof object.info !== "object") + throw TypeError(".tendermint.abci.Request.info: object expected"); + message.info = $root.tendermint.abci.RequestInfo.fromObject(object.info); + } + if (object.set_option != null) { + if (typeof object.set_option !== "object") + throw TypeError(".tendermint.abci.Request.set_option: object expected"); + message.set_option = $root.tendermint.abci.RequestSetOption.fromObject(object.set_option); + } + if (object.init_chain != null) { + if (typeof object.init_chain !== "object") + throw TypeError(".tendermint.abci.Request.init_chain: object expected"); + message.init_chain = $root.tendermint.abci.RequestInitChain.fromObject(object.init_chain); + } + if (object.query != null) { + if (typeof object.query !== "object") + throw TypeError(".tendermint.abci.Request.query: object expected"); + message.query = $root.tendermint.abci.RequestQuery.fromObject(object.query); + } + if (object.begin_block != null) { + if (typeof object.begin_block !== "object") + throw TypeError(".tendermint.abci.Request.begin_block: object expected"); + message.begin_block = $root.tendermint.abci.RequestBeginBlock.fromObject(object.begin_block); + } + if (object.check_tx != null) { + if (typeof object.check_tx !== "object") + throw TypeError(".tendermint.abci.Request.check_tx: object expected"); + message.check_tx = $root.tendermint.abci.RequestCheckTx.fromObject(object.check_tx); + } + if (object.deliver_tx != null) { + if (typeof object.deliver_tx !== "object") + throw TypeError(".tendermint.abci.Request.deliver_tx: object expected"); + message.deliver_tx = $root.tendermint.abci.RequestDeliverTx.fromObject(object.deliver_tx); + } + if (object.end_block != null) { + if (typeof object.end_block !== "object") + throw TypeError(".tendermint.abci.Request.end_block: object expected"); + message.end_block = $root.tendermint.abci.RequestEndBlock.fromObject(object.end_block); + } + if (object.commit != null) { + if (typeof object.commit !== "object") + throw TypeError(".tendermint.abci.Request.commit: object expected"); + message.commit = $root.tendermint.abci.RequestCommit.fromObject(object.commit); + } + if (object.list_snapshots != null) { + if (typeof object.list_snapshots !== "object") + throw TypeError(".tendermint.abci.Request.list_snapshots: object expected"); + message.list_snapshots = $root.tendermint.abci.RequestListSnapshots.fromObject(object.list_snapshots); + } + if (object.offer_snapshot != null) { + if (typeof object.offer_snapshot !== "object") + throw TypeError(".tendermint.abci.Request.offer_snapshot: object expected"); + message.offer_snapshot = $root.tendermint.abci.RequestOfferSnapshot.fromObject(object.offer_snapshot); + } + if (object.load_snapshot_chunk != null) { + if (typeof object.load_snapshot_chunk !== "object") + throw TypeError(".tendermint.abci.Request.load_snapshot_chunk: object expected"); + message.load_snapshot_chunk = $root.tendermint.abci.RequestLoadSnapshotChunk.fromObject(object.load_snapshot_chunk); + } + if (object.apply_snapshot_chunk != null) { + if (typeof object.apply_snapshot_chunk !== "object") + throw TypeError(".tendermint.abci.Request.apply_snapshot_chunk: object expected"); + message.apply_snapshot_chunk = $root.tendermint.abci.RequestApplySnapshotChunk.fromObject(object.apply_snapshot_chunk); + } + return message; + }; + + /** + * Creates a plain object from a Request message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.Request + * @static + * @param {tendermint.abci.Request} message Request + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Request.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (message.echo != null && message.hasOwnProperty("echo")) { + object.echo = $root.tendermint.abci.RequestEcho.toObject(message.echo, options); + if (options.oneofs) + object.value = "echo"; + } + if (message.flush != null && message.hasOwnProperty("flush")) { + object.flush = $root.tendermint.abci.RequestFlush.toObject(message.flush, options); + if (options.oneofs) + object.value = "flush"; + } + if (message.info != null && message.hasOwnProperty("info")) { + object.info = $root.tendermint.abci.RequestInfo.toObject(message.info, options); + if (options.oneofs) + object.value = "info"; + } + if (message.set_option != null && message.hasOwnProperty("set_option")) { + object.set_option = $root.tendermint.abci.RequestSetOption.toObject(message.set_option, options); + if (options.oneofs) + object.value = "set_option"; + } + if (message.init_chain != null && message.hasOwnProperty("init_chain")) { + object.init_chain = $root.tendermint.abci.RequestInitChain.toObject(message.init_chain, options); + if (options.oneofs) + object.value = "init_chain"; + } + if (message.query != null && message.hasOwnProperty("query")) { + object.query = $root.tendermint.abci.RequestQuery.toObject(message.query, options); + if (options.oneofs) + object.value = "query"; + } + if (message.begin_block != null && message.hasOwnProperty("begin_block")) { + object.begin_block = $root.tendermint.abci.RequestBeginBlock.toObject(message.begin_block, options); + if (options.oneofs) + object.value = "begin_block"; + } + if (message.check_tx != null && message.hasOwnProperty("check_tx")) { + object.check_tx = $root.tendermint.abci.RequestCheckTx.toObject(message.check_tx, options); + if (options.oneofs) + object.value = "check_tx"; + } + if (message.deliver_tx != null && message.hasOwnProperty("deliver_tx")) { + object.deliver_tx = $root.tendermint.abci.RequestDeliverTx.toObject(message.deliver_tx, options); + if (options.oneofs) + object.value = "deliver_tx"; + } + if (message.end_block != null && message.hasOwnProperty("end_block")) { + object.end_block = $root.tendermint.abci.RequestEndBlock.toObject(message.end_block, options); + if (options.oneofs) + object.value = "end_block"; + } + if (message.commit != null && message.hasOwnProperty("commit")) { + object.commit = $root.tendermint.abci.RequestCommit.toObject(message.commit, options); + if (options.oneofs) + object.value = "commit"; + } + if (message.list_snapshots != null && message.hasOwnProperty("list_snapshots")) { + object.list_snapshots = $root.tendermint.abci.RequestListSnapshots.toObject(message.list_snapshots, options); + if (options.oneofs) + object.value = "list_snapshots"; + } + if (message.offer_snapshot != null && message.hasOwnProperty("offer_snapshot")) { + object.offer_snapshot = $root.tendermint.abci.RequestOfferSnapshot.toObject(message.offer_snapshot, options); + if (options.oneofs) + object.value = "offer_snapshot"; + } + if (message.load_snapshot_chunk != null && message.hasOwnProperty("load_snapshot_chunk")) { + object.load_snapshot_chunk = $root.tendermint.abci.RequestLoadSnapshotChunk.toObject(message.load_snapshot_chunk, options); + if (options.oneofs) + object.value = "load_snapshot_chunk"; + } + if (message.apply_snapshot_chunk != null && message.hasOwnProperty("apply_snapshot_chunk")) { + object.apply_snapshot_chunk = $root.tendermint.abci.RequestApplySnapshotChunk.toObject(message.apply_snapshot_chunk, options); + if (options.oneofs) + object.value = "apply_snapshot_chunk"; + } + return object; + }; + + /** + * Converts this Request to JSON. + * @function toJSON + * @memberof tendermint.abci.Request + * @instance + * @returns {Object.} JSON object + */ + Request.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Request; + })(); + + abci.RequestEcho = (function() { + + /** + * Properties of a RequestEcho. + * @memberof tendermint.abci + * @interface IRequestEcho + * @property {string|null} [message] RequestEcho message + */ + + /** + * Constructs a new RequestEcho. + * @memberof tendermint.abci + * @classdesc Represents a RequestEcho. + * @implements IRequestEcho + * @constructor + * @param {tendermint.abci.IRequestEcho=} [properties] Properties to set + */ + function RequestEcho(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RequestEcho message. + * @member {string} message + * @memberof tendermint.abci.RequestEcho + * @instance + */ + RequestEcho.prototype.message = ""; + + /** + * Encodes the specified RequestEcho message. Does not implicitly {@link tendermint.abci.RequestEcho.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.RequestEcho + * @static + * @param {tendermint.abci.IRequestEcho} message RequestEcho message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestEcho.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.message); + return writer; + }; + + /** + * Encodes the specified RequestEcho message, length delimited. Does not implicitly {@link tendermint.abci.RequestEcho.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.RequestEcho + * @static + * @param {tendermint.abci.IRequestEcho} message RequestEcho message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestEcho.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RequestEcho message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.RequestEcho + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.RequestEcho} RequestEcho + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestEcho.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.RequestEcho(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.message = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RequestEcho message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.RequestEcho + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.RequestEcho} RequestEcho + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestEcho.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RequestEcho message. + * @function verify + * @memberof tendermint.abci.RequestEcho + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RequestEcho.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + return null; + }; + + /** + * Creates a RequestEcho message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.RequestEcho + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.RequestEcho} RequestEcho + */ + RequestEcho.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.RequestEcho) + return object; + let message = new $root.tendermint.abci.RequestEcho(); + if (object.message != null) + message.message = String(object.message); + return message; + }; + + /** + * Creates a plain object from a RequestEcho message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.RequestEcho + * @static + * @param {tendermint.abci.RequestEcho} message RequestEcho + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RequestEcho.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.message = ""; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + return object; + }; + + /** + * Converts this RequestEcho to JSON. + * @function toJSON + * @memberof tendermint.abci.RequestEcho + * @instance + * @returns {Object.} JSON object + */ + RequestEcho.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RequestEcho; + })(); + + abci.RequestFlush = (function() { + + /** + * Properties of a RequestFlush. + * @memberof tendermint.abci + * @interface IRequestFlush + */ + + /** + * Constructs a new RequestFlush. + * @memberof tendermint.abci + * @classdesc Represents a RequestFlush. + * @implements IRequestFlush + * @constructor + * @param {tendermint.abci.IRequestFlush=} [properties] Properties to set + */ + function RequestFlush(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified RequestFlush message. Does not implicitly {@link tendermint.abci.RequestFlush.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.RequestFlush + * @static + * @param {tendermint.abci.IRequestFlush} message RequestFlush message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestFlush.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified RequestFlush message, length delimited. Does not implicitly {@link tendermint.abci.RequestFlush.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.RequestFlush + * @static + * @param {tendermint.abci.IRequestFlush} message RequestFlush message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestFlush.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RequestFlush message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.RequestFlush + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.RequestFlush} RequestFlush + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestFlush.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.RequestFlush(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RequestFlush message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.RequestFlush + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.RequestFlush} RequestFlush + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestFlush.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RequestFlush message. + * @function verify + * @memberof tendermint.abci.RequestFlush + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RequestFlush.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a RequestFlush message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.RequestFlush + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.RequestFlush} RequestFlush + */ + RequestFlush.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.RequestFlush) + return object; + return new $root.tendermint.abci.RequestFlush(); + }; + + /** + * Creates a plain object from a RequestFlush message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.RequestFlush + * @static + * @param {tendermint.abci.RequestFlush} message RequestFlush + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RequestFlush.toObject = function toObject() { + return {}; + }; + + /** + * Converts this RequestFlush to JSON. + * @function toJSON + * @memberof tendermint.abci.RequestFlush + * @instance + * @returns {Object.} JSON object + */ + RequestFlush.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RequestFlush; + })(); + + abci.RequestInfo = (function() { + + /** + * Properties of a RequestInfo. + * @memberof tendermint.abci + * @interface IRequestInfo + * @property {string|null} [version] RequestInfo version + * @property {Long|null} [block_version] RequestInfo block_version + * @property {Long|null} [p2p_version] RequestInfo p2p_version + */ + + /** + * Constructs a new RequestInfo. + * @memberof tendermint.abci + * @classdesc Represents a RequestInfo. + * @implements IRequestInfo + * @constructor + * @param {tendermint.abci.IRequestInfo=} [properties] Properties to set + */ + function RequestInfo(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RequestInfo version. + * @member {string} version + * @memberof tendermint.abci.RequestInfo + * @instance + */ + RequestInfo.prototype.version = ""; + + /** + * RequestInfo block_version. + * @member {Long} block_version + * @memberof tendermint.abci.RequestInfo + * @instance + */ + RequestInfo.prototype.block_version = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * RequestInfo p2p_version. + * @member {Long} p2p_version + * @memberof tendermint.abci.RequestInfo + * @instance + */ + RequestInfo.prototype.p2p_version = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified RequestInfo message. Does not implicitly {@link tendermint.abci.RequestInfo.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.RequestInfo + * @static + * @param {tendermint.abci.IRequestInfo} message RequestInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.version); + if (message.block_version != null && Object.hasOwnProperty.call(message, "block_version")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.block_version); + if (message.p2p_version != null && Object.hasOwnProperty.call(message, "p2p_version")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.p2p_version); + return writer; + }; + + /** + * Encodes the specified RequestInfo message, length delimited. Does not implicitly {@link tendermint.abci.RequestInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.RequestInfo + * @static + * @param {tendermint.abci.IRequestInfo} message RequestInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RequestInfo message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.RequestInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.RequestInfo} RequestInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.RequestInfo(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.string(); + break; + case 2: + message.block_version = reader.uint64(); + break; + case 3: + message.p2p_version = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RequestInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.RequestInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.RequestInfo} RequestInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RequestInfo message. + * @function verify + * @memberof tendermint.abci.RequestInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RequestInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + if (message.block_version != null && message.hasOwnProperty("block_version")) + if (!$util.isInteger(message.block_version) && !(message.block_version && $util.isInteger(message.block_version.low) && $util.isInteger(message.block_version.high))) + return "block_version: integer|Long expected"; + if (message.p2p_version != null && message.hasOwnProperty("p2p_version")) + if (!$util.isInteger(message.p2p_version) && !(message.p2p_version && $util.isInteger(message.p2p_version.low) && $util.isInteger(message.p2p_version.high))) + return "p2p_version: integer|Long expected"; + return null; + }; + + /** + * Creates a RequestInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.RequestInfo + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.RequestInfo} RequestInfo + */ + RequestInfo.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.RequestInfo) + return object; + let message = new $root.tendermint.abci.RequestInfo(); + if (object.version != null) + message.version = String(object.version); + if (object.block_version != null) + if ($util.Long) + (message.block_version = $util.Long.fromValue(object.block_version)).unsigned = true; + else if (typeof object.block_version === "string") + message.block_version = parseInt(object.block_version, 10); + else if (typeof object.block_version === "number") + message.block_version = object.block_version; + else if (typeof object.block_version === "object") + message.block_version = new $util.LongBits(object.block_version.low >>> 0, object.block_version.high >>> 0).toNumber(true); + if (object.p2p_version != null) + if ($util.Long) + (message.p2p_version = $util.Long.fromValue(object.p2p_version)).unsigned = true; + else if (typeof object.p2p_version === "string") + message.p2p_version = parseInt(object.p2p_version, 10); + else if (typeof object.p2p_version === "number") + message.p2p_version = object.p2p_version; + else if (typeof object.p2p_version === "object") + message.p2p_version = new $util.LongBits(object.p2p_version.low >>> 0, object.p2p_version.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a RequestInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.RequestInfo + * @static + * @param {tendermint.abci.RequestInfo} message RequestInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RequestInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.version = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.block_version = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.block_version = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.p2p_version = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.p2p_version = options.longs === String ? "0" : 0; + } + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + if (message.block_version != null && message.hasOwnProperty("block_version")) + if (typeof message.block_version === "number") + object.block_version = options.longs === String ? String(message.block_version) : message.block_version; + else + object.block_version = options.longs === String ? $util.Long.prototype.toString.call(message.block_version) : options.longs === Number ? new $util.LongBits(message.block_version.low >>> 0, message.block_version.high >>> 0).toNumber(true) : message.block_version; + if (message.p2p_version != null && message.hasOwnProperty("p2p_version")) + if (typeof message.p2p_version === "number") + object.p2p_version = options.longs === String ? String(message.p2p_version) : message.p2p_version; + else + object.p2p_version = options.longs === String ? $util.Long.prototype.toString.call(message.p2p_version) : options.longs === Number ? new $util.LongBits(message.p2p_version.low >>> 0, message.p2p_version.high >>> 0).toNumber(true) : message.p2p_version; + return object; + }; + + /** + * Converts this RequestInfo to JSON. + * @function toJSON + * @memberof tendermint.abci.RequestInfo + * @instance + * @returns {Object.} JSON object + */ + RequestInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RequestInfo; + })(); + + abci.RequestSetOption = (function() { + + /** + * Properties of a RequestSetOption. + * @memberof tendermint.abci + * @interface IRequestSetOption + * @property {string|null} [key] RequestSetOption key + * @property {string|null} [value] RequestSetOption value + */ + + /** + * Constructs a new RequestSetOption. + * @memberof tendermint.abci + * @classdesc Represents a RequestSetOption. + * @implements IRequestSetOption + * @constructor + * @param {tendermint.abci.IRequestSetOption=} [properties] Properties to set + */ + function RequestSetOption(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RequestSetOption key. + * @member {string} key + * @memberof tendermint.abci.RequestSetOption + * @instance + */ + RequestSetOption.prototype.key = ""; + + /** + * RequestSetOption value. + * @member {string} value + * @memberof tendermint.abci.RequestSetOption + * @instance + */ + RequestSetOption.prototype.value = ""; + + /** + * Encodes the specified RequestSetOption message. Does not implicitly {@link tendermint.abci.RequestSetOption.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.RequestSetOption + * @static + * @param {tendermint.abci.IRequestSetOption} message RequestSetOption message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestSetOption.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); + return writer; + }; + + /** + * Encodes the specified RequestSetOption message, length delimited. Does not implicitly {@link tendermint.abci.RequestSetOption.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.RequestSetOption + * @static + * @param {tendermint.abci.IRequestSetOption} message RequestSetOption message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestSetOption.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RequestSetOption message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.RequestSetOption + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.RequestSetOption} RequestSetOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestSetOption.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.RequestSetOption(); + while (reader.pos < end) { + let 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; + }; + + /** + * Decodes a RequestSetOption message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.RequestSetOption + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.RequestSetOption} RequestSetOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestSetOption.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RequestSetOption message. + * @function verify + * @memberof tendermint.abci.RequestSetOption + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RequestSetOption.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + return null; + }; + + /** + * Creates a RequestSetOption message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.RequestSetOption + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.RequestSetOption} RequestSetOption + */ + RequestSetOption.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.RequestSetOption) + return object; + let message = new $root.tendermint.abci.RequestSetOption(); + if (object.key != null) + message.key = String(object.key); + if (object.value != null) + message.value = String(object.value); + return message; + }; + + /** + * Creates a plain object from a RequestSetOption message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.RequestSetOption + * @static + * @param {tendermint.abci.RequestSetOption} message RequestSetOption + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RequestSetOption.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.key = ""; + object.value = ""; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this RequestSetOption to JSON. + * @function toJSON + * @memberof tendermint.abci.RequestSetOption + * @instance + * @returns {Object.} JSON object + */ + RequestSetOption.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RequestSetOption; + })(); + + abci.RequestInitChain = (function() { + + /** + * Properties of a RequestInitChain. + * @memberof tendermint.abci + * @interface IRequestInitChain + * @property {google.protobuf.ITimestamp|null} [time] RequestInitChain time + * @property {string|null} [chain_id] RequestInitChain chain_id + * @property {tendermint.abci.IConsensusParams|null} [consensus_params] RequestInitChain consensus_params + * @property {Array.|null} [validators] RequestInitChain validators + * @property {Uint8Array|null} [app_state_bytes] RequestInitChain app_state_bytes + * @property {Long|null} [initial_height] RequestInitChain initial_height + */ + + /** + * Constructs a new RequestInitChain. + * @memberof tendermint.abci + * @classdesc Represents a RequestInitChain. + * @implements IRequestInitChain + * @constructor + * @param {tendermint.abci.IRequestInitChain=} [properties] Properties to set + */ + function RequestInitChain(properties) { + this.validators = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RequestInitChain time. + * @member {google.protobuf.ITimestamp|null|undefined} time + * @memberof tendermint.abci.RequestInitChain + * @instance + */ + RequestInitChain.prototype.time = null; + + /** + * RequestInitChain chain_id. + * @member {string} chain_id + * @memberof tendermint.abci.RequestInitChain + * @instance + */ + RequestInitChain.prototype.chain_id = ""; + + /** + * RequestInitChain consensus_params. + * @member {tendermint.abci.IConsensusParams|null|undefined} consensus_params + * @memberof tendermint.abci.RequestInitChain + * @instance + */ + RequestInitChain.prototype.consensus_params = null; + + /** + * RequestInitChain validators. + * @member {Array.} validators + * @memberof tendermint.abci.RequestInitChain + * @instance + */ + RequestInitChain.prototype.validators = $util.emptyArray; + + /** + * RequestInitChain app_state_bytes. + * @member {Uint8Array} app_state_bytes + * @memberof tendermint.abci.RequestInitChain + * @instance + */ + RequestInitChain.prototype.app_state_bytes = $util.newBuffer([]); + + /** + * RequestInitChain initial_height. + * @member {Long} initial_height + * @memberof tendermint.abci.RequestInitChain + * @instance + */ + RequestInitChain.prototype.initial_height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Encodes the specified RequestInitChain message. Does not implicitly {@link tendermint.abci.RequestInitChain.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.RequestInitChain + * @static + * @param {tendermint.abci.IRequestInitChain} message RequestInitChain message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestInitChain.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.time != null && Object.hasOwnProperty.call(message, "time")) + $root.google.protobuf.Timestamp.encode(message.time, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.chain_id != null && Object.hasOwnProperty.call(message, "chain_id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.chain_id); + if (message.consensus_params != null && Object.hasOwnProperty.call(message, "consensus_params")) + $root.tendermint.abci.ConsensusParams.encode(message.consensus_params, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.validators != null && message.validators.length) + for (let i = 0; i < message.validators.length; ++i) + $root.tendermint.abci.ValidatorUpdate.encode(message.validators[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.app_state_bytes != null && Object.hasOwnProperty.call(message, "app_state_bytes")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.app_state_bytes); + if (message.initial_height != null && Object.hasOwnProperty.call(message, "initial_height")) + writer.uint32(/* id 6, wireType 0 =*/48).int64(message.initial_height); + return writer; + }; + + /** + * Encodes the specified RequestInitChain message, length delimited. Does not implicitly {@link tendermint.abci.RequestInitChain.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.RequestInitChain + * @static + * @param {tendermint.abci.IRequestInitChain} message RequestInitChain message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestInitChain.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RequestInitChain message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.RequestInitChain + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.RequestInitChain} RequestInitChain + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestInitChain.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.RequestInitChain(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 2: + message.chain_id = reader.string(); + break; + case 3: + message.consensus_params = $root.tendermint.abci.ConsensusParams.decode(reader, reader.uint32()); + break; + case 4: + if (!(message.validators && message.validators.length)) + message.validators = []; + message.validators.push($root.tendermint.abci.ValidatorUpdate.decode(reader, reader.uint32())); + break; + case 5: + message.app_state_bytes = reader.bytes(); + break; + case 6: + message.initial_height = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RequestInitChain message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.RequestInitChain + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.RequestInitChain} RequestInitChain + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestInitChain.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RequestInitChain message. + * @function verify + * @memberof tendermint.abci.RequestInitChain + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RequestInitChain.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.time != null && message.hasOwnProperty("time")) { + let error = $root.google.protobuf.Timestamp.verify(message.time); + if (error) + return "time." + error; + } + if (message.chain_id != null && message.hasOwnProperty("chain_id")) + if (!$util.isString(message.chain_id)) + return "chain_id: string expected"; + if (message.consensus_params != null && message.hasOwnProperty("consensus_params")) { + let error = $root.tendermint.abci.ConsensusParams.verify(message.consensus_params); + if (error) + return "consensus_params." + error; + } + if (message.validators != null && message.hasOwnProperty("validators")) { + if (!Array.isArray(message.validators)) + return "validators: array expected"; + for (let i = 0; i < message.validators.length; ++i) { + let error = $root.tendermint.abci.ValidatorUpdate.verify(message.validators[i]); + if (error) + return "validators." + error; + } + } + if (message.app_state_bytes != null && message.hasOwnProperty("app_state_bytes")) + if (!(message.app_state_bytes && typeof message.app_state_bytes.length === "number" || $util.isString(message.app_state_bytes))) + return "app_state_bytes: buffer expected"; + if (message.initial_height != null && message.hasOwnProperty("initial_height")) + if (!$util.isInteger(message.initial_height) && !(message.initial_height && $util.isInteger(message.initial_height.low) && $util.isInteger(message.initial_height.high))) + return "initial_height: integer|Long expected"; + return null; + }; + + /** + * Creates a RequestInitChain message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.RequestInitChain + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.RequestInitChain} RequestInitChain + */ + RequestInitChain.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.RequestInitChain) + return object; + let message = new $root.tendermint.abci.RequestInitChain(); + if (object.time != null) { + if (typeof object.time !== "object") + throw TypeError(".tendermint.abci.RequestInitChain.time: object expected"); + message.time = $root.google.protobuf.Timestamp.fromObject(object.time); + } + if (object.chain_id != null) + message.chain_id = String(object.chain_id); + if (object.consensus_params != null) { + if (typeof object.consensus_params !== "object") + throw TypeError(".tendermint.abci.RequestInitChain.consensus_params: object expected"); + message.consensus_params = $root.tendermint.abci.ConsensusParams.fromObject(object.consensus_params); + } + if (object.validators) { + if (!Array.isArray(object.validators)) + throw TypeError(".tendermint.abci.RequestInitChain.validators: array expected"); + message.validators = []; + for (let i = 0; i < object.validators.length; ++i) { + if (typeof object.validators[i] !== "object") + throw TypeError(".tendermint.abci.RequestInitChain.validators: object expected"); + message.validators[i] = $root.tendermint.abci.ValidatorUpdate.fromObject(object.validators[i]); + } + } + if (object.app_state_bytes != null) + if (typeof object.app_state_bytes === "string") + $util.base64.decode(object.app_state_bytes, message.app_state_bytes = $util.newBuffer($util.base64.length(object.app_state_bytes)), 0); + else if (object.app_state_bytes.length) + message.app_state_bytes = object.app_state_bytes; + if (object.initial_height != null) + if ($util.Long) + (message.initial_height = $util.Long.fromValue(object.initial_height)).unsigned = false; + else if (typeof object.initial_height === "string") + message.initial_height = parseInt(object.initial_height, 10); + else if (typeof object.initial_height === "number") + message.initial_height = object.initial_height; + else if (typeof object.initial_height === "object") + message.initial_height = new $util.LongBits(object.initial_height.low >>> 0, object.initial_height.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a RequestInitChain message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.RequestInitChain + * @static + * @param {tendermint.abci.RequestInitChain} message RequestInitChain + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RequestInitChain.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.validators = []; + if (options.defaults) { + object.time = null; + object.chain_id = ""; + object.consensus_params = null; + if (options.bytes === String) + object.app_state_bytes = ""; + else { + object.app_state_bytes = []; + if (options.bytes !== Array) + object.app_state_bytes = $util.newBuffer(object.app_state_bytes); + } + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.initial_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.initial_height = options.longs === String ? "0" : 0; + } + if (message.time != null && message.hasOwnProperty("time")) + object.time = $root.google.protobuf.Timestamp.toObject(message.time, options); + if (message.chain_id != null && message.hasOwnProperty("chain_id")) + object.chain_id = message.chain_id; + if (message.consensus_params != null && message.hasOwnProperty("consensus_params")) + object.consensus_params = $root.tendermint.abci.ConsensusParams.toObject(message.consensus_params, options); + if (message.validators && message.validators.length) { + object.validators = []; + for (let j = 0; j < message.validators.length; ++j) + object.validators[j] = $root.tendermint.abci.ValidatorUpdate.toObject(message.validators[j], options); + } + if (message.app_state_bytes != null && message.hasOwnProperty("app_state_bytes")) + object.app_state_bytes = options.bytes === String ? $util.base64.encode(message.app_state_bytes, 0, message.app_state_bytes.length) : options.bytes === Array ? Array.prototype.slice.call(message.app_state_bytes) : message.app_state_bytes; + if (message.initial_height != null && message.hasOwnProperty("initial_height")) + if (typeof message.initial_height === "number") + object.initial_height = options.longs === String ? String(message.initial_height) : message.initial_height; + else + object.initial_height = options.longs === String ? $util.Long.prototype.toString.call(message.initial_height) : options.longs === Number ? new $util.LongBits(message.initial_height.low >>> 0, message.initial_height.high >>> 0).toNumber() : message.initial_height; + return object; + }; + + /** + * Converts this RequestInitChain to JSON. + * @function toJSON + * @memberof tendermint.abci.RequestInitChain + * @instance + * @returns {Object.} JSON object + */ + RequestInitChain.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RequestInitChain; + })(); + + abci.RequestQuery = (function() { + + /** + * Properties of a RequestQuery. + * @memberof tendermint.abci + * @interface IRequestQuery + * @property {Uint8Array|null} [data] RequestQuery data + * @property {string|null} [path] RequestQuery path + * @property {Long|null} [height] RequestQuery height + * @property {boolean|null} [prove] RequestQuery prove + */ + + /** + * Constructs a new RequestQuery. + * @memberof tendermint.abci + * @classdesc Represents a RequestQuery. + * @implements IRequestQuery + * @constructor + * @param {tendermint.abci.IRequestQuery=} [properties] Properties to set + */ + function RequestQuery(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RequestQuery data. + * @member {Uint8Array} data + * @memberof tendermint.abci.RequestQuery + * @instance + */ + RequestQuery.prototype.data = $util.newBuffer([]); + + /** + * RequestQuery path. + * @member {string} path + * @memberof tendermint.abci.RequestQuery + * @instance + */ + RequestQuery.prototype.path = ""; + + /** + * RequestQuery height. + * @member {Long} height + * @memberof tendermint.abci.RequestQuery + * @instance + */ + RequestQuery.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * RequestQuery prove. + * @member {boolean} prove + * @memberof tendermint.abci.RequestQuery + * @instance + */ + RequestQuery.prototype.prove = false; + + /** + * Encodes the specified RequestQuery message. Does not implicitly {@link tendermint.abci.RequestQuery.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.RequestQuery + * @static + * @param {tendermint.abci.IRequestQuery} message RequestQuery message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestQuery.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.data != null && Object.hasOwnProperty.call(message, "data")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.data); + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.height); + if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.prove); + return writer; + }; + + /** + * Encodes the specified RequestQuery message, length delimited. Does not implicitly {@link tendermint.abci.RequestQuery.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.RequestQuery + * @static + * @param {tendermint.abci.IRequestQuery} message RequestQuery message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestQuery.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RequestQuery message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.RequestQuery + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.RequestQuery} RequestQuery + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestQuery.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.RequestQuery(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.data = reader.bytes(); + break; + case 2: + message.path = reader.string(); + break; + case 3: + message.height = reader.int64(); + break; + case 4: + message.prove = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RequestQuery message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.RequestQuery + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.RequestQuery} RequestQuery + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestQuery.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RequestQuery message. + * @function verify + * @memberof tendermint.abci.RequestQuery + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RequestQuery.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.data != null && message.hasOwnProperty("data")) + if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) + return "data: buffer expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!$util.isString(message.path)) + return "path: string expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) + return "height: integer|Long expected"; + if (message.prove != null && message.hasOwnProperty("prove")) + if (typeof message.prove !== "boolean") + return "prove: boolean expected"; + return null; + }; + + /** + * Creates a RequestQuery message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.RequestQuery + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.RequestQuery} RequestQuery + */ + RequestQuery.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.RequestQuery) + return object; + let message = new $root.tendermint.abci.RequestQuery(); + if (object.data != null) + if (typeof object.data === "string") + $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); + else if (object.data.length) + message.data = object.data; + if (object.path != null) + message.path = String(object.path); + if (object.height != null) + if ($util.Long) + (message.height = $util.Long.fromValue(object.height)).unsigned = false; + else if (typeof object.height === "string") + message.height = parseInt(object.height, 10); + else if (typeof object.height === "number") + message.height = object.height; + else if (typeof object.height === "object") + message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); + if (object.prove != null) + message.prove = Boolean(object.prove); + return message; + }; + + /** + * Creates a plain object from a RequestQuery message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.RequestQuery + * @static + * @param {tendermint.abci.RequestQuery} message RequestQuery + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RequestQuery.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if (options.bytes === String) + object.data = ""; + else { + object.data = []; + if (options.bytes !== Array) + object.data = $util.newBuffer(object.data); + } + object.path = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.height = options.longs === String ? "0" : 0; + object.prove = false; + } + if (message.data != null && message.hasOwnProperty("data")) + object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; + if (message.path != null && message.hasOwnProperty("path")) + object.path = message.path; + if (message.height != null && message.hasOwnProperty("height")) + if (typeof message.height === "number") + object.height = options.longs === String ? String(message.height) : message.height; + else + object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; + if (message.prove != null && message.hasOwnProperty("prove")) + object.prove = message.prove; + return object; + }; + + /** + * Converts this RequestQuery to JSON. + * @function toJSON + * @memberof tendermint.abci.RequestQuery + * @instance + * @returns {Object.} JSON object + */ + RequestQuery.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RequestQuery; + })(); + + abci.RequestBeginBlock = (function() { + + /** + * Properties of a RequestBeginBlock. + * @memberof tendermint.abci + * @interface IRequestBeginBlock + * @property {Uint8Array|null} [hash] RequestBeginBlock hash + * @property {tendermint.types.IHeader|null} [header] RequestBeginBlock header + * @property {tendermint.abci.ILastCommitInfo|null} [last_commit_info] RequestBeginBlock last_commit_info + * @property {Array.|null} [byzantine_validators] RequestBeginBlock byzantine_validators + */ + + /** + * Constructs a new RequestBeginBlock. + * @memberof tendermint.abci + * @classdesc Represents a RequestBeginBlock. + * @implements IRequestBeginBlock + * @constructor + * @param {tendermint.abci.IRequestBeginBlock=} [properties] Properties to set + */ + function RequestBeginBlock(properties) { + this.byzantine_validators = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RequestBeginBlock hash. + * @member {Uint8Array} hash + * @memberof tendermint.abci.RequestBeginBlock + * @instance + */ + RequestBeginBlock.prototype.hash = $util.newBuffer([]); + + /** + * RequestBeginBlock header. + * @member {tendermint.types.IHeader|null|undefined} header + * @memberof tendermint.abci.RequestBeginBlock + * @instance + */ + RequestBeginBlock.prototype.header = null; + + /** + * RequestBeginBlock last_commit_info. + * @member {tendermint.abci.ILastCommitInfo|null|undefined} last_commit_info + * @memberof tendermint.abci.RequestBeginBlock + * @instance + */ + RequestBeginBlock.prototype.last_commit_info = null; + + /** + * RequestBeginBlock byzantine_validators. + * @member {Array.} byzantine_validators + * @memberof tendermint.abci.RequestBeginBlock + * @instance + */ + RequestBeginBlock.prototype.byzantine_validators = $util.emptyArray; + + /** + * Encodes the specified RequestBeginBlock message. Does not implicitly {@link tendermint.abci.RequestBeginBlock.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.RequestBeginBlock + * @static + * @param {tendermint.abci.IRequestBeginBlock} message RequestBeginBlock message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestBeginBlock.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.hash != null && Object.hasOwnProperty.call(message, "hash")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.hash); + if (message.header != null && Object.hasOwnProperty.call(message, "header")) + $root.tendermint.types.Header.encode(message.header, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.last_commit_info != null && Object.hasOwnProperty.call(message, "last_commit_info")) + $root.tendermint.abci.LastCommitInfo.encode(message.last_commit_info, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.byzantine_validators != null && message.byzantine_validators.length) + for (let i = 0; i < message.byzantine_validators.length; ++i) + $root.tendermint.abci.Evidence.encode(message.byzantine_validators[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified RequestBeginBlock message, length delimited. Does not implicitly {@link tendermint.abci.RequestBeginBlock.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.RequestBeginBlock + * @static + * @param {tendermint.abci.IRequestBeginBlock} message RequestBeginBlock message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestBeginBlock.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RequestBeginBlock message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.RequestBeginBlock + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.RequestBeginBlock} RequestBeginBlock + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestBeginBlock.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.RequestBeginBlock(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.bytes(); + break; + case 2: + message.header = $root.tendermint.types.Header.decode(reader, reader.uint32()); + break; + case 3: + message.last_commit_info = $root.tendermint.abci.LastCommitInfo.decode(reader, reader.uint32()); + break; + case 4: + if (!(message.byzantine_validators && message.byzantine_validators.length)) + message.byzantine_validators = []; + message.byzantine_validators.push($root.tendermint.abci.Evidence.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RequestBeginBlock message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.RequestBeginBlock + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.RequestBeginBlock} RequestBeginBlock + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestBeginBlock.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RequestBeginBlock message. + * @function verify + * @memberof tendermint.abci.RequestBeginBlock + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RequestBeginBlock.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.hash != null && message.hasOwnProperty("hash")) + if (!(message.hash && typeof message.hash.length === "number" || $util.isString(message.hash))) + return "hash: buffer expected"; + if (message.header != null && message.hasOwnProperty("header")) { + let error = $root.tendermint.types.Header.verify(message.header); + if (error) + return "header." + error; + } + if (message.last_commit_info != null && message.hasOwnProperty("last_commit_info")) { + let error = $root.tendermint.abci.LastCommitInfo.verify(message.last_commit_info); + if (error) + return "last_commit_info." + error; + } + if (message.byzantine_validators != null && message.hasOwnProperty("byzantine_validators")) { + if (!Array.isArray(message.byzantine_validators)) + return "byzantine_validators: array expected"; + for (let i = 0; i < message.byzantine_validators.length; ++i) { + let error = $root.tendermint.abci.Evidence.verify(message.byzantine_validators[i]); + if (error) + return "byzantine_validators." + error; + } + } + return null; + }; + + /** + * Creates a RequestBeginBlock message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.RequestBeginBlock + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.RequestBeginBlock} RequestBeginBlock + */ + RequestBeginBlock.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.RequestBeginBlock) + return object; + let message = new $root.tendermint.abci.RequestBeginBlock(); + if (object.hash != null) + if (typeof object.hash === "string") + $util.base64.decode(object.hash, message.hash = $util.newBuffer($util.base64.length(object.hash)), 0); + else if (object.hash.length) + message.hash = object.hash; + if (object.header != null) { + if (typeof object.header !== "object") + throw TypeError(".tendermint.abci.RequestBeginBlock.header: object expected"); + message.header = $root.tendermint.types.Header.fromObject(object.header); + } + if (object.last_commit_info != null) { + if (typeof object.last_commit_info !== "object") + throw TypeError(".tendermint.abci.RequestBeginBlock.last_commit_info: object expected"); + message.last_commit_info = $root.tendermint.abci.LastCommitInfo.fromObject(object.last_commit_info); + } + if (object.byzantine_validators) { + if (!Array.isArray(object.byzantine_validators)) + throw TypeError(".tendermint.abci.RequestBeginBlock.byzantine_validators: array expected"); + message.byzantine_validators = []; + for (let i = 0; i < object.byzantine_validators.length; ++i) { + if (typeof object.byzantine_validators[i] !== "object") + throw TypeError(".tendermint.abci.RequestBeginBlock.byzantine_validators: object expected"); + message.byzantine_validators[i] = $root.tendermint.abci.Evidence.fromObject(object.byzantine_validators[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a RequestBeginBlock message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.RequestBeginBlock + * @static + * @param {tendermint.abci.RequestBeginBlock} message RequestBeginBlock + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RequestBeginBlock.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.byzantine_validators = []; + if (options.defaults) { + if (options.bytes === String) + object.hash = ""; + else { + object.hash = []; + if (options.bytes !== Array) + object.hash = $util.newBuffer(object.hash); + } + object.header = null; + object.last_commit_info = null; + } + if (message.hash != null && message.hasOwnProperty("hash")) + object.hash = options.bytes === String ? $util.base64.encode(message.hash, 0, message.hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.hash) : message.hash; + if (message.header != null && message.hasOwnProperty("header")) + object.header = $root.tendermint.types.Header.toObject(message.header, options); + if (message.last_commit_info != null && message.hasOwnProperty("last_commit_info")) + object.last_commit_info = $root.tendermint.abci.LastCommitInfo.toObject(message.last_commit_info, options); + if (message.byzantine_validators && message.byzantine_validators.length) { + object.byzantine_validators = []; + for (let j = 0; j < message.byzantine_validators.length; ++j) + object.byzantine_validators[j] = $root.tendermint.abci.Evidence.toObject(message.byzantine_validators[j], options); + } + return object; + }; + + /** + * Converts this RequestBeginBlock to JSON. + * @function toJSON + * @memberof tendermint.abci.RequestBeginBlock + * @instance + * @returns {Object.} JSON object + */ + RequestBeginBlock.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RequestBeginBlock; + })(); + + /** + * CheckTxType enum. + * @name tendermint.abci.CheckTxType + * @enum {number} + * @property {number} NEW=0 NEW value + * @property {number} RECHECK=1 RECHECK value + */ + abci.CheckTxType = (function() { + const valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NEW"] = 0; + values[valuesById[1] = "RECHECK"] = 1; + return values; + })(); + + abci.RequestCheckTx = (function() { + + /** + * Properties of a RequestCheckTx. + * @memberof tendermint.abci + * @interface IRequestCheckTx + * @property {Uint8Array|null} [tx] RequestCheckTx tx + * @property {tendermint.abci.CheckTxType|null} [type] RequestCheckTx type + */ + + /** + * Constructs a new RequestCheckTx. + * @memberof tendermint.abci + * @classdesc Represents a RequestCheckTx. + * @implements IRequestCheckTx + * @constructor + * @param {tendermint.abci.IRequestCheckTx=} [properties] Properties to set + */ + function RequestCheckTx(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RequestCheckTx tx. + * @member {Uint8Array} tx + * @memberof tendermint.abci.RequestCheckTx + * @instance + */ + RequestCheckTx.prototype.tx = $util.newBuffer([]); + + /** + * RequestCheckTx type. + * @member {tendermint.abci.CheckTxType} type + * @memberof tendermint.abci.RequestCheckTx + * @instance + */ + RequestCheckTx.prototype.type = 0; + + /** + * Encodes the specified RequestCheckTx message. Does not implicitly {@link tendermint.abci.RequestCheckTx.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.RequestCheckTx + * @static + * @param {tendermint.abci.IRequestCheckTx} message RequestCheckTx message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestCheckTx.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.tx != null && Object.hasOwnProperty.call(message, "tx")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.tx); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.type); + return writer; + }; + + /** + * Encodes the specified RequestCheckTx message, length delimited. Does not implicitly {@link tendermint.abci.RequestCheckTx.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.RequestCheckTx + * @static + * @param {tendermint.abci.IRequestCheckTx} message RequestCheckTx message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestCheckTx.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RequestCheckTx message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.RequestCheckTx + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.RequestCheckTx} RequestCheckTx + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestCheckTx.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.RequestCheckTx(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx = reader.bytes(); + break; + case 2: + message.type = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RequestCheckTx message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.RequestCheckTx + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.RequestCheckTx} RequestCheckTx + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestCheckTx.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RequestCheckTx message. + * @function verify + * @memberof tendermint.abci.RequestCheckTx + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RequestCheckTx.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.tx != null && message.hasOwnProperty("tx")) + if (!(message.tx && typeof message.tx.length === "number" || $util.isString(message.tx))) + return "tx: buffer expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + break; + } + return null; + }; + + /** + * Creates a RequestCheckTx message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.RequestCheckTx + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.RequestCheckTx} RequestCheckTx + */ + RequestCheckTx.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.RequestCheckTx) + return object; + let message = new $root.tendermint.abci.RequestCheckTx(); + if (object.tx != null) + if (typeof object.tx === "string") + $util.base64.decode(object.tx, message.tx = $util.newBuffer($util.base64.length(object.tx)), 0); + else if (object.tx.length) + message.tx = object.tx; + switch (object.type) { + case "NEW": + case 0: + message.type = 0; + break; + case "RECHECK": + case 1: + message.type = 1; + break; + } + return message; + }; + + /** + * Creates a plain object from a RequestCheckTx message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.RequestCheckTx + * @static + * @param {tendermint.abci.RequestCheckTx} message RequestCheckTx + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RequestCheckTx.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if (options.bytes === String) + object.tx = ""; + else { + object.tx = []; + if (options.bytes !== Array) + object.tx = $util.newBuffer(object.tx); + } + object.type = options.enums === String ? "NEW" : 0; + } + if (message.tx != null && message.hasOwnProperty("tx")) + object.tx = options.bytes === String ? $util.base64.encode(message.tx, 0, message.tx.length) : options.bytes === Array ? Array.prototype.slice.call(message.tx) : message.tx; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.tendermint.abci.CheckTxType[message.type] : message.type; + return object; + }; + + /** + * Converts this RequestCheckTx to JSON. + * @function toJSON + * @memberof tendermint.abci.RequestCheckTx + * @instance + * @returns {Object.} JSON object + */ + RequestCheckTx.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RequestCheckTx; + })(); + + abci.RequestDeliverTx = (function() { + + /** + * Properties of a RequestDeliverTx. + * @memberof tendermint.abci + * @interface IRequestDeliverTx + * @property {Uint8Array|null} [tx] RequestDeliverTx tx + */ + + /** + * Constructs a new RequestDeliverTx. + * @memberof tendermint.abci + * @classdesc Represents a RequestDeliverTx. + * @implements IRequestDeliverTx + * @constructor + * @param {tendermint.abci.IRequestDeliverTx=} [properties] Properties to set + */ + function RequestDeliverTx(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RequestDeliverTx tx. + * @member {Uint8Array} tx + * @memberof tendermint.abci.RequestDeliverTx + * @instance + */ + RequestDeliverTx.prototype.tx = $util.newBuffer([]); + + /** + * Encodes the specified RequestDeliverTx message. Does not implicitly {@link tendermint.abci.RequestDeliverTx.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.RequestDeliverTx + * @static + * @param {tendermint.abci.IRequestDeliverTx} message RequestDeliverTx message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestDeliverTx.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.tx != null && Object.hasOwnProperty.call(message, "tx")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.tx); + return writer; + }; + + /** + * Encodes the specified RequestDeliverTx message, length delimited. Does not implicitly {@link tendermint.abci.RequestDeliverTx.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.RequestDeliverTx + * @static + * @param {tendermint.abci.IRequestDeliverTx} message RequestDeliverTx message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestDeliverTx.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RequestDeliverTx message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.RequestDeliverTx + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.RequestDeliverTx} RequestDeliverTx + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestDeliverTx.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.RequestDeliverTx(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RequestDeliverTx message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.RequestDeliverTx + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.RequestDeliverTx} RequestDeliverTx + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestDeliverTx.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RequestDeliverTx message. + * @function verify + * @memberof tendermint.abci.RequestDeliverTx + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RequestDeliverTx.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.tx != null && message.hasOwnProperty("tx")) + if (!(message.tx && typeof message.tx.length === "number" || $util.isString(message.tx))) + return "tx: buffer expected"; + return null; + }; + + /** + * Creates a RequestDeliverTx message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.RequestDeliverTx + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.RequestDeliverTx} RequestDeliverTx + */ + RequestDeliverTx.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.RequestDeliverTx) + return object; + let message = new $root.tendermint.abci.RequestDeliverTx(); + if (object.tx != null) + if (typeof object.tx === "string") + $util.base64.decode(object.tx, message.tx = $util.newBuffer($util.base64.length(object.tx)), 0); + else if (object.tx.length) + message.tx = object.tx; + return message; + }; + + /** + * Creates a plain object from a RequestDeliverTx message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.RequestDeliverTx + * @static + * @param {tendermint.abci.RequestDeliverTx} message RequestDeliverTx + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RequestDeliverTx.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + if (options.bytes === String) + object.tx = ""; + else { + object.tx = []; + if (options.bytes !== Array) + object.tx = $util.newBuffer(object.tx); + } + if (message.tx != null && message.hasOwnProperty("tx")) + object.tx = options.bytes === String ? $util.base64.encode(message.tx, 0, message.tx.length) : options.bytes === Array ? Array.prototype.slice.call(message.tx) : message.tx; + return object; + }; + + /** + * Converts this RequestDeliverTx to JSON. + * @function toJSON + * @memberof tendermint.abci.RequestDeliverTx + * @instance + * @returns {Object.} JSON object + */ + RequestDeliverTx.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RequestDeliverTx; + })(); + + abci.RequestEndBlock = (function() { + + /** + * Properties of a RequestEndBlock. + * @memberof tendermint.abci + * @interface IRequestEndBlock + * @property {Long|null} [height] RequestEndBlock height + */ + + /** + * Constructs a new RequestEndBlock. + * @memberof tendermint.abci + * @classdesc Represents a RequestEndBlock. + * @implements IRequestEndBlock + * @constructor + * @param {tendermint.abci.IRequestEndBlock=} [properties] Properties to set + */ + function RequestEndBlock(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RequestEndBlock height. + * @member {Long} height + * @memberof tendermint.abci.RequestEndBlock + * @instance + */ + RequestEndBlock.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Encodes the specified RequestEndBlock message. Does not implicitly {@link tendermint.abci.RequestEndBlock.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.RequestEndBlock + * @static + * @param {tendermint.abci.IRequestEndBlock} message RequestEndBlock message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestEndBlock.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.height); + return writer; + }; + + /** + * Encodes the specified RequestEndBlock message, length delimited. Does not implicitly {@link tendermint.abci.RequestEndBlock.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.RequestEndBlock + * @static + * @param {tendermint.abci.IRequestEndBlock} message RequestEndBlock message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestEndBlock.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RequestEndBlock message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.RequestEndBlock + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.RequestEndBlock} RequestEndBlock + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestEndBlock.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.RequestEndBlock(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RequestEndBlock message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.RequestEndBlock + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.RequestEndBlock} RequestEndBlock + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestEndBlock.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RequestEndBlock message. + * @function verify + * @memberof tendermint.abci.RequestEndBlock + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RequestEndBlock.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) + return "height: integer|Long expected"; + return null; + }; + + /** + * Creates a RequestEndBlock message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.RequestEndBlock + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.RequestEndBlock} RequestEndBlock + */ + RequestEndBlock.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.RequestEndBlock) + return object; + let message = new $root.tendermint.abci.RequestEndBlock(); + if (object.height != null) + if ($util.Long) + (message.height = $util.Long.fromValue(object.height)).unsigned = false; + else if (typeof object.height === "string") + message.height = parseInt(object.height, 10); + else if (typeof object.height === "number") + message.height = object.height; + else if (typeof object.height === "object") + message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a RequestEndBlock message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.RequestEndBlock + * @static + * @param {tendermint.abci.RequestEndBlock} message RequestEndBlock + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RequestEndBlock.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.height = options.longs === String ? "0" : 0; + if (message.height != null && message.hasOwnProperty("height")) + if (typeof message.height === "number") + object.height = options.longs === String ? String(message.height) : message.height; + else + object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; + return object; + }; + + /** + * Converts this RequestEndBlock to JSON. + * @function toJSON + * @memberof tendermint.abci.RequestEndBlock + * @instance + * @returns {Object.} JSON object + */ + RequestEndBlock.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RequestEndBlock; + })(); + + abci.RequestCommit = (function() { + + /** + * Properties of a RequestCommit. + * @memberof tendermint.abci + * @interface IRequestCommit + */ + + /** + * Constructs a new RequestCommit. + * @memberof tendermint.abci + * @classdesc Represents a RequestCommit. + * @implements IRequestCommit + * @constructor + * @param {tendermint.abci.IRequestCommit=} [properties] Properties to set + */ + function RequestCommit(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified RequestCommit message. Does not implicitly {@link tendermint.abci.RequestCommit.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.RequestCommit + * @static + * @param {tendermint.abci.IRequestCommit} message RequestCommit message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestCommit.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified RequestCommit message, length delimited. Does not implicitly {@link tendermint.abci.RequestCommit.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.RequestCommit + * @static + * @param {tendermint.abci.IRequestCommit} message RequestCommit message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestCommit.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RequestCommit message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.RequestCommit + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.RequestCommit} RequestCommit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestCommit.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.RequestCommit(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RequestCommit message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.RequestCommit + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.RequestCommit} RequestCommit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestCommit.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RequestCommit message. + * @function verify + * @memberof tendermint.abci.RequestCommit + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RequestCommit.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a RequestCommit message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.RequestCommit + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.RequestCommit} RequestCommit + */ + RequestCommit.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.RequestCommit) + return object; + return new $root.tendermint.abci.RequestCommit(); + }; + + /** + * Creates a plain object from a RequestCommit message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.RequestCommit + * @static + * @param {tendermint.abci.RequestCommit} message RequestCommit + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RequestCommit.toObject = function toObject() { + return {}; + }; + + /** + * Converts this RequestCommit to JSON. + * @function toJSON + * @memberof tendermint.abci.RequestCommit + * @instance + * @returns {Object.} JSON object + */ + RequestCommit.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RequestCommit; + })(); + + abci.RequestListSnapshots = (function() { + + /** + * Properties of a RequestListSnapshots. + * @memberof tendermint.abci + * @interface IRequestListSnapshots + */ + + /** + * Constructs a new RequestListSnapshots. + * @memberof tendermint.abci + * @classdesc Represents a RequestListSnapshots. + * @implements IRequestListSnapshots + * @constructor + * @param {tendermint.abci.IRequestListSnapshots=} [properties] Properties to set + */ + function RequestListSnapshots(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified RequestListSnapshots message. Does not implicitly {@link tendermint.abci.RequestListSnapshots.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.RequestListSnapshots + * @static + * @param {tendermint.abci.IRequestListSnapshots} message RequestListSnapshots message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestListSnapshots.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified RequestListSnapshots message, length delimited. Does not implicitly {@link tendermint.abci.RequestListSnapshots.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.RequestListSnapshots + * @static + * @param {tendermint.abci.IRequestListSnapshots} message RequestListSnapshots message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestListSnapshots.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RequestListSnapshots message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.RequestListSnapshots + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.RequestListSnapshots} RequestListSnapshots + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestListSnapshots.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.RequestListSnapshots(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RequestListSnapshots message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.RequestListSnapshots + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.RequestListSnapshots} RequestListSnapshots + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestListSnapshots.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RequestListSnapshots message. + * @function verify + * @memberof tendermint.abci.RequestListSnapshots + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RequestListSnapshots.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a RequestListSnapshots message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.RequestListSnapshots + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.RequestListSnapshots} RequestListSnapshots + */ + RequestListSnapshots.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.RequestListSnapshots) + return object; + return new $root.tendermint.abci.RequestListSnapshots(); + }; + + /** + * Creates a plain object from a RequestListSnapshots message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.RequestListSnapshots + * @static + * @param {tendermint.abci.RequestListSnapshots} message RequestListSnapshots + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RequestListSnapshots.toObject = function toObject() { + return {}; + }; + + /** + * Converts this RequestListSnapshots to JSON. + * @function toJSON + * @memberof tendermint.abci.RequestListSnapshots + * @instance + * @returns {Object.} JSON object + */ + RequestListSnapshots.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RequestListSnapshots; + })(); + + abci.RequestOfferSnapshot = (function() { + + /** + * Properties of a RequestOfferSnapshot. + * @memberof tendermint.abci + * @interface IRequestOfferSnapshot + * @property {tendermint.abci.ISnapshot|null} [snapshot] RequestOfferSnapshot snapshot + * @property {Uint8Array|null} [app_hash] RequestOfferSnapshot app_hash + */ + + /** + * Constructs a new RequestOfferSnapshot. + * @memberof tendermint.abci + * @classdesc Represents a RequestOfferSnapshot. + * @implements IRequestOfferSnapshot + * @constructor + * @param {tendermint.abci.IRequestOfferSnapshot=} [properties] Properties to set + */ + function RequestOfferSnapshot(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RequestOfferSnapshot snapshot. + * @member {tendermint.abci.ISnapshot|null|undefined} snapshot + * @memberof tendermint.abci.RequestOfferSnapshot + * @instance + */ + RequestOfferSnapshot.prototype.snapshot = null; + + /** + * RequestOfferSnapshot app_hash. + * @member {Uint8Array} app_hash + * @memberof tendermint.abci.RequestOfferSnapshot + * @instance + */ + RequestOfferSnapshot.prototype.app_hash = $util.newBuffer([]); + + /** + * Encodes the specified RequestOfferSnapshot message. Does not implicitly {@link tendermint.abci.RequestOfferSnapshot.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.RequestOfferSnapshot + * @static + * @param {tendermint.abci.IRequestOfferSnapshot} message RequestOfferSnapshot message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestOfferSnapshot.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.snapshot != null && Object.hasOwnProperty.call(message, "snapshot")) + $root.tendermint.abci.Snapshot.encode(message.snapshot, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.app_hash != null && Object.hasOwnProperty.call(message, "app_hash")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.app_hash); + return writer; + }; + + /** + * Encodes the specified RequestOfferSnapshot message, length delimited. Does not implicitly {@link tendermint.abci.RequestOfferSnapshot.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.RequestOfferSnapshot + * @static + * @param {tendermint.abci.IRequestOfferSnapshot} message RequestOfferSnapshot message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestOfferSnapshot.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RequestOfferSnapshot message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.RequestOfferSnapshot + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.RequestOfferSnapshot} RequestOfferSnapshot + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestOfferSnapshot.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.RequestOfferSnapshot(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.snapshot = $root.tendermint.abci.Snapshot.decode(reader, reader.uint32()); + break; + case 2: + message.app_hash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RequestOfferSnapshot message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.RequestOfferSnapshot + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.RequestOfferSnapshot} RequestOfferSnapshot + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestOfferSnapshot.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RequestOfferSnapshot message. + * @function verify + * @memberof tendermint.abci.RequestOfferSnapshot + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RequestOfferSnapshot.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.snapshot != null && message.hasOwnProperty("snapshot")) { + let error = $root.tendermint.abci.Snapshot.verify(message.snapshot); + if (error) + return "snapshot." + error; + } + if (message.app_hash != null && message.hasOwnProperty("app_hash")) + if (!(message.app_hash && typeof message.app_hash.length === "number" || $util.isString(message.app_hash))) + return "app_hash: buffer expected"; + return null; + }; + + /** + * Creates a RequestOfferSnapshot message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.RequestOfferSnapshot + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.RequestOfferSnapshot} RequestOfferSnapshot + */ + RequestOfferSnapshot.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.RequestOfferSnapshot) + return object; + let message = new $root.tendermint.abci.RequestOfferSnapshot(); + if (object.snapshot != null) { + if (typeof object.snapshot !== "object") + throw TypeError(".tendermint.abci.RequestOfferSnapshot.snapshot: object expected"); + message.snapshot = $root.tendermint.abci.Snapshot.fromObject(object.snapshot); + } + if (object.app_hash != null) + if (typeof object.app_hash === "string") + $util.base64.decode(object.app_hash, message.app_hash = $util.newBuffer($util.base64.length(object.app_hash)), 0); + else if (object.app_hash.length) + message.app_hash = object.app_hash; + return message; + }; + + /** + * Creates a plain object from a RequestOfferSnapshot message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.RequestOfferSnapshot + * @static + * @param {tendermint.abci.RequestOfferSnapshot} message RequestOfferSnapshot + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RequestOfferSnapshot.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.snapshot = null; + if (options.bytes === String) + object.app_hash = ""; + else { + object.app_hash = []; + if (options.bytes !== Array) + object.app_hash = $util.newBuffer(object.app_hash); + } + } + if (message.snapshot != null && message.hasOwnProperty("snapshot")) + object.snapshot = $root.tendermint.abci.Snapshot.toObject(message.snapshot, options); + if (message.app_hash != null && message.hasOwnProperty("app_hash")) + object.app_hash = options.bytes === String ? $util.base64.encode(message.app_hash, 0, message.app_hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.app_hash) : message.app_hash; + return object; + }; + + /** + * Converts this RequestOfferSnapshot to JSON. + * @function toJSON + * @memberof tendermint.abci.RequestOfferSnapshot + * @instance + * @returns {Object.} JSON object + */ + RequestOfferSnapshot.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RequestOfferSnapshot; + })(); + + abci.RequestLoadSnapshotChunk = (function() { + + /** + * Properties of a RequestLoadSnapshotChunk. + * @memberof tendermint.abci + * @interface IRequestLoadSnapshotChunk + * @property {Long|null} [height] RequestLoadSnapshotChunk height + * @property {number|null} [format] RequestLoadSnapshotChunk format + * @property {number|null} [chunk] RequestLoadSnapshotChunk chunk + */ + + /** + * Constructs a new RequestLoadSnapshotChunk. + * @memberof tendermint.abci + * @classdesc Represents a RequestLoadSnapshotChunk. + * @implements IRequestLoadSnapshotChunk + * @constructor + * @param {tendermint.abci.IRequestLoadSnapshotChunk=} [properties] Properties to set + */ + function RequestLoadSnapshotChunk(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RequestLoadSnapshotChunk height. + * @member {Long} height + * @memberof tendermint.abci.RequestLoadSnapshotChunk + * @instance + */ + RequestLoadSnapshotChunk.prototype.height = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * RequestLoadSnapshotChunk format. + * @member {number} format + * @memberof tendermint.abci.RequestLoadSnapshotChunk + * @instance + */ + RequestLoadSnapshotChunk.prototype.format = 0; + + /** + * RequestLoadSnapshotChunk chunk. + * @member {number} chunk + * @memberof tendermint.abci.RequestLoadSnapshotChunk + * @instance + */ + RequestLoadSnapshotChunk.prototype.chunk = 0; + + /** + * Encodes the specified RequestLoadSnapshotChunk message. Does not implicitly {@link tendermint.abci.RequestLoadSnapshotChunk.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.RequestLoadSnapshotChunk + * @static + * @param {tendermint.abci.IRequestLoadSnapshotChunk} message RequestLoadSnapshotChunk message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestLoadSnapshotChunk.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.height); + if (message.format != null && Object.hasOwnProperty.call(message, "format")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.format); + if (message.chunk != null && Object.hasOwnProperty.call(message, "chunk")) + writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.chunk); + return writer; + }; + + /** + * Encodes the specified RequestLoadSnapshotChunk message, length delimited. Does not implicitly {@link tendermint.abci.RequestLoadSnapshotChunk.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.RequestLoadSnapshotChunk + * @static + * @param {tendermint.abci.IRequestLoadSnapshotChunk} message RequestLoadSnapshotChunk message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestLoadSnapshotChunk.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RequestLoadSnapshotChunk message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.RequestLoadSnapshotChunk + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.RequestLoadSnapshotChunk} RequestLoadSnapshotChunk + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestLoadSnapshotChunk.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.RequestLoadSnapshotChunk(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.uint64(); + break; + case 2: + message.format = reader.uint32(); + break; + case 3: + message.chunk = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RequestLoadSnapshotChunk message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.RequestLoadSnapshotChunk + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.RequestLoadSnapshotChunk} RequestLoadSnapshotChunk + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestLoadSnapshotChunk.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RequestLoadSnapshotChunk message. + * @function verify + * @memberof tendermint.abci.RequestLoadSnapshotChunk + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RequestLoadSnapshotChunk.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) + return "height: integer|Long expected"; + if (message.format != null && message.hasOwnProperty("format")) + if (!$util.isInteger(message.format)) + return "format: integer expected"; + if (message.chunk != null && message.hasOwnProperty("chunk")) + if (!$util.isInteger(message.chunk)) + return "chunk: integer expected"; + return null; + }; + + /** + * Creates a RequestLoadSnapshotChunk message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.RequestLoadSnapshotChunk + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.RequestLoadSnapshotChunk} RequestLoadSnapshotChunk + */ + RequestLoadSnapshotChunk.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.RequestLoadSnapshotChunk) + return object; + let message = new $root.tendermint.abci.RequestLoadSnapshotChunk(); + if (object.height != null) + if ($util.Long) + (message.height = $util.Long.fromValue(object.height)).unsigned = true; + else if (typeof object.height === "string") + message.height = parseInt(object.height, 10); + else if (typeof object.height === "number") + message.height = object.height; + else if (typeof object.height === "object") + message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(true); + if (object.format != null) + message.format = object.format >>> 0; + if (object.chunk != null) + message.chunk = object.chunk >>> 0; + return message; + }; + + /** + * Creates a plain object from a RequestLoadSnapshotChunk message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.RequestLoadSnapshotChunk + * @static + * @param {tendermint.abci.RequestLoadSnapshotChunk} message RequestLoadSnapshotChunk + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RequestLoadSnapshotChunk.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.height = options.longs === String ? "0" : 0; + object.format = 0; + object.chunk = 0; + } + if (message.height != null && message.hasOwnProperty("height")) + if (typeof message.height === "number") + object.height = options.longs === String ? String(message.height) : message.height; + else + object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber(true) : message.height; + if (message.format != null && message.hasOwnProperty("format")) + object.format = message.format; + if (message.chunk != null && message.hasOwnProperty("chunk")) + object.chunk = message.chunk; + return object; + }; + + /** + * Converts this RequestLoadSnapshotChunk to JSON. + * @function toJSON + * @memberof tendermint.abci.RequestLoadSnapshotChunk + * @instance + * @returns {Object.} JSON object + */ + RequestLoadSnapshotChunk.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RequestLoadSnapshotChunk; + })(); + + abci.RequestApplySnapshotChunk = (function() { + + /** + * Properties of a RequestApplySnapshotChunk. + * @memberof tendermint.abci + * @interface IRequestApplySnapshotChunk + * @property {number|null} [index] RequestApplySnapshotChunk index + * @property {Uint8Array|null} [chunk] RequestApplySnapshotChunk chunk + * @property {string|null} [sender] RequestApplySnapshotChunk sender + */ + + /** + * Constructs a new RequestApplySnapshotChunk. + * @memberof tendermint.abci + * @classdesc Represents a RequestApplySnapshotChunk. + * @implements IRequestApplySnapshotChunk + * @constructor + * @param {tendermint.abci.IRequestApplySnapshotChunk=} [properties] Properties to set + */ + function RequestApplySnapshotChunk(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RequestApplySnapshotChunk index. + * @member {number} index + * @memberof tendermint.abci.RequestApplySnapshotChunk + * @instance + */ + RequestApplySnapshotChunk.prototype.index = 0; + + /** + * RequestApplySnapshotChunk chunk. + * @member {Uint8Array} chunk + * @memberof tendermint.abci.RequestApplySnapshotChunk + * @instance + */ + RequestApplySnapshotChunk.prototype.chunk = $util.newBuffer([]); + + /** + * RequestApplySnapshotChunk sender. + * @member {string} sender + * @memberof tendermint.abci.RequestApplySnapshotChunk + * @instance + */ + RequestApplySnapshotChunk.prototype.sender = ""; + + /** + * Encodes the specified RequestApplySnapshotChunk message. Does not implicitly {@link tendermint.abci.RequestApplySnapshotChunk.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.RequestApplySnapshotChunk + * @static + * @param {tendermint.abci.IRequestApplySnapshotChunk} message RequestApplySnapshotChunk message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestApplySnapshotChunk.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.index != null && Object.hasOwnProperty.call(message, "index")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.index); + if (message.chunk != null && Object.hasOwnProperty.call(message, "chunk")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.chunk); + if (message.sender != null && Object.hasOwnProperty.call(message, "sender")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.sender); + return writer; + }; + + /** + * Encodes the specified RequestApplySnapshotChunk message, length delimited. Does not implicitly {@link tendermint.abci.RequestApplySnapshotChunk.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.RequestApplySnapshotChunk + * @static + * @param {tendermint.abci.IRequestApplySnapshotChunk} message RequestApplySnapshotChunk message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestApplySnapshotChunk.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RequestApplySnapshotChunk message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.RequestApplySnapshotChunk + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.RequestApplySnapshotChunk} RequestApplySnapshotChunk + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestApplySnapshotChunk.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.RequestApplySnapshotChunk(); + while (reader.pos < end) { + let 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; + }; + + /** + * Decodes a RequestApplySnapshotChunk message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.RequestApplySnapshotChunk + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.RequestApplySnapshotChunk} RequestApplySnapshotChunk + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestApplySnapshotChunk.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RequestApplySnapshotChunk message. + * @function verify + * @memberof tendermint.abci.RequestApplySnapshotChunk + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RequestApplySnapshotChunk.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.index != null && message.hasOwnProperty("index")) + if (!$util.isInteger(message.index)) + return "index: integer expected"; + if (message.chunk != null && message.hasOwnProperty("chunk")) + if (!(message.chunk && typeof message.chunk.length === "number" || $util.isString(message.chunk))) + return "chunk: buffer expected"; + if (message.sender != null && message.hasOwnProperty("sender")) + if (!$util.isString(message.sender)) + return "sender: string expected"; + return null; + }; + + /** + * Creates a RequestApplySnapshotChunk message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.RequestApplySnapshotChunk + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.RequestApplySnapshotChunk} RequestApplySnapshotChunk + */ + RequestApplySnapshotChunk.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.RequestApplySnapshotChunk) + return object; + let message = new $root.tendermint.abci.RequestApplySnapshotChunk(); + if (object.index != null) + message.index = object.index >>> 0; + if (object.chunk != null) + if (typeof object.chunk === "string") + $util.base64.decode(object.chunk, message.chunk = $util.newBuffer($util.base64.length(object.chunk)), 0); + else if (object.chunk.length) + message.chunk = object.chunk; + if (object.sender != null) + message.sender = String(object.sender); + return message; + }; + + /** + * Creates a plain object from a RequestApplySnapshotChunk message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.RequestApplySnapshotChunk + * @static + * @param {tendermint.abci.RequestApplySnapshotChunk} message RequestApplySnapshotChunk + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RequestApplySnapshotChunk.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.index = 0; + if (options.bytes === String) + object.chunk = ""; + else { + object.chunk = []; + if (options.bytes !== Array) + object.chunk = $util.newBuffer(object.chunk); + } + object.sender = ""; + } + if (message.index != null && message.hasOwnProperty("index")) + object.index = message.index; + if (message.chunk != null && message.hasOwnProperty("chunk")) + object.chunk = options.bytes === String ? $util.base64.encode(message.chunk, 0, message.chunk.length) : options.bytes === Array ? Array.prototype.slice.call(message.chunk) : message.chunk; + if (message.sender != null && message.hasOwnProperty("sender")) + object.sender = message.sender; + return object; + }; + + /** + * Converts this RequestApplySnapshotChunk to JSON. + * @function toJSON + * @memberof tendermint.abci.RequestApplySnapshotChunk + * @instance + * @returns {Object.} JSON object + */ + RequestApplySnapshotChunk.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RequestApplySnapshotChunk; + })(); + + abci.Response = (function() { + + /** + * Properties of a Response. + * @memberof tendermint.abci + * @interface IResponse + * @property {tendermint.abci.IResponseException|null} [exception] Response exception + * @property {tendermint.abci.IResponseEcho|null} [echo] Response echo + * @property {tendermint.abci.IResponseFlush|null} [flush] Response flush + * @property {tendermint.abci.IResponseInfo|null} [info] Response info + * @property {tendermint.abci.IResponseSetOption|null} [set_option] Response set_option + * @property {tendermint.abci.IResponseInitChain|null} [init_chain] Response init_chain + * @property {tendermint.abci.IResponseQuery|null} [query] Response query + * @property {tendermint.abci.IResponseBeginBlock|null} [begin_block] Response begin_block + * @property {tendermint.abci.IResponseCheckTx|null} [check_tx] Response check_tx + * @property {tendermint.abci.IResponseDeliverTx|null} [deliver_tx] Response deliver_tx + * @property {tendermint.abci.IResponseEndBlock|null} [end_block] Response end_block + * @property {tendermint.abci.IResponseCommit|null} [commit] Response commit + * @property {tendermint.abci.IResponseListSnapshots|null} [list_snapshots] Response list_snapshots + * @property {tendermint.abci.IResponseOfferSnapshot|null} [offer_snapshot] Response offer_snapshot + * @property {tendermint.abci.IResponseLoadSnapshotChunk|null} [load_snapshot_chunk] Response load_snapshot_chunk + * @property {tendermint.abci.IResponseApplySnapshotChunk|null} [apply_snapshot_chunk] Response apply_snapshot_chunk + */ + + /** + * Constructs a new Response. + * @memberof tendermint.abci + * @classdesc Represents a Response. + * @implements IResponse + * @constructor + * @param {tendermint.abci.IResponse=} [properties] Properties to set + */ + function Response(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Response exception. + * @member {tendermint.abci.IResponseException|null|undefined} exception + * @memberof tendermint.abci.Response + * @instance + */ + Response.prototype.exception = null; + + /** + * Response echo. + * @member {tendermint.abci.IResponseEcho|null|undefined} echo + * @memberof tendermint.abci.Response + * @instance + */ + Response.prototype.echo = null; + + /** + * Response flush. + * @member {tendermint.abci.IResponseFlush|null|undefined} flush + * @memberof tendermint.abci.Response + * @instance + */ + Response.prototype.flush = null; + + /** + * Response info. + * @member {tendermint.abci.IResponseInfo|null|undefined} info + * @memberof tendermint.abci.Response + * @instance + */ + Response.prototype.info = null; + + /** + * Response set_option. + * @member {tendermint.abci.IResponseSetOption|null|undefined} set_option + * @memberof tendermint.abci.Response + * @instance + */ + Response.prototype.set_option = null; + + /** + * Response init_chain. + * @member {tendermint.abci.IResponseInitChain|null|undefined} init_chain + * @memberof tendermint.abci.Response + * @instance + */ + Response.prototype.init_chain = null; + + /** + * Response query. + * @member {tendermint.abci.IResponseQuery|null|undefined} query + * @memberof tendermint.abci.Response + * @instance + */ + Response.prototype.query = null; + + /** + * Response begin_block. + * @member {tendermint.abci.IResponseBeginBlock|null|undefined} begin_block + * @memberof tendermint.abci.Response + * @instance + */ + Response.prototype.begin_block = null; + + /** + * Response check_tx. + * @member {tendermint.abci.IResponseCheckTx|null|undefined} check_tx + * @memberof tendermint.abci.Response + * @instance + */ + Response.prototype.check_tx = null; + + /** + * Response deliver_tx. + * @member {tendermint.abci.IResponseDeliverTx|null|undefined} deliver_tx + * @memberof tendermint.abci.Response + * @instance + */ + Response.prototype.deliver_tx = null; + + /** + * Response end_block. + * @member {tendermint.abci.IResponseEndBlock|null|undefined} end_block + * @memberof tendermint.abci.Response + * @instance + */ + Response.prototype.end_block = null; + + /** + * Response commit. + * @member {tendermint.abci.IResponseCommit|null|undefined} commit + * @memberof tendermint.abci.Response + * @instance + */ + Response.prototype.commit = null; + + /** + * Response list_snapshots. + * @member {tendermint.abci.IResponseListSnapshots|null|undefined} list_snapshots + * @memberof tendermint.abci.Response + * @instance + */ + Response.prototype.list_snapshots = null; + + /** + * Response offer_snapshot. + * @member {tendermint.abci.IResponseOfferSnapshot|null|undefined} offer_snapshot + * @memberof tendermint.abci.Response + * @instance + */ + Response.prototype.offer_snapshot = null; + + /** + * Response load_snapshot_chunk. + * @member {tendermint.abci.IResponseLoadSnapshotChunk|null|undefined} load_snapshot_chunk + * @memberof tendermint.abci.Response + * @instance + */ + Response.prototype.load_snapshot_chunk = null; + + /** + * Response apply_snapshot_chunk. + * @member {tendermint.abci.IResponseApplySnapshotChunk|null|undefined} apply_snapshot_chunk + * @memberof tendermint.abci.Response + * @instance + */ + Response.prototype.apply_snapshot_chunk = null; + + // OneOf field names bound to virtual getters and setters + let $oneOfFields; + + /** + * Response value. + * @member {"exception"|"echo"|"flush"|"info"|"set_option"|"init_chain"|"query"|"begin_block"|"check_tx"|"deliver_tx"|"end_block"|"commit"|"list_snapshots"|"offer_snapshot"|"load_snapshot_chunk"|"apply_snapshot_chunk"|undefined} value + * @memberof tendermint.abci.Response + * @instance + */ + Object.defineProperty(Response.prototype, "value", { + get: $util.oneOfGetter($oneOfFields = ["exception", "echo", "flush", "info", "set_option", "init_chain", "query", "begin_block", "check_tx", "deliver_tx", "end_block", "commit", "list_snapshots", "offer_snapshot", "load_snapshot_chunk", "apply_snapshot_chunk"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Encodes the specified Response message. Does not implicitly {@link tendermint.abci.Response.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.Response + * @static + * @param {tendermint.abci.IResponse} message Response message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Response.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.exception != null && Object.hasOwnProperty.call(message, "exception")) + $root.tendermint.abci.ResponseException.encode(message.exception, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.echo != null && Object.hasOwnProperty.call(message, "echo")) + $root.tendermint.abci.ResponseEcho.encode(message.echo, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.flush != null && Object.hasOwnProperty.call(message, "flush")) + $root.tendermint.abci.ResponseFlush.encode(message.flush, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.info != null && Object.hasOwnProperty.call(message, "info")) + $root.tendermint.abci.ResponseInfo.encode(message.info, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.set_option != null && Object.hasOwnProperty.call(message, "set_option")) + $root.tendermint.abci.ResponseSetOption.encode(message.set_option, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.init_chain != null && Object.hasOwnProperty.call(message, "init_chain")) + $root.tendermint.abci.ResponseInitChain.encode(message.init_chain, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + $root.tendermint.abci.ResponseQuery.encode(message.query, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.begin_block != null && Object.hasOwnProperty.call(message, "begin_block")) + $root.tendermint.abci.ResponseBeginBlock.encode(message.begin_block, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.check_tx != null && Object.hasOwnProperty.call(message, "check_tx")) + $root.tendermint.abci.ResponseCheckTx.encode(message.check_tx, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.deliver_tx != null && Object.hasOwnProperty.call(message, "deliver_tx")) + $root.tendermint.abci.ResponseDeliverTx.encode(message.deliver_tx, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.end_block != null && Object.hasOwnProperty.call(message, "end_block")) + $root.tendermint.abci.ResponseEndBlock.encode(message.end_block, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.commit != null && Object.hasOwnProperty.call(message, "commit")) + $root.tendermint.abci.ResponseCommit.encode(message.commit, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.list_snapshots != null && Object.hasOwnProperty.call(message, "list_snapshots")) + $root.tendermint.abci.ResponseListSnapshots.encode(message.list_snapshots, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.offer_snapshot != null && Object.hasOwnProperty.call(message, "offer_snapshot")) + $root.tendermint.abci.ResponseOfferSnapshot.encode(message.offer_snapshot, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.load_snapshot_chunk != null && Object.hasOwnProperty.call(message, "load_snapshot_chunk")) + $root.tendermint.abci.ResponseLoadSnapshotChunk.encode(message.load_snapshot_chunk, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); + if (message.apply_snapshot_chunk != null && Object.hasOwnProperty.call(message, "apply_snapshot_chunk")) + $root.tendermint.abci.ResponseApplySnapshotChunk.encode(message.apply_snapshot_chunk, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Response message, length delimited. Does not implicitly {@link tendermint.abci.Response.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.Response + * @static + * @param {tendermint.abci.IResponse} message Response message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Response.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Response message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.Response + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.Response} Response + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Response.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.Response(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.exception = $root.tendermint.abci.ResponseException.decode(reader, reader.uint32()); + break; + case 2: + message.echo = $root.tendermint.abci.ResponseEcho.decode(reader, reader.uint32()); + break; + case 3: + message.flush = $root.tendermint.abci.ResponseFlush.decode(reader, reader.uint32()); + break; + case 4: + message.info = $root.tendermint.abci.ResponseInfo.decode(reader, reader.uint32()); + break; + case 5: + message.set_option = $root.tendermint.abci.ResponseSetOption.decode(reader, reader.uint32()); + break; + case 6: + message.init_chain = $root.tendermint.abci.ResponseInitChain.decode(reader, reader.uint32()); + break; + case 7: + message.query = $root.tendermint.abci.ResponseQuery.decode(reader, reader.uint32()); + break; + case 8: + message.begin_block = $root.tendermint.abci.ResponseBeginBlock.decode(reader, reader.uint32()); + break; + case 9: + message.check_tx = $root.tendermint.abci.ResponseCheckTx.decode(reader, reader.uint32()); + break; + case 10: + message.deliver_tx = $root.tendermint.abci.ResponseDeliverTx.decode(reader, reader.uint32()); + break; + case 11: + message.end_block = $root.tendermint.abci.ResponseEndBlock.decode(reader, reader.uint32()); + break; + case 12: + message.commit = $root.tendermint.abci.ResponseCommit.decode(reader, reader.uint32()); + break; + case 13: + message.list_snapshots = $root.tendermint.abci.ResponseListSnapshots.decode(reader, reader.uint32()); + break; + case 14: + message.offer_snapshot = $root.tendermint.abci.ResponseOfferSnapshot.decode(reader, reader.uint32()); + break; + case 15: + message.load_snapshot_chunk = $root.tendermint.abci.ResponseLoadSnapshotChunk.decode(reader, reader.uint32()); + break; + case 16: + message.apply_snapshot_chunk = $root.tendermint.abci.ResponseApplySnapshotChunk.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Response message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.Response + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.Response} Response + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Response.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Response message. + * @function verify + * @memberof tendermint.abci.Response + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Response.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + let properties = {}; + if (message.exception != null && message.hasOwnProperty("exception")) { + properties.value = 1; + { + let error = $root.tendermint.abci.ResponseException.verify(message.exception); + if (error) + return "exception." + error; + } + } + if (message.echo != null && message.hasOwnProperty("echo")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + { + let error = $root.tendermint.abci.ResponseEcho.verify(message.echo); + if (error) + return "echo." + error; + } + } + if (message.flush != null && message.hasOwnProperty("flush")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + { + let error = $root.tendermint.abci.ResponseFlush.verify(message.flush); + if (error) + return "flush." + error; + } + } + if (message.info != null && message.hasOwnProperty("info")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + { + let error = $root.tendermint.abci.ResponseInfo.verify(message.info); + if (error) + return "info." + error; + } + } + if (message.set_option != null && message.hasOwnProperty("set_option")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + { + let error = $root.tendermint.abci.ResponseSetOption.verify(message.set_option); + if (error) + return "set_option." + error; + } + } + if (message.init_chain != null && message.hasOwnProperty("init_chain")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + { + let error = $root.tendermint.abci.ResponseInitChain.verify(message.init_chain); + if (error) + return "init_chain." + error; + } + } + if (message.query != null && message.hasOwnProperty("query")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + { + let error = $root.tendermint.abci.ResponseQuery.verify(message.query); + if (error) + return "query." + error; + } + } + if (message.begin_block != null && message.hasOwnProperty("begin_block")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + { + let error = $root.tendermint.abci.ResponseBeginBlock.verify(message.begin_block); + if (error) + return "begin_block." + error; + } + } + if (message.check_tx != null && message.hasOwnProperty("check_tx")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + { + let error = $root.tendermint.abci.ResponseCheckTx.verify(message.check_tx); + if (error) + return "check_tx." + error; + } + } + if (message.deliver_tx != null && message.hasOwnProperty("deliver_tx")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + { + let error = $root.tendermint.abci.ResponseDeliverTx.verify(message.deliver_tx); + if (error) + return "deliver_tx." + error; + } + } + if (message.end_block != null && message.hasOwnProperty("end_block")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + { + let error = $root.tendermint.abci.ResponseEndBlock.verify(message.end_block); + if (error) + return "end_block." + error; + } + } + if (message.commit != null && message.hasOwnProperty("commit")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + { + let error = $root.tendermint.abci.ResponseCommit.verify(message.commit); + if (error) + return "commit." + error; + } + } + if (message.list_snapshots != null && message.hasOwnProperty("list_snapshots")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + { + let error = $root.tendermint.abci.ResponseListSnapshots.verify(message.list_snapshots); + if (error) + return "list_snapshots." + error; + } + } + if (message.offer_snapshot != null && message.hasOwnProperty("offer_snapshot")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + { + let error = $root.tendermint.abci.ResponseOfferSnapshot.verify(message.offer_snapshot); + if (error) + return "offer_snapshot." + error; + } + } + if (message.load_snapshot_chunk != null && message.hasOwnProperty("load_snapshot_chunk")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + { + let error = $root.tendermint.abci.ResponseLoadSnapshotChunk.verify(message.load_snapshot_chunk); + if (error) + return "load_snapshot_chunk." + error; + } + } + if (message.apply_snapshot_chunk != null && message.hasOwnProperty("apply_snapshot_chunk")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + { + let error = $root.tendermint.abci.ResponseApplySnapshotChunk.verify(message.apply_snapshot_chunk); + if (error) + return "apply_snapshot_chunk." + error; + } + } + return null; + }; + + /** + * Creates a Response message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.Response + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.Response} Response + */ + Response.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.Response) + return object; + let message = new $root.tendermint.abci.Response(); + if (object.exception != null) { + if (typeof object.exception !== "object") + throw TypeError(".tendermint.abci.Response.exception: object expected"); + message.exception = $root.tendermint.abci.ResponseException.fromObject(object.exception); + } + if (object.echo != null) { + if (typeof object.echo !== "object") + throw TypeError(".tendermint.abci.Response.echo: object expected"); + message.echo = $root.tendermint.abci.ResponseEcho.fromObject(object.echo); + } + if (object.flush != null) { + if (typeof object.flush !== "object") + throw TypeError(".tendermint.abci.Response.flush: object expected"); + message.flush = $root.tendermint.abci.ResponseFlush.fromObject(object.flush); + } + if (object.info != null) { + if (typeof object.info !== "object") + throw TypeError(".tendermint.abci.Response.info: object expected"); + message.info = $root.tendermint.abci.ResponseInfo.fromObject(object.info); + } + if (object.set_option != null) { + if (typeof object.set_option !== "object") + throw TypeError(".tendermint.abci.Response.set_option: object expected"); + message.set_option = $root.tendermint.abci.ResponseSetOption.fromObject(object.set_option); + } + if (object.init_chain != null) { + if (typeof object.init_chain !== "object") + throw TypeError(".tendermint.abci.Response.init_chain: object expected"); + message.init_chain = $root.tendermint.abci.ResponseInitChain.fromObject(object.init_chain); + } + if (object.query != null) { + if (typeof object.query !== "object") + throw TypeError(".tendermint.abci.Response.query: object expected"); + message.query = $root.tendermint.abci.ResponseQuery.fromObject(object.query); + } + if (object.begin_block != null) { + if (typeof object.begin_block !== "object") + throw TypeError(".tendermint.abci.Response.begin_block: object expected"); + message.begin_block = $root.tendermint.abci.ResponseBeginBlock.fromObject(object.begin_block); + } + if (object.check_tx != null) { + if (typeof object.check_tx !== "object") + throw TypeError(".tendermint.abci.Response.check_tx: object expected"); + message.check_tx = $root.tendermint.abci.ResponseCheckTx.fromObject(object.check_tx); + } + if (object.deliver_tx != null) { + if (typeof object.deliver_tx !== "object") + throw TypeError(".tendermint.abci.Response.deliver_tx: object expected"); + message.deliver_tx = $root.tendermint.abci.ResponseDeliverTx.fromObject(object.deliver_tx); + } + if (object.end_block != null) { + if (typeof object.end_block !== "object") + throw TypeError(".tendermint.abci.Response.end_block: object expected"); + message.end_block = $root.tendermint.abci.ResponseEndBlock.fromObject(object.end_block); + } + if (object.commit != null) { + if (typeof object.commit !== "object") + throw TypeError(".tendermint.abci.Response.commit: object expected"); + message.commit = $root.tendermint.abci.ResponseCommit.fromObject(object.commit); + } + if (object.list_snapshots != null) { + if (typeof object.list_snapshots !== "object") + throw TypeError(".tendermint.abci.Response.list_snapshots: object expected"); + message.list_snapshots = $root.tendermint.abci.ResponseListSnapshots.fromObject(object.list_snapshots); + } + if (object.offer_snapshot != null) { + if (typeof object.offer_snapshot !== "object") + throw TypeError(".tendermint.abci.Response.offer_snapshot: object expected"); + message.offer_snapshot = $root.tendermint.abci.ResponseOfferSnapshot.fromObject(object.offer_snapshot); + } + if (object.load_snapshot_chunk != null) { + if (typeof object.load_snapshot_chunk !== "object") + throw TypeError(".tendermint.abci.Response.load_snapshot_chunk: object expected"); + message.load_snapshot_chunk = $root.tendermint.abci.ResponseLoadSnapshotChunk.fromObject(object.load_snapshot_chunk); + } + if (object.apply_snapshot_chunk != null) { + if (typeof object.apply_snapshot_chunk !== "object") + throw TypeError(".tendermint.abci.Response.apply_snapshot_chunk: object expected"); + message.apply_snapshot_chunk = $root.tendermint.abci.ResponseApplySnapshotChunk.fromObject(object.apply_snapshot_chunk); + } + return message; + }; + + /** + * Creates a plain object from a Response message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.Response + * @static + * @param {tendermint.abci.Response} message Response + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Response.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (message.exception != null && message.hasOwnProperty("exception")) { + object.exception = $root.tendermint.abci.ResponseException.toObject(message.exception, options); + if (options.oneofs) + object.value = "exception"; + } + if (message.echo != null && message.hasOwnProperty("echo")) { + object.echo = $root.tendermint.abci.ResponseEcho.toObject(message.echo, options); + if (options.oneofs) + object.value = "echo"; + } + if (message.flush != null && message.hasOwnProperty("flush")) { + object.flush = $root.tendermint.abci.ResponseFlush.toObject(message.flush, options); + if (options.oneofs) + object.value = "flush"; + } + if (message.info != null && message.hasOwnProperty("info")) { + object.info = $root.tendermint.abci.ResponseInfo.toObject(message.info, options); + if (options.oneofs) + object.value = "info"; + } + if (message.set_option != null && message.hasOwnProperty("set_option")) { + object.set_option = $root.tendermint.abci.ResponseSetOption.toObject(message.set_option, options); + if (options.oneofs) + object.value = "set_option"; + } + if (message.init_chain != null && message.hasOwnProperty("init_chain")) { + object.init_chain = $root.tendermint.abci.ResponseInitChain.toObject(message.init_chain, options); + if (options.oneofs) + object.value = "init_chain"; + } + if (message.query != null && message.hasOwnProperty("query")) { + object.query = $root.tendermint.abci.ResponseQuery.toObject(message.query, options); + if (options.oneofs) + object.value = "query"; + } + if (message.begin_block != null && message.hasOwnProperty("begin_block")) { + object.begin_block = $root.tendermint.abci.ResponseBeginBlock.toObject(message.begin_block, options); + if (options.oneofs) + object.value = "begin_block"; + } + if (message.check_tx != null && message.hasOwnProperty("check_tx")) { + object.check_tx = $root.tendermint.abci.ResponseCheckTx.toObject(message.check_tx, options); + if (options.oneofs) + object.value = "check_tx"; + } + if (message.deliver_tx != null && message.hasOwnProperty("deliver_tx")) { + object.deliver_tx = $root.tendermint.abci.ResponseDeliverTx.toObject(message.deliver_tx, options); + if (options.oneofs) + object.value = "deliver_tx"; + } + if (message.end_block != null && message.hasOwnProperty("end_block")) { + object.end_block = $root.tendermint.abci.ResponseEndBlock.toObject(message.end_block, options); + if (options.oneofs) + object.value = "end_block"; + } + if (message.commit != null && message.hasOwnProperty("commit")) { + object.commit = $root.tendermint.abci.ResponseCommit.toObject(message.commit, options); + if (options.oneofs) + object.value = "commit"; + } + if (message.list_snapshots != null && message.hasOwnProperty("list_snapshots")) { + object.list_snapshots = $root.tendermint.abci.ResponseListSnapshots.toObject(message.list_snapshots, options); + if (options.oneofs) + object.value = "list_snapshots"; + } + if (message.offer_snapshot != null && message.hasOwnProperty("offer_snapshot")) { + object.offer_snapshot = $root.tendermint.abci.ResponseOfferSnapshot.toObject(message.offer_snapshot, options); + if (options.oneofs) + object.value = "offer_snapshot"; + } + if (message.load_snapshot_chunk != null && message.hasOwnProperty("load_snapshot_chunk")) { + object.load_snapshot_chunk = $root.tendermint.abci.ResponseLoadSnapshotChunk.toObject(message.load_snapshot_chunk, options); + if (options.oneofs) + object.value = "load_snapshot_chunk"; + } + if (message.apply_snapshot_chunk != null && message.hasOwnProperty("apply_snapshot_chunk")) { + object.apply_snapshot_chunk = $root.tendermint.abci.ResponseApplySnapshotChunk.toObject(message.apply_snapshot_chunk, options); + if (options.oneofs) + object.value = "apply_snapshot_chunk"; + } + return object; + }; + + /** + * Converts this Response to JSON. + * @function toJSON + * @memberof tendermint.abci.Response + * @instance + * @returns {Object.} JSON object + */ + Response.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Response; + })(); + + abci.ResponseException = (function() { + + /** + * Properties of a ResponseException. + * @memberof tendermint.abci + * @interface IResponseException + * @property {string|null} [error] ResponseException error + */ + + /** + * Constructs a new ResponseException. + * @memberof tendermint.abci + * @classdesc Represents a ResponseException. + * @implements IResponseException + * @constructor + * @param {tendermint.abci.IResponseException=} [properties] Properties to set + */ + function ResponseException(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResponseException error. + * @member {string} error + * @memberof tendermint.abci.ResponseException + * @instance + */ + ResponseException.prototype.error = ""; + + /** + * Encodes the specified ResponseException message. Does not implicitly {@link tendermint.abci.ResponseException.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.ResponseException + * @static + * @param {tendermint.abci.IResponseException} message ResponseException message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseException.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.error != null && Object.hasOwnProperty.call(message, "error")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.error); + return writer; + }; + + /** + * Encodes the specified ResponseException message, length delimited. Does not implicitly {@link tendermint.abci.ResponseException.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.ResponseException + * @static + * @param {tendermint.abci.IResponseException} message ResponseException message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseException.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResponseException message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.ResponseException + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.ResponseException} ResponseException + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseException.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseException(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.error = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResponseException message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.ResponseException + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.ResponseException} ResponseException + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseException.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResponseException message. + * @function verify + * @memberof tendermint.abci.ResponseException + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResponseException.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.error != null && message.hasOwnProperty("error")) + if (!$util.isString(message.error)) + return "error: string expected"; + return null; + }; + + /** + * Creates a ResponseException message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.ResponseException + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.ResponseException} ResponseException + */ + ResponseException.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.ResponseException) + return object; + let message = new $root.tendermint.abci.ResponseException(); + if (object.error != null) + message.error = String(object.error); + return message; + }; + + /** + * Creates a plain object from a ResponseException message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.ResponseException + * @static + * @param {tendermint.abci.ResponseException} message ResponseException + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResponseException.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.error = ""; + if (message.error != null && message.hasOwnProperty("error")) + object.error = message.error; + return object; + }; + + /** + * Converts this ResponseException to JSON. + * @function toJSON + * @memberof tendermint.abci.ResponseException + * @instance + * @returns {Object.} JSON object + */ + ResponseException.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ResponseException; + })(); + + abci.ResponseEcho = (function() { + + /** + * Properties of a ResponseEcho. + * @memberof tendermint.abci + * @interface IResponseEcho + * @property {string|null} [message] ResponseEcho message + */ + + /** + * Constructs a new ResponseEcho. + * @memberof tendermint.abci + * @classdesc Represents a ResponseEcho. + * @implements IResponseEcho + * @constructor + * @param {tendermint.abci.IResponseEcho=} [properties] Properties to set + */ + function ResponseEcho(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResponseEcho message. + * @member {string} message + * @memberof tendermint.abci.ResponseEcho + * @instance + */ + ResponseEcho.prototype.message = ""; + + /** + * Encodes the specified ResponseEcho message. Does not implicitly {@link tendermint.abci.ResponseEcho.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.ResponseEcho + * @static + * @param {tendermint.abci.IResponseEcho} message ResponseEcho message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseEcho.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.message); + return writer; + }; + + /** + * Encodes the specified ResponseEcho message, length delimited. Does not implicitly {@link tendermint.abci.ResponseEcho.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.ResponseEcho + * @static + * @param {tendermint.abci.IResponseEcho} message ResponseEcho message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseEcho.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResponseEcho message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.ResponseEcho + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.ResponseEcho} ResponseEcho + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseEcho.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseEcho(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.message = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResponseEcho message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.ResponseEcho + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.ResponseEcho} ResponseEcho + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseEcho.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResponseEcho message. + * @function verify + * @memberof tendermint.abci.ResponseEcho + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResponseEcho.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + return null; + }; + + /** + * Creates a ResponseEcho message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.ResponseEcho + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.ResponseEcho} ResponseEcho + */ + ResponseEcho.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.ResponseEcho) + return object; + let message = new $root.tendermint.abci.ResponseEcho(); + if (object.message != null) + message.message = String(object.message); + return message; + }; + + /** + * Creates a plain object from a ResponseEcho message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.ResponseEcho + * @static + * @param {tendermint.abci.ResponseEcho} message ResponseEcho + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResponseEcho.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.message = ""; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + return object; + }; + + /** + * Converts this ResponseEcho to JSON. + * @function toJSON + * @memberof tendermint.abci.ResponseEcho + * @instance + * @returns {Object.} JSON object + */ + ResponseEcho.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ResponseEcho; + })(); + + abci.ResponseFlush = (function() { + + /** + * Properties of a ResponseFlush. + * @memberof tendermint.abci + * @interface IResponseFlush + */ + + /** + * Constructs a new ResponseFlush. + * @memberof tendermint.abci + * @classdesc Represents a ResponseFlush. + * @implements IResponseFlush + * @constructor + * @param {tendermint.abci.IResponseFlush=} [properties] Properties to set + */ + function ResponseFlush(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Encodes the specified ResponseFlush message. Does not implicitly {@link tendermint.abci.ResponseFlush.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.ResponseFlush + * @static + * @param {tendermint.abci.IResponseFlush} message ResponseFlush message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseFlush.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified ResponseFlush message, length delimited. Does not implicitly {@link tendermint.abci.ResponseFlush.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.ResponseFlush + * @static + * @param {tendermint.abci.IResponseFlush} message ResponseFlush message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseFlush.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResponseFlush message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.ResponseFlush + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.ResponseFlush} ResponseFlush + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseFlush.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseFlush(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResponseFlush message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.ResponseFlush + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.ResponseFlush} ResponseFlush + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseFlush.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResponseFlush message. + * @function verify + * @memberof tendermint.abci.ResponseFlush + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResponseFlush.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a ResponseFlush message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.ResponseFlush + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.ResponseFlush} ResponseFlush + */ + ResponseFlush.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.ResponseFlush) + return object; + return new $root.tendermint.abci.ResponseFlush(); + }; + + /** + * Creates a plain object from a ResponseFlush message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.ResponseFlush + * @static + * @param {tendermint.abci.ResponseFlush} message ResponseFlush + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResponseFlush.toObject = function toObject() { + return {}; + }; + + /** + * Converts this ResponseFlush to JSON. + * @function toJSON + * @memberof tendermint.abci.ResponseFlush + * @instance + * @returns {Object.} JSON object + */ + ResponseFlush.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ResponseFlush; + })(); + + abci.ResponseInfo = (function() { + + /** + * Properties of a ResponseInfo. + * @memberof tendermint.abci + * @interface IResponseInfo + * @property {string|null} [data] ResponseInfo data + * @property {string|null} [version] ResponseInfo version + * @property {Long|null} [app_version] ResponseInfo app_version + * @property {Long|null} [last_block_height] ResponseInfo last_block_height + * @property {Uint8Array|null} [last_block_app_hash] ResponseInfo last_block_app_hash + */ + + /** + * Constructs a new ResponseInfo. + * @memberof tendermint.abci + * @classdesc Represents a ResponseInfo. + * @implements IResponseInfo + * @constructor + * @param {tendermint.abci.IResponseInfo=} [properties] Properties to set + */ + function ResponseInfo(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResponseInfo data. + * @member {string} data + * @memberof tendermint.abci.ResponseInfo + * @instance + */ + ResponseInfo.prototype.data = ""; + + /** + * ResponseInfo version. + * @member {string} version + * @memberof tendermint.abci.ResponseInfo + * @instance + */ + ResponseInfo.prototype.version = ""; + + /** + * ResponseInfo app_version. + * @member {Long} app_version + * @memberof tendermint.abci.ResponseInfo + * @instance + */ + ResponseInfo.prototype.app_version = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * ResponseInfo last_block_height. + * @member {Long} last_block_height + * @memberof tendermint.abci.ResponseInfo + * @instance + */ + ResponseInfo.prototype.last_block_height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ResponseInfo last_block_app_hash. + * @member {Uint8Array} last_block_app_hash + * @memberof tendermint.abci.ResponseInfo + * @instance + */ + ResponseInfo.prototype.last_block_app_hash = $util.newBuffer([]); + + /** + * Encodes the specified ResponseInfo message. Does not implicitly {@link tendermint.abci.ResponseInfo.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.ResponseInfo + * @static + * @param {tendermint.abci.IResponseInfo} message ResponseInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.data != null && Object.hasOwnProperty.call(message, "data")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.data); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.version); + if (message.app_version != null && Object.hasOwnProperty.call(message, "app_version")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.app_version); + if (message.last_block_height != null && Object.hasOwnProperty.call(message, "last_block_height")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.last_block_height); + if (message.last_block_app_hash != null && Object.hasOwnProperty.call(message, "last_block_app_hash")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.last_block_app_hash); + return writer; + }; + + /** + * Encodes the specified ResponseInfo message, length delimited. Does not implicitly {@link tendermint.abci.ResponseInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.ResponseInfo + * @static + * @param {tendermint.abci.IResponseInfo} message ResponseInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResponseInfo message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.ResponseInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.ResponseInfo} ResponseInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseInfo(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.data = reader.string(); + break; + case 2: + message.version = reader.string(); + break; + case 3: + message.app_version = reader.uint64(); + break; + case 4: + message.last_block_height = reader.int64(); + break; + case 5: + message.last_block_app_hash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResponseInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.ResponseInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.ResponseInfo} ResponseInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResponseInfo message. + * @function verify + * @memberof tendermint.abci.ResponseInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResponseInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.data != null && message.hasOwnProperty("data")) + if (!$util.isString(message.data)) + return "data: string expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + if (message.app_version != null && message.hasOwnProperty("app_version")) + if (!$util.isInteger(message.app_version) && !(message.app_version && $util.isInteger(message.app_version.low) && $util.isInteger(message.app_version.high))) + return "app_version: integer|Long expected"; + if (message.last_block_height != null && message.hasOwnProperty("last_block_height")) + if (!$util.isInteger(message.last_block_height) && !(message.last_block_height && $util.isInteger(message.last_block_height.low) && $util.isInteger(message.last_block_height.high))) + return "last_block_height: integer|Long expected"; + if (message.last_block_app_hash != null && message.hasOwnProperty("last_block_app_hash")) + if (!(message.last_block_app_hash && typeof message.last_block_app_hash.length === "number" || $util.isString(message.last_block_app_hash))) + return "last_block_app_hash: buffer expected"; + return null; + }; + + /** + * Creates a ResponseInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.ResponseInfo + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.ResponseInfo} ResponseInfo + */ + ResponseInfo.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.ResponseInfo) + return object; + let message = new $root.tendermint.abci.ResponseInfo(); + if (object.data != null) + message.data = String(object.data); + if (object.version != null) + message.version = String(object.version); + if (object.app_version != null) + if ($util.Long) + (message.app_version = $util.Long.fromValue(object.app_version)).unsigned = true; + else if (typeof object.app_version === "string") + message.app_version = parseInt(object.app_version, 10); + else if (typeof object.app_version === "number") + message.app_version = object.app_version; + else if (typeof object.app_version === "object") + message.app_version = new $util.LongBits(object.app_version.low >>> 0, object.app_version.high >>> 0).toNumber(true); + if (object.last_block_height != null) + if ($util.Long) + (message.last_block_height = $util.Long.fromValue(object.last_block_height)).unsigned = false; + else if (typeof object.last_block_height === "string") + message.last_block_height = parseInt(object.last_block_height, 10); + else if (typeof object.last_block_height === "number") + message.last_block_height = object.last_block_height; + else if (typeof object.last_block_height === "object") + message.last_block_height = new $util.LongBits(object.last_block_height.low >>> 0, object.last_block_height.high >>> 0).toNumber(); + if (object.last_block_app_hash != null) + if (typeof object.last_block_app_hash === "string") + $util.base64.decode(object.last_block_app_hash, message.last_block_app_hash = $util.newBuffer($util.base64.length(object.last_block_app_hash)), 0); + else if (object.last_block_app_hash.length) + message.last_block_app_hash = object.last_block_app_hash; + return message; + }; + + /** + * Creates a plain object from a ResponseInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.ResponseInfo + * @static + * @param {tendermint.abci.ResponseInfo} message ResponseInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResponseInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.data = ""; + object.version = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.app_version = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.app_version = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.last_block_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.last_block_height = options.longs === String ? "0" : 0; + if (options.bytes === String) + object.last_block_app_hash = ""; + else { + object.last_block_app_hash = []; + if (options.bytes !== Array) + object.last_block_app_hash = $util.newBuffer(object.last_block_app_hash); + } + } + if (message.data != null && message.hasOwnProperty("data")) + object.data = message.data; + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + if (message.app_version != null && message.hasOwnProperty("app_version")) + if (typeof message.app_version === "number") + object.app_version = options.longs === String ? String(message.app_version) : message.app_version; + else + object.app_version = options.longs === String ? $util.Long.prototype.toString.call(message.app_version) : options.longs === Number ? new $util.LongBits(message.app_version.low >>> 0, message.app_version.high >>> 0).toNumber(true) : message.app_version; + if (message.last_block_height != null && message.hasOwnProperty("last_block_height")) + if (typeof message.last_block_height === "number") + object.last_block_height = options.longs === String ? String(message.last_block_height) : message.last_block_height; + else + object.last_block_height = options.longs === String ? $util.Long.prototype.toString.call(message.last_block_height) : options.longs === Number ? new $util.LongBits(message.last_block_height.low >>> 0, message.last_block_height.high >>> 0).toNumber() : message.last_block_height; + if (message.last_block_app_hash != null && message.hasOwnProperty("last_block_app_hash")) + object.last_block_app_hash = options.bytes === String ? $util.base64.encode(message.last_block_app_hash, 0, message.last_block_app_hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.last_block_app_hash) : message.last_block_app_hash; + return object; + }; + + /** + * Converts this ResponseInfo to JSON. + * @function toJSON + * @memberof tendermint.abci.ResponseInfo + * @instance + * @returns {Object.} JSON object + */ + ResponseInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ResponseInfo; + })(); + + abci.ResponseSetOption = (function() { + + /** + * Properties of a ResponseSetOption. + * @memberof tendermint.abci + * @interface IResponseSetOption + * @property {number|null} [code] ResponseSetOption code + * @property {string|null} [log] ResponseSetOption log + * @property {string|null} [info] ResponseSetOption info + */ + + /** + * Constructs a new ResponseSetOption. + * @memberof tendermint.abci + * @classdesc Represents a ResponseSetOption. + * @implements IResponseSetOption + * @constructor + * @param {tendermint.abci.IResponseSetOption=} [properties] Properties to set + */ + function ResponseSetOption(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResponseSetOption code. + * @member {number} code + * @memberof tendermint.abci.ResponseSetOption + * @instance + */ + ResponseSetOption.prototype.code = 0; + + /** + * ResponseSetOption log. + * @member {string} log + * @memberof tendermint.abci.ResponseSetOption + * @instance + */ + ResponseSetOption.prototype.log = ""; + + /** + * ResponseSetOption info. + * @member {string} info + * @memberof tendermint.abci.ResponseSetOption + * @instance + */ + ResponseSetOption.prototype.info = ""; + + /** + * Encodes the specified ResponseSetOption message. Does not implicitly {@link tendermint.abci.ResponseSetOption.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.ResponseSetOption + * @static + * @param {tendermint.abci.IResponseSetOption} message ResponseSetOption message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseSetOption.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.code != null && Object.hasOwnProperty.call(message, "code")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.code); + if (message.log != null && Object.hasOwnProperty.call(message, "log")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.log); + if (message.info != null && Object.hasOwnProperty.call(message, "info")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.info); + return writer; + }; + + /** + * Encodes the specified ResponseSetOption message, length delimited. Does not implicitly {@link tendermint.abci.ResponseSetOption.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.ResponseSetOption + * @static + * @param {tendermint.abci.IResponseSetOption} message ResponseSetOption message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseSetOption.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResponseSetOption message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.ResponseSetOption + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.ResponseSetOption} ResponseSetOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseSetOption.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseSetOption(); + while (reader.pos < end) { + let 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; + }; + + /** + * Decodes a ResponseSetOption message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.ResponseSetOption + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.ResponseSetOption} ResponseSetOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseSetOption.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResponseSetOption message. + * @function verify + * @memberof tendermint.abci.ResponseSetOption + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResponseSetOption.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.code != null && message.hasOwnProperty("code")) + if (!$util.isInteger(message.code)) + return "code: integer expected"; + if (message.log != null && message.hasOwnProperty("log")) + if (!$util.isString(message.log)) + return "log: string expected"; + if (message.info != null && message.hasOwnProperty("info")) + if (!$util.isString(message.info)) + return "info: string expected"; + return null; + }; + + /** + * Creates a ResponseSetOption message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.ResponseSetOption + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.ResponseSetOption} ResponseSetOption + */ + ResponseSetOption.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.ResponseSetOption) + return object; + let message = new $root.tendermint.abci.ResponseSetOption(); + if (object.code != null) + message.code = object.code >>> 0; + if (object.log != null) + message.log = String(object.log); + if (object.info != null) + message.info = String(object.info); + return message; + }; + + /** + * Creates a plain object from a ResponseSetOption message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.ResponseSetOption + * @static + * @param {tendermint.abci.ResponseSetOption} message ResponseSetOption + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResponseSetOption.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.code = 0; + object.log = ""; + object.info = ""; + } + if (message.code != null && message.hasOwnProperty("code")) + object.code = message.code; + if (message.log != null && message.hasOwnProperty("log")) + object.log = message.log; + if (message.info != null && message.hasOwnProperty("info")) + object.info = message.info; + return object; + }; + + /** + * Converts this ResponseSetOption to JSON. + * @function toJSON + * @memberof tendermint.abci.ResponseSetOption + * @instance + * @returns {Object.} JSON object + */ + ResponseSetOption.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ResponseSetOption; + })(); + + abci.ResponseInitChain = (function() { + + /** + * Properties of a ResponseInitChain. + * @memberof tendermint.abci + * @interface IResponseInitChain + * @property {tendermint.abci.IConsensusParams|null} [consensus_params] ResponseInitChain consensus_params + * @property {Array.|null} [validators] ResponseInitChain validators + * @property {Uint8Array|null} [app_hash] ResponseInitChain app_hash + */ + + /** + * Constructs a new ResponseInitChain. + * @memberof tendermint.abci + * @classdesc Represents a ResponseInitChain. + * @implements IResponseInitChain + * @constructor + * @param {tendermint.abci.IResponseInitChain=} [properties] Properties to set + */ + function ResponseInitChain(properties) { + this.validators = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResponseInitChain consensus_params. + * @member {tendermint.abci.IConsensusParams|null|undefined} consensus_params + * @memberof tendermint.abci.ResponseInitChain + * @instance + */ + ResponseInitChain.prototype.consensus_params = null; + + /** + * ResponseInitChain validators. + * @member {Array.} validators + * @memberof tendermint.abci.ResponseInitChain + * @instance + */ + ResponseInitChain.prototype.validators = $util.emptyArray; + + /** + * ResponseInitChain app_hash. + * @member {Uint8Array} app_hash + * @memberof tendermint.abci.ResponseInitChain + * @instance + */ + ResponseInitChain.prototype.app_hash = $util.newBuffer([]); + + /** + * Encodes the specified ResponseInitChain message. Does not implicitly {@link tendermint.abci.ResponseInitChain.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.ResponseInitChain + * @static + * @param {tendermint.abci.IResponseInitChain} message ResponseInitChain message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseInitChain.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.consensus_params != null && Object.hasOwnProperty.call(message, "consensus_params")) + $root.tendermint.abci.ConsensusParams.encode(message.consensus_params, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.validators != null && message.validators.length) + for (let i = 0; i < message.validators.length; ++i) + $root.tendermint.abci.ValidatorUpdate.encode(message.validators[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.app_hash != null && Object.hasOwnProperty.call(message, "app_hash")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.app_hash); + return writer; + }; + + /** + * Encodes the specified ResponseInitChain message, length delimited. Does not implicitly {@link tendermint.abci.ResponseInitChain.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.ResponseInitChain + * @static + * @param {tendermint.abci.IResponseInitChain} message ResponseInitChain message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseInitChain.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResponseInitChain message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.ResponseInitChain + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.ResponseInitChain} ResponseInitChain + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseInitChain.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseInitChain(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.consensus_params = $root.tendermint.abci.ConsensusParams.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.validators && message.validators.length)) + message.validators = []; + message.validators.push($root.tendermint.abci.ValidatorUpdate.decode(reader, reader.uint32())); + break; + case 3: + message.app_hash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResponseInitChain message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.ResponseInitChain + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.ResponseInitChain} ResponseInitChain + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseInitChain.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResponseInitChain message. + * @function verify + * @memberof tendermint.abci.ResponseInitChain + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResponseInitChain.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.consensus_params != null && message.hasOwnProperty("consensus_params")) { + let error = $root.tendermint.abci.ConsensusParams.verify(message.consensus_params); + if (error) + return "consensus_params." + error; + } + if (message.validators != null && message.hasOwnProperty("validators")) { + if (!Array.isArray(message.validators)) + return "validators: array expected"; + for (let i = 0; i < message.validators.length; ++i) { + let error = $root.tendermint.abci.ValidatorUpdate.verify(message.validators[i]); + if (error) + return "validators." + error; + } + } + if (message.app_hash != null && message.hasOwnProperty("app_hash")) + if (!(message.app_hash && typeof message.app_hash.length === "number" || $util.isString(message.app_hash))) + return "app_hash: buffer expected"; + return null; + }; + + /** + * Creates a ResponseInitChain message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.ResponseInitChain + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.ResponseInitChain} ResponseInitChain + */ + ResponseInitChain.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.ResponseInitChain) + return object; + let message = new $root.tendermint.abci.ResponseInitChain(); + if (object.consensus_params != null) { + if (typeof object.consensus_params !== "object") + throw TypeError(".tendermint.abci.ResponseInitChain.consensus_params: object expected"); + message.consensus_params = $root.tendermint.abci.ConsensusParams.fromObject(object.consensus_params); + } + if (object.validators) { + if (!Array.isArray(object.validators)) + throw TypeError(".tendermint.abci.ResponseInitChain.validators: array expected"); + message.validators = []; + for (let i = 0; i < object.validators.length; ++i) { + if (typeof object.validators[i] !== "object") + throw TypeError(".tendermint.abci.ResponseInitChain.validators: object expected"); + message.validators[i] = $root.tendermint.abci.ValidatorUpdate.fromObject(object.validators[i]); + } + } + if (object.app_hash != null) + if (typeof object.app_hash === "string") + $util.base64.decode(object.app_hash, message.app_hash = $util.newBuffer($util.base64.length(object.app_hash)), 0); + else if (object.app_hash.length) + message.app_hash = object.app_hash; + return message; + }; + + /** + * Creates a plain object from a ResponseInitChain message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.ResponseInitChain + * @static + * @param {tendermint.abci.ResponseInitChain} message ResponseInitChain + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResponseInitChain.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.validators = []; + if (options.defaults) { + object.consensus_params = null; + if (options.bytes === String) + object.app_hash = ""; + else { + object.app_hash = []; + if (options.bytes !== Array) + object.app_hash = $util.newBuffer(object.app_hash); + } + } + if (message.consensus_params != null && message.hasOwnProperty("consensus_params")) + object.consensus_params = $root.tendermint.abci.ConsensusParams.toObject(message.consensus_params, options); + if (message.validators && message.validators.length) { + object.validators = []; + for (let j = 0; j < message.validators.length; ++j) + object.validators[j] = $root.tendermint.abci.ValidatorUpdate.toObject(message.validators[j], options); + } + if (message.app_hash != null && message.hasOwnProperty("app_hash")) + object.app_hash = options.bytes === String ? $util.base64.encode(message.app_hash, 0, message.app_hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.app_hash) : message.app_hash; + return object; + }; + + /** + * Converts this ResponseInitChain to JSON. + * @function toJSON + * @memberof tendermint.abci.ResponseInitChain + * @instance + * @returns {Object.} JSON object + */ + ResponseInitChain.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ResponseInitChain; + })(); + + abci.ResponseQuery = (function() { + + /** + * Properties of a ResponseQuery. + * @memberof tendermint.abci + * @interface IResponseQuery + * @property {number|null} [code] ResponseQuery code + * @property {string|null} [log] ResponseQuery log + * @property {string|null} [info] ResponseQuery info + * @property {Long|null} [index] ResponseQuery index + * @property {Uint8Array|null} [key] ResponseQuery key + * @property {Uint8Array|null} [value] ResponseQuery value + * @property {tendermint.crypto.IProofOps|null} [proof_ops] ResponseQuery proof_ops + * @property {Long|null} [height] ResponseQuery height + * @property {string|null} [codespace] ResponseQuery codespace + */ + + /** + * Constructs a new ResponseQuery. + * @memberof tendermint.abci + * @classdesc Represents a ResponseQuery. + * @implements IResponseQuery + * @constructor + * @param {tendermint.abci.IResponseQuery=} [properties] Properties to set + */ + function ResponseQuery(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResponseQuery code. + * @member {number} code + * @memberof tendermint.abci.ResponseQuery + * @instance + */ + ResponseQuery.prototype.code = 0; + + /** + * ResponseQuery log. + * @member {string} log + * @memberof tendermint.abci.ResponseQuery + * @instance + */ + ResponseQuery.prototype.log = ""; + + /** + * ResponseQuery info. + * @member {string} info + * @memberof tendermint.abci.ResponseQuery + * @instance + */ + ResponseQuery.prototype.info = ""; + + /** + * ResponseQuery index. + * @member {Long} index + * @memberof tendermint.abci.ResponseQuery + * @instance + */ + ResponseQuery.prototype.index = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ResponseQuery key. + * @member {Uint8Array} key + * @memberof tendermint.abci.ResponseQuery + * @instance + */ + ResponseQuery.prototype.key = $util.newBuffer([]); + + /** + * ResponseQuery value. + * @member {Uint8Array} value + * @memberof tendermint.abci.ResponseQuery + * @instance + */ + ResponseQuery.prototype.value = $util.newBuffer([]); + + /** + * ResponseQuery proof_ops. + * @member {tendermint.crypto.IProofOps|null|undefined} proof_ops + * @memberof tendermint.abci.ResponseQuery + * @instance + */ + ResponseQuery.prototype.proof_ops = null; + + /** + * ResponseQuery height. + * @member {Long} height + * @memberof tendermint.abci.ResponseQuery + * @instance + */ + ResponseQuery.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ResponseQuery codespace. + * @member {string} codespace + * @memberof tendermint.abci.ResponseQuery + * @instance + */ + ResponseQuery.prototype.codespace = ""; + + /** + * Encodes the specified ResponseQuery message. Does not implicitly {@link tendermint.abci.ResponseQuery.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.ResponseQuery + * @static + * @param {tendermint.abci.IResponseQuery} message ResponseQuery message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseQuery.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.code != null && Object.hasOwnProperty.call(message, "code")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.code); + if (message.log != null && Object.hasOwnProperty.call(message, "log")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.log); + if (message.info != null && Object.hasOwnProperty.call(message, "info")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.info); + if (message.index != null && Object.hasOwnProperty.call(message, "index")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.index); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.key); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.value); + if (message.proof_ops != null && Object.hasOwnProperty.call(message, "proof_ops")) + $root.tendermint.crypto.ProofOps.encode(message.proof_ops, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 9, wireType 0 =*/72).int64(message.height); + if (message.codespace != null && Object.hasOwnProperty.call(message, "codespace")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.codespace); + return writer; + }; + + /** + * Encodes the specified ResponseQuery message, length delimited. Does not implicitly {@link tendermint.abci.ResponseQuery.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.ResponseQuery + * @static + * @param {tendermint.abci.IResponseQuery} message ResponseQuery message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseQuery.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResponseQuery message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.ResponseQuery + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.ResponseQuery} ResponseQuery + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseQuery.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseQuery(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.code = reader.uint32(); + break; + case 3: + message.log = reader.string(); + break; + case 4: + message.info = reader.string(); + break; + case 5: + message.index = reader.int64(); + break; + case 6: + message.key = reader.bytes(); + break; + case 7: + message.value = reader.bytes(); + break; + case 8: + message.proof_ops = $root.tendermint.crypto.ProofOps.decode(reader, reader.uint32()); + break; + case 9: + message.height = reader.int64(); + break; + case 10: + message.codespace = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResponseQuery message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.ResponseQuery + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.ResponseQuery} ResponseQuery + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseQuery.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResponseQuery message. + * @function verify + * @memberof tendermint.abci.ResponseQuery + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResponseQuery.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.code != null && message.hasOwnProperty("code")) + if (!$util.isInteger(message.code)) + return "code: integer expected"; + if (message.log != null && message.hasOwnProperty("log")) + if (!$util.isString(message.log)) + return "log: string expected"; + if (message.info != null && message.hasOwnProperty("info")) + if (!$util.isString(message.info)) + return "info: string expected"; + if (message.index != null && message.hasOwnProperty("index")) + if (!$util.isInteger(message.index) && !(message.index && $util.isInteger(message.index.low) && $util.isInteger(message.index.high))) + return "index: integer|Long expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) + return "key: buffer expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) + return "value: buffer expected"; + if (message.proof_ops != null && message.hasOwnProperty("proof_ops")) { + let error = $root.tendermint.crypto.ProofOps.verify(message.proof_ops); + if (error) + return "proof_ops." + error; + } + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) + return "height: integer|Long expected"; + if (message.codespace != null && message.hasOwnProperty("codespace")) + if (!$util.isString(message.codespace)) + return "codespace: string expected"; + return null; + }; + + /** + * Creates a ResponseQuery message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.ResponseQuery + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.ResponseQuery} ResponseQuery + */ + ResponseQuery.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.ResponseQuery) + return object; + let message = new $root.tendermint.abci.ResponseQuery(); + if (object.code != null) + message.code = object.code >>> 0; + if (object.log != null) + message.log = String(object.log); + if (object.info != null) + message.info = String(object.info); + if (object.index != null) + if ($util.Long) + (message.index = $util.Long.fromValue(object.index)).unsigned = false; + else if (typeof object.index === "string") + message.index = parseInt(object.index, 10); + else if (typeof object.index === "number") + message.index = object.index; + else if (typeof object.index === "object") + message.index = new $util.LongBits(object.index.low >>> 0, object.index.high >>> 0).toNumber(); + if (object.key != null) + if (typeof object.key === "string") + $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); + else if (object.key.length) + message.key = object.key; + if (object.value != null) + if (typeof object.value === "string") + $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); + else if (object.value.length) + message.value = object.value; + if (object.proof_ops != null) { + if (typeof object.proof_ops !== "object") + throw TypeError(".tendermint.abci.ResponseQuery.proof_ops: object expected"); + message.proof_ops = $root.tendermint.crypto.ProofOps.fromObject(object.proof_ops); + } + if (object.height != null) + if ($util.Long) + (message.height = $util.Long.fromValue(object.height)).unsigned = false; + else if (typeof object.height === "string") + message.height = parseInt(object.height, 10); + else if (typeof object.height === "number") + message.height = object.height; + else if (typeof object.height === "object") + message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); + if (object.codespace != null) + message.codespace = String(object.codespace); + return message; + }; + + /** + * Creates a plain object from a ResponseQuery message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.ResponseQuery + * @static + * @param {tendermint.abci.ResponseQuery} message ResponseQuery + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResponseQuery.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.code = 0; + object.log = ""; + object.info = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.index = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.index = options.longs === String ? "0" : 0; + if (options.bytes === String) + object.key = ""; + else { + object.key = []; + if (options.bytes !== Array) + object.key = $util.newBuffer(object.key); + } + if (options.bytes === String) + object.value = ""; + else { + object.value = []; + if (options.bytes !== Array) + object.value = $util.newBuffer(object.value); + } + object.proof_ops = null; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.height = options.longs === String ? "0" : 0; + object.codespace = ""; + } + if (message.code != null && message.hasOwnProperty("code")) + object.code = message.code; + if (message.log != null && message.hasOwnProperty("log")) + object.log = message.log; + if (message.info != null && message.hasOwnProperty("info")) + object.info = message.info; + if (message.index != null && message.hasOwnProperty("index")) + if (typeof message.index === "number") + object.index = options.longs === String ? String(message.index) : message.index; + else + object.index = options.longs === String ? $util.Long.prototype.toString.call(message.index) : options.longs === Number ? new $util.LongBits(message.index.low >>> 0, message.index.high >>> 0).toNumber() : message.index; + if (message.key != null && message.hasOwnProperty("key")) + object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; + if (message.proof_ops != null && message.hasOwnProperty("proof_ops")) + object.proof_ops = $root.tendermint.crypto.ProofOps.toObject(message.proof_ops, options); + if (message.height != null && message.hasOwnProperty("height")) + if (typeof message.height === "number") + object.height = options.longs === String ? String(message.height) : message.height; + else + object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; + if (message.codespace != null && message.hasOwnProperty("codespace")) + object.codespace = message.codespace; + return object; + }; + + /** + * Converts this ResponseQuery to JSON. + * @function toJSON + * @memberof tendermint.abci.ResponseQuery + * @instance + * @returns {Object.} JSON object + */ + ResponseQuery.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ResponseQuery; + })(); + + abci.ResponseBeginBlock = (function() { + + /** + * Properties of a ResponseBeginBlock. + * @memberof tendermint.abci + * @interface IResponseBeginBlock + * @property {Array.|null} [events] ResponseBeginBlock events + */ + + /** + * Constructs a new ResponseBeginBlock. + * @memberof tendermint.abci + * @classdesc Represents a ResponseBeginBlock. + * @implements IResponseBeginBlock + * @constructor + * @param {tendermint.abci.IResponseBeginBlock=} [properties] Properties to set + */ + function ResponseBeginBlock(properties) { + this.events = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResponseBeginBlock events. + * @member {Array.} events + * @memberof tendermint.abci.ResponseBeginBlock + * @instance + */ + ResponseBeginBlock.prototype.events = $util.emptyArray; + + /** + * Encodes the specified ResponseBeginBlock message. Does not implicitly {@link tendermint.abci.ResponseBeginBlock.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.ResponseBeginBlock + * @static + * @param {tendermint.abci.IResponseBeginBlock} message ResponseBeginBlock message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseBeginBlock.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.events != null && message.events.length) + for (let i = 0; i < message.events.length; ++i) + $root.tendermint.abci.Event.encode(message.events[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ResponseBeginBlock message, length delimited. Does not implicitly {@link tendermint.abci.ResponseBeginBlock.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.ResponseBeginBlock + * @static + * @param {tendermint.abci.IResponseBeginBlock} message ResponseBeginBlock message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseBeginBlock.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResponseBeginBlock message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.ResponseBeginBlock + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.ResponseBeginBlock} ResponseBeginBlock + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseBeginBlock.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseBeginBlock(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.events && message.events.length)) + message.events = []; + message.events.push($root.tendermint.abci.Event.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResponseBeginBlock message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.ResponseBeginBlock + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.ResponseBeginBlock} ResponseBeginBlock + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseBeginBlock.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResponseBeginBlock message. + * @function verify + * @memberof tendermint.abci.ResponseBeginBlock + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResponseBeginBlock.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.events != null && message.hasOwnProperty("events")) { + if (!Array.isArray(message.events)) + return "events: array expected"; + for (let i = 0; i < message.events.length; ++i) { + let error = $root.tendermint.abci.Event.verify(message.events[i]); + if (error) + return "events." + error; + } + } + return null; + }; + + /** + * Creates a ResponseBeginBlock message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.ResponseBeginBlock + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.ResponseBeginBlock} ResponseBeginBlock + */ + ResponseBeginBlock.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.ResponseBeginBlock) + return object; + let message = new $root.tendermint.abci.ResponseBeginBlock(); + if (object.events) { + if (!Array.isArray(object.events)) + throw TypeError(".tendermint.abci.ResponseBeginBlock.events: array expected"); + message.events = []; + for (let i = 0; i < object.events.length; ++i) { + if (typeof object.events[i] !== "object") + throw TypeError(".tendermint.abci.ResponseBeginBlock.events: object expected"); + message.events[i] = $root.tendermint.abci.Event.fromObject(object.events[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ResponseBeginBlock message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.ResponseBeginBlock + * @static + * @param {tendermint.abci.ResponseBeginBlock} message ResponseBeginBlock + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResponseBeginBlock.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.events = []; + if (message.events && message.events.length) { + object.events = []; + for (let j = 0; j < message.events.length; ++j) + object.events[j] = $root.tendermint.abci.Event.toObject(message.events[j], options); + } + return object; + }; + + /** + * Converts this ResponseBeginBlock to JSON. + * @function toJSON + * @memberof tendermint.abci.ResponseBeginBlock + * @instance + * @returns {Object.} JSON object + */ + ResponseBeginBlock.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ResponseBeginBlock; + })(); + + abci.ResponseCheckTx = (function() { + + /** + * Properties of a ResponseCheckTx. + * @memberof tendermint.abci + * @interface IResponseCheckTx + * @property {number|null} [code] ResponseCheckTx code + * @property {Uint8Array|null} [data] ResponseCheckTx data + * @property {string|null} [log] ResponseCheckTx log + * @property {string|null} [info] ResponseCheckTx info + * @property {Long|null} [gas_wanted] ResponseCheckTx gas_wanted + * @property {Long|null} [gas_used] ResponseCheckTx gas_used + * @property {Array.|null} [events] ResponseCheckTx events + * @property {string|null} [codespace] ResponseCheckTx codespace + */ + + /** + * Constructs a new ResponseCheckTx. + * @memberof tendermint.abci + * @classdesc Represents a ResponseCheckTx. + * @implements IResponseCheckTx + * @constructor + * @param {tendermint.abci.IResponseCheckTx=} [properties] Properties to set + */ + function ResponseCheckTx(properties) { + this.events = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResponseCheckTx code. + * @member {number} code + * @memberof tendermint.abci.ResponseCheckTx + * @instance + */ + ResponseCheckTx.prototype.code = 0; + + /** + * ResponseCheckTx data. + * @member {Uint8Array} data + * @memberof tendermint.abci.ResponseCheckTx + * @instance + */ + ResponseCheckTx.prototype.data = $util.newBuffer([]); + + /** + * ResponseCheckTx log. + * @member {string} log + * @memberof tendermint.abci.ResponseCheckTx + * @instance + */ + ResponseCheckTx.prototype.log = ""; + + /** + * ResponseCheckTx info. + * @member {string} info + * @memberof tendermint.abci.ResponseCheckTx + * @instance + */ + ResponseCheckTx.prototype.info = ""; + + /** + * ResponseCheckTx gas_wanted. + * @member {Long} gas_wanted + * @memberof tendermint.abci.ResponseCheckTx + * @instance + */ + ResponseCheckTx.prototype.gas_wanted = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ResponseCheckTx gas_used. + * @member {Long} gas_used + * @memberof tendermint.abci.ResponseCheckTx + * @instance + */ + ResponseCheckTx.prototype.gas_used = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ResponseCheckTx events. + * @member {Array.} events + * @memberof tendermint.abci.ResponseCheckTx + * @instance + */ + ResponseCheckTx.prototype.events = $util.emptyArray; + + /** + * ResponseCheckTx codespace. + * @member {string} codespace + * @memberof tendermint.abci.ResponseCheckTx + * @instance + */ + ResponseCheckTx.prototype.codespace = ""; + + /** + * Encodes the specified ResponseCheckTx message. Does not implicitly {@link tendermint.abci.ResponseCheckTx.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.ResponseCheckTx + * @static + * @param {tendermint.abci.IResponseCheckTx} message ResponseCheckTx message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseCheckTx.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.code != null && Object.hasOwnProperty.call(message, "code")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.code); + if (message.data != null && Object.hasOwnProperty.call(message, "data")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.data); + if (message.log != null && Object.hasOwnProperty.call(message, "log")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.log); + if (message.info != null && Object.hasOwnProperty.call(message, "info")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.info); + if (message.gas_wanted != null && Object.hasOwnProperty.call(message, "gas_wanted")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.gas_wanted); + if (message.gas_used != null && Object.hasOwnProperty.call(message, "gas_used")) + writer.uint32(/* id 6, wireType 0 =*/48).int64(message.gas_used); + if (message.events != null && message.events.length) + for (let i = 0; i < message.events.length; ++i) + $root.tendermint.abci.Event.encode(message.events[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.codespace != null && Object.hasOwnProperty.call(message, "codespace")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.codespace); + return writer; + }; + + /** + * Encodes the specified ResponseCheckTx message, length delimited. Does not implicitly {@link tendermint.abci.ResponseCheckTx.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.ResponseCheckTx + * @static + * @param {tendermint.abci.IResponseCheckTx} message ResponseCheckTx message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseCheckTx.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResponseCheckTx message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.ResponseCheckTx + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.ResponseCheckTx} ResponseCheckTx + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseCheckTx.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseCheckTx(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.code = reader.uint32(); + break; + case 2: + message.data = reader.bytes(); + break; + case 3: + message.log = reader.string(); + break; + case 4: + message.info = reader.string(); + break; + case 5: + message.gas_wanted = reader.int64(); + break; + case 6: + message.gas_used = reader.int64(); + break; + case 7: + if (!(message.events && message.events.length)) + message.events = []; + message.events.push($root.tendermint.abci.Event.decode(reader, reader.uint32())); + break; + case 8: + message.codespace = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResponseCheckTx message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.ResponseCheckTx + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.ResponseCheckTx} ResponseCheckTx + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseCheckTx.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResponseCheckTx message. + * @function verify + * @memberof tendermint.abci.ResponseCheckTx + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResponseCheckTx.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.code != null && message.hasOwnProperty("code")) + if (!$util.isInteger(message.code)) + return "code: integer expected"; + if (message.data != null && message.hasOwnProperty("data")) + if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) + return "data: buffer expected"; + if (message.log != null && message.hasOwnProperty("log")) + if (!$util.isString(message.log)) + return "log: string expected"; + if (message.info != null && message.hasOwnProperty("info")) + if (!$util.isString(message.info)) + return "info: string expected"; + if (message.gas_wanted != null && message.hasOwnProperty("gas_wanted")) + if (!$util.isInteger(message.gas_wanted) && !(message.gas_wanted && $util.isInteger(message.gas_wanted.low) && $util.isInteger(message.gas_wanted.high))) + return "gas_wanted: integer|Long expected"; + if (message.gas_used != null && message.hasOwnProperty("gas_used")) + if (!$util.isInteger(message.gas_used) && !(message.gas_used && $util.isInteger(message.gas_used.low) && $util.isInteger(message.gas_used.high))) + return "gas_used: integer|Long expected"; + if (message.events != null && message.hasOwnProperty("events")) { + if (!Array.isArray(message.events)) + return "events: array expected"; + for (let i = 0; i < message.events.length; ++i) { + let error = $root.tendermint.abci.Event.verify(message.events[i]); + if (error) + return "events." + error; + } + } + if (message.codespace != null && message.hasOwnProperty("codespace")) + if (!$util.isString(message.codespace)) + return "codespace: string expected"; + return null; + }; + + /** + * Creates a ResponseCheckTx message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.ResponseCheckTx + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.ResponseCheckTx} ResponseCheckTx + */ + ResponseCheckTx.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.ResponseCheckTx) + return object; + let message = new $root.tendermint.abci.ResponseCheckTx(); + if (object.code != null) + message.code = object.code >>> 0; + if (object.data != null) + if (typeof object.data === "string") + $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); + else if (object.data.length) + message.data = object.data; + if (object.log != null) + message.log = String(object.log); + if (object.info != null) + message.info = String(object.info); + if (object.gas_wanted != null) + if ($util.Long) + (message.gas_wanted = $util.Long.fromValue(object.gas_wanted)).unsigned = false; + else if (typeof object.gas_wanted === "string") + message.gas_wanted = parseInt(object.gas_wanted, 10); + else if (typeof object.gas_wanted === "number") + message.gas_wanted = object.gas_wanted; + else if (typeof object.gas_wanted === "object") + message.gas_wanted = new $util.LongBits(object.gas_wanted.low >>> 0, object.gas_wanted.high >>> 0).toNumber(); + if (object.gas_used != null) + if ($util.Long) + (message.gas_used = $util.Long.fromValue(object.gas_used)).unsigned = false; + else if (typeof object.gas_used === "string") + message.gas_used = parseInt(object.gas_used, 10); + else if (typeof object.gas_used === "number") + message.gas_used = object.gas_used; + else if (typeof object.gas_used === "object") + message.gas_used = new $util.LongBits(object.gas_used.low >>> 0, object.gas_used.high >>> 0).toNumber(); + if (object.events) { + if (!Array.isArray(object.events)) + throw TypeError(".tendermint.abci.ResponseCheckTx.events: array expected"); + message.events = []; + for (let i = 0; i < object.events.length; ++i) { + if (typeof object.events[i] !== "object") + throw TypeError(".tendermint.abci.ResponseCheckTx.events: object expected"); + message.events[i] = $root.tendermint.abci.Event.fromObject(object.events[i]); + } + } + if (object.codespace != null) + message.codespace = String(object.codespace); + return message; + }; + + /** + * Creates a plain object from a ResponseCheckTx message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.ResponseCheckTx + * @static + * @param {tendermint.abci.ResponseCheckTx} message ResponseCheckTx + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResponseCheckTx.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.events = []; + if (options.defaults) { + object.code = 0; + if (options.bytes === String) + object.data = ""; + else { + object.data = []; + if (options.bytes !== Array) + object.data = $util.newBuffer(object.data); + } + object.log = ""; + object.info = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.gas_wanted = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.gas_wanted = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.gas_used = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.gas_used = options.longs === String ? "0" : 0; + object.codespace = ""; + } + if (message.code != null && message.hasOwnProperty("code")) + object.code = message.code; + if (message.data != null && message.hasOwnProperty("data")) + object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; + if (message.log != null && message.hasOwnProperty("log")) + object.log = message.log; + if (message.info != null && message.hasOwnProperty("info")) + object.info = message.info; + if (message.gas_wanted != null && message.hasOwnProperty("gas_wanted")) + if (typeof message.gas_wanted === "number") + object.gas_wanted = options.longs === String ? String(message.gas_wanted) : message.gas_wanted; + else + object.gas_wanted = options.longs === String ? $util.Long.prototype.toString.call(message.gas_wanted) : options.longs === Number ? new $util.LongBits(message.gas_wanted.low >>> 0, message.gas_wanted.high >>> 0).toNumber() : message.gas_wanted; + if (message.gas_used != null && message.hasOwnProperty("gas_used")) + if (typeof message.gas_used === "number") + object.gas_used = options.longs === String ? String(message.gas_used) : message.gas_used; + else + object.gas_used = options.longs === String ? $util.Long.prototype.toString.call(message.gas_used) : options.longs === Number ? new $util.LongBits(message.gas_used.low >>> 0, message.gas_used.high >>> 0).toNumber() : message.gas_used; + if (message.events && message.events.length) { + object.events = []; + for (let j = 0; j < message.events.length; ++j) + object.events[j] = $root.tendermint.abci.Event.toObject(message.events[j], options); + } + if (message.codespace != null && message.hasOwnProperty("codespace")) + object.codespace = message.codespace; + return object; + }; + + /** + * Converts this ResponseCheckTx to JSON. + * @function toJSON + * @memberof tendermint.abci.ResponseCheckTx + * @instance + * @returns {Object.} JSON object + */ + ResponseCheckTx.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ResponseCheckTx; + })(); + + abci.ResponseDeliverTx = (function() { + + /** + * Properties of a ResponseDeliverTx. + * @memberof tendermint.abci + * @interface IResponseDeliverTx + * @property {number|null} [code] ResponseDeliverTx code + * @property {Uint8Array|null} [data] ResponseDeliverTx data + * @property {string|null} [log] ResponseDeliverTx log + * @property {string|null} [info] ResponseDeliverTx info + * @property {Long|null} [gas_wanted] ResponseDeliverTx gas_wanted + * @property {Long|null} [gas_used] ResponseDeliverTx gas_used + * @property {Array.|null} [events] ResponseDeliverTx events + * @property {string|null} [codespace] ResponseDeliverTx codespace + */ + + /** + * Constructs a new ResponseDeliverTx. + * @memberof tendermint.abci + * @classdesc Represents a ResponseDeliverTx. + * @implements IResponseDeliverTx + * @constructor + * @param {tendermint.abci.IResponseDeliverTx=} [properties] Properties to set + */ + function ResponseDeliverTx(properties) { + this.events = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResponseDeliverTx code. + * @member {number} code + * @memberof tendermint.abci.ResponseDeliverTx + * @instance + */ + ResponseDeliverTx.prototype.code = 0; + + /** + * ResponseDeliverTx data. + * @member {Uint8Array} data + * @memberof tendermint.abci.ResponseDeliverTx + * @instance + */ + ResponseDeliverTx.prototype.data = $util.newBuffer([]); + + /** + * ResponseDeliverTx log. + * @member {string} log + * @memberof tendermint.abci.ResponseDeliverTx + * @instance + */ + ResponseDeliverTx.prototype.log = ""; + + /** + * ResponseDeliverTx info. + * @member {string} info + * @memberof tendermint.abci.ResponseDeliverTx + * @instance + */ + ResponseDeliverTx.prototype.info = ""; + + /** + * ResponseDeliverTx gas_wanted. + * @member {Long} gas_wanted + * @memberof tendermint.abci.ResponseDeliverTx + * @instance + */ + ResponseDeliverTx.prototype.gas_wanted = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ResponseDeliverTx gas_used. + * @member {Long} gas_used + * @memberof tendermint.abci.ResponseDeliverTx + * @instance + */ + ResponseDeliverTx.prototype.gas_used = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ResponseDeliverTx events. + * @member {Array.} events + * @memberof tendermint.abci.ResponseDeliverTx + * @instance + */ + ResponseDeliverTx.prototype.events = $util.emptyArray; + + /** + * ResponseDeliverTx codespace. + * @member {string} codespace + * @memberof tendermint.abci.ResponseDeliverTx + * @instance + */ + ResponseDeliverTx.prototype.codespace = ""; + + /** + * Encodes the specified ResponseDeliverTx message. Does not implicitly {@link tendermint.abci.ResponseDeliverTx.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.ResponseDeliverTx + * @static + * @param {tendermint.abci.IResponseDeliverTx} message ResponseDeliverTx message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseDeliverTx.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.code != null && Object.hasOwnProperty.call(message, "code")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.code); + if (message.data != null && Object.hasOwnProperty.call(message, "data")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.data); + if (message.log != null && Object.hasOwnProperty.call(message, "log")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.log); + if (message.info != null && Object.hasOwnProperty.call(message, "info")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.info); + if (message.gas_wanted != null && Object.hasOwnProperty.call(message, "gas_wanted")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.gas_wanted); + if (message.gas_used != null && Object.hasOwnProperty.call(message, "gas_used")) + writer.uint32(/* id 6, wireType 0 =*/48).int64(message.gas_used); + if (message.events != null && message.events.length) + for (let i = 0; i < message.events.length; ++i) + $root.tendermint.abci.Event.encode(message.events[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.codespace != null && Object.hasOwnProperty.call(message, "codespace")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.codespace); + return writer; + }; + + /** + * Encodes the specified ResponseDeliverTx message, length delimited. Does not implicitly {@link tendermint.abci.ResponseDeliverTx.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.ResponseDeliverTx + * @static + * @param {tendermint.abci.IResponseDeliverTx} message ResponseDeliverTx message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseDeliverTx.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResponseDeliverTx message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.ResponseDeliverTx + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.ResponseDeliverTx} ResponseDeliverTx + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseDeliverTx.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseDeliverTx(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.code = reader.uint32(); + break; + case 2: + message.data = reader.bytes(); + break; + case 3: + message.log = reader.string(); + break; + case 4: + message.info = reader.string(); + break; + case 5: + message.gas_wanted = reader.int64(); + break; + case 6: + message.gas_used = reader.int64(); + break; + case 7: + if (!(message.events && message.events.length)) + message.events = []; + message.events.push($root.tendermint.abci.Event.decode(reader, reader.uint32())); + break; + case 8: + message.codespace = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResponseDeliverTx message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.ResponseDeliverTx + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.ResponseDeliverTx} ResponseDeliverTx + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseDeliverTx.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResponseDeliverTx message. + * @function verify + * @memberof tendermint.abci.ResponseDeliverTx + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResponseDeliverTx.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.code != null && message.hasOwnProperty("code")) + if (!$util.isInteger(message.code)) + return "code: integer expected"; + if (message.data != null && message.hasOwnProperty("data")) + if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) + return "data: buffer expected"; + if (message.log != null && message.hasOwnProperty("log")) + if (!$util.isString(message.log)) + return "log: string expected"; + if (message.info != null && message.hasOwnProperty("info")) + if (!$util.isString(message.info)) + return "info: string expected"; + if (message.gas_wanted != null && message.hasOwnProperty("gas_wanted")) + if (!$util.isInteger(message.gas_wanted) && !(message.gas_wanted && $util.isInteger(message.gas_wanted.low) && $util.isInteger(message.gas_wanted.high))) + return "gas_wanted: integer|Long expected"; + if (message.gas_used != null && message.hasOwnProperty("gas_used")) + if (!$util.isInteger(message.gas_used) && !(message.gas_used && $util.isInteger(message.gas_used.low) && $util.isInteger(message.gas_used.high))) + return "gas_used: integer|Long expected"; + if (message.events != null && message.hasOwnProperty("events")) { + if (!Array.isArray(message.events)) + return "events: array expected"; + for (let i = 0; i < message.events.length; ++i) { + let error = $root.tendermint.abci.Event.verify(message.events[i]); + if (error) + return "events." + error; + } + } + if (message.codespace != null && message.hasOwnProperty("codespace")) + if (!$util.isString(message.codespace)) + return "codespace: string expected"; + return null; + }; + + /** + * Creates a ResponseDeliverTx message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.ResponseDeliverTx + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.ResponseDeliverTx} ResponseDeliverTx + */ + ResponseDeliverTx.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.ResponseDeliverTx) + return object; + let message = new $root.tendermint.abci.ResponseDeliverTx(); + if (object.code != null) + message.code = object.code >>> 0; + if (object.data != null) + if (typeof object.data === "string") + $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); + else if (object.data.length) + message.data = object.data; + if (object.log != null) + message.log = String(object.log); + if (object.info != null) + message.info = String(object.info); + if (object.gas_wanted != null) + if ($util.Long) + (message.gas_wanted = $util.Long.fromValue(object.gas_wanted)).unsigned = false; + else if (typeof object.gas_wanted === "string") + message.gas_wanted = parseInt(object.gas_wanted, 10); + else if (typeof object.gas_wanted === "number") + message.gas_wanted = object.gas_wanted; + else if (typeof object.gas_wanted === "object") + message.gas_wanted = new $util.LongBits(object.gas_wanted.low >>> 0, object.gas_wanted.high >>> 0).toNumber(); + if (object.gas_used != null) + if ($util.Long) + (message.gas_used = $util.Long.fromValue(object.gas_used)).unsigned = false; + else if (typeof object.gas_used === "string") + message.gas_used = parseInt(object.gas_used, 10); + else if (typeof object.gas_used === "number") + message.gas_used = object.gas_used; + else if (typeof object.gas_used === "object") + message.gas_used = new $util.LongBits(object.gas_used.low >>> 0, object.gas_used.high >>> 0).toNumber(); + if (object.events) { + if (!Array.isArray(object.events)) + throw TypeError(".tendermint.abci.ResponseDeliverTx.events: array expected"); + message.events = []; + for (let i = 0; i < object.events.length; ++i) { + if (typeof object.events[i] !== "object") + throw TypeError(".tendermint.abci.ResponseDeliverTx.events: object expected"); + message.events[i] = $root.tendermint.abci.Event.fromObject(object.events[i]); + } + } + if (object.codespace != null) + message.codespace = String(object.codespace); + return message; + }; + + /** + * Creates a plain object from a ResponseDeliverTx message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.ResponseDeliverTx + * @static + * @param {tendermint.abci.ResponseDeliverTx} message ResponseDeliverTx + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResponseDeliverTx.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.events = []; + if (options.defaults) { + object.code = 0; + if (options.bytes === String) + object.data = ""; + else { + object.data = []; + if (options.bytes !== Array) + object.data = $util.newBuffer(object.data); + } + object.log = ""; + object.info = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.gas_wanted = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.gas_wanted = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.gas_used = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.gas_used = options.longs === String ? "0" : 0; + object.codespace = ""; + } + if (message.code != null && message.hasOwnProperty("code")) + object.code = message.code; + if (message.data != null && message.hasOwnProperty("data")) + object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; + if (message.log != null && message.hasOwnProperty("log")) + object.log = message.log; + if (message.info != null && message.hasOwnProperty("info")) + object.info = message.info; + if (message.gas_wanted != null && message.hasOwnProperty("gas_wanted")) + if (typeof message.gas_wanted === "number") + object.gas_wanted = options.longs === String ? String(message.gas_wanted) : message.gas_wanted; + else + object.gas_wanted = options.longs === String ? $util.Long.prototype.toString.call(message.gas_wanted) : options.longs === Number ? new $util.LongBits(message.gas_wanted.low >>> 0, message.gas_wanted.high >>> 0).toNumber() : message.gas_wanted; + if (message.gas_used != null && message.hasOwnProperty("gas_used")) + if (typeof message.gas_used === "number") + object.gas_used = options.longs === String ? String(message.gas_used) : message.gas_used; + else + object.gas_used = options.longs === String ? $util.Long.prototype.toString.call(message.gas_used) : options.longs === Number ? new $util.LongBits(message.gas_used.low >>> 0, message.gas_used.high >>> 0).toNumber() : message.gas_used; + if (message.events && message.events.length) { + object.events = []; + for (let j = 0; j < message.events.length; ++j) + object.events[j] = $root.tendermint.abci.Event.toObject(message.events[j], options); + } + if (message.codespace != null && message.hasOwnProperty("codespace")) + object.codespace = message.codespace; + return object; + }; + + /** + * Converts this ResponseDeliverTx to JSON. + * @function toJSON + * @memberof tendermint.abci.ResponseDeliverTx + * @instance + * @returns {Object.} JSON object + */ + ResponseDeliverTx.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ResponseDeliverTx; + })(); + + abci.ResponseEndBlock = (function() { + + /** + * Properties of a ResponseEndBlock. + * @memberof tendermint.abci + * @interface IResponseEndBlock + * @property {Array.|null} [validator_updates] ResponseEndBlock validator_updates + * @property {tendermint.abci.IConsensusParams|null} [consensus_param_updates] ResponseEndBlock consensus_param_updates + * @property {Array.|null} [events] ResponseEndBlock events + */ + + /** + * Constructs a new ResponseEndBlock. + * @memberof tendermint.abci + * @classdesc Represents a ResponseEndBlock. + * @implements IResponseEndBlock + * @constructor + * @param {tendermint.abci.IResponseEndBlock=} [properties] Properties to set + */ + function ResponseEndBlock(properties) { + this.validator_updates = []; + this.events = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResponseEndBlock validator_updates. + * @member {Array.} validator_updates + * @memberof tendermint.abci.ResponseEndBlock + * @instance + */ + ResponseEndBlock.prototype.validator_updates = $util.emptyArray; + + /** + * ResponseEndBlock consensus_param_updates. + * @member {tendermint.abci.IConsensusParams|null|undefined} consensus_param_updates + * @memberof tendermint.abci.ResponseEndBlock + * @instance + */ + ResponseEndBlock.prototype.consensus_param_updates = null; + + /** + * ResponseEndBlock events. + * @member {Array.} events + * @memberof tendermint.abci.ResponseEndBlock + * @instance + */ + ResponseEndBlock.prototype.events = $util.emptyArray; + + /** + * Encodes the specified ResponseEndBlock message. Does not implicitly {@link tendermint.abci.ResponseEndBlock.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.ResponseEndBlock + * @static + * @param {tendermint.abci.IResponseEndBlock} message ResponseEndBlock message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseEndBlock.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.validator_updates != null && message.validator_updates.length) + for (let i = 0; i < message.validator_updates.length; ++i) + $root.tendermint.abci.ValidatorUpdate.encode(message.validator_updates[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.consensus_param_updates != null && Object.hasOwnProperty.call(message, "consensus_param_updates")) + $root.tendermint.abci.ConsensusParams.encode(message.consensus_param_updates, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.events != null && message.events.length) + for (let i = 0; i < message.events.length; ++i) + $root.tendermint.abci.Event.encode(message.events[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ResponseEndBlock message, length delimited. Does not implicitly {@link tendermint.abci.ResponseEndBlock.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.ResponseEndBlock + * @static + * @param {tendermint.abci.IResponseEndBlock} message ResponseEndBlock message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseEndBlock.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResponseEndBlock message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.ResponseEndBlock + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.ResponseEndBlock} ResponseEndBlock + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseEndBlock.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseEndBlock(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.validator_updates && message.validator_updates.length)) + message.validator_updates = []; + message.validator_updates.push($root.tendermint.abci.ValidatorUpdate.decode(reader, reader.uint32())); + break; + case 2: + message.consensus_param_updates = $root.tendermint.abci.ConsensusParams.decode(reader, reader.uint32()); + break; + case 3: + if (!(message.events && message.events.length)) + message.events = []; + message.events.push($root.tendermint.abci.Event.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResponseEndBlock message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.ResponseEndBlock + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.ResponseEndBlock} ResponseEndBlock + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseEndBlock.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResponseEndBlock message. + * @function verify + * @memberof tendermint.abci.ResponseEndBlock + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResponseEndBlock.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.validator_updates != null && message.hasOwnProperty("validator_updates")) { + if (!Array.isArray(message.validator_updates)) + return "validator_updates: array expected"; + for (let i = 0; i < message.validator_updates.length; ++i) { + let error = $root.tendermint.abci.ValidatorUpdate.verify(message.validator_updates[i]); + if (error) + return "validator_updates." + error; + } + } + if (message.consensus_param_updates != null && message.hasOwnProperty("consensus_param_updates")) { + let error = $root.tendermint.abci.ConsensusParams.verify(message.consensus_param_updates); + if (error) + return "consensus_param_updates." + error; + } + if (message.events != null && message.hasOwnProperty("events")) { + if (!Array.isArray(message.events)) + return "events: array expected"; + for (let i = 0; i < message.events.length; ++i) { + let error = $root.tendermint.abci.Event.verify(message.events[i]); + if (error) + return "events." + error; + } + } + return null; + }; + + /** + * Creates a ResponseEndBlock message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.ResponseEndBlock + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.ResponseEndBlock} ResponseEndBlock + */ + ResponseEndBlock.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.ResponseEndBlock) + return object; + let message = new $root.tendermint.abci.ResponseEndBlock(); + if (object.validator_updates) { + if (!Array.isArray(object.validator_updates)) + throw TypeError(".tendermint.abci.ResponseEndBlock.validator_updates: array expected"); + message.validator_updates = []; + for (let i = 0; i < object.validator_updates.length; ++i) { + if (typeof object.validator_updates[i] !== "object") + throw TypeError(".tendermint.abci.ResponseEndBlock.validator_updates: object expected"); + message.validator_updates[i] = $root.tendermint.abci.ValidatorUpdate.fromObject(object.validator_updates[i]); + } + } + if (object.consensus_param_updates != null) { + if (typeof object.consensus_param_updates !== "object") + throw TypeError(".tendermint.abci.ResponseEndBlock.consensus_param_updates: object expected"); + message.consensus_param_updates = $root.tendermint.abci.ConsensusParams.fromObject(object.consensus_param_updates); + } + if (object.events) { + if (!Array.isArray(object.events)) + throw TypeError(".tendermint.abci.ResponseEndBlock.events: array expected"); + message.events = []; + for (let i = 0; i < object.events.length; ++i) { + if (typeof object.events[i] !== "object") + throw TypeError(".tendermint.abci.ResponseEndBlock.events: object expected"); + message.events[i] = $root.tendermint.abci.Event.fromObject(object.events[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ResponseEndBlock message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.ResponseEndBlock + * @static + * @param {tendermint.abci.ResponseEndBlock} message ResponseEndBlock + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResponseEndBlock.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) { + object.validator_updates = []; + object.events = []; + } + if (options.defaults) + object.consensus_param_updates = null; + if (message.validator_updates && message.validator_updates.length) { + object.validator_updates = []; + for (let j = 0; j < message.validator_updates.length; ++j) + object.validator_updates[j] = $root.tendermint.abci.ValidatorUpdate.toObject(message.validator_updates[j], options); + } + if (message.consensus_param_updates != null && message.hasOwnProperty("consensus_param_updates")) + object.consensus_param_updates = $root.tendermint.abci.ConsensusParams.toObject(message.consensus_param_updates, options); + if (message.events && message.events.length) { + object.events = []; + for (let j = 0; j < message.events.length; ++j) + object.events[j] = $root.tendermint.abci.Event.toObject(message.events[j], options); + } + return object; + }; + + /** + * Converts this ResponseEndBlock to JSON. + * @function toJSON + * @memberof tendermint.abci.ResponseEndBlock + * @instance + * @returns {Object.} JSON object + */ + ResponseEndBlock.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ResponseEndBlock; + })(); + + abci.ResponseCommit = (function() { + + /** + * Properties of a ResponseCommit. + * @memberof tendermint.abci + * @interface IResponseCommit + * @property {Uint8Array|null} [data] ResponseCommit data + * @property {Long|null} [retain_height] ResponseCommit retain_height + */ + + /** + * Constructs a new ResponseCommit. + * @memberof tendermint.abci + * @classdesc Represents a ResponseCommit. + * @implements IResponseCommit + * @constructor + * @param {tendermint.abci.IResponseCommit=} [properties] Properties to set + */ + function ResponseCommit(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResponseCommit data. + * @member {Uint8Array} data + * @memberof tendermint.abci.ResponseCommit + * @instance + */ + ResponseCommit.prototype.data = $util.newBuffer([]); + + /** + * ResponseCommit retain_height. + * @member {Long} retain_height + * @memberof tendermint.abci.ResponseCommit + * @instance + */ + ResponseCommit.prototype.retain_height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Encodes the specified ResponseCommit message. Does not implicitly {@link tendermint.abci.ResponseCommit.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.ResponseCommit + * @static + * @param {tendermint.abci.IResponseCommit} message ResponseCommit message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseCommit.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.data != null && Object.hasOwnProperty.call(message, "data")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.data); + if (message.retain_height != null && Object.hasOwnProperty.call(message, "retain_height")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.retain_height); + return writer; + }; + + /** + * Encodes the specified ResponseCommit message, length delimited. Does not implicitly {@link tendermint.abci.ResponseCommit.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.ResponseCommit + * @static + * @param {tendermint.abci.IResponseCommit} message ResponseCommit message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseCommit.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResponseCommit message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.ResponseCommit + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.ResponseCommit} ResponseCommit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseCommit.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseCommit(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.data = reader.bytes(); + break; + case 3: + message.retain_height = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResponseCommit message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.ResponseCommit + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.ResponseCommit} ResponseCommit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseCommit.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResponseCommit message. + * @function verify + * @memberof tendermint.abci.ResponseCommit + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResponseCommit.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.data != null && message.hasOwnProperty("data")) + if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) + return "data: buffer expected"; + if (message.retain_height != null && message.hasOwnProperty("retain_height")) + if (!$util.isInteger(message.retain_height) && !(message.retain_height && $util.isInteger(message.retain_height.low) && $util.isInteger(message.retain_height.high))) + return "retain_height: integer|Long expected"; + return null; + }; + + /** + * Creates a ResponseCommit message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.ResponseCommit + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.ResponseCommit} ResponseCommit + */ + ResponseCommit.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.ResponseCommit) + return object; + let message = new $root.tendermint.abci.ResponseCommit(); + if (object.data != null) + if (typeof object.data === "string") + $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); + else if (object.data.length) + message.data = object.data; + if (object.retain_height != null) + if ($util.Long) + (message.retain_height = $util.Long.fromValue(object.retain_height)).unsigned = false; + else if (typeof object.retain_height === "string") + message.retain_height = parseInt(object.retain_height, 10); + else if (typeof object.retain_height === "number") + message.retain_height = object.retain_height; + else if (typeof object.retain_height === "object") + message.retain_height = new $util.LongBits(object.retain_height.low >>> 0, object.retain_height.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a ResponseCommit message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.ResponseCommit + * @static + * @param {tendermint.abci.ResponseCommit} message ResponseCommit + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResponseCommit.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if (options.bytes === String) + object.data = ""; + else { + object.data = []; + if (options.bytes !== Array) + object.data = $util.newBuffer(object.data); + } + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.retain_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.retain_height = options.longs === String ? "0" : 0; + } + if (message.data != null && message.hasOwnProperty("data")) + object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; + if (message.retain_height != null && message.hasOwnProperty("retain_height")) + if (typeof message.retain_height === "number") + object.retain_height = options.longs === String ? String(message.retain_height) : message.retain_height; + else + object.retain_height = options.longs === String ? $util.Long.prototype.toString.call(message.retain_height) : options.longs === Number ? new $util.LongBits(message.retain_height.low >>> 0, message.retain_height.high >>> 0).toNumber() : message.retain_height; + return object; + }; + + /** + * Converts this ResponseCommit to JSON. + * @function toJSON + * @memberof tendermint.abci.ResponseCommit + * @instance + * @returns {Object.} JSON object + */ + ResponseCommit.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ResponseCommit; + })(); + + abci.ResponseListSnapshots = (function() { + + /** + * Properties of a ResponseListSnapshots. + * @memberof tendermint.abci + * @interface IResponseListSnapshots + * @property {Array.|null} [snapshots] ResponseListSnapshots snapshots + */ + + /** + * Constructs a new ResponseListSnapshots. + * @memberof tendermint.abci + * @classdesc Represents a ResponseListSnapshots. + * @implements IResponseListSnapshots + * @constructor + * @param {tendermint.abci.IResponseListSnapshots=} [properties] Properties to set + */ + function ResponseListSnapshots(properties) { + this.snapshots = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResponseListSnapshots snapshots. + * @member {Array.} snapshots + * @memberof tendermint.abci.ResponseListSnapshots + * @instance + */ + ResponseListSnapshots.prototype.snapshots = $util.emptyArray; + + /** + * Encodes the specified ResponseListSnapshots message. Does not implicitly {@link tendermint.abci.ResponseListSnapshots.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.ResponseListSnapshots + * @static + * @param {tendermint.abci.IResponseListSnapshots} message ResponseListSnapshots message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseListSnapshots.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.snapshots != null && message.snapshots.length) + for (let i = 0; i < message.snapshots.length; ++i) + $root.tendermint.abci.Snapshot.encode(message.snapshots[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ResponseListSnapshots message, length delimited. Does not implicitly {@link tendermint.abci.ResponseListSnapshots.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.ResponseListSnapshots + * @static + * @param {tendermint.abci.IResponseListSnapshots} message ResponseListSnapshots message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseListSnapshots.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResponseListSnapshots message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.ResponseListSnapshots + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.ResponseListSnapshots} ResponseListSnapshots + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseListSnapshots.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseListSnapshots(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.snapshots && message.snapshots.length)) + message.snapshots = []; + message.snapshots.push($root.tendermint.abci.Snapshot.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResponseListSnapshots message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.ResponseListSnapshots + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.ResponseListSnapshots} ResponseListSnapshots + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseListSnapshots.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResponseListSnapshots message. + * @function verify + * @memberof tendermint.abci.ResponseListSnapshots + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResponseListSnapshots.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.snapshots != null && message.hasOwnProperty("snapshots")) { + if (!Array.isArray(message.snapshots)) + return "snapshots: array expected"; + for (let i = 0; i < message.snapshots.length; ++i) { + let error = $root.tendermint.abci.Snapshot.verify(message.snapshots[i]); + if (error) + return "snapshots." + error; + } + } + return null; + }; + + /** + * Creates a ResponseListSnapshots message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.ResponseListSnapshots + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.ResponseListSnapshots} ResponseListSnapshots + */ + ResponseListSnapshots.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.ResponseListSnapshots) + return object; + let message = new $root.tendermint.abci.ResponseListSnapshots(); + if (object.snapshots) { + if (!Array.isArray(object.snapshots)) + throw TypeError(".tendermint.abci.ResponseListSnapshots.snapshots: array expected"); + message.snapshots = []; + for (let i = 0; i < object.snapshots.length; ++i) { + if (typeof object.snapshots[i] !== "object") + throw TypeError(".tendermint.abci.ResponseListSnapshots.snapshots: object expected"); + message.snapshots[i] = $root.tendermint.abci.Snapshot.fromObject(object.snapshots[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ResponseListSnapshots message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.ResponseListSnapshots + * @static + * @param {tendermint.abci.ResponseListSnapshots} message ResponseListSnapshots + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResponseListSnapshots.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.snapshots = []; + if (message.snapshots && message.snapshots.length) { + object.snapshots = []; + for (let j = 0; j < message.snapshots.length; ++j) + object.snapshots[j] = $root.tendermint.abci.Snapshot.toObject(message.snapshots[j], options); + } + return object; + }; + + /** + * Converts this ResponseListSnapshots to JSON. + * @function toJSON + * @memberof tendermint.abci.ResponseListSnapshots + * @instance + * @returns {Object.} JSON object + */ + ResponseListSnapshots.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ResponseListSnapshots; + })(); + + abci.ResponseOfferSnapshot = (function() { + + /** + * Properties of a ResponseOfferSnapshot. + * @memberof tendermint.abci + * @interface IResponseOfferSnapshot + * @property {tendermint.abci.ResponseOfferSnapshot.Result|null} [result] ResponseOfferSnapshot result + */ + + /** + * Constructs a new ResponseOfferSnapshot. + * @memberof tendermint.abci + * @classdesc Represents a ResponseOfferSnapshot. + * @implements IResponseOfferSnapshot + * @constructor + * @param {tendermint.abci.IResponseOfferSnapshot=} [properties] Properties to set + */ + function ResponseOfferSnapshot(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResponseOfferSnapshot result. + * @member {tendermint.abci.ResponseOfferSnapshot.Result} result + * @memberof tendermint.abci.ResponseOfferSnapshot + * @instance + */ + ResponseOfferSnapshot.prototype.result = 0; + + /** + * Encodes the specified ResponseOfferSnapshot message. Does not implicitly {@link tendermint.abci.ResponseOfferSnapshot.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.ResponseOfferSnapshot + * @static + * @param {tendermint.abci.IResponseOfferSnapshot} message ResponseOfferSnapshot message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseOfferSnapshot.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.result != null && Object.hasOwnProperty.call(message, "result")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.result); + return writer; + }; + + /** + * Encodes the specified ResponseOfferSnapshot message, length delimited. Does not implicitly {@link tendermint.abci.ResponseOfferSnapshot.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.ResponseOfferSnapshot + * @static + * @param {tendermint.abci.IResponseOfferSnapshot} message ResponseOfferSnapshot message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseOfferSnapshot.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResponseOfferSnapshot message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.ResponseOfferSnapshot + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.ResponseOfferSnapshot} ResponseOfferSnapshot + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseOfferSnapshot.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseOfferSnapshot(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.result = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResponseOfferSnapshot message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.ResponseOfferSnapshot + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.ResponseOfferSnapshot} ResponseOfferSnapshot + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseOfferSnapshot.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResponseOfferSnapshot message. + * @function verify + * @memberof tendermint.abci.ResponseOfferSnapshot + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResponseOfferSnapshot.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.result != null && message.hasOwnProperty("result")) + switch (message.result) { + default: + return "result: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + return null; + }; + + /** + * Creates a ResponseOfferSnapshot message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.ResponseOfferSnapshot + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.ResponseOfferSnapshot} ResponseOfferSnapshot + */ + ResponseOfferSnapshot.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.ResponseOfferSnapshot) + return object; + let message = new $root.tendermint.abci.ResponseOfferSnapshot(); + switch (object.result) { + case "UNKNOWN": + case 0: + message.result = 0; + break; + case "ACCEPT": + case 1: + message.result = 1; + break; + case "ABORT": + case 2: + message.result = 2; + break; + case "REJECT": + case 3: + message.result = 3; + break; + case "REJECT_FORMAT": + case 4: + message.result = 4; + break; + case "REJECT_SENDER": + case 5: + message.result = 5; + break; + } + return message; + }; + + /** + * Creates a plain object from a ResponseOfferSnapshot message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.ResponseOfferSnapshot + * @static + * @param {tendermint.abci.ResponseOfferSnapshot} message ResponseOfferSnapshot + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResponseOfferSnapshot.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + object.result = options.enums === String ? "UNKNOWN" : 0; + if (message.result != null && message.hasOwnProperty("result")) + object.result = options.enums === String ? $root.tendermint.abci.ResponseOfferSnapshot.Result[message.result] : message.result; + return object; + }; + + /** + * Converts this ResponseOfferSnapshot to JSON. + * @function toJSON + * @memberof tendermint.abci.ResponseOfferSnapshot + * @instance + * @returns {Object.} JSON object + */ + ResponseOfferSnapshot.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Result enum. + * @name tendermint.abci.ResponseOfferSnapshot.Result + * @enum {number} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} ACCEPT=1 ACCEPT value + * @property {number} ABORT=2 ABORT value + * @property {number} REJECT=3 REJECT value + * @property {number} REJECT_FORMAT=4 REJECT_FORMAT value + * @property {number} REJECT_SENDER=5 REJECT_SENDER value + */ + ResponseOfferSnapshot.Result = (function() { + const valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "ACCEPT"] = 1; + values[valuesById[2] = "ABORT"] = 2; + values[valuesById[3] = "REJECT"] = 3; + values[valuesById[4] = "REJECT_FORMAT"] = 4; + values[valuesById[5] = "REJECT_SENDER"] = 5; + return values; + })(); + + return ResponseOfferSnapshot; + })(); + + abci.ResponseLoadSnapshotChunk = (function() { + + /** + * Properties of a ResponseLoadSnapshotChunk. + * @memberof tendermint.abci + * @interface IResponseLoadSnapshotChunk + * @property {Uint8Array|null} [chunk] ResponseLoadSnapshotChunk chunk + */ + + /** + * Constructs a new ResponseLoadSnapshotChunk. + * @memberof tendermint.abci + * @classdesc Represents a ResponseLoadSnapshotChunk. + * @implements IResponseLoadSnapshotChunk + * @constructor + * @param {tendermint.abci.IResponseLoadSnapshotChunk=} [properties] Properties to set + */ + function ResponseLoadSnapshotChunk(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResponseLoadSnapshotChunk chunk. + * @member {Uint8Array} chunk + * @memberof tendermint.abci.ResponseLoadSnapshotChunk + * @instance + */ + ResponseLoadSnapshotChunk.prototype.chunk = $util.newBuffer([]); + + /** + * Encodes the specified ResponseLoadSnapshotChunk message. Does not implicitly {@link tendermint.abci.ResponseLoadSnapshotChunk.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.ResponseLoadSnapshotChunk + * @static + * @param {tendermint.abci.IResponseLoadSnapshotChunk} message ResponseLoadSnapshotChunk message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseLoadSnapshotChunk.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.chunk != null && Object.hasOwnProperty.call(message, "chunk")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.chunk); + return writer; + }; + + /** + * Encodes the specified ResponseLoadSnapshotChunk message, length delimited. Does not implicitly {@link tendermint.abci.ResponseLoadSnapshotChunk.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.ResponseLoadSnapshotChunk + * @static + * @param {tendermint.abci.IResponseLoadSnapshotChunk} message ResponseLoadSnapshotChunk message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseLoadSnapshotChunk.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResponseLoadSnapshotChunk message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.ResponseLoadSnapshotChunk + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.ResponseLoadSnapshotChunk} ResponseLoadSnapshotChunk + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseLoadSnapshotChunk.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseLoadSnapshotChunk(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.chunk = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResponseLoadSnapshotChunk message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.ResponseLoadSnapshotChunk + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.ResponseLoadSnapshotChunk} ResponseLoadSnapshotChunk + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseLoadSnapshotChunk.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResponseLoadSnapshotChunk message. + * @function verify + * @memberof tendermint.abci.ResponseLoadSnapshotChunk + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResponseLoadSnapshotChunk.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.chunk != null && message.hasOwnProperty("chunk")) + if (!(message.chunk && typeof message.chunk.length === "number" || $util.isString(message.chunk))) + return "chunk: buffer expected"; + return null; + }; + + /** + * Creates a ResponseLoadSnapshotChunk message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.ResponseLoadSnapshotChunk + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.ResponseLoadSnapshotChunk} ResponseLoadSnapshotChunk + */ + ResponseLoadSnapshotChunk.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.ResponseLoadSnapshotChunk) + return object; + let message = new $root.tendermint.abci.ResponseLoadSnapshotChunk(); + if (object.chunk != null) + if (typeof object.chunk === "string") + $util.base64.decode(object.chunk, message.chunk = $util.newBuffer($util.base64.length(object.chunk)), 0); + else if (object.chunk.length) + message.chunk = object.chunk; + return message; + }; + + /** + * Creates a plain object from a ResponseLoadSnapshotChunk message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.ResponseLoadSnapshotChunk + * @static + * @param {tendermint.abci.ResponseLoadSnapshotChunk} message ResponseLoadSnapshotChunk + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResponseLoadSnapshotChunk.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + if (options.bytes === String) + object.chunk = ""; + else { + object.chunk = []; + if (options.bytes !== Array) + object.chunk = $util.newBuffer(object.chunk); + } + if (message.chunk != null && message.hasOwnProperty("chunk")) + object.chunk = options.bytes === String ? $util.base64.encode(message.chunk, 0, message.chunk.length) : options.bytes === Array ? Array.prototype.slice.call(message.chunk) : message.chunk; + return object; + }; + + /** + * Converts this ResponseLoadSnapshotChunk to JSON. + * @function toJSON + * @memberof tendermint.abci.ResponseLoadSnapshotChunk + * @instance + * @returns {Object.} JSON object + */ + ResponseLoadSnapshotChunk.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ResponseLoadSnapshotChunk; + })(); + + abci.ResponseApplySnapshotChunk = (function() { + + /** + * Properties of a ResponseApplySnapshotChunk. + * @memberof tendermint.abci + * @interface IResponseApplySnapshotChunk + * @property {tendermint.abci.ResponseApplySnapshotChunk.Result|null} [result] ResponseApplySnapshotChunk result + * @property {Array.|null} [refetch_chunks] ResponseApplySnapshotChunk refetch_chunks + * @property {Array.|null} [reject_senders] ResponseApplySnapshotChunk reject_senders + */ + + /** + * Constructs a new ResponseApplySnapshotChunk. + * @memberof tendermint.abci + * @classdesc Represents a ResponseApplySnapshotChunk. + * @implements IResponseApplySnapshotChunk + * @constructor + * @param {tendermint.abci.IResponseApplySnapshotChunk=} [properties] Properties to set + */ + function ResponseApplySnapshotChunk(properties) { + this.refetch_chunks = []; + this.reject_senders = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResponseApplySnapshotChunk result. + * @member {tendermint.abci.ResponseApplySnapshotChunk.Result} result + * @memberof tendermint.abci.ResponseApplySnapshotChunk + * @instance + */ + ResponseApplySnapshotChunk.prototype.result = 0; + + /** + * ResponseApplySnapshotChunk refetch_chunks. + * @member {Array.} refetch_chunks + * @memberof tendermint.abci.ResponseApplySnapshotChunk + * @instance + */ + ResponseApplySnapshotChunk.prototype.refetch_chunks = $util.emptyArray; + + /** + * ResponseApplySnapshotChunk reject_senders. + * @member {Array.} reject_senders + * @memberof tendermint.abci.ResponseApplySnapshotChunk + * @instance + */ + ResponseApplySnapshotChunk.prototype.reject_senders = $util.emptyArray; + + /** + * Encodes the specified ResponseApplySnapshotChunk message. Does not implicitly {@link tendermint.abci.ResponseApplySnapshotChunk.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.ResponseApplySnapshotChunk + * @static + * @param {tendermint.abci.IResponseApplySnapshotChunk} message ResponseApplySnapshotChunk message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseApplySnapshotChunk.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.result != null && Object.hasOwnProperty.call(message, "result")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.result); + if (message.refetch_chunks != null && message.refetch_chunks.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (let i = 0; i < message.refetch_chunks.length; ++i) + writer.uint32(message.refetch_chunks[i]); + writer.ldelim(); + } + if (message.reject_senders != null && message.reject_senders.length) + for (let i = 0; i < message.reject_senders.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.reject_senders[i]); + return writer; + }; + + /** + * Encodes the specified ResponseApplySnapshotChunk message, length delimited. Does not implicitly {@link tendermint.abci.ResponseApplySnapshotChunk.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.ResponseApplySnapshotChunk + * @static + * @param {tendermint.abci.IResponseApplySnapshotChunk} message ResponseApplySnapshotChunk message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseApplySnapshotChunk.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResponseApplySnapshotChunk message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.ResponseApplySnapshotChunk + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.ResponseApplySnapshotChunk} ResponseApplySnapshotChunk + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseApplySnapshotChunk.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseApplySnapshotChunk(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.result = reader.int32(); + break; + case 2: + if (!(message.refetch_chunks && message.refetch_chunks.length)) + message.refetch_chunks = []; + if ((tag & 7) === 2) { + let end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.refetch_chunks.push(reader.uint32()); + } else + message.refetch_chunks.push(reader.uint32()); + break; + case 3: + if (!(message.reject_senders && message.reject_senders.length)) + message.reject_senders = []; + message.reject_senders.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResponseApplySnapshotChunk message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.ResponseApplySnapshotChunk + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.ResponseApplySnapshotChunk} ResponseApplySnapshotChunk + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseApplySnapshotChunk.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResponseApplySnapshotChunk message. + * @function verify + * @memberof tendermint.abci.ResponseApplySnapshotChunk + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResponseApplySnapshotChunk.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.result != null && message.hasOwnProperty("result")) + switch (message.result) { + default: + return "result: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.refetch_chunks != null && message.hasOwnProperty("refetch_chunks")) { + if (!Array.isArray(message.refetch_chunks)) + return "refetch_chunks: array expected"; + for (let i = 0; i < message.refetch_chunks.length; ++i) + if (!$util.isInteger(message.refetch_chunks[i])) + return "refetch_chunks: integer[] expected"; + } + if (message.reject_senders != null && message.hasOwnProperty("reject_senders")) { + if (!Array.isArray(message.reject_senders)) + return "reject_senders: array expected"; + for (let i = 0; i < message.reject_senders.length; ++i) + if (!$util.isString(message.reject_senders[i])) + return "reject_senders: string[] expected"; + } + return null; + }; + + /** + * Creates a ResponseApplySnapshotChunk message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.ResponseApplySnapshotChunk + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.ResponseApplySnapshotChunk} ResponseApplySnapshotChunk + */ + ResponseApplySnapshotChunk.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.ResponseApplySnapshotChunk) + return object; + let message = new $root.tendermint.abci.ResponseApplySnapshotChunk(); + switch (object.result) { + case "UNKNOWN": + case 0: + message.result = 0; + break; + case "ACCEPT": + case 1: + message.result = 1; + break; + case "ABORT": + case 2: + message.result = 2; + break; + case "RETRY": + case 3: + message.result = 3; + break; + case "RETRY_SNAPSHOT": + case 4: + message.result = 4; + break; + case "REJECT_SNAPSHOT": + case 5: + message.result = 5; + break; + } + if (object.refetch_chunks) { + if (!Array.isArray(object.refetch_chunks)) + throw TypeError(".tendermint.abci.ResponseApplySnapshotChunk.refetch_chunks: array expected"); + message.refetch_chunks = []; + for (let i = 0; i < object.refetch_chunks.length; ++i) + message.refetch_chunks[i] = object.refetch_chunks[i] >>> 0; + } + if (object.reject_senders) { + if (!Array.isArray(object.reject_senders)) + throw TypeError(".tendermint.abci.ResponseApplySnapshotChunk.reject_senders: array expected"); + message.reject_senders = []; + for (let i = 0; i < object.reject_senders.length; ++i) + message.reject_senders[i] = String(object.reject_senders[i]); + } + return message; + }; + + /** + * Creates a plain object from a ResponseApplySnapshotChunk message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.ResponseApplySnapshotChunk + * @static + * @param {tendermint.abci.ResponseApplySnapshotChunk} message ResponseApplySnapshotChunk + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResponseApplySnapshotChunk.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) { + object.refetch_chunks = []; + object.reject_senders = []; + } + if (options.defaults) + object.result = options.enums === String ? "UNKNOWN" : 0; + if (message.result != null && message.hasOwnProperty("result")) + object.result = options.enums === String ? $root.tendermint.abci.ResponseApplySnapshotChunk.Result[message.result] : message.result; + if (message.refetch_chunks && message.refetch_chunks.length) { + object.refetch_chunks = []; + for (let j = 0; j < message.refetch_chunks.length; ++j) + object.refetch_chunks[j] = message.refetch_chunks[j]; + } + if (message.reject_senders && message.reject_senders.length) { + object.reject_senders = []; + for (let j = 0; j < message.reject_senders.length; ++j) + object.reject_senders[j] = message.reject_senders[j]; + } + return object; + }; + + /** + * Converts this ResponseApplySnapshotChunk to JSON. + * @function toJSON + * @memberof tendermint.abci.ResponseApplySnapshotChunk + * @instance + * @returns {Object.} JSON object + */ + ResponseApplySnapshotChunk.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Result enum. + * @name tendermint.abci.ResponseApplySnapshotChunk.Result + * @enum {number} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} ACCEPT=1 ACCEPT value + * @property {number} ABORT=2 ABORT value + * @property {number} RETRY=3 RETRY value + * @property {number} RETRY_SNAPSHOT=4 RETRY_SNAPSHOT value + * @property {number} REJECT_SNAPSHOT=5 REJECT_SNAPSHOT value + */ + ResponseApplySnapshotChunk.Result = (function() { + const valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "ACCEPT"] = 1; + values[valuesById[2] = "ABORT"] = 2; + values[valuesById[3] = "RETRY"] = 3; + values[valuesById[4] = "RETRY_SNAPSHOT"] = 4; + values[valuesById[5] = "REJECT_SNAPSHOT"] = 5; + return values; + })(); + + return ResponseApplySnapshotChunk; + })(); + + abci.ConsensusParams = (function() { + + /** + * Properties of a ConsensusParams. + * @memberof tendermint.abci + * @interface IConsensusParams + * @property {tendermint.abci.IBlockParams|null} [block] ConsensusParams block + * @property {tendermint.types.IEvidenceParams|null} [evidence] ConsensusParams evidence + * @property {tendermint.types.IValidatorParams|null} [validator] ConsensusParams validator + * @property {tendermint.types.IVersionParams|null} [version] ConsensusParams version + */ + + /** + * Constructs a new ConsensusParams. + * @memberof tendermint.abci + * @classdesc Represents a ConsensusParams. + * @implements IConsensusParams + * @constructor + * @param {tendermint.abci.IConsensusParams=} [properties] Properties to set + */ + function ConsensusParams(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConsensusParams block. + * @member {tendermint.abci.IBlockParams|null|undefined} block + * @memberof tendermint.abci.ConsensusParams + * @instance + */ + ConsensusParams.prototype.block = null; + + /** + * ConsensusParams evidence. + * @member {tendermint.types.IEvidenceParams|null|undefined} evidence + * @memberof tendermint.abci.ConsensusParams + * @instance + */ + ConsensusParams.prototype.evidence = null; + + /** + * ConsensusParams validator. + * @member {tendermint.types.IValidatorParams|null|undefined} validator + * @memberof tendermint.abci.ConsensusParams + * @instance + */ + ConsensusParams.prototype.validator = null; + + /** + * ConsensusParams version. + * @member {tendermint.types.IVersionParams|null|undefined} version + * @memberof tendermint.abci.ConsensusParams + * @instance + */ + ConsensusParams.prototype.version = null; + + /** + * Encodes the specified ConsensusParams message. Does not implicitly {@link tendermint.abci.ConsensusParams.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.ConsensusParams + * @static + * @param {tendermint.abci.IConsensusParams} message ConsensusParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConsensusParams.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.block != null && Object.hasOwnProperty.call(message, "block")) + $root.tendermint.abci.BlockParams.encode(message.block, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.evidence != null && Object.hasOwnProperty.call(message, "evidence")) + $root.tendermint.types.EvidenceParams.encode(message.evidence, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.validator != null && Object.hasOwnProperty.call(message, "validator")) + $root.tendermint.types.ValidatorParams.encode(message.validator, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + $root.tendermint.types.VersionParams.encode(message.version, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ConsensusParams message, length delimited. Does not implicitly {@link tendermint.abci.ConsensusParams.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.ConsensusParams + * @static + * @param {tendermint.abci.IConsensusParams} message ConsensusParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConsensusParams.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConsensusParams message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.ConsensusParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.ConsensusParams} ConsensusParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConsensusParams.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ConsensusParams(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.block = $root.tendermint.abci.BlockParams.decode(reader, reader.uint32()); + break; + case 2: + message.evidence = $root.tendermint.types.EvidenceParams.decode(reader, reader.uint32()); + break; + case 3: + message.validator = $root.tendermint.types.ValidatorParams.decode(reader, reader.uint32()); + break; + case 4: + message.version = $root.tendermint.types.VersionParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConsensusParams message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.ConsensusParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.ConsensusParams} ConsensusParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConsensusParams.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConsensusParams message. + * @function verify + * @memberof tendermint.abci.ConsensusParams + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConsensusParams.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.block != null && message.hasOwnProperty("block")) { + let error = $root.tendermint.abci.BlockParams.verify(message.block); + if (error) + return "block." + error; + } + if (message.evidence != null && message.hasOwnProperty("evidence")) { + let error = $root.tendermint.types.EvidenceParams.verify(message.evidence); + if (error) + return "evidence." + error; + } + if (message.validator != null && message.hasOwnProperty("validator")) { + let error = $root.tendermint.types.ValidatorParams.verify(message.validator); + if (error) + return "validator." + error; + } + if (message.version != null && message.hasOwnProperty("version")) { + let error = $root.tendermint.types.VersionParams.verify(message.version); + if (error) + return "version." + error; + } + return null; + }; + + /** + * Creates a ConsensusParams message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.ConsensusParams + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.ConsensusParams} ConsensusParams + */ + ConsensusParams.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.ConsensusParams) + return object; + let message = new $root.tendermint.abci.ConsensusParams(); + if (object.block != null) { + if (typeof object.block !== "object") + throw TypeError(".tendermint.abci.ConsensusParams.block: object expected"); + message.block = $root.tendermint.abci.BlockParams.fromObject(object.block); + } + if (object.evidence != null) { + if (typeof object.evidence !== "object") + throw TypeError(".tendermint.abci.ConsensusParams.evidence: object expected"); + message.evidence = $root.tendermint.types.EvidenceParams.fromObject(object.evidence); + } + if (object.validator != null) { + if (typeof object.validator !== "object") + throw TypeError(".tendermint.abci.ConsensusParams.validator: object expected"); + message.validator = $root.tendermint.types.ValidatorParams.fromObject(object.validator); + } + if (object.version != null) { + if (typeof object.version !== "object") + throw TypeError(".tendermint.abci.ConsensusParams.version: object expected"); + message.version = $root.tendermint.types.VersionParams.fromObject(object.version); + } + return message; + }; + + /** + * Creates a plain object from a ConsensusParams message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.ConsensusParams + * @static + * @param {tendermint.abci.ConsensusParams} message ConsensusParams + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConsensusParams.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.block = null; + object.evidence = null; + object.validator = null; + object.version = null; + } + if (message.block != null && message.hasOwnProperty("block")) + object.block = $root.tendermint.abci.BlockParams.toObject(message.block, options); + if (message.evidence != null && message.hasOwnProperty("evidence")) + object.evidence = $root.tendermint.types.EvidenceParams.toObject(message.evidence, options); + if (message.validator != null && message.hasOwnProperty("validator")) + object.validator = $root.tendermint.types.ValidatorParams.toObject(message.validator, options); + if (message.version != null && message.hasOwnProperty("version")) + object.version = $root.tendermint.types.VersionParams.toObject(message.version, options); + return object; + }; + + /** + * Converts this ConsensusParams to JSON. + * @function toJSON + * @memberof tendermint.abci.ConsensusParams + * @instance + * @returns {Object.} JSON object + */ + ConsensusParams.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ConsensusParams; + })(); + + abci.BlockParams = (function() { + + /** + * Properties of a BlockParams. + * @memberof tendermint.abci + * @interface IBlockParams + * @property {Long|null} [max_bytes] BlockParams max_bytes + * @property {Long|null} [max_gas] BlockParams max_gas + */ + + /** + * Constructs a new BlockParams. + * @memberof tendermint.abci + * @classdesc Represents a BlockParams. + * @implements IBlockParams + * @constructor + * @param {tendermint.abci.IBlockParams=} [properties] Properties to set + */ + function BlockParams(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BlockParams max_bytes. + * @member {Long} max_bytes + * @memberof tendermint.abci.BlockParams + * @instance + */ + BlockParams.prototype.max_bytes = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BlockParams max_gas. + * @member {Long} max_gas + * @memberof tendermint.abci.BlockParams + * @instance + */ + BlockParams.prototype.max_gas = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Encodes the specified BlockParams message. Does not implicitly {@link tendermint.abci.BlockParams.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.BlockParams + * @static + * @param {tendermint.abci.IBlockParams} message BlockParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BlockParams.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.max_bytes != null && Object.hasOwnProperty.call(message, "max_bytes")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.max_bytes); + if (message.max_gas != null && Object.hasOwnProperty.call(message, "max_gas")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.max_gas); + return writer; + }; + + /** + * Encodes the specified BlockParams message, length delimited. Does not implicitly {@link tendermint.abci.BlockParams.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.BlockParams + * @static + * @param {tendermint.abci.IBlockParams} message BlockParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BlockParams.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BlockParams message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.BlockParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.BlockParams} BlockParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BlockParams.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.BlockParams(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.max_bytes = reader.int64(); + break; + case 2: + message.max_gas = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BlockParams message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.BlockParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.BlockParams} BlockParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BlockParams.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BlockParams message. + * @function verify + * @memberof tendermint.abci.BlockParams + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BlockParams.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.max_bytes != null && message.hasOwnProperty("max_bytes")) + if (!$util.isInteger(message.max_bytes) && !(message.max_bytes && $util.isInteger(message.max_bytes.low) && $util.isInteger(message.max_bytes.high))) + return "max_bytes: integer|Long expected"; + if (message.max_gas != null && message.hasOwnProperty("max_gas")) + if (!$util.isInteger(message.max_gas) && !(message.max_gas && $util.isInteger(message.max_gas.low) && $util.isInteger(message.max_gas.high))) + return "max_gas: integer|Long expected"; + return null; + }; + + /** + * Creates a BlockParams message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.BlockParams + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.BlockParams} BlockParams + */ + BlockParams.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.BlockParams) + return object; + let message = new $root.tendermint.abci.BlockParams(); + if (object.max_bytes != null) + if ($util.Long) + (message.max_bytes = $util.Long.fromValue(object.max_bytes)).unsigned = false; + else if (typeof object.max_bytes === "string") + message.max_bytes = parseInt(object.max_bytes, 10); + else if (typeof object.max_bytes === "number") + message.max_bytes = object.max_bytes; + else if (typeof object.max_bytes === "object") + message.max_bytes = new $util.LongBits(object.max_bytes.low >>> 0, object.max_bytes.high >>> 0).toNumber(); + if (object.max_gas != null) + if ($util.Long) + (message.max_gas = $util.Long.fromValue(object.max_gas)).unsigned = false; + else if (typeof object.max_gas === "string") + message.max_gas = parseInt(object.max_gas, 10); + else if (typeof object.max_gas === "number") + message.max_gas = object.max_gas; + else if (typeof object.max_gas === "object") + message.max_gas = new $util.LongBits(object.max_gas.low >>> 0, object.max_gas.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a BlockParams message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.BlockParams + * @static + * @param {tendermint.abci.BlockParams} message BlockParams + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BlockParams.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.max_bytes = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.max_bytes = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.max_gas = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.max_gas = options.longs === String ? "0" : 0; + } + if (message.max_bytes != null && message.hasOwnProperty("max_bytes")) + if (typeof message.max_bytes === "number") + object.max_bytes = options.longs === String ? String(message.max_bytes) : message.max_bytes; + else + object.max_bytes = options.longs === String ? $util.Long.prototype.toString.call(message.max_bytes) : options.longs === Number ? new $util.LongBits(message.max_bytes.low >>> 0, message.max_bytes.high >>> 0).toNumber() : message.max_bytes; + if (message.max_gas != null && message.hasOwnProperty("max_gas")) + if (typeof message.max_gas === "number") + object.max_gas = options.longs === String ? String(message.max_gas) : message.max_gas; + else + object.max_gas = options.longs === String ? $util.Long.prototype.toString.call(message.max_gas) : options.longs === Number ? new $util.LongBits(message.max_gas.low >>> 0, message.max_gas.high >>> 0).toNumber() : message.max_gas; + return object; + }; + + /** + * Converts this BlockParams to JSON. + * @function toJSON + * @memberof tendermint.abci.BlockParams + * @instance + * @returns {Object.} JSON object + */ + BlockParams.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BlockParams; + })(); + + abci.LastCommitInfo = (function() { + + /** + * Properties of a LastCommitInfo. + * @memberof tendermint.abci + * @interface ILastCommitInfo + * @property {number|null} [round] LastCommitInfo round + * @property {Array.|null} [votes] LastCommitInfo votes + */ + + /** + * Constructs a new LastCommitInfo. + * @memberof tendermint.abci + * @classdesc Represents a LastCommitInfo. + * @implements ILastCommitInfo + * @constructor + * @param {tendermint.abci.ILastCommitInfo=} [properties] Properties to set + */ + function LastCommitInfo(properties) { + this.votes = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LastCommitInfo round. + * @member {number} round + * @memberof tendermint.abci.LastCommitInfo + * @instance + */ + LastCommitInfo.prototype.round = 0; + + /** + * LastCommitInfo votes. + * @member {Array.} votes + * @memberof tendermint.abci.LastCommitInfo + * @instance + */ + LastCommitInfo.prototype.votes = $util.emptyArray; + + /** + * Encodes the specified LastCommitInfo message. Does not implicitly {@link tendermint.abci.LastCommitInfo.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.LastCommitInfo + * @static + * @param {tendermint.abci.ILastCommitInfo} message LastCommitInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LastCommitInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.round != null && Object.hasOwnProperty.call(message, "round")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.round); + if (message.votes != null && message.votes.length) + for (let i = 0; i < message.votes.length; ++i) + $root.tendermint.abci.VoteInfo.encode(message.votes[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified LastCommitInfo message, length delimited. Does not implicitly {@link tendermint.abci.LastCommitInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.LastCommitInfo + * @static + * @param {tendermint.abci.ILastCommitInfo} message LastCommitInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LastCommitInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LastCommitInfo message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.LastCommitInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.LastCommitInfo} LastCommitInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LastCommitInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.LastCommitInfo(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.round = reader.int32(); + break; + case 2: + if (!(message.votes && message.votes.length)) + message.votes = []; + message.votes.push($root.tendermint.abci.VoteInfo.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LastCommitInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.LastCommitInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.LastCommitInfo} LastCommitInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LastCommitInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LastCommitInfo message. + * @function verify + * @memberof tendermint.abci.LastCommitInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LastCommitInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.round != null && message.hasOwnProperty("round")) + if (!$util.isInteger(message.round)) + return "round: integer expected"; + if (message.votes != null && message.hasOwnProperty("votes")) { + if (!Array.isArray(message.votes)) + return "votes: array expected"; + for (let i = 0; i < message.votes.length; ++i) { + let error = $root.tendermint.abci.VoteInfo.verify(message.votes[i]); + if (error) + return "votes." + error; + } + } + return null; + }; + + /** + * Creates a LastCommitInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.LastCommitInfo + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.LastCommitInfo} LastCommitInfo + */ + LastCommitInfo.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.LastCommitInfo) + return object; + let message = new $root.tendermint.abci.LastCommitInfo(); + if (object.round != null) + message.round = object.round | 0; + if (object.votes) { + if (!Array.isArray(object.votes)) + throw TypeError(".tendermint.abci.LastCommitInfo.votes: array expected"); + message.votes = []; + for (let i = 0; i < object.votes.length; ++i) { + if (typeof object.votes[i] !== "object") + throw TypeError(".tendermint.abci.LastCommitInfo.votes: object expected"); + message.votes[i] = $root.tendermint.abci.VoteInfo.fromObject(object.votes[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a LastCommitInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.LastCommitInfo + * @static + * @param {tendermint.abci.LastCommitInfo} message LastCommitInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LastCommitInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.votes = []; + if (options.defaults) + object.round = 0; + if (message.round != null && message.hasOwnProperty("round")) + object.round = message.round; + if (message.votes && message.votes.length) { + object.votes = []; + for (let j = 0; j < message.votes.length; ++j) + object.votes[j] = $root.tendermint.abci.VoteInfo.toObject(message.votes[j], options); + } + return object; + }; + + /** + * Converts this LastCommitInfo to JSON. + * @function toJSON + * @memberof tendermint.abci.LastCommitInfo + * @instance + * @returns {Object.} JSON object + */ + LastCommitInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return LastCommitInfo; + })(); + + abci.Event = (function() { + + /** + * Properties of an Event. + * @memberof tendermint.abci + * @interface IEvent + * @property {string|null} [type] Event type + * @property {Array.|null} [attributes] Event attributes + */ + + /** + * Constructs a new Event. + * @memberof tendermint.abci + * @classdesc Represents an Event. + * @implements IEvent + * @constructor + * @param {tendermint.abci.IEvent=} [properties] Properties to set + */ + function Event(properties) { + this.attributes = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Event type. + * @member {string} type + * @memberof tendermint.abci.Event + * @instance + */ + Event.prototype.type = ""; + + /** + * Event attributes. + * @member {Array.} attributes + * @memberof tendermint.abci.Event + * @instance + */ + Event.prototype.attributes = $util.emptyArray; + + /** + * Encodes the specified Event message. Does not implicitly {@link tendermint.abci.Event.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.Event + * @static + * @param {tendermint.abci.IEvent} message Event message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Event.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.attributes != null && message.attributes.length) + for (let i = 0; i < message.attributes.length; ++i) + $root.tendermint.abci.EventAttribute.encode(message.attributes[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Event message, length delimited. Does not implicitly {@link tendermint.abci.Event.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.Event + * @static + * @param {tendermint.abci.IEvent} message Event message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Event.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Event message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.Event + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.Event} Event + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Event.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.Event(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.string(); + break; + case 2: + if (!(message.attributes && message.attributes.length)) + message.attributes = []; + message.attributes.push($root.tendermint.abci.EventAttribute.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Event message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.Event + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.Event} Event + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Event.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Event message. + * @function verify + * @memberof tendermint.abci.Event + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Event.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.attributes != null && message.hasOwnProperty("attributes")) { + if (!Array.isArray(message.attributes)) + return "attributes: array expected"; + for (let i = 0; i < message.attributes.length; ++i) { + let error = $root.tendermint.abci.EventAttribute.verify(message.attributes[i]); + if (error) + return "attributes." + error; + } + } + return null; + }; + + /** + * Creates an Event message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.Event + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.Event} Event + */ + Event.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.Event) + return object; + let message = new $root.tendermint.abci.Event(); + if (object.type != null) + message.type = String(object.type); + if (object.attributes) { + if (!Array.isArray(object.attributes)) + throw TypeError(".tendermint.abci.Event.attributes: array expected"); + message.attributes = []; + for (let i = 0; i < object.attributes.length; ++i) { + if (typeof object.attributes[i] !== "object") + throw TypeError(".tendermint.abci.Event.attributes: object expected"); + message.attributes[i] = $root.tendermint.abci.EventAttribute.fromObject(object.attributes[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an Event message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.Event + * @static + * @param {tendermint.abci.Event} message Event + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Event.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.attributes = []; + if (options.defaults) + object.type = ""; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.attributes && message.attributes.length) { + object.attributes = []; + for (let j = 0; j < message.attributes.length; ++j) + object.attributes[j] = $root.tendermint.abci.EventAttribute.toObject(message.attributes[j], options); + } + return object; + }; + + /** + * Converts this Event to JSON. + * @function toJSON + * @memberof tendermint.abci.Event + * @instance + * @returns {Object.} JSON object + */ + Event.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Event; + })(); + + abci.EventAttribute = (function() { + + /** + * Properties of an EventAttribute. + * @memberof tendermint.abci + * @interface IEventAttribute + * @property {Uint8Array|null} [key] EventAttribute key + * @property {Uint8Array|null} [value] EventAttribute value + * @property {boolean|null} [index] EventAttribute index + */ + + /** + * Constructs a new EventAttribute. + * @memberof tendermint.abci + * @classdesc Represents an EventAttribute. + * @implements IEventAttribute + * @constructor + * @param {tendermint.abci.IEventAttribute=} [properties] Properties to set + */ + function EventAttribute(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EventAttribute key. + * @member {Uint8Array} key + * @memberof tendermint.abci.EventAttribute + * @instance + */ + EventAttribute.prototype.key = $util.newBuffer([]); + + /** + * EventAttribute value. + * @member {Uint8Array} value + * @memberof tendermint.abci.EventAttribute + * @instance + */ + EventAttribute.prototype.value = $util.newBuffer([]); + + /** + * EventAttribute index. + * @member {boolean} index + * @memberof tendermint.abci.EventAttribute + * @instance + */ + EventAttribute.prototype.index = false; + + /** + * Encodes the specified EventAttribute message. Does not implicitly {@link tendermint.abci.EventAttribute.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.EventAttribute + * @static + * @param {tendermint.abci.IEventAttribute} message EventAttribute message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EventAttribute.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value); + if (message.index != null && Object.hasOwnProperty.call(message, "index")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.index); + return writer; + }; + + /** + * Encodes the specified EventAttribute message, length delimited. Does not implicitly {@link tendermint.abci.EventAttribute.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.EventAttribute + * @static + * @param {tendermint.abci.IEventAttribute} message EventAttribute message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EventAttribute.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EventAttribute message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.EventAttribute + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.EventAttribute} EventAttribute + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EventAttribute.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.EventAttribute(); + while (reader.pos < end) { + let 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; + }; + + /** + * Decodes an EventAttribute message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.EventAttribute + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.EventAttribute} EventAttribute + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EventAttribute.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EventAttribute message. + * @function verify + * @memberof tendermint.abci.EventAttribute + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EventAttribute.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) + return "key: buffer expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) + return "value: buffer expected"; + if (message.index != null && message.hasOwnProperty("index")) + if (typeof message.index !== "boolean") + return "index: boolean expected"; + return null; + }; + + /** + * Creates an EventAttribute message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.EventAttribute + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.EventAttribute} EventAttribute + */ + EventAttribute.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.EventAttribute) + return object; + let message = new $root.tendermint.abci.EventAttribute(); + if (object.key != null) + if (typeof object.key === "string") + $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); + else if (object.key.length) + message.key = object.key; + if (object.value != null) + if (typeof object.value === "string") + $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); + else if (object.value.length) + message.value = object.value; + if (object.index != null) + message.index = Boolean(object.index); + return message; + }; + + /** + * Creates a plain object from an EventAttribute message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.EventAttribute + * @static + * @param {tendermint.abci.EventAttribute} message EventAttribute + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EventAttribute.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if (options.bytes === String) + object.key = ""; + else { + object.key = []; + if (options.bytes !== Array) + object.key = $util.newBuffer(object.key); + } + if (options.bytes === String) + object.value = ""; + else { + object.value = []; + if (options.bytes !== Array) + object.value = $util.newBuffer(object.value); + } + object.index = false; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; + if (message.index != null && message.hasOwnProperty("index")) + object.index = message.index; + return object; + }; + + /** + * Converts this EventAttribute to JSON. + * @function toJSON + * @memberof tendermint.abci.EventAttribute + * @instance + * @returns {Object.} JSON object + */ + EventAttribute.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EventAttribute; + })(); + + abci.TxResult = (function() { + + /** + * Properties of a TxResult. + * @memberof tendermint.abci + * @interface ITxResult + * @property {Long|null} [height] TxResult height + * @property {number|null} [index] TxResult index + * @property {Uint8Array|null} [tx] TxResult tx + * @property {tendermint.abci.IResponseDeliverTx|null} [result] TxResult result + */ + + /** + * Constructs a new TxResult. + * @memberof tendermint.abci + * @classdesc Represents a TxResult. + * @implements ITxResult + * @constructor + * @param {tendermint.abci.ITxResult=} [properties] Properties to set + */ + function TxResult(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TxResult height. + * @member {Long} height + * @memberof tendermint.abci.TxResult + * @instance + */ + TxResult.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * TxResult index. + * @member {number} index + * @memberof tendermint.abci.TxResult + * @instance + */ + TxResult.prototype.index = 0; + + /** + * TxResult tx. + * @member {Uint8Array} tx + * @memberof tendermint.abci.TxResult + * @instance + */ + TxResult.prototype.tx = $util.newBuffer([]); + + /** + * TxResult result. + * @member {tendermint.abci.IResponseDeliverTx|null|undefined} result + * @memberof tendermint.abci.TxResult + * @instance + */ + TxResult.prototype.result = null; + + /** + * Encodes the specified TxResult message. Does not implicitly {@link tendermint.abci.TxResult.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.TxResult + * @static + * @param {tendermint.abci.ITxResult} message TxResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TxResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.height); + if (message.index != null && Object.hasOwnProperty.call(message, "index")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.index); + if (message.tx != null && Object.hasOwnProperty.call(message, "tx")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.tx); + if (message.result != null && Object.hasOwnProperty.call(message, "result")) + $root.tendermint.abci.ResponseDeliverTx.encode(message.result, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TxResult message, length delimited. Does not implicitly {@link tendermint.abci.TxResult.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.TxResult + * @static + * @param {tendermint.abci.ITxResult} message TxResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TxResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TxResult message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.TxResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.TxResult} TxResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TxResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.TxResult(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + case 2: + message.index = reader.uint32(); + break; + case 3: + message.tx = reader.bytes(); + break; + case 4: + message.result = $root.tendermint.abci.ResponseDeliverTx.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TxResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.TxResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.TxResult} TxResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TxResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TxResult message. + * @function verify + * @memberof tendermint.abci.TxResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TxResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) + return "height: integer|Long expected"; + if (message.index != null && message.hasOwnProperty("index")) + if (!$util.isInteger(message.index)) + return "index: integer expected"; + if (message.tx != null && message.hasOwnProperty("tx")) + if (!(message.tx && typeof message.tx.length === "number" || $util.isString(message.tx))) + return "tx: buffer expected"; + if (message.result != null && message.hasOwnProperty("result")) { + let error = $root.tendermint.abci.ResponseDeliverTx.verify(message.result); + if (error) + return "result." + error; + } + return null; + }; + + /** + * Creates a TxResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.TxResult + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.TxResult} TxResult + */ + TxResult.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.TxResult) + return object; + let message = new $root.tendermint.abci.TxResult(); + if (object.height != null) + if ($util.Long) + (message.height = $util.Long.fromValue(object.height)).unsigned = false; + else if (typeof object.height === "string") + message.height = parseInt(object.height, 10); + else if (typeof object.height === "number") + message.height = object.height; + else if (typeof object.height === "object") + message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); + if (object.index != null) + message.index = object.index >>> 0; + if (object.tx != null) + if (typeof object.tx === "string") + $util.base64.decode(object.tx, message.tx = $util.newBuffer($util.base64.length(object.tx)), 0); + else if (object.tx.length) + message.tx = object.tx; + if (object.result != null) { + if (typeof object.result !== "object") + throw TypeError(".tendermint.abci.TxResult.result: object expected"); + message.result = $root.tendermint.abci.ResponseDeliverTx.fromObject(object.result); + } + return message; + }; + + /** + * Creates a plain object from a TxResult message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.TxResult + * @static + * @param {tendermint.abci.TxResult} message TxResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TxResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.height = options.longs === String ? "0" : 0; + object.index = 0; + if (options.bytes === String) + object.tx = ""; + else { + object.tx = []; + if (options.bytes !== Array) + object.tx = $util.newBuffer(object.tx); + } + object.result = null; + } + if (message.height != null && message.hasOwnProperty("height")) + if (typeof message.height === "number") + object.height = options.longs === String ? String(message.height) : message.height; + else + object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; + if (message.index != null && message.hasOwnProperty("index")) + object.index = message.index; + if (message.tx != null && message.hasOwnProperty("tx")) + object.tx = options.bytes === String ? $util.base64.encode(message.tx, 0, message.tx.length) : options.bytes === Array ? Array.prototype.slice.call(message.tx) : message.tx; + if (message.result != null && message.hasOwnProperty("result")) + object.result = $root.tendermint.abci.ResponseDeliverTx.toObject(message.result, options); + return object; + }; + + /** + * Converts this TxResult to JSON. + * @function toJSON + * @memberof tendermint.abci.TxResult + * @instance + * @returns {Object.} JSON object + */ + TxResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TxResult; + })(); + + abci.Validator = (function() { + + /** + * Properties of a Validator. + * @memberof tendermint.abci + * @interface IValidator + * @property {Uint8Array|null} [address] Validator address + * @property {Long|null} [power] Validator power + */ + + /** + * Constructs a new Validator. + * @memberof tendermint.abci + * @classdesc Represents a Validator. + * @implements IValidator + * @constructor + * @param {tendermint.abci.IValidator=} [properties] Properties to set + */ + function Validator(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Validator address. + * @member {Uint8Array} address + * @memberof tendermint.abci.Validator + * @instance + */ + Validator.prototype.address = $util.newBuffer([]); + + /** + * Validator power. + * @member {Long} power + * @memberof tendermint.abci.Validator + * @instance + */ + Validator.prototype.power = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Encodes the specified Validator message. Does not implicitly {@link tendermint.abci.Validator.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.Validator + * @static + * @param {tendermint.abci.IValidator} message Validator message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Validator.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.address != null && Object.hasOwnProperty.call(message, "address")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.address); + if (message.power != null && Object.hasOwnProperty.call(message, "power")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.power); + return writer; + }; + + /** + * Encodes the specified Validator message, length delimited. Does not implicitly {@link tendermint.abci.Validator.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.Validator + * @static + * @param {tendermint.abci.IValidator} message Validator message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Validator.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Validator message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.Validator + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.Validator} Validator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Validator.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.Validator(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.bytes(); + break; + case 3: + message.power = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Validator message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.Validator + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.Validator} Validator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Validator.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Validator message. + * @function verify + * @memberof tendermint.abci.Validator + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Validator.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.address != null && message.hasOwnProperty("address")) + if (!(message.address && typeof message.address.length === "number" || $util.isString(message.address))) + return "address: buffer expected"; + if (message.power != null && message.hasOwnProperty("power")) + if (!$util.isInteger(message.power) && !(message.power && $util.isInteger(message.power.low) && $util.isInteger(message.power.high))) + return "power: integer|Long expected"; + return null; + }; + + /** + * Creates a Validator message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.Validator + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.Validator} Validator + */ + Validator.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.Validator) + return object; + let message = new $root.tendermint.abci.Validator(); + if (object.address != null) + if (typeof object.address === "string") + $util.base64.decode(object.address, message.address = $util.newBuffer($util.base64.length(object.address)), 0); + else if (object.address.length) + message.address = object.address; + if (object.power != null) + if ($util.Long) + (message.power = $util.Long.fromValue(object.power)).unsigned = false; + else if (typeof object.power === "string") + message.power = parseInt(object.power, 10); + else if (typeof object.power === "number") + message.power = object.power; + else if (typeof object.power === "object") + message.power = new $util.LongBits(object.power.low >>> 0, object.power.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a Validator message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.Validator + * @static + * @param {tendermint.abci.Validator} message Validator + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Validator.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if (options.bytes === String) + object.address = ""; + else { + object.address = []; + if (options.bytes !== Array) + object.address = $util.newBuffer(object.address); + } + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.power = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.power = options.longs === String ? "0" : 0; + } + if (message.address != null && message.hasOwnProperty("address")) + object.address = options.bytes === String ? $util.base64.encode(message.address, 0, message.address.length) : options.bytes === Array ? Array.prototype.slice.call(message.address) : message.address; + if (message.power != null && message.hasOwnProperty("power")) + if (typeof message.power === "number") + object.power = options.longs === String ? String(message.power) : message.power; + else + object.power = options.longs === String ? $util.Long.prototype.toString.call(message.power) : options.longs === Number ? new $util.LongBits(message.power.low >>> 0, message.power.high >>> 0).toNumber() : message.power; + return object; + }; + + /** + * Converts this Validator to JSON. + * @function toJSON + * @memberof tendermint.abci.Validator + * @instance + * @returns {Object.} JSON object + */ + Validator.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Validator; + })(); + + abci.ValidatorUpdate = (function() { + + /** + * Properties of a ValidatorUpdate. + * @memberof tendermint.abci + * @interface IValidatorUpdate + * @property {tendermint.crypto.IPublicKey|null} [pub_key] ValidatorUpdate pub_key + * @property {Long|null} [power] ValidatorUpdate power + */ + + /** + * Constructs a new ValidatorUpdate. + * @memberof tendermint.abci + * @classdesc Represents a ValidatorUpdate. + * @implements IValidatorUpdate + * @constructor + * @param {tendermint.abci.IValidatorUpdate=} [properties] Properties to set + */ + function ValidatorUpdate(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ValidatorUpdate pub_key. + * @member {tendermint.crypto.IPublicKey|null|undefined} pub_key + * @memberof tendermint.abci.ValidatorUpdate + * @instance + */ + ValidatorUpdate.prototype.pub_key = null; + + /** + * ValidatorUpdate power. + * @member {Long} power + * @memberof tendermint.abci.ValidatorUpdate + * @instance + */ + ValidatorUpdate.prototype.power = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Encodes the specified ValidatorUpdate message. Does not implicitly {@link tendermint.abci.ValidatorUpdate.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.ValidatorUpdate + * @static + * @param {tendermint.abci.IValidatorUpdate} message ValidatorUpdate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorUpdate.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pub_key != null && Object.hasOwnProperty.call(message, "pub_key")) + $root.tendermint.crypto.PublicKey.encode(message.pub_key, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.power != null && Object.hasOwnProperty.call(message, "power")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.power); + return writer; + }; + + /** + * Encodes the specified ValidatorUpdate message, length delimited. Does not implicitly {@link tendermint.abci.ValidatorUpdate.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.ValidatorUpdate + * @static + * @param {tendermint.abci.IValidatorUpdate} message ValidatorUpdate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorUpdate.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ValidatorUpdate message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.ValidatorUpdate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.ValidatorUpdate} ValidatorUpdate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorUpdate.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ValidatorUpdate(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pub_key = $root.tendermint.crypto.PublicKey.decode(reader, reader.uint32()); + break; + case 2: + message.power = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ValidatorUpdate message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.ValidatorUpdate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.ValidatorUpdate} ValidatorUpdate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorUpdate.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ValidatorUpdate message. + * @function verify + * @memberof tendermint.abci.ValidatorUpdate + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ValidatorUpdate.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pub_key != null && message.hasOwnProperty("pub_key")) { + let error = $root.tendermint.crypto.PublicKey.verify(message.pub_key); + if (error) + return "pub_key." + error; + } + if (message.power != null && message.hasOwnProperty("power")) + if (!$util.isInteger(message.power) && !(message.power && $util.isInteger(message.power.low) && $util.isInteger(message.power.high))) + return "power: integer|Long expected"; + return null; + }; + + /** + * Creates a ValidatorUpdate message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.ValidatorUpdate + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.ValidatorUpdate} ValidatorUpdate + */ + ValidatorUpdate.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.ValidatorUpdate) + return object; + let message = new $root.tendermint.abci.ValidatorUpdate(); + if (object.pub_key != null) { + if (typeof object.pub_key !== "object") + throw TypeError(".tendermint.abci.ValidatorUpdate.pub_key: object expected"); + message.pub_key = $root.tendermint.crypto.PublicKey.fromObject(object.pub_key); + } + if (object.power != null) + if ($util.Long) + (message.power = $util.Long.fromValue(object.power)).unsigned = false; + else if (typeof object.power === "string") + message.power = parseInt(object.power, 10); + else if (typeof object.power === "number") + message.power = object.power; + else if (typeof object.power === "object") + message.power = new $util.LongBits(object.power.low >>> 0, object.power.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a ValidatorUpdate message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.ValidatorUpdate + * @static + * @param {tendermint.abci.ValidatorUpdate} message ValidatorUpdate + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ValidatorUpdate.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.pub_key = null; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.power = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.power = options.longs === String ? "0" : 0; + } + if (message.pub_key != null && message.hasOwnProperty("pub_key")) + object.pub_key = $root.tendermint.crypto.PublicKey.toObject(message.pub_key, options); + if (message.power != null && message.hasOwnProperty("power")) + if (typeof message.power === "number") + object.power = options.longs === String ? String(message.power) : message.power; + else + object.power = options.longs === String ? $util.Long.prototype.toString.call(message.power) : options.longs === Number ? new $util.LongBits(message.power.low >>> 0, message.power.high >>> 0).toNumber() : message.power; + return object; + }; + + /** + * Converts this ValidatorUpdate to JSON. + * @function toJSON + * @memberof tendermint.abci.ValidatorUpdate + * @instance + * @returns {Object.} JSON object + */ + ValidatorUpdate.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ValidatorUpdate; + })(); + + abci.VoteInfo = (function() { + + /** + * Properties of a VoteInfo. + * @memberof tendermint.abci + * @interface IVoteInfo + * @property {tendermint.abci.IValidator|null} [validator] VoteInfo validator + * @property {boolean|null} [signed_last_block] VoteInfo signed_last_block + */ + + /** + * Constructs a new VoteInfo. + * @memberof tendermint.abci + * @classdesc Represents a VoteInfo. + * @implements IVoteInfo + * @constructor + * @param {tendermint.abci.IVoteInfo=} [properties] Properties to set + */ + function VoteInfo(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * VoteInfo validator. + * @member {tendermint.abci.IValidator|null|undefined} validator + * @memberof tendermint.abci.VoteInfo + * @instance + */ + VoteInfo.prototype.validator = null; + + /** + * VoteInfo signed_last_block. + * @member {boolean} signed_last_block + * @memberof tendermint.abci.VoteInfo + * @instance + */ + VoteInfo.prototype.signed_last_block = false; + + /** + * Encodes the specified VoteInfo message. Does not implicitly {@link tendermint.abci.VoteInfo.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.VoteInfo + * @static + * @param {tendermint.abci.IVoteInfo} message VoteInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VoteInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.validator != null && Object.hasOwnProperty.call(message, "validator")) + $root.tendermint.abci.Validator.encode(message.validator, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.signed_last_block != null && Object.hasOwnProperty.call(message, "signed_last_block")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.signed_last_block); + return writer; + }; + + /** + * Encodes the specified VoteInfo message, length delimited. Does not implicitly {@link tendermint.abci.VoteInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.VoteInfo + * @static + * @param {tendermint.abci.IVoteInfo} message VoteInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VoteInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VoteInfo message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.VoteInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.VoteInfo} VoteInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VoteInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.VoteInfo(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator = $root.tendermint.abci.Validator.decode(reader, reader.uint32()); + break; + case 2: + message.signed_last_block = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VoteInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.VoteInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.VoteInfo} VoteInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VoteInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VoteInfo message. + * @function verify + * @memberof tendermint.abci.VoteInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VoteInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.validator != null && message.hasOwnProperty("validator")) { + let error = $root.tendermint.abci.Validator.verify(message.validator); + if (error) + return "validator." + error; + } + if (message.signed_last_block != null && message.hasOwnProperty("signed_last_block")) + if (typeof message.signed_last_block !== "boolean") + return "signed_last_block: boolean expected"; + return null; + }; + + /** + * Creates a VoteInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.VoteInfo + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.VoteInfo} VoteInfo + */ + VoteInfo.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.VoteInfo) + return object; + let message = new $root.tendermint.abci.VoteInfo(); + if (object.validator != null) { + if (typeof object.validator !== "object") + throw TypeError(".tendermint.abci.VoteInfo.validator: object expected"); + message.validator = $root.tendermint.abci.Validator.fromObject(object.validator); + } + if (object.signed_last_block != null) + message.signed_last_block = Boolean(object.signed_last_block); + return message; + }; + + /** + * Creates a plain object from a VoteInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.VoteInfo + * @static + * @param {tendermint.abci.VoteInfo} message VoteInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VoteInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.validator = null; + object.signed_last_block = false; + } + if (message.validator != null && message.hasOwnProperty("validator")) + object.validator = $root.tendermint.abci.Validator.toObject(message.validator, options); + if (message.signed_last_block != null && message.hasOwnProperty("signed_last_block")) + object.signed_last_block = message.signed_last_block; + return object; + }; + + /** + * Converts this VoteInfo to JSON. + * @function toJSON + * @memberof tendermint.abci.VoteInfo + * @instance + * @returns {Object.} JSON object + */ + VoteInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return VoteInfo; + })(); + + /** + * EvidenceType enum. + * @name tendermint.abci.EvidenceType + * @enum {number} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} DUPLICATE_VOTE=1 DUPLICATE_VOTE value + * @property {number} LIGHT_CLIENT_ATTACK=2 LIGHT_CLIENT_ATTACK value + */ + abci.EvidenceType = (function() { + const valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "DUPLICATE_VOTE"] = 1; + values[valuesById[2] = "LIGHT_CLIENT_ATTACK"] = 2; + return values; + })(); + + abci.Evidence = (function() { + + /** + * Properties of an Evidence. + * @memberof tendermint.abci + * @interface IEvidence + * @property {tendermint.abci.EvidenceType|null} [type] Evidence type + * @property {tendermint.abci.IValidator|null} [validator] Evidence validator + * @property {Long|null} [height] Evidence height + * @property {google.protobuf.ITimestamp|null} [time] Evidence time + * @property {Long|null} [total_voting_power] Evidence total_voting_power + */ + + /** + * Constructs a new Evidence. + * @memberof tendermint.abci + * @classdesc Represents an Evidence. + * @implements IEvidence + * @constructor + * @param {tendermint.abci.IEvidence=} [properties] Properties to set + */ + function Evidence(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Evidence type. + * @member {tendermint.abci.EvidenceType} type + * @memberof tendermint.abci.Evidence + * @instance + */ + Evidence.prototype.type = 0; + + /** + * Evidence validator. + * @member {tendermint.abci.IValidator|null|undefined} validator + * @memberof tendermint.abci.Evidence + * @instance + */ + Evidence.prototype.validator = null; + + /** + * Evidence height. + * @member {Long} height + * @memberof tendermint.abci.Evidence + * @instance + */ + Evidence.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Evidence time. + * @member {google.protobuf.ITimestamp|null|undefined} time + * @memberof tendermint.abci.Evidence + * @instance + */ + Evidence.prototype.time = null; + + /** + * Evidence total_voting_power. + * @member {Long} total_voting_power + * @memberof tendermint.abci.Evidence + * @instance + */ + Evidence.prototype.total_voting_power = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Encodes the specified Evidence message. Does not implicitly {@link tendermint.abci.Evidence.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.Evidence + * @static + * @param {tendermint.abci.IEvidence} message Evidence message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Evidence.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); + if (message.validator != null && Object.hasOwnProperty.call(message, "validator")) + $root.tendermint.abci.Validator.encode(message.validator, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.height); + if (message.time != null && Object.hasOwnProperty.call(message, "time")) + $root.google.protobuf.Timestamp.encode(message.time, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.total_voting_power != null && Object.hasOwnProperty.call(message, "total_voting_power")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.total_voting_power); + return writer; + }; + + /** + * Encodes the specified Evidence message, length delimited. Does not implicitly {@link tendermint.abci.Evidence.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.Evidence + * @static + * @param {tendermint.abci.IEvidence} message Evidence message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Evidence.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Evidence message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.Evidence + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.Evidence} Evidence + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Evidence.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.Evidence(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.int32(); + break; + case 2: + message.validator = $root.tendermint.abci.Validator.decode(reader, reader.uint32()); + break; + case 3: + message.height = reader.int64(); + break; + case 4: + message.time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 5: + message.total_voting_power = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Evidence message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.Evidence + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.Evidence} Evidence + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Evidence.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Evidence message. + * @function verify + * @memberof tendermint.abci.Evidence + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Evidence.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.validator != null && message.hasOwnProperty("validator")) { + let error = $root.tendermint.abci.Validator.verify(message.validator); + if (error) + return "validator." + error; + } + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) + return "height: integer|Long expected"; + if (message.time != null && message.hasOwnProperty("time")) { + let error = $root.google.protobuf.Timestamp.verify(message.time); + if (error) + return "time." + error; + } + if (message.total_voting_power != null && message.hasOwnProperty("total_voting_power")) + if (!$util.isInteger(message.total_voting_power) && !(message.total_voting_power && $util.isInteger(message.total_voting_power.low) && $util.isInteger(message.total_voting_power.high))) + return "total_voting_power: integer|Long expected"; + return null; + }; + + /** + * Creates an Evidence message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.Evidence + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.Evidence} Evidence + */ + Evidence.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.Evidence) + return object; + let message = new $root.tendermint.abci.Evidence(); + switch (object.type) { + case "UNKNOWN": + case 0: + message.type = 0; + break; + case "DUPLICATE_VOTE": + case 1: + message.type = 1; + break; + case "LIGHT_CLIENT_ATTACK": + case 2: + message.type = 2; + break; + } + if (object.validator != null) { + if (typeof object.validator !== "object") + throw TypeError(".tendermint.abci.Evidence.validator: object expected"); + message.validator = $root.tendermint.abci.Validator.fromObject(object.validator); + } + if (object.height != null) + if ($util.Long) + (message.height = $util.Long.fromValue(object.height)).unsigned = false; + else if (typeof object.height === "string") + message.height = parseInt(object.height, 10); + else if (typeof object.height === "number") + message.height = object.height; + else if (typeof object.height === "object") + message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); + if (object.time != null) { + if (typeof object.time !== "object") + throw TypeError(".tendermint.abci.Evidence.time: object expected"); + message.time = $root.google.protobuf.Timestamp.fromObject(object.time); + } + if (object.total_voting_power != null) + if ($util.Long) + (message.total_voting_power = $util.Long.fromValue(object.total_voting_power)).unsigned = false; + else if (typeof object.total_voting_power === "string") + message.total_voting_power = parseInt(object.total_voting_power, 10); + else if (typeof object.total_voting_power === "number") + message.total_voting_power = object.total_voting_power; + else if (typeof object.total_voting_power === "object") + message.total_voting_power = new $util.LongBits(object.total_voting_power.low >>> 0, object.total_voting_power.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from an Evidence message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.Evidence + * @static + * @param {tendermint.abci.Evidence} message Evidence + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Evidence.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.type = options.enums === String ? "UNKNOWN" : 0; + object.validator = null; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.height = options.longs === String ? "0" : 0; + object.time = null; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.total_voting_power = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.total_voting_power = options.longs === String ? "0" : 0; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.tendermint.abci.EvidenceType[message.type] : message.type; + if (message.validator != null && message.hasOwnProperty("validator")) + object.validator = $root.tendermint.abci.Validator.toObject(message.validator, options); + if (message.height != null && message.hasOwnProperty("height")) + if (typeof message.height === "number") + object.height = options.longs === String ? String(message.height) : message.height; + else + object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; + if (message.time != null && message.hasOwnProperty("time")) + object.time = $root.google.protobuf.Timestamp.toObject(message.time, options); + if (message.total_voting_power != null && message.hasOwnProperty("total_voting_power")) + if (typeof message.total_voting_power === "number") + object.total_voting_power = options.longs === String ? String(message.total_voting_power) : message.total_voting_power; + else + object.total_voting_power = options.longs === String ? $util.Long.prototype.toString.call(message.total_voting_power) : options.longs === Number ? new $util.LongBits(message.total_voting_power.low >>> 0, message.total_voting_power.high >>> 0).toNumber() : message.total_voting_power; + return object; + }; + + /** + * Converts this Evidence to JSON. + * @function toJSON + * @memberof tendermint.abci.Evidence + * @instance + * @returns {Object.} JSON object + */ + Evidence.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Evidence; + })(); + + abci.Snapshot = (function() { + + /** + * Properties of a Snapshot. + * @memberof tendermint.abci + * @interface ISnapshot + * @property {Long|null} [height] Snapshot height + * @property {number|null} [format] Snapshot format + * @property {number|null} [chunks] Snapshot chunks + * @property {Uint8Array|null} [hash] Snapshot hash + * @property {Uint8Array|null} [metadata] Snapshot metadata + */ + + /** + * Constructs a new Snapshot. + * @memberof tendermint.abci + * @classdesc Represents a Snapshot. + * @implements ISnapshot + * @constructor + * @param {tendermint.abci.ISnapshot=} [properties] Properties to set + */ + function Snapshot(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Snapshot height. + * @member {Long} height + * @memberof tendermint.abci.Snapshot + * @instance + */ + Snapshot.prototype.height = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Snapshot format. + * @member {number} format + * @memberof tendermint.abci.Snapshot + * @instance + */ + Snapshot.prototype.format = 0; + + /** + * Snapshot chunks. + * @member {number} chunks + * @memberof tendermint.abci.Snapshot + * @instance + */ + Snapshot.prototype.chunks = 0; + + /** + * Snapshot hash. + * @member {Uint8Array} hash + * @memberof tendermint.abci.Snapshot + * @instance + */ + Snapshot.prototype.hash = $util.newBuffer([]); + + /** + * Snapshot metadata. + * @member {Uint8Array} metadata + * @memberof tendermint.abci.Snapshot + * @instance + */ + Snapshot.prototype.metadata = $util.newBuffer([]); + + /** + * Encodes the specified Snapshot message. Does not implicitly {@link tendermint.abci.Snapshot.verify|verify} messages. + * @function encode + * @memberof tendermint.abci.Snapshot + * @static + * @param {tendermint.abci.ISnapshot} message Snapshot message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Snapshot.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.height); + if (message.format != null && Object.hasOwnProperty.call(message, "format")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.format); + if (message.chunks != null && Object.hasOwnProperty.call(message, "chunks")) + writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.chunks); + if (message.hash != null && Object.hasOwnProperty.call(message, "hash")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.hash); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.metadata); + return writer; + }; + + /** + * Encodes the specified Snapshot message, length delimited. Does not implicitly {@link tendermint.abci.Snapshot.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.abci.Snapshot + * @static + * @param {tendermint.abci.ISnapshot} message Snapshot message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Snapshot.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Snapshot message from the specified reader or buffer. + * @function decode + * @memberof tendermint.abci.Snapshot + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.abci.Snapshot} Snapshot + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Snapshot.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.Snapshot(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.uint64(); + break; + case 2: + message.format = reader.uint32(); + break; + case 3: + message.chunks = reader.uint32(); + break; + case 4: + message.hash = reader.bytes(); + break; + case 5: + message.metadata = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Snapshot message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.abci.Snapshot + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.abci.Snapshot} Snapshot + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Snapshot.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Snapshot message. + * @function verify + * @memberof tendermint.abci.Snapshot + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Snapshot.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) + return "height: integer|Long expected"; + if (message.format != null && message.hasOwnProperty("format")) + if (!$util.isInteger(message.format)) + return "format: integer expected"; + if (message.chunks != null && message.hasOwnProperty("chunks")) + if (!$util.isInteger(message.chunks)) + return "chunks: integer expected"; + if (message.hash != null && message.hasOwnProperty("hash")) + if (!(message.hash && typeof message.hash.length === "number" || $util.isString(message.hash))) + return "hash: buffer expected"; + if (message.metadata != null && message.hasOwnProperty("metadata")) + if (!(message.metadata && typeof message.metadata.length === "number" || $util.isString(message.metadata))) + return "metadata: buffer expected"; + return null; + }; + + /** + * Creates a Snapshot message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.abci.Snapshot + * @static + * @param {Object.} object Plain object + * @returns {tendermint.abci.Snapshot} Snapshot + */ + Snapshot.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.abci.Snapshot) + return object; + let message = new $root.tendermint.abci.Snapshot(); + if (object.height != null) + if ($util.Long) + (message.height = $util.Long.fromValue(object.height)).unsigned = true; + else if (typeof object.height === "string") + message.height = parseInt(object.height, 10); + else if (typeof object.height === "number") + message.height = object.height; + else if (typeof object.height === "object") + message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(true); + if (object.format != null) + message.format = object.format >>> 0; + if (object.chunks != null) + message.chunks = object.chunks >>> 0; + if (object.hash != null) + if (typeof object.hash === "string") + $util.base64.decode(object.hash, message.hash = $util.newBuffer($util.base64.length(object.hash)), 0); + else if (object.hash.length) + message.hash = object.hash; + if (object.metadata != null) + if (typeof object.metadata === "string") + $util.base64.decode(object.metadata, message.metadata = $util.newBuffer($util.base64.length(object.metadata)), 0); + else if (object.metadata.length) + message.metadata = object.metadata; + return message; + }; + + /** + * Creates a plain object from a Snapshot message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.abci.Snapshot + * @static + * @param {tendermint.abci.Snapshot} message Snapshot + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Snapshot.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.height = options.longs === String ? "0" : 0; + object.format = 0; + object.chunks = 0; + if (options.bytes === String) + object.hash = ""; + else { + object.hash = []; + if (options.bytes !== Array) + object.hash = $util.newBuffer(object.hash); + } + if (options.bytes === String) + object.metadata = ""; + else { + object.metadata = []; + if (options.bytes !== Array) + object.metadata = $util.newBuffer(object.metadata); + } + } + if (message.height != null && message.hasOwnProperty("height")) + if (typeof message.height === "number") + object.height = options.longs === String ? String(message.height) : message.height; + else + object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber(true) : message.height; + if (message.format != null && message.hasOwnProperty("format")) + object.format = message.format; + if (message.chunks != null && message.hasOwnProperty("chunks")) + object.chunks = message.chunks; + if (message.hash != null && message.hasOwnProperty("hash")) + object.hash = options.bytes === String ? $util.base64.encode(message.hash, 0, message.hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.hash) : message.hash; + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = options.bytes === String ? $util.base64.encode(message.metadata, 0, message.metadata.length) : options.bytes === Array ? Array.prototype.slice.call(message.metadata) : message.metadata; + return object; + }; + + /** + * Converts this Snapshot to JSON. + * @function toJSON + * @memberof tendermint.abci.Snapshot + * @instance + * @returns {Object.} JSON object + */ + Snapshot.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Snapshot; + })(); + + abci.ABCIApplication = (function() { + + /** + * Constructs a new ABCIApplication service. + * @memberof tendermint.abci + * @classdesc Represents a ABCIApplication + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function ABCIApplication(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (ABCIApplication.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ABCIApplication; + + /** + * Callback as used by {@link tendermint.abci.ABCIApplication#echo}. + * @memberof tendermint.abci.ABCIApplication + * @typedef EchoCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {tendermint.abci.ResponseEcho} [response] ResponseEcho + */ + + /** + * Calls Echo. + * @function echo + * @memberof tendermint.abci.ABCIApplication + * @instance + * @param {tendermint.abci.IRequestEcho} request RequestEcho message or plain object + * @param {tendermint.abci.ABCIApplication.EchoCallback} callback Node-style callback called with the error, if any, and ResponseEcho + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ABCIApplication.prototype.echo = function echo(request, callback) { + return this.rpcCall(echo, $root.tendermint.abci.RequestEcho, $root.tendermint.abci.ResponseEcho, request, callback); + }, "name", { value: "Echo" }); + + /** + * Calls Echo. + * @function echo + * @memberof tendermint.abci.ABCIApplication + * @instance + * @param {tendermint.abci.IRequestEcho} request RequestEcho message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link tendermint.abci.ABCIApplication#flush}. + * @memberof tendermint.abci.ABCIApplication + * @typedef FlushCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {tendermint.abci.ResponseFlush} [response] ResponseFlush + */ + + /** + * Calls Flush. + * @function flush + * @memberof tendermint.abci.ABCIApplication + * @instance + * @param {tendermint.abci.IRequestFlush} request RequestFlush message or plain object + * @param {tendermint.abci.ABCIApplication.FlushCallback} callback Node-style callback called with the error, if any, and ResponseFlush + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ABCIApplication.prototype.flush = function flush(request, callback) { + return this.rpcCall(flush, $root.tendermint.abci.RequestFlush, $root.tendermint.abci.ResponseFlush, request, callback); + }, "name", { value: "Flush" }); + + /** + * Calls Flush. + * @function flush + * @memberof tendermint.abci.ABCIApplication + * @instance + * @param {tendermint.abci.IRequestFlush} request RequestFlush message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link tendermint.abci.ABCIApplication#info}. + * @memberof tendermint.abci.ABCIApplication + * @typedef InfoCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {tendermint.abci.ResponseInfo} [response] ResponseInfo + */ + + /** + * Calls Info. + * @function info + * @memberof tendermint.abci.ABCIApplication + * @instance + * @param {tendermint.abci.IRequestInfo} request RequestInfo message or plain object + * @param {tendermint.abci.ABCIApplication.InfoCallback} callback Node-style callback called with the error, if any, and ResponseInfo + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ABCIApplication.prototype.info = function info(request, callback) { + return this.rpcCall(info, $root.tendermint.abci.RequestInfo, $root.tendermint.abci.ResponseInfo, request, callback); + }, "name", { value: "Info" }); + + /** + * Calls Info. + * @function info + * @memberof tendermint.abci.ABCIApplication + * @instance + * @param {tendermint.abci.IRequestInfo} request RequestInfo message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link tendermint.abci.ABCIApplication#setOption}. + * @memberof tendermint.abci.ABCIApplication + * @typedef SetOptionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {tendermint.abci.ResponseSetOption} [response] ResponseSetOption + */ + + /** + * Calls SetOption. + * @function setOption + * @memberof tendermint.abci.ABCIApplication + * @instance + * @param {tendermint.abci.IRequestSetOption} request RequestSetOption message or plain object + * @param {tendermint.abci.ABCIApplication.SetOptionCallback} callback Node-style callback called with the error, if any, and ResponseSetOption + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ABCIApplication.prototype.setOption = function setOption(request, callback) { + return this.rpcCall(setOption, $root.tendermint.abci.RequestSetOption, $root.tendermint.abci.ResponseSetOption, request, callback); + }, "name", { value: "SetOption" }); + + /** + * Calls SetOption. + * @function setOption + * @memberof tendermint.abci.ABCIApplication + * @instance + * @param {tendermint.abci.IRequestSetOption} request RequestSetOption message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link tendermint.abci.ABCIApplication#deliverTx}. + * @memberof tendermint.abci.ABCIApplication + * @typedef DeliverTxCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {tendermint.abci.ResponseDeliverTx} [response] ResponseDeliverTx + */ + + /** + * Calls DeliverTx. + * @function deliverTx + * @memberof tendermint.abci.ABCIApplication + * @instance + * @param {tendermint.abci.IRequestDeliverTx} request RequestDeliverTx message or plain object + * @param {tendermint.abci.ABCIApplication.DeliverTxCallback} callback Node-style callback called with the error, if any, and ResponseDeliverTx + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ABCIApplication.prototype.deliverTx = function deliverTx(request, callback) { + return this.rpcCall(deliverTx, $root.tendermint.abci.RequestDeliverTx, $root.tendermint.abci.ResponseDeliverTx, request, callback); + }, "name", { value: "DeliverTx" }); + + /** + * Calls DeliverTx. + * @function deliverTx + * @memberof tendermint.abci.ABCIApplication + * @instance + * @param {tendermint.abci.IRequestDeliverTx} request RequestDeliverTx message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link tendermint.abci.ABCIApplication#checkTx}. + * @memberof tendermint.abci.ABCIApplication + * @typedef CheckTxCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {tendermint.abci.ResponseCheckTx} [response] ResponseCheckTx + */ + + /** + * Calls CheckTx. + * @function checkTx + * @memberof tendermint.abci.ABCIApplication + * @instance + * @param {tendermint.abci.IRequestCheckTx} request RequestCheckTx message or plain object + * @param {tendermint.abci.ABCIApplication.CheckTxCallback} callback Node-style callback called with the error, if any, and ResponseCheckTx + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ABCIApplication.prototype.checkTx = function checkTx(request, callback) { + return this.rpcCall(checkTx, $root.tendermint.abci.RequestCheckTx, $root.tendermint.abci.ResponseCheckTx, request, callback); + }, "name", { value: "CheckTx" }); + + /** + * Calls CheckTx. + * @function checkTx + * @memberof tendermint.abci.ABCIApplication + * @instance + * @param {tendermint.abci.IRequestCheckTx} request RequestCheckTx message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link tendermint.abci.ABCIApplication#query}. + * @memberof tendermint.abci.ABCIApplication + * @typedef QueryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {tendermint.abci.ResponseQuery} [response] ResponseQuery + */ + + /** + * Calls Query. + * @function query + * @memberof tendermint.abci.ABCIApplication + * @instance + * @param {tendermint.abci.IRequestQuery} request RequestQuery message or plain object + * @param {tendermint.abci.ABCIApplication.QueryCallback} callback Node-style callback called with the error, if any, and ResponseQuery + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ABCIApplication.prototype.query = function query(request, callback) { + return this.rpcCall(query, $root.tendermint.abci.RequestQuery, $root.tendermint.abci.ResponseQuery, request, callback); + }, "name", { value: "Query" }); + + /** + * Calls Query. + * @function query + * @memberof tendermint.abci.ABCIApplication + * @instance + * @param {tendermint.abci.IRequestQuery} request RequestQuery message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link tendermint.abci.ABCIApplication#commit}. + * @memberof tendermint.abci.ABCIApplication + * @typedef CommitCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {tendermint.abci.ResponseCommit} [response] ResponseCommit + */ + + /** + * Calls Commit. + * @function commit + * @memberof tendermint.abci.ABCIApplication + * @instance + * @param {tendermint.abci.IRequestCommit} request RequestCommit message or plain object + * @param {tendermint.abci.ABCIApplication.CommitCallback} callback Node-style callback called with the error, if any, and ResponseCommit + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ABCIApplication.prototype.commit = function commit(request, callback) { + return this.rpcCall(commit, $root.tendermint.abci.RequestCommit, $root.tendermint.abci.ResponseCommit, request, callback); + }, "name", { value: "Commit" }); + + /** + * Calls Commit. + * @function commit + * @memberof tendermint.abci.ABCIApplication + * @instance + * @param {tendermint.abci.IRequestCommit} request RequestCommit message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link tendermint.abci.ABCIApplication#initChain}. + * @memberof tendermint.abci.ABCIApplication + * @typedef InitChainCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {tendermint.abci.ResponseInitChain} [response] ResponseInitChain + */ + + /** + * Calls InitChain. + * @function initChain + * @memberof tendermint.abci.ABCIApplication + * @instance + * @param {tendermint.abci.IRequestInitChain} request RequestInitChain message or plain object + * @param {tendermint.abci.ABCIApplication.InitChainCallback} callback Node-style callback called with the error, if any, and ResponseInitChain + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ABCIApplication.prototype.initChain = function initChain(request, callback) { + return this.rpcCall(initChain, $root.tendermint.abci.RequestInitChain, $root.tendermint.abci.ResponseInitChain, request, callback); + }, "name", { value: "InitChain" }); + + /** + * Calls InitChain. + * @function initChain + * @memberof tendermint.abci.ABCIApplication + * @instance + * @param {tendermint.abci.IRequestInitChain} request RequestInitChain message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link tendermint.abci.ABCIApplication#beginBlock}. + * @memberof tendermint.abci.ABCIApplication + * @typedef BeginBlockCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {tendermint.abci.ResponseBeginBlock} [response] ResponseBeginBlock + */ + + /** + * Calls BeginBlock. + * @function beginBlock + * @memberof tendermint.abci.ABCIApplication + * @instance + * @param {tendermint.abci.IRequestBeginBlock} request RequestBeginBlock message or plain object + * @param {tendermint.abci.ABCIApplication.BeginBlockCallback} callback Node-style callback called with the error, if any, and ResponseBeginBlock + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ABCIApplication.prototype.beginBlock = function beginBlock(request, callback) { + return this.rpcCall(beginBlock, $root.tendermint.abci.RequestBeginBlock, $root.tendermint.abci.ResponseBeginBlock, request, callback); + }, "name", { value: "BeginBlock" }); + + /** + * Calls BeginBlock. + * @function beginBlock + * @memberof tendermint.abci.ABCIApplication + * @instance + * @param {tendermint.abci.IRequestBeginBlock} request RequestBeginBlock message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link tendermint.abci.ABCIApplication#endBlock}. + * @memberof tendermint.abci.ABCIApplication + * @typedef EndBlockCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {tendermint.abci.ResponseEndBlock} [response] ResponseEndBlock + */ + + /** + * Calls EndBlock. + * @function endBlock + * @memberof tendermint.abci.ABCIApplication + * @instance + * @param {tendermint.abci.IRequestEndBlock} request RequestEndBlock message or plain object + * @param {tendermint.abci.ABCIApplication.EndBlockCallback} callback Node-style callback called with the error, if any, and ResponseEndBlock + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ABCIApplication.prototype.endBlock = function endBlock(request, callback) { + return this.rpcCall(endBlock, $root.tendermint.abci.RequestEndBlock, $root.tendermint.abci.ResponseEndBlock, request, callback); + }, "name", { value: "EndBlock" }); + + /** + * Calls EndBlock. + * @function endBlock + * @memberof tendermint.abci.ABCIApplication + * @instance + * @param {tendermint.abci.IRequestEndBlock} request RequestEndBlock message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link tendermint.abci.ABCIApplication#listSnapshots}. + * @memberof tendermint.abci.ABCIApplication + * @typedef ListSnapshotsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {tendermint.abci.ResponseListSnapshots} [response] ResponseListSnapshots + */ + + /** + * Calls ListSnapshots. + * @function listSnapshots + * @memberof tendermint.abci.ABCIApplication + * @instance + * @param {tendermint.abci.IRequestListSnapshots} request RequestListSnapshots message or plain object + * @param {tendermint.abci.ABCIApplication.ListSnapshotsCallback} callback Node-style callback called with the error, if any, and ResponseListSnapshots + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ABCIApplication.prototype.listSnapshots = function listSnapshots(request, callback) { + return this.rpcCall(listSnapshots, $root.tendermint.abci.RequestListSnapshots, $root.tendermint.abci.ResponseListSnapshots, request, callback); + }, "name", { value: "ListSnapshots" }); + + /** + * Calls ListSnapshots. + * @function listSnapshots + * @memberof tendermint.abci.ABCIApplication + * @instance + * @param {tendermint.abci.IRequestListSnapshots} request RequestListSnapshots message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link tendermint.abci.ABCIApplication#offerSnapshot}. + * @memberof tendermint.abci.ABCIApplication + * @typedef OfferSnapshotCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {tendermint.abci.ResponseOfferSnapshot} [response] ResponseOfferSnapshot + */ + + /** + * Calls OfferSnapshot. + * @function offerSnapshot + * @memberof tendermint.abci.ABCIApplication + * @instance + * @param {tendermint.abci.IRequestOfferSnapshot} request RequestOfferSnapshot message or plain object + * @param {tendermint.abci.ABCIApplication.OfferSnapshotCallback} callback Node-style callback called with the error, if any, and ResponseOfferSnapshot + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ABCIApplication.prototype.offerSnapshot = function offerSnapshot(request, callback) { + return this.rpcCall(offerSnapshot, $root.tendermint.abci.RequestOfferSnapshot, $root.tendermint.abci.ResponseOfferSnapshot, request, callback); + }, "name", { value: "OfferSnapshot" }); + + /** + * Calls OfferSnapshot. + * @function offerSnapshot + * @memberof tendermint.abci.ABCIApplication + * @instance + * @param {tendermint.abci.IRequestOfferSnapshot} request RequestOfferSnapshot message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link tendermint.abci.ABCIApplication#loadSnapshotChunk}. + * @memberof tendermint.abci.ABCIApplication + * @typedef LoadSnapshotChunkCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {tendermint.abci.ResponseLoadSnapshotChunk} [response] ResponseLoadSnapshotChunk + */ + + /** + * Calls LoadSnapshotChunk. + * @function loadSnapshotChunk + * @memberof tendermint.abci.ABCIApplication + * @instance + * @param {tendermint.abci.IRequestLoadSnapshotChunk} request RequestLoadSnapshotChunk message or plain object + * @param {tendermint.abci.ABCIApplication.LoadSnapshotChunkCallback} callback Node-style callback called with the error, if any, and ResponseLoadSnapshotChunk + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ABCIApplication.prototype.loadSnapshotChunk = function loadSnapshotChunk(request, callback) { + return this.rpcCall(loadSnapshotChunk, $root.tendermint.abci.RequestLoadSnapshotChunk, $root.tendermint.abci.ResponseLoadSnapshotChunk, request, callback); + }, "name", { value: "LoadSnapshotChunk" }); + + /** + * Calls LoadSnapshotChunk. + * @function loadSnapshotChunk + * @memberof tendermint.abci.ABCIApplication + * @instance + * @param {tendermint.abci.IRequestLoadSnapshotChunk} request RequestLoadSnapshotChunk message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link tendermint.abci.ABCIApplication#applySnapshotChunk}. + * @memberof tendermint.abci.ABCIApplication + * @typedef ApplySnapshotChunkCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {tendermint.abci.ResponseApplySnapshotChunk} [response] ResponseApplySnapshotChunk + */ + + /** + * Calls ApplySnapshotChunk. + * @function applySnapshotChunk + * @memberof tendermint.abci.ABCIApplication + * @instance + * @param {tendermint.abci.IRequestApplySnapshotChunk} request RequestApplySnapshotChunk message or plain object + * @param {tendermint.abci.ABCIApplication.ApplySnapshotChunkCallback} callback Node-style callback called with the error, if any, and ResponseApplySnapshotChunk + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ABCIApplication.prototype.applySnapshotChunk = function applySnapshotChunk(request, callback) { + return this.rpcCall(applySnapshotChunk, $root.tendermint.abci.RequestApplySnapshotChunk, $root.tendermint.abci.ResponseApplySnapshotChunk, request, callback); + }, "name", { value: "ApplySnapshotChunk" }); + + /** + * Calls ApplySnapshotChunk. + * @function applySnapshotChunk + * @memberof tendermint.abci.ABCIApplication + * @instance + * @param {tendermint.abci.IRequestApplySnapshotChunk} request RequestApplySnapshotChunk message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return ABCIApplication; + })(); + + return abci; + })(); + + tendermint.crypto = (function() { + + /** + * Namespace crypto. + * @memberof tendermint + * @namespace + */ + const crypto = {}; + + crypto.Proof = (function() { + + /** + * Properties of a Proof. + * @memberof tendermint.crypto + * @interface IProof + * @property {Long|null} [total] Proof total + * @property {Long|null} [index] Proof index + * @property {Uint8Array|null} [leaf_hash] Proof leaf_hash + * @property {Array.|null} [aunts] Proof aunts + */ + + /** + * Constructs a new Proof. + * @memberof tendermint.crypto + * @classdesc Represents a Proof. + * @implements IProof + * @constructor + * @param {tendermint.crypto.IProof=} [properties] Properties to set + */ + function Proof(properties) { + this.aunts = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Proof total. + * @member {Long} total + * @memberof tendermint.crypto.Proof + * @instance + */ + Proof.prototype.total = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Proof index. + * @member {Long} index + * @memberof tendermint.crypto.Proof + * @instance + */ + Proof.prototype.index = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Proof leaf_hash. + * @member {Uint8Array} leaf_hash + * @memberof tendermint.crypto.Proof + * @instance + */ + Proof.prototype.leaf_hash = $util.newBuffer([]); + + /** + * Proof aunts. + * @member {Array.} aunts + * @memberof tendermint.crypto.Proof + * @instance + */ + Proof.prototype.aunts = $util.emptyArray; + + /** + * Encodes the specified Proof message. Does not implicitly {@link tendermint.crypto.Proof.verify|verify} messages. + * @function encode + * @memberof tendermint.crypto.Proof + * @static + * @param {tendermint.crypto.IProof} message Proof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Proof.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.total != null && Object.hasOwnProperty.call(message, "total")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.total); + if (message.index != null && Object.hasOwnProperty.call(message, "index")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.index); + if (message.leaf_hash != null && Object.hasOwnProperty.call(message, "leaf_hash")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.leaf_hash); + if (message.aunts != null && message.aunts.length) + for (let i = 0; i < message.aunts.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.aunts[i]); + return writer; + }; + + /** + * Encodes the specified Proof message, length delimited. Does not implicitly {@link tendermint.crypto.Proof.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.crypto.Proof + * @static + * @param {tendermint.crypto.IProof} message Proof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Proof.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Proof message from the specified reader or buffer. + * @function decode + * @memberof tendermint.crypto.Proof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.crypto.Proof} Proof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Proof.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.crypto.Proof(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.total = reader.int64(); + break; + case 2: + message.index = reader.int64(); + break; + case 3: + message.leaf_hash = reader.bytes(); + break; + case 4: + if (!(message.aunts && message.aunts.length)) + message.aunts = []; + message.aunts.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Proof message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.crypto.Proof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.crypto.Proof} Proof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Proof.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Proof message. + * @function verify + * @memberof tendermint.crypto.Proof + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Proof.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.total != null && message.hasOwnProperty("total")) + if (!$util.isInteger(message.total) && !(message.total && $util.isInteger(message.total.low) && $util.isInteger(message.total.high))) + return "total: integer|Long expected"; + if (message.index != null && message.hasOwnProperty("index")) + if (!$util.isInteger(message.index) && !(message.index && $util.isInteger(message.index.low) && $util.isInteger(message.index.high))) + return "index: integer|Long expected"; + if (message.leaf_hash != null && message.hasOwnProperty("leaf_hash")) + if (!(message.leaf_hash && typeof message.leaf_hash.length === "number" || $util.isString(message.leaf_hash))) + return "leaf_hash: buffer expected"; + if (message.aunts != null && message.hasOwnProperty("aunts")) { + if (!Array.isArray(message.aunts)) + return "aunts: array expected"; + for (let i = 0; i < message.aunts.length; ++i) + if (!(message.aunts[i] && typeof message.aunts[i].length === "number" || $util.isString(message.aunts[i]))) + return "aunts: buffer[] expected"; + } + return null; + }; + + /** + * Creates a Proof message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.crypto.Proof + * @static + * @param {Object.} object Plain object + * @returns {tendermint.crypto.Proof} Proof + */ + Proof.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.crypto.Proof) + return object; + let message = new $root.tendermint.crypto.Proof(); + if (object.total != null) + if ($util.Long) + (message.total = $util.Long.fromValue(object.total)).unsigned = false; + else if (typeof object.total === "string") + message.total = parseInt(object.total, 10); + else if (typeof object.total === "number") + message.total = object.total; + else if (typeof object.total === "object") + message.total = new $util.LongBits(object.total.low >>> 0, object.total.high >>> 0).toNumber(); + if (object.index != null) + if ($util.Long) + (message.index = $util.Long.fromValue(object.index)).unsigned = false; + else if (typeof object.index === "string") + message.index = parseInt(object.index, 10); + else if (typeof object.index === "number") + message.index = object.index; + else if (typeof object.index === "object") + message.index = new $util.LongBits(object.index.low >>> 0, object.index.high >>> 0).toNumber(); + if (object.leaf_hash != null) + if (typeof object.leaf_hash === "string") + $util.base64.decode(object.leaf_hash, message.leaf_hash = $util.newBuffer($util.base64.length(object.leaf_hash)), 0); + else if (object.leaf_hash.length) + message.leaf_hash = object.leaf_hash; + if (object.aunts) { + if (!Array.isArray(object.aunts)) + throw TypeError(".tendermint.crypto.Proof.aunts: array expected"); + message.aunts = []; + for (let i = 0; i < object.aunts.length; ++i) + if (typeof object.aunts[i] === "string") + $util.base64.decode(object.aunts[i], message.aunts[i] = $util.newBuffer($util.base64.length(object.aunts[i])), 0); + else if (object.aunts[i].length) + message.aunts[i] = object.aunts[i]; + } + return message; + }; + + /** + * Creates a plain object from a Proof message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.crypto.Proof + * @static + * @param {tendermint.crypto.Proof} message Proof + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Proof.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.aunts = []; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.total = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.total = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.index = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.index = options.longs === String ? "0" : 0; + if (options.bytes === String) + object.leaf_hash = ""; + else { + object.leaf_hash = []; + if (options.bytes !== Array) + object.leaf_hash = $util.newBuffer(object.leaf_hash); + } + } + if (message.total != null && message.hasOwnProperty("total")) + if (typeof message.total === "number") + object.total = options.longs === String ? String(message.total) : message.total; + else + object.total = options.longs === String ? $util.Long.prototype.toString.call(message.total) : options.longs === Number ? new $util.LongBits(message.total.low >>> 0, message.total.high >>> 0).toNumber() : message.total; + if (message.index != null && message.hasOwnProperty("index")) + if (typeof message.index === "number") + object.index = options.longs === String ? String(message.index) : message.index; + else + object.index = options.longs === String ? $util.Long.prototype.toString.call(message.index) : options.longs === Number ? new $util.LongBits(message.index.low >>> 0, message.index.high >>> 0).toNumber() : message.index; + if (message.leaf_hash != null && message.hasOwnProperty("leaf_hash")) + object.leaf_hash = options.bytes === String ? $util.base64.encode(message.leaf_hash, 0, message.leaf_hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.leaf_hash) : message.leaf_hash; + if (message.aunts && message.aunts.length) { + object.aunts = []; + for (let j = 0; j < message.aunts.length; ++j) + object.aunts[j] = options.bytes === String ? $util.base64.encode(message.aunts[j], 0, message.aunts[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.aunts[j]) : message.aunts[j]; + } + return object; + }; + + /** + * Converts this Proof to JSON. + * @function toJSON + * @memberof tendermint.crypto.Proof + * @instance + * @returns {Object.} JSON object + */ + Proof.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Proof; + })(); + + crypto.ValueOp = (function() { + + /** + * Properties of a ValueOp. + * @memberof tendermint.crypto + * @interface IValueOp + * @property {Uint8Array|null} [key] ValueOp key + * @property {tendermint.crypto.IProof|null} [proof] ValueOp proof + */ + + /** + * Constructs a new ValueOp. + * @memberof tendermint.crypto + * @classdesc Represents a ValueOp. + * @implements IValueOp + * @constructor + * @param {tendermint.crypto.IValueOp=} [properties] Properties to set + */ + function ValueOp(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ValueOp key. + * @member {Uint8Array} key + * @memberof tendermint.crypto.ValueOp + * @instance + */ + ValueOp.prototype.key = $util.newBuffer([]); + + /** + * ValueOp proof. + * @member {tendermint.crypto.IProof|null|undefined} proof + * @memberof tendermint.crypto.ValueOp + * @instance + */ + ValueOp.prototype.proof = null; + + /** + * Encodes the specified ValueOp message. Does not implicitly {@link tendermint.crypto.ValueOp.verify|verify} messages. + * @function encode + * @memberof tendermint.crypto.ValueOp + * @static + * @param {tendermint.crypto.IValueOp} message ValueOp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValueOp.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + $root.tendermint.crypto.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ValueOp message, length delimited. Does not implicitly {@link tendermint.crypto.ValueOp.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.crypto.ValueOp + * @static + * @param {tendermint.crypto.IValueOp} message ValueOp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValueOp.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ValueOp message from the specified reader or buffer. + * @function decode + * @memberof tendermint.crypto.ValueOp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.crypto.ValueOp} ValueOp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValueOp.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.crypto.ValueOp(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.proof = $root.tendermint.crypto.Proof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ValueOp message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.crypto.ValueOp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.crypto.ValueOp} ValueOp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValueOp.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ValueOp message. + * @function verify + * @memberof tendermint.crypto.ValueOp + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ValueOp.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) + return "key: buffer expected"; + if (message.proof != null && message.hasOwnProperty("proof")) { + let error = $root.tendermint.crypto.Proof.verify(message.proof); + if (error) + return "proof." + error; + } + return null; + }; + + /** + * Creates a ValueOp message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.crypto.ValueOp + * @static + * @param {Object.} object Plain object + * @returns {tendermint.crypto.ValueOp} ValueOp + */ + ValueOp.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.crypto.ValueOp) + return object; + let message = new $root.tendermint.crypto.ValueOp(); + if (object.key != null) + if (typeof object.key === "string") + $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); + else if (object.key.length) + message.key = object.key; + if (object.proof != null) { + if (typeof object.proof !== "object") + throw TypeError(".tendermint.crypto.ValueOp.proof: object expected"); + message.proof = $root.tendermint.crypto.Proof.fromObject(object.proof); + } + return message; + }; + + /** + * Creates a plain object from a ValueOp message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.crypto.ValueOp + * @static + * @param {tendermint.crypto.ValueOp} message ValueOp + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ValueOp.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if (options.bytes === String) + object.key = ""; + else { + object.key = []; + if (options.bytes !== Array) + object.key = $util.newBuffer(object.key); + } + object.proof = null; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; + if (message.proof != null && message.hasOwnProperty("proof")) + object.proof = $root.tendermint.crypto.Proof.toObject(message.proof, options); + return object; + }; + + /** + * Converts this ValueOp to JSON. + * @function toJSON + * @memberof tendermint.crypto.ValueOp + * @instance + * @returns {Object.} JSON object + */ + ValueOp.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ValueOp; + })(); + + crypto.DominoOp = (function() { + + /** + * Properties of a DominoOp. + * @memberof tendermint.crypto + * @interface IDominoOp + * @property {string|null} [key] DominoOp key + * @property {string|null} [input] DominoOp input + * @property {string|null} [output] DominoOp output + */ + + /** + * Constructs a new DominoOp. + * @memberof tendermint.crypto + * @classdesc Represents a DominoOp. + * @implements IDominoOp + * @constructor + * @param {tendermint.crypto.IDominoOp=} [properties] Properties to set + */ + function DominoOp(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DominoOp key. + * @member {string} key + * @memberof tendermint.crypto.DominoOp + * @instance + */ + DominoOp.prototype.key = ""; + + /** + * DominoOp input. + * @member {string} input + * @memberof tendermint.crypto.DominoOp + * @instance + */ + DominoOp.prototype.input = ""; + + /** + * DominoOp output. + * @member {string} output + * @memberof tendermint.crypto.DominoOp + * @instance + */ + DominoOp.prototype.output = ""; + + /** + * Encodes the specified DominoOp message. Does not implicitly {@link tendermint.crypto.DominoOp.verify|verify} messages. + * @function encode + * @memberof tendermint.crypto.DominoOp + * @static + * @param {tendermint.crypto.IDominoOp} message DominoOp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DominoOp.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.input != null && Object.hasOwnProperty.call(message, "input")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.input); + if (message.output != null && Object.hasOwnProperty.call(message, "output")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.output); + return writer; + }; + + /** + * Encodes the specified DominoOp message, length delimited. Does not implicitly {@link tendermint.crypto.DominoOp.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.crypto.DominoOp + * @static + * @param {tendermint.crypto.IDominoOp} message DominoOp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DominoOp.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DominoOp message from the specified reader or buffer. + * @function decode + * @memberof tendermint.crypto.DominoOp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.crypto.DominoOp} DominoOp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DominoOp.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.crypto.DominoOp(); + while (reader.pos < end) { + let 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; + }; + + /** + * Decodes a DominoOp message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.crypto.DominoOp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.crypto.DominoOp} DominoOp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DominoOp.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DominoOp message. + * @function verify + * @memberof tendermint.crypto.DominoOp + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DominoOp.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.input != null && message.hasOwnProperty("input")) + if (!$util.isString(message.input)) + return "input: string expected"; + if (message.output != null && message.hasOwnProperty("output")) + if (!$util.isString(message.output)) + return "output: string expected"; + return null; + }; + + /** + * Creates a DominoOp message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.crypto.DominoOp + * @static + * @param {Object.} object Plain object + * @returns {tendermint.crypto.DominoOp} DominoOp + */ + DominoOp.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.crypto.DominoOp) + return object; + let message = new $root.tendermint.crypto.DominoOp(); + if (object.key != null) + message.key = String(object.key); + if (object.input != null) + message.input = String(object.input); + if (object.output != null) + message.output = String(object.output); + return message; + }; + + /** + * Creates a plain object from a DominoOp message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.crypto.DominoOp + * @static + * @param {tendermint.crypto.DominoOp} message DominoOp + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DominoOp.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.key = ""; + object.input = ""; + object.output = ""; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.input != null && message.hasOwnProperty("input")) + object.input = message.input; + if (message.output != null && message.hasOwnProperty("output")) + object.output = message.output; + return object; + }; + + /** + * Converts this DominoOp to JSON. + * @function toJSON + * @memberof tendermint.crypto.DominoOp + * @instance + * @returns {Object.} JSON object + */ + DominoOp.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DominoOp; + })(); + + crypto.ProofOp = (function() { + + /** + * Properties of a ProofOp. + * @memberof tendermint.crypto + * @interface IProofOp + * @property {string|null} [type] ProofOp type + * @property {Uint8Array|null} [key] ProofOp key + * @property {Uint8Array|null} [data] ProofOp data + */ + + /** + * Constructs a new ProofOp. + * @memberof tendermint.crypto + * @classdesc Represents a ProofOp. + * @implements IProofOp + * @constructor + * @param {tendermint.crypto.IProofOp=} [properties] Properties to set + */ + function ProofOp(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProofOp type. + * @member {string} type + * @memberof tendermint.crypto.ProofOp + * @instance + */ + ProofOp.prototype.type = ""; + + /** + * ProofOp key. + * @member {Uint8Array} key + * @memberof tendermint.crypto.ProofOp + * @instance + */ + ProofOp.prototype.key = $util.newBuffer([]); + + /** + * ProofOp data. + * @member {Uint8Array} data + * @memberof tendermint.crypto.ProofOp + * @instance + */ + ProofOp.prototype.data = $util.newBuffer([]); + + /** + * Encodes the specified ProofOp message. Does not implicitly {@link tendermint.crypto.ProofOp.verify|verify} messages. + * @function encode + * @memberof tendermint.crypto.ProofOp + * @static + * @param {tendermint.crypto.IProofOp} message ProofOp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProofOp.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.key); + if (message.data != null && Object.hasOwnProperty.call(message, "data")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.data); + return writer; + }; + + /** + * Encodes the specified ProofOp message, length delimited. Does not implicitly {@link tendermint.crypto.ProofOp.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.crypto.ProofOp + * @static + * @param {tendermint.crypto.IProofOp} message ProofOp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProofOp.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProofOp message from the specified reader or buffer. + * @function decode + * @memberof tendermint.crypto.ProofOp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.crypto.ProofOp} ProofOp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProofOp.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.crypto.ProofOp(); + while (reader.pos < end) { + let 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; + }; + + /** + * Decodes a ProofOp message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.crypto.ProofOp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.crypto.ProofOp} ProofOp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProofOp.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProofOp message. + * @function verify + * @memberof tendermint.crypto.ProofOp + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProofOp.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) + return "key: buffer expected"; + if (message.data != null && message.hasOwnProperty("data")) + if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) + return "data: buffer expected"; + return null; + }; + + /** + * Creates a ProofOp message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.crypto.ProofOp + * @static + * @param {Object.} object Plain object + * @returns {tendermint.crypto.ProofOp} ProofOp + */ + ProofOp.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.crypto.ProofOp) + return object; + let message = new $root.tendermint.crypto.ProofOp(); + if (object.type != null) + message.type = String(object.type); + if (object.key != null) + if (typeof object.key === "string") + $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); + else if (object.key.length) + message.key = object.key; + if (object.data != null) + if (typeof object.data === "string") + $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); + else if (object.data.length) + message.data = object.data; + return message; + }; + + /** + * Creates a plain object from a ProofOp message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.crypto.ProofOp + * @static + * @param {tendermint.crypto.ProofOp} message ProofOp + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProofOp.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.type = ""; + if (options.bytes === String) + object.key = ""; + else { + object.key = []; + if (options.bytes !== Array) + object.key = $util.newBuffer(object.key); + } + if (options.bytes === String) + object.data = ""; + else { + object.data = []; + if (options.bytes !== Array) + object.data = $util.newBuffer(object.data); + } + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.key != null && message.hasOwnProperty("key")) + object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; + if (message.data != null && message.hasOwnProperty("data")) + object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; + return object; + }; + + /** + * Converts this ProofOp to JSON. + * @function toJSON + * @memberof tendermint.crypto.ProofOp + * @instance + * @returns {Object.} JSON object + */ + ProofOp.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProofOp; + })(); + + crypto.ProofOps = (function() { + + /** + * Properties of a ProofOps. + * @memberof tendermint.crypto + * @interface IProofOps + * @property {Array.|null} [ops] ProofOps ops + */ + + /** + * Constructs a new ProofOps. + * @memberof tendermint.crypto + * @classdesc Represents a ProofOps. + * @implements IProofOps + * @constructor + * @param {tendermint.crypto.IProofOps=} [properties] Properties to set + */ + function ProofOps(properties) { + this.ops = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProofOps ops. + * @member {Array.} ops + * @memberof tendermint.crypto.ProofOps + * @instance + */ + ProofOps.prototype.ops = $util.emptyArray; + + /** + * Encodes the specified ProofOps message. Does not implicitly {@link tendermint.crypto.ProofOps.verify|verify} messages. + * @function encode + * @memberof tendermint.crypto.ProofOps + * @static + * @param {tendermint.crypto.IProofOps} message ProofOps message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProofOps.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ops != null && message.ops.length) + for (let i = 0; i < message.ops.length; ++i) + $root.tendermint.crypto.ProofOp.encode(message.ops[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ProofOps message, length delimited. Does not implicitly {@link tendermint.crypto.ProofOps.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.crypto.ProofOps + * @static + * @param {tendermint.crypto.IProofOps} message ProofOps message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProofOps.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProofOps message from the specified reader or buffer. + * @function decode + * @memberof tendermint.crypto.ProofOps + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.crypto.ProofOps} ProofOps + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProofOps.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.crypto.ProofOps(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.ops && message.ops.length)) + message.ops = []; + message.ops.push($root.tendermint.crypto.ProofOp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProofOps message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.crypto.ProofOps + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.crypto.ProofOps} ProofOps + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProofOps.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProofOps message. + * @function verify + * @memberof tendermint.crypto.ProofOps + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProofOps.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ops != null && message.hasOwnProperty("ops")) { + if (!Array.isArray(message.ops)) + return "ops: array expected"; + for (let i = 0; i < message.ops.length; ++i) { + let error = $root.tendermint.crypto.ProofOp.verify(message.ops[i]); + if (error) + return "ops." + error; + } + } + return null; + }; + + /** + * Creates a ProofOps message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.crypto.ProofOps + * @static + * @param {Object.} object Plain object + * @returns {tendermint.crypto.ProofOps} ProofOps + */ + ProofOps.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.crypto.ProofOps) + return object; + let message = new $root.tendermint.crypto.ProofOps(); + if (object.ops) { + if (!Array.isArray(object.ops)) + throw TypeError(".tendermint.crypto.ProofOps.ops: array expected"); + message.ops = []; + for (let i = 0; i < object.ops.length; ++i) { + if (typeof object.ops[i] !== "object") + throw TypeError(".tendermint.crypto.ProofOps.ops: object expected"); + message.ops[i] = $root.tendermint.crypto.ProofOp.fromObject(object.ops[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ProofOps message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.crypto.ProofOps + * @static + * @param {tendermint.crypto.ProofOps} message ProofOps + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProofOps.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.ops = []; + if (message.ops && message.ops.length) { + object.ops = []; + for (let j = 0; j < message.ops.length; ++j) + object.ops[j] = $root.tendermint.crypto.ProofOp.toObject(message.ops[j], options); + } + return object; + }; + + /** + * Converts this ProofOps to JSON. + * @function toJSON + * @memberof tendermint.crypto.ProofOps + * @instance + * @returns {Object.} JSON object + */ + ProofOps.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProofOps; + })(); + + crypto.PublicKey = (function() { + + /** + * Properties of a PublicKey. + * @memberof tendermint.crypto + * @interface IPublicKey + * @property {Uint8Array|null} [ed25519] PublicKey ed25519 + * @property {Uint8Array|null} [secp256k1] PublicKey secp256k1 + */ + + /** + * Constructs a new PublicKey. + * @memberof tendermint.crypto + * @classdesc Represents a PublicKey. + * @implements IPublicKey + * @constructor + * @param {tendermint.crypto.IPublicKey=} [properties] Properties to set + */ + function PublicKey(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PublicKey ed25519. + * @member {Uint8Array} ed25519 + * @memberof tendermint.crypto.PublicKey + * @instance + */ + PublicKey.prototype.ed25519 = $util.newBuffer([]); + + /** + * PublicKey secp256k1. + * @member {Uint8Array} secp256k1 + * @memberof tendermint.crypto.PublicKey + * @instance + */ + PublicKey.prototype.secp256k1 = $util.newBuffer([]); + + // OneOf field names bound to virtual getters and setters + let $oneOfFields; + + /** + * PublicKey sum. + * @member {"ed25519"|"secp256k1"|undefined} sum + * @memberof tendermint.crypto.PublicKey + * @instance + */ + Object.defineProperty(PublicKey.prototype, "sum", { + get: $util.oneOfGetter($oneOfFields = ["ed25519", "secp256k1"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Encodes the specified PublicKey message. Does not implicitly {@link tendermint.crypto.PublicKey.verify|verify} messages. + * @function encode + * @memberof tendermint.crypto.PublicKey + * @static + * @param {tendermint.crypto.IPublicKey} message PublicKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PublicKey.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ed25519 != null && Object.hasOwnProperty.call(message, "ed25519")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.ed25519); + if (message.secp256k1 != null && Object.hasOwnProperty.call(message, "secp256k1")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.secp256k1); + return writer; + }; + + /** + * Encodes the specified PublicKey message, length delimited. Does not implicitly {@link tendermint.crypto.PublicKey.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.crypto.PublicKey + * @static + * @param {tendermint.crypto.IPublicKey} message PublicKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PublicKey.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PublicKey message from the specified reader or buffer. + * @function decode + * @memberof tendermint.crypto.PublicKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.crypto.PublicKey} PublicKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PublicKey.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.crypto.PublicKey(); + while (reader.pos < end) { + let 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; + }; + + /** + * Decodes a PublicKey message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.crypto.PublicKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.crypto.PublicKey} PublicKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PublicKey.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PublicKey message. + * @function verify + * @memberof tendermint.crypto.PublicKey + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PublicKey.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + let properties = {}; + if (message.ed25519 != null && message.hasOwnProperty("ed25519")) { + properties.sum = 1; + if (!(message.ed25519 && typeof message.ed25519.length === "number" || $util.isString(message.ed25519))) + return "ed25519: buffer expected"; + } + if (message.secp256k1 != null && message.hasOwnProperty("secp256k1")) { + if (properties.sum === 1) + return "sum: multiple values"; + properties.sum = 1; + if (!(message.secp256k1 && typeof message.secp256k1.length === "number" || $util.isString(message.secp256k1))) + return "secp256k1: buffer expected"; + } + return null; + }; + + /** + * Creates a PublicKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.crypto.PublicKey + * @static + * @param {Object.} object Plain object + * @returns {tendermint.crypto.PublicKey} PublicKey + */ + PublicKey.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.crypto.PublicKey) + return object; + let message = new $root.tendermint.crypto.PublicKey(); + if (object.ed25519 != null) + if (typeof object.ed25519 === "string") + $util.base64.decode(object.ed25519, message.ed25519 = $util.newBuffer($util.base64.length(object.ed25519)), 0); + else if (object.ed25519.length) + message.ed25519 = object.ed25519; + if (object.secp256k1 != null) + if (typeof object.secp256k1 === "string") + $util.base64.decode(object.secp256k1, message.secp256k1 = $util.newBuffer($util.base64.length(object.secp256k1)), 0); + else if (object.secp256k1.length) + message.secp256k1 = object.secp256k1; + return message; + }; + + /** + * Creates a plain object from a PublicKey message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.crypto.PublicKey + * @static + * @param {tendermint.crypto.PublicKey} message PublicKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PublicKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (message.ed25519 != null && message.hasOwnProperty("ed25519")) { + object.ed25519 = options.bytes === String ? $util.base64.encode(message.ed25519, 0, message.ed25519.length) : options.bytes === Array ? Array.prototype.slice.call(message.ed25519) : message.ed25519; + if (options.oneofs) + object.sum = "ed25519"; + } + if (message.secp256k1 != null && message.hasOwnProperty("secp256k1")) { + object.secp256k1 = options.bytes === String ? $util.base64.encode(message.secp256k1, 0, message.secp256k1.length) : options.bytes === Array ? Array.prototype.slice.call(message.secp256k1) : message.secp256k1; + if (options.oneofs) + object.sum = "secp256k1"; + } + return object; + }; + + /** + * Converts this PublicKey to JSON. + * @function toJSON + * @memberof tendermint.crypto.PublicKey + * @instance + * @returns {Object.} JSON object + */ + PublicKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PublicKey; + })(); + + return crypto; + })(); + + tendermint.libs = (function() { + + /** + * Namespace libs. + * @memberof tendermint + * @namespace + */ + const libs = {}; + + libs.bits = (function() { + + /** + * Namespace bits. + * @memberof tendermint.libs + * @namespace + */ + const bits = {}; + + bits.BitArray = (function() { + + /** + * Properties of a BitArray. + * @memberof tendermint.libs.bits + * @interface IBitArray + * @property {Long|null} [bits] BitArray bits + * @property {Array.|null} [elems] BitArray elems + */ + + /** + * Constructs a new BitArray. + * @memberof tendermint.libs.bits + * @classdesc Represents a BitArray. + * @implements IBitArray + * @constructor + * @param {tendermint.libs.bits.IBitArray=} [properties] Properties to set + */ + function BitArray(properties) { + this.elems = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BitArray bits. + * @member {Long} bits + * @memberof tendermint.libs.bits.BitArray + * @instance + */ + BitArray.prototype.bits = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BitArray elems. + * @member {Array.} elems + * @memberof tendermint.libs.bits.BitArray + * @instance + */ + BitArray.prototype.elems = $util.emptyArray; + + /** + * Encodes the specified BitArray message. Does not implicitly {@link tendermint.libs.bits.BitArray.verify|verify} messages. + * @function encode + * @memberof tendermint.libs.bits.BitArray + * @static + * @param {tendermint.libs.bits.IBitArray} message BitArray message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BitArray.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.bits != null && Object.hasOwnProperty.call(message, "bits")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.bits); + if (message.elems != null && message.elems.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (let i = 0; i < message.elems.length; ++i) + writer.uint64(message.elems[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified BitArray message, length delimited. Does not implicitly {@link tendermint.libs.bits.BitArray.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.libs.bits.BitArray + * @static + * @param {tendermint.libs.bits.IBitArray} message BitArray message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BitArray.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BitArray message from the specified reader or buffer. + * @function decode + * @memberof tendermint.libs.bits.BitArray + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.libs.bits.BitArray} BitArray + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BitArray.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.libs.bits.BitArray(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bits = reader.int64(); + break; + case 2: + if (!(message.elems && message.elems.length)) + message.elems = []; + if ((tag & 7) === 2) { + let end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.elems.push(reader.uint64()); + } else + message.elems.push(reader.uint64()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BitArray message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.libs.bits.BitArray + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.libs.bits.BitArray} BitArray + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BitArray.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BitArray message. + * @function verify + * @memberof tendermint.libs.bits.BitArray + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BitArray.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.bits != null && message.hasOwnProperty("bits")) + if (!$util.isInteger(message.bits) && !(message.bits && $util.isInteger(message.bits.low) && $util.isInteger(message.bits.high))) + return "bits: integer|Long expected"; + if (message.elems != null && message.hasOwnProperty("elems")) { + if (!Array.isArray(message.elems)) + return "elems: array expected"; + for (let i = 0; i < message.elems.length; ++i) + if (!$util.isInteger(message.elems[i]) && !(message.elems[i] && $util.isInteger(message.elems[i].low) && $util.isInteger(message.elems[i].high))) + return "elems: integer|Long[] expected"; + } + return null; + }; + + /** + * Creates a BitArray message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.libs.bits.BitArray + * @static + * @param {Object.} object Plain object + * @returns {tendermint.libs.bits.BitArray} BitArray + */ + BitArray.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.libs.bits.BitArray) + return object; + let message = new $root.tendermint.libs.bits.BitArray(); + if (object.bits != null) + if ($util.Long) + (message.bits = $util.Long.fromValue(object.bits)).unsigned = false; + else if (typeof object.bits === "string") + message.bits = parseInt(object.bits, 10); + else if (typeof object.bits === "number") + message.bits = object.bits; + else if (typeof object.bits === "object") + message.bits = new $util.LongBits(object.bits.low >>> 0, object.bits.high >>> 0).toNumber(); + if (object.elems) { + if (!Array.isArray(object.elems)) + throw TypeError(".tendermint.libs.bits.BitArray.elems: array expected"); + message.elems = []; + for (let i = 0; i < object.elems.length; ++i) + if ($util.Long) + (message.elems[i] = $util.Long.fromValue(object.elems[i])).unsigned = true; + else if (typeof object.elems[i] === "string") + message.elems[i] = parseInt(object.elems[i], 10); + else if (typeof object.elems[i] === "number") + message.elems[i] = object.elems[i]; + else if (typeof object.elems[i] === "object") + message.elems[i] = new $util.LongBits(object.elems[i].low >>> 0, object.elems[i].high >>> 0).toNumber(true); + } + return message; + }; + + /** + * Creates a plain object from a BitArray message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.libs.bits.BitArray + * @static + * @param {tendermint.libs.bits.BitArray} message BitArray + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BitArray.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.elems = []; + if (options.defaults) + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.bits = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.bits = options.longs === String ? "0" : 0; + if (message.bits != null && message.hasOwnProperty("bits")) + if (typeof message.bits === "number") + object.bits = options.longs === String ? String(message.bits) : message.bits; + else + object.bits = options.longs === String ? $util.Long.prototype.toString.call(message.bits) : options.longs === Number ? new $util.LongBits(message.bits.low >>> 0, message.bits.high >>> 0).toNumber() : message.bits; + if (message.elems && message.elems.length) { + object.elems = []; + for (let j = 0; j < message.elems.length; ++j) + if (typeof message.elems[j] === "number") + object.elems[j] = options.longs === String ? String(message.elems[j]) : message.elems[j]; + else + object.elems[j] = options.longs === String ? $util.Long.prototype.toString.call(message.elems[j]) : options.longs === Number ? new $util.LongBits(message.elems[j].low >>> 0, message.elems[j].high >>> 0).toNumber(true) : message.elems[j]; + } + return object; + }; + + /** + * Converts this BitArray to JSON. + * @function toJSON + * @memberof tendermint.libs.bits.BitArray + * @instance + * @returns {Object.} JSON object + */ + BitArray.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BitArray; + })(); + + return bits; + })(); + + return libs; + })(); + + tendermint.p2p = (function() { + + /** + * Namespace p2p. + * @memberof tendermint + * @namespace + */ + const p2p = {}; + + p2p.NetAddress = (function() { + + /** + * Properties of a NetAddress. + * @memberof tendermint.p2p + * @interface INetAddress + * @property {string|null} [id] NetAddress id + * @property {string|null} [ip] NetAddress ip + * @property {number|null} [port] NetAddress port + */ + + /** + * Constructs a new NetAddress. + * @memberof tendermint.p2p + * @classdesc Represents a NetAddress. + * @implements INetAddress + * @constructor + * @param {tendermint.p2p.INetAddress=} [properties] Properties to set + */ + function NetAddress(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NetAddress id. + * @member {string} id + * @memberof tendermint.p2p.NetAddress + * @instance + */ + NetAddress.prototype.id = ""; + + /** + * NetAddress ip. + * @member {string} ip + * @memberof tendermint.p2p.NetAddress + * @instance + */ + NetAddress.prototype.ip = ""; + + /** + * NetAddress port. + * @member {number} port + * @memberof tendermint.p2p.NetAddress + * @instance + */ + NetAddress.prototype.port = 0; + + /** + * Encodes the specified NetAddress message. Does not implicitly {@link tendermint.p2p.NetAddress.verify|verify} messages. + * @function encode + * @memberof tendermint.p2p.NetAddress + * @static + * @param {tendermint.p2p.INetAddress} message NetAddress message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NetAddress.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.ip != null && Object.hasOwnProperty.call(message, "ip")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.ip); + if (message.port != null && Object.hasOwnProperty.call(message, "port")) + writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.port); + return writer; + }; + + /** + * Encodes the specified NetAddress message, length delimited. Does not implicitly {@link tendermint.p2p.NetAddress.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.p2p.NetAddress + * @static + * @param {tendermint.p2p.INetAddress} message NetAddress message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NetAddress.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NetAddress message from the specified reader or buffer. + * @function decode + * @memberof tendermint.p2p.NetAddress + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.p2p.NetAddress} NetAddress + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NetAddress.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.p2p.NetAddress(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.ip = reader.string(); + break; + case 3: + message.port = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NetAddress message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.p2p.NetAddress + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.p2p.NetAddress} NetAddress + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NetAddress.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NetAddress message. + * @function verify + * @memberof tendermint.p2p.NetAddress + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NetAddress.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.ip != null && message.hasOwnProperty("ip")) + if (!$util.isString(message.ip)) + return "ip: string expected"; + if (message.port != null && message.hasOwnProperty("port")) + if (!$util.isInteger(message.port)) + return "port: integer expected"; + return null; + }; + + /** + * Creates a NetAddress message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.p2p.NetAddress + * @static + * @param {Object.} object Plain object + * @returns {tendermint.p2p.NetAddress} NetAddress + */ + NetAddress.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.p2p.NetAddress) + return object; + let message = new $root.tendermint.p2p.NetAddress(); + if (object.id != null) + message.id = String(object.id); + if (object.ip != null) + message.ip = String(object.ip); + if (object.port != null) + message.port = object.port >>> 0; + return message; + }; + + /** + * Creates a plain object from a NetAddress message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.p2p.NetAddress + * @static + * @param {tendermint.p2p.NetAddress} message NetAddress + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NetAddress.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.id = ""; + object.ip = ""; + object.port = 0; + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.ip != null && message.hasOwnProperty("ip")) + object.ip = message.ip; + if (message.port != null && message.hasOwnProperty("port")) + object.port = message.port; + return object; + }; + + /** + * Converts this NetAddress to JSON. + * @function toJSON + * @memberof tendermint.p2p.NetAddress + * @instance + * @returns {Object.} JSON object + */ + NetAddress.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return NetAddress; + })(); + + p2p.ProtocolVersion = (function() { + + /** + * Properties of a ProtocolVersion. + * @memberof tendermint.p2p + * @interface IProtocolVersion + * @property {Long|null} [p2p] ProtocolVersion p2p + * @property {Long|null} [block] ProtocolVersion block + * @property {Long|null} [app] ProtocolVersion app + */ + + /** + * Constructs a new ProtocolVersion. + * @memberof tendermint.p2p + * @classdesc Represents a ProtocolVersion. + * @implements IProtocolVersion + * @constructor + * @param {tendermint.p2p.IProtocolVersion=} [properties] Properties to set + */ + function ProtocolVersion(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProtocolVersion p2p. + * @member {Long} p2p + * @memberof tendermint.p2p.ProtocolVersion + * @instance + */ + ProtocolVersion.prototype.p2p = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * ProtocolVersion block. + * @member {Long} block + * @memberof tendermint.p2p.ProtocolVersion + * @instance + */ + ProtocolVersion.prototype.block = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * ProtocolVersion app. + * @member {Long} app + * @memberof tendermint.p2p.ProtocolVersion + * @instance + */ + ProtocolVersion.prototype.app = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified ProtocolVersion message. Does not implicitly {@link tendermint.p2p.ProtocolVersion.verify|verify} messages. + * @function encode + * @memberof tendermint.p2p.ProtocolVersion + * @static + * @param {tendermint.p2p.IProtocolVersion} message ProtocolVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProtocolVersion.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.p2p != null && Object.hasOwnProperty.call(message, "p2p")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.p2p); + if (message.block != null && Object.hasOwnProperty.call(message, "block")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.block); + if (message.app != null && Object.hasOwnProperty.call(message, "app")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.app); + return writer; + }; + + /** + * Encodes the specified ProtocolVersion message, length delimited. Does not implicitly {@link tendermint.p2p.ProtocolVersion.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.p2p.ProtocolVersion + * @static + * @param {tendermint.p2p.IProtocolVersion} message ProtocolVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProtocolVersion.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProtocolVersion message from the specified reader or buffer. + * @function decode + * @memberof tendermint.p2p.ProtocolVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.p2p.ProtocolVersion} ProtocolVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProtocolVersion.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.p2p.ProtocolVersion(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.p2p = reader.uint64(); + break; + case 2: + message.block = reader.uint64(); + break; + case 3: + message.app = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProtocolVersion message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.p2p.ProtocolVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.p2p.ProtocolVersion} ProtocolVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProtocolVersion.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProtocolVersion message. + * @function verify + * @memberof tendermint.p2p.ProtocolVersion + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProtocolVersion.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.p2p != null && message.hasOwnProperty("p2p")) + if (!$util.isInteger(message.p2p) && !(message.p2p && $util.isInteger(message.p2p.low) && $util.isInteger(message.p2p.high))) + return "p2p: integer|Long expected"; + if (message.block != null && message.hasOwnProperty("block")) + if (!$util.isInteger(message.block) && !(message.block && $util.isInteger(message.block.low) && $util.isInteger(message.block.high))) + return "block: integer|Long expected"; + if (message.app != null && message.hasOwnProperty("app")) + if (!$util.isInteger(message.app) && !(message.app && $util.isInteger(message.app.low) && $util.isInteger(message.app.high))) + return "app: integer|Long expected"; + return null; + }; + + /** + * Creates a ProtocolVersion message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.p2p.ProtocolVersion + * @static + * @param {Object.} object Plain object + * @returns {tendermint.p2p.ProtocolVersion} ProtocolVersion + */ + ProtocolVersion.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.p2p.ProtocolVersion) + return object; + let message = new $root.tendermint.p2p.ProtocolVersion(); + if (object.p2p != null) + if ($util.Long) + (message.p2p = $util.Long.fromValue(object.p2p)).unsigned = true; + else if (typeof object.p2p === "string") + message.p2p = parseInt(object.p2p, 10); + else if (typeof object.p2p === "number") + message.p2p = object.p2p; + else if (typeof object.p2p === "object") + message.p2p = new $util.LongBits(object.p2p.low >>> 0, object.p2p.high >>> 0).toNumber(true); + if (object.block != null) + if ($util.Long) + (message.block = $util.Long.fromValue(object.block)).unsigned = true; + else if (typeof object.block === "string") + message.block = parseInt(object.block, 10); + else if (typeof object.block === "number") + message.block = object.block; + else if (typeof object.block === "object") + message.block = new $util.LongBits(object.block.low >>> 0, object.block.high >>> 0).toNumber(true); + if (object.app != null) + if ($util.Long) + (message.app = $util.Long.fromValue(object.app)).unsigned = true; + else if (typeof object.app === "string") + message.app = parseInt(object.app, 10); + else if (typeof object.app === "number") + message.app = object.app; + else if (typeof object.app === "object") + message.app = new $util.LongBits(object.app.low >>> 0, object.app.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a ProtocolVersion message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.p2p.ProtocolVersion + * @static + * @param {tendermint.p2p.ProtocolVersion} message ProtocolVersion + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProtocolVersion.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.p2p = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.p2p = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.block = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.block = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.app = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.app = options.longs === String ? "0" : 0; + } + if (message.p2p != null && message.hasOwnProperty("p2p")) + if (typeof message.p2p === "number") + object.p2p = options.longs === String ? String(message.p2p) : message.p2p; + else + object.p2p = options.longs === String ? $util.Long.prototype.toString.call(message.p2p) : options.longs === Number ? new $util.LongBits(message.p2p.low >>> 0, message.p2p.high >>> 0).toNumber(true) : message.p2p; + if (message.block != null && message.hasOwnProperty("block")) + if (typeof message.block === "number") + object.block = options.longs === String ? String(message.block) : message.block; + else + object.block = options.longs === String ? $util.Long.prototype.toString.call(message.block) : options.longs === Number ? new $util.LongBits(message.block.low >>> 0, message.block.high >>> 0).toNumber(true) : message.block; + if (message.app != null && message.hasOwnProperty("app")) + if (typeof message.app === "number") + object.app = options.longs === String ? String(message.app) : message.app; + else + object.app = options.longs === String ? $util.Long.prototype.toString.call(message.app) : options.longs === Number ? new $util.LongBits(message.app.low >>> 0, message.app.high >>> 0).toNumber(true) : message.app; + return object; + }; + + /** + * Converts this ProtocolVersion to JSON. + * @function toJSON + * @memberof tendermint.p2p.ProtocolVersion + * @instance + * @returns {Object.} JSON object + */ + ProtocolVersion.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProtocolVersion; + })(); + + p2p.DefaultNodeInfo = (function() { + + /** + * Properties of a DefaultNodeInfo. + * @memberof tendermint.p2p + * @interface IDefaultNodeInfo + * @property {tendermint.p2p.IProtocolVersion|null} [protocol_version] DefaultNodeInfo protocol_version + * @property {string|null} [default_node_id] DefaultNodeInfo default_node_id + * @property {string|null} [listen_addr] DefaultNodeInfo listen_addr + * @property {string|null} [network] DefaultNodeInfo network + * @property {string|null} [version] DefaultNodeInfo version + * @property {Uint8Array|null} [channels] DefaultNodeInfo channels + * @property {string|null} [moniker] DefaultNodeInfo moniker + * @property {tendermint.p2p.IDefaultNodeInfoOther|null} [other] DefaultNodeInfo other + */ + + /** + * Constructs a new DefaultNodeInfo. + * @memberof tendermint.p2p + * @classdesc Represents a DefaultNodeInfo. + * @implements IDefaultNodeInfo + * @constructor + * @param {tendermint.p2p.IDefaultNodeInfo=} [properties] Properties to set + */ + function DefaultNodeInfo(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DefaultNodeInfo protocol_version. + * @member {tendermint.p2p.IProtocolVersion|null|undefined} protocol_version + * @memberof tendermint.p2p.DefaultNodeInfo + * @instance + */ + DefaultNodeInfo.prototype.protocol_version = null; + + /** + * DefaultNodeInfo default_node_id. + * @member {string} default_node_id + * @memberof tendermint.p2p.DefaultNodeInfo + * @instance + */ + DefaultNodeInfo.prototype.default_node_id = ""; + + /** + * DefaultNodeInfo listen_addr. + * @member {string} listen_addr + * @memberof tendermint.p2p.DefaultNodeInfo + * @instance + */ + DefaultNodeInfo.prototype.listen_addr = ""; + + /** + * DefaultNodeInfo network. + * @member {string} network + * @memberof tendermint.p2p.DefaultNodeInfo + * @instance + */ + DefaultNodeInfo.prototype.network = ""; + + /** + * DefaultNodeInfo version. + * @member {string} version + * @memberof tendermint.p2p.DefaultNodeInfo + * @instance + */ + DefaultNodeInfo.prototype.version = ""; + + /** + * DefaultNodeInfo channels. + * @member {Uint8Array} channels + * @memberof tendermint.p2p.DefaultNodeInfo + * @instance + */ + DefaultNodeInfo.prototype.channels = $util.newBuffer([]); + + /** + * DefaultNodeInfo moniker. + * @member {string} moniker + * @memberof tendermint.p2p.DefaultNodeInfo + * @instance + */ + DefaultNodeInfo.prototype.moniker = ""; + + /** + * DefaultNodeInfo other. + * @member {tendermint.p2p.IDefaultNodeInfoOther|null|undefined} other + * @memberof tendermint.p2p.DefaultNodeInfo + * @instance + */ + DefaultNodeInfo.prototype.other = null; + + /** + * Encodes the specified DefaultNodeInfo message. Does not implicitly {@link tendermint.p2p.DefaultNodeInfo.verify|verify} messages. + * @function encode + * @memberof tendermint.p2p.DefaultNodeInfo + * @static + * @param {tendermint.p2p.IDefaultNodeInfo} message DefaultNodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DefaultNodeInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.protocol_version != null && Object.hasOwnProperty.call(message, "protocol_version")) + $root.tendermint.p2p.ProtocolVersion.encode(message.protocol_version, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.default_node_id != null && Object.hasOwnProperty.call(message, "default_node_id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.default_node_id); + if (message.listen_addr != null && Object.hasOwnProperty.call(message, "listen_addr")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.listen_addr); + if (message.network != null && Object.hasOwnProperty.call(message, "network")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.network); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.version); + if (message.channels != null && Object.hasOwnProperty.call(message, "channels")) + writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.channels); + if (message.moniker != null && Object.hasOwnProperty.call(message, "moniker")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.moniker); + if (message.other != null && Object.hasOwnProperty.call(message, "other")) + $root.tendermint.p2p.DefaultNodeInfoOther.encode(message.other, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DefaultNodeInfo message, length delimited. Does not implicitly {@link tendermint.p2p.DefaultNodeInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.p2p.DefaultNodeInfo + * @static + * @param {tendermint.p2p.IDefaultNodeInfo} message DefaultNodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DefaultNodeInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DefaultNodeInfo message from the specified reader or buffer. + * @function decode + * @memberof tendermint.p2p.DefaultNodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.p2p.DefaultNodeInfo} DefaultNodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DefaultNodeInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.p2p.DefaultNodeInfo(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.protocol_version = $root.tendermint.p2p.ProtocolVersion.decode(reader, reader.uint32()); + break; + case 2: + message.default_node_id = reader.string(); + break; + case 3: + message.listen_addr = reader.string(); + break; + case 4: + message.network = reader.string(); + break; + case 5: + message.version = reader.string(); + break; + case 6: + message.channels = reader.bytes(); + break; + case 7: + message.moniker = reader.string(); + break; + case 8: + message.other = $root.tendermint.p2p.DefaultNodeInfoOther.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DefaultNodeInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.p2p.DefaultNodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.p2p.DefaultNodeInfo} DefaultNodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DefaultNodeInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DefaultNodeInfo message. + * @function verify + * @memberof tendermint.p2p.DefaultNodeInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DefaultNodeInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.protocol_version != null && message.hasOwnProperty("protocol_version")) { + let error = $root.tendermint.p2p.ProtocolVersion.verify(message.protocol_version); + if (error) + return "protocol_version." + error; + } + if (message.default_node_id != null && message.hasOwnProperty("default_node_id")) + if (!$util.isString(message.default_node_id)) + return "default_node_id: string expected"; + if (message.listen_addr != null && message.hasOwnProperty("listen_addr")) + if (!$util.isString(message.listen_addr)) + return "listen_addr: string expected"; + if (message.network != null && message.hasOwnProperty("network")) + if (!$util.isString(message.network)) + return "network: string expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + if (message.channels != null && message.hasOwnProperty("channels")) + if (!(message.channels && typeof message.channels.length === "number" || $util.isString(message.channels))) + return "channels: buffer expected"; + if (message.moniker != null && message.hasOwnProperty("moniker")) + if (!$util.isString(message.moniker)) + return "moniker: string expected"; + if (message.other != null && message.hasOwnProperty("other")) { + let error = $root.tendermint.p2p.DefaultNodeInfoOther.verify(message.other); + if (error) + return "other." + error; + } + return null; + }; + + /** + * Creates a DefaultNodeInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.p2p.DefaultNodeInfo + * @static + * @param {Object.} object Plain object + * @returns {tendermint.p2p.DefaultNodeInfo} DefaultNodeInfo + */ + DefaultNodeInfo.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.p2p.DefaultNodeInfo) + return object; + let message = new $root.tendermint.p2p.DefaultNodeInfo(); + if (object.protocol_version != null) { + if (typeof object.protocol_version !== "object") + throw TypeError(".tendermint.p2p.DefaultNodeInfo.protocol_version: object expected"); + message.protocol_version = $root.tendermint.p2p.ProtocolVersion.fromObject(object.protocol_version); + } + if (object.default_node_id != null) + message.default_node_id = String(object.default_node_id); + if (object.listen_addr != null) + message.listen_addr = String(object.listen_addr); + if (object.network != null) + message.network = String(object.network); + if (object.version != null) + message.version = String(object.version); + if (object.channels != null) + if (typeof object.channels === "string") + $util.base64.decode(object.channels, message.channels = $util.newBuffer($util.base64.length(object.channels)), 0); + else if (object.channels.length) + message.channels = object.channels; + if (object.moniker != null) + message.moniker = String(object.moniker); + if (object.other != null) { + if (typeof object.other !== "object") + throw TypeError(".tendermint.p2p.DefaultNodeInfo.other: object expected"); + message.other = $root.tendermint.p2p.DefaultNodeInfoOther.fromObject(object.other); + } + return message; + }; + + /** + * Creates a plain object from a DefaultNodeInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.p2p.DefaultNodeInfo + * @static + * @param {tendermint.p2p.DefaultNodeInfo} message DefaultNodeInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DefaultNodeInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.protocol_version = null; + object.default_node_id = ""; + object.listen_addr = ""; + object.network = ""; + object.version = ""; + if (options.bytes === String) + object.channels = ""; + else { + object.channels = []; + if (options.bytes !== Array) + object.channels = $util.newBuffer(object.channels); + } + object.moniker = ""; + object.other = null; + } + if (message.protocol_version != null && message.hasOwnProperty("protocol_version")) + object.protocol_version = $root.tendermint.p2p.ProtocolVersion.toObject(message.protocol_version, options); + if (message.default_node_id != null && message.hasOwnProperty("default_node_id")) + object.default_node_id = message.default_node_id; + if (message.listen_addr != null && message.hasOwnProperty("listen_addr")) + object.listen_addr = message.listen_addr; + if (message.network != null && message.hasOwnProperty("network")) + object.network = message.network; + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + if (message.channels != null && message.hasOwnProperty("channels")) + object.channels = options.bytes === String ? $util.base64.encode(message.channels, 0, message.channels.length) : options.bytes === Array ? Array.prototype.slice.call(message.channels) : message.channels; + if (message.moniker != null && message.hasOwnProperty("moniker")) + object.moniker = message.moniker; + if (message.other != null && message.hasOwnProperty("other")) + object.other = $root.tendermint.p2p.DefaultNodeInfoOther.toObject(message.other, options); + return object; + }; + + /** + * Converts this DefaultNodeInfo to JSON. + * @function toJSON + * @memberof tendermint.p2p.DefaultNodeInfo + * @instance + * @returns {Object.} JSON object + */ + DefaultNodeInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DefaultNodeInfo; + })(); + + p2p.DefaultNodeInfoOther = (function() { + + /** + * Properties of a DefaultNodeInfoOther. + * @memberof tendermint.p2p + * @interface IDefaultNodeInfoOther + * @property {string|null} [tx_index] DefaultNodeInfoOther tx_index + * @property {string|null} [rpc_address] DefaultNodeInfoOther rpc_address + */ + + /** + * Constructs a new DefaultNodeInfoOther. + * @memberof tendermint.p2p + * @classdesc Represents a DefaultNodeInfoOther. + * @implements IDefaultNodeInfoOther + * @constructor + * @param {tendermint.p2p.IDefaultNodeInfoOther=} [properties] Properties to set + */ + function DefaultNodeInfoOther(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DefaultNodeInfoOther tx_index. + * @member {string} tx_index + * @memberof tendermint.p2p.DefaultNodeInfoOther + * @instance + */ + DefaultNodeInfoOther.prototype.tx_index = ""; + + /** + * DefaultNodeInfoOther rpc_address. + * @member {string} rpc_address + * @memberof tendermint.p2p.DefaultNodeInfoOther + * @instance + */ + DefaultNodeInfoOther.prototype.rpc_address = ""; + + /** + * Encodes the specified DefaultNodeInfoOther message. Does not implicitly {@link tendermint.p2p.DefaultNodeInfoOther.verify|verify} messages. + * @function encode + * @memberof tendermint.p2p.DefaultNodeInfoOther + * @static + * @param {tendermint.p2p.IDefaultNodeInfoOther} message DefaultNodeInfoOther message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DefaultNodeInfoOther.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.tx_index != null && Object.hasOwnProperty.call(message, "tx_index")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.tx_index); + if (message.rpc_address != null && Object.hasOwnProperty.call(message, "rpc_address")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.rpc_address); + return writer; + }; + + /** + * Encodes the specified DefaultNodeInfoOther message, length delimited. Does not implicitly {@link tendermint.p2p.DefaultNodeInfoOther.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.p2p.DefaultNodeInfoOther + * @static + * @param {tendermint.p2p.IDefaultNodeInfoOther} message DefaultNodeInfoOther message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DefaultNodeInfoOther.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DefaultNodeInfoOther message from the specified reader or buffer. + * @function decode + * @memberof tendermint.p2p.DefaultNodeInfoOther + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.p2p.DefaultNodeInfoOther} DefaultNodeInfoOther + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DefaultNodeInfoOther.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.p2p.DefaultNodeInfoOther(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx_index = reader.string(); + break; + case 2: + message.rpc_address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DefaultNodeInfoOther message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.p2p.DefaultNodeInfoOther + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.p2p.DefaultNodeInfoOther} DefaultNodeInfoOther + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DefaultNodeInfoOther.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DefaultNodeInfoOther message. + * @function verify + * @memberof tendermint.p2p.DefaultNodeInfoOther + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DefaultNodeInfoOther.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.tx_index != null && message.hasOwnProperty("tx_index")) + if (!$util.isString(message.tx_index)) + return "tx_index: string expected"; + if (message.rpc_address != null && message.hasOwnProperty("rpc_address")) + if (!$util.isString(message.rpc_address)) + return "rpc_address: string expected"; + return null; + }; + + /** + * Creates a DefaultNodeInfoOther message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.p2p.DefaultNodeInfoOther + * @static + * @param {Object.} object Plain object + * @returns {tendermint.p2p.DefaultNodeInfoOther} DefaultNodeInfoOther + */ + DefaultNodeInfoOther.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.p2p.DefaultNodeInfoOther) + return object; + let message = new $root.tendermint.p2p.DefaultNodeInfoOther(); + if (object.tx_index != null) + message.tx_index = String(object.tx_index); + if (object.rpc_address != null) + message.rpc_address = String(object.rpc_address); + return message; + }; + + /** + * Creates a plain object from a DefaultNodeInfoOther message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.p2p.DefaultNodeInfoOther + * @static + * @param {tendermint.p2p.DefaultNodeInfoOther} message DefaultNodeInfoOther + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DefaultNodeInfoOther.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.tx_index = ""; + object.rpc_address = ""; + } + if (message.tx_index != null && message.hasOwnProperty("tx_index")) + object.tx_index = message.tx_index; + if (message.rpc_address != null && message.hasOwnProperty("rpc_address")) + object.rpc_address = message.rpc_address; + return object; + }; + + /** + * Converts this DefaultNodeInfoOther to JSON. + * @function toJSON + * @memberof tendermint.p2p.DefaultNodeInfoOther + * @instance + * @returns {Object.} JSON object + */ + DefaultNodeInfoOther.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DefaultNodeInfoOther; + })(); + + return p2p; + })(); + + tendermint.types = (function() { + + /** + * Namespace types. + * @memberof tendermint + * @namespace + */ + const types = {}; + + types.Evidence = (function() { + + /** + * Properties of an Evidence. + * @memberof tendermint.types + * @interface IEvidence + * @property {tendermint.types.IDuplicateVoteEvidence|null} [duplicate_vote_evidence] Evidence duplicate_vote_evidence + * @property {tendermint.types.ILightClientAttackEvidence|null} [light_client_attack_evidence] Evidence light_client_attack_evidence + */ + + /** + * Constructs a new Evidence. + * @memberof tendermint.types + * @classdesc Represents an Evidence. + * @implements IEvidence + * @constructor + * @param {tendermint.types.IEvidence=} [properties] Properties to set + */ + function Evidence(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Evidence duplicate_vote_evidence. + * @member {tendermint.types.IDuplicateVoteEvidence|null|undefined} duplicate_vote_evidence + * @memberof tendermint.types.Evidence + * @instance + */ + Evidence.prototype.duplicate_vote_evidence = null; + + /** + * Evidence light_client_attack_evidence. + * @member {tendermint.types.ILightClientAttackEvidence|null|undefined} light_client_attack_evidence + * @memberof tendermint.types.Evidence + * @instance + */ + Evidence.prototype.light_client_attack_evidence = null; + + // OneOf field names bound to virtual getters and setters + let $oneOfFields; + + /** + * Evidence sum. + * @member {"duplicate_vote_evidence"|"light_client_attack_evidence"|undefined} sum + * @memberof tendermint.types.Evidence + * @instance + */ + Object.defineProperty(Evidence.prototype, "sum", { + get: $util.oneOfGetter($oneOfFields = ["duplicate_vote_evidence", "light_client_attack_evidence"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Encodes the specified Evidence message. Does not implicitly {@link tendermint.types.Evidence.verify|verify} messages. + * @function encode + * @memberof tendermint.types.Evidence + * @static + * @param {tendermint.types.IEvidence} message Evidence message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Evidence.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.duplicate_vote_evidence != null && Object.hasOwnProperty.call(message, "duplicate_vote_evidence")) + $root.tendermint.types.DuplicateVoteEvidence.encode(message.duplicate_vote_evidence, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.light_client_attack_evidence != null && Object.hasOwnProperty.call(message, "light_client_attack_evidence")) + $root.tendermint.types.LightClientAttackEvidence.encode(message.light_client_attack_evidence, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Evidence message, length delimited. Does not implicitly {@link tendermint.types.Evidence.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.types.Evidence + * @static + * @param {tendermint.types.IEvidence} message Evidence message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Evidence.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Evidence message from the specified reader or buffer. + * @function decode + * @memberof tendermint.types.Evidence + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.types.Evidence} Evidence + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Evidence.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.Evidence(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.duplicate_vote_evidence = $root.tendermint.types.DuplicateVoteEvidence.decode(reader, reader.uint32()); + break; + case 2: + message.light_client_attack_evidence = $root.tendermint.types.LightClientAttackEvidence.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Evidence message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.types.Evidence + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.types.Evidence} Evidence + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Evidence.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Evidence message. + * @function verify + * @memberof tendermint.types.Evidence + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Evidence.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + let properties = {}; + if (message.duplicate_vote_evidence != null && message.hasOwnProperty("duplicate_vote_evidence")) { + properties.sum = 1; + { + let error = $root.tendermint.types.DuplicateVoteEvidence.verify(message.duplicate_vote_evidence); + if (error) + return "duplicate_vote_evidence." + error; + } + } + if (message.light_client_attack_evidence != null && message.hasOwnProperty("light_client_attack_evidence")) { + if (properties.sum === 1) + return "sum: multiple values"; + properties.sum = 1; + { + let error = $root.tendermint.types.LightClientAttackEvidence.verify(message.light_client_attack_evidence); + if (error) + return "light_client_attack_evidence." + error; + } + } + return null; + }; + + /** + * Creates an Evidence message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.types.Evidence + * @static + * @param {Object.} object Plain object + * @returns {tendermint.types.Evidence} Evidence + */ + Evidence.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.types.Evidence) + return object; + let message = new $root.tendermint.types.Evidence(); + if (object.duplicate_vote_evidence != null) { + if (typeof object.duplicate_vote_evidence !== "object") + throw TypeError(".tendermint.types.Evidence.duplicate_vote_evidence: object expected"); + message.duplicate_vote_evidence = $root.tendermint.types.DuplicateVoteEvidence.fromObject(object.duplicate_vote_evidence); + } + if (object.light_client_attack_evidence != null) { + if (typeof object.light_client_attack_evidence !== "object") + throw TypeError(".tendermint.types.Evidence.light_client_attack_evidence: object expected"); + message.light_client_attack_evidence = $root.tendermint.types.LightClientAttackEvidence.fromObject(object.light_client_attack_evidence); + } + return message; + }; + + /** + * Creates a plain object from an Evidence message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.types.Evidence + * @static + * @param {tendermint.types.Evidence} message Evidence + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Evidence.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (message.duplicate_vote_evidence != null && message.hasOwnProperty("duplicate_vote_evidence")) { + object.duplicate_vote_evidence = $root.tendermint.types.DuplicateVoteEvidence.toObject(message.duplicate_vote_evidence, options); + if (options.oneofs) + object.sum = "duplicate_vote_evidence"; + } + if (message.light_client_attack_evidence != null && message.hasOwnProperty("light_client_attack_evidence")) { + object.light_client_attack_evidence = $root.tendermint.types.LightClientAttackEvidence.toObject(message.light_client_attack_evidence, options); + if (options.oneofs) + object.sum = "light_client_attack_evidence"; + } + return object; + }; + + /** + * Converts this Evidence to JSON. + * @function toJSON + * @memberof tendermint.types.Evidence + * @instance + * @returns {Object.} JSON object + */ + Evidence.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Evidence; + })(); + + types.DuplicateVoteEvidence = (function() { + + /** + * Properties of a DuplicateVoteEvidence. + * @memberof tendermint.types + * @interface IDuplicateVoteEvidence + * @property {tendermint.types.IVote|null} [vote_a] DuplicateVoteEvidence vote_a + * @property {tendermint.types.IVote|null} [vote_b] DuplicateVoteEvidence vote_b + * @property {Long|null} [total_voting_power] DuplicateVoteEvidence total_voting_power + * @property {Long|null} [validator_power] DuplicateVoteEvidence validator_power + * @property {google.protobuf.ITimestamp|null} [timestamp] DuplicateVoteEvidence timestamp + */ + + /** + * Constructs a new DuplicateVoteEvidence. + * @memberof tendermint.types + * @classdesc Represents a DuplicateVoteEvidence. + * @implements IDuplicateVoteEvidence + * @constructor + * @param {tendermint.types.IDuplicateVoteEvidence=} [properties] Properties to set + */ + function DuplicateVoteEvidence(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DuplicateVoteEvidence vote_a. + * @member {tendermint.types.IVote|null|undefined} vote_a + * @memberof tendermint.types.DuplicateVoteEvidence + * @instance + */ + DuplicateVoteEvidence.prototype.vote_a = null; + + /** + * DuplicateVoteEvidence vote_b. + * @member {tendermint.types.IVote|null|undefined} vote_b + * @memberof tendermint.types.DuplicateVoteEvidence + * @instance + */ + DuplicateVoteEvidence.prototype.vote_b = null; + + /** + * DuplicateVoteEvidence total_voting_power. + * @member {Long} total_voting_power + * @memberof tendermint.types.DuplicateVoteEvidence + * @instance + */ + DuplicateVoteEvidence.prototype.total_voting_power = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * DuplicateVoteEvidence validator_power. + * @member {Long} validator_power + * @memberof tendermint.types.DuplicateVoteEvidence + * @instance + */ + DuplicateVoteEvidence.prototype.validator_power = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * DuplicateVoteEvidence timestamp. + * @member {google.protobuf.ITimestamp|null|undefined} timestamp + * @memberof tendermint.types.DuplicateVoteEvidence + * @instance + */ + DuplicateVoteEvidence.prototype.timestamp = null; + + /** + * Encodes the specified DuplicateVoteEvidence message. Does not implicitly {@link tendermint.types.DuplicateVoteEvidence.verify|verify} messages. + * @function encode + * @memberof tendermint.types.DuplicateVoteEvidence + * @static + * @param {tendermint.types.IDuplicateVoteEvidence} message DuplicateVoteEvidence message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DuplicateVoteEvidence.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.vote_a != null && Object.hasOwnProperty.call(message, "vote_a")) + $root.tendermint.types.Vote.encode(message.vote_a, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.vote_b != null && Object.hasOwnProperty.call(message, "vote_b")) + $root.tendermint.types.Vote.encode(message.vote_b, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.total_voting_power != null && Object.hasOwnProperty.call(message, "total_voting_power")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.total_voting_power); + if (message.validator_power != null && Object.hasOwnProperty.call(message, "validator_power")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.validator_power); + if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) + $root.google.protobuf.Timestamp.encode(message.timestamp, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DuplicateVoteEvidence message, length delimited. Does not implicitly {@link tendermint.types.DuplicateVoteEvidence.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.types.DuplicateVoteEvidence + * @static + * @param {tendermint.types.IDuplicateVoteEvidence} message DuplicateVoteEvidence message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DuplicateVoteEvidence.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DuplicateVoteEvidence message from the specified reader or buffer. + * @function decode + * @memberof tendermint.types.DuplicateVoteEvidence + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.types.DuplicateVoteEvidence} DuplicateVoteEvidence + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DuplicateVoteEvidence.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.DuplicateVoteEvidence(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.vote_a = $root.tendermint.types.Vote.decode(reader, reader.uint32()); + break; + case 2: + message.vote_b = $root.tendermint.types.Vote.decode(reader, reader.uint32()); + break; + case 3: + message.total_voting_power = reader.int64(); + break; + case 4: + message.validator_power = reader.int64(); + break; + case 5: + message.timestamp = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DuplicateVoteEvidence message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.types.DuplicateVoteEvidence + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.types.DuplicateVoteEvidence} DuplicateVoteEvidence + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DuplicateVoteEvidence.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DuplicateVoteEvidence message. + * @function verify + * @memberof tendermint.types.DuplicateVoteEvidence + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DuplicateVoteEvidence.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.vote_a != null && message.hasOwnProperty("vote_a")) { + let error = $root.tendermint.types.Vote.verify(message.vote_a); + if (error) + return "vote_a." + error; + } + if (message.vote_b != null && message.hasOwnProperty("vote_b")) { + let error = $root.tendermint.types.Vote.verify(message.vote_b); + if (error) + return "vote_b." + error; + } + if (message.total_voting_power != null && message.hasOwnProperty("total_voting_power")) + if (!$util.isInteger(message.total_voting_power) && !(message.total_voting_power && $util.isInteger(message.total_voting_power.low) && $util.isInteger(message.total_voting_power.high))) + return "total_voting_power: integer|Long expected"; + if (message.validator_power != null && message.hasOwnProperty("validator_power")) + if (!$util.isInteger(message.validator_power) && !(message.validator_power && $util.isInteger(message.validator_power.low) && $util.isInteger(message.validator_power.high))) + return "validator_power: integer|Long expected"; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) { + let error = $root.google.protobuf.Timestamp.verify(message.timestamp); + if (error) + return "timestamp." + error; + } + return null; + }; + + /** + * Creates a DuplicateVoteEvidence message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.types.DuplicateVoteEvidence + * @static + * @param {Object.} object Plain object + * @returns {tendermint.types.DuplicateVoteEvidence} DuplicateVoteEvidence + */ + DuplicateVoteEvidence.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.types.DuplicateVoteEvidence) + return object; + let message = new $root.tendermint.types.DuplicateVoteEvidence(); + if (object.vote_a != null) { + if (typeof object.vote_a !== "object") + throw TypeError(".tendermint.types.DuplicateVoteEvidence.vote_a: object expected"); + message.vote_a = $root.tendermint.types.Vote.fromObject(object.vote_a); + } + if (object.vote_b != null) { + if (typeof object.vote_b !== "object") + throw TypeError(".tendermint.types.DuplicateVoteEvidence.vote_b: object expected"); + message.vote_b = $root.tendermint.types.Vote.fromObject(object.vote_b); + } + if (object.total_voting_power != null) + if ($util.Long) + (message.total_voting_power = $util.Long.fromValue(object.total_voting_power)).unsigned = false; + else if (typeof object.total_voting_power === "string") + message.total_voting_power = parseInt(object.total_voting_power, 10); + else if (typeof object.total_voting_power === "number") + message.total_voting_power = object.total_voting_power; + else if (typeof object.total_voting_power === "object") + message.total_voting_power = new $util.LongBits(object.total_voting_power.low >>> 0, object.total_voting_power.high >>> 0).toNumber(); + if (object.validator_power != null) + if ($util.Long) + (message.validator_power = $util.Long.fromValue(object.validator_power)).unsigned = false; + else if (typeof object.validator_power === "string") + message.validator_power = parseInt(object.validator_power, 10); + else if (typeof object.validator_power === "number") + message.validator_power = object.validator_power; + else if (typeof object.validator_power === "object") + message.validator_power = new $util.LongBits(object.validator_power.low >>> 0, object.validator_power.high >>> 0).toNumber(); + if (object.timestamp != null) { + if (typeof object.timestamp !== "object") + throw TypeError(".tendermint.types.DuplicateVoteEvidence.timestamp: object expected"); + message.timestamp = $root.google.protobuf.Timestamp.fromObject(object.timestamp); + } + return message; + }; + + /** + * Creates a plain object from a DuplicateVoteEvidence message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.types.DuplicateVoteEvidence + * @static + * @param {tendermint.types.DuplicateVoteEvidence} message DuplicateVoteEvidence + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DuplicateVoteEvidence.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.vote_a = null; + object.vote_b = null; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.total_voting_power = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.total_voting_power = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.validator_power = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.validator_power = options.longs === String ? "0" : 0; + object.timestamp = null; + } + if (message.vote_a != null && message.hasOwnProperty("vote_a")) + object.vote_a = $root.tendermint.types.Vote.toObject(message.vote_a, options); + if (message.vote_b != null && message.hasOwnProperty("vote_b")) + object.vote_b = $root.tendermint.types.Vote.toObject(message.vote_b, options); + if (message.total_voting_power != null && message.hasOwnProperty("total_voting_power")) + if (typeof message.total_voting_power === "number") + object.total_voting_power = options.longs === String ? String(message.total_voting_power) : message.total_voting_power; + else + object.total_voting_power = options.longs === String ? $util.Long.prototype.toString.call(message.total_voting_power) : options.longs === Number ? new $util.LongBits(message.total_voting_power.low >>> 0, message.total_voting_power.high >>> 0).toNumber() : message.total_voting_power; + if (message.validator_power != null && message.hasOwnProperty("validator_power")) + if (typeof message.validator_power === "number") + object.validator_power = options.longs === String ? String(message.validator_power) : message.validator_power; + else + object.validator_power = options.longs === String ? $util.Long.prototype.toString.call(message.validator_power) : options.longs === Number ? new $util.LongBits(message.validator_power.low >>> 0, message.validator_power.high >>> 0).toNumber() : message.validator_power; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + object.timestamp = $root.google.protobuf.Timestamp.toObject(message.timestamp, options); + return object; + }; + + /** + * Converts this DuplicateVoteEvidence to JSON. + * @function toJSON + * @memberof tendermint.types.DuplicateVoteEvidence + * @instance + * @returns {Object.} JSON object + */ + DuplicateVoteEvidence.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DuplicateVoteEvidence; + })(); + + types.LightClientAttackEvidence = (function() { + + /** + * Properties of a LightClientAttackEvidence. + * @memberof tendermint.types + * @interface ILightClientAttackEvidence + * @property {tendermint.types.ILightBlock|null} [conflicting_block] LightClientAttackEvidence conflicting_block + * @property {Long|null} [common_height] LightClientAttackEvidence common_height + * @property {Array.|null} [byzantine_validators] LightClientAttackEvidence byzantine_validators + * @property {Long|null} [total_voting_power] LightClientAttackEvidence total_voting_power + * @property {google.protobuf.ITimestamp|null} [timestamp] LightClientAttackEvidence timestamp + */ + + /** + * Constructs a new LightClientAttackEvidence. + * @memberof tendermint.types + * @classdesc Represents a LightClientAttackEvidence. + * @implements ILightClientAttackEvidence + * @constructor + * @param {tendermint.types.ILightClientAttackEvidence=} [properties] Properties to set + */ + function LightClientAttackEvidence(properties) { + this.byzantine_validators = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LightClientAttackEvidence conflicting_block. + * @member {tendermint.types.ILightBlock|null|undefined} conflicting_block + * @memberof tendermint.types.LightClientAttackEvidence + * @instance + */ + LightClientAttackEvidence.prototype.conflicting_block = null; + + /** + * LightClientAttackEvidence common_height. + * @member {Long} common_height + * @memberof tendermint.types.LightClientAttackEvidence + * @instance + */ + LightClientAttackEvidence.prototype.common_height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * LightClientAttackEvidence byzantine_validators. + * @member {Array.} byzantine_validators + * @memberof tendermint.types.LightClientAttackEvidence + * @instance + */ + LightClientAttackEvidence.prototype.byzantine_validators = $util.emptyArray; + + /** + * LightClientAttackEvidence total_voting_power. + * @member {Long} total_voting_power + * @memberof tendermint.types.LightClientAttackEvidence + * @instance + */ + LightClientAttackEvidence.prototype.total_voting_power = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * LightClientAttackEvidence timestamp. + * @member {google.protobuf.ITimestamp|null|undefined} timestamp + * @memberof tendermint.types.LightClientAttackEvidence + * @instance + */ + LightClientAttackEvidence.prototype.timestamp = null; + + /** + * Encodes the specified LightClientAttackEvidence message. Does not implicitly {@link tendermint.types.LightClientAttackEvidence.verify|verify} messages. + * @function encode + * @memberof tendermint.types.LightClientAttackEvidence + * @static + * @param {tendermint.types.ILightClientAttackEvidence} message LightClientAttackEvidence message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LightClientAttackEvidence.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conflicting_block != null && Object.hasOwnProperty.call(message, "conflicting_block")) + $root.tendermint.types.LightBlock.encode(message.conflicting_block, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.common_height != null && Object.hasOwnProperty.call(message, "common_height")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.common_height); + if (message.byzantine_validators != null && message.byzantine_validators.length) + for (let i = 0; i < message.byzantine_validators.length; ++i) + $root.tendermint.types.Validator.encode(message.byzantine_validators[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.total_voting_power != null && Object.hasOwnProperty.call(message, "total_voting_power")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.total_voting_power); + if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) + $root.google.protobuf.Timestamp.encode(message.timestamp, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified LightClientAttackEvidence message, length delimited. Does not implicitly {@link tendermint.types.LightClientAttackEvidence.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.types.LightClientAttackEvidence + * @static + * @param {tendermint.types.ILightClientAttackEvidence} message LightClientAttackEvidence message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LightClientAttackEvidence.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LightClientAttackEvidence message from the specified reader or buffer. + * @function decode + * @memberof tendermint.types.LightClientAttackEvidence + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.types.LightClientAttackEvidence} LightClientAttackEvidence + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LightClientAttackEvidence.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.LightClientAttackEvidence(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.conflicting_block = $root.tendermint.types.LightBlock.decode(reader, reader.uint32()); + break; + case 2: + message.common_height = reader.int64(); + break; + case 3: + if (!(message.byzantine_validators && message.byzantine_validators.length)) + message.byzantine_validators = []; + message.byzantine_validators.push($root.tendermint.types.Validator.decode(reader, reader.uint32())); + break; + case 4: + message.total_voting_power = reader.int64(); + break; + case 5: + message.timestamp = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LightClientAttackEvidence message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.types.LightClientAttackEvidence + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.types.LightClientAttackEvidence} LightClientAttackEvidence + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LightClientAttackEvidence.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LightClientAttackEvidence message. + * @function verify + * @memberof tendermint.types.LightClientAttackEvidence + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LightClientAttackEvidence.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conflicting_block != null && message.hasOwnProperty("conflicting_block")) { + let error = $root.tendermint.types.LightBlock.verify(message.conflicting_block); + if (error) + return "conflicting_block." + error; + } + if (message.common_height != null && message.hasOwnProperty("common_height")) + if (!$util.isInteger(message.common_height) && !(message.common_height && $util.isInteger(message.common_height.low) && $util.isInteger(message.common_height.high))) + return "common_height: integer|Long expected"; + if (message.byzantine_validators != null && message.hasOwnProperty("byzantine_validators")) { + if (!Array.isArray(message.byzantine_validators)) + return "byzantine_validators: array expected"; + for (let i = 0; i < message.byzantine_validators.length; ++i) { + let error = $root.tendermint.types.Validator.verify(message.byzantine_validators[i]); + if (error) + return "byzantine_validators." + error; + } + } + if (message.total_voting_power != null && message.hasOwnProperty("total_voting_power")) + if (!$util.isInteger(message.total_voting_power) && !(message.total_voting_power && $util.isInteger(message.total_voting_power.low) && $util.isInteger(message.total_voting_power.high))) + return "total_voting_power: integer|Long expected"; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) { + let error = $root.google.protobuf.Timestamp.verify(message.timestamp); + if (error) + return "timestamp." + error; + } + return null; + }; + + /** + * Creates a LightClientAttackEvidence message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.types.LightClientAttackEvidence + * @static + * @param {Object.} object Plain object + * @returns {tendermint.types.LightClientAttackEvidence} LightClientAttackEvidence + */ + LightClientAttackEvidence.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.types.LightClientAttackEvidence) + return object; + let message = new $root.tendermint.types.LightClientAttackEvidence(); + if (object.conflicting_block != null) { + if (typeof object.conflicting_block !== "object") + throw TypeError(".tendermint.types.LightClientAttackEvidence.conflicting_block: object expected"); + message.conflicting_block = $root.tendermint.types.LightBlock.fromObject(object.conflicting_block); + } + if (object.common_height != null) + if ($util.Long) + (message.common_height = $util.Long.fromValue(object.common_height)).unsigned = false; + else if (typeof object.common_height === "string") + message.common_height = parseInt(object.common_height, 10); + else if (typeof object.common_height === "number") + message.common_height = object.common_height; + else if (typeof object.common_height === "object") + message.common_height = new $util.LongBits(object.common_height.low >>> 0, object.common_height.high >>> 0).toNumber(); + if (object.byzantine_validators) { + if (!Array.isArray(object.byzantine_validators)) + throw TypeError(".tendermint.types.LightClientAttackEvidence.byzantine_validators: array expected"); + message.byzantine_validators = []; + for (let i = 0; i < object.byzantine_validators.length; ++i) { + if (typeof object.byzantine_validators[i] !== "object") + throw TypeError(".tendermint.types.LightClientAttackEvidence.byzantine_validators: object expected"); + message.byzantine_validators[i] = $root.tendermint.types.Validator.fromObject(object.byzantine_validators[i]); + } + } + if (object.total_voting_power != null) + if ($util.Long) + (message.total_voting_power = $util.Long.fromValue(object.total_voting_power)).unsigned = false; + else if (typeof object.total_voting_power === "string") + message.total_voting_power = parseInt(object.total_voting_power, 10); + else if (typeof object.total_voting_power === "number") + message.total_voting_power = object.total_voting_power; + else if (typeof object.total_voting_power === "object") + message.total_voting_power = new $util.LongBits(object.total_voting_power.low >>> 0, object.total_voting_power.high >>> 0).toNumber(); + if (object.timestamp != null) { + if (typeof object.timestamp !== "object") + throw TypeError(".tendermint.types.LightClientAttackEvidence.timestamp: object expected"); + message.timestamp = $root.google.protobuf.Timestamp.fromObject(object.timestamp); + } + return message; + }; + + /** + * Creates a plain object from a LightClientAttackEvidence message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.types.LightClientAttackEvidence + * @static + * @param {tendermint.types.LightClientAttackEvidence} message LightClientAttackEvidence + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LightClientAttackEvidence.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.byzantine_validators = []; + if (options.defaults) { + object.conflicting_block = null; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.common_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.common_height = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.total_voting_power = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.total_voting_power = options.longs === String ? "0" : 0; + object.timestamp = null; + } + if (message.conflicting_block != null && message.hasOwnProperty("conflicting_block")) + object.conflicting_block = $root.tendermint.types.LightBlock.toObject(message.conflicting_block, options); + if (message.common_height != null && message.hasOwnProperty("common_height")) + if (typeof message.common_height === "number") + object.common_height = options.longs === String ? String(message.common_height) : message.common_height; + else + object.common_height = options.longs === String ? $util.Long.prototype.toString.call(message.common_height) : options.longs === Number ? new $util.LongBits(message.common_height.low >>> 0, message.common_height.high >>> 0).toNumber() : message.common_height; + if (message.byzantine_validators && message.byzantine_validators.length) { + object.byzantine_validators = []; + for (let j = 0; j < message.byzantine_validators.length; ++j) + object.byzantine_validators[j] = $root.tendermint.types.Validator.toObject(message.byzantine_validators[j], options); + } + if (message.total_voting_power != null && message.hasOwnProperty("total_voting_power")) + if (typeof message.total_voting_power === "number") + object.total_voting_power = options.longs === String ? String(message.total_voting_power) : message.total_voting_power; + else + object.total_voting_power = options.longs === String ? $util.Long.prototype.toString.call(message.total_voting_power) : options.longs === Number ? new $util.LongBits(message.total_voting_power.low >>> 0, message.total_voting_power.high >>> 0).toNumber() : message.total_voting_power; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + object.timestamp = $root.google.protobuf.Timestamp.toObject(message.timestamp, options); + return object; + }; + + /** + * Converts this LightClientAttackEvidence to JSON. + * @function toJSON + * @memberof tendermint.types.LightClientAttackEvidence + * @instance + * @returns {Object.} JSON object + */ + LightClientAttackEvidence.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return LightClientAttackEvidence; + })(); + + types.EvidenceList = (function() { + + /** + * Properties of an EvidenceList. + * @memberof tendermint.types + * @interface IEvidenceList + * @property {Array.|null} [evidence] EvidenceList evidence + */ + + /** + * Constructs a new EvidenceList. + * @memberof tendermint.types + * @classdesc Represents an EvidenceList. + * @implements IEvidenceList + * @constructor + * @param {tendermint.types.IEvidenceList=} [properties] Properties to set + */ + function EvidenceList(properties) { + this.evidence = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EvidenceList evidence. + * @member {Array.} evidence + * @memberof tendermint.types.EvidenceList + * @instance + */ + EvidenceList.prototype.evidence = $util.emptyArray; + + /** + * Encodes the specified EvidenceList message. Does not implicitly {@link tendermint.types.EvidenceList.verify|verify} messages. + * @function encode + * @memberof tendermint.types.EvidenceList + * @static + * @param {tendermint.types.IEvidenceList} message EvidenceList message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EvidenceList.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.evidence != null && message.evidence.length) + for (let i = 0; i < message.evidence.length; ++i) + $root.tendermint.types.Evidence.encode(message.evidence[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EvidenceList message, length delimited. Does not implicitly {@link tendermint.types.EvidenceList.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.types.EvidenceList + * @static + * @param {tendermint.types.IEvidenceList} message EvidenceList message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EvidenceList.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EvidenceList message from the specified reader or buffer. + * @function decode + * @memberof tendermint.types.EvidenceList + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.types.EvidenceList} EvidenceList + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EvidenceList.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.EvidenceList(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.evidence && message.evidence.length)) + message.evidence = []; + message.evidence.push($root.tendermint.types.Evidence.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EvidenceList message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.types.EvidenceList + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.types.EvidenceList} EvidenceList + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EvidenceList.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EvidenceList message. + * @function verify + * @memberof tendermint.types.EvidenceList + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EvidenceList.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.evidence != null && message.hasOwnProperty("evidence")) { + if (!Array.isArray(message.evidence)) + return "evidence: array expected"; + for (let i = 0; i < message.evidence.length; ++i) { + let error = $root.tendermint.types.Evidence.verify(message.evidence[i]); + if (error) + return "evidence." + error; + } + } + return null; + }; + + /** + * Creates an EvidenceList message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.types.EvidenceList + * @static + * @param {Object.} object Plain object + * @returns {tendermint.types.EvidenceList} EvidenceList + */ + EvidenceList.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.types.EvidenceList) + return object; + let message = new $root.tendermint.types.EvidenceList(); + if (object.evidence) { + if (!Array.isArray(object.evidence)) + throw TypeError(".tendermint.types.EvidenceList.evidence: array expected"); + message.evidence = []; + for (let i = 0; i < object.evidence.length; ++i) { + if (typeof object.evidence[i] !== "object") + throw TypeError(".tendermint.types.EvidenceList.evidence: object expected"); + message.evidence[i] = $root.tendermint.types.Evidence.fromObject(object.evidence[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an EvidenceList message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.types.EvidenceList + * @static + * @param {tendermint.types.EvidenceList} message EvidenceList + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EvidenceList.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.evidence = []; + if (message.evidence && message.evidence.length) { + object.evidence = []; + for (let j = 0; j < message.evidence.length; ++j) + object.evidence[j] = $root.tendermint.types.Evidence.toObject(message.evidence[j], options); + } + return object; + }; + + /** + * Converts this EvidenceList to JSON. + * @function toJSON + * @memberof tendermint.types.EvidenceList + * @instance + * @returns {Object.} JSON object + */ + EvidenceList.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EvidenceList; + })(); + + /** + * BlockIDFlag enum. + * @name tendermint.types.BlockIDFlag + * @enum {number} + * @property {number} BLOCK_ID_FLAG_UNKNOWN=0 BLOCK_ID_FLAG_UNKNOWN value + * @property {number} BLOCK_ID_FLAG_ABSENT=1 BLOCK_ID_FLAG_ABSENT value + * @property {number} BLOCK_ID_FLAG_COMMIT=2 BLOCK_ID_FLAG_COMMIT value + * @property {number} BLOCK_ID_FLAG_NIL=3 BLOCK_ID_FLAG_NIL value + */ + types.BlockIDFlag = (function() { + const valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "BLOCK_ID_FLAG_UNKNOWN"] = 0; + values[valuesById[1] = "BLOCK_ID_FLAG_ABSENT"] = 1; + values[valuesById[2] = "BLOCK_ID_FLAG_COMMIT"] = 2; + values[valuesById[3] = "BLOCK_ID_FLAG_NIL"] = 3; + return values; + })(); + + /** + * SignedMsgType enum. + * @name tendermint.types.SignedMsgType + * @enum {number} + * @property {number} SIGNED_MSG_TYPE_UNKNOWN=0 SIGNED_MSG_TYPE_UNKNOWN value + * @property {number} SIGNED_MSG_TYPE_PREVOTE=1 SIGNED_MSG_TYPE_PREVOTE value + * @property {number} SIGNED_MSG_TYPE_PRECOMMIT=2 SIGNED_MSG_TYPE_PRECOMMIT value + * @property {number} SIGNED_MSG_TYPE_PROPOSAL=32 SIGNED_MSG_TYPE_PROPOSAL value + */ + types.SignedMsgType = (function() { + const valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SIGNED_MSG_TYPE_UNKNOWN"] = 0; + values[valuesById[1] = "SIGNED_MSG_TYPE_PREVOTE"] = 1; + values[valuesById[2] = "SIGNED_MSG_TYPE_PRECOMMIT"] = 2; + values[valuesById[32] = "SIGNED_MSG_TYPE_PROPOSAL"] = 32; + return values; + })(); + + types.PartSetHeader = (function() { + + /** + * Properties of a PartSetHeader. + * @memberof tendermint.types + * @interface IPartSetHeader + * @property {number|null} [total] PartSetHeader total + * @property {Uint8Array|null} [hash] PartSetHeader hash + */ + + /** + * Constructs a new PartSetHeader. + * @memberof tendermint.types + * @classdesc Represents a PartSetHeader. + * @implements IPartSetHeader + * @constructor + * @param {tendermint.types.IPartSetHeader=} [properties] Properties to set + */ + function PartSetHeader(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PartSetHeader total. + * @member {number} total + * @memberof tendermint.types.PartSetHeader + * @instance + */ + PartSetHeader.prototype.total = 0; + + /** + * PartSetHeader hash. + * @member {Uint8Array} hash + * @memberof tendermint.types.PartSetHeader + * @instance + */ + PartSetHeader.prototype.hash = $util.newBuffer([]); + + /** + * Encodes the specified PartSetHeader message. Does not implicitly {@link tendermint.types.PartSetHeader.verify|verify} messages. + * @function encode + * @memberof tendermint.types.PartSetHeader + * @static + * @param {tendermint.types.IPartSetHeader} message PartSetHeader message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PartSetHeader.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.total != null && Object.hasOwnProperty.call(message, "total")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.total); + if (message.hash != null && Object.hasOwnProperty.call(message, "hash")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.hash); + return writer; + }; + + /** + * Encodes the specified PartSetHeader message, length delimited. Does not implicitly {@link tendermint.types.PartSetHeader.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.types.PartSetHeader + * @static + * @param {tendermint.types.IPartSetHeader} message PartSetHeader message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PartSetHeader.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PartSetHeader message from the specified reader or buffer. + * @function decode + * @memberof tendermint.types.PartSetHeader + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.types.PartSetHeader} PartSetHeader + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PartSetHeader.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.PartSetHeader(); + while (reader.pos < end) { + let 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; + }; + + /** + * Decodes a PartSetHeader message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.types.PartSetHeader + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.types.PartSetHeader} PartSetHeader + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PartSetHeader.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PartSetHeader message. + * @function verify + * @memberof tendermint.types.PartSetHeader + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PartSetHeader.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.total != null && message.hasOwnProperty("total")) + if (!$util.isInteger(message.total)) + return "total: integer expected"; + if (message.hash != null && message.hasOwnProperty("hash")) + if (!(message.hash && typeof message.hash.length === "number" || $util.isString(message.hash))) + return "hash: buffer expected"; + return null; + }; + + /** + * Creates a PartSetHeader message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.types.PartSetHeader + * @static + * @param {Object.} object Plain object + * @returns {tendermint.types.PartSetHeader} PartSetHeader + */ + PartSetHeader.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.types.PartSetHeader) + return object; + let message = new $root.tendermint.types.PartSetHeader(); + if (object.total != null) + message.total = object.total >>> 0; + if (object.hash != null) + if (typeof object.hash === "string") + $util.base64.decode(object.hash, message.hash = $util.newBuffer($util.base64.length(object.hash)), 0); + else if (object.hash.length) + message.hash = object.hash; + return message; + }; + + /** + * Creates a plain object from a PartSetHeader message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.types.PartSetHeader + * @static + * @param {tendermint.types.PartSetHeader} message PartSetHeader + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PartSetHeader.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.total = 0; + if (options.bytes === String) + object.hash = ""; + else { + object.hash = []; + if (options.bytes !== Array) + object.hash = $util.newBuffer(object.hash); + } + } + if (message.total != null && message.hasOwnProperty("total")) + object.total = message.total; + if (message.hash != null && message.hasOwnProperty("hash")) + object.hash = options.bytes === String ? $util.base64.encode(message.hash, 0, message.hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.hash) : message.hash; + return object; + }; + + /** + * Converts this PartSetHeader to JSON. + * @function toJSON + * @memberof tendermint.types.PartSetHeader + * @instance + * @returns {Object.} JSON object + */ + PartSetHeader.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PartSetHeader; + })(); + + types.Part = (function() { + + /** + * Properties of a Part. + * @memberof tendermint.types + * @interface IPart + * @property {number|null} [index] Part index + * @property {Uint8Array|null} [bytes] Part bytes + * @property {tendermint.crypto.IProof|null} [proof] Part proof + */ + + /** + * Constructs a new Part. + * @memberof tendermint.types + * @classdesc Represents a Part. + * @implements IPart + * @constructor + * @param {tendermint.types.IPart=} [properties] Properties to set + */ + function Part(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Part index. + * @member {number} index + * @memberof tendermint.types.Part + * @instance + */ + Part.prototype.index = 0; + + /** + * Part bytes. + * @member {Uint8Array} bytes + * @memberof tendermint.types.Part + * @instance + */ + Part.prototype.bytes = $util.newBuffer([]); + + /** + * Part proof. + * @member {tendermint.crypto.IProof|null|undefined} proof + * @memberof tendermint.types.Part + * @instance + */ + Part.prototype.proof = null; + + /** + * Encodes the specified Part message. Does not implicitly {@link tendermint.types.Part.verify|verify} messages. + * @function encode + * @memberof tendermint.types.Part + * @static + * @param {tendermint.types.IPart} message Part message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Part.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.index != null && Object.hasOwnProperty.call(message, "index")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.index); + if (message.bytes != null && Object.hasOwnProperty.call(message, "bytes")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.bytes); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + $root.tendermint.crypto.Proof.encode(message.proof, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Part message, length delimited. Does not implicitly {@link tendermint.types.Part.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.types.Part + * @static + * @param {tendermint.types.IPart} message Part message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Part.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Part message from the specified reader or buffer. + * @function decode + * @memberof tendermint.types.Part + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.types.Part} Part + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Part.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.Part(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = reader.uint32(); + break; + case 2: + message.bytes = reader.bytes(); + break; + case 3: + message.proof = $root.tendermint.crypto.Proof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Part message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.types.Part + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.types.Part} Part + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Part.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Part message. + * @function verify + * @memberof tendermint.types.Part + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Part.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.index != null && message.hasOwnProperty("index")) + if (!$util.isInteger(message.index)) + return "index: integer expected"; + if (message.bytes != null && message.hasOwnProperty("bytes")) + if (!(message.bytes && typeof message.bytes.length === "number" || $util.isString(message.bytes))) + return "bytes: buffer expected"; + if (message.proof != null && message.hasOwnProperty("proof")) { + let error = $root.tendermint.crypto.Proof.verify(message.proof); + if (error) + return "proof." + error; + } + return null; + }; + + /** + * Creates a Part message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.types.Part + * @static + * @param {Object.} object Plain object + * @returns {tendermint.types.Part} Part + */ + Part.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.types.Part) + return object; + let message = new $root.tendermint.types.Part(); + if (object.index != null) + message.index = object.index >>> 0; + if (object.bytes != null) + if (typeof object.bytes === "string") + $util.base64.decode(object.bytes, message.bytes = $util.newBuffer($util.base64.length(object.bytes)), 0); + else if (object.bytes.length) + message.bytes = object.bytes; + if (object.proof != null) { + if (typeof object.proof !== "object") + throw TypeError(".tendermint.types.Part.proof: object expected"); + message.proof = $root.tendermint.crypto.Proof.fromObject(object.proof); + } + return message; + }; + + /** + * Creates a plain object from a Part message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.types.Part + * @static + * @param {tendermint.types.Part} message Part + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Part.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.index = 0; + if (options.bytes === String) + object.bytes = ""; + else { + object.bytes = []; + if (options.bytes !== Array) + object.bytes = $util.newBuffer(object.bytes); + } + object.proof = null; + } + if (message.index != null && message.hasOwnProperty("index")) + object.index = message.index; + if (message.bytes != null && message.hasOwnProperty("bytes")) + object.bytes = options.bytes === String ? $util.base64.encode(message.bytes, 0, message.bytes.length) : options.bytes === Array ? Array.prototype.slice.call(message.bytes) : message.bytes; + if (message.proof != null && message.hasOwnProperty("proof")) + object.proof = $root.tendermint.crypto.Proof.toObject(message.proof, options); + return object; + }; + + /** + * Converts this Part to JSON. + * @function toJSON + * @memberof tendermint.types.Part + * @instance + * @returns {Object.} JSON object + */ + Part.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Part; + })(); + + types.BlockID = (function() { + + /** + * Properties of a BlockID. + * @memberof tendermint.types + * @interface IBlockID + * @property {Uint8Array|null} [hash] BlockID hash + * @property {tendermint.types.IPartSetHeader|null} [part_set_header] BlockID part_set_header + */ + + /** + * Constructs a new BlockID. + * @memberof tendermint.types + * @classdesc Represents a BlockID. + * @implements IBlockID + * @constructor + * @param {tendermint.types.IBlockID=} [properties] Properties to set + */ + function BlockID(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BlockID hash. + * @member {Uint8Array} hash + * @memberof tendermint.types.BlockID + * @instance + */ + BlockID.prototype.hash = $util.newBuffer([]); + + /** + * BlockID part_set_header. + * @member {tendermint.types.IPartSetHeader|null|undefined} part_set_header + * @memberof tendermint.types.BlockID + * @instance + */ + BlockID.prototype.part_set_header = null; + + /** + * Encodes the specified BlockID message. Does not implicitly {@link tendermint.types.BlockID.verify|verify} messages. + * @function encode + * @memberof tendermint.types.BlockID + * @static + * @param {tendermint.types.IBlockID} message BlockID message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BlockID.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.hash != null && Object.hasOwnProperty.call(message, "hash")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.hash); + if (message.part_set_header != null && Object.hasOwnProperty.call(message, "part_set_header")) + $root.tendermint.types.PartSetHeader.encode(message.part_set_header, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BlockID message, length delimited. Does not implicitly {@link tendermint.types.BlockID.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.types.BlockID + * @static + * @param {tendermint.types.IBlockID} message BlockID message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BlockID.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BlockID message from the specified reader or buffer. + * @function decode + * @memberof tendermint.types.BlockID + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.types.BlockID} BlockID + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BlockID.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.BlockID(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.bytes(); + break; + case 2: + message.part_set_header = $root.tendermint.types.PartSetHeader.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BlockID message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.types.BlockID + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.types.BlockID} BlockID + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BlockID.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BlockID message. + * @function verify + * @memberof tendermint.types.BlockID + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BlockID.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.hash != null && message.hasOwnProperty("hash")) + if (!(message.hash && typeof message.hash.length === "number" || $util.isString(message.hash))) + return "hash: buffer expected"; + if (message.part_set_header != null && message.hasOwnProperty("part_set_header")) { + let error = $root.tendermint.types.PartSetHeader.verify(message.part_set_header); + if (error) + return "part_set_header." + error; + } + return null; + }; + + /** + * Creates a BlockID message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.types.BlockID + * @static + * @param {Object.} object Plain object + * @returns {tendermint.types.BlockID} BlockID + */ + BlockID.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.types.BlockID) + return object; + let message = new $root.tendermint.types.BlockID(); + if (object.hash != null) + if (typeof object.hash === "string") + $util.base64.decode(object.hash, message.hash = $util.newBuffer($util.base64.length(object.hash)), 0); + else if (object.hash.length) + message.hash = object.hash; + if (object.part_set_header != null) { + if (typeof object.part_set_header !== "object") + throw TypeError(".tendermint.types.BlockID.part_set_header: object expected"); + message.part_set_header = $root.tendermint.types.PartSetHeader.fromObject(object.part_set_header); + } + return message; + }; + + /** + * Creates a plain object from a BlockID message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.types.BlockID + * @static + * @param {tendermint.types.BlockID} message BlockID + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BlockID.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if (options.bytes === String) + object.hash = ""; + else { + object.hash = []; + if (options.bytes !== Array) + object.hash = $util.newBuffer(object.hash); + } + object.part_set_header = null; + } + if (message.hash != null && message.hasOwnProperty("hash")) + object.hash = options.bytes === String ? $util.base64.encode(message.hash, 0, message.hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.hash) : message.hash; + if (message.part_set_header != null && message.hasOwnProperty("part_set_header")) + object.part_set_header = $root.tendermint.types.PartSetHeader.toObject(message.part_set_header, options); + return object; + }; + + /** + * Converts this BlockID to JSON. + * @function toJSON + * @memberof tendermint.types.BlockID + * @instance + * @returns {Object.} JSON object + */ + BlockID.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BlockID; + })(); + + types.Header = (function() { + + /** + * Properties of a Header. + * @memberof tendermint.types + * @interface IHeader + * @property {tendermint.version.IConsensus|null} [version] Header version + * @property {string|null} [chain_id] Header chain_id + * @property {Long|null} [height] Header height + * @property {google.protobuf.ITimestamp|null} [time] Header time + * @property {tendermint.types.IBlockID|null} [last_block_id] Header last_block_id + * @property {Uint8Array|null} [last_commit_hash] Header last_commit_hash + * @property {Uint8Array|null} [data_hash] Header data_hash + * @property {Uint8Array|null} [validators_hash] Header validators_hash + * @property {Uint8Array|null} [next_validators_hash] Header next_validators_hash + * @property {Uint8Array|null} [consensus_hash] Header consensus_hash + * @property {Uint8Array|null} [app_hash] Header app_hash + * @property {Uint8Array|null} [last_results_hash] Header last_results_hash + * @property {Uint8Array|null} [evidence_hash] Header evidence_hash + * @property {Uint8Array|null} [proposer_address] Header proposer_address + */ + + /** + * Constructs a new Header. + * @memberof tendermint.types + * @classdesc Represents a Header. + * @implements IHeader + * @constructor + * @param {tendermint.types.IHeader=} [properties] Properties to set + */ + function Header(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Header version. + * @member {tendermint.version.IConsensus|null|undefined} version + * @memberof tendermint.types.Header + * @instance + */ + Header.prototype.version = null; + + /** + * Header chain_id. + * @member {string} chain_id + * @memberof tendermint.types.Header + * @instance + */ + Header.prototype.chain_id = ""; + + /** + * Header height. + * @member {Long} height + * @memberof tendermint.types.Header + * @instance + */ + Header.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Header time. + * @member {google.protobuf.ITimestamp|null|undefined} time + * @memberof tendermint.types.Header + * @instance + */ + Header.prototype.time = null; + + /** + * Header last_block_id. + * @member {tendermint.types.IBlockID|null|undefined} last_block_id + * @memberof tendermint.types.Header + * @instance + */ + Header.prototype.last_block_id = null; + + /** + * Header last_commit_hash. + * @member {Uint8Array} last_commit_hash + * @memberof tendermint.types.Header + * @instance + */ + Header.prototype.last_commit_hash = $util.newBuffer([]); + + /** + * Header data_hash. + * @member {Uint8Array} data_hash + * @memberof tendermint.types.Header + * @instance + */ + Header.prototype.data_hash = $util.newBuffer([]); + + /** + * Header validators_hash. + * @member {Uint8Array} validators_hash + * @memberof tendermint.types.Header + * @instance + */ + Header.prototype.validators_hash = $util.newBuffer([]); + + /** + * Header next_validators_hash. + * @member {Uint8Array} next_validators_hash + * @memberof tendermint.types.Header + * @instance + */ + Header.prototype.next_validators_hash = $util.newBuffer([]); + + /** + * Header consensus_hash. + * @member {Uint8Array} consensus_hash + * @memberof tendermint.types.Header + * @instance + */ + Header.prototype.consensus_hash = $util.newBuffer([]); + + /** + * Header app_hash. + * @member {Uint8Array} app_hash + * @memberof tendermint.types.Header + * @instance + */ + Header.prototype.app_hash = $util.newBuffer([]); + + /** + * Header last_results_hash. + * @member {Uint8Array} last_results_hash + * @memberof tendermint.types.Header + * @instance + */ + Header.prototype.last_results_hash = $util.newBuffer([]); + + /** + * Header evidence_hash. + * @member {Uint8Array} evidence_hash + * @memberof tendermint.types.Header + * @instance + */ + Header.prototype.evidence_hash = $util.newBuffer([]); + + /** + * Header proposer_address. + * @member {Uint8Array} proposer_address + * @memberof tendermint.types.Header + * @instance + */ + Header.prototype.proposer_address = $util.newBuffer([]); + + /** + * Encodes the specified Header message. Does not implicitly {@link tendermint.types.Header.verify|verify} messages. + * @function encode + * @memberof tendermint.types.Header + * @static + * @param {tendermint.types.IHeader} message Header message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Header.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + $root.tendermint.version.Consensus.encode(message.version, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.chain_id != null && Object.hasOwnProperty.call(message, "chain_id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.chain_id); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.height); + if (message.time != null && Object.hasOwnProperty.call(message, "time")) + $root.google.protobuf.Timestamp.encode(message.time, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.last_block_id != null && Object.hasOwnProperty.call(message, "last_block_id")) + $root.tendermint.types.BlockID.encode(message.last_block_id, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.last_commit_hash != null && Object.hasOwnProperty.call(message, "last_commit_hash")) + writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.last_commit_hash); + if (message.data_hash != null && Object.hasOwnProperty.call(message, "data_hash")) + writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.data_hash); + if (message.validators_hash != null && Object.hasOwnProperty.call(message, "validators_hash")) + writer.uint32(/* id 8, wireType 2 =*/66).bytes(message.validators_hash); + if (message.next_validators_hash != null && Object.hasOwnProperty.call(message, "next_validators_hash")) + writer.uint32(/* id 9, wireType 2 =*/74).bytes(message.next_validators_hash); + if (message.consensus_hash != null && Object.hasOwnProperty.call(message, "consensus_hash")) + writer.uint32(/* id 10, wireType 2 =*/82).bytes(message.consensus_hash); + if (message.app_hash != null && Object.hasOwnProperty.call(message, "app_hash")) + writer.uint32(/* id 11, wireType 2 =*/90).bytes(message.app_hash); + if (message.last_results_hash != null && Object.hasOwnProperty.call(message, "last_results_hash")) + writer.uint32(/* id 12, wireType 2 =*/98).bytes(message.last_results_hash); + if (message.evidence_hash != null && Object.hasOwnProperty.call(message, "evidence_hash")) + writer.uint32(/* id 13, wireType 2 =*/106).bytes(message.evidence_hash); + if (message.proposer_address != null && Object.hasOwnProperty.call(message, "proposer_address")) + writer.uint32(/* id 14, wireType 2 =*/114).bytes(message.proposer_address); + return writer; + }; + + /** + * Encodes the specified Header message, length delimited. Does not implicitly {@link tendermint.types.Header.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.types.Header + * @static + * @param {tendermint.types.IHeader} message Header message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Header.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Header message from the specified reader or buffer. + * @function decode + * @memberof tendermint.types.Header + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.types.Header} Header + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Header.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.Header(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = $root.tendermint.version.Consensus.decode(reader, reader.uint32()); + break; + case 2: + message.chain_id = reader.string(); + break; + case 3: + message.height = reader.int64(); + break; + case 4: + message.time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 5: + message.last_block_id = $root.tendermint.types.BlockID.decode(reader, reader.uint32()); + break; + case 6: + message.last_commit_hash = reader.bytes(); + break; + case 7: + message.data_hash = reader.bytes(); + break; + case 8: + message.validators_hash = reader.bytes(); + break; + case 9: + message.next_validators_hash = reader.bytes(); + break; + case 10: + message.consensus_hash = reader.bytes(); + break; + case 11: + message.app_hash = reader.bytes(); + break; + case 12: + message.last_results_hash = reader.bytes(); + break; + case 13: + message.evidence_hash = reader.bytes(); + break; + case 14: + message.proposer_address = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Header message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.types.Header + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.types.Header} Header + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Header.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Header message. + * @function verify + * @memberof tendermint.types.Header + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Header.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.version != null && message.hasOwnProperty("version")) { + let error = $root.tendermint.version.Consensus.verify(message.version); + if (error) + return "version." + error; + } + if (message.chain_id != null && message.hasOwnProperty("chain_id")) + if (!$util.isString(message.chain_id)) + return "chain_id: string expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) + return "height: integer|Long expected"; + if (message.time != null && message.hasOwnProperty("time")) { + let error = $root.google.protobuf.Timestamp.verify(message.time); + if (error) + return "time." + error; + } + if (message.last_block_id != null && message.hasOwnProperty("last_block_id")) { + let error = $root.tendermint.types.BlockID.verify(message.last_block_id); + if (error) + return "last_block_id." + error; + } + if (message.last_commit_hash != null && message.hasOwnProperty("last_commit_hash")) + if (!(message.last_commit_hash && typeof message.last_commit_hash.length === "number" || $util.isString(message.last_commit_hash))) + return "last_commit_hash: buffer expected"; + if (message.data_hash != null && message.hasOwnProperty("data_hash")) + if (!(message.data_hash && typeof message.data_hash.length === "number" || $util.isString(message.data_hash))) + return "data_hash: buffer expected"; + if (message.validators_hash != null && message.hasOwnProperty("validators_hash")) + if (!(message.validators_hash && typeof message.validators_hash.length === "number" || $util.isString(message.validators_hash))) + return "validators_hash: buffer expected"; + if (message.next_validators_hash != null && message.hasOwnProperty("next_validators_hash")) + if (!(message.next_validators_hash && typeof message.next_validators_hash.length === "number" || $util.isString(message.next_validators_hash))) + return "next_validators_hash: buffer expected"; + if (message.consensus_hash != null && message.hasOwnProperty("consensus_hash")) + if (!(message.consensus_hash && typeof message.consensus_hash.length === "number" || $util.isString(message.consensus_hash))) + return "consensus_hash: buffer expected"; + if (message.app_hash != null && message.hasOwnProperty("app_hash")) + if (!(message.app_hash && typeof message.app_hash.length === "number" || $util.isString(message.app_hash))) + return "app_hash: buffer expected"; + if (message.last_results_hash != null && message.hasOwnProperty("last_results_hash")) + if (!(message.last_results_hash && typeof message.last_results_hash.length === "number" || $util.isString(message.last_results_hash))) + return "last_results_hash: buffer expected"; + if (message.evidence_hash != null && message.hasOwnProperty("evidence_hash")) + if (!(message.evidence_hash && typeof message.evidence_hash.length === "number" || $util.isString(message.evidence_hash))) + return "evidence_hash: buffer expected"; + if (message.proposer_address != null && message.hasOwnProperty("proposer_address")) + if (!(message.proposer_address && typeof message.proposer_address.length === "number" || $util.isString(message.proposer_address))) + return "proposer_address: buffer expected"; + return null; + }; + + /** + * Creates a Header message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.types.Header + * @static + * @param {Object.} object Plain object + * @returns {tendermint.types.Header} Header + */ + Header.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.types.Header) + return object; + let message = new $root.tendermint.types.Header(); + if (object.version != null) { + if (typeof object.version !== "object") + throw TypeError(".tendermint.types.Header.version: object expected"); + message.version = $root.tendermint.version.Consensus.fromObject(object.version); + } + if (object.chain_id != null) + message.chain_id = String(object.chain_id); + if (object.height != null) + if ($util.Long) + (message.height = $util.Long.fromValue(object.height)).unsigned = false; + else if (typeof object.height === "string") + message.height = parseInt(object.height, 10); + else if (typeof object.height === "number") + message.height = object.height; + else if (typeof object.height === "object") + message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); + if (object.time != null) { + if (typeof object.time !== "object") + throw TypeError(".tendermint.types.Header.time: object expected"); + message.time = $root.google.protobuf.Timestamp.fromObject(object.time); + } + if (object.last_block_id != null) { + if (typeof object.last_block_id !== "object") + throw TypeError(".tendermint.types.Header.last_block_id: object expected"); + message.last_block_id = $root.tendermint.types.BlockID.fromObject(object.last_block_id); + } + if (object.last_commit_hash != null) + if (typeof object.last_commit_hash === "string") + $util.base64.decode(object.last_commit_hash, message.last_commit_hash = $util.newBuffer($util.base64.length(object.last_commit_hash)), 0); + else if (object.last_commit_hash.length) + message.last_commit_hash = object.last_commit_hash; + if (object.data_hash != null) + if (typeof object.data_hash === "string") + $util.base64.decode(object.data_hash, message.data_hash = $util.newBuffer($util.base64.length(object.data_hash)), 0); + else if (object.data_hash.length) + message.data_hash = object.data_hash; + if (object.validators_hash != null) + if (typeof object.validators_hash === "string") + $util.base64.decode(object.validators_hash, message.validators_hash = $util.newBuffer($util.base64.length(object.validators_hash)), 0); + else if (object.validators_hash.length) + message.validators_hash = object.validators_hash; + if (object.next_validators_hash != null) + if (typeof object.next_validators_hash === "string") + $util.base64.decode(object.next_validators_hash, message.next_validators_hash = $util.newBuffer($util.base64.length(object.next_validators_hash)), 0); + else if (object.next_validators_hash.length) + message.next_validators_hash = object.next_validators_hash; + if (object.consensus_hash != null) + if (typeof object.consensus_hash === "string") + $util.base64.decode(object.consensus_hash, message.consensus_hash = $util.newBuffer($util.base64.length(object.consensus_hash)), 0); + else if (object.consensus_hash.length) + message.consensus_hash = object.consensus_hash; + if (object.app_hash != null) + if (typeof object.app_hash === "string") + $util.base64.decode(object.app_hash, message.app_hash = $util.newBuffer($util.base64.length(object.app_hash)), 0); + else if (object.app_hash.length) + message.app_hash = object.app_hash; + if (object.last_results_hash != null) + if (typeof object.last_results_hash === "string") + $util.base64.decode(object.last_results_hash, message.last_results_hash = $util.newBuffer($util.base64.length(object.last_results_hash)), 0); + else if (object.last_results_hash.length) + message.last_results_hash = object.last_results_hash; + if (object.evidence_hash != null) + if (typeof object.evidence_hash === "string") + $util.base64.decode(object.evidence_hash, message.evidence_hash = $util.newBuffer($util.base64.length(object.evidence_hash)), 0); + else if (object.evidence_hash.length) + message.evidence_hash = object.evidence_hash; + if (object.proposer_address != null) + if (typeof object.proposer_address === "string") + $util.base64.decode(object.proposer_address, message.proposer_address = $util.newBuffer($util.base64.length(object.proposer_address)), 0); + else if (object.proposer_address.length) + message.proposer_address = object.proposer_address; + return message; + }; + + /** + * Creates a plain object from a Header message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.types.Header + * @static + * @param {tendermint.types.Header} message Header + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Header.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.version = null; + object.chain_id = ""; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.height = options.longs === String ? "0" : 0; + object.time = null; + object.last_block_id = null; + if (options.bytes === String) + object.last_commit_hash = ""; + else { + object.last_commit_hash = []; + if (options.bytes !== Array) + object.last_commit_hash = $util.newBuffer(object.last_commit_hash); + } + if (options.bytes === String) + object.data_hash = ""; + else { + object.data_hash = []; + if (options.bytes !== Array) + object.data_hash = $util.newBuffer(object.data_hash); + } + if (options.bytes === String) + object.validators_hash = ""; + else { + object.validators_hash = []; + if (options.bytes !== Array) + object.validators_hash = $util.newBuffer(object.validators_hash); + } + if (options.bytes === String) + object.next_validators_hash = ""; + else { + object.next_validators_hash = []; + if (options.bytes !== Array) + object.next_validators_hash = $util.newBuffer(object.next_validators_hash); + } + if (options.bytes === String) + object.consensus_hash = ""; + else { + object.consensus_hash = []; + if (options.bytes !== Array) + object.consensus_hash = $util.newBuffer(object.consensus_hash); + } + if (options.bytes === String) + object.app_hash = ""; + else { + object.app_hash = []; + if (options.bytes !== Array) + object.app_hash = $util.newBuffer(object.app_hash); + } + if (options.bytes === String) + object.last_results_hash = ""; + else { + object.last_results_hash = []; + if (options.bytes !== Array) + object.last_results_hash = $util.newBuffer(object.last_results_hash); + } + if (options.bytes === String) + object.evidence_hash = ""; + else { + object.evidence_hash = []; + if (options.bytes !== Array) + object.evidence_hash = $util.newBuffer(object.evidence_hash); + } + if (options.bytes === String) + object.proposer_address = ""; + else { + object.proposer_address = []; + if (options.bytes !== Array) + object.proposer_address = $util.newBuffer(object.proposer_address); + } + } + if (message.version != null && message.hasOwnProperty("version")) + object.version = $root.tendermint.version.Consensus.toObject(message.version, options); + if (message.chain_id != null && message.hasOwnProperty("chain_id")) + object.chain_id = message.chain_id; + if (message.height != null && message.hasOwnProperty("height")) + if (typeof message.height === "number") + object.height = options.longs === String ? String(message.height) : message.height; + else + object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; + if (message.time != null && message.hasOwnProperty("time")) + object.time = $root.google.protobuf.Timestamp.toObject(message.time, options); + if (message.last_block_id != null && message.hasOwnProperty("last_block_id")) + object.last_block_id = $root.tendermint.types.BlockID.toObject(message.last_block_id, options); + if (message.last_commit_hash != null && message.hasOwnProperty("last_commit_hash")) + object.last_commit_hash = options.bytes === String ? $util.base64.encode(message.last_commit_hash, 0, message.last_commit_hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.last_commit_hash) : message.last_commit_hash; + if (message.data_hash != null && message.hasOwnProperty("data_hash")) + object.data_hash = options.bytes === String ? $util.base64.encode(message.data_hash, 0, message.data_hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.data_hash) : message.data_hash; + if (message.validators_hash != null && message.hasOwnProperty("validators_hash")) + object.validators_hash = options.bytes === String ? $util.base64.encode(message.validators_hash, 0, message.validators_hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.validators_hash) : message.validators_hash; + if (message.next_validators_hash != null && message.hasOwnProperty("next_validators_hash")) + object.next_validators_hash = options.bytes === String ? $util.base64.encode(message.next_validators_hash, 0, message.next_validators_hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.next_validators_hash) : message.next_validators_hash; + if (message.consensus_hash != null && message.hasOwnProperty("consensus_hash")) + object.consensus_hash = options.bytes === String ? $util.base64.encode(message.consensus_hash, 0, message.consensus_hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.consensus_hash) : message.consensus_hash; + if (message.app_hash != null && message.hasOwnProperty("app_hash")) + object.app_hash = options.bytes === String ? $util.base64.encode(message.app_hash, 0, message.app_hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.app_hash) : message.app_hash; + if (message.last_results_hash != null && message.hasOwnProperty("last_results_hash")) + object.last_results_hash = options.bytes === String ? $util.base64.encode(message.last_results_hash, 0, message.last_results_hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.last_results_hash) : message.last_results_hash; + if (message.evidence_hash != null && message.hasOwnProperty("evidence_hash")) + object.evidence_hash = options.bytes === String ? $util.base64.encode(message.evidence_hash, 0, message.evidence_hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.evidence_hash) : message.evidence_hash; + if (message.proposer_address != null && message.hasOwnProperty("proposer_address")) + object.proposer_address = options.bytes === String ? $util.base64.encode(message.proposer_address, 0, message.proposer_address.length) : options.bytes === Array ? Array.prototype.slice.call(message.proposer_address) : message.proposer_address; + return object; + }; + + /** + * Converts this Header to JSON. + * @function toJSON + * @memberof tendermint.types.Header + * @instance + * @returns {Object.} JSON object + */ + Header.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Header; + })(); + + types.Data = (function() { + + /** + * Properties of a Data. + * @memberof tendermint.types + * @interface IData + * @property {Array.|null} [txs] Data txs + */ + + /** + * Constructs a new Data. + * @memberof tendermint.types + * @classdesc Represents a Data. + * @implements IData + * @constructor + * @param {tendermint.types.IData=} [properties] Properties to set + */ + function Data(properties) { + this.txs = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Data txs. + * @member {Array.} txs + * @memberof tendermint.types.Data + * @instance + */ + Data.prototype.txs = $util.emptyArray; + + /** + * Encodes the specified Data message. Does not implicitly {@link tendermint.types.Data.verify|verify} messages. + * @function encode + * @memberof tendermint.types.Data + * @static + * @param {tendermint.types.IData} message Data message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Data.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.txs != null && message.txs.length) + for (let i = 0; i < message.txs.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.txs[i]); + return writer; + }; + + /** + * Encodes the specified Data message, length delimited. Does not implicitly {@link tendermint.types.Data.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.types.Data + * @static + * @param {tendermint.types.IData} message Data message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Data.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Data message from the specified reader or buffer. + * @function decode + * @memberof tendermint.types.Data + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.types.Data} Data + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Data.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.Data(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.txs && message.txs.length)) + message.txs = []; + message.txs.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Data message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.types.Data + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.types.Data} Data + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Data.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Data message. + * @function verify + * @memberof tendermint.types.Data + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Data.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.txs != null && message.hasOwnProperty("txs")) { + if (!Array.isArray(message.txs)) + return "txs: array expected"; + for (let i = 0; i < message.txs.length; ++i) + if (!(message.txs[i] && typeof message.txs[i].length === "number" || $util.isString(message.txs[i]))) + return "txs: buffer[] expected"; + } + return null; + }; + + /** + * Creates a Data message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.types.Data + * @static + * @param {Object.} object Plain object + * @returns {tendermint.types.Data} Data + */ + Data.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.types.Data) + return object; + let message = new $root.tendermint.types.Data(); + if (object.txs) { + if (!Array.isArray(object.txs)) + throw TypeError(".tendermint.types.Data.txs: array expected"); + message.txs = []; + for (let i = 0; i < object.txs.length; ++i) + if (typeof object.txs[i] === "string") + $util.base64.decode(object.txs[i], message.txs[i] = $util.newBuffer($util.base64.length(object.txs[i])), 0); + else if (object.txs[i].length) + message.txs[i] = object.txs[i]; + } + return message; + }; + + /** + * Creates a plain object from a Data message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.types.Data + * @static + * @param {tendermint.types.Data} message Data + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Data.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.txs = []; + if (message.txs && message.txs.length) { + object.txs = []; + for (let j = 0; j < message.txs.length; ++j) + object.txs[j] = options.bytes === String ? $util.base64.encode(message.txs[j], 0, message.txs[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.txs[j]) : message.txs[j]; + } + return object; + }; + + /** + * Converts this Data to JSON. + * @function toJSON + * @memberof tendermint.types.Data + * @instance + * @returns {Object.} JSON object + */ + Data.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Data; + })(); + + types.Vote = (function() { + + /** + * Properties of a Vote. + * @memberof tendermint.types + * @interface IVote + * @property {tendermint.types.SignedMsgType|null} [type] Vote type + * @property {Long|null} [height] Vote height + * @property {number|null} [round] Vote round + * @property {tendermint.types.IBlockID|null} [block_id] Vote block_id + * @property {google.protobuf.ITimestamp|null} [timestamp] Vote timestamp + * @property {Uint8Array|null} [validator_address] Vote validator_address + * @property {number|null} [validator_index] Vote validator_index + * @property {Uint8Array|null} [signature] Vote signature + */ + + /** + * Constructs a new Vote. + * @memberof tendermint.types + * @classdesc Represents a Vote. + * @implements IVote + * @constructor + * @param {tendermint.types.IVote=} [properties] Properties to set + */ + function Vote(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Vote type. + * @member {tendermint.types.SignedMsgType} type + * @memberof tendermint.types.Vote + * @instance + */ + Vote.prototype.type = 0; + + /** + * Vote height. + * @member {Long} height + * @memberof tendermint.types.Vote + * @instance + */ + Vote.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Vote round. + * @member {number} round + * @memberof tendermint.types.Vote + * @instance + */ + Vote.prototype.round = 0; + + /** + * Vote block_id. + * @member {tendermint.types.IBlockID|null|undefined} block_id + * @memberof tendermint.types.Vote + * @instance + */ + Vote.prototype.block_id = null; + + /** + * Vote timestamp. + * @member {google.protobuf.ITimestamp|null|undefined} timestamp + * @memberof tendermint.types.Vote + * @instance + */ + Vote.prototype.timestamp = null; + + /** + * Vote validator_address. + * @member {Uint8Array} validator_address + * @memberof tendermint.types.Vote + * @instance + */ + Vote.prototype.validator_address = $util.newBuffer([]); + + /** + * Vote validator_index. + * @member {number} validator_index + * @memberof tendermint.types.Vote + * @instance + */ + Vote.prototype.validator_index = 0; + + /** + * Vote signature. + * @member {Uint8Array} signature + * @memberof tendermint.types.Vote + * @instance + */ + Vote.prototype.signature = $util.newBuffer([]); + + /** + * Encodes the specified Vote message. Does not implicitly {@link tendermint.types.Vote.verify|verify} messages. + * @function encode + * @memberof tendermint.types.Vote + * @static + * @param {tendermint.types.IVote} message Vote message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Vote.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.height); + if (message.round != null && Object.hasOwnProperty.call(message, "round")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.round); + if (message.block_id != null && Object.hasOwnProperty.call(message, "block_id")) + $root.tendermint.types.BlockID.encode(message.block_id, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) + $root.google.protobuf.Timestamp.encode(message.timestamp, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) + writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.validator_address); + if (message.validator_index != null && Object.hasOwnProperty.call(message, "validator_index")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.validator_index); + if (message.signature != null && Object.hasOwnProperty.call(message, "signature")) + writer.uint32(/* id 8, wireType 2 =*/66).bytes(message.signature); + return writer; + }; + + /** + * Encodes the specified Vote message, length delimited. Does not implicitly {@link tendermint.types.Vote.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.types.Vote + * @static + * @param {tendermint.types.IVote} message Vote message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Vote.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Vote message from the specified reader or buffer. + * @function decode + * @memberof tendermint.types.Vote + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.types.Vote} Vote + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Vote.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.Vote(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.int32(); + break; + case 2: + message.height = reader.int64(); + break; + case 3: + message.round = reader.int32(); + break; + case 4: + message.block_id = $root.tendermint.types.BlockID.decode(reader, reader.uint32()); + break; + case 5: + message.timestamp = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 6: + message.validator_address = reader.bytes(); + break; + case 7: + message.validator_index = reader.int32(); + break; + case 8: + message.signature = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Vote message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.types.Vote + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.types.Vote} Vote + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Vote.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Vote message. + * @function verify + * @memberof tendermint.types.Vote + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Vote.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 32: + break; + } + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) + return "height: integer|Long expected"; + if (message.round != null && message.hasOwnProperty("round")) + if (!$util.isInteger(message.round)) + return "round: integer expected"; + if (message.block_id != null && message.hasOwnProperty("block_id")) { + let error = $root.tendermint.types.BlockID.verify(message.block_id); + if (error) + return "block_id." + error; + } + if (message.timestamp != null && message.hasOwnProperty("timestamp")) { + let error = $root.google.protobuf.Timestamp.verify(message.timestamp); + if (error) + return "timestamp." + error; + } + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + if (!(message.validator_address && typeof message.validator_address.length === "number" || $util.isString(message.validator_address))) + return "validator_address: buffer expected"; + if (message.validator_index != null && message.hasOwnProperty("validator_index")) + if (!$util.isInteger(message.validator_index)) + return "validator_index: integer expected"; + if (message.signature != null && message.hasOwnProperty("signature")) + if (!(message.signature && typeof message.signature.length === "number" || $util.isString(message.signature))) + return "signature: buffer expected"; + return null; + }; + + /** + * Creates a Vote message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.types.Vote + * @static + * @param {Object.} object Plain object + * @returns {tendermint.types.Vote} Vote + */ + Vote.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.types.Vote) + return object; + let message = new $root.tendermint.types.Vote(); + switch (object.type) { + case "SIGNED_MSG_TYPE_UNKNOWN": + case 0: + message.type = 0; + break; + case "SIGNED_MSG_TYPE_PREVOTE": + case 1: + message.type = 1; + break; + case "SIGNED_MSG_TYPE_PRECOMMIT": + case 2: + message.type = 2; + break; + case "SIGNED_MSG_TYPE_PROPOSAL": + case 32: + message.type = 32; + break; + } + if (object.height != null) + if ($util.Long) + (message.height = $util.Long.fromValue(object.height)).unsigned = false; + else if (typeof object.height === "string") + message.height = parseInt(object.height, 10); + else if (typeof object.height === "number") + message.height = object.height; + else if (typeof object.height === "object") + message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); + if (object.round != null) + message.round = object.round | 0; + if (object.block_id != null) { + if (typeof object.block_id !== "object") + throw TypeError(".tendermint.types.Vote.block_id: object expected"); + message.block_id = $root.tendermint.types.BlockID.fromObject(object.block_id); + } + if (object.timestamp != null) { + if (typeof object.timestamp !== "object") + throw TypeError(".tendermint.types.Vote.timestamp: object expected"); + message.timestamp = $root.google.protobuf.Timestamp.fromObject(object.timestamp); + } + if (object.validator_address != null) + if (typeof object.validator_address === "string") + $util.base64.decode(object.validator_address, message.validator_address = $util.newBuffer($util.base64.length(object.validator_address)), 0); + else if (object.validator_address.length) + message.validator_address = object.validator_address; + if (object.validator_index != null) + message.validator_index = object.validator_index | 0; + if (object.signature != null) + if (typeof object.signature === "string") + $util.base64.decode(object.signature, message.signature = $util.newBuffer($util.base64.length(object.signature)), 0); + else if (object.signature.length) + message.signature = object.signature; + return message; + }; + + /** + * Creates a plain object from a Vote message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.types.Vote + * @static + * @param {tendermint.types.Vote} message Vote + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Vote.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.type = options.enums === String ? "SIGNED_MSG_TYPE_UNKNOWN" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.height = options.longs === String ? "0" : 0; + object.round = 0; + object.block_id = null; + object.timestamp = null; + if (options.bytes === String) + object.validator_address = ""; + else { + object.validator_address = []; + if (options.bytes !== Array) + object.validator_address = $util.newBuffer(object.validator_address); + } + object.validator_index = 0; + if (options.bytes === String) + object.signature = ""; + else { + object.signature = []; + if (options.bytes !== Array) + object.signature = $util.newBuffer(object.signature); + } + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.tendermint.types.SignedMsgType[message.type] : message.type; + if (message.height != null && message.hasOwnProperty("height")) + if (typeof message.height === "number") + object.height = options.longs === String ? String(message.height) : message.height; + else + object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; + if (message.round != null && message.hasOwnProperty("round")) + object.round = message.round; + if (message.block_id != null && message.hasOwnProperty("block_id")) + object.block_id = $root.tendermint.types.BlockID.toObject(message.block_id, options); + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + object.timestamp = $root.google.protobuf.Timestamp.toObject(message.timestamp, options); + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + object.validator_address = options.bytes === String ? $util.base64.encode(message.validator_address, 0, message.validator_address.length) : options.bytes === Array ? Array.prototype.slice.call(message.validator_address) : message.validator_address; + if (message.validator_index != null && message.hasOwnProperty("validator_index")) + object.validator_index = message.validator_index; + if (message.signature != null && message.hasOwnProperty("signature")) + object.signature = options.bytes === String ? $util.base64.encode(message.signature, 0, message.signature.length) : options.bytes === Array ? Array.prototype.slice.call(message.signature) : message.signature; + return object; + }; + + /** + * Converts this Vote to JSON. + * @function toJSON + * @memberof tendermint.types.Vote + * @instance + * @returns {Object.} JSON object + */ + Vote.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Vote; + })(); + + types.Commit = (function() { + + /** + * Properties of a Commit. + * @memberof tendermint.types + * @interface ICommit + * @property {Long|null} [height] Commit height + * @property {number|null} [round] Commit round + * @property {tendermint.types.IBlockID|null} [block_id] Commit block_id + * @property {Array.|null} [signatures] Commit signatures + */ + + /** + * Constructs a new Commit. + * @memberof tendermint.types + * @classdesc Represents a Commit. + * @implements ICommit + * @constructor + * @param {tendermint.types.ICommit=} [properties] Properties to set + */ + function Commit(properties) { + this.signatures = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Commit height. + * @member {Long} height + * @memberof tendermint.types.Commit + * @instance + */ + Commit.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Commit round. + * @member {number} round + * @memberof tendermint.types.Commit + * @instance + */ + Commit.prototype.round = 0; + + /** + * Commit block_id. + * @member {tendermint.types.IBlockID|null|undefined} block_id + * @memberof tendermint.types.Commit + * @instance + */ + Commit.prototype.block_id = null; + + /** + * Commit signatures. + * @member {Array.} signatures + * @memberof tendermint.types.Commit + * @instance + */ + Commit.prototype.signatures = $util.emptyArray; + + /** + * Encodes the specified Commit message. Does not implicitly {@link tendermint.types.Commit.verify|verify} messages. + * @function encode + * @memberof tendermint.types.Commit + * @static + * @param {tendermint.types.ICommit} message Commit message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Commit.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.height); + if (message.round != null && Object.hasOwnProperty.call(message, "round")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.round); + if (message.block_id != null && Object.hasOwnProperty.call(message, "block_id")) + $root.tendermint.types.BlockID.encode(message.block_id, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.signatures != null && message.signatures.length) + for (let i = 0; i < message.signatures.length; ++i) + $root.tendermint.types.CommitSig.encode(message.signatures[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Commit message, length delimited. Does not implicitly {@link tendermint.types.Commit.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.types.Commit + * @static + * @param {tendermint.types.ICommit} message Commit message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Commit.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Commit message from the specified reader or buffer. + * @function decode + * @memberof tendermint.types.Commit + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.types.Commit} Commit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Commit.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.Commit(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + case 2: + message.round = reader.int32(); + break; + case 3: + message.block_id = $root.tendermint.types.BlockID.decode(reader, reader.uint32()); + break; + case 4: + if (!(message.signatures && message.signatures.length)) + message.signatures = []; + message.signatures.push($root.tendermint.types.CommitSig.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Commit message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.types.Commit + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.types.Commit} Commit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Commit.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Commit message. + * @function verify + * @memberof tendermint.types.Commit + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Commit.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) + return "height: integer|Long expected"; + if (message.round != null && message.hasOwnProperty("round")) + if (!$util.isInteger(message.round)) + return "round: integer expected"; + if (message.block_id != null && message.hasOwnProperty("block_id")) { + let error = $root.tendermint.types.BlockID.verify(message.block_id); + if (error) + return "block_id." + error; + } + if (message.signatures != null && message.hasOwnProperty("signatures")) { + if (!Array.isArray(message.signatures)) + return "signatures: array expected"; + for (let i = 0; i < message.signatures.length; ++i) { + let error = $root.tendermint.types.CommitSig.verify(message.signatures[i]); + if (error) + return "signatures." + error; + } + } + return null; + }; + + /** + * Creates a Commit message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.types.Commit + * @static + * @param {Object.} object Plain object + * @returns {tendermint.types.Commit} Commit + */ + Commit.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.types.Commit) + return object; + let message = new $root.tendermint.types.Commit(); + if (object.height != null) + if ($util.Long) + (message.height = $util.Long.fromValue(object.height)).unsigned = false; + else if (typeof object.height === "string") + message.height = parseInt(object.height, 10); + else if (typeof object.height === "number") + message.height = object.height; + else if (typeof object.height === "object") + message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); + if (object.round != null) + message.round = object.round | 0; + if (object.block_id != null) { + if (typeof object.block_id !== "object") + throw TypeError(".tendermint.types.Commit.block_id: object expected"); + message.block_id = $root.tendermint.types.BlockID.fromObject(object.block_id); + } + if (object.signatures) { + if (!Array.isArray(object.signatures)) + throw TypeError(".tendermint.types.Commit.signatures: array expected"); + message.signatures = []; + for (let i = 0; i < object.signatures.length; ++i) { + if (typeof object.signatures[i] !== "object") + throw TypeError(".tendermint.types.Commit.signatures: object expected"); + message.signatures[i] = $root.tendermint.types.CommitSig.fromObject(object.signatures[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Commit message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.types.Commit + * @static + * @param {tendermint.types.Commit} message Commit + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Commit.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.signatures = []; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.height = options.longs === String ? "0" : 0; + object.round = 0; + object.block_id = null; + } + if (message.height != null && message.hasOwnProperty("height")) + if (typeof message.height === "number") + object.height = options.longs === String ? String(message.height) : message.height; + else + object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; + if (message.round != null && message.hasOwnProperty("round")) + object.round = message.round; + if (message.block_id != null && message.hasOwnProperty("block_id")) + object.block_id = $root.tendermint.types.BlockID.toObject(message.block_id, options); + if (message.signatures && message.signatures.length) { + object.signatures = []; + for (let j = 0; j < message.signatures.length; ++j) + object.signatures[j] = $root.tendermint.types.CommitSig.toObject(message.signatures[j], options); + } + return object; + }; + + /** + * Converts this Commit to JSON. + * @function toJSON + * @memberof tendermint.types.Commit + * @instance + * @returns {Object.} JSON object + */ + Commit.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Commit; + })(); + + types.CommitSig = (function() { + + /** + * Properties of a CommitSig. + * @memberof tendermint.types + * @interface ICommitSig + * @property {tendermint.types.BlockIDFlag|null} [block_id_flag] CommitSig block_id_flag + * @property {Uint8Array|null} [validator_address] CommitSig validator_address + * @property {google.protobuf.ITimestamp|null} [timestamp] CommitSig timestamp + * @property {Uint8Array|null} [signature] CommitSig signature + */ + + /** + * Constructs a new CommitSig. + * @memberof tendermint.types + * @classdesc Represents a CommitSig. + * @implements ICommitSig + * @constructor + * @param {tendermint.types.ICommitSig=} [properties] Properties to set + */ + function CommitSig(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CommitSig block_id_flag. + * @member {tendermint.types.BlockIDFlag} block_id_flag + * @memberof tendermint.types.CommitSig + * @instance + */ + CommitSig.prototype.block_id_flag = 0; + + /** + * CommitSig validator_address. + * @member {Uint8Array} validator_address + * @memberof tendermint.types.CommitSig + * @instance + */ + CommitSig.prototype.validator_address = $util.newBuffer([]); + + /** + * CommitSig timestamp. + * @member {google.protobuf.ITimestamp|null|undefined} timestamp + * @memberof tendermint.types.CommitSig + * @instance + */ + CommitSig.prototype.timestamp = null; + + /** + * CommitSig signature. + * @member {Uint8Array} signature + * @memberof tendermint.types.CommitSig + * @instance + */ + CommitSig.prototype.signature = $util.newBuffer([]); + + /** + * Encodes the specified CommitSig message. Does not implicitly {@link tendermint.types.CommitSig.verify|verify} messages. + * @function encode + * @memberof tendermint.types.CommitSig + * @static + * @param {tendermint.types.ICommitSig} message CommitSig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommitSig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.block_id_flag != null && Object.hasOwnProperty.call(message, "block_id_flag")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.block_id_flag); + if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.validator_address); + if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) + $root.google.protobuf.Timestamp.encode(message.timestamp, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.signature != null && Object.hasOwnProperty.call(message, "signature")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.signature); + return writer; + }; + + /** + * Encodes the specified CommitSig message, length delimited. Does not implicitly {@link tendermint.types.CommitSig.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.types.CommitSig + * @static + * @param {tendermint.types.ICommitSig} message CommitSig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommitSig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CommitSig message from the specified reader or buffer. + * @function decode + * @memberof tendermint.types.CommitSig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.types.CommitSig} CommitSig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommitSig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.CommitSig(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.block_id_flag = reader.int32(); + break; + case 2: + message.validator_address = reader.bytes(); + break; + case 3: + message.timestamp = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + message.signature = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CommitSig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.types.CommitSig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.types.CommitSig} CommitSig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommitSig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CommitSig message. + * @function verify + * @memberof tendermint.types.CommitSig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CommitSig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.block_id_flag != null && message.hasOwnProperty("block_id_flag")) + switch (message.block_id_flag) { + default: + return "block_id_flag: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + if (!(message.validator_address && typeof message.validator_address.length === "number" || $util.isString(message.validator_address))) + return "validator_address: buffer expected"; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) { + let error = $root.google.protobuf.Timestamp.verify(message.timestamp); + if (error) + return "timestamp." + error; + } + if (message.signature != null && message.hasOwnProperty("signature")) + if (!(message.signature && typeof message.signature.length === "number" || $util.isString(message.signature))) + return "signature: buffer expected"; + return null; + }; + + /** + * Creates a CommitSig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.types.CommitSig + * @static + * @param {Object.} object Plain object + * @returns {tendermint.types.CommitSig} CommitSig + */ + CommitSig.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.types.CommitSig) + return object; + let message = new $root.tendermint.types.CommitSig(); + switch (object.block_id_flag) { + case "BLOCK_ID_FLAG_UNKNOWN": + case 0: + message.block_id_flag = 0; + break; + case "BLOCK_ID_FLAG_ABSENT": + case 1: + message.block_id_flag = 1; + break; + case "BLOCK_ID_FLAG_COMMIT": + case 2: + message.block_id_flag = 2; + break; + case "BLOCK_ID_FLAG_NIL": + case 3: + message.block_id_flag = 3; + break; + } + if (object.validator_address != null) + if (typeof object.validator_address === "string") + $util.base64.decode(object.validator_address, message.validator_address = $util.newBuffer($util.base64.length(object.validator_address)), 0); + else if (object.validator_address.length) + message.validator_address = object.validator_address; + if (object.timestamp != null) { + if (typeof object.timestamp !== "object") + throw TypeError(".tendermint.types.CommitSig.timestamp: object expected"); + message.timestamp = $root.google.protobuf.Timestamp.fromObject(object.timestamp); + } + if (object.signature != null) + if (typeof object.signature === "string") + $util.base64.decode(object.signature, message.signature = $util.newBuffer($util.base64.length(object.signature)), 0); + else if (object.signature.length) + message.signature = object.signature; + return message; + }; + + /** + * Creates a plain object from a CommitSig message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.types.CommitSig + * @static + * @param {tendermint.types.CommitSig} message CommitSig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CommitSig.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.block_id_flag = options.enums === String ? "BLOCK_ID_FLAG_UNKNOWN" : 0; + if (options.bytes === String) + object.validator_address = ""; + else { + object.validator_address = []; + if (options.bytes !== Array) + object.validator_address = $util.newBuffer(object.validator_address); + } + object.timestamp = null; + if (options.bytes === String) + object.signature = ""; + else { + object.signature = []; + if (options.bytes !== Array) + object.signature = $util.newBuffer(object.signature); + } + } + if (message.block_id_flag != null && message.hasOwnProperty("block_id_flag")) + object.block_id_flag = options.enums === String ? $root.tendermint.types.BlockIDFlag[message.block_id_flag] : message.block_id_flag; + if (message.validator_address != null && message.hasOwnProperty("validator_address")) + object.validator_address = options.bytes === String ? $util.base64.encode(message.validator_address, 0, message.validator_address.length) : options.bytes === Array ? Array.prototype.slice.call(message.validator_address) : message.validator_address; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + object.timestamp = $root.google.protobuf.Timestamp.toObject(message.timestamp, options); + if (message.signature != null && message.hasOwnProperty("signature")) + object.signature = options.bytes === String ? $util.base64.encode(message.signature, 0, message.signature.length) : options.bytes === Array ? Array.prototype.slice.call(message.signature) : message.signature; + return object; + }; + + /** + * Converts this CommitSig to JSON. + * @function toJSON + * @memberof tendermint.types.CommitSig + * @instance + * @returns {Object.} JSON object + */ + CommitSig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CommitSig; + })(); + + types.Proposal = (function() { + + /** + * Properties of a Proposal. + * @memberof tendermint.types + * @interface IProposal + * @property {tendermint.types.SignedMsgType|null} [type] Proposal type + * @property {Long|null} [height] Proposal height + * @property {number|null} [round] Proposal round + * @property {number|null} [pol_round] Proposal pol_round + * @property {tendermint.types.IBlockID|null} [block_id] Proposal block_id + * @property {google.protobuf.ITimestamp|null} [timestamp] Proposal timestamp + * @property {Uint8Array|null} [signature] Proposal signature + */ + + /** + * Constructs a new Proposal. + * @memberof tendermint.types + * @classdesc Represents a Proposal. + * @implements IProposal + * @constructor + * @param {tendermint.types.IProposal=} [properties] Properties to set + */ + function Proposal(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Proposal type. + * @member {tendermint.types.SignedMsgType} type + * @memberof tendermint.types.Proposal + * @instance + */ + Proposal.prototype.type = 0; + + /** + * Proposal height. + * @member {Long} height + * @memberof tendermint.types.Proposal + * @instance + */ + Proposal.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Proposal round. + * @member {number} round + * @memberof tendermint.types.Proposal + * @instance + */ + Proposal.prototype.round = 0; + + /** + * Proposal pol_round. + * @member {number} pol_round + * @memberof tendermint.types.Proposal + * @instance + */ + Proposal.prototype.pol_round = 0; + + /** + * Proposal block_id. + * @member {tendermint.types.IBlockID|null|undefined} block_id + * @memberof tendermint.types.Proposal + * @instance + */ + Proposal.prototype.block_id = null; + + /** + * Proposal timestamp. + * @member {google.protobuf.ITimestamp|null|undefined} timestamp + * @memberof tendermint.types.Proposal + * @instance + */ + Proposal.prototype.timestamp = null; + + /** + * Proposal signature. + * @member {Uint8Array} signature + * @memberof tendermint.types.Proposal + * @instance + */ + Proposal.prototype.signature = $util.newBuffer([]); + + /** + * Encodes the specified Proposal message. Does not implicitly {@link tendermint.types.Proposal.verify|verify} messages. + * @function encode + * @memberof tendermint.types.Proposal + * @static + * @param {tendermint.types.IProposal} message Proposal message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Proposal.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.height); + if (message.round != null && Object.hasOwnProperty.call(message, "round")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.round); + if (message.pol_round != null && Object.hasOwnProperty.call(message, "pol_round")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.pol_round); + if (message.block_id != null && Object.hasOwnProperty.call(message, "block_id")) + $root.tendermint.types.BlockID.encode(message.block_id, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) + $root.google.protobuf.Timestamp.encode(message.timestamp, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.signature != null && Object.hasOwnProperty.call(message, "signature")) + writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.signature); + return writer; + }; + + /** + * Encodes the specified Proposal message, length delimited. Does not implicitly {@link tendermint.types.Proposal.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.types.Proposal + * @static + * @param {tendermint.types.IProposal} message Proposal message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Proposal.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Proposal message from the specified reader or buffer. + * @function decode + * @memberof tendermint.types.Proposal + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.types.Proposal} Proposal + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Proposal.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.Proposal(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.int32(); + break; + case 2: + message.height = reader.int64(); + break; + case 3: + message.round = reader.int32(); + break; + case 4: + message.pol_round = reader.int32(); + break; + case 5: + message.block_id = $root.tendermint.types.BlockID.decode(reader, reader.uint32()); + break; + case 6: + message.timestamp = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 7: + message.signature = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Proposal message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.types.Proposal + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.types.Proposal} Proposal + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Proposal.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Proposal message. + * @function verify + * @memberof tendermint.types.Proposal + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Proposal.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 32: + break; + } + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) + return "height: integer|Long expected"; + if (message.round != null && message.hasOwnProperty("round")) + if (!$util.isInteger(message.round)) + return "round: integer expected"; + if (message.pol_round != null && message.hasOwnProperty("pol_round")) + if (!$util.isInteger(message.pol_round)) + return "pol_round: integer expected"; + if (message.block_id != null && message.hasOwnProperty("block_id")) { + let error = $root.tendermint.types.BlockID.verify(message.block_id); + if (error) + return "block_id." + error; + } + if (message.timestamp != null && message.hasOwnProperty("timestamp")) { + let error = $root.google.protobuf.Timestamp.verify(message.timestamp); + if (error) + return "timestamp." + error; + } + if (message.signature != null && message.hasOwnProperty("signature")) + if (!(message.signature && typeof message.signature.length === "number" || $util.isString(message.signature))) + return "signature: buffer expected"; + return null; + }; + + /** + * Creates a Proposal message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.types.Proposal + * @static + * @param {Object.} object Plain object + * @returns {tendermint.types.Proposal} Proposal + */ + Proposal.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.types.Proposal) + return object; + let message = new $root.tendermint.types.Proposal(); + switch (object.type) { + case "SIGNED_MSG_TYPE_UNKNOWN": + case 0: + message.type = 0; + break; + case "SIGNED_MSG_TYPE_PREVOTE": + case 1: + message.type = 1; + break; + case "SIGNED_MSG_TYPE_PRECOMMIT": + case 2: + message.type = 2; + break; + case "SIGNED_MSG_TYPE_PROPOSAL": + case 32: + message.type = 32; + break; + } + if (object.height != null) + if ($util.Long) + (message.height = $util.Long.fromValue(object.height)).unsigned = false; + else if (typeof object.height === "string") + message.height = parseInt(object.height, 10); + else if (typeof object.height === "number") + message.height = object.height; + else if (typeof object.height === "object") + message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); + if (object.round != null) + message.round = object.round | 0; + if (object.pol_round != null) + message.pol_round = object.pol_round | 0; + if (object.block_id != null) { + if (typeof object.block_id !== "object") + throw TypeError(".tendermint.types.Proposal.block_id: object expected"); + message.block_id = $root.tendermint.types.BlockID.fromObject(object.block_id); + } + if (object.timestamp != null) { + if (typeof object.timestamp !== "object") + throw TypeError(".tendermint.types.Proposal.timestamp: object expected"); + message.timestamp = $root.google.protobuf.Timestamp.fromObject(object.timestamp); + } + if (object.signature != null) + if (typeof object.signature === "string") + $util.base64.decode(object.signature, message.signature = $util.newBuffer($util.base64.length(object.signature)), 0); + else if (object.signature.length) + message.signature = object.signature; + return message; + }; + + /** + * Creates a plain object from a Proposal message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.types.Proposal + * @static + * @param {tendermint.types.Proposal} message Proposal + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Proposal.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.type = options.enums === String ? "SIGNED_MSG_TYPE_UNKNOWN" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.height = options.longs === String ? "0" : 0; + object.round = 0; + object.pol_round = 0; + object.block_id = null; + object.timestamp = null; + if (options.bytes === String) + object.signature = ""; + else { + object.signature = []; + if (options.bytes !== Array) + object.signature = $util.newBuffer(object.signature); + } + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.tendermint.types.SignedMsgType[message.type] : message.type; + if (message.height != null && message.hasOwnProperty("height")) + if (typeof message.height === "number") + object.height = options.longs === String ? String(message.height) : message.height; + else + object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; + if (message.round != null && message.hasOwnProperty("round")) + object.round = message.round; + if (message.pol_round != null && message.hasOwnProperty("pol_round")) + object.pol_round = message.pol_round; + if (message.block_id != null && message.hasOwnProperty("block_id")) + object.block_id = $root.tendermint.types.BlockID.toObject(message.block_id, options); + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + object.timestamp = $root.google.protobuf.Timestamp.toObject(message.timestamp, options); + if (message.signature != null && message.hasOwnProperty("signature")) + object.signature = options.bytes === String ? $util.base64.encode(message.signature, 0, message.signature.length) : options.bytes === Array ? Array.prototype.slice.call(message.signature) : message.signature; + return object; + }; + + /** + * Converts this Proposal to JSON. + * @function toJSON + * @memberof tendermint.types.Proposal + * @instance + * @returns {Object.} JSON object + */ + Proposal.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Proposal; + })(); + + types.SignedHeader = (function() { + + /** + * Properties of a SignedHeader. + * @memberof tendermint.types + * @interface ISignedHeader + * @property {tendermint.types.IHeader|null} [header] SignedHeader header + * @property {tendermint.types.ICommit|null} [commit] SignedHeader commit + */ + + /** + * Constructs a new SignedHeader. + * @memberof tendermint.types + * @classdesc Represents a SignedHeader. + * @implements ISignedHeader + * @constructor + * @param {tendermint.types.ISignedHeader=} [properties] Properties to set + */ + function SignedHeader(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SignedHeader header. + * @member {tendermint.types.IHeader|null|undefined} header + * @memberof tendermint.types.SignedHeader + * @instance + */ + SignedHeader.prototype.header = null; + + /** + * SignedHeader commit. + * @member {tendermint.types.ICommit|null|undefined} commit + * @memberof tendermint.types.SignedHeader + * @instance + */ + SignedHeader.prototype.commit = null; + + /** + * Encodes the specified SignedHeader message. Does not implicitly {@link tendermint.types.SignedHeader.verify|verify} messages. + * @function encode + * @memberof tendermint.types.SignedHeader + * @static + * @param {tendermint.types.ISignedHeader} message SignedHeader message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SignedHeader.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.header != null && Object.hasOwnProperty.call(message, "header")) + $root.tendermint.types.Header.encode(message.header, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.commit != null && Object.hasOwnProperty.call(message, "commit")) + $root.tendermint.types.Commit.encode(message.commit, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SignedHeader message, length delimited. Does not implicitly {@link tendermint.types.SignedHeader.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.types.SignedHeader + * @static + * @param {tendermint.types.ISignedHeader} message SignedHeader message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SignedHeader.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SignedHeader message from the specified reader or buffer. + * @function decode + * @memberof tendermint.types.SignedHeader + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.types.SignedHeader} SignedHeader + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SignedHeader.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.SignedHeader(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.header = $root.tendermint.types.Header.decode(reader, reader.uint32()); + break; + case 2: + message.commit = $root.tendermint.types.Commit.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SignedHeader message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.types.SignedHeader + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.types.SignedHeader} SignedHeader + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SignedHeader.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SignedHeader message. + * @function verify + * @memberof tendermint.types.SignedHeader + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SignedHeader.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.header != null && message.hasOwnProperty("header")) { + let error = $root.tendermint.types.Header.verify(message.header); + if (error) + return "header." + error; + } + if (message.commit != null && message.hasOwnProperty("commit")) { + let error = $root.tendermint.types.Commit.verify(message.commit); + if (error) + return "commit." + error; + } + return null; + }; + + /** + * Creates a SignedHeader message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.types.SignedHeader + * @static + * @param {Object.} object Plain object + * @returns {tendermint.types.SignedHeader} SignedHeader + */ + SignedHeader.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.types.SignedHeader) + return object; + let message = new $root.tendermint.types.SignedHeader(); + if (object.header != null) { + if (typeof object.header !== "object") + throw TypeError(".tendermint.types.SignedHeader.header: object expected"); + message.header = $root.tendermint.types.Header.fromObject(object.header); + } + if (object.commit != null) { + if (typeof object.commit !== "object") + throw TypeError(".tendermint.types.SignedHeader.commit: object expected"); + message.commit = $root.tendermint.types.Commit.fromObject(object.commit); + } + return message; + }; + + /** + * Creates a plain object from a SignedHeader message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.types.SignedHeader + * @static + * @param {tendermint.types.SignedHeader} message SignedHeader + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SignedHeader.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.header = null; + object.commit = null; + } + if (message.header != null && message.hasOwnProperty("header")) + object.header = $root.tendermint.types.Header.toObject(message.header, options); + if (message.commit != null && message.hasOwnProperty("commit")) + object.commit = $root.tendermint.types.Commit.toObject(message.commit, options); + return object; + }; + + /** + * Converts this SignedHeader to JSON. + * @function toJSON + * @memberof tendermint.types.SignedHeader + * @instance + * @returns {Object.} JSON object + */ + SignedHeader.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SignedHeader; + })(); + + types.LightBlock = (function() { + + /** + * Properties of a LightBlock. + * @memberof tendermint.types + * @interface ILightBlock + * @property {tendermint.types.ISignedHeader|null} [signed_header] LightBlock signed_header + * @property {tendermint.types.IValidatorSet|null} [validator_set] LightBlock validator_set + */ + + /** + * Constructs a new LightBlock. + * @memberof tendermint.types + * @classdesc Represents a LightBlock. + * @implements ILightBlock + * @constructor + * @param {tendermint.types.ILightBlock=} [properties] Properties to set + */ + function LightBlock(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LightBlock signed_header. + * @member {tendermint.types.ISignedHeader|null|undefined} signed_header + * @memberof tendermint.types.LightBlock + * @instance + */ + LightBlock.prototype.signed_header = null; + + /** + * LightBlock validator_set. + * @member {tendermint.types.IValidatorSet|null|undefined} validator_set + * @memberof tendermint.types.LightBlock + * @instance + */ + LightBlock.prototype.validator_set = null; + + /** + * Encodes the specified LightBlock message. Does not implicitly {@link tendermint.types.LightBlock.verify|verify} messages. + * @function encode + * @memberof tendermint.types.LightBlock + * @static + * @param {tendermint.types.ILightBlock} message LightBlock message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LightBlock.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.signed_header != null && Object.hasOwnProperty.call(message, "signed_header")) + $root.tendermint.types.SignedHeader.encode(message.signed_header, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.validator_set != null && Object.hasOwnProperty.call(message, "validator_set")) + $root.tendermint.types.ValidatorSet.encode(message.validator_set, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified LightBlock message, length delimited. Does not implicitly {@link tendermint.types.LightBlock.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.types.LightBlock + * @static + * @param {tendermint.types.ILightBlock} message LightBlock message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LightBlock.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LightBlock message from the specified reader or buffer. + * @function decode + * @memberof tendermint.types.LightBlock + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.types.LightBlock} LightBlock + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LightBlock.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.LightBlock(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signed_header = $root.tendermint.types.SignedHeader.decode(reader, reader.uint32()); + break; + case 2: + message.validator_set = $root.tendermint.types.ValidatorSet.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LightBlock message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.types.LightBlock + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.types.LightBlock} LightBlock + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LightBlock.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LightBlock message. + * @function verify + * @memberof tendermint.types.LightBlock + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LightBlock.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.signed_header != null && message.hasOwnProperty("signed_header")) { + let error = $root.tendermint.types.SignedHeader.verify(message.signed_header); + if (error) + return "signed_header." + error; + } + if (message.validator_set != null && message.hasOwnProperty("validator_set")) { + let error = $root.tendermint.types.ValidatorSet.verify(message.validator_set); + if (error) + return "validator_set." + error; + } + return null; + }; + + /** + * Creates a LightBlock message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.types.LightBlock + * @static + * @param {Object.} object Plain object + * @returns {tendermint.types.LightBlock} LightBlock + */ + LightBlock.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.types.LightBlock) + return object; + let message = new $root.tendermint.types.LightBlock(); + if (object.signed_header != null) { + if (typeof object.signed_header !== "object") + throw TypeError(".tendermint.types.LightBlock.signed_header: object expected"); + message.signed_header = $root.tendermint.types.SignedHeader.fromObject(object.signed_header); + } + if (object.validator_set != null) { + if (typeof object.validator_set !== "object") + throw TypeError(".tendermint.types.LightBlock.validator_set: object expected"); + message.validator_set = $root.tendermint.types.ValidatorSet.fromObject(object.validator_set); + } + return message; + }; + + /** + * Creates a plain object from a LightBlock message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.types.LightBlock + * @static + * @param {tendermint.types.LightBlock} message LightBlock + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LightBlock.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.signed_header = null; + object.validator_set = null; + } + if (message.signed_header != null && message.hasOwnProperty("signed_header")) + object.signed_header = $root.tendermint.types.SignedHeader.toObject(message.signed_header, options); + if (message.validator_set != null && message.hasOwnProperty("validator_set")) + object.validator_set = $root.tendermint.types.ValidatorSet.toObject(message.validator_set, options); + return object; + }; + + /** + * Converts this LightBlock to JSON. + * @function toJSON + * @memberof tendermint.types.LightBlock + * @instance + * @returns {Object.} JSON object + */ + LightBlock.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return LightBlock; + })(); + + types.BlockMeta = (function() { + + /** + * Properties of a BlockMeta. + * @memberof tendermint.types + * @interface IBlockMeta + * @property {tendermint.types.IBlockID|null} [block_id] BlockMeta block_id + * @property {Long|null} [block_size] BlockMeta block_size + * @property {tendermint.types.IHeader|null} [header] BlockMeta header + * @property {Long|null} [num_txs] BlockMeta num_txs + */ + + /** + * Constructs a new BlockMeta. + * @memberof tendermint.types + * @classdesc Represents a BlockMeta. + * @implements IBlockMeta + * @constructor + * @param {tendermint.types.IBlockMeta=} [properties] Properties to set + */ + function BlockMeta(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BlockMeta block_id. + * @member {tendermint.types.IBlockID|null|undefined} block_id + * @memberof tendermint.types.BlockMeta + * @instance + */ + BlockMeta.prototype.block_id = null; + + /** + * BlockMeta block_size. + * @member {Long} block_size + * @memberof tendermint.types.BlockMeta + * @instance + */ + BlockMeta.prototype.block_size = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BlockMeta header. + * @member {tendermint.types.IHeader|null|undefined} header + * @memberof tendermint.types.BlockMeta + * @instance + */ + BlockMeta.prototype.header = null; + + /** + * BlockMeta num_txs. + * @member {Long} num_txs + * @memberof tendermint.types.BlockMeta + * @instance + */ + BlockMeta.prototype.num_txs = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Encodes the specified BlockMeta message. Does not implicitly {@link tendermint.types.BlockMeta.verify|verify} messages. + * @function encode + * @memberof tendermint.types.BlockMeta + * @static + * @param {tendermint.types.IBlockMeta} message BlockMeta message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BlockMeta.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.block_id != null && Object.hasOwnProperty.call(message, "block_id")) + $root.tendermint.types.BlockID.encode(message.block_id, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.block_size != null && Object.hasOwnProperty.call(message, "block_size")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.block_size); + if (message.header != null && Object.hasOwnProperty.call(message, "header")) + $root.tendermint.types.Header.encode(message.header, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.num_txs != null && Object.hasOwnProperty.call(message, "num_txs")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.num_txs); + return writer; + }; + + /** + * Encodes the specified BlockMeta message, length delimited. Does not implicitly {@link tendermint.types.BlockMeta.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.types.BlockMeta + * @static + * @param {tendermint.types.IBlockMeta} message BlockMeta message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BlockMeta.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BlockMeta message from the specified reader or buffer. + * @function decode + * @memberof tendermint.types.BlockMeta + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.types.BlockMeta} BlockMeta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BlockMeta.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.BlockMeta(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.block_id = $root.tendermint.types.BlockID.decode(reader, reader.uint32()); + break; + case 2: + message.block_size = reader.int64(); + break; + case 3: + message.header = $root.tendermint.types.Header.decode(reader, reader.uint32()); + break; + case 4: + message.num_txs = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BlockMeta message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.types.BlockMeta + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.types.BlockMeta} BlockMeta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BlockMeta.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BlockMeta message. + * @function verify + * @memberof tendermint.types.BlockMeta + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BlockMeta.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.block_id != null && message.hasOwnProperty("block_id")) { + let error = $root.tendermint.types.BlockID.verify(message.block_id); + if (error) + return "block_id." + error; + } + if (message.block_size != null && message.hasOwnProperty("block_size")) + if (!$util.isInteger(message.block_size) && !(message.block_size && $util.isInteger(message.block_size.low) && $util.isInteger(message.block_size.high))) + return "block_size: integer|Long expected"; + if (message.header != null && message.hasOwnProperty("header")) { + let error = $root.tendermint.types.Header.verify(message.header); + if (error) + return "header." + error; + } + if (message.num_txs != null && message.hasOwnProperty("num_txs")) + if (!$util.isInteger(message.num_txs) && !(message.num_txs && $util.isInteger(message.num_txs.low) && $util.isInteger(message.num_txs.high))) + return "num_txs: integer|Long expected"; + return null; + }; + + /** + * Creates a BlockMeta message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.types.BlockMeta + * @static + * @param {Object.} object Plain object + * @returns {tendermint.types.BlockMeta} BlockMeta + */ + BlockMeta.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.types.BlockMeta) + return object; + let message = new $root.tendermint.types.BlockMeta(); + if (object.block_id != null) { + if (typeof object.block_id !== "object") + throw TypeError(".tendermint.types.BlockMeta.block_id: object expected"); + message.block_id = $root.tendermint.types.BlockID.fromObject(object.block_id); + } + if (object.block_size != null) + if ($util.Long) + (message.block_size = $util.Long.fromValue(object.block_size)).unsigned = false; + else if (typeof object.block_size === "string") + message.block_size = parseInt(object.block_size, 10); + else if (typeof object.block_size === "number") + message.block_size = object.block_size; + else if (typeof object.block_size === "object") + message.block_size = new $util.LongBits(object.block_size.low >>> 0, object.block_size.high >>> 0).toNumber(); + if (object.header != null) { + if (typeof object.header !== "object") + throw TypeError(".tendermint.types.BlockMeta.header: object expected"); + message.header = $root.tendermint.types.Header.fromObject(object.header); + } + if (object.num_txs != null) + if ($util.Long) + (message.num_txs = $util.Long.fromValue(object.num_txs)).unsigned = false; + else if (typeof object.num_txs === "string") + message.num_txs = parseInt(object.num_txs, 10); + else if (typeof object.num_txs === "number") + message.num_txs = object.num_txs; + else if (typeof object.num_txs === "object") + message.num_txs = new $util.LongBits(object.num_txs.low >>> 0, object.num_txs.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a BlockMeta message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.types.BlockMeta + * @static + * @param {tendermint.types.BlockMeta} message BlockMeta + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BlockMeta.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.block_id = null; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.block_size = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.block_size = options.longs === String ? "0" : 0; + object.header = null; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.num_txs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.num_txs = options.longs === String ? "0" : 0; + } + if (message.block_id != null && message.hasOwnProperty("block_id")) + object.block_id = $root.tendermint.types.BlockID.toObject(message.block_id, options); + if (message.block_size != null && message.hasOwnProperty("block_size")) + if (typeof message.block_size === "number") + object.block_size = options.longs === String ? String(message.block_size) : message.block_size; + else + object.block_size = options.longs === String ? $util.Long.prototype.toString.call(message.block_size) : options.longs === Number ? new $util.LongBits(message.block_size.low >>> 0, message.block_size.high >>> 0).toNumber() : message.block_size; + if (message.header != null && message.hasOwnProperty("header")) + object.header = $root.tendermint.types.Header.toObject(message.header, options); + if (message.num_txs != null && message.hasOwnProperty("num_txs")) + if (typeof message.num_txs === "number") + object.num_txs = options.longs === String ? String(message.num_txs) : message.num_txs; + else + object.num_txs = options.longs === String ? $util.Long.prototype.toString.call(message.num_txs) : options.longs === Number ? new $util.LongBits(message.num_txs.low >>> 0, message.num_txs.high >>> 0).toNumber() : message.num_txs; + return object; + }; + + /** + * Converts this BlockMeta to JSON. + * @function toJSON + * @memberof tendermint.types.BlockMeta + * @instance + * @returns {Object.} JSON object + */ + BlockMeta.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BlockMeta; + })(); + + types.TxProof = (function() { + + /** + * Properties of a TxProof. + * @memberof tendermint.types + * @interface ITxProof + * @property {Uint8Array|null} [root_hash] TxProof root_hash + * @property {Uint8Array|null} [data] TxProof data + * @property {tendermint.crypto.IProof|null} [proof] TxProof proof + */ + + /** + * Constructs a new TxProof. + * @memberof tendermint.types + * @classdesc Represents a TxProof. + * @implements ITxProof + * @constructor + * @param {tendermint.types.ITxProof=} [properties] Properties to set + */ + function TxProof(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TxProof root_hash. + * @member {Uint8Array} root_hash + * @memberof tendermint.types.TxProof + * @instance + */ + TxProof.prototype.root_hash = $util.newBuffer([]); + + /** + * TxProof data. + * @member {Uint8Array} data + * @memberof tendermint.types.TxProof + * @instance + */ + TxProof.prototype.data = $util.newBuffer([]); + + /** + * TxProof proof. + * @member {tendermint.crypto.IProof|null|undefined} proof + * @memberof tendermint.types.TxProof + * @instance + */ + TxProof.prototype.proof = null; + + /** + * Encodes the specified TxProof message. Does not implicitly {@link tendermint.types.TxProof.verify|verify} messages. + * @function encode + * @memberof tendermint.types.TxProof + * @static + * @param {tendermint.types.ITxProof} message TxProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TxProof.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.root_hash != null && Object.hasOwnProperty.call(message, "root_hash")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.root_hash); + if (message.data != null && Object.hasOwnProperty.call(message, "data")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.data); + if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) + $root.tendermint.crypto.Proof.encode(message.proof, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TxProof message, length delimited. Does not implicitly {@link tendermint.types.TxProof.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.types.TxProof + * @static + * @param {tendermint.types.ITxProof} message TxProof message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TxProof.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TxProof message from the specified reader or buffer. + * @function decode + * @memberof tendermint.types.TxProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.types.TxProof} TxProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TxProof.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.TxProof(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.root_hash = reader.bytes(); + break; + case 2: + message.data = reader.bytes(); + break; + case 3: + message.proof = $root.tendermint.crypto.Proof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TxProof message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.types.TxProof + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.types.TxProof} TxProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TxProof.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TxProof message. + * @function verify + * @memberof tendermint.types.TxProof + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TxProof.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.root_hash != null && message.hasOwnProperty("root_hash")) + if (!(message.root_hash && typeof message.root_hash.length === "number" || $util.isString(message.root_hash))) + return "root_hash: buffer expected"; + if (message.data != null && message.hasOwnProperty("data")) + if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) + return "data: buffer expected"; + if (message.proof != null && message.hasOwnProperty("proof")) { + let error = $root.tendermint.crypto.Proof.verify(message.proof); + if (error) + return "proof." + error; + } + return null; + }; + + /** + * Creates a TxProof message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.types.TxProof + * @static + * @param {Object.} object Plain object + * @returns {tendermint.types.TxProof} TxProof + */ + TxProof.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.types.TxProof) + return object; + let message = new $root.tendermint.types.TxProof(); + if (object.root_hash != null) + if (typeof object.root_hash === "string") + $util.base64.decode(object.root_hash, message.root_hash = $util.newBuffer($util.base64.length(object.root_hash)), 0); + else if (object.root_hash.length) + message.root_hash = object.root_hash; + if (object.data != null) + if (typeof object.data === "string") + $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); + else if (object.data.length) + message.data = object.data; + if (object.proof != null) { + if (typeof object.proof !== "object") + throw TypeError(".tendermint.types.TxProof.proof: object expected"); + message.proof = $root.tendermint.crypto.Proof.fromObject(object.proof); + } + return message; + }; + + /** + * Creates a plain object from a TxProof message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.types.TxProof + * @static + * @param {tendermint.types.TxProof} message TxProof + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TxProof.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if (options.bytes === String) + object.root_hash = ""; + else { + object.root_hash = []; + if (options.bytes !== Array) + object.root_hash = $util.newBuffer(object.root_hash); + } + if (options.bytes === String) + object.data = ""; + else { + object.data = []; + if (options.bytes !== Array) + object.data = $util.newBuffer(object.data); + } + object.proof = null; + } + if (message.root_hash != null && message.hasOwnProperty("root_hash")) + object.root_hash = options.bytes === String ? $util.base64.encode(message.root_hash, 0, message.root_hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.root_hash) : message.root_hash; + if (message.data != null && message.hasOwnProperty("data")) + object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; + if (message.proof != null && message.hasOwnProperty("proof")) + object.proof = $root.tendermint.crypto.Proof.toObject(message.proof, options); + return object; + }; + + /** + * Converts this TxProof to JSON. + * @function toJSON + * @memberof tendermint.types.TxProof + * @instance + * @returns {Object.} JSON object + */ + TxProof.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TxProof; + })(); + + types.ValidatorSet = (function() { + + /** + * Properties of a ValidatorSet. + * @memberof tendermint.types + * @interface IValidatorSet + * @property {Array.|null} [validators] ValidatorSet validators + * @property {tendermint.types.IValidator|null} [proposer] ValidatorSet proposer + * @property {Long|null} [total_voting_power] ValidatorSet total_voting_power + */ + + /** + * Constructs a new ValidatorSet. + * @memberof tendermint.types + * @classdesc Represents a ValidatorSet. + * @implements IValidatorSet + * @constructor + * @param {tendermint.types.IValidatorSet=} [properties] Properties to set + */ + function ValidatorSet(properties) { + this.validators = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ValidatorSet validators. + * @member {Array.} validators + * @memberof tendermint.types.ValidatorSet + * @instance + */ + ValidatorSet.prototype.validators = $util.emptyArray; + + /** + * ValidatorSet proposer. + * @member {tendermint.types.IValidator|null|undefined} proposer + * @memberof tendermint.types.ValidatorSet + * @instance + */ + ValidatorSet.prototype.proposer = null; + + /** + * ValidatorSet total_voting_power. + * @member {Long} total_voting_power + * @memberof tendermint.types.ValidatorSet + * @instance + */ + ValidatorSet.prototype.total_voting_power = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Encodes the specified ValidatorSet message. Does not implicitly {@link tendermint.types.ValidatorSet.verify|verify} messages. + * @function encode + * @memberof tendermint.types.ValidatorSet + * @static + * @param {tendermint.types.IValidatorSet} message ValidatorSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorSet.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.validators != null && message.validators.length) + for (let i = 0; i < message.validators.length; ++i) + $root.tendermint.types.Validator.encode(message.validators[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.proposer != null && Object.hasOwnProperty.call(message, "proposer")) + $root.tendermint.types.Validator.encode(message.proposer, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.total_voting_power != null && Object.hasOwnProperty.call(message, "total_voting_power")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.total_voting_power); + return writer; + }; + + /** + * Encodes the specified ValidatorSet message, length delimited. Does not implicitly {@link tendermint.types.ValidatorSet.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.types.ValidatorSet + * @static + * @param {tendermint.types.IValidatorSet} message ValidatorSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorSet.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ValidatorSet message from the specified reader or buffer. + * @function decode + * @memberof tendermint.types.ValidatorSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.types.ValidatorSet} ValidatorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorSet.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.ValidatorSet(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.validators && message.validators.length)) + message.validators = []; + message.validators.push($root.tendermint.types.Validator.decode(reader, reader.uint32())); + break; + case 2: + message.proposer = $root.tendermint.types.Validator.decode(reader, reader.uint32()); + break; + case 3: + message.total_voting_power = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ValidatorSet message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.types.ValidatorSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.types.ValidatorSet} ValidatorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorSet.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ValidatorSet message. + * @function verify + * @memberof tendermint.types.ValidatorSet + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ValidatorSet.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.validators != null && message.hasOwnProperty("validators")) { + if (!Array.isArray(message.validators)) + return "validators: array expected"; + for (let i = 0; i < message.validators.length; ++i) { + let error = $root.tendermint.types.Validator.verify(message.validators[i]); + if (error) + return "validators." + error; + } + } + if (message.proposer != null && message.hasOwnProperty("proposer")) { + let error = $root.tendermint.types.Validator.verify(message.proposer); + if (error) + return "proposer." + error; + } + if (message.total_voting_power != null && message.hasOwnProperty("total_voting_power")) + if (!$util.isInteger(message.total_voting_power) && !(message.total_voting_power && $util.isInteger(message.total_voting_power.low) && $util.isInteger(message.total_voting_power.high))) + return "total_voting_power: integer|Long expected"; + return null; + }; + + /** + * Creates a ValidatorSet message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.types.ValidatorSet + * @static + * @param {Object.} object Plain object + * @returns {tendermint.types.ValidatorSet} ValidatorSet + */ + ValidatorSet.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.types.ValidatorSet) + return object; + let message = new $root.tendermint.types.ValidatorSet(); + if (object.validators) { + if (!Array.isArray(object.validators)) + throw TypeError(".tendermint.types.ValidatorSet.validators: array expected"); + message.validators = []; + for (let i = 0; i < object.validators.length; ++i) { + if (typeof object.validators[i] !== "object") + throw TypeError(".tendermint.types.ValidatorSet.validators: object expected"); + message.validators[i] = $root.tendermint.types.Validator.fromObject(object.validators[i]); + } + } + if (object.proposer != null) { + if (typeof object.proposer !== "object") + throw TypeError(".tendermint.types.ValidatorSet.proposer: object expected"); + message.proposer = $root.tendermint.types.Validator.fromObject(object.proposer); + } + if (object.total_voting_power != null) + if ($util.Long) + (message.total_voting_power = $util.Long.fromValue(object.total_voting_power)).unsigned = false; + else if (typeof object.total_voting_power === "string") + message.total_voting_power = parseInt(object.total_voting_power, 10); + else if (typeof object.total_voting_power === "number") + message.total_voting_power = object.total_voting_power; + else if (typeof object.total_voting_power === "object") + message.total_voting_power = new $util.LongBits(object.total_voting_power.low >>> 0, object.total_voting_power.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a ValidatorSet message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.types.ValidatorSet + * @static + * @param {tendermint.types.ValidatorSet} message ValidatorSet + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ValidatorSet.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.validators = []; + if (options.defaults) { + object.proposer = null; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.total_voting_power = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.total_voting_power = options.longs === String ? "0" : 0; + } + if (message.validators && message.validators.length) { + object.validators = []; + for (let j = 0; j < message.validators.length; ++j) + object.validators[j] = $root.tendermint.types.Validator.toObject(message.validators[j], options); + } + if (message.proposer != null && message.hasOwnProperty("proposer")) + object.proposer = $root.tendermint.types.Validator.toObject(message.proposer, options); + if (message.total_voting_power != null && message.hasOwnProperty("total_voting_power")) + if (typeof message.total_voting_power === "number") + object.total_voting_power = options.longs === String ? String(message.total_voting_power) : message.total_voting_power; + else + object.total_voting_power = options.longs === String ? $util.Long.prototype.toString.call(message.total_voting_power) : options.longs === Number ? new $util.LongBits(message.total_voting_power.low >>> 0, message.total_voting_power.high >>> 0).toNumber() : message.total_voting_power; + return object; + }; + + /** + * Converts this ValidatorSet to JSON. + * @function toJSON + * @memberof tendermint.types.ValidatorSet + * @instance + * @returns {Object.} JSON object + */ + ValidatorSet.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ValidatorSet; + })(); + + types.Validator = (function() { + + /** + * Properties of a Validator. + * @memberof tendermint.types + * @interface IValidator + * @property {Uint8Array|null} [address] Validator address + * @property {tendermint.crypto.IPublicKey|null} [pub_key] Validator pub_key + * @property {Long|null} [voting_power] Validator voting_power + * @property {Long|null} [proposer_priority] Validator proposer_priority + */ + + /** + * Constructs a new Validator. + * @memberof tendermint.types + * @classdesc Represents a Validator. + * @implements IValidator + * @constructor + * @param {tendermint.types.IValidator=} [properties] Properties to set + */ + function Validator(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Validator address. + * @member {Uint8Array} address + * @memberof tendermint.types.Validator + * @instance + */ + Validator.prototype.address = $util.newBuffer([]); + + /** + * Validator pub_key. + * @member {tendermint.crypto.IPublicKey|null|undefined} pub_key + * @memberof tendermint.types.Validator + * @instance + */ + Validator.prototype.pub_key = null; + + /** + * Validator voting_power. + * @member {Long} voting_power + * @memberof tendermint.types.Validator + * @instance + */ + Validator.prototype.voting_power = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Validator proposer_priority. + * @member {Long} proposer_priority + * @memberof tendermint.types.Validator + * @instance + */ + Validator.prototype.proposer_priority = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Encodes the specified Validator message. Does not implicitly {@link tendermint.types.Validator.verify|verify} messages. + * @function encode + * @memberof tendermint.types.Validator + * @static + * @param {tendermint.types.IValidator} message Validator message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Validator.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.address != null && Object.hasOwnProperty.call(message, "address")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.address); + if (message.pub_key != null && Object.hasOwnProperty.call(message, "pub_key")) + $root.tendermint.crypto.PublicKey.encode(message.pub_key, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.voting_power != null && Object.hasOwnProperty.call(message, "voting_power")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.voting_power); + if (message.proposer_priority != null && Object.hasOwnProperty.call(message, "proposer_priority")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.proposer_priority); + return writer; + }; + + /** + * Encodes the specified Validator message, length delimited. Does not implicitly {@link tendermint.types.Validator.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.types.Validator + * @static + * @param {tendermint.types.IValidator} message Validator message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Validator.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Validator message from the specified reader or buffer. + * @function decode + * @memberof tendermint.types.Validator + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.types.Validator} Validator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Validator.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.Validator(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.bytes(); + break; + case 2: + message.pub_key = $root.tendermint.crypto.PublicKey.decode(reader, reader.uint32()); + break; + case 3: + message.voting_power = reader.int64(); + break; + case 4: + message.proposer_priority = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Validator message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.types.Validator + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.types.Validator} Validator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Validator.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Validator message. + * @function verify + * @memberof tendermint.types.Validator + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Validator.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.address != null && message.hasOwnProperty("address")) + if (!(message.address && typeof message.address.length === "number" || $util.isString(message.address))) + return "address: buffer expected"; + if (message.pub_key != null && message.hasOwnProperty("pub_key")) { + let error = $root.tendermint.crypto.PublicKey.verify(message.pub_key); + if (error) + return "pub_key." + error; + } + if (message.voting_power != null && message.hasOwnProperty("voting_power")) + if (!$util.isInteger(message.voting_power) && !(message.voting_power && $util.isInteger(message.voting_power.low) && $util.isInteger(message.voting_power.high))) + return "voting_power: integer|Long expected"; + if (message.proposer_priority != null && message.hasOwnProperty("proposer_priority")) + if (!$util.isInteger(message.proposer_priority) && !(message.proposer_priority && $util.isInteger(message.proposer_priority.low) && $util.isInteger(message.proposer_priority.high))) + return "proposer_priority: integer|Long expected"; + return null; + }; + + /** + * Creates a Validator message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.types.Validator + * @static + * @param {Object.} object Plain object + * @returns {tendermint.types.Validator} Validator + */ + Validator.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.types.Validator) + return object; + let message = new $root.tendermint.types.Validator(); + if (object.address != null) + if (typeof object.address === "string") + $util.base64.decode(object.address, message.address = $util.newBuffer($util.base64.length(object.address)), 0); + else if (object.address.length) + message.address = object.address; + if (object.pub_key != null) { + if (typeof object.pub_key !== "object") + throw TypeError(".tendermint.types.Validator.pub_key: object expected"); + message.pub_key = $root.tendermint.crypto.PublicKey.fromObject(object.pub_key); + } + if (object.voting_power != null) + if ($util.Long) + (message.voting_power = $util.Long.fromValue(object.voting_power)).unsigned = false; + else if (typeof object.voting_power === "string") + message.voting_power = parseInt(object.voting_power, 10); + else if (typeof object.voting_power === "number") + message.voting_power = object.voting_power; + else if (typeof object.voting_power === "object") + message.voting_power = new $util.LongBits(object.voting_power.low >>> 0, object.voting_power.high >>> 0).toNumber(); + if (object.proposer_priority != null) + if ($util.Long) + (message.proposer_priority = $util.Long.fromValue(object.proposer_priority)).unsigned = false; + else if (typeof object.proposer_priority === "string") + message.proposer_priority = parseInt(object.proposer_priority, 10); + else if (typeof object.proposer_priority === "number") + message.proposer_priority = object.proposer_priority; + else if (typeof object.proposer_priority === "object") + message.proposer_priority = new $util.LongBits(object.proposer_priority.low >>> 0, object.proposer_priority.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a Validator message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.types.Validator + * @static + * @param {tendermint.types.Validator} message Validator + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Validator.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if (options.bytes === String) + object.address = ""; + else { + object.address = []; + if (options.bytes !== Array) + object.address = $util.newBuffer(object.address); + } + object.pub_key = null; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.voting_power = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.voting_power = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.proposer_priority = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.proposer_priority = options.longs === String ? "0" : 0; + } + if (message.address != null && message.hasOwnProperty("address")) + object.address = options.bytes === String ? $util.base64.encode(message.address, 0, message.address.length) : options.bytes === Array ? Array.prototype.slice.call(message.address) : message.address; + if (message.pub_key != null && message.hasOwnProperty("pub_key")) + object.pub_key = $root.tendermint.crypto.PublicKey.toObject(message.pub_key, options); + if (message.voting_power != null && message.hasOwnProperty("voting_power")) + if (typeof message.voting_power === "number") + object.voting_power = options.longs === String ? String(message.voting_power) : message.voting_power; + else + object.voting_power = options.longs === String ? $util.Long.prototype.toString.call(message.voting_power) : options.longs === Number ? new $util.LongBits(message.voting_power.low >>> 0, message.voting_power.high >>> 0).toNumber() : message.voting_power; + if (message.proposer_priority != null && message.hasOwnProperty("proposer_priority")) + if (typeof message.proposer_priority === "number") + object.proposer_priority = options.longs === String ? String(message.proposer_priority) : message.proposer_priority; + else + object.proposer_priority = options.longs === String ? $util.Long.prototype.toString.call(message.proposer_priority) : options.longs === Number ? new $util.LongBits(message.proposer_priority.low >>> 0, message.proposer_priority.high >>> 0).toNumber() : message.proposer_priority; + return object; + }; + + /** + * Converts this Validator to JSON. + * @function toJSON + * @memberof tendermint.types.Validator + * @instance + * @returns {Object.} JSON object + */ + Validator.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Validator; + })(); + + types.SimpleValidator = (function() { + + /** + * Properties of a SimpleValidator. + * @memberof tendermint.types + * @interface ISimpleValidator + * @property {tendermint.crypto.IPublicKey|null} [pub_key] SimpleValidator pub_key + * @property {Long|null} [voting_power] SimpleValidator voting_power + */ + + /** + * Constructs a new SimpleValidator. + * @memberof tendermint.types + * @classdesc Represents a SimpleValidator. + * @implements ISimpleValidator + * @constructor + * @param {tendermint.types.ISimpleValidator=} [properties] Properties to set + */ + function SimpleValidator(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SimpleValidator pub_key. + * @member {tendermint.crypto.IPublicKey|null|undefined} pub_key + * @memberof tendermint.types.SimpleValidator + * @instance + */ + SimpleValidator.prototype.pub_key = null; + + /** + * SimpleValidator voting_power. + * @member {Long} voting_power + * @memberof tendermint.types.SimpleValidator + * @instance + */ + SimpleValidator.prototype.voting_power = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Encodes the specified SimpleValidator message. Does not implicitly {@link tendermint.types.SimpleValidator.verify|verify} messages. + * @function encode + * @memberof tendermint.types.SimpleValidator + * @static + * @param {tendermint.types.ISimpleValidator} message SimpleValidator message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SimpleValidator.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pub_key != null && Object.hasOwnProperty.call(message, "pub_key")) + $root.tendermint.crypto.PublicKey.encode(message.pub_key, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.voting_power != null && Object.hasOwnProperty.call(message, "voting_power")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.voting_power); + return writer; + }; + + /** + * Encodes the specified SimpleValidator message, length delimited. Does not implicitly {@link tendermint.types.SimpleValidator.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.types.SimpleValidator + * @static + * @param {tendermint.types.ISimpleValidator} message SimpleValidator message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SimpleValidator.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SimpleValidator message from the specified reader or buffer. + * @function decode + * @memberof tendermint.types.SimpleValidator + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.types.SimpleValidator} SimpleValidator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SimpleValidator.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.SimpleValidator(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pub_key = $root.tendermint.crypto.PublicKey.decode(reader, reader.uint32()); + break; + case 2: + message.voting_power = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SimpleValidator message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.types.SimpleValidator + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.types.SimpleValidator} SimpleValidator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SimpleValidator.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SimpleValidator message. + * @function verify + * @memberof tendermint.types.SimpleValidator + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SimpleValidator.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pub_key != null && message.hasOwnProperty("pub_key")) { + let error = $root.tendermint.crypto.PublicKey.verify(message.pub_key); + if (error) + return "pub_key." + error; + } + if (message.voting_power != null && message.hasOwnProperty("voting_power")) + if (!$util.isInteger(message.voting_power) && !(message.voting_power && $util.isInteger(message.voting_power.low) && $util.isInteger(message.voting_power.high))) + return "voting_power: integer|Long expected"; + return null; + }; + + /** + * Creates a SimpleValidator message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.types.SimpleValidator + * @static + * @param {Object.} object Plain object + * @returns {tendermint.types.SimpleValidator} SimpleValidator + */ + SimpleValidator.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.types.SimpleValidator) + return object; + let message = new $root.tendermint.types.SimpleValidator(); + if (object.pub_key != null) { + if (typeof object.pub_key !== "object") + throw TypeError(".tendermint.types.SimpleValidator.pub_key: object expected"); + message.pub_key = $root.tendermint.crypto.PublicKey.fromObject(object.pub_key); + } + if (object.voting_power != null) + if ($util.Long) + (message.voting_power = $util.Long.fromValue(object.voting_power)).unsigned = false; + else if (typeof object.voting_power === "string") + message.voting_power = parseInt(object.voting_power, 10); + else if (typeof object.voting_power === "number") + message.voting_power = object.voting_power; + else if (typeof object.voting_power === "object") + message.voting_power = new $util.LongBits(object.voting_power.low >>> 0, object.voting_power.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a SimpleValidator message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.types.SimpleValidator + * @static + * @param {tendermint.types.SimpleValidator} message SimpleValidator + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SimpleValidator.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.pub_key = null; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.voting_power = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.voting_power = options.longs === String ? "0" : 0; + } + if (message.pub_key != null && message.hasOwnProperty("pub_key")) + object.pub_key = $root.tendermint.crypto.PublicKey.toObject(message.pub_key, options); + if (message.voting_power != null && message.hasOwnProperty("voting_power")) + if (typeof message.voting_power === "number") + object.voting_power = options.longs === String ? String(message.voting_power) : message.voting_power; + else + object.voting_power = options.longs === String ? $util.Long.prototype.toString.call(message.voting_power) : options.longs === Number ? new $util.LongBits(message.voting_power.low >>> 0, message.voting_power.high >>> 0).toNumber() : message.voting_power; + return object; + }; + + /** + * Converts this SimpleValidator to JSON. + * @function toJSON + * @memberof tendermint.types.SimpleValidator + * @instance + * @returns {Object.} JSON object + */ + SimpleValidator.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SimpleValidator; + })(); + + types.Block = (function() { + + /** + * Properties of a Block. + * @memberof tendermint.types + * @interface IBlock + * @property {tendermint.types.IHeader|null} [header] Block header + * @property {tendermint.types.IData|null} [data] Block data + * @property {tendermint.types.IEvidenceList|null} [evidence] Block evidence + * @property {tendermint.types.ICommit|null} [last_commit] Block last_commit + */ + + /** + * Constructs a new Block. + * @memberof tendermint.types + * @classdesc Represents a Block. + * @implements IBlock + * @constructor + * @param {tendermint.types.IBlock=} [properties] Properties to set + */ + function Block(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Block header. + * @member {tendermint.types.IHeader|null|undefined} header + * @memberof tendermint.types.Block + * @instance + */ + Block.prototype.header = null; + + /** + * Block data. + * @member {tendermint.types.IData|null|undefined} data + * @memberof tendermint.types.Block + * @instance + */ + Block.prototype.data = null; + + /** + * Block evidence. + * @member {tendermint.types.IEvidenceList|null|undefined} evidence + * @memberof tendermint.types.Block + * @instance + */ + Block.prototype.evidence = null; + + /** + * Block last_commit. + * @member {tendermint.types.ICommit|null|undefined} last_commit + * @memberof tendermint.types.Block + * @instance + */ + Block.prototype.last_commit = null; + + /** + * Encodes the specified Block message. Does not implicitly {@link tendermint.types.Block.verify|verify} messages. + * @function encode + * @memberof tendermint.types.Block + * @static + * @param {tendermint.types.IBlock} message Block message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Block.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.header != null && Object.hasOwnProperty.call(message, "header")) + $root.tendermint.types.Header.encode(message.header, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.data != null && Object.hasOwnProperty.call(message, "data")) + $root.tendermint.types.Data.encode(message.data, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.evidence != null && Object.hasOwnProperty.call(message, "evidence")) + $root.tendermint.types.EvidenceList.encode(message.evidence, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.last_commit != null && Object.hasOwnProperty.call(message, "last_commit")) + $root.tendermint.types.Commit.encode(message.last_commit, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Block message, length delimited. Does not implicitly {@link tendermint.types.Block.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.types.Block + * @static + * @param {tendermint.types.IBlock} message Block message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Block.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Block message from the specified reader or buffer. + * @function decode + * @memberof tendermint.types.Block + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.types.Block} Block + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Block.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.Block(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.header = $root.tendermint.types.Header.decode(reader, reader.uint32()); + break; + case 2: + message.data = $root.tendermint.types.Data.decode(reader, reader.uint32()); + break; + case 3: + message.evidence = $root.tendermint.types.EvidenceList.decode(reader, reader.uint32()); + break; + case 4: + message.last_commit = $root.tendermint.types.Commit.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Block message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.types.Block + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.types.Block} Block + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Block.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Block message. + * @function verify + * @memberof tendermint.types.Block + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Block.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.header != null && message.hasOwnProperty("header")) { + let error = $root.tendermint.types.Header.verify(message.header); + if (error) + return "header." + error; + } + if (message.data != null && message.hasOwnProperty("data")) { + let error = $root.tendermint.types.Data.verify(message.data); + if (error) + return "data." + error; + } + if (message.evidence != null && message.hasOwnProperty("evidence")) { + let error = $root.tendermint.types.EvidenceList.verify(message.evidence); + if (error) + return "evidence." + error; + } + if (message.last_commit != null && message.hasOwnProperty("last_commit")) { + let error = $root.tendermint.types.Commit.verify(message.last_commit); + if (error) + return "last_commit." + error; + } + return null; + }; + + /** + * Creates a Block message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.types.Block + * @static + * @param {Object.} object Plain object + * @returns {tendermint.types.Block} Block + */ + Block.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.types.Block) + return object; + let message = new $root.tendermint.types.Block(); + if (object.header != null) { + if (typeof object.header !== "object") + throw TypeError(".tendermint.types.Block.header: object expected"); + message.header = $root.tendermint.types.Header.fromObject(object.header); + } + if (object.data != null) { + if (typeof object.data !== "object") + throw TypeError(".tendermint.types.Block.data: object expected"); + message.data = $root.tendermint.types.Data.fromObject(object.data); + } + if (object.evidence != null) { + if (typeof object.evidence !== "object") + throw TypeError(".tendermint.types.Block.evidence: object expected"); + message.evidence = $root.tendermint.types.EvidenceList.fromObject(object.evidence); + } + if (object.last_commit != null) { + if (typeof object.last_commit !== "object") + throw TypeError(".tendermint.types.Block.last_commit: object expected"); + message.last_commit = $root.tendermint.types.Commit.fromObject(object.last_commit); + } + return message; + }; + + /** + * Creates a plain object from a Block message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.types.Block + * @static + * @param {tendermint.types.Block} message Block + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Block.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.header = null; + object.data = null; + object.evidence = null; + object.last_commit = null; + } + if (message.header != null && message.hasOwnProperty("header")) + object.header = $root.tendermint.types.Header.toObject(message.header, options); + if (message.data != null && message.hasOwnProperty("data")) + object.data = $root.tendermint.types.Data.toObject(message.data, options); + if (message.evidence != null && message.hasOwnProperty("evidence")) + object.evidence = $root.tendermint.types.EvidenceList.toObject(message.evidence, options); + if (message.last_commit != null && message.hasOwnProperty("last_commit")) + object.last_commit = $root.tendermint.types.Commit.toObject(message.last_commit, options); + return object; + }; + + /** + * Converts this Block to JSON. + * @function toJSON + * @memberof tendermint.types.Block + * @instance + * @returns {Object.} JSON object + */ + Block.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Block; + })(); + + types.ConsensusParams = (function() { + + /** + * Properties of a ConsensusParams. + * @memberof tendermint.types + * @interface IConsensusParams + * @property {tendermint.types.IBlockParams|null} [block] ConsensusParams block + * @property {tendermint.types.IEvidenceParams|null} [evidence] ConsensusParams evidence + * @property {tendermint.types.IValidatorParams|null} [validator] ConsensusParams validator + * @property {tendermint.types.IVersionParams|null} [version] ConsensusParams version + */ + + /** + * Constructs a new ConsensusParams. + * @memberof tendermint.types + * @classdesc Represents a ConsensusParams. + * @implements IConsensusParams + * @constructor + * @param {tendermint.types.IConsensusParams=} [properties] Properties to set + */ + function ConsensusParams(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConsensusParams block. + * @member {tendermint.types.IBlockParams|null|undefined} block + * @memberof tendermint.types.ConsensusParams + * @instance + */ + ConsensusParams.prototype.block = null; + + /** + * ConsensusParams evidence. + * @member {tendermint.types.IEvidenceParams|null|undefined} evidence + * @memberof tendermint.types.ConsensusParams + * @instance + */ + ConsensusParams.prototype.evidence = null; + + /** + * ConsensusParams validator. + * @member {tendermint.types.IValidatorParams|null|undefined} validator + * @memberof tendermint.types.ConsensusParams + * @instance + */ + ConsensusParams.prototype.validator = null; + + /** + * ConsensusParams version. + * @member {tendermint.types.IVersionParams|null|undefined} version + * @memberof tendermint.types.ConsensusParams + * @instance + */ + ConsensusParams.prototype.version = null; + + /** + * Encodes the specified ConsensusParams message. Does not implicitly {@link tendermint.types.ConsensusParams.verify|verify} messages. + * @function encode + * @memberof tendermint.types.ConsensusParams + * @static + * @param {tendermint.types.IConsensusParams} message ConsensusParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConsensusParams.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.block != null && Object.hasOwnProperty.call(message, "block")) + $root.tendermint.types.BlockParams.encode(message.block, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.evidence != null && Object.hasOwnProperty.call(message, "evidence")) + $root.tendermint.types.EvidenceParams.encode(message.evidence, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.validator != null && Object.hasOwnProperty.call(message, "validator")) + $root.tendermint.types.ValidatorParams.encode(message.validator, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + $root.tendermint.types.VersionParams.encode(message.version, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ConsensusParams message, length delimited. Does not implicitly {@link tendermint.types.ConsensusParams.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.types.ConsensusParams + * @static + * @param {tendermint.types.IConsensusParams} message ConsensusParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConsensusParams.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConsensusParams message from the specified reader or buffer. + * @function decode + * @memberof tendermint.types.ConsensusParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.types.ConsensusParams} ConsensusParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConsensusParams.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.ConsensusParams(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.block = $root.tendermint.types.BlockParams.decode(reader, reader.uint32()); + break; + case 2: + message.evidence = $root.tendermint.types.EvidenceParams.decode(reader, reader.uint32()); + break; + case 3: + message.validator = $root.tendermint.types.ValidatorParams.decode(reader, reader.uint32()); + break; + case 4: + message.version = $root.tendermint.types.VersionParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConsensusParams message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.types.ConsensusParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.types.ConsensusParams} ConsensusParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConsensusParams.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConsensusParams message. + * @function verify + * @memberof tendermint.types.ConsensusParams + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConsensusParams.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.block != null && message.hasOwnProperty("block")) { + let error = $root.tendermint.types.BlockParams.verify(message.block); + if (error) + return "block." + error; + } + if (message.evidence != null && message.hasOwnProperty("evidence")) { + let error = $root.tendermint.types.EvidenceParams.verify(message.evidence); + if (error) + return "evidence." + error; + } + if (message.validator != null && message.hasOwnProperty("validator")) { + let error = $root.tendermint.types.ValidatorParams.verify(message.validator); + if (error) + return "validator." + error; + } + if (message.version != null && message.hasOwnProperty("version")) { + let error = $root.tendermint.types.VersionParams.verify(message.version); + if (error) + return "version." + error; + } + return null; + }; + + /** + * Creates a ConsensusParams message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.types.ConsensusParams + * @static + * @param {Object.} object Plain object + * @returns {tendermint.types.ConsensusParams} ConsensusParams + */ + ConsensusParams.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.types.ConsensusParams) + return object; + let message = new $root.tendermint.types.ConsensusParams(); + if (object.block != null) { + if (typeof object.block !== "object") + throw TypeError(".tendermint.types.ConsensusParams.block: object expected"); + message.block = $root.tendermint.types.BlockParams.fromObject(object.block); + } + if (object.evidence != null) { + if (typeof object.evidence !== "object") + throw TypeError(".tendermint.types.ConsensusParams.evidence: object expected"); + message.evidence = $root.tendermint.types.EvidenceParams.fromObject(object.evidence); + } + if (object.validator != null) { + if (typeof object.validator !== "object") + throw TypeError(".tendermint.types.ConsensusParams.validator: object expected"); + message.validator = $root.tendermint.types.ValidatorParams.fromObject(object.validator); + } + if (object.version != null) { + if (typeof object.version !== "object") + throw TypeError(".tendermint.types.ConsensusParams.version: object expected"); + message.version = $root.tendermint.types.VersionParams.fromObject(object.version); + } + return message; + }; + + /** + * Creates a plain object from a ConsensusParams message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.types.ConsensusParams + * @static + * @param {tendermint.types.ConsensusParams} message ConsensusParams + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConsensusParams.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + object.block = null; + object.evidence = null; + object.validator = null; + object.version = null; + } + if (message.block != null && message.hasOwnProperty("block")) + object.block = $root.tendermint.types.BlockParams.toObject(message.block, options); + if (message.evidence != null && message.hasOwnProperty("evidence")) + object.evidence = $root.tendermint.types.EvidenceParams.toObject(message.evidence, options); + if (message.validator != null && message.hasOwnProperty("validator")) + object.validator = $root.tendermint.types.ValidatorParams.toObject(message.validator, options); + if (message.version != null && message.hasOwnProperty("version")) + object.version = $root.tendermint.types.VersionParams.toObject(message.version, options); + return object; + }; + + /** + * Converts this ConsensusParams to JSON. + * @function toJSON + * @memberof tendermint.types.ConsensusParams + * @instance + * @returns {Object.} JSON object + */ + ConsensusParams.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ConsensusParams; + })(); + + types.BlockParams = (function() { + + /** + * Properties of a BlockParams. + * @memberof tendermint.types + * @interface IBlockParams + * @property {Long|null} [max_bytes] BlockParams max_bytes + * @property {Long|null} [max_gas] BlockParams max_gas + * @property {Long|null} [time_iota_ms] BlockParams time_iota_ms + */ + + /** + * Constructs a new BlockParams. + * @memberof tendermint.types + * @classdesc Represents a BlockParams. + * @implements IBlockParams + * @constructor + * @param {tendermint.types.IBlockParams=} [properties] Properties to set + */ + function BlockParams(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BlockParams max_bytes. + * @member {Long} max_bytes + * @memberof tendermint.types.BlockParams + * @instance + */ + BlockParams.prototype.max_bytes = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BlockParams max_gas. + * @member {Long} max_gas + * @memberof tendermint.types.BlockParams + * @instance + */ + BlockParams.prototype.max_gas = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BlockParams time_iota_ms. + * @member {Long} time_iota_ms + * @memberof tendermint.types.BlockParams + * @instance + */ + BlockParams.prototype.time_iota_ms = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Encodes the specified BlockParams message. Does not implicitly {@link tendermint.types.BlockParams.verify|verify} messages. + * @function encode + * @memberof tendermint.types.BlockParams + * @static + * @param {tendermint.types.IBlockParams} message BlockParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BlockParams.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.max_bytes != null && Object.hasOwnProperty.call(message, "max_bytes")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.max_bytes); + if (message.max_gas != null && Object.hasOwnProperty.call(message, "max_gas")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.max_gas); + if (message.time_iota_ms != null && Object.hasOwnProperty.call(message, "time_iota_ms")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.time_iota_ms); + return writer; + }; + + /** + * Encodes the specified BlockParams message, length delimited. Does not implicitly {@link tendermint.types.BlockParams.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.types.BlockParams + * @static + * @param {tendermint.types.IBlockParams} message BlockParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BlockParams.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BlockParams message from the specified reader or buffer. + * @function decode + * @memberof tendermint.types.BlockParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.types.BlockParams} BlockParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BlockParams.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.BlockParams(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.max_bytes = reader.int64(); + break; + case 2: + message.max_gas = reader.int64(); + break; + case 3: + message.time_iota_ms = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BlockParams message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.types.BlockParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.types.BlockParams} BlockParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BlockParams.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BlockParams message. + * @function verify + * @memberof tendermint.types.BlockParams + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BlockParams.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.max_bytes != null && message.hasOwnProperty("max_bytes")) + if (!$util.isInteger(message.max_bytes) && !(message.max_bytes && $util.isInteger(message.max_bytes.low) && $util.isInteger(message.max_bytes.high))) + return "max_bytes: integer|Long expected"; + if (message.max_gas != null && message.hasOwnProperty("max_gas")) + if (!$util.isInteger(message.max_gas) && !(message.max_gas && $util.isInteger(message.max_gas.low) && $util.isInteger(message.max_gas.high))) + return "max_gas: integer|Long expected"; + if (message.time_iota_ms != null && message.hasOwnProperty("time_iota_ms")) + if (!$util.isInteger(message.time_iota_ms) && !(message.time_iota_ms && $util.isInteger(message.time_iota_ms.low) && $util.isInteger(message.time_iota_ms.high))) + return "time_iota_ms: integer|Long expected"; + return null; + }; + + /** + * Creates a BlockParams message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.types.BlockParams + * @static + * @param {Object.} object Plain object + * @returns {tendermint.types.BlockParams} BlockParams + */ + BlockParams.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.types.BlockParams) + return object; + let message = new $root.tendermint.types.BlockParams(); + if (object.max_bytes != null) + if ($util.Long) + (message.max_bytes = $util.Long.fromValue(object.max_bytes)).unsigned = false; + else if (typeof object.max_bytes === "string") + message.max_bytes = parseInt(object.max_bytes, 10); + else if (typeof object.max_bytes === "number") + message.max_bytes = object.max_bytes; + else if (typeof object.max_bytes === "object") + message.max_bytes = new $util.LongBits(object.max_bytes.low >>> 0, object.max_bytes.high >>> 0).toNumber(); + if (object.max_gas != null) + if ($util.Long) + (message.max_gas = $util.Long.fromValue(object.max_gas)).unsigned = false; + else if (typeof object.max_gas === "string") + message.max_gas = parseInt(object.max_gas, 10); + else if (typeof object.max_gas === "number") + message.max_gas = object.max_gas; + else if (typeof object.max_gas === "object") + message.max_gas = new $util.LongBits(object.max_gas.low >>> 0, object.max_gas.high >>> 0).toNumber(); + if (object.time_iota_ms != null) + if ($util.Long) + (message.time_iota_ms = $util.Long.fromValue(object.time_iota_ms)).unsigned = false; + else if (typeof object.time_iota_ms === "string") + message.time_iota_ms = parseInt(object.time_iota_ms, 10); + else if (typeof object.time_iota_ms === "number") + message.time_iota_ms = object.time_iota_ms; + else if (typeof object.time_iota_ms === "object") + message.time_iota_ms = new $util.LongBits(object.time_iota_ms.low >>> 0, object.time_iota_ms.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a BlockParams message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.types.BlockParams + * @static + * @param {tendermint.types.BlockParams} message BlockParams + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BlockParams.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.max_bytes = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.max_bytes = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.max_gas = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.max_gas = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.time_iota_ms = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.time_iota_ms = options.longs === String ? "0" : 0; + } + if (message.max_bytes != null && message.hasOwnProperty("max_bytes")) + if (typeof message.max_bytes === "number") + object.max_bytes = options.longs === String ? String(message.max_bytes) : message.max_bytes; + else + object.max_bytes = options.longs === String ? $util.Long.prototype.toString.call(message.max_bytes) : options.longs === Number ? new $util.LongBits(message.max_bytes.low >>> 0, message.max_bytes.high >>> 0).toNumber() : message.max_bytes; + if (message.max_gas != null && message.hasOwnProperty("max_gas")) + if (typeof message.max_gas === "number") + object.max_gas = options.longs === String ? String(message.max_gas) : message.max_gas; + else + object.max_gas = options.longs === String ? $util.Long.prototype.toString.call(message.max_gas) : options.longs === Number ? new $util.LongBits(message.max_gas.low >>> 0, message.max_gas.high >>> 0).toNumber() : message.max_gas; + if (message.time_iota_ms != null && message.hasOwnProperty("time_iota_ms")) + if (typeof message.time_iota_ms === "number") + object.time_iota_ms = options.longs === String ? String(message.time_iota_ms) : message.time_iota_ms; + else + object.time_iota_ms = options.longs === String ? $util.Long.prototype.toString.call(message.time_iota_ms) : options.longs === Number ? new $util.LongBits(message.time_iota_ms.low >>> 0, message.time_iota_ms.high >>> 0).toNumber() : message.time_iota_ms; + return object; + }; + + /** + * Converts this BlockParams to JSON. + * @function toJSON + * @memberof tendermint.types.BlockParams + * @instance + * @returns {Object.} JSON object + */ + BlockParams.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BlockParams; + })(); + + types.EvidenceParams = (function() { + + /** + * Properties of an EvidenceParams. + * @memberof tendermint.types + * @interface IEvidenceParams + * @property {Long|null} [max_age_num_blocks] EvidenceParams max_age_num_blocks + * @property {google.protobuf.IDuration|null} [max_age_duration] EvidenceParams max_age_duration + * @property {Long|null} [max_bytes] EvidenceParams max_bytes + */ + + /** + * Constructs a new EvidenceParams. + * @memberof tendermint.types + * @classdesc Represents an EvidenceParams. + * @implements IEvidenceParams + * @constructor + * @param {tendermint.types.IEvidenceParams=} [properties] Properties to set + */ + function EvidenceParams(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EvidenceParams max_age_num_blocks. + * @member {Long} max_age_num_blocks + * @memberof tendermint.types.EvidenceParams + * @instance + */ + EvidenceParams.prototype.max_age_num_blocks = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * EvidenceParams max_age_duration. + * @member {google.protobuf.IDuration|null|undefined} max_age_duration + * @memberof tendermint.types.EvidenceParams + * @instance + */ + EvidenceParams.prototype.max_age_duration = null; + + /** + * EvidenceParams max_bytes. + * @member {Long} max_bytes + * @memberof tendermint.types.EvidenceParams + * @instance + */ + EvidenceParams.prototype.max_bytes = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Encodes the specified EvidenceParams message. Does not implicitly {@link tendermint.types.EvidenceParams.verify|verify} messages. + * @function encode + * @memberof tendermint.types.EvidenceParams + * @static + * @param {tendermint.types.IEvidenceParams} message EvidenceParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EvidenceParams.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.max_age_num_blocks != null && Object.hasOwnProperty.call(message, "max_age_num_blocks")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.max_age_num_blocks); + if (message.max_age_duration != null && Object.hasOwnProperty.call(message, "max_age_duration")) + $root.google.protobuf.Duration.encode(message.max_age_duration, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.max_bytes != null && Object.hasOwnProperty.call(message, "max_bytes")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.max_bytes); + return writer; + }; + + /** + * Encodes the specified EvidenceParams message, length delimited. Does not implicitly {@link tendermint.types.EvidenceParams.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.types.EvidenceParams + * @static + * @param {tendermint.types.IEvidenceParams} message EvidenceParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EvidenceParams.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EvidenceParams message from the specified reader or buffer. + * @function decode + * @memberof tendermint.types.EvidenceParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.types.EvidenceParams} EvidenceParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EvidenceParams.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.EvidenceParams(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.max_age_num_blocks = reader.int64(); + break; + case 2: + message.max_age_duration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + case 3: + message.max_bytes = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EvidenceParams message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.types.EvidenceParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.types.EvidenceParams} EvidenceParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EvidenceParams.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EvidenceParams message. + * @function verify + * @memberof tendermint.types.EvidenceParams + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EvidenceParams.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.max_age_num_blocks != null && message.hasOwnProperty("max_age_num_blocks")) + if (!$util.isInteger(message.max_age_num_blocks) && !(message.max_age_num_blocks && $util.isInteger(message.max_age_num_blocks.low) && $util.isInteger(message.max_age_num_blocks.high))) + return "max_age_num_blocks: integer|Long expected"; + if (message.max_age_duration != null && message.hasOwnProperty("max_age_duration")) { + let error = $root.google.protobuf.Duration.verify(message.max_age_duration); + if (error) + return "max_age_duration." + error; + } + if (message.max_bytes != null && message.hasOwnProperty("max_bytes")) + if (!$util.isInteger(message.max_bytes) && !(message.max_bytes && $util.isInteger(message.max_bytes.low) && $util.isInteger(message.max_bytes.high))) + return "max_bytes: integer|Long expected"; + return null; + }; + + /** + * Creates an EvidenceParams message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.types.EvidenceParams + * @static + * @param {Object.} object Plain object + * @returns {tendermint.types.EvidenceParams} EvidenceParams + */ + EvidenceParams.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.types.EvidenceParams) + return object; + let message = new $root.tendermint.types.EvidenceParams(); + if (object.max_age_num_blocks != null) + if ($util.Long) + (message.max_age_num_blocks = $util.Long.fromValue(object.max_age_num_blocks)).unsigned = false; + else if (typeof object.max_age_num_blocks === "string") + message.max_age_num_blocks = parseInt(object.max_age_num_blocks, 10); + else if (typeof object.max_age_num_blocks === "number") + message.max_age_num_blocks = object.max_age_num_blocks; + else if (typeof object.max_age_num_blocks === "object") + message.max_age_num_blocks = new $util.LongBits(object.max_age_num_blocks.low >>> 0, object.max_age_num_blocks.high >>> 0).toNumber(); + if (object.max_age_duration != null) { + if (typeof object.max_age_duration !== "object") + throw TypeError(".tendermint.types.EvidenceParams.max_age_duration: object expected"); + message.max_age_duration = $root.google.protobuf.Duration.fromObject(object.max_age_duration); + } + if (object.max_bytes != null) + if ($util.Long) + (message.max_bytes = $util.Long.fromValue(object.max_bytes)).unsigned = false; + else if (typeof object.max_bytes === "string") + message.max_bytes = parseInt(object.max_bytes, 10); + else if (typeof object.max_bytes === "number") + message.max_bytes = object.max_bytes; + else if (typeof object.max_bytes === "object") + message.max_bytes = new $util.LongBits(object.max_bytes.low >>> 0, object.max_bytes.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from an EvidenceParams message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.types.EvidenceParams + * @static + * @param {tendermint.types.EvidenceParams} message EvidenceParams + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EvidenceParams.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.max_age_num_blocks = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.max_age_num_blocks = options.longs === String ? "0" : 0; + object.max_age_duration = null; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.max_bytes = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.max_bytes = options.longs === String ? "0" : 0; + } + if (message.max_age_num_blocks != null && message.hasOwnProperty("max_age_num_blocks")) + if (typeof message.max_age_num_blocks === "number") + object.max_age_num_blocks = options.longs === String ? String(message.max_age_num_blocks) : message.max_age_num_blocks; + else + object.max_age_num_blocks = options.longs === String ? $util.Long.prototype.toString.call(message.max_age_num_blocks) : options.longs === Number ? new $util.LongBits(message.max_age_num_blocks.low >>> 0, message.max_age_num_blocks.high >>> 0).toNumber() : message.max_age_num_blocks; + if (message.max_age_duration != null && message.hasOwnProperty("max_age_duration")) + object.max_age_duration = $root.google.protobuf.Duration.toObject(message.max_age_duration, options); + if (message.max_bytes != null && message.hasOwnProperty("max_bytes")) + if (typeof message.max_bytes === "number") + object.max_bytes = options.longs === String ? String(message.max_bytes) : message.max_bytes; + else + object.max_bytes = options.longs === String ? $util.Long.prototype.toString.call(message.max_bytes) : options.longs === Number ? new $util.LongBits(message.max_bytes.low >>> 0, message.max_bytes.high >>> 0).toNumber() : message.max_bytes; + return object; + }; + + /** + * Converts this EvidenceParams to JSON. + * @function toJSON + * @memberof tendermint.types.EvidenceParams + * @instance + * @returns {Object.} JSON object + */ + EvidenceParams.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EvidenceParams; + })(); + + types.ValidatorParams = (function() { + + /** + * Properties of a ValidatorParams. + * @memberof tendermint.types + * @interface IValidatorParams + * @property {Array.|null} [pub_key_types] ValidatorParams pub_key_types + */ + + /** + * Constructs a new ValidatorParams. + * @memberof tendermint.types + * @classdesc Represents a ValidatorParams. + * @implements IValidatorParams + * @constructor + * @param {tendermint.types.IValidatorParams=} [properties] Properties to set + */ + function ValidatorParams(properties) { + this.pub_key_types = []; + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ValidatorParams pub_key_types. + * @member {Array.} pub_key_types + * @memberof tendermint.types.ValidatorParams + * @instance + */ + ValidatorParams.prototype.pub_key_types = $util.emptyArray; + + /** + * Encodes the specified ValidatorParams message. Does not implicitly {@link tendermint.types.ValidatorParams.verify|verify} messages. + * @function encode + * @memberof tendermint.types.ValidatorParams + * @static + * @param {tendermint.types.IValidatorParams} message ValidatorParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorParams.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pub_key_types != null && message.pub_key_types.length) + for (let i = 0; i < message.pub_key_types.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.pub_key_types[i]); + return writer; + }; + + /** + * Encodes the specified ValidatorParams message, length delimited. Does not implicitly {@link tendermint.types.ValidatorParams.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.types.ValidatorParams + * @static + * @param {tendermint.types.IValidatorParams} message ValidatorParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidatorParams.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ValidatorParams message from the specified reader or buffer. + * @function decode + * @memberof tendermint.types.ValidatorParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.types.ValidatorParams} ValidatorParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorParams.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.ValidatorParams(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.pub_key_types && message.pub_key_types.length)) + message.pub_key_types = []; + message.pub_key_types.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ValidatorParams message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.types.ValidatorParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.types.ValidatorParams} ValidatorParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidatorParams.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ValidatorParams message. + * @function verify + * @memberof tendermint.types.ValidatorParams + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ValidatorParams.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pub_key_types != null && message.hasOwnProperty("pub_key_types")) { + if (!Array.isArray(message.pub_key_types)) + return "pub_key_types: array expected"; + for (let i = 0; i < message.pub_key_types.length; ++i) + if (!$util.isString(message.pub_key_types[i])) + return "pub_key_types: string[] expected"; + } + return null; + }; + + /** + * Creates a ValidatorParams message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.types.ValidatorParams + * @static + * @param {Object.} object Plain object + * @returns {tendermint.types.ValidatorParams} ValidatorParams + */ + ValidatorParams.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.types.ValidatorParams) + return object; + let message = new $root.tendermint.types.ValidatorParams(); + if (object.pub_key_types) { + if (!Array.isArray(object.pub_key_types)) + throw TypeError(".tendermint.types.ValidatorParams.pub_key_types: array expected"); + message.pub_key_types = []; + for (let i = 0; i < object.pub_key_types.length; ++i) + message.pub_key_types[i] = String(object.pub_key_types[i]); + } + return message; + }; + + /** + * Creates a plain object from a ValidatorParams message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.types.ValidatorParams + * @static + * @param {tendermint.types.ValidatorParams} message ValidatorParams + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ValidatorParams.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.arrays || options.defaults) + object.pub_key_types = []; + if (message.pub_key_types && message.pub_key_types.length) { + object.pub_key_types = []; + for (let j = 0; j < message.pub_key_types.length; ++j) + object.pub_key_types[j] = message.pub_key_types[j]; + } + return object; + }; + + /** + * Converts this ValidatorParams to JSON. + * @function toJSON + * @memberof tendermint.types.ValidatorParams + * @instance + * @returns {Object.} JSON object + */ + ValidatorParams.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ValidatorParams; + })(); + + types.VersionParams = (function() { + + /** + * Properties of a VersionParams. + * @memberof tendermint.types + * @interface IVersionParams + * @property {Long|null} [app_version] VersionParams app_version + */ + + /** + * Constructs a new VersionParams. + * @memberof tendermint.types + * @classdesc Represents a VersionParams. + * @implements IVersionParams + * @constructor + * @param {tendermint.types.IVersionParams=} [properties] Properties to set + */ + function VersionParams(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * VersionParams app_version. + * @member {Long} app_version + * @memberof tendermint.types.VersionParams + * @instance + */ + VersionParams.prototype.app_version = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified VersionParams message. Does not implicitly {@link tendermint.types.VersionParams.verify|verify} messages. + * @function encode + * @memberof tendermint.types.VersionParams + * @static + * @param {tendermint.types.IVersionParams} message VersionParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VersionParams.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.app_version != null && Object.hasOwnProperty.call(message, "app_version")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.app_version); + return writer; + }; + + /** + * Encodes the specified VersionParams message, length delimited. Does not implicitly {@link tendermint.types.VersionParams.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.types.VersionParams + * @static + * @param {tendermint.types.IVersionParams} message VersionParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VersionParams.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VersionParams message from the specified reader or buffer. + * @function decode + * @memberof tendermint.types.VersionParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.types.VersionParams} VersionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VersionParams.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.VersionParams(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.app_version = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VersionParams message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.types.VersionParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.types.VersionParams} VersionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VersionParams.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VersionParams message. + * @function verify + * @memberof tendermint.types.VersionParams + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VersionParams.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.app_version != null && message.hasOwnProperty("app_version")) + if (!$util.isInteger(message.app_version) && !(message.app_version && $util.isInteger(message.app_version.low) && $util.isInteger(message.app_version.high))) + return "app_version: integer|Long expected"; + return null; + }; + + /** + * Creates a VersionParams message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.types.VersionParams + * @static + * @param {Object.} object Plain object + * @returns {tendermint.types.VersionParams} VersionParams + */ + VersionParams.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.types.VersionParams) + return object; + let message = new $root.tendermint.types.VersionParams(); + if (object.app_version != null) + if ($util.Long) + (message.app_version = $util.Long.fromValue(object.app_version)).unsigned = true; + else if (typeof object.app_version === "string") + message.app_version = parseInt(object.app_version, 10); + else if (typeof object.app_version === "number") + message.app_version = object.app_version; + else if (typeof object.app_version === "object") + message.app_version = new $util.LongBits(object.app_version.low >>> 0, object.app_version.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a VersionParams message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.types.VersionParams + * @static + * @param {tendermint.types.VersionParams} message VersionParams + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VersionParams.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.app_version = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.app_version = options.longs === String ? "0" : 0; + if (message.app_version != null && message.hasOwnProperty("app_version")) + if (typeof message.app_version === "number") + object.app_version = options.longs === String ? String(message.app_version) : message.app_version; + else + object.app_version = options.longs === String ? $util.Long.prototype.toString.call(message.app_version) : options.longs === Number ? new $util.LongBits(message.app_version.low >>> 0, message.app_version.high >>> 0).toNumber(true) : message.app_version; + return object; + }; + + /** + * Converts this VersionParams to JSON. + * @function toJSON + * @memberof tendermint.types.VersionParams + * @instance + * @returns {Object.} JSON object + */ + VersionParams.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return VersionParams; + })(); + + types.HashedParams = (function() { + + /** + * Properties of a HashedParams. + * @memberof tendermint.types + * @interface IHashedParams + * @property {Long|null} [block_max_bytes] HashedParams block_max_bytes + * @property {Long|null} [block_max_gas] HashedParams block_max_gas + */ + + /** + * Constructs a new HashedParams. + * @memberof tendermint.types + * @classdesc Represents a HashedParams. + * @implements IHashedParams + * @constructor + * @param {tendermint.types.IHashedParams=} [properties] Properties to set + */ + function HashedParams(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HashedParams block_max_bytes. + * @member {Long} block_max_bytes + * @memberof tendermint.types.HashedParams + * @instance + */ + HashedParams.prototype.block_max_bytes = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * HashedParams block_max_gas. + * @member {Long} block_max_gas + * @memberof tendermint.types.HashedParams + * @instance + */ + HashedParams.prototype.block_max_gas = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Encodes the specified HashedParams message. Does not implicitly {@link tendermint.types.HashedParams.verify|verify} messages. + * @function encode + * @memberof tendermint.types.HashedParams + * @static + * @param {tendermint.types.IHashedParams} message HashedParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HashedParams.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.block_max_bytes != null && Object.hasOwnProperty.call(message, "block_max_bytes")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.block_max_bytes); + if (message.block_max_gas != null && Object.hasOwnProperty.call(message, "block_max_gas")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.block_max_gas); + return writer; + }; + + /** + * Encodes the specified HashedParams message, length delimited. Does not implicitly {@link tendermint.types.HashedParams.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.types.HashedParams + * @static + * @param {tendermint.types.IHashedParams} message HashedParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HashedParams.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HashedParams message from the specified reader or buffer. + * @function decode + * @memberof tendermint.types.HashedParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.types.HashedParams} HashedParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HashedParams.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.HashedParams(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.block_max_bytes = reader.int64(); + break; + case 2: + message.block_max_gas = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HashedParams message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.types.HashedParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.types.HashedParams} HashedParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HashedParams.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HashedParams message. + * @function verify + * @memberof tendermint.types.HashedParams + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HashedParams.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.block_max_bytes != null && message.hasOwnProperty("block_max_bytes")) + if (!$util.isInteger(message.block_max_bytes) && !(message.block_max_bytes && $util.isInteger(message.block_max_bytes.low) && $util.isInteger(message.block_max_bytes.high))) + return "block_max_bytes: integer|Long expected"; + if (message.block_max_gas != null && message.hasOwnProperty("block_max_gas")) + if (!$util.isInteger(message.block_max_gas) && !(message.block_max_gas && $util.isInteger(message.block_max_gas.low) && $util.isInteger(message.block_max_gas.high))) + return "block_max_gas: integer|Long expected"; + return null; + }; + + /** + * Creates a HashedParams message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.types.HashedParams + * @static + * @param {Object.} object Plain object + * @returns {tendermint.types.HashedParams} HashedParams + */ + HashedParams.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.types.HashedParams) + return object; + let message = new $root.tendermint.types.HashedParams(); + if (object.block_max_bytes != null) + if ($util.Long) + (message.block_max_bytes = $util.Long.fromValue(object.block_max_bytes)).unsigned = false; + else if (typeof object.block_max_bytes === "string") + message.block_max_bytes = parseInt(object.block_max_bytes, 10); + else if (typeof object.block_max_bytes === "number") + message.block_max_bytes = object.block_max_bytes; + else if (typeof object.block_max_bytes === "object") + message.block_max_bytes = new $util.LongBits(object.block_max_bytes.low >>> 0, object.block_max_bytes.high >>> 0).toNumber(); + if (object.block_max_gas != null) + if ($util.Long) + (message.block_max_gas = $util.Long.fromValue(object.block_max_gas)).unsigned = false; + else if (typeof object.block_max_gas === "string") + message.block_max_gas = parseInt(object.block_max_gas, 10); + else if (typeof object.block_max_gas === "number") + message.block_max_gas = object.block_max_gas; + else if (typeof object.block_max_gas === "object") + message.block_max_gas = new $util.LongBits(object.block_max_gas.low >>> 0, object.block_max_gas.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a HashedParams message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.types.HashedParams + * @static + * @param {tendermint.types.HashedParams} message HashedParams + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HashedParams.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.block_max_bytes = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.block_max_bytes = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, false); + object.block_max_gas = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.block_max_gas = options.longs === String ? "0" : 0; + } + if (message.block_max_bytes != null && message.hasOwnProperty("block_max_bytes")) + if (typeof message.block_max_bytes === "number") + object.block_max_bytes = options.longs === String ? String(message.block_max_bytes) : message.block_max_bytes; + else + object.block_max_bytes = options.longs === String ? $util.Long.prototype.toString.call(message.block_max_bytes) : options.longs === Number ? new $util.LongBits(message.block_max_bytes.low >>> 0, message.block_max_bytes.high >>> 0).toNumber() : message.block_max_bytes; + if (message.block_max_gas != null && message.hasOwnProperty("block_max_gas")) + if (typeof message.block_max_gas === "number") + object.block_max_gas = options.longs === String ? String(message.block_max_gas) : message.block_max_gas; + else + object.block_max_gas = options.longs === String ? $util.Long.prototype.toString.call(message.block_max_gas) : options.longs === Number ? new $util.LongBits(message.block_max_gas.low >>> 0, message.block_max_gas.high >>> 0).toNumber() : message.block_max_gas; + return object; + }; + + /** + * Converts this HashedParams to JSON. + * @function toJSON + * @memberof tendermint.types.HashedParams + * @instance + * @returns {Object.} JSON object + */ + HashedParams.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return HashedParams; + })(); + + return types; + })(); + + tendermint.version = (function() { + + /** + * Namespace version. + * @memberof tendermint + * @namespace + */ + const version = {}; + + version.App = (function() { + + /** + * Properties of an App. + * @memberof tendermint.version + * @interface IApp + * @property {Long|null} [protocol] App protocol + * @property {string|null} [software] App software + */ + + /** + * Constructs a new App. + * @memberof tendermint.version + * @classdesc Represents an App. + * @implements IApp + * @constructor + * @param {tendermint.version.IApp=} [properties] Properties to set + */ + function App(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * App protocol. + * @member {Long} protocol + * @memberof tendermint.version.App + * @instance + */ + App.prototype.protocol = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * App software. + * @member {string} software + * @memberof tendermint.version.App + * @instance + */ + App.prototype.software = ""; + + /** + * Encodes the specified App message. Does not implicitly {@link tendermint.version.App.verify|verify} messages. + * @function encode + * @memberof tendermint.version.App + * @static + * @param {tendermint.version.IApp} message App message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + App.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.protocol != null && Object.hasOwnProperty.call(message, "protocol")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.protocol); + if (message.software != null && Object.hasOwnProperty.call(message, "software")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.software); + return writer; + }; + + /** + * Encodes the specified App message, length delimited. Does not implicitly {@link tendermint.version.App.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.version.App + * @static + * @param {tendermint.version.IApp} message App message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + App.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an App message from the specified reader or buffer. + * @function decode + * @memberof tendermint.version.App + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.version.App} App + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + App.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.version.App(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.protocol = reader.uint64(); + break; + case 2: + message.software = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an App message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.version.App + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.version.App} App + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + App.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an App message. + * @function verify + * @memberof tendermint.version.App + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + App.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.protocol != null && message.hasOwnProperty("protocol")) + if (!$util.isInteger(message.protocol) && !(message.protocol && $util.isInteger(message.protocol.low) && $util.isInteger(message.protocol.high))) + return "protocol: integer|Long expected"; + if (message.software != null && message.hasOwnProperty("software")) + if (!$util.isString(message.software)) + return "software: string expected"; + return null; + }; + + /** + * Creates an App message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.version.App + * @static + * @param {Object.} object Plain object + * @returns {tendermint.version.App} App + */ + App.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.version.App) + return object; + let message = new $root.tendermint.version.App(); + if (object.protocol != null) + if ($util.Long) + (message.protocol = $util.Long.fromValue(object.protocol)).unsigned = true; + else if (typeof object.protocol === "string") + message.protocol = parseInt(object.protocol, 10); + else if (typeof object.protocol === "number") + message.protocol = object.protocol; + else if (typeof object.protocol === "object") + message.protocol = new $util.LongBits(object.protocol.low >>> 0, object.protocol.high >>> 0).toNumber(true); + if (object.software != null) + message.software = String(object.software); + return message; + }; + + /** + * Creates a plain object from an App message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.version.App + * @static + * @param {tendermint.version.App} message App + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + App.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.protocol = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.protocol = options.longs === String ? "0" : 0; + object.software = ""; + } + if (message.protocol != null && message.hasOwnProperty("protocol")) + if (typeof message.protocol === "number") + object.protocol = options.longs === String ? String(message.protocol) : message.protocol; + else + object.protocol = options.longs === String ? $util.Long.prototype.toString.call(message.protocol) : options.longs === Number ? new $util.LongBits(message.protocol.low >>> 0, message.protocol.high >>> 0).toNumber(true) : message.protocol; + if (message.software != null && message.hasOwnProperty("software")) + object.software = message.software; + return object; + }; + + /** + * Converts this App to JSON. + * @function toJSON + * @memberof tendermint.version.App + * @instance + * @returns {Object.} JSON object + */ + App.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return App; + })(); + + version.Consensus = (function() { + + /** + * Properties of a Consensus. + * @memberof tendermint.version + * @interface IConsensus + * @property {Long|null} [block] Consensus block + * @property {Long|null} [app] Consensus app + */ + + /** + * Constructs a new Consensus. + * @memberof tendermint.version + * @classdesc Represents a Consensus. + * @implements IConsensus + * @constructor + * @param {tendermint.version.IConsensus=} [properties] Properties to set + */ + function Consensus(properties) { + if (properties) + for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Consensus block. + * @member {Long} block + * @memberof tendermint.version.Consensus + * @instance + */ + Consensus.prototype.block = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Consensus app. + * @member {Long} app + * @memberof tendermint.version.Consensus + * @instance + */ + Consensus.prototype.app = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Encodes the specified Consensus message. Does not implicitly {@link tendermint.version.Consensus.verify|verify} messages. + * @function encode + * @memberof tendermint.version.Consensus + * @static + * @param {tendermint.version.IConsensus} message Consensus message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Consensus.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.block != null && Object.hasOwnProperty.call(message, "block")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.block); + if (message.app != null && Object.hasOwnProperty.call(message, "app")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.app); + return writer; + }; + + /** + * Encodes the specified Consensus message, length delimited. Does not implicitly {@link tendermint.version.Consensus.verify|verify} messages. + * @function encodeDelimited + * @memberof tendermint.version.Consensus + * @static + * @param {tendermint.version.IConsensus} message Consensus message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Consensus.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Consensus message from the specified reader or buffer. + * @function decode + * @memberof tendermint.version.Consensus + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {tendermint.version.Consensus} Consensus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Consensus.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.version.Consensus(); + while (reader.pos < end) { + let tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.block = reader.uint64(); + break; + case 2: + message.app = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Consensus message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof tendermint.version.Consensus + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {tendermint.version.Consensus} Consensus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Consensus.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Consensus message. + * @function verify + * @memberof tendermint.version.Consensus + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Consensus.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.block != null && message.hasOwnProperty("block")) + if (!$util.isInteger(message.block) && !(message.block && $util.isInteger(message.block.low) && $util.isInteger(message.block.high))) + return "block: integer|Long expected"; + if (message.app != null && message.hasOwnProperty("app")) + if (!$util.isInteger(message.app) && !(message.app && $util.isInteger(message.app.low) && $util.isInteger(message.app.high))) + return "app: integer|Long expected"; + return null; + }; + + /** + * Creates a Consensus message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof tendermint.version.Consensus + * @static + * @param {Object.} object Plain object + * @returns {tendermint.version.Consensus} Consensus + */ + Consensus.fromObject = function fromObject(object) { + if (object instanceof $root.tendermint.version.Consensus) + return object; + let message = new $root.tendermint.version.Consensus(); + if (object.block != null) + if ($util.Long) + (message.block = $util.Long.fromValue(object.block)).unsigned = true; + else if (typeof object.block === "string") + message.block = parseInt(object.block, 10); + else if (typeof object.block === "number") + message.block = object.block; + else if (typeof object.block === "object") + message.block = new $util.LongBits(object.block.low >>> 0, object.block.high >>> 0).toNumber(true); + if (object.app != null) + if ($util.Long) + (message.app = $util.Long.fromValue(object.app)).unsigned = true; + else if (typeof object.app === "string") + message.app = parseInt(object.app, 10); + else if (typeof object.app === "number") + message.app = object.app; + else if (typeof object.app === "object") + message.app = new $util.LongBits(object.app.low >>> 0, object.app.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a Consensus message. Also converts values to other types if specified. + * @function toObject + * @memberof tendermint.version.Consensus + * @static + * @param {tendermint.version.Consensus} message Consensus + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Consensus.toObject = function toObject(message, options) { + if (!options) + options = {}; + let object = {}; + if (options.defaults) { + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.block = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.block = options.longs === String ? "0" : 0; + if ($util.Long) { + let long = new $util.Long(0, 0, true); + object.app = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.app = options.longs === String ? "0" : 0; + } + if (message.block != null && message.hasOwnProperty("block")) + if (typeof message.block === "number") + object.block = options.longs === String ? String(message.block) : message.block; + else + object.block = options.longs === String ? $util.Long.prototype.toString.call(message.block) : options.longs === Number ? new $util.LongBits(message.block.low >>> 0, message.block.high >>> 0).toNumber(true) : message.block; + if (message.app != null && message.hasOwnProperty("app")) + if (typeof message.app === "number") + object.app = options.longs === String ? String(message.app) : message.app; + else + object.app = options.longs === String ? $util.Long.prototype.toString.call(message.app) : options.longs === Number ? new $util.LongBits(message.app.low >>> 0, message.app.high >>> 0).toNumber(true) : message.app; + return object; + }; + + /** + * Converts this Consensus to JSON. + * @function toJSON + * @memberof tendermint.version.Consensus + * @instance + * @returns {Object.} JSON object + */ + Consensus.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Consensus; + })(); + + return version; + })(); + + return tendermint; +})(); + +export { $root as default }; diff --git a/package-lock.json b/package-lock.json index b39d3688a..4d2ce3779 100644 --- a/package-lock.json +++ b/package-lock.json @@ -313,6 +313,46 @@ "resolved": "https://registry.npmjs.org/@cosmjs/utils/-/utils-0.25.5.tgz", "integrity": "sha512-U4YdgJadFgXWblthgyXqP28Yw5rsw2IX/cOES0pa6fiB81hoYl2LXqXiuKp2yVPoAgk8JpkFh3i5KchcD9muJg==" }, + "@cosmostation/cosmosjs": { + "version": "0.9.5", + "resolved": "https://registry.npmjs.org/@cosmostation/cosmosjs/-/cosmosjs-0.9.5.tgz", + "integrity": "sha512-KPMUbbRLBnBIn+4LHNhgo5RSkP7rX6lpfH33ZSGFZ97814YrnShrHQYd20QbYkr7ymlyI65BflaI+Al90GgSzQ==", + "requires": { + "bech32": "^1.1.3", + "bip32": "^1.0.2", + "bip39": "^2.5.0", + "bitcoinjs-lib": "^4.0.2", + "node-fetch": "^2.6.0", + "secp256k1": "^3.6.2" + }, + "dependencies": { + "bip32": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/bip32/-/bip32-1.0.4.tgz", + "integrity": "sha512-8T21eLWylZETolyqCPgia+MNp+kY37zFr7PTFDTPObHeNi9JlfG4qGIh8WzerIJidtwoK+NsWq2I5i66YfHoIw==", + "requires": { + "bs58check": "^2.1.1", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "tiny-secp256k1": "^1.0.0", + "typeforce": "^1.11.5", + "wif": "^2.0.6" + } + }, + "bip39": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/bip39/-/bip39-2.6.0.tgz", + "integrity": "sha512-RrnQRG2EgEoqO24ea+Q/fftuPUZLmrEM3qNhhGsA3PbaXaCW791LTzPuVyx/VprXQcTbPJ3K3UeTna8ZnVl2sg==", + "requires": { + "create-hash": "^1.1.0", + "pbkdf2": "^3.0.9", + "randombytes": "^2.0.1", + "safe-buffer": "^5.0.1", + "unorm": "^1.3.3" + } + } + } + }, "@emotion/is-prop-valid": { "version": "0.7.3", "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-0.7.3.tgz", @@ -1323,6 +1363,19 @@ "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=" }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, "assertion-error": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", @@ -1346,6 +1399,21 @@ "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", + "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==" + }, "axe-core": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.1.0.tgz", @@ -1598,6 +1666,14 @@ "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "requires": { + "tweetnacl": "^0.14.3" + } + }, "bcrypto": { "version": "5.4.0", "resolved": "https://registry.npmjs.org/bcrypto/-/bcrypto-5.4.0.tgz", @@ -1672,6 +1748,48 @@ "safe-buffer": "^5.0.1" } }, + "bitcoin-ops": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/bitcoin-ops/-/bitcoin-ops-1.4.1.tgz", + "integrity": "sha512-pef6gxZFztEhaE9RY9HmWVmiIHqCb2OyS4HPKkpc6CIiiOa3Qmuoylxc5P2EkU3w+5eTSifI9SEZC88idAIGow==" + }, + "bitcoinjs-lib": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/bitcoinjs-lib/-/bitcoinjs-lib-4.0.5.tgz", + "integrity": "sha512-gYs7K2hiY4Xb96J8AIF+Rx+hqbwjVlp5Zt6L6AnHOdzfe/2tODdmDxsEytnaxVCdhOUg0JnsGpl+KowBpGLxtA==", + "requires": { + "bech32": "^1.1.2", + "bip32": "^1.0.4", + "bip66": "^1.1.0", + "bitcoin-ops": "^1.4.0", + "bs58check": "^2.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.3", + "merkle-lib": "^2.0.10", + "pushdata-bitcoin": "^1.0.1", + "randombytes": "^2.0.1", + "safe-buffer": "^5.1.1", + "tiny-secp256k1": "^1.0.0", + "typeforce": "^1.11.3", + "varuint-bitcoin": "^1.0.4", + "wif": "^2.0.1" + }, + "dependencies": { + "bip32": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/bip32/-/bip32-1.0.4.tgz", + "integrity": "sha512-8T21eLWylZETolyqCPgia+MNp+kY37zFr7PTFDTPObHeNi9JlfG4qGIh8WzerIJidtwoK+NsWq2I5i66YfHoIw==", + "requires": { + "bs58check": "^2.1.1", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "tiny-secp256k1": "^1.0.0", + "typeforce": "^1.11.5", + "wif": "^2.0.6" + } + } + } + }, "bn.js": { "version": "4.11.8", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", @@ -1773,6 +1891,11 @@ "resolved": "https://registry.npmjs.org/camelize/-/camelize-1.0.0.tgz", "integrity": "sha1-FkpUg+Yw+kMh5a8HAg5TGDGyYJs=" }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, "chai": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.4.tgz", @@ -2033,6 +2156,14 @@ "color-name": "^1.0.0" } }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, "commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", @@ -2481,6 +2612,14 @@ "integrity": "sha512-JVrozIeElnj3QzfUIt8tB8YMluBJom4Vw9qTPpjGYQ9fYlB3D/rb6OordUxf3xeFB35LKWs0xqcO5U6ySvBtug==", "dev": true }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, "debug": { "version": "3.2.7", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", @@ -2537,6 +2676,11 @@ "object-keys": "^1.0.12" } }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, "detect-libc": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", @@ -2635,6 +2779,15 @@ } } }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, "elliptic": { "version": "6.5.4", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", @@ -3423,6 +3576,11 @@ "safe-buffer": "^5.1.1" } }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, "external-editor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", @@ -3434,6 +3592,11 @@ "tmp": "^0.0.33" } }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, "fast-deep-equal": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", @@ -3443,8 +3606,7 @@ "fast-json-stable-stringify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", - "dev": true + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" }, "fast-levenshtein": { "version": "2.0.6", @@ -3613,6 +3775,21 @@ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.1.tgz", "integrity": "sha512-HWqDgT7ZEkqRzBvc2s64vSZ/hfOceEol3ac/7tKwzuvEyWx3/4UegXh5oBOIotkGsObyk3xznnSRVADBgWSQVg==" }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, "framesync": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/framesync/-/framesync-4.0.4.tgz", @@ -3690,6 +3867,14 @@ } } }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, "glob": { "version": "7.1.4", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", @@ -3717,6 +3902,11 @@ "define-properties": "^1.1.3" } }, + "google-protobuf": { + "version": "3.17.3", + "resolved": "https://registry.npmjs.org/google-protobuf/-/google-protobuf-3.17.3.tgz", + "integrity": "sha512-OVPzcSWIAJ+d5yiHyeaLrdufQtrvaBrF4JQg+z8ynTkbO3uFcujqXszTumqg1cGsAsjkWnI+M5B1xZ19yR4Wyg==" + }, "graceful-fs": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", @@ -3727,6 +3917,38 @@ "resolved": "https://registry.npmjs.org/gud/-/gud-1.0.0.tgz", "integrity": "sha512-zGEOVKFM5sVPPrYs7J5/hYEw2Pof8KCyOwyhG8sAF26mCAeUFAcYPu1mwB7hhpIP29zOIBaDqwuHdLp0jvZXjw==" }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", + "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", + "requires": { + "ajv": "^6.12.3", + "har-schema": "^2.0.0" + }, + "dependencies": { + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + } + } + }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -3822,6 +4044,16 @@ "readable-stream": "^3.1.1" } }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -4086,6 +4318,11 @@ "has-symbols": "^1.0.0" } }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, "is-what": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/is-what/-/is-what-3.5.0.tgz", @@ -4112,6 +4349,11 @@ "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz", "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==" }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, "jquery": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz", @@ -4147,6 +4389,11 @@ "esprima": "^4.0.0" } }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + }, "jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -4158,11 +4405,15 @@ "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", "dev": true }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, "json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" }, "json-stable-stringify": { "version": "1.0.1", @@ -4205,6 +4456,17 @@ "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=" }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, "jsx-ast-utils": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.1.0.tgz", @@ -4435,6 +4697,11 @@ "is-what": "^3.3.1" } }, + "merkle-lib": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/merkle-lib/-/merkle-lib-2.0.10.tgz", + "integrity": "sha1-grjbrnXieneFOItz+ddyXQ9vMyY=" + }, "mersenne-twister": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/mersenne-twister/-/mersenne-twister-1.1.0.tgz", @@ -5025,6 +5292,19 @@ } } }, + "mime-db": { + "version": "1.48.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.48.0.tgz", + "integrity": "sha512-FM3QwxV+TnZYQ2aRqhlKBMHxk10lTbMt3bBkMAp54ddrNeVSfcQYOOKuGuy3Ddrm38I04If834fOUSq1yzslJQ==" + }, + "mime-types": { + "version": "2.1.31", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.31.tgz", + "integrity": "sha512-XGZnNzm3QvgKxa8dpzyhFTHmpP3l5YNusmne07VUOXxou9CqUqYa/HBy124RqtVh/O2pECas/MOcsDgpilPOPg==", + "requires": { + "mime-db": "1.48.0" + } + }, "mimic-fn": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", @@ -5149,6 +5429,11 @@ "bignumber.js": "^8.1.1" } }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -5667,6 +5952,11 @@ "sha.js": "^2.4.8" } }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, "pify": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", @@ -6091,6 +6381,11 @@ } } }, + "psl": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", + "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==" + }, "pump": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", @@ -6113,14 +6408,26 @@ "punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "dev": true + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" }, "pure-color": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/pure-color/-/pure-color-1.3.0.tgz", "integrity": "sha1-H+Bk+wrIUfDeYTIKi/eWg2Qi8z4=" }, + "pushdata-bitcoin": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/pushdata-bitcoin/-/pushdata-bitcoin-1.0.1.tgz", + "integrity": "sha1-FZMdPNlnreUiBvUjqnMxrvfUOvc=", + "requires": { + "bitcoin-ops": "^1.3.0" + } + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -6442,6 +6749,33 @@ "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", "dev": true }, + "request": { + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -6771,6 +7105,22 @@ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, + "sshpk": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", + "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, "stream-shift": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.1.tgz", @@ -7394,6 +7744,15 @@ "popper.js": "^1.0.2" } }, + "tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "requires": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + } + }, "trim-right": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", @@ -7421,6 +7780,19 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.8.1.tgz", "integrity": "sha1-aUavLR1lGnsYY7Ux1uWvpBqkTqw=" }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + }, "type-check": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", @@ -7491,11 +7863,15 @@ "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" }, + "unorm": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/unorm/-/unorm-1.6.0.tgz", + "integrity": "sha512-b2/KCUlYZUeA7JFUuRJZPUtr4gZvBh7tavtv4fvk4+KV9pfGiR6CQAQAWl49ZpR3ts2dk4FYkP7EIgDJoiOLDA==" + }, "uri-js": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", - "dev": true, "requires": { "punycode": "^2.1.0" } @@ -7533,6 +7909,11 @@ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" + }, "validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", @@ -7557,6 +7938,24 @@ "safe-buffer": "^5.1.1" } }, + "varuint-bitcoin": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/varuint-bitcoin/-/varuint-bitcoin-1.1.2.tgz", + "integrity": "sha512-4EVb+w4rx+YfVM32HQX42AbbT7/1f5zwAYhIujKXKk8NQK+JfRVl3pqT3hjNn/L+RstigmGGKVwHA/P0wgITZw==", + "requires": { + "safe-buffer": "^5.1.1" + } + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, "voca": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/voca/-/voca-1.4.0.tgz", diff --git a/package.json b/package.json index c2c9d7e5d..84522a539 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "@cosmjs/amino": "^0.25.5", "@cosmjs/proto-signing": "^0.25.5", "@cosmjs/stargate": "^0.25.5", + "@cosmostation/cosmosjs": "^0.9.5", "@ledgerhq/hw-transport-web-ble": "^5.50.0", "@ledgerhq/hw-transport-webusb": "^5.53.0", "@lunie/cosmos-js": "0.0.22", @@ -29,6 +30,7 @@ "crypto-js": "^3.3.0", "d3": "^5.16.0", "fibers": "^4.0.3", + "google-protobuf": "^3.17.3", "jquery": "^3.6.0", "js-sha256": "^0.9.0", "ledger-cosmos-js": "^2.1.8", @@ -53,6 +55,7 @@ "react-sidebar": "^3.0.2", "react-toastify": "^4.5.2", "reactstrap": "^8.9.0", + "request": "^2.88.2", "rollup": "^2.49.0", "secp256k1": "^3.8.0", "styled-components": "^4.4.1", From a204ad4cf513ee9ef0b1ff3a8ac62468f27267bc Mon Sep 17 00:00:00 2001 From: Magic Cat Date: Mon, 28 Jun 2021 22:54:50 +0800 Subject: [PATCH 03/17] Updated getTotalNumberOfCosmosAccounts method --- imports/ui/accounts/TotalAccounts.jsx | 59 --------------------------- imports/ui/ledger/ledger.js | 55 ++++++++++++++++++++++++- package-lock.json | 21 ++++++++++ package.json | 1 + 4 files changed, 76 insertions(+), 60 deletions(-) delete mode 100644 imports/ui/accounts/TotalAccounts.jsx diff --git a/imports/ui/accounts/TotalAccounts.jsx b/imports/ui/accounts/TotalAccounts.jsx deleted file mode 100644 index 9a391ea6e..000000000 --- a/imports/ui/accounts/TotalAccounts.jsx +++ /dev/null @@ -1,59 +0,0 @@ -import { getNewWalletFromSeed } from "@lunie/cosmos-keys" -import { signWithPrivateKey } from "@lunie/cosmos-keys" -import Cosmos from "@lunie/cosmos-js" - - -function getFromAddress(){ - const seed = "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone"; - const bech32prefix = 'cosmos'; - let hdpath = `m/44'/${COINTYPE}'/0'/0/0` - const { cosmosAddress, privateKey, publicKey } = getNewWalletFromSeed(seed, bech32prefix, hdpath) - return { cosmosAddress, privateKey, publicKey } -} -function getToAddress() { - const seed = "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone"; - const bech32prefix = 'cosmos'; - let hdpath = `m/44'/${COINTYPE}'/1'/0/0` - const { cosmosAddress, privateKey, publicKey } = getNewWalletFromSeed(seed, bech32prefix, hdpath) - return { cosmosAddress, privateKey, publicKey } -} -export async function queryTotalNumberOfAccounts(transportBLE, accountIndex) { - // let signMessage = { "account_number": "51442", - // "chain_id": "cosmoshub-4", - // "fee": { "amount": [{ "amount": "1879", "denom": "uatom" }], "gas": "93931" }, - // "memo": "Sent via Big Dipper", - // "msgs": [{ - // "type": "cosmos-sdk/MsgSend", - // "value": { "amount": [{ "amount": "100000", "denom": "uatom" }], - // "from_address": "cosmos1uulfsj45fvvkr98s859nxkzy08dzejs35ruy3l", - // "to_address": "cosmos1uulfsj45fvvkr98s859nxkzy08dzejs35ruy3l" } }], - // "sequence": "3" } - - let getFromAddress = getFromAddress(); - let getToAddress = getToAddress(); - - console.log(getFromAddress, getToAddress); - - const cosmos = Cosmos("http://139.162.187.197:1317", getFromAddress.cosmosAddress) - // create message - const msg = cosmos - .MsgSend({ toAddress: getToAddress, amounts: [{ denom: 'uatom', amount: 100 }] }) - console.log(msg) - // create a signer from this local js signer library - const localSigner = (signMessage) => { - const signature = signWithPrivateKey(signMessage, privateKey) - - return { - signature, - publicKey - } - } - - // send the transaction - const { included } = await msg.send({ gas: 200000 }, localSigner) - console.log(included) - // await tx to be included in a block - await included() - - return '' -} \ No newline at end of file diff --git a/imports/ui/ledger/ledger.js b/imports/ui/ledger/ledger.js index 330103c63..37f0965ab 100644 --- a/imports/ui/ledger/ledger.js +++ b/imports/ui/ledger/ledger.js @@ -11,6 +11,11 @@ import bech32 from "bech32"; import sha256 from "crypto-js/sha256" import ripemd160 from "crypto-js/ripemd160" import CryptoJS from "crypto-js" +import { getNewWalletFromSeed } from "@lunie/cosmos-keys" +import { signWithPrivateKey } from "@lunie/cosmos-keys" +import { SigningStargateClient, assertIsBroadcastTxSuccess} from "@cosmjs/stargate" +import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"; +import { Chain } from '../../api/chain/chain'; // TODO: discuss TIMEOUT value const INTERACTION_TIMEOUT = 10000 @@ -18,7 +23,9 @@ const REQUIRED_COSMOS_APP_VERSION = Meteor.settings.public.ledger.ledgerAppVersi const DEFAULT_DENOM = Meteor.settings.public.bondDenom || 'uatom'; export const DEFAULT_GAS_PRICE = parseFloat(Meteor.settings.public.ledger.gasPrice) || 0.025; export const DEFAULT_MEMO = 'Sent via Big Dipper' - +const RPC = Meteor?.settings?.remote?.rpc || "http://139.162.187.197:26657" +const API = Meteor?.settings?.remote?.api || "http://139.162.187.197:1317" +const CHAINID = Meteor?.settings?.public?.chainId || 'cosmoshub-4' /* HD wallet derivation path (BIP44) DerivationPath{44, 118, account, 0, index} @@ -177,6 +184,52 @@ export class Ledger { }) } + getFromAddress() { + const seed = "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone"; + const bech32prefix = 'cosmos'; + let hdpath = `m/44'/${COINTYPE}'/0'/0/0` + const { cosmosAddress, privateKey, publicKey } = getNewWalletFromSeed(seed, bech32prefix, hdpath) + return { cosmosAddress, privateKey, publicKey } + } + + getToAddress(accountIndex) { + const seed = "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone"; + const bech32prefix = 'cosmos'; + let hdpath = `m/44'/${COINTYPE}'/${accountIndex}'/0/0` + const { cosmosAddress, privateKey, publicKey } = getNewWalletFromSeed(seed, bech32prefix, hdpath) + return { cosmosAddress, privateKey, publicKey } + } + + async getTotalNumberOfCosmosAccounts(accountIndex) { + let sendFromAddress = this.getFromAddress(); + let sendToAddress = this.getToAddress(accountIndex); + const seed = "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone"; + const options = { prefix: 'cosmos'}; + + const wallet = await DirectSecp256k1HdWallet.fromMnemonic(seed); + const client = await SigningStargateClient.connectWithSigner(RPC, wallet, options); + const [{ address }] = await wallet.getAccounts(); + const amount = [{amount: "123", denom: "uatom"}] + const fee = { + amount: [{ amount: "2100", denom: "uatom" }], + gas: "160000", + } + const sendMsg = { + typeUrl: "/cosmos.bank.v1beta1.MsgSend", + value: { + fromAddress: sendFromAddress.cosmosAddress, + toAddress: sendToAddress.cosmosAddress, + amount: [...amount], + }, + }; + + let signMessage = await client.signAndBroadcast(sendFromAddress.cosmosAddress, [sendMsg], fee, DEFAULT_MEMO); + assertIsBroadcastTxSuccess(signMessage); + const accountNumber = await client.getSequence(sendToAddress.cosmosAddress); + const latestAccountNumber = accountNumber.accountNumber + Chain.upsert({ chainId: CHAINID }, { $set: { "totalNumberOfCosmosAccounts": latestAccountNumber } }); + } + async sign(signMessage, transportBLE) { await this.connect(INTERACTION_TIMEOUT, transportBLE) diff --git a/package-lock.json b/package-lock.json index 4d2ce3779..0a5da5b70 100644 --- a/package-lock.json +++ b/package-lock.json @@ -231,6 +231,27 @@ "xstream": "^11.14.0" } }, + "@cosmjs/launchpad": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@cosmjs/launchpad/-/launchpad-0.25.5.tgz", + "integrity": "sha512-7zsFWQHLAiOUBXV/QWvffI/5Ssma67lEO3V01DZ8CtfnWiO4bCSbnU2sslSAH11RkrPdNfRBM7WOBczMMigIzw==", + "requires": { + "@cosmjs/amino": "^0.25.5", + "@cosmjs/crypto": "^0.25.5", + "@cosmjs/encoding": "^0.25.5", + "@cosmjs/math": "^0.25.5", + "@cosmjs/utils": "^0.25.5", + "axios": "^0.21.1", + "fast-deep-equal": "^3.1.3" + }, + "dependencies": { + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + } + } + }, "@cosmjs/math": { "version": "0.25.5", "resolved": "https://registry.npmjs.org/@cosmjs/math/-/math-0.25.5.tgz", diff --git a/package.json b/package.json index 84522a539..021b21fae 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "dependencies": { "@babel/runtime": "^7.13.17", "@cosmjs/amino": "^0.25.5", + "@cosmjs/launchpad": "^0.25.5", "@cosmjs/proto-signing": "^0.25.5", "@cosmjs/stargate": "^0.25.5", "@cosmostation/cosmosjs": "^0.9.5", From 54c218756b53853627c404fa33bba245fbcf6bdd Mon Sep 17 00:00:00 2001 From: Magic Cat Date: Wed, 30 Jun 2021 18:10:57 +0800 Subject: [PATCH 04/17] Display total cosmos accounts number in ChainStatus --- both/i18n/en-us.i18n.yml | 1 + imports/ui/home/ChainStatus.jsx | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/both/i18n/en-us.i18n.yml b/both/i18n/en-us.i18n.yml index c2d85d265..74a2490fe 100644 --- a/both/i18n/en-us.i18n.yml +++ b/both/i18n/en-us.i18n.yml @@ -77,6 +77,7 @@ chainStatus: outOfValidators: 'out of {$totalValidators} validators' onlineVotingPower: 'Online Voting Power' fromTotalStakes: '{$percent} from {$totalStakes} {$denomPlural}' + totalAccounts: 'Total Number Of Cosmos Accounts' analytics: blockTimeHistory: 'Block Time History' averageBlockTime: 'Average Block Time' diff --git a/imports/ui/home/ChainStatus.jsx b/imports/ui/home/ChainStatus.jsx index 15ebc321b..e9d40a8c6 100644 --- a/imports/ui/home/ChainStatus.jsx +++ b/imports/ui/home/ChainStatus.jsx @@ -34,7 +34,8 @@ export default class ChainStatus extends React.Component { numValidators: this.props.status.validators, totalNumValidators: this.props.status.totalValidators, bondedTokens: this.props.states.bondedTokens, - totalSupply: this.props.states.totalSupply + totalSupply: this.props.states.totalSupply, + totalNumberOfCosmosAccounts: this.props.status.totalNumberOfCosmosAccounts }) switch (this.state.avgBlockTimeType){ @@ -153,7 +154,7 @@ export default class ChainStatus extends React.Component { if (this.props.statusExist && this.props.status.prevotes){ return( - + chainStatus.latestHeight @@ -162,7 +163,7 @@ export default class ChainStatus extends React.Component { - + @@ -181,13 +182,19 @@ export default class ChainStatus extends React.Component { - + chainStatus.activeValidators {this.state.numValidators}chainStatus.outOfValidators - + + + chainStatus.totalAccounts + {this.state.totalNumberOfCosmosAccounts?.total}{this.state.totalNumberOfCosmosAccounts?.updatedAt} + + + From 474f94a010c9f4980d895096f8d97f00fc80646d Mon Sep 17 00:00:00 2001 From: Magic Cat Date: Wed, 30 Jun 2021 18:11:28 +0800 Subject: [PATCH 05/17] Updated ledger.js --- imports/ui/ledger/ledger.js | 56 ++----------------------------------- 1 file changed, 2 insertions(+), 54 deletions(-) diff --git a/imports/ui/ledger/ledger.js b/imports/ui/ledger/ledger.js index 37f0965ab..27ca21dd6 100644 --- a/imports/ui/ledger/ledger.js +++ b/imports/ui/ledger/ledger.js @@ -11,11 +11,7 @@ import bech32 from "bech32"; import sha256 from "crypto-js/sha256" import ripemd160 from "crypto-js/ripemd160" import CryptoJS from "crypto-js" -import { getNewWalletFromSeed } from "@lunie/cosmos-keys" -import { signWithPrivateKey } from "@lunie/cosmos-keys" -import { SigningStargateClient, assertIsBroadcastTxSuccess} from "@cosmjs/stargate" -import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"; -import { Chain } from '../../api/chain/chain'; + // TODO: discuss TIMEOUT value const INTERACTION_TIMEOUT = 10000 @@ -23,9 +19,7 @@ const REQUIRED_COSMOS_APP_VERSION = Meteor.settings.public.ledger.ledgerAppVersi const DEFAULT_DENOM = Meteor.settings.public.bondDenom || 'uatom'; export const DEFAULT_GAS_PRICE = parseFloat(Meteor.settings.public.ledger.gasPrice) || 0.025; export const DEFAULT_MEMO = 'Sent via Big Dipper' -const RPC = Meteor?.settings?.remote?.rpc || "http://139.162.187.197:26657" -const API = Meteor?.settings?.remote?.api || "http://139.162.187.197:1317" -const CHAINID = Meteor?.settings?.public?.chainId || 'cosmoshub-4' + /* HD wallet derivation path (BIP44) DerivationPath{44, 118, account, 0, index} @@ -184,52 +178,6 @@ export class Ledger { }) } - getFromAddress() { - const seed = "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone"; - const bech32prefix = 'cosmos'; - let hdpath = `m/44'/${COINTYPE}'/0'/0/0` - const { cosmosAddress, privateKey, publicKey } = getNewWalletFromSeed(seed, bech32prefix, hdpath) - return { cosmosAddress, privateKey, publicKey } - } - - getToAddress(accountIndex) { - const seed = "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone"; - const bech32prefix = 'cosmos'; - let hdpath = `m/44'/${COINTYPE}'/${accountIndex}'/0/0` - const { cosmosAddress, privateKey, publicKey } = getNewWalletFromSeed(seed, bech32prefix, hdpath) - return { cosmosAddress, privateKey, publicKey } - } - - async getTotalNumberOfCosmosAccounts(accountIndex) { - let sendFromAddress = this.getFromAddress(); - let sendToAddress = this.getToAddress(accountIndex); - const seed = "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone"; - const options = { prefix: 'cosmos'}; - - const wallet = await DirectSecp256k1HdWallet.fromMnemonic(seed); - const client = await SigningStargateClient.connectWithSigner(RPC, wallet, options); - const [{ address }] = await wallet.getAccounts(); - const amount = [{amount: "123", denom: "uatom"}] - const fee = { - amount: [{ amount: "2100", denom: "uatom" }], - gas: "160000", - } - const sendMsg = { - typeUrl: "/cosmos.bank.v1beta1.MsgSend", - value: { - fromAddress: sendFromAddress.cosmosAddress, - toAddress: sendToAddress.cosmosAddress, - amount: [...amount], - }, - }; - - let signMessage = await client.signAndBroadcast(sendFromAddress.cosmosAddress, [sendMsg], fee, DEFAULT_MEMO); - assertIsBroadcastTxSuccess(signMessage); - const accountNumber = await client.getSequence(sendToAddress.cosmosAddress); - const latestAccountNumber = accountNumber.accountNumber - Chain.upsert({ chainId: CHAINID }, { $set: { "totalNumberOfCosmosAccounts": latestAccountNumber } }); - } - async sign(signMessage, transportBLE) { await this.connect(INTERACTION_TIMEOUT, transportBLE) From 5947a7979445e1365c70f801f7c7876d52f66f57 Mon Sep 17 00:00:00 2001 From: Magic Cat Date: Wed, 30 Jun 2021 18:12:20 +0800 Subject: [PATCH 06/17] Add getTotalCosmosAccounts --- imports/api/chain/server/methods.js | 15 +++++ imports/ui/home/TotalCosmosAcounts.js | 96 +++++++++++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 imports/ui/home/TotalCosmosAcounts.js diff --git a/imports/api/chain/server/methods.js b/imports/api/chain/server/methods.js index 0910d72f0..367daaa4f 100644 --- a/imports/api/chain/server/methods.js +++ b/imports/api/chain/server/methods.js @@ -235,4 +235,19 @@ Meteor.methods({ this.unblock(); Chain.find().sort({created:-1}).limit(1); }, + 'chain.getTotalCosmosAccounts': function (totalNumberOfAccountsIndex) { + this.unblock(); + let date = new Date(); + let dateUTC = date.toUTCString(); + let totalNumberOfCosmosAccounts = { + total: totalNumberOfAccountsIndex, + updatedAt: dateUTC + } + try { + Chain.upsert({ chainId: Meteor.settings.public.chainId }, { $set: { "totalNumberOfCosmosAccounts": totalNumberOfCosmosAccounts } }); + } + catch (e) { + console.log(e); + } + }, }) diff --git a/imports/ui/home/TotalCosmosAcounts.js b/imports/ui/home/TotalCosmosAcounts.js new file mode 100644 index 000000000..5687c9b45 --- /dev/null +++ b/imports/ui/home/TotalCosmosAcounts.js @@ -0,0 +1,96 @@ +/* eslint-disable camelcase */ +import 'babel-polyfill'; +import { getNewWalletFromSeed } from "@lunie/cosmos-keys" +import { SigningStargateClient, assertIsBroadcastTxSuccess } from "@cosmjs/stargate" +import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"; + +export const DEFAULT_GAS_PRICE = parseFloat(Meteor.settings.public.ledger.gasPrice) || 0.025; +export const DEFAULT_MEMO = 'Sent via Big Dipper' +const RPC = Meteor?.settings?.remote?.rpc || "http://139.162.187.197:26657" +const API = Meteor?.settings?.remote?.api || "http://139.162.187.197:1317" +const COINTYPE = Meteor.settings.public.ledger.coinType || 118; + +getFromAddress = () => { + const seed = "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone"; + const bech32prefix = 'cosmos'; + let hdpath = `m/44'/${COINTYPE}'/0'/0/0` + const { cosmosAddress, privateKey, publicKey } = getNewWalletFromSeed(seed, bech32prefix, hdpath) + return { cosmosAddress, privateKey, publicKey } +} + +getToAddress = (accountIndex) => { + const seed = "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone"; + const bech32prefix = 'cosmos'; + let hdpath = `m/44'/${COINTYPE}'/${accountIndex}'/0/0` + const { cosmosAddress, privateKey, publicKey } = getNewWalletFromSeed(seed, bech32prefix, hdpath) + return { cosmosAddress, privateKey, publicKey } +} + +async function queryTotalNumberOfCosmosAccounts(accountIndex){ + let sendFromAddress = this.getFromAddress(); + let sendToAddress = this.getToAddress(accountIndex); + // console.log("to account " + sendToAddress.cosmosAddress) + const seed = "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone"; + const options = { prefix: 'cosmos' }; + + const wallet = await DirectSecp256k1HdWallet.fromMnemonic(seed); + const client = await SigningStargateClient.connectWithSigner(RPC, wallet, options); + const amount = [{ amount: "1", denom: "uatom" }] + const fee = { + amount: [{ amount: "100", denom: "uatom" }], + gas: "100000", + } + const sendMsg = { + typeUrl: "/cosmos.bank.v1beta1.MsgSend", + value: { + fromAddress: sendFromAddress.cosmosAddress, + toAddress: sendToAddress.cosmosAddress, + amount: [...amount], + }, + }; + try { + let signMessage = await client.signAndBroadcast(sendFromAddress.cosmosAddress, [sendMsg], fee, DEFAULT_MEMO); + assertIsBroadcastTxSuccess(signMessage); + } + catch (e) { + console.log(e) + } + try { + const accountNumber = await client.getSequence(sendToAddress.cosmosAddress); + // console.log(accountNumber) + const latestAccountNumber = accountNumber.accountNumber || 0; + try{ + Meteor.call('chain.getTotalCosmosAccounts', latestAccountNumber) + } + catch(e){ + console.log("Error updating Total Number Of Cosmos Accounts " + e) + } + return latestAccountNumber + } + catch (e) { + console.log(e) + } +} + +export async function getTotalCosmosAccounts() { + const seed = "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone"; + const options = { prefix: 'cosmos' }; + let accountIndex; + const wallet = await DirectSecp256k1HdWallet.fromMnemonic(seed); + const client = await SigningStargateClient.connectWithSigner(RPC, wallet, options); + for(let c = 1; c < 100; c++){ + let accIndex = this.getToAddress(c); + try{ + // eslint-disable-next-line no-await-in-loop + await client.getSequence(accIndex.cosmosAddress) + } + catch(e){ + accountIndex = c + break; + } + + } + // console.log(accountIndex) + + return queryTotalNumberOfCosmosAccounts(accountIndex) +} \ No newline at end of file From 9aef2741bd6be46ab26677d8ac32999d129bceb5 Mon Sep 17 00:00:00 2001 From: Magic Cat Date: Wed, 30 Jun 2021 18:12:44 +0800 Subject: [PATCH 07/17] add timeout --- client/main.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/main.js b/client/main.js index 528dd4e48..93ede5a8d 100644 --- a/client/main.js +++ b/client/main.js @@ -7,6 +7,7 @@ import App from '/imports/ui/App.jsx'; import React from 'react'; import { BrowserRouter as Router } from 'react-router-dom' // import ReactDOM from 'react-dom'; +import { getTotalCosmosAccounts } from '../imports/ui/home/TotalCosmosAcounts' import { Meteor } from 'meteor/meteor'; import { render } from 'react-dom'; @@ -31,4 +32,5 @@ Meteor.startup(() => { // , document.getElementById('app') // ); // }); + setTimeout(getTotalCosmosAccounts, 86400000); }); From 58e796263e5f47422594f887f11da29bb64226b3 Mon Sep 17 00:00:00 2001 From: Magic Cat Date: Fri, 9 Jul 2021 15:06:36 +0800 Subject: [PATCH 08/17] Cleanup --- imports/ui/home/TotalCosmosAcounts.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/imports/ui/home/TotalCosmosAcounts.js b/imports/ui/home/TotalCosmosAcounts.js index 5687c9b45..03a4165cc 100644 --- a/imports/ui/home/TotalCosmosAcounts.js +++ b/imports/ui/home/TotalCosmosAcounts.js @@ -6,21 +6,20 @@ import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"; export const DEFAULT_GAS_PRICE = parseFloat(Meteor.settings.public.ledger.gasPrice) || 0.025; export const DEFAULT_MEMO = 'Sent via Big Dipper' -const RPC = Meteor?.settings?.remote?.rpc || "http://139.162.187.197:26657" -const API = Meteor?.settings?.remote?.api || "http://139.162.187.197:1317" -const COINTYPE = Meteor.settings.public.ledger.coinType || 118; +const RPC = Meteor.settings.public.remote.rpc +const API = Meteor.settings.public.remote.api +const COINTYPE = Meteor.settings.public.ledger.coinType +const seed = "" +const options = { prefix: 'cosmos' }; +const bech32prefix = 'cosmos'; getFromAddress = () => { - const seed = "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone"; - const bech32prefix = 'cosmos'; let hdpath = `m/44'/${COINTYPE}'/0'/0/0` const { cosmosAddress, privateKey, publicKey } = getNewWalletFromSeed(seed, bech32prefix, hdpath) return { cosmosAddress, privateKey, publicKey } } getToAddress = (accountIndex) => { - const seed = "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone"; - const bech32prefix = 'cosmos'; let hdpath = `m/44'/${COINTYPE}'/${accountIndex}'/0/0` const { cosmosAddress, privateKey, publicKey } = getNewWalletFromSeed(seed, bech32prefix, hdpath) return { cosmosAddress, privateKey, publicKey } @@ -30,8 +29,6 @@ async function queryTotalNumberOfCosmosAccounts(accountIndex){ let sendFromAddress = this.getFromAddress(); let sendToAddress = this.getToAddress(accountIndex); // console.log("to account " + sendToAddress.cosmosAddress) - const seed = "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone"; - const options = { prefix: 'cosmos' }; const wallet = await DirectSecp256k1HdWallet.fromMnemonic(seed); const client = await SigningStargateClient.connectWithSigner(RPC, wallet, options); @@ -73,8 +70,6 @@ async function queryTotalNumberOfCosmosAccounts(accountIndex){ } export async function getTotalCosmosAccounts() { - const seed = "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone"; - const options = { prefix: 'cosmos' }; let accountIndex; const wallet = await DirectSecp256k1HdWallet.fromMnemonic(seed); const client = await SigningStargateClient.connectWithSigner(RPC, wallet, options); From 5d5865387c691e10f199202e5e7cd86777cac5f9 Mon Sep 17 00:00:00 2001 From: Magic Cat Date: Fri, 16 Jul 2021 15:06:53 +0800 Subject: [PATCH 09/17] Add shouldUpdateTotalCosmosAccounts --- imports/api/chain/server/methods.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/imports/api/chain/server/methods.js b/imports/api/chain/server/methods.js index 367daaa4f..dd11c2325 100644 --- a/imports/api/chain/server/methods.js +++ b/imports/api/chain/server/methods.js @@ -235,13 +235,22 @@ Meteor.methods({ this.unblock(); Chain.find().sort({created:-1}).limit(1); }, + 'chain.shouldUpdateTotalCosmosAccounts': function () { + this.unblock(); + let date = new Date(); + let chain = Chain.find().fetch(); + let lastUpdated = chain?.lastUpdated ? new Date(chain?.lastUpdated) : new Date(); + let timeDifference = moment(date).diff(moment(lastUpdated), 'hours'); + let shouldUpdate = timeDifference >= 24 ? true : false; + return shouldUpdate; + }, 'chain.getTotalCosmosAccounts': function (totalNumberOfAccountsIndex) { this.unblock(); let date = new Date(); let dateUTC = date.toUTCString(); let totalNumberOfCosmosAccounts = { total: totalNumberOfAccountsIndex, - updatedAt: dateUTC + lastUpdated: dateUTC } try { Chain.upsert({ chainId: Meteor.settings.public.chainId }, { $set: { "totalNumberOfCosmosAccounts": totalNumberOfCosmosAccounts } }); From 0a73ed8eac4c7cf35954de025fac427f925be838 Mon Sep 17 00:00:00 2001 From: Magic Cat Date: Fri, 16 Jul 2021 15:07:39 +0800 Subject: [PATCH 10/17] Updated meteor methods --- imports/api/chain/server/methods.js | 4 ++-- package-lock.json | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/imports/api/chain/server/methods.js b/imports/api/chain/server/methods.js index dd11c2325..b00a65537 100644 --- a/imports/api/chain/server/methods.js +++ b/imports/api/chain/server/methods.js @@ -235,7 +235,7 @@ Meteor.methods({ this.unblock(); Chain.find().sort({created:-1}).limit(1); }, - 'chain.shouldUpdateTotalCosmosAccounts': function () { + 'chain.shouldUpdateCosmosAccountsNumber': function () { this.unblock(); let date = new Date(); let chain = Chain.find().fetch(); @@ -244,7 +244,7 @@ Meteor.methods({ let shouldUpdate = timeDifference >= 24 ? true : false; return shouldUpdate; }, - 'chain.getTotalCosmosAccounts': function (totalNumberOfAccountsIndex) { + 'chain.getCosmosAccountsNumber': function (totalNumberOfAccountsIndex) { this.unblock(); let date = new Date(); let dateUTC = date.toUTCString(); diff --git a/package-lock.json b/package-lock.json index 0a5da5b70..7aaea6a0c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -282,9 +282,9 @@ }, "dependencies": { "ws": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.0.tgz", - "integrity": "sha512-6ezXvzOZupqKj4jUqbQ9tXuJNo+BR2gU8fFRk3XCP3e0G6WT414u5ELe6Y0vtp7kmSJ3F7YWObSNr1ESsgi4vw==" + "version": "7.5.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.3.tgz", + "integrity": "sha512-kQ/dHIzuLrS6Je9+uv81ueZomEwH0qVYstcAQ4/Z93K8zeko9gtAbttJWzoC5ukqXY1PpoouV3+VSOqEAFt5wg==" } } }, From 5260f6af70bd2a8491ad21d4ecbe8afe897c5ad6 Mon Sep 17 00:00:00 2001 From: Magic Cat Date: Fri, 16 Jul 2021 15:13:36 +0800 Subject: [PATCH 11/17] Add method methods --- client/main.js | 4 +- imports/ui/home/TotalCosmosAcounts.js | 171 ++++++++++++++++++++++---- 2 files changed, 146 insertions(+), 29 deletions(-) diff --git a/client/main.js b/client/main.js index 93ede5a8d..84946df2f 100644 --- a/client/main.js +++ b/client/main.js @@ -7,7 +7,7 @@ import App from '/imports/ui/App.jsx'; import React from 'react'; import { BrowserRouter as Router } from 'react-router-dom' // import ReactDOM from 'react-dom'; -import { getTotalCosmosAccounts } from '../imports/ui/home/TotalCosmosAcounts' +import { getCosmosAccountsNumber } from '../imports/ui/home/TotalCosmosAcounts' import { Meteor } from 'meteor/meteor'; import { render } from 'react-dom'; @@ -32,5 +32,5 @@ Meteor.startup(() => { // , document.getElementById('app') // ); // }); - setTimeout(getTotalCosmosAccounts, 86400000); + setTimeout(getCosmosAccountsNumber, 60000); }); diff --git a/imports/ui/home/TotalCosmosAcounts.js b/imports/ui/home/TotalCosmosAcounts.js index 03a4165cc..ea7e7ef94 100644 --- a/imports/ui/home/TotalCosmosAcounts.js +++ b/imports/ui/home/TotalCosmosAcounts.js @@ -1,4 +1,5 @@ /* eslint-disable camelcase */ +import { Meteor } from 'meteor/meteor'; import 'babel-polyfill'; import { getNewWalletFromSeed } from "@lunie/cosmos-keys" import { SigningStargateClient, assertIsBroadcastTxSuccess } from "@cosmjs/stargate" @@ -6,10 +7,9 @@ import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"; export const DEFAULT_GAS_PRICE = parseFloat(Meteor.settings.public.ledger.gasPrice) || 0.025; export const DEFAULT_MEMO = 'Sent via Big Dipper' -const RPC = Meteor.settings.public.remote.rpc -const API = Meteor.settings.public.remote.api -const COINTYPE = Meteor.settings.public.ledger.coinType -const seed = "" +const RPC = Meteor?.settings?.public?.remote?.rpc +const COINTYPE = Meteor?.settings?.public?.ledger?.coinType +const seed = Meteor?.settings?.private?.seed; const options = { prefix: 'cosmos' }; const bech32prefix = 'cosmos'; @@ -25,11 +25,9 @@ getToAddress = (accountIndex) => { return { cosmosAddress, privateKey, publicKey } } -async function queryTotalNumberOfCosmosAccounts(accountIndex){ +async function fetchCosmosAccountsNumber(accountIndex){ let sendFromAddress = this.getFromAddress(); let sendToAddress = this.getToAddress(accountIndex); - // console.log("to account " + sendToAddress.cosmosAddress) - const wallet = await DirectSecp256k1HdWallet.fromMnemonic(seed); const client = await SigningStargateClient.connectWithSigner(RPC, wallet, options); const amount = [{ amount: "1", denom: "uatom" }] @@ -54,13 +52,12 @@ async function queryTotalNumberOfCosmosAccounts(accountIndex){ } try { const accountNumber = await client.getSequence(sendToAddress.cosmosAddress); - // console.log(accountNumber) const latestAccountNumber = accountNumber.accountNumber || 0; try{ - Meteor.call('chain.getTotalCosmosAccounts', latestAccountNumber) + Meteor.call('chain.getCosmosAccountsNumber', latestAccountNumber) } catch(e){ - console.log("Error updating Total Number Of Cosmos Accounts " + e) + console.log("chain.getCosmosAccountsNumber error " + e) } return latestAccountNumber } @@ -69,23 +66,143 @@ async function queryTotalNumberOfCosmosAccounts(accountIndex){ } } -export async function getTotalCosmosAccounts() { - let accountIndex; - const wallet = await DirectSecp256k1HdWallet.fromMnemonic(seed); - const client = await SigningStargateClient.connectWithSigner(RPC, wallet, options); - for(let c = 1; c < 100; c++){ - let accIndex = this.getToAddress(c); - try{ - // eslint-disable-next-line no-await-in-loop - await client.getSequence(accIndex.cosmosAddress) +export function getCosmosAccountsNumber() { + Meteor.call('chain.shouldUpdateCosmosAccountsNumber', async (error, result) => { + if (error) { + console.log("chain.shouldUpdateCosmosAccountsNumber error ", error); } - catch(e){ - accountIndex = c - break; + else { + let accountIndex; + const wallet = await DirectSecp256k1HdWallet.fromMnemonic(seed); + const client = await SigningStargateClient.connectWithSigner(RPC, wallet, options); + for (let c = 1; c < 100; c++) { + let accIndex = this.getToAddress(c); + try { + // eslint-disable-next-line no-await-in-loop + await client.getSequence(accIndex.cosmosAddress) + } + catch (e) { + accountIndex = c + break; + } + + } + return fetchCosmosAccountsNumber(accountIndex) } - - } - // console.log(accountIndex) + }) +} + +Meteor.methods({ + 'cosmosAccounts.getToAddress': function (accountIndex) { + this.unblock(); + let hdpath = `m/44'/${COINTYPE}'/${accountIndex}'/0/0` + const { cosmosAddress, privateKey, publicKey } = getNewWalletFromSeed(seed, bech32prefix, hdpath) + return { cosmosAddress, privateKey, publicKey } + }, + 'cosmosAccounts.getFromAddress': function () { + this.unblock(); + let hdpath = `m/44'/${COINTYPE}'/0'/0/0` + const { cosmosAddress, privateKey, publicKey } = getNewWalletFromSeed(seed, bech32prefix, hdpath) + return { cosmosAddress, privateKey, publicKey } + }, + 'cosmosAccounts.fetchCosmosAccountsNumber': async function (accountIndex) { + this.unblock(); + let sendFromAddress, sendToAddress; + Meteor.call('cosmosAccounts.getFromAddress', (error, result) => { + if (error) { + console.log("cosmosAccounts.getFromAddress error ", error); + } + else if(result){ + sendFromAddress = result; + } + }) + Meteor.call('cosmosAccounts.getToAddress', accountIndex, (error, result) => { + if (error) { + console.log("cosmosAccounts.getToAddress error ", error); + } + else if (result) { + sendToAddress = result; + } + }) + + const wallet = await DirectSecp256k1HdWallet.fromMnemonic(seed); + const client = await SigningStargateClient.connectWithSigner(RPC, wallet, options); + const amount = [{ amount: "1", denom: "uatom" }] + const fee = { + amount: [{ amount: "100", denom: "uatom" }], + gas: "100000", + } + const sendMsg = { + typeUrl: "/cosmos.bank.v1beta1.MsgSend", + value: { + fromAddress: sendFromAddress.cosmosAddress, + toAddress: sendToAddress.cosmosAddress, + amount: [...amount], + }, + }; + + try { + let signMessage = await client.signAndBroadcast(sendFromAddress.cosmosAddress, [sendMsg], fee, DEFAULT_MEMO); + assertIsBroadcastTxSuccess(signMessage); + } + catch (e) { + console.log(e) + } + try { + const accountNumber = await client.getSequence(sendToAddress.cosmosAddress); + const latestAccountNumber = accountNumber.accountNumber || 0; + try { + Meteor.call('chain.getCosmosAccountsNumber', latestAccountNumber) + } + catch (e) { + console.log("chain.getCosmosAccountsNumber error " + e) + } + return latestAccountNumber + } + catch (e) { + console.log(e) + } + }, + + 'cosmosAccounts.getTotal': function () { + this.unblock(); + Meteor.call('chain.shouldUpdateCosmosAccountsNumber', async (error, result) => { + if (error) { + console.log("chain.shouldUpdateCosmosAccountsNumber error ", error); + } + else { + let accountIndex; + const wallet = await DirectSecp256k1HdWallet.fromMnemonic(seed); + const client = await SigningStargateClient.connectWithSigner(RPC, wallet, options); + for (let c = 1; c < 100; c++) { + let accIndex; + // eslint-disable-next-line no-loop-func + Meteor.call('cosmosAccounts.getToAddress', c, async (error, result) => { + if (error) { + console.log("cosmosAccounts.getToAddress error ", error); + } + else if (result) { + accIndex = result; + try { + // eslint-disable-next-line no-await-in-loop + await client.getSequence(accIndex.cosmosAddress) + } + catch (e) { + accountIndex = c + // break; + } + } + }) + } + try { + Meteor.call('cosmosAccounts.fetchCosmosAccountsNumber', latestAccountNumber) + } + catch (e) { + console.log("cosmosAccounts.fetchCosmosAccountsNumber error ", error); + + } + } + }) + }, - return queryTotalNumberOfCosmosAccounts(accountIndex) -} \ No newline at end of file +}) \ No newline at end of file From 009f950fefde0e1c4d1aa163e00aadee5c521c0e Mon Sep 17 00:00:00 2001 From: Magic Cat Date: Fri, 16 Jul 2021 15:15:06 +0800 Subject: [PATCH 12/17] Rename file to CosmosAccounts.js --- client/main.js | 2 +- imports/ui/home/{TotalCosmosAcounts.js => CosmosAccounts.js} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename imports/ui/home/{TotalCosmosAcounts.js => CosmosAccounts.js} (100%) diff --git a/client/main.js b/client/main.js index 84946df2f..4e522555d 100644 --- a/client/main.js +++ b/client/main.js @@ -7,7 +7,7 @@ import App from '/imports/ui/App.jsx'; import React from 'react'; import { BrowserRouter as Router } from 'react-router-dom' // import ReactDOM from 'react-dom'; -import { getCosmosAccountsNumber } from '../imports/ui/home/TotalCosmosAcounts' +import { getCosmosAccountsNumber } from '../imports/ui/home/CosmosAccounts' import { Meteor } from 'meteor/meteor'; import { render } from 'react-dom'; diff --git a/imports/ui/home/TotalCosmosAcounts.js b/imports/ui/home/CosmosAccounts.js similarity index 100% rename from imports/ui/home/TotalCosmosAcounts.js rename to imports/ui/home/CosmosAccounts.js From 8bf1e7a11124dd68157e937357194fb6d2c268df Mon Sep 17 00:00:00 2001 From: Magic Cat Date: Fri, 16 Jul 2021 15:20:55 +0800 Subject: [PATCH 13/17] Remove proto --- both/utils/proto/google/protobuf/any.proto | 158 - both/utils/proto/google/protobuf/any_pb.js | 223 - both/utils/proto/messages/.npmignore | 1 - .../proto/messages/.openapi-generator-ignore | 23 - .../proto/messages/.openapi-generator/FILES | 8 - .../proto/messages/.openapi-generator/VERSION | 1 - both/utils/proto/messages/proto.js | 142272 --------------- 7 files changed, 142686 deletions(-) delete mode 100644 both/utils/proto/google/protobuf/any.proto delete mode 100644 both/utils/proto/google/protobuf/any_pb.js delete mode 100644 both/utils/proto/messages/.npmignore delete mode 100644 both/utils/proto/messages/.openapi-generator-ignore delete mode 100644 both/utils/proto/messages/.openapi-generator/FILES delete mode 100644 both/utils/proto/messages/.openapi-generator/VERSION delete mode 100644 both/utils/proto/messages/proto.js diff --git a/both/utils/proto/google/protobuf/any.proto b/both/utils/proto/google/protobuf/any.proto deleted file mode 100644 index 1c6a465c7..000000000 --- a/both/utils/proto/google/protobuf/any.proto +++ /dev/null @@ -1,158 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// 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. - -syntax = "proto3"; - -package google.protobuf; - -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option go_package = "google.golang.org/protobuf/types/known/anypb"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "AnyProto"; -option java_multiple_files = true; -option objc_class_prefix = "GPB"; - -// `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 := anypb.New(foo) -// if err != nil { -// ... -// } -// ... -// foo := &pb.Foo{} -// if err := any.UnmarshalTo(foo); err != nil { -// ... -// } -// -// The pack methods provided by protobuf library will by default use -// 'type.googleapis.com/full.type.name' as the type URL and the unpack -// methods only use the fully qualified type name after the last '/' -// in the type URL, for example "foo.bar.com/x/y.z" will yield type -// name "y.z". -// -// -// JSON -// ==== -// The JSON representation of an `Any` value uses the regular -// representation of the deserialized, embedded message, with an -// additional field `@type` which contains the type URL. Example: -// -// package google.profile; -// message Person { -// string first_name = 1; -// string last_name = 2; -// } -// -// { -// "@type": "type.googleapis.com/google.profile.Person", -// "firstName": , -// "lastName": -// } -// -// If the embedded message type is well-known and has a custom JSON -// representation, that representation will be embedded adding a field -// `value` which holds the custom JSON in addition to the `@type` -// field. Example (for message [google.protobuf.Duration][]): -// -// { -// "@type": "type.googleapis.com/google.protobuf.Duration", -// "value": "1.212s" -// } -// -message Any { - // A URL/resource name that uniquely identifies the type of the serialized - // protocol buffer message. This string must contain at least - // one "/" character. The last segment of the URL's path must represent - // the fully qualified name of the type (as in - // `path/google.protobuf.Duration`). The name should be in a canonical form - // (e.g., leading "." is not accepted). - // - // In practice, teams usually precompile into the binary all types that they - // expect it to use in the context of Any. However, for URLs which use the - // scheme `http`, `https`, or no scheme, one can optionally set up a type - // server that maps type URLs to message definitions as follows: - // - // * If no scheme is provided, `https` is assumed. - // * An HTTP GET on the URL must yield a [google.protobuf.Type][] - // value in binary format, or produce an error. - // * Applications are allowed to cache lookup results based on the - // URL, or have them precompiled into a binary to avoid any - // lookup. Therefore, binary compatibility needs to be preserved - // on changes to types. (Use versioned type names to manage - // breaking changes.) - // - // Note: this functionality is not currently available in the official - // protobuf release, and it is not used for type URLs beginning with - // type.googleapis.com. - // - // Schemes other than `http`, `https` (or the empty scheme) might be - // used with implementation specific semantics. - // - string type_url = 1; - - // Must be a valid serialized protocol buffer of the above specified type. - bytes value = 2; -} \ No newline at end of file diff --git a/both/utils/proto/google/protobuf/any_pb.js b/both/utils/proto/google/protobuf/any_pb.js deleted file mode 100644 index e20bf1e6a..000000000 --- a/both/utils/proto/google/protobuf/any_pb.js +++ /dev/null @@ -1,223 +0,0 @@ -// source: any.proto -/** - * @fileoverview - * @enhanceable - * @suppress {messageConventions} JS Compiler reports an error if a variable or - * field starts with 'MSG_' and isn't a translatable message. - * @public - */ -// GENERATED CODE -- DO NOT EDIT! -/* eslint-disable */ -// @ts-nocheck - -var jspb = require('google-protobuf'); -var goog = jspb; -var global = Function('return this')(); - -goog.exportSymbol('proto.google.protobuf.Any', null, global); -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.google.protobuf.Any = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.google.protobuf.Any, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.google.protobuf.Any.displayName = 'proto.google.protobuf.Any'; -} - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.google.protobuf.Any.prototype.toObject = function(opt_includeInstance) { - return proto.google.protobuf.Any.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.google.protobuf.Any} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.google.protobuf.Any.toObject = function(includeInstance, msg) { - var f, obj = { - typeUrl: jspb.Message.getFieldWithDefault(msg, 1, ""), - value: msg.getValue_asB64() - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.google.protobuf.Any} - */ -proto.google.protobuf.Any.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.google.protobuf.Any; - return proto.google.protobuf.Any.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.google.protobuf.Any} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.google.protobuf.Any} - */ -proto.google.protobuf.Any.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setTypeUrl(value); - break; - case 2: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setValue(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.google.protobuf.Any.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.google.protobuf.Any.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.google.protobuf.Any} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.google.protobuf.Any.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getTypeUrl(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } - f = message.getValue_asU8(); - if (f.length > 0) { - writer.writeBytes( - 2, - f - ); - } -}; - - -/** - * optional string type_url = 1; - * @return {string} - */ -proto.google.protobuf.Any.prototype.getTypeUrl = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.google.protobuf.Any} returns this - */ -proto.google.protobuf.Any.prototype.setTypeUrl = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional bytes value = 2; - * @return {!(string|Uint8Array)} - */ -proto.google.protobuf.Any.prototype.getValue = function() { - return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * optional bytes value = 2; - * This is a type-conversion wrapper around `getValue()` - * @return {string} - */ -proto.google.protobuf.Any.prototype.getValue_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getValue())); -}; - - -/** - * optional bytes value = 2; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getValue()` - * @return {!Uint8Array} - */ -proto.google.protobuf.Any.prototype.getValue_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getValue())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.google.protobuf.Any} returns this - */ -proto.google.protobuf.Any.prototype.setValue = function(value) { - return jspb.Message.setProto3BytesField(this, 2, value); -}; - - -goog.object.extend(exports, proto.google.protobuf); diff --git a/both/utils/proto/messages/.npmignore b/both/utils/proto/messages/.npmignore deleted file mode 100644 index 999d88df6..000000000 --- a/both/utils/proto/messages/.npmignore +++ /dev/null @@ -1 +0,0 @@ -# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm \ No newline at end of file diff --git a/both/utils/proto/messages/.openapi-generator-ignore b/both/utils/proto/messages/.openapi-generator-ignore deleted file mode 100644 index 7484ee590..000000000 --- a/both/utils/proto/messages/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/both/utils/proto/messages/.openapi-generator/FILES b/both/utils/proto/messages/.openapi-generator/FILES deleted file mode 100644 index 467f05421..000000000 --- a/both/utils/proto/messages/.openapi-generator/FILES +++ /dev/null @@ -1,8 +0,0 @@ -.gitignore -.npmignore -.openapi-generator-ignore -api.ts -base.ts -configuration.ts -git_push.sh -index.ts diff --git a/both/utils/proto/messages/.openapi-generator/VERSION b/both/utils/proto/messages/.openapi-generator/VERSION deleted file mode 100644 index 3fa3b389a..000000000 --- a/both/utils/proto/messages/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -5.0.1-SNAPSHOT \ No newline at end of file diff --git a/both/utils/proto/messages/proto.js b/both/utils/proto/messages/proto.js deleted file mode 100644 index bfc2b19de..000000000 --- a/both/utils/proto/messages/proto.js +++ /dev/null @@ -1,142272 +0,0 @@ -/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/ -// import * as $protobuf from "protobufjs/minimal"; -import $protobuf from "protobufjs/minimal"; - -// Common aliases -const $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; - -// Exported root namespace -const $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); - -export const ics23 = $root.ics23 = (() => { - - /** - * Namespace ics23. - * @exports ics23 - * @namespace - */ - const ics23 = {}; - - /** - * HashOp enum. - * @name ics23.HashOp - * @enum {number} - * @property {number} NO_HASH=0 NO_HASH value - * @property {number} SHA256=1 SHA256 value - * @property {number} SHA512=2 SHA512 value - * @property {number} KECCAK=3 KECCAK value - * @property {number} RIPEMD160=4 RIPEMD160 value - * @property {number} BITCOIN=5 BITCOIN value - */ - ics23.HashOp = (function() { - const valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "NO_HASH"] = 0; - values[valuesById[1] = "SHA256"] = 1; - values[valuesById[2] = "SHA512"] = 2; - values[valuesById[3] = "KECCAK"] = 3; - values[valuesById[4] = "RIPEMD160"] = 4; - values[valuesById[5] = "BITCOIN"] = 5; - return values; - })(); - - /** - * 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) - * @name ics23.LengthOp - * @enum {number} - * @property {number} NO_PREFIX=0 NO_PREFIX value - * @property {number} VAR_PROTO=1 VAR_PROTO value - * @property {number} VAR_RLP=2 VAR_RLP value - * @property {number} FIXED32_BIG=3 FIXED32_BIG value - * @property {number} FIXED32_LITTLE=4 FIXED32_LITTLE value - * @property {number} FIXED64_BIG=5 FIXED64_BIG value - * @property {number} FIXED64_LITTLE=6 FIXED64_LITTLE value - * @property {number} REQUIRE_32_BYTES=7 REQUIRE_32_BYTES value - * @property {number} REQUIRE_64_BYTES=8 REQUIRE_64_BYTES value - */ - ics23.LengthOp = (function() { - const valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "NO_PREFIX"] = 0; - values[valuesById[1] = "VAR_PROTO"] = 1; - values[valuesById[2] = "VAR_RLP"] = 2; - values[valuesById[3] = "FIXED32_BIG"] = 3; - values[valuesById[4] = "FIXED32_LITTLE"] = 4; - values[valuesById[5] = "FIXED64_BIG"] = 5; - values[valuesById[6] = "FIXED64_LITTLE"] = 6; - values[valuesById[7] = "REQUIRE_32_BYTES"] = 7; - values[valuesById[8] = "REQUIRE_64_BYTES"] = 8; - return values; - })(); - - ics23.ExistenceProof = (function() { - - /** - * Properties of an ExistenceProof. - * @memberof ics23 - * @interface IExistenceProof - * @property {Uint8Array|null} [key] ExistenceProof key - * @property {Uint8Array|null} [value] ExistenceProof value - * @property {ics23.ILeafOp|null} [leaf] ExistenceProof leaf - * @property {Array.|null} [path] ExistenceProof path - */ - - /** - * Constructs a new ExistenceProof. - * @memberof ics23 - * @classdesc 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. - * @implements IExistenceProof - * @constructor - * @param {ics23.IExistenceProof=} [properties] Properties to set - */ - function ExistenceProof(properties) { - this.path = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ExistenceProof key. - * @member {Uint8Array} key - * @memberof ics23.ExistenceProof - * @instance - */ - ExistenceProof.prototype.key = $util.newBuffer([]); - - /** - * ExistenceProof value. - * @member {Uint8Array} value - * @memberof ics23.ExistenceProof - * @instance - */ - ExistenceProof.prototype.value = $util.newBuffer([]); - - /** - * ExistenceProof leaf. - * @member {ics23.ILeafOp|null|undefined} leaf - * @memberof ics23.ExistenceProof - * @instance - */ - ExistenceProof.prototype.leaf = null; - - /** - * ExistenceProof path. - * @member {Array.} path - * @memberof ics23.ExistenceProof - * @instance - */ - ExistenceProof.prototype.path = $util.emptyArray; - - /** - * Encodes the specified ExistenceProof message. Does not implicitly {@link ics23.ExistenceProof.verify|verify} messages. - * @function encode - * @memberof ics23.ExistenceProof - * @static - * @param {ics23.IExistenceProof} message ExistenceProof message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExistenceProof.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value); - if (message.leaf != null && Object.hasOwnProperty.call(message, "leaf")) - $root.ics23.LeafOp.encode(message.leaf, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.path != null && message.path.length) - for (let i = 0; i < message.path.length; ++i) - $root.ics23.InnerOp.encode(message.path[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ExistenceProof message, length delimited. Does not implicitly {@link ics23.ExistenceProof.verify|verify} messages. - * @function encodeDelimited - * @memberof ics23.ExistenceProof - * @static - * @param {ics23.IExistenceProof} message ExistenceProof message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExistenceProof.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ExistenceProof message from the specified reader or buffer. - * @function decode - * @memberof ics23.ExistenceProof - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ics23.ExistenceProof} ExistenceProof - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExistenceProof.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.ExistenceProof(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.bytes(); - break; - case 2: - message.value = reader.bytes(); - break; - case 3: - message.leaf = $root.ics23.LeafOp.decode(reader, reader.uint32()); - break; - case 4: - if (!(message.path && message.path.length)) - message.path = []; - message.path.push($root.ics23.InnerOp.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ExistenceProof message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ics23.ExistenceProof - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ics23.ExistenceProof} ExistenceProof - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExistenceProof.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ExistenceProof message. - * @function verify - * @memberof ics23.ExistenceProof - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ExistenceProof.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) - return "key: buffer expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) - return "value: buffer expected"; - if (message.leaf != null && message.hasOwnProperty("leaf")) { - let error = $root.ics23.LeafOp.verify(message.leaf); - if (error) - return "leaf." + error; - } - if (message.path != null && message.hasOwnProperty("path")) { - if (!Array.isArray(message.path)) - return "path: array expected"; - for (let i = 0; i < message.path.length; ++i) { - let error = $root.ics23.InnerOp.verify(message.path[i]); - if (error) - return "path." + error; - } - } - return null; - }; - - /** - * Creates an ExistenceProof message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ics23.ExistenceProof - * @static - * @param {Object.} object Plain object - * @returns {ics23.ExistenceProof} ExistenceProof - */ - ExistenceProof.fromObject = function fromObject(object) { - if (object instanceof $root.ics23.ExistenceProof) - return object; - let message = new $root.ics23.ExistenceProof(); - if (object.key != null) - if (typeof object.key === "string") - $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); - else if (object.key.length) - message.key = object.key; - if (object.value != null) - if (typeof object.value === "string") - $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); - else if (object.value.length) - message.value = object.value; - if (object.leaf != null) { - if (typeof object.leaf !== "object") - throw TypeError(".ics23.ExistenceProof.leaf: object expected"); - message.leaf = $root.ics23.LeafOp.fromObject(object.leaf); - } - if (object.path) { - if (!Array.isArray(object.path)) - throw TypeError(".ics23.ExistenceProof.path: array expected"); - message.path = []; - for (let i = 0; i < object.path.length; ++i) { - if (typeof object.path[i] !== "object") - throw TypeError(".ics23.ExistenceProof.path: object expected"); - message.path[i] = $root.ics23.InnerOp.fromObject(object.path[i]); - } - } - return message; - }; - - /** - * Creates a plain object from an ExistenceProof message. Also converts values to other types if specified. - * @function toObject - * @memberof ics23.ExistenceProof - * @static - * @param {ics23.ExistenceProof} message ExistenceProof - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ExistenceProof.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.path = []; - if (options.defaults) { - if (options.bytes === String) - object.key = ""; - else { - object.key = []; - if (options.bytes !== Array) - object.key = $util.newBuffer(object.key); - } - if (options.bytes === String) - object.value = ""; - else { - object.value = []; - if (options.bytes !== Array) - object.value = $util.newBuffer(object.value); - } - object.leaf = null; - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; - if (message.value != null && message.hasOwnProperty("value")) - object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; - if (message.leaf != null && message.hasOwnProperty("leaf")) - object.leaf = $root.ics23.LeafOp.toObject(message.leaf, options); - if (message.path && message.path.length) { - object.path = []; - for (let j = 0; j < message.path.length; ++j) - object.path[j] = $root.ics23.InnerOp.toObject(message.path[j], options); - } - return object; - }; - - /** - * Converts this ExistenceProof to JSON. - * @function toJSON - * @memberof ics23.ExistenceProof - * @instance - * @returns {Object.} JSON object - */ - ExistenceProof.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ExistenceProof; - })(); - - ics23.NonExistenceProof = (function() { - - /** - * Properties of a NonExistenceProof. - * @memberof ics23 - * @interface INonExistenceProof - * @property {Uint8Array|null} [key] NonExistenceProof key - * @property {ics23.IExistenceProof|null} [left] NonExistenceProof left - * @property {ics23.IExistenceProof|null} [right] NonExistenceProof right - */ - - /** - * Constructs a new NonExistenceProof. - * @memberof ics23 - * @classdesc Represents a NonExistenceProof. - * @implements INonExistenceProof - * @constructor - * @param {ics23.INonExistenceProof=} [properties] Properties to set - */ - function NonExistenceProof(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * NonExistenceProof key. - * @member {Uint8Array} key - * @memberof ics23.NonExistenceProof - * @instance - */ - NonExistenceProof.prototype.key = $util.newBuffer([]); - - /** - * NonExistenceProof left. - * @member {ics23.IExistenceProof|null|undefined} left - * @memberof ics23.NonExistenceProof - * @instance - */ - NonExistenceProof.prototype.left = null; - - /** - * NonExistenceProof right. - * @member {ics23.IExistenceProof|null|undefined} right - * @memberof ics23.NonExistenceProof - * @instance - */ - NonExistenceProof.prototype.right = null; - - /** - * Encodes the specified NonExistenceProof message. Does not implicitly {@link ics23.NonExistenceProof.verify|verify} messages. - * @function encode - * @memberof ics23.NonExistenceProof - * @static - * @param {ics23.INonExistenceProof} message NonExistenceProof message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - NonExistenceProof.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); - if (message.left != null && Object.hasOwnProperty.call(message, "left")) - $root.ics23.ExistenceProof.encode(message.left, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.right != null && Object.hasOwnProperty.call(message, "right")) - $root.ics23.ExistenceProof.encode(message.right, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified NonExistenceProof message, length delimited. Does not implicitly {@link ics23.NonExistenceProof.verify|verify} messages. - * @function encodeDelimited - * @memberof ics23.NonExistenceProof - * @static - * @param {ics23.INonExistenceProof} message NonExistenceProof message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - NonExistenceProof.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a NonExistenceProof message from the specified reader or buffer. - * @function decode - * @memberof ics23.NonExistenceProof - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ics23.NonExistenceProof} NonExistenceProof - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - NonExistenceProof.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.NonExistenceProof(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.bytes(); - break; - case 2: - message.left = $root.ics23.ExistenceProof.decode(reader, reader.uint32()); - break; - case 3: - message.right = $root.ics23.ExistenceProof.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a NonExistenceProof message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ics23.NonExistenceProof - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ics23.NonExistenceProof} NonExistenceProof - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - NonExistenceProof.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a NonExistenceProof message. - * @function verify - * @memberof ics23.NonExistenceProof - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - NonExistenceProof.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) - return "key: buffer expected"; - if (message.left != null && message.hasOwnProperty("left")) { - let error = $root.ics23.ExistenceProof.verify(message.left); - if (error) - return "left." + error; - } - if (message.right != null && message.hasOwnProperty("right")) { - let error = $root.ics23.ExistenceProof.verify(message.right); - if (error) - return "right." + error; - } - return null; - }; - - /** - * Creates a NonExistenceProof message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ics23.NonExistenceProof - * @static - * @param {Object.} object Plain object - * @returns {ics23.NonExistenceProof} NonExistenceProof - */ - NonExistenceProof.fromObject = function fromObject(object) { - if (object instanceof $root.ics23.NonExistenceProof) - return object; - let message = new $root.ics23.NonExistenceProof(); - if (object.key != null) - if (typeof object.key === "string") - $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); - else if (object.key.length) - message.key = object.key; - if (object.left != null) { - if (typeof object.left !== "object") - throw TypeError(".ics23.NonExistenceProof.left: object expected"); - message.left = $root.ics23.ExistenceProof.fromObject(object.left); - } - if (object.right != null) { - if (typeof object.right !== "object") - throw TypeError(".ics23.NonExistenceProof.right: object expected"); - message.right = $root.ics23.ExistenceProof.fromObject(object.right); - } - return message; - }; - - /** - * Creates a plain object from a NonExistenceProof message. Also converts values to other types if specified. - * @function toObject - * @memberof ics23.NonExistenceProof - * @static - * @param {ics23.NonExistenceProof} message NonExistenceProof - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - NonExistenceProof.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if (options.bytes === String) - object.key = ""; - else { - object.key = []; - if (options.bytes !== Array) - object.key = $util.newBuffer(object.key); - } - object.left = null; - object.right = null; - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; - if (message.left != null && message.hasOwnProperty("left")) - object.left = $root.ics23.ExistenceProof.toObject(message.left, options); - if (message.right != null && message.hasOwnProperty("right")) - object.right = $root.ics23.ExistenceProof.toObject(message.right, options); - return object; - }; - - /** - * Converts this NonExistenceProof to JSON. - * @function toJSON - * @memberof ics23.NonExistenceProof - * @instance - * @returns {Object.} JSON object - */ - NonExistenceProof.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return NonExistenceProof; - })(); - - ics23.CommitmentProof = (function() { - - /** - * Properties of a CommitmentProof. - * @memberof ics23 - * @interface ICommitmentProof - * @property {ics23.IExistenceProof|null} [exist] CommitmentProof exist - * @property {ics23.INonExistenceProof|null} [nonexist] CommitmentProof nonexist - * @property {ics23.IBatchProof|null} [batch] CommitmentProof batch - * @property {ics23.ICompressedBatchProof|null} [compressed] CommitmentProof compressed - */ - - /** - * Constructs a new CommitmentProof. - * @memberof ics23 - * @classdesc Represents a CommitmentProof. - * @implements ICommitmentProof - * @constructor - * @param {ics23.ICommitmentProof=} [properties] Properties to set - */ - function CommitmentProof(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * CommitmentProof exist. - * @member {ics23.IExistenceProof|null|undefined} exist - * @memberof ics23.CommitmentProof - * @instance - */ - CommitmentProof.prototype.exist = null; - - /** - * CommitmentProof nonexist. - * @member {ics23.INonExistenceProof|null|undefined} nonexist - * @memberof ics23.CommitmentProof - * @instance - */ - CommitmentProof.prototype.nonexist = null; - - /** - * CommitmentProof batch. - * @member {ics23.IBatchProof|null|undefined} batch - * @memberof ics23.CommitmentProof - * @instance - */ - CommitmentProof.prototype.batch = null; - - /** - * CommitmentProof compressed. - * @member {ics23.ICompressedBatchProof|null|undefined} compressed - * @memberof ics23.CommitmentProof - * @instance - */ - CommitmentProof.prototype.compressed = null; - - // OneOf field names bound to virtual getters and setters - let $oneOfFields; - - /** - * CommitmentProof proof. - * @member {"exist"|"nonexist"|"batch"|"compressed"|undefined} proof - * @memberof ics23.CommitmentProof - * @instance - */ - Object.defineProperty(CommitmentProof.prototype, "proof", { - get: $util.oneOfGetter($oneOfFields = ["exist", "nonexist", "batch", "compressed"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Encodes the specified CommitmentProof message. Does not implicitly {@link ics23.CommitmentProof.verify|verify} messages. - * @function encode - * @memberof ics23.CommitmentProof - * @static - * @param {ics23.ICommitmentProof} message CommitmentProof message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CommitmentProof.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.exist != null && Object.hasOwnProperty.call(message, "exist")) - $root.ics23.ExistenceProof.encode(message.exist, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nonexist != null && Object.hasOwnProperty.call(message, "nonexist")) - $root.ics23.NonExistenceProof.encode(message.nonexist, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.batch != null && Object.hasOwnProperty.call(message, "batch")) - $root.ics23.BatchProof.encode(message.batch, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.compressed != null && Object.hasOwnProperty.call(message, "compressed")) - $root.ics23.CompressedBatchProof.encode(message.compressed, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified CommitmentProof message, length delimited. Does not implicitly {@link ics23.CommitmentProof.verify|verify} messages. - * @function encodeDelimited - * @memberof ics23.CommitmentProof - * @static - * @param {ics23.ICommitmentProof} message CommitmentProof message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CommitmentProof.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CommitmentProof message from the specified reader or buffer. - * @function decode - * @memberof ics23.CommitmentProof - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ics23.CommitmentProof} CommitmentProof - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CommitmentProof.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.CommitmentProof(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.exist = $root.ics23.ExistenceProof.decode(reader, reader.uint32()); - break; - case 2: - message.nonexist = $root.ics23.NonExistenceProof.decode(reader, reader.uint32()); - break; - case 3: - message.batch = $root.ics23.BatchProof.decode(reader, reader.uint32()); - break; - case 4: - message.compressed = $root.ics23.CompressedBatchProof.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CommitmentProof message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ics23.CommitmentProof - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ics23.CommitmentProof} CommitmentProof - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CommitmentProof.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CommitmentProof message. - * @function verify - * @memberof ics23.CommitmentProof - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CommitmentProof.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - let properties = {}; - if (message.exist != null && message.hasOwnProperty("exist")) { - properties.proof = 1; - { - let error = $root.ics23.ExistenceProof.verify(message.exist); - if (error) - return "exist." + error; - } - } - if (message.nonexist != null && message.hasOwnProperty("nonexist")) { - if (properties.proof === 1) - return "proof: multiple values"; - properties.proof = 1; - { - let error = $root.ics23.NonExistenceProof.verify(message.nonexist); - if (error) - return "nonexist." + error; - } - } - if (message.batch != null && message.hasOwnProperty("batch")) { - if (properties.proof === 1) - return "proof: multiple values"; - properties.proof = 1; - { - let error = $root.ics23.BatchProof.verify(message.batch); - if (error) - return "batch." + error; - } - } - if (message.compressed != null && message.hasOwnProperty("compressed")) { - if (properties.proof === 1) - return "proof: multiple values"; - properties.proof = 1; - { - let error = $root.ics23.CompressedBatchProof.verify(message.compressed); - if (error) - return "compressed." + error; - } - } - return null; - }; - - /** - * Creates a CommitmentProof message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ics23.CommitmentProof - * @static - * @param {Object.} object Plain object - * @returns {ics23.CommitmentProof} CommitmentProof - */ - CommitmentProof.fromObject = function fromObject(object) { - if (object instanceof $root.ics23.CommitmentProof) - return object; - let message = new $root.ics23.CommitmentProof(); - if (object.exist != null) { - if (typeof object.exist !== "object") - throw TypeError(".ics23.CommitmentProof.exist: object expected"); - message.exist = $root.ics23.ExistenceProof.fromObject(object.exist); - } - if (object.nonexist != null) { - if (typeof object.nonexist !== "object") - throw TypeError(".ics23.CommitmentProof.nonexist: object expected"); - message.nonexist = $root.ics23.NonExistenceProof.fromObject(object.nonexist); - } - if (object.batch != null) { - if (typeof object.batch !== "object") - throw TypeError(".ics23.CommitmentProof.batch: object expected"); - message.batch = $root.ics23.BatchProof.fromObject(object.batch); - } - if (object.compressed != null) { - if (typeof object.compressed !== "object") - throw TypeError(".ics23.CommitmentProof.compressed: object expected"); - message.compressed = $root.ics23.CompressedBatchProof.fromObject(object.compressed); - } - return message; - }; - - /** - * Creates a plain object from a CommitmentProof message. Also converts values to other types if specified. - * @function toObject - * @memberof ics23.CommitmentProof - * @static - * @param {ics23.CommitmentProof} message CommitmentProof - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CommitmentProof.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (message.exist != null && message.hasOwnProperty("exist")) { - object.exist = $root.ics23.ExistenceProof.toObject(message.exist, options); - if (options.oneofs) - object.proof = "exist"; - } - if (message.nonexist != null && message.hasOwnProperty("nonexist")) { - object.nonexist = $root.ics23.NonExistenceProof.toObject(message.nonexist, options); - if (options.oneofs) - object.proof = "nonexist"; - } - if (message.batch != null && message.hasOwnProperty("batch")) { - object.batch = $root.ics23.BatchProof.toObject(message.batch, options); - if (options.oneofs) - object.proof = "batch"; - } - if (message.compressed != null && message.hasOwnProperty("compressed")) { - object.compressed = $root.ics23.CompressedBatchProof.toObject(message.compressed, options); - if (options.oneofs) - object.proof = "compressed"; - } - return object; - }; - - /** - * Converts this CommitmentProof to JSON. - * @function toJSON - * @memberof ics23.CommitmentProof - * @instance - * @returns {Object.} JSON object - */ - CommitmentProof.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return CommitmentProof; - })(); - - ics23.LeafOp = (function() { - - /** - * Properties of a LeafOp. - * @memberof ics23 - * @interface ILeafOp - * @property {ics23.HashOp|null} [hash] LeafOp hash - * @property {ics23.HashOp|null} [prehash_key] LeafOp prehash_key - * @property {ics23.HashOp|null} [prehash_value] LeafOp prehash_value - * @property {ics23.LengthOp|null} [length] LeafOp length - * @property {Uint8Array|null} [prefix] LeafOp prefix - */ - - /** - * Constructs a new LeafOp. - * @memberof ics23 - * @classdesc 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) - * @implements ILeafOp - * @constructor - * @param {ics23.ILeafOp=} [properties] Properties to set - */ - function LeafOp(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * LeafOp hash. - * @member {ics23.HashOp} hash - * @memberof ics23.LeafOp - * @instance - */ - LeafOp.prototype.hash = 0; - - /** - * LeafOp prehash_key. - * @member {ics23.HashOp} prehash_key - * @memberof ics23.LeafOp - * @instance - */ - LeafOp.prototype.prehash_key = 0; - - /** - * LeafOp prehash_value. - * @member {ics23.HashOp} prehash_value - * @memberof ics23.LeafOp - * @instance - */ - LeafOp.prototype.prehash_value = 0; - - /** - * LeafOp length. - * @member {ics23.LengthOp} length - * @memberof ics23.LeafOp - * @instance - */ - LeafOp.prototype.length = 0; - - /** - * LeafOp prefix. - * @member {Uint8Array} prefix - * @memberof ics23.LeafOp - * @instance - */ - LeafOp.prototype.prefix = $util.newBuffer([]); - - /** - * Encodes the specified LeafOp message. Does not implicitly {@link ics23.LeafOp.verify|verify} messages. - * @function encode - * @memberof ics23.LeafOp - * @static - * @param {ics23.ILeafOp} message LeafOp message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LeafOp.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.hash != null && Object.hasOwnProperty.call(message, "hash")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.hash); - if (message.prehash_key != null && Object.hasOwnProperty.call(message, "prehash_key")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.prehash_key); - if (message.prehash_value != null && Object.hasOwnProperty.call(message, "prehash_value")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.prehash_value); - if (message.length != null && Object.hasOwnProperty.call(message, "length")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.length); - if (message.prefix != null && Object.hasOwnProperty.call(message, "prefix")) - writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.prefix); - return writer; - }; - - /** - * Encodes the specified LeafOp message, length delimited. Does not implicitly {@link ics23.LeafOp.verify|verify} messages. - * @function encodeDelimited - * @memberof ics23.LeafOp - * @static - * @param {ics23.ILeafOp} message LeafOp message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LeafOp.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a LeafOp message from the specified reader or buffer. - * @function decode - * @memberof ics23.LeafOp - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ics23.LeafOp} LeafOp - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LeafOp.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.LeafOp(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.hash = reader.int32(); - break; - case 2: - message.prehash_key = reader.int32(); - break; - case 3: - message.prehash_value = reader.int32(); - break; - case 4: - message.length = reader.int32(); - break; - case 5: - message.prefix = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a LeafOp message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ics23.LeafOp - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ics23.LeafOp} LeafOp - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LeafOp.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a LeafOp message. - * @function verify - * @memberof ics23.LeafOp - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - LeafOp.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.hash != null && message.hasOwnProperty("hash")) - switch (message.hash) { - default: - return "hash: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.prehash_key != null && message.hasOwnProperty("prehash_key")) - switch (message.prehash_key) { - default: - return "prehash_key: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.prehash_value != null && message.hasOwnProperty("prehash_value")) - switch (message.prehash_value) { - default: - return "prehash_value: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.length != null && message.hasOwnProperty("length")) - switch (message.length) { - default: - return "length: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - break; - } - if (message.prefix != null && message.hasOwnProperty("prefix")) - if (!(message.prefix && typeof message.prefix.length === "number" || $util.isString(message.prefix))) - return "prefix: buffer expected"; - return null; - }; - - /** - * Creates a LeafOp message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ics23.LeafOp - * @static - * @param {Object.} object Plain object - * @returns {ics23.LeafOp} LeafOp - */ - LeafOp.fromObject = function fromObject(object) { - if (object instanceof $root.ics23.LeafOp) - return object; - let message = new $root.ics23.LeafOp(); - switch (object.hash) { - case "NO_HASH": - case 0: - message.hash = 0; - break; - case "SHA256": - case 1: - message.hash = 1; - break; - case "SHA512": - case 2: - message.hash = 2; - break; - case "KECCAK": - case 3: - message.hash = 3; - break; - case "RIPEMD160": - case 4: - message.hash = 4; - break; - case "BITCOIN": - case 5: - message.hash = 5; - break; - } - switch (object.prehash_key) { - case "NO_HASH": - case 0: - message.prehash_key = 0; - break; - case "SHA256": - case 1: - message.prehash_key = 1; - break; - case "SHA512": - case 2: - message.prehash_key = 2; - break; - case "KECCAK": - case 3: - message.prehash_key = 3; - break; - case "RIPEMD160": - case 4: - message.prehash_key = 4; - break; - case "BITCOIN": - case 5: - message.prehash_key = 5; - break; - } - switch (object.prehash_value) { - case "NO_HASH": - case 0: - message.prehash_value = 0; - break; - case "SHA256": - case 1: - message.prehash_value = 1; - break; - case "SHA512": - case 2: - message.prehash_value = 2; - break; - case "KECCAK": - case 3: - message.prehash_value = 3; - break; - case "RIPEMD160": - case 4: - message.prehash_value = 4; - break; - case "BITCOIN": - case 5: - message.prehash_value = 5; - break; - } - switch (object.length) { - case "NO_PREFIX": - case 0: - message.length = 0; - break; - case "VAR_PROTO": - case 1: - message.length = 1; - break; - case "VAR_RLP": - case 2: - message.length = 2; - break; - case "FIXED32_BIG": - case 3: - message.length = 3; - break; - case "FIXED32_LITTLE": - case 4: - message.length = 4; - break; - case "FIXED64_BIG": - case 5: - message.length = 5; - break; - case "FIXED64_LITTLE": - case 6: - message.length = 6; - break; - case "REQUIRE_32_BYTES": - case 7: - message.length = 7; - break; - case "REQUIRE_64_BYTES": - case 8: - message.length = 8; - break; - } - if (object.prefix != null) - if (typeof object.prefix === "string") - $util.base64.decode(object.prefix, message.prefix = $util.newBuffer($util.base64.length(object.prefix)), 0); - else if (object.prefix.length) - message.prefix = object.prefix; - return message; - }; - - /** - * Creates a plain object from a LeafOp message. Also converts values to other types if specified. - * @function toObject - * @memberof ics23.LeafOp - * @static - * @param {ics23.LeafOp} message LeafOp - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - LeafOp.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.hash = options.enums === String ? "NO_HASH" : 0; - object.prehash_key = options.enums === String ? "NO_HASH" : 0; - object.prehash_value = options.enums === String ? "NO_HASH" : 0; - object.length = options.enums === String ? "NO_PREFIX" : 0; - if (options.bytes === String) - object.prefix = ""; - else { - object.prefix = []; - if (options.bytes !== Array) - object.prefix = $util.newBuffer(object.prefix); - } - } - if (message.hash != null && message.hasOwnProperty("hash")) - object.hash = options.enums === String ? $root.ics23.HashOp[message.hash] : message.hash; - if (message.prehash_key != null && message.hasOwnProperty("prehash_key")) - object.prehash_key = options.enums === String ? $root.ics23.HashOp[message.prehash_key] : message.prehash_key; - if (message.prehash_value != null && message.hasOwnProperty("prehash_value")) - object.prehash_value = options.enums === String ? $root.ics23.HashOp[message.prehash_value] : message.prehash_value; - if (message.length != null && message.hasOwnProperty("length")) - object.length = options.enums === String ? $root.ics23.LengthOp[message.length] : message.length; - if (message.prefix != null && message.hasOwnProperty("prefix")) - object.prefix = options.bytes === String ? $util.base64.encode(message.prefix, 0, message.prefix.length) : options.bytes === Array ? Array.prototype.slice.call(message.prefix) : message.prefix; - return object; - }; - - /** - * Converts this LeafOp to JSON. - * @function toJSON - * @memberof ics23.LeafOp - * @instance - * @returns {Object.} JSON object - */ - LeafOp.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return LeafOp; - })(); - - ics23.InnerOp = (function() { - - /** - * Properties of an InnerOp. - * @memberof ics23 - * @interface IInnerOp - * @property {ics23.HashOp|null} [hash] InnerOp hash - * @property {Uint8Array|null} [prefix] InnerOp prefix - * @property {Uint8Array|null} [suffix] InnerOp suffix - */ - - /** - * Constructs a new InnerOp. - * @memberof ics23 - * @classdesc 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 - * @implements IInnerOp - * @constructor - * @param {ics23.IInnerOp=} [properties] Properties to set - */ - function InnerOp(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InnerOp hash. - * @member {ics23.HashOp} hash - * @memberof ics23.InnerOp - * @instance - */ - InnerOp.prototype.hash = 0; - - /** - * InnerOp prefix. - * @member {Uint8Array} prefix - * @memberof ics23.InnerOp - * @instance - */ - InnerOp.prototype.prefix = $util.newBuffer([]); - - /** - * InnerOp suffix. - * @member {Uint8Array} suffix - * @memberof ics23.InnerOp - * @instance - */ - InnerOp.prototype.suffix = $util.newBuffer([]); - - /** - * Encodes the specified InnerOp message. Does not implicitly {@link ics23.InnerOp.verify|verify} messages. - * @function encode - * @memberof ics23.InnerOp - * @static - * @param {ics23.IInnerOp} message InnerOp message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InnerOp.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.hash != null && Object.hasOwnProperty.call(message, "hash")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.hash); - if (message.prefix != null && Object.hasOwnProperty.call(message, "prefix")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.prefix); - if (message.suffix != null && Object.hasOwnProperty.call(message, "suffix")) - writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.suffix); - return writer; - }; - - /** - * Encodes the specified InnerOp message, length delimited. Does not implicitly {@link ics23.InnerOp.verify|verify} messages. - * @function encodeDelimited - * @memberof ics23.InnerOp - * @static - * @param {ics23.IInnerOp} message InnerOp message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InnerOp.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InnerOp message from the specified reader or buffer. - * @function decode - * @memberof ics23.InnerOp - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ics23.InnerOp} InnerOp - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InnerOp.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.InnerOp(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.hash = reader.int32(); - break; - case 2: - message.prefix = reader.bytes(); - break; - case 3: - message.suffix = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InnerOp message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ics23.InnerOp - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ics23.InnerOp} InnerOp - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InnerOp.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InnerOp message. - * @function verify - * @memberof ics23.InnerOp - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InnerOp.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.hash != null && message.hasOwnProperty("hash")) - switch (message.hash) { - default: - return "hash: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.prefix != null && message.hasOwnProperty("prefix")) - if (!(message.prefix && typeof message.prefix.length === "number" || $util.isString(message.prefix))) - return "prefix: buffer expected"; - if (message.suffix != null && message.hasOwnProperty("suffix")) - if (!(message.suffix && typeof message.suffix.length === "number" || $util.isString(message.suffix))) - return "suffix: buffer expected"; - return null; - }; - - /** - * Creates an InnerOp message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ics23.InnerOp - * @static - * @param {Object.} object Plain object - * @returns {ics23.InnerOp} InnerOp - */ - InnerOp.fromObject = function fromObject(object) { - if (object instanceof $root.ics23.InnerOp) - return object; - let message = new $root.ics23.InnerOp(); - switch (object.hash) { - case "NO_HASH": - case 0: - message.hash = 0; - break; - case "SHA256": - case 1: - message.hash = 1; - break; - case "SHA512": - case 2: - message.hash = 2; - break; - case "KECCAK": - case 3: - message.hash = 3; - break; - case "RIPEMD160": - case 4: - message.hash = 4; - break; - case "BITCOIN": - case 5: - message.hash = 5; - break; - } - if (object.prefix != null) - if (typeof object.prefix === "string") - $util.base64.decode(object.prefix, message.prefix = $util.newBuffer($util.base64.length(object.prefix)), 0); - else if (object.prefix.length) - message.prefix = object.prefix; - if (object.suffix != null) - if (typeof object.suffix === "string") - $util.base64.decode(object.suffix, message.suffix = $util.newBuffer($util.base64.length(object.suffix)), 0); - else if (object.suffix.length) - message.suffix = object.suffix; - return message; - }; - - /** - * Creates a plain object from an InnerOp message. Also converts values to other types if specified. - * @function toObject - * @memberof ics23.InnerOp - * @static - * @param {ics23.InnerOp} message InnerOp - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InnerOp.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.hash = options.enums === String ? "NO_HASH" : 0; - if (options.bytes === String) - object.prefix = ""; - else { - object.prefix = []; - if (options.bytes !== Array) - object.prefix = $util.newBuffer(object.prefix); - } - if (options.bytes === String) - object.suffix = ""; - else { - object.suffix = []; - if (options.bytes !== Array) - object.suffix = $util.newBuffer(object.suffix); - } - } - if (message.hash != null && message.hasOwnProperty("hash")) - object.hash = options.enums === String ? $root.ics23.HashOp[message.hash] : message.hash; - if (message.prefix != null && message.hasOwnProperty("prefix")) - object.prefix = options.bytes === String ? $util.base64.encode(message.prefix, 0, message.prefix.length) : options.bytes === Array ? Array.prototype.slice.call(message.prefix) : message.prefix; - if (message.suffix != null && message.hasOwnProperty("suffix")) - object.suffix = options.bytes === String ? $util.base64.encode(message.suffix, 0, message.suffix.length) : options.bytes === Array ? Array.prototype.slice.call(message.suffix) : message.suffix; - return object; - }; - - /** - * Converts this InnerOp to JSON. - * @function toJSON - * @memberof ics23.InnerOp - * @instance - * @returns {Object.} JSON object - */ - InnerOp.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return InnerOp; - })(); - - ics23.ProofSpec = (function() { - - /** - * Properties of a ProofSpec. - * @memberof ics23 - * @interface IProofSpec - * @property {ics23.ILeafOp|null} [leaf_spec] ProofSpec leaf_spec - * @property {ics23.IInnerSpec|null} [inner_spec] ProofSpec inner_spec - * @property {number|null} [max_depth] ProofSpec max_depth - * @property {number|null} [min_depth] ProofSpec min_depth - */ - - /** - * Constructs a new ProofSpec. - * @memberof ics23 - * @classdesc 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. - * @implements IProofSpec - * @constructor - * @param {ics23.IProofSpec=} [properties] Properties to set - */ - function ProofSpec(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ProofSpec leaf_spec. - * @member {ics23.ILeafOp|null|undefined} leaf_spec - * @memberof ics23.ProofSpec - * @instance - */ - ProofSpec.prototype.leaf_spec = null; - - /** - * ProofSpec inner_spec. - * @member {ics23.IInnerSpec|null|undefined} inner_spec - * @memberof ics23.ProofSpec - * @instance - */ - ProofSpec.prototype.inner_spec = null; - - /** - * ProofSpec max_depth. - * @member {number} max_depth - * @memberof ics23.ProofSpec - * @instance - */ - ProofSpec.prototype.max_depth = 0; - - /** - * ProofSpec min_depth. - * @member {number} min_depth - * @memberof ics23.ProofSpec - * @instance - */ - ProofSpec.prototype.min_depth = 0; - - /** - * Encodes the specified ProofSpec message. Does not implicitly {@link ics23.ProofSpec.verify|verify} messages. - * @function encode - * @memberof ics23.ProofSpec - * @static - * @param {ics23.IProofSpec} message ProofSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProofSpec.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.leaf_spec != null && Object.hasOwnProperty.call(message, "leaf_spec")) - $root.ics23.LeafOp.encode(message.leaf_spec, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.inner_spec != null && Object.hasOwnProperty.call(message, "inner_spec")) - $root.ics23.InnerSpec.encode(message.inner_spec, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.max_depth != null && Object.hasOwnProperty.call(message, "max_depth")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.max_depth); - if (message.min_depth != null && Object.hasOwnProperty.call(message, "min_depth")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.min_depth); - return writer; - }; - - /** - * Encodes the specified ProofSpec message, length delimited. Does not implicitly {@link ics23.ProofSpec.verify|verify} messages. - * @function encodeDelimited - * @memberof ics23.ProofSpec - * @static - * @param {ics23.IProofSpec} message ProofSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProofSpec.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ProofSpec message from the specified reader or buffer. - * @function decode - * @memberof ics23.ProofSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ics23.ProofSpec} ProofSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProofSpec.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.ProofSpec(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.leaf_spec = $root.ics23.LeafOp.decode(reader, reader.uint32()); - break; - case 2: - message.inner_spec = $root.ics23.InnerSpec.decode(reader, reader.uint32()); - break; - case 3: - message.max_depth = reader.int32(); - break; - case 4: - message.min_depth = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ProofSpec message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ics23.ProofSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ics23.ProofSpec} ProofSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProofSpec.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ProofSpec message. - * @function verify - * @memberof ics23.ProofSpec - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ProofSpec.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.leaf_spec != null && message.hasOwnProperty("leaf_spec")) { - let error = $root.ics23.LeafOp.verify(message.leaf_spec); - if (error) - return "leaf_spec." + error; - } - if (message.inner_spec != null && message.hasOwnProperty("inner_spec")) { - let error = $root.ics23.InnerSpec.verify(message.inner_spec); - if (error) - return "inner_spec." + error; - } - if (message.max_depth != null && message.hasOwnProperty("max_depth")) - if (!$util.isInteger(message.max_depth)) - return "max_depth: integer expected"; - if (message.min_depth != null && message.hasOwnProperty("min_depth")) - if (!$util.isInteger(message.min_depth)) - return "min_depth: integer expected"; - return null; - }; - - /** - * Creates a ProofSpec message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ics23.ProofSpec - * @static - * @param {Object.} object Plain object - * @returns {ics23.ProofSpec} ProofSpec - */ - ProofSpec.fromObject = function fromObject(object) { - if (object instanceof $root.ics23.ProofSpec) - return object; - let message = new $root.ics23.ProofSpec(); - if (object.leaf_spec != null) { - if (typeof object.leaf_spec !== "object") - throw TypeError(".ics23.ProofSpec.leaf_spec: object expected"); - message.leaf_spec = $root.ics23.LeafOp.fromObject(object.leaf_spec); - } - if (object.inner_spec != null) { - if (typeof object.inner_spec !== "object") - throw TypeError(".ics23.ProofSpec.inner_spec: object expected"); - message.inner_spec = $root.ics23.InnerSpec.fromObject(object.inner_spec); - } - if (object.max_depth != null) - message.max_depth = object.max_depth | 0; - if (object.min_depth != null) - message.min_depth = object.min_depth | 0; - return message; - }; - - /** - * Creates a plain object from a ProofSpec message. Also converts values to other types if specified. - * @function toObject - * @memberof ics23.ProofSpec - * @static - * @param {ics23.ProofSpec} message ProofSpec - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ProofSpec.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.leaf_spec = null; - object.inner_spec = null; - object.max_depth = 0; - object.min_depth = 0; - } - if (message.leaf_spec != null && message.hasOwnProperty("leaf_spec")) - object.leaf_spec = $root.ics23.LeafOp.toObject(message.leaf_spec, options); - if (message.inner_spec != null && message.hasOwnProperty("inner_spec")) - object.inner_spec = $root.ics23.InnerSpec.toObject(message.inner_spec, options); - if (message.max_depth != null && message.hasOwnProperty("max_depth")) - object.max_depth = message.max_depth; - if (message.min_depth != null && message.hasOwnProperty("min_depth")) - object.min_depth = message.min_depth; - return object; - }; - - /** - * Converts this ProofSpec to JSON. - * @function toJSON - * @memberof ics23.ProofSpec - * @instance - * @returns {Object.} JSON object - */ - ProofSpec.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ProofSpec; - })(); - - ics23.InnerSpec = (function() { - - /** - * Properties of an InnerSpec. - * @memberof ics23 - * @interface IInnerSpec - * @property {Array.|null} [child_order] InnerSpec child_order - * @property {number|null} [child_size] InnerSpec child_size - * @property {number|null} [min_prefix_length] InnerSpec min_prefix_length - * @property {number|null} [max_prefix_length] InnerSpec max_prefix_length - * @property {Uint8Array|null} [empty_child] InnerSpec empty_child - * @property {ics23.HashOp|null} [hash] InnerSpec hash - */ - - /** - * Constructs a new InnerSpec. - * @memberof ics23 - * @classdesc Represents an InnerSpec. - * @implements IInnerSpec - * @constructor - * @param {ics23.IInnerSpec=} [properties] Properties to set - */ - function InnerSpec(properties) { - this.child_order = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InnerSpec child_order. - * @member {Array.} child_order - * @memberof ics23.InnerSpec - * @instance - */ - InnerSpec.prototype.child_order = $util.emptyArray; - - /** - * InnerSpec child_size. - * @member {number} child_size - * @memberof ics23.InnerSpec - * @instance - */ - InnerSpec.prototype.child_size = 0; - - /** - * InnerSpec min_prefix_length. - * @member {number} min_prefix_length - * @memberof ics23.InnerSpec - * @instance - */ - InnerSpec.prototype.min_prefix_length = 0; - - /** - * InnerSpec max_prefix_length. - * @member {number} max_prefix_length - * @memberof ics23.InnerSpec - * @instance - */ - InnerSpec.prototype.max_prefix_length = 0; - - /** - * InnerSpec empty_child. - * @member {Uint8Array} empty_child - * @memberof ics23.InnerSpec - * @instance - */ - InnerSpec.prototype.empty_child = $util.newBuffer([]); - - /** - * InnerSpec hash. - * @member {ics23.HashOp} hash - * @memberof ics23.InnerSpec - * @instance - */ - InnerSpec.prototype.hash = 0; - - /** - * Encodes the specified InnerSpec message. Does not implicitly {@link ics23.InnerSpec.verify|verify} messages. - * @function encode - * @memberof ics23.InnerSpec - * @static - * @param {ics23.IInnerSpec} message InnerSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InnerSpec.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.child_order != null && message.child_order.length) { - writer.uint32(/* id 1, wireType 2 =*/10).fork(); - for (let i = 0; i < message.child_order.length; ++i) - writer.int32(message.child_order[i]); - writer.ldelim(); - } - if (message.child_size != null && Object.hasOwnProperty.call(message, "child_size")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.child_size); - if (message.min_prefix_length != null && Object.hasOwnProperty.call(message, "min_prefix_length")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.min_prefix_length); - if (message.max_prefix_length != null && Object.hasOwnProperty.call(message, "max_prefix_length")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.max_prefix_length); - if (message.empty_child != null && Object.hasOwnProperty.call(message, "empty_child")) - writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.empty_child); - if (message.hash != null && Object.hasOwnProperty.call(message, "hash")) - writer.uint32(/* id 6, wireType 0 =*/48).int32(message.hash); - return writer; - }; - - /** - * Encodes the specified InnerSpec message, length delimited. Does not implicitly {@link ics23.InnerSpec.verify|verify} messages. - * @function encodeDelimited - * @memberof ics23.InnerSpec - * @static - * @param {ics23.IInnerSpec} message InnerSpec message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InnerSpec.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InnerSpec message from the specified reader or buffer. - * @function decode - * @memberof ics23.InnerSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ics23.InnerSpec} InnerSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InnerSpec.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.InnerSpec(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.child_order && message.child_order.length)) - message.child_order = []; - if ((tag & 7) === 2) { - let end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.child_order.push(reader.int32()); - } else - message.child_order.push(reader.int32()); - break; - case 2: - message.child_size = reader.int32(); - break; - case 3: - message.min_prefix_length = reader.int32(); - break; - case 4: - message.max_prefix_length = reader.int32(); - break; - case 5: - message.empty_child = reader.bytes(); - break; - case 6: - message.hash = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InnerSpec message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ics23.InnerSpec - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ics23.InnerSpec} InnerSpec - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InnerSpec.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InnerSpec message. - * @function verify - * @memberof ics23.InnerSpec - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InnerSpec.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.child_order != null && message.hasOwnProperty("child_order")) { - if (!Array.isArray(message.child_order)) - return "child_order: array expected"; - for (let i = 0; i < message.child_order.length; ++i) - if (!$util.isInteger(message.child_order[i])) - return "child_order: integer[] expected"; - } - if (message.child_size != null && message.hasOwnProperty("child_size")) - if (!$util.isInteger(message.child_size)) - return "child_size: integer expected"; - if (message.min_prefix_length != null && message.hasOwnProperty("min_prefix_length")) - if (!$util.isInteger(message.min_prefix_length)) - return "min_prefix_length: integer expected"; - if (message.max_prefix_length != null && message.hasOwnProperty("max_prefix_length")) - if (!$util.isInteger(message.max_prefix_length)) - return "max_prefix_length: integer expected"; - if (message.empty_child != null && message.hasOwnProperty("empty_child")) - if (!(message.empty_child && typeof message.empty_child.length === "number" || $util.isString(message.empty_child))) - return "empty_child: buffer expected"; - if (message.hash != null && message.hasOwnProperty("hash")) - switch (message.hash) { - default: - return "hash: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - return null; - }; - - /** - * Creates an InnerSpec message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ics23.InnerSpec - * @static - * @param {Object.} object Plain object - * @returns {ics23.InnerSpec} InnerSpec - */ - InnerSpec.fromObject = function fromObject(object) { - if (object instanceof $root.ics23.InnerSpec) - return object; - let message = new $root.ics23.InnerSpec(); - if (object.child_order) { - if (!Array.isArray(object.child_order)) - throw TypeError(".ics23.InnerSpec.child_order: array expected"); - message.child_order = []; - for (let i = 0; i < object.child_order.length; ++i) - message.child_order[i] = object.child_order[i] | 0; - } - if (object.child_size != null) - message.child_size = object.child_size | 0; - if (object.min_prefix_length != null) - message.min_prefix_length = object.min_prefix_length | 0; - if (object.max_prefix_length != null) - message.max_prefix_length = object.max_prefix_length | 0; - if (object.empty_child != null) - if (typeof object.empty_child === "string") - $util.base64.decode(object.empty_child, message.empty_child = $util.newBuffer($util.base64.length(object.empty_child)), 0); - else if (object.empty_child.length) - message.empty_child = object.empty_child; - switch (object.hash) { - case "NO_HASH": - case 0: - message.hash = 0; - break; - case "SHA256": - case 1: - message.hash = 1; - break; - case "SHA512": - case 2: - message.hash = 2; - break; - case "KECCAK": - case 3: - message.hash = 3; - break; - case "RIPEMD160": - case 4: - message.hash = 4; - break; - case "BITCOIN": - case 5: - message.hash = 5; - break; - } - return message; - }; - - /** - * Creates a plain object from an InnerSpec message. Also converts values to other types if specified. - * @function toObject - * @memberof ics23.InnerSpec - * @static - * @param {ics23.InnerSpec} message InnerSpec - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InnerSpec.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.child_order = []; - if (options.defaults) { - object.child_size = 0; - object.min_prefix_length = 0; - object.max_prefix_length = 0; - if (options.bytes === String) - object.empty_child = ""; - else { - object.empty_child = []; - if (options.bytes !== Array) - object.empty_child = $util.newBuffer(object.empty_child); - } - object.hash = options.enums === String ? "NO_HASH" : 0; - } - if (message.child_order && message.child_order.length) { - object.child_order = []; - for (let j = 0; j < message.child_order.length; ++j) - object.child_order[j] = message.child_order[j]; - } - if (message.child_size != null && message.hasOwnProperty("child_size")) - object.child_size = message.child_size; - if (message.min_prefix_length != null && message.hasOwnProperty("min_prefix_length")) - object.min_prefix_length = message.min_prefix_length; - if (message.max_prefix_length != null && message.hasOwnProperty("max_prefix_length")) - object.max_prefix_length = message.max_prefix_length; - if (message.empty_child != null && message.hasOwnProperty("empty_child")) - object.empty_child = options.bytes === String ? $util.base64.encode(message.empty_child, 0, message.empty_child.length) : options.bytes === Array ? Array.prototype.slice.call(message.empty_child) : message.empty_child; - if (message.hash != null && message.hasOwnProperty("hash")) - object.hash = options.enums === String ? $root.ics23.HashOp[message.hash] : message.hash; - return object; - }; - - /** - * Converts this InnerSpec to JSON. - * @function toJSON - * @memberof ics23.InnerSpec - * @instance - * @returns {Object.} JSON object - */ - InnerSpec.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return InnerSpec; - })(); - - ics23.BatchProof = (function() { - - /** - * Properties of a BatchProof. - * @memberof ics23 - * @interface IBatchProof - * @property {Array.|null} [entries] BatchProof entries - */ - - /** - * Constructs a new BatchProof. - * @memberof ics23 - * @classdesc Represents a BatchProof. - * @implements IBatchProof - * @constructor - * @param {ics23.IBatchProof=} [properties] Properties to set - */ - function BatchProof(properties) { - this.entries = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * BatchProof entries. - * @member {Array.} entries - * @memberof ics23.BatchProof - * @instance - */ - BatchProof.prototype.entries = $util.emptyArray; - - /** - * Encodes the specified BatchProof message. Does not implicitly {@link ics23.BatchProof.verify|verify} messages. - * @function encode - * @memberof ics23.BatchProof - * @static - * @param {ics23.IBatchProof} message BatchProof message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BatchProof.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.entries != null && message.entries.length) - for (let i = 0; i < message.entries.length; ++i) - $root.ics23.BatchEntry.encode(message.entries[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified BatchProof message, length delimited. Does not implicitly {@link ics23.BatchProof.verify|verify} messages. - * @function encodeDelimited - * @memberof ics23.BatchProof - * @static - * @param {ics23.IBatchProof} message BatchProof message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BatchProof.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BatchProof message from the specified reader or buffer. - * @function decode - * @memberof ics23.BatchProof - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ics23.BatchProof} BatchProof - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BatchProof.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.BatchProof(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.entries && message.entries.length)) - message.entries = []; - message.entries.push($root.ics23.BatchEntry.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BatchProof message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ics23.BatchProof - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ics23.BatchProof} BatchProof - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BatchProof.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BatchProof message. - * @function verify - * @memberof ics23.BatchProof - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BatchProof.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.entries != null && message.hasOwnProperty("entries")) { - if (!Array.isArray(message.entries)) - return "entries: array expected"; - for (let i = 0; i < message.entries.length; ++i) { - let error = $root.ics23.BatchEntry.verify(message.entries[i]); - if (error) - return "entries." + error; - } - } - return null; - }; - - /** - * Creates a BatchProof message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ics23.BatchProof - * @static - * @param {Object.} object Plain object - * @returns {ics23.BatchProof} BatchProof - */ - BatchProof.fromObject = function fromObject(object) { - if (object instanceof $root.ics23.BatchProof) - return object; - let message = new $root.ics23.BatchProof(); - if (object.entries) { - if (!Array.isArray(object.entries)) - throw TypeError(".ics23.BatchProof.entries: array expected"); - message.entries = []; - for (let i = 0; i < object.entries.length; ++i) { - if (typeof object.entries[i] !== "object") - throw TypeError(".ics23.BatchProof.entries: object expected"); - message.entries[i] = $root.ics23.BatchEntry.fromObject(object.entries[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a BatchProof message. Also converts values to other types if specified. - * @function toObject - * @memberof ics23.BatchProof - * @static - * @param {ics23.BatchProof} message BatchProof - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BatchProof.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.entries = []; - if (message.entries && message.entries.length) { - object.entries = []; - for (let j = 0; j < message.entries.length; ++j) - object.entries[j] = $root.ics23.BatchEntry.toObject(message.entries[j], options); - } - return object; - }; - - /** - * Converts this BatchProof to JSON. - * @function toJSON - * @memberof ics23.BatchProof - * @instance - * @returns {Object.} JSON object - */ - BatchProof.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return BatchProof; - })(); - - ics23.BatchEntry = (function() { - - /** - * Properties of a BatchEntry. - * @memberof ics23 - * @interface IBatchEntry - * @property {ics23.IExistenceProof|null} [exist] BatchEntry exist - * @property {ics23.INonExistenceProof|null} [nonexist] BatchEntry nonexist - */ - - /** - * Constructs a new BatchEntry. - * @memberof ics23 - * @classdesc Represents a BatchEntry. - * @implements IBatchEntry - * @constructor - * @param {ics23.IBatchEntry=} [properties] Properties to set - */ - function BatchEntry(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * BatchEntry exist. - * @member {ics23.IExistenceProof|null|undefined} exist - * @memberof ics23.BatchEntry - * @instance - */ - BatchEntry.prototype.exist = null; - - /** - * BatchEntry nonexist. - * @member {ics23.INonExistenceProof|null|undefined} nonexist - * @memberof ics23.BatchEntry - * @instance - */ - BatchEntry.prototype.nonexist = null; - - // OneOf field names bound to virtual getters and setters - let $oneOfFields; - - /** - * BatchEntry proof. - * @member {"exist"|"nonexist"|undefined} proof - * @memberof ics23.BatchEntry - * @instance - */ - Object.defineProperty(BatchEntry.prototype, "proof", { - get: $util.oneOfGetter($oneOfFields = ["exist", "nonexist"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Encodes the specified BatchEntry message. Does not implicitly {@link ics23.BatchEntry.verify|verify} messages. - * @function encode - * @memberof ics23.BatchEntry - * @static - * @param {ics23.IBatchEntry} message BatchEntry message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BatchEntry.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.exist != null && Object.hasOwnProperty.call(message, "exist")) - $root.ics23.ExistenceProof.encode(message.exist, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nonexist != null && Object.hasOwnProperty.call(message, "nonexist")) - $root.ics23.NonExistenceProof.encode(message.nonexist, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified BatchEntry message, length delimited. Does not implicitly {@link ics23.BatchEntry.verify|verify} messages. - * @function encodeDelimited - * @memberof ics23.BatchEntry - * @static - * @param {ics23.IBatchEntry} message BatchEntry message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BatchEntry.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BatchEntry message from the specified reader or buffer. - * @function decode - * @memberof ics23.BatchEntry - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ics23.BatchEntry} BatchEntry - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BatchEntry.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.BatchEntry(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.exist = $root.ics23.ExistenceProof.decode(reader, reader.uint32()); - break; - case 2: - message.nonexist = $root.ics23.NonExistenceProof.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BatchEntry message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ics23.BatchEntry - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ics23.BatchEntry} BatchEntry - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BatchEntry.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BatchEntry message. - * @function verify - * @memberof ics23.BatchEntry - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BatchEntry.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - let properties = {}; - if (message.exist != null && message.hasOwnProperty("exist")) { - properties.proof = 1; - { - let error = $root.ics23.ExistenceProof.verify(message.exist); - if (error) - return "exist." + error; - } - } - if (message.nonexist != null && message.hasOwnProperty("nonexist")) { - if (properties.proof === 1) - return "proof: multiple values"; - properties.proof = 1; - { - let error = $root.ics23.NonExistenceProof.verify(message.nonexist); - if (error) - return "nonexist." + error; - } - } - return null; - }; - - /** - * Creates a BatchEntry message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ics23.BatchEntry - * @static - * @param {Object.} object Plain object - * @returns {ics23.BatchEntry} BatchEntry - */ - BatchEntry.fromObject = function fromObject(object) { - if (object instanceof $root.ics23.BatchEntry) - return object; - let message = new $root.ics23.BatchEntry(); - if (object.exist != null) { - if (typeof object.exist !== "object") - throw TypeError(".ics23.BatchEntry.exist: object expected"); - message.exist = $root.ics23.ExistenceProof.fromObject(object.exist); - } - if (object.nonexist != null) { - if (typeof object.nonexist !== "object") - throw TypeError(".ics23.BatchEntry.nonexist: object expected"); - message.nonexist = $root.ics23.NonExistenceProof.fromObject(object.nonexist); - } - return message; - }; - - /** - * Creates a plain object from a BatchEntry message. Also converts values to other types if specified. - * @function toObject - * @memberof ics23.BatchEntry - * @static - * @param {ics23.BatchEntry} message BatchEntry - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BatchEntry.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (message.exist != null && message.hasOwnProperty("exist")) { - object.exist = $root.ics23.ExistenceProof.toObject(message.exist, options); - if (options.oneofs) - object.proof = "exist"; - } - if (message.nonexist != null && message.hasOwnProperty("nonexist")) { - object.nonexist = $root.ics23.NonExistenceProof.toObject(message.nonexist, options); - if (options.oneofs) - object.proof = "nonexist"; - } - return object; - }; - - /** - * Converts this BatchEntry to JSON. - * @function toJSON - * @memberof ics23.BatchEntry - * @instance - * @returns {Object.} JSON object - */ - BatchEntry.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return BatchEntry; - })(); - - ics23.CompressedBatchProof = (function() { - - /** - * Properties of a CompressedBatchProof. - * @memberof ics23 - * @interface ICompressedBatchProof - * @property {Array.|null} [entries] CompressedBatchProof entries - * @property {Array.|null} [lookup_inners] CompressedBatchProof lookup_inners - */ - - /** - * Constructs a new CompressedBatchProof. - * @memberof ics23 - * @classdesc Represents a CompressedBatchProof. - * @implements ICompressedBatchProof - * @constructor - * @param {ics23.ICompressedBatchProof=} [properties] Properties to set - */ - function CompressedBatchProof(properties) { - this.entries = []; - this.lookup_inners = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * CompressedBatchProof entries. - * @member {Array.} entries - * @memberof ics23.CompressedBatchProof - * @instance - */ - CompressedBatchProof.prototype.entries = $util.emptyArray; - - /** - * CompressedBatchProof lookup_inners. - * @member {Array.} lookup_inners - * @memberof ics23.CompressedBatchProof - * @instance - */ - CompressedBatchProof.prototype.lookup_inners = $util.emptyArray; - - /** - * Encodes the specified CompressedBatchProof message. Does not implicitly {@link ics23.CompressedBatchProof.verify|verify} messages. - * @function encode - * @memberof ics23.CompressedBatchProof - * @static - * @param {ics23.ICompressedBatchProof} message CompressedBatchProof message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CompressedBatchProof.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.entries != null && message.entries.length) - for (let i = 0; i < message.entries.length; ++i) - $root.ics23.CompressedBatchEntry.encode(message.entries[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.lookup_inners != null && message.lookup_inners.length) - for (let i = 0; i < message.lookup_inners.length; ++i) - $root.ics23.InnerOp.encode(message.lookup_inners[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified CompressedBatchProof message, length delimited. Does not implicitly {@link ics23.CompressedBatchProof.verify|verify} messages. - * @function encodeDelimited - * @memberof ics23.CompressedBatchProof - * @static - * @param {ics23.ICompressedBatchProof} message CompressedBatchProof message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CompressedBatchProof.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CompressedBatchProof message from the specified reader or buffer. - * @function decode - * @memberof ics23.CompressedBatchProof - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ics23.CompressedBatchProof} CompressedBatchProof - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CompressedBatchProof.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.CompressedBatchProof(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.entries && message.entries.length)) - message.entries = []; - message.entries.push($root.ics23.CompressedBatchEntry.decode(reader, reader.uint32())); - break; - case 2: - if (!(message.lookup_inners && message.lookup_inners.length)) - message.lookup_inners = []; - message.lookup_inners.push($root.ics23.InnerOp.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CompressedBatchProof message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ics23.CompressedBatchProof - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ics23.CompressedBatchProof} CompressedBatchProof - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CompressedBatchProof.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CompressedBatchProof message. - * @function verify - * @memberof ics23.CompressedBatchProof - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CompressedBatchProof.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.entries != null && message.hasOwnProperty("entries")) { - if (!Array.isArray(message.entries)) - return "entries: array expected"; - for (let i = 0; i < message.entries.length; ++i) { - let error = $root.ics23.CompressedBatchEntry.verify(message.entries[i]); - if (error) - return "entries." + error; - } - } - if (message.lookup_inners != null && message.hasOwnProperty("lookup_inners")) { - if (!Array.isArray(message.lookup_inners)) - return "lookup_inners: array expected"; - for (let i = 0; i < message.lookup_inners.length; ++i) { - let error = $root.ics23.InnerOp.verify(message.lookup_inners[i]); - if (error) - return "lookup_inners." + error; - } - } - return null; - }; - - /** - * Creates a CompressedBatchProof message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ics23.CompressedBatchProof - * @static - * @param {Object.} object Plain object - * @returns {ics23.CompressedBatchProof} CompressedBatchProof - */ - CompressedBatchProof.fromObject = function fromObject(object) { - if (object instanceof $root.ics23.CompressedBatchProof) - return object; - let message = new $root.ics23.CompressedBatchProof(); - if (object.entries) { - if (!Array.isArray(object.entries)) - throw TypeError(".ics23.CompressedBatchProof.entries: array expected"); - message.entries = []; - for (let i = 0; i < object.entries.length; ++i) { - if (typeof object.entries[i] !== "object") - throw TypeError(".ics23.CompressedBatchProof.entries: object expected"); - message.entries[i] = $root.ics23.CompressedBatchEntry.fromObject(object.entries[i]); - } - } - if (object.lookup_inners) { - if (!Array.isArray(object.lookup_inners)) - throw TypeError(".ics23.CompressedBatchProof.lookup_inners: array expected"); - message.lookup_inners = []; - for (let i = 0; i < object.lookup_inners.length; ++i) { - if (typeof object.lookup_inners[i] !== "object") - throw TypeError(".ics23.CompressedBatchProof.lookup_inners: object expected"); - message.lookup_inners[i] = $root.ics23.InnerOp.fromObject(object.lookup_inners[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a CompressedBatchProof message. Also converts values to other types if specified. - * @function toObject - * @memberof ics23.CompressedBatchProof - * @static - * @param {ics23.CompressedBatchProof} message CompressedBatchProof - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CompressedBatchProof.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) { - object.entries = []; - object.lookup_inners = []; - } - if (message.entries && message.entries.length) { - object.entries = []; - for (let j = 0; j < message.entries.length; ++j) - object.entries[j] = $root.ics23.CompressedBatchEntry.toObject(message.entries[j], options); - } - if (message.lookup_inners && message.lookup_inners.length) { - object.lookup_inners = []; - for (let j = 0; j < message.lookup_inners.length; ++j) - object.lookup_inners[j] = $root.ics23.InnerOp.toObject(message.lookup_inners[j], options); - } - return object; - }; - - /** - * Converts this CompressedBatchProof to JSON. - * @function toJSON - * @memberof ics23.CompressedBatchProof - * @instance - * @returns {Object.} JSON object - */ - CompressedBatchProof.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return CompressedBatchProof; - })(); - - ics23.CompressedBatchEntry = (function() { - - /** - * Properties of a CompressedBatchEntry. - * @memberof ics23 - * @interface ICompressedBatchEntry - * @property {ics23.ICompressedExistenceProof|null} [exist] CompressedBatchEntry exist - * @property {ics23.ICompressedNonExistenceProof|null} [nonexist] CompressedBatchEntry nonexist - */ - - /** - * Constructs a new CompressedBatchEntry. - * @memberof ics23 - * @classdesc Represents a CompressedBatchEntry. - * @implements ICompressedBatchEntry - * @constructor - * @param {ics23.ICompressedBatchEntry=} [properties] Properties to set - */ - function CompressedBatchEntry(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * CompressedBatchEntry exist. - * @member {ics23.ICompressedExistenceProof|null|undefined} exist - * @memberof ics23.CompressedBatchEntry - * @instance - */ - CompressedBatchEntry.prototype.exist = null; - - /** - * CompressedBatchEntry nonexist. - * @member {ics23.ICompressedNonExistenceProof|null|undefined} nonexist - * @memberof ics23.CompressedBatchEntry - * @instance - */ - CompressedBatchEntry.prototype.nonexist = null; - - // OneOf field names bound to virtual getters and setters - let $oneOfFields; - - /** - * CompressedBatchEntry proof. - * @member {"exist"|"nonexist"|undefined} proof - * @memberof ics23.CompressedBatchEntry - * @instance - */ - Object.defineProperty(CompressedBatchEntry.prototype, "proof", { - get: $util.oneOfGetter($oneOfFields = ["exist", "nonexist"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Encodes the specified CompressedBatchEntry message. Does not implicitly {@link ics23.CompressedBatchEntry.verify|verify} messages. - * @function encode - * @memberof ics23.CompressedBatchEntry - * @static - * @param {ics23.ICompressedBatchEntry} message CompressedBatchEntry message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CompressedBatchEntry.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.exist != null && Object.hasOwnProperty.call(message, "exist")) - $root.ics23.CompressedExistenceProof.encode(message.exist, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nonexist != null && Object.hasOwnProperty.call(message, "nonexist")) - $root.ics23.CompressedNonExistenceProof.encode(message.nonexist, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified CompressedBatchEntry message, length delimited. Does not implicitly {@link ics23.CompressedBatchEntry.verify|verify} messages. - * @function encodeDelimited - * @memberof ics23.CompressedBatchEntry - * @static - * @param {ics23.ICompressedBatchEntry} message CompressedBatchEntry message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CompressedBatchEntry.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CompressedBatchEntry message from the specified reader or buffer. - * @function decode - * @memberof ics23.CompressedBatchEntry - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ics23.CompressedBatchEntry} CompressedBatchEntry - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CompressedBatchEntry.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.CompressedBatchEntry(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.exist = $root.ics23.CompressedExistenceProof.decode(reader, reader.uint32()); - break; - case 2: - message.nonexist = $root.ics23.CompressedNonExistenceProof.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CompressedBatchEntry message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ics23.CompressedBatchEntry - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ics23.CompressedBatchEntry} CompressedBatchEntry - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CompressedBatchEntry.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CompressedBatchEntry message. - * @function verify - * @memberof ics23.CompressedBatchEntry - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CompressedBatchEntry.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - let properties = {}; - if (message.exist != null && message.hasOwnProperty("exist")) { - properties.proof = 1; - { - let error = $root.ics23.CompressedExistenceProof.verify(message.exist); - if (error) - return "exist." + error; - } - } - if (message.nonexist != null && message.hasOwnProperty("nonexist")) { - if (properties.proof === 1) - return "proof: multiple values"; - properties.proof = 1; - { - let error = $root.ics23.CompressedNonExistenceProof.verify(message.nonexist); - if (error) - return "nonexist." + error; - } - } - return null; - }; - - /** - * Creates a CompressedBatchEntry message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ics23.CompressedBatchEntry - * @static - * @param {Object.} object Plain object - * @returns {ics23.CompressedBatchEntry} CompressedBatchEntry - */ - CompressedBatchEntry.fromObject = function fromObject(object) { - if (object instanceof $root.ics23.CompressedBatchEntry) - return object; - let message = new $root.ics23.CompressedBatchEntry(); - if (object.exist != null) { - if (typeof object.exist !== "object") - throw TypeError(".ics23.CompressedBatchEntry.exist: object expected"); - message.exist = $root.ics23.CompressedExistenceProof.fromObject(object.exist); - } - if (object.nonexist != null) { - if (typeof object.nonexist !== "object") - throw TypeError(".ics23.CompressedBatchEntry.nonexist: object expected"); - message.nonexist = $root.ics23.CompressedNonExistenceProof.fromObject(object.nonexist); - } - return message; - }; - - /** - * Creates a plain object from a CompressedBatchEntry message. Also converts values to other types if specified. - * @function toObject - * @memberof ics23.CompressedBatchEntry - * @static - * @param {ics23.CompressedBatchEntry} message CompressedBatchEntry - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CompressedBatchEntry.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (message.exist != null && message.hasOwnProperty("exist")) { - object.exist = $root.ics23.CompressedExistenceProof.toObject(message.exist, options); - if (options.oneofs) - object.proof = "exist"; - } - if (message.nonexist != null && message.hasOwnProperty("nonexist")) { - object.nonexist = $root.ics23.CompressedNonExistenceProof.toObject(message.nonexist, options); - if (options.oneofs) - object.proof = "nonexist"; - } - return object; - }; - - /** - * Converts this CompressedBatchEntry to JSON. - * @function toJSON - * @memberof ics23.CompressedBatchEntry - * @instance - * @returns {Object.} JSON object - */ - CompressedBatchEntry.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return CompressedBatchEntry; - })(); - - ics23.CompressedExistenceProof = (function() { - - /** - * Properties of a CompressedExistenceProof. - * @memberof ics23 - * @interface ICompressedExistenceProof - * @property {Uint8Array|null} [key] CompressedExistenceProof key - * @property {Uint8Array|null} [value] CompressedExistenceProof value - * @property {ics23.ILeafOp|null} [leaf] CompressedExistenceProof leaf - * @property {Array.|null} [path] CompressedExistenceProof path - */ - - /** - * Constructs a new CompressedExistenceProof. - * @memberof ics23 - * @classdesc Represents a CompressedExistenceProof. - * @implements ICompressedExistenceProof - * @constructor - * @param {ics23.ICompressedExistenceProof=} [properties] Properties to set - */ - function CompressedExistenceProof(properties) { - this.path = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * CompressedExistenceProof key. - * @member {Uint8Array} key - * @memberof ics23.CompressedExistenceProof - * @instance - */ - CompressedExistenceProof.prototype.key = $util.newBuffer([]); - - /** - * CompressedExistenceProof value. - * @member {Uint8Array} value - * @memberof ics23.CompressedExistenceProof - * @instance - */ - CompressedExistenceProof.prototype.value = $util.newBuffer([]); - - /** - * CompressedExistenceProof leaf. - * @member {ics23.ILeafOp|null|undefined} leaf - * @memberof ics23.CompressedExistenceProof - * @instance - */ - CompressedExistenceProof.prototype.leaf = null; - - /** - * CompressedExistenceProof path. - * @member {Array.} path - * @memberof ics23.CompressedExistenceProof - * @instance - */ - CompressedExistenceProof.prototype.path = $util.emptyArray; - - /** - * Encodes the specified CompressedExistenceProof message. Does not implicitly {@link ics23.CompressedExistenceProof.verify|verify} messages. - * @function encode - * @memberof ics23.CompressedExistenceProof - * @static - * @param {ics23.ICompressedExistenceProof} message CompressedExistenceProof message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CompressedExistenceProof.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value); - if (message.leaf != null && Object.hasOwnProperty.call(message, "leaf")) - $root.ics23.LeafOp.encode(message.leaf, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.path != null && message.path.length) { - writer.uint32(/* id 4, wireType 2 =*/34).fork(); - for (let i = 0; i < message.path.length; ++i) - writer.int32(message.path[i]); - writer.ldelim(); - } - return writer; - }; - - /** - * Encodes the specified CompressedExistenceProof message, length delimited. Does not implicitly {@link ics23.CompressedExistenceProof.verify|verify} messages. - * @function encodeDelimited - * @memberof ics23.CompressedExistenceProof - * @static - * @param {ics23.ICompressedExistenceProof} message CompressedExistenceProof message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CompressedExistenceProof.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CompressedExistenceProof message from the specified reader or buffer. - * @function decode - * @memberof ics23.CompressedExistenceProof - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ics23.CompressedExistenceProof} CompressedExistenceProof - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CompressedExistenceProof.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.CompressedExistenceProof(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.bytes(); - break; - case 2: - message.value = reader.bytes(); - break; - case 3: - message.leaf = $root.ics23.LeafOp.decode(reader, reader.uint32()); - break; - case 4: - if (!(message.path && message.path.length)) - message.path = []; - if ((tag & 7) === 2) { - let 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; - }; - - /** - * Decodes a CompressedExistenceProof message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ics23.CompressedExistenceProof - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ics23.CompressedExistenceProof} CompressedExistenceProof - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CompressedExistenceProof.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CompressedExistenceProof message. - * @function verify - * @memberof ics23.CompressedExistenceProof - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CompressedExistenceProof.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) - return "key: buffer expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) - return "value: buffer expected"; - if (message.leaf != null && message.hasOwnProperty("leaf")) { - let error = $root.ics23.LeafOp.verify(message.leaf); - if (error) - return "leaf." + error; - } - if (message.path != null && message.hasOwnProperty("path")) { - if (!Array.isArray(message.path)) - return "path: array expected"; - for (let i = 0; i < message.path.length; ++i) - if (!$util.isInteger(message.path[i])) - return "path: integer[] expected"; - } - return null; - }; - - /** - * Creates a CompressedExistenceProof message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ics23.CompressedExistenceProof - * @static - * @param {Object.} object Plain object - * @returns {ics23.CompressedExistenceProof} CompressedExistenceProof - */ - CompressedExistenceProof.fromObject = function fromObject(object) { - if (object instanceof $root.ics23.CompressedExistenceProof) - return object; - let message = new $root.ics23.CompressedExistenceProof(); - if (object.key != null) - if (typeof object.key === "string") - $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); - else if (object.key.length) - message.key = object.key; - if (object.value != null) - if (typeof object.value === "string") - $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); - else if (object.value.length) - message.value = object.value; - if (object.leaf != null) { - if (typeof object.leaf !== "object") - throw TypeError(".ics23.CompressedExistenceProof.leaf: object expected"); - message.leaf = $root.ics23.LeafOp.fromObject(object.leaf); - } - if (object.path) { - if (!Array.isArray(object.path)) - throw TypeError(".ics23.CompressedExistenceProof.path: array expected"); - message.path = []; - for (let i = 0; i < object.path.length; ++i) - message.path[i] = object.path[i] | 0; - } - return message; - }; - - /** - * Creates a plain object from a CompressedExistenceProof message. Also converts values to other types if specified. - * @function toObject - * @memberof ics23.CompressedExistenceProof - * @static - * @param {ics23.CompressedExistenceProof} message CompressedExistenceProof - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CompressedExistenceProof.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.path = []; - if (options.defaults) { - if (options.bytes === String) - object.key = ""; - else { - object.key = []; - if (options.bytes !== Array) - object.key = $util.newBuffer(object.key); - } - if (options.bytes === String) - object.value = ""; - else { - object.value = []; - if (options.bytes !== Array) - object.value = $util.newBuffer(object.value); - } - object.leaf = null; - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; - if (message.value != null && message.hasOwnProperty("value")) - object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; - if (message.leaf != null && message.hasOwnProperty("leaf")) - object.leaf = $root.ics23.LeafOp.toObject(message.leaf, options); - if (message.path && message.path.length) { - object.path = []; - for (let j = 0; j < message.path.length; ++j) - object.path[j] = message.path[j]; - } - return object; - }; - - /** - * Converts this CompressedExistenceProof to JSON. - * @function toJSON - * @memberof ics23.CompressedExistenceProof - * @instance - * @returns {Object.} JSON object - */ - CompressedExistenceProof.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return CompressedExistenceProof; - })(); - - ics23.CompressedNonExistenceProof = (function() { - - /** - * Properties of a CompressedNonExistenceProof. - * @memberof ics23 - * @interface ICompressedNonExistenceProof - * @property {Uint8Array|null} [key] CompressedNonExistenceProof key - * @property {ics23.ICompressedExistenceProof|null} [left] CompressedNonExistenceProof left - * @property {ics23.ICompressedExistenceProof|null} [right] CompressedNonExistenceProof right - */ - - /** - * Constructs a new CompressedNonExistenceProof. - * @memberof ics23 - * @classdesc Represents a CompressedNonExistenceProof. - * @implements ICompressedNonExistenceProof - * @constructor - * @param {ics23.ICompressedNonExistenceProof=} [properties] Properties to set - */ - function CompressedNonExistenceProof(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * CompressedNonExistenceProof key. - * @member {Uint8Array} key - * @memberof ics23.CompressedNonExistenceProof - * @instance - */ - CompressedNonExistenceProof.prototype.key = $util.newBuffer([]); - - /** - * CompressedNonExistenceProof left. - * @member {ics23.ICompressedExistenceProof|null|undefined} left - * @memberof ics23.CompressedNonExistenceProof - * @instance - */ - CompressedNonExistenceProof.prototype.left = null; - - /** - * CompressedNonExistenceProof right. - * @member {ics23.ICompressedExistenceProof|null|undefined} right - * @memberof ics23.CompressedNonExistenceProof - * @instance - */ - CompressedNonExistenceProof.prototype.right = null; - - /** - * Encodes the specified CompressedNonExistenceProof message. Does not implicitly {@link ics23.CompressedNonExistenceProof.verify|verify} messages. - * @function encode - * @memberof ics23.CompressedNonExistenceProof - * @static - * @param {ics23.ICompressedNonExistenceProof} message CompressedNonExistenceProof message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CompressedNonExistenceProof.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); - if (message.left != null && Object.hasOwnProperty.call(message, "left")) - $root.ics23.CompressedExistenceProof.encode(message.left, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.right != null && Object.hasOwnProperty.call(message, "right")) - $root.ics23.CompressedExistenceProof.encode(message.right, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified CompressedNonExistenceProof message, length delimited. Does not implicitly {@link ics23.CompressedNonExistenceProof.verify|verify} messages. - * @function encodeDelimited - * @memberof ics23.CompressedNonExistenceProof - * @static - * @param {ics23.ICompressedNonExistenceProof} message CompressedNonExistenceProof message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CompressedNonExistenceProof.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CompressedNonExistenceProof message from the specified reader or buffer. - * @function decode - * @memberof ics23.CompressedNonExistenceProof - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ics23.CompressedNonExistenceProof} CompressedNonExistenceProof - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CompressedNonExistenceProof.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ics23.CompressedNonExistenceProof(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.bytes(); - break; - case 2: - message.left = $root.ics23.CompressedExistenceProof.decode(reader, reader.uint32()); - break; - case 3: - message.right = $root.ics23.CompressedExistenceProof.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CompressedNonExistenceProof message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ics23.CompressedNonExistenceProof - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ics23.CompressedNonExistenceProof} CompressedNonExistenceProof - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CompressedNonExistenceProof.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CompressedNonExistenceProof message. - * @function verify - * @memberof ics23.CompressedNonExistenceProof - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CompressedNonExistenceProof.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) - return "key: buffer expected"; - if (message.left != null && message.hasOwnProperty("left")) { - let error = $root.ics23.CompressedExistenceProof.verify(message.left); - if (error) - return "left." + error; - } - if (message.right != null && message.hasOwnProperty("right")) { - let error = $root.ics23.CompressedExistenceProof.verify(message.right); - if (error) - return "right." + error; - } - return null; - }; - - /** - * Creates a CompressedNonExistenceProof message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ics23.CompressedNonExistenceProof - * @static - * @param {Object.} object Plain object - * @returns {ics23.CompressedNonExistenceProof} CompressedNonExistenceProof - */ - CompressedNonExistenceProof.fromObject = function fromObject(object) { - if (object instanceof $root.ics23.CompressedNonExistenceProof) - return object; - let message = new $root.ics23.CompressedNonExistenceProof(); - if (object.key != null) - if (typeof object.key === "string") - $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); - else if (object.key.length) - message.key = object.key; - if (object.left != null) { - if (typeof object.left !== "object") - throw TypeError(".ics23.CompressedNonExistenceProof.left: object expected"); - message.left = $root.ics23.CompressedExistenceProof.fromObject(object.left); - } - if (object.right != null) { - if (typeof object.right !== "object") - throw TypeError(".ics23.CompressedNonExistenceProof.right: object expected"); - message.right = $root.ics23.CompressedExistenceProof.fromObject(object.right); - } - return message; - }; - - /** - * Creates a plain object from a CompressedNonExistenceProof message. Also converts values to other types if specified. - * @function toObject - * @memberof ics23.CompressedNonExistenceProof - * @static - * @param {ics23.CompressedNonExistenceProof} message CompressedNonExistenceProof - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CompressedNonExistenceProof.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if (options.bytes === String) - object.key = ""; - else { - object.key = []; - if (options.bytes !== Array) - object.key = $util.newBuffer(object.key); - } - object.left = null; - object.right = null; - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; - if (message.left != null && message.hasOwnProperty("left")) - object.left = $root.ics23.CompressedExistenceProof.toObject(message.left, options); - if (message.right != null && message.hasOwnProperty("right")) - object.right = $root.ics23.CompressedExistenceProof.toObject(message.right, options); - return object; - }; - - /** - * Converts this CompressedNonExistenceProof to JSON. - * @function toJSON - * @memberof ics23.CompressedNonExistenceProof - * @instance - * @returns {Object.} JSON object - */ - CompressedNonExistenceProof.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return CompressedNonExistenceProof; - })(); - - return ics23; -})(); - -export const cosmos = $root.cosmos = (() => { - - /** - * Namespace cosmos. - * @exports cosmos - * @namespace - */ - const cosmos = {}; - - cosmos.auth = (function() { - - /** - * Namespace auth. - * @memberof cosmos - * @namespace - */ - const auth = {}; - - auth.v1beta1 = (function() { - - /** - * Namespace v1beta1. - * @memberof cosmos.auth - * @namespace - */ - const v1beta1 = {}; - - v1beta1.Query = (function() { - - /** - * Constructs a new Query service. - * @memberof cosmos.auth.v1beta1 - * @classdesc Represents a Query - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function Query(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Query.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Query; - - /** - * Callback as used by {@link cosmos.auth.v1beta1.Query#account}. - * @memberof cosmos.auth.v1beta1.Query - * @typedef AccountCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.auth.v1beta1.QueryAccountResponse} [response] QueryAccountResponse - */ - - /** - * Calls Account. - * @function account - * @memberof cosmos.auth.v1beta1.Query - * @instance - * @param {cosmos.auth.v1beta1.IQueryAccountRequest} request QueryAccountRequest message or plain object - * @param {cosmos.auth.v1beta1.Query.AccountCallback} callback Node-style callback called with the error, if any, and QueryAccountResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.account = function account(request, callback) { - return this.rpcCall(account, $root.cosmos.auth.v1beta1.QueryAccountRequest, $root.cosmos.auth.v1beta1.QueryAccountResponse, request, callback); - }, "name", { value: "Account" }); - - /** - * Calls Account. - * @function account - * @memberof cosmos.auth.v1beta1.Query - * @instance - * @param {cosmos.auth.v1beta1.IQueryAccountRequest} request QueryAccountRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.auth.v1beta1.Query#params}. - * @memberof cosmos.auth.v1beta1.Query - * @typedef ParamsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.auth.v1beta1.QueryParamsResponse} [response] QueryParamsResponse - */ - - /** - * Calls Params. - * @function params - * @memberof cosmos.auth.v1beta1.Query - * @instance - * @param {cosmos.auth.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object - * @param {cosmos.auth.v1beta1.Query.ParamsCallback} callback Node-style callback called with the error, if any, and QueryParamsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.params = function params(request, callback) { - return this.rpcCall(params, $root.cosmos.auth.v1beta1.QueryParamsRequest, $root.cosmos.auth.v1beta1.QueryParamsResponse, request, callback); - }, "name", { value: "Params" }); - - /** - * Calls Params. - * @function params - * @memberof cosmos.auth.v1beta1.Query - * @instance - * @param {cosmos.auth.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return Query; - })(); - - v1beta1.QueryAccountRequest = (function() { - - /** - * Properties of a QueryAccountRequest. - * @memberof cosmos.auth.v1beta1 - * @interface IQueryAccountRequest - * @property {string|null} [address] QueryAccountRequest address - */ - - /** - * Constructs a new QueryAccountRequest. - * @memberof cosmos.auth.v1beta1 - * @classdesc Represents a QueryAccountRequest. - * @implements IQueryAccountRequest - * @constructor - * @param {cosmos.auth.v1beta1.IQueryAccountRequest=} [properties] Properties to set - */ - function QueryAccountRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryAccountRequest address. - * @member {string} address - * @memberof cosmos.auth.v1beta1.QueryAccountRequest - * @instance - */ - QueryAccountRequest.prototype.address = ""; - - /** - * Encodes the specified QueryAccountRequest message. Does not implicitly {@link cosmos.auth.v1beta1.QueryAccountRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.auth.v1beta1.QueryAccountRequest - * @static - * @param {cosmos.auth.v1beta1.IQueryAccountRequest} message QueryAccountRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryAccountRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.address != null && Object.hasOwnProperty.call(message, "address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.address); - return writer; - }; - - /** - * Encodes the specified QueryAccountRequest message, length delimited. Does not implicitly {@link cosmos.auth.v1beta1.QueryAccountRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.auth.v1beta1.QueryAccountRequest - * @static - * @param {cosmos.auth.v1beta1.IQueryAccountRequest} message QueryAccountRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryAccountRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryAccountRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.auth.v1beta1.QueryAccountRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.auth.v1beta1.QueryAccountRequest} QueryAccountRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryAccountRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.auth.v1beta1.QueryAccountRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.address = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryAccountRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.auth.v1beta1.QueryAccountRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.auth.v1beta1.QueryAccountRequest} QueryAccountRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryAccountRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryAccountRequest message. - * @function verify - * @memberof cosmos.auth.v1beta1.QueryAccountRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryAccountRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.address != null && message.hasOwnProperty("address")) - if (!$util.isString(message.address)) - return "address: string expected"; - return null; - }; - - /** - * Creates a QueryAccountRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.auth.v1beta1.QueryAccountRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.auth.v1beta1.QueryAccountRequest} QueryAccountRequest - */ - QueryAccountRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.auth.v1beta1.QueryAccountRequest) - return object; - let message = new $root.cosmos.auth.v1beta1.QueryAccountRequest(); - if (object.address != null) - message.address = String(object.address); - return message; - }; - - /** - * Creates a plain object from a QueryAccountRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.auth.v1beta1.QueryAccountRequest - * @static - * @param {cosmos.auth.v1beta1.QueryAccountRequest} message QueryAccountRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryAccountRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.address = ""; - if (message.address != null && message.hasOwnProperty("address")) - object.address = message.address; - return object; - }; - - /** - * Converts this QueryAccountRequest to JSON. - * @function toJSON - * @memberof cosmos.auth.v1beta1.QueryAccountRequest - * @instance - * @returns {Object.} JSON object - */ - QueryAccountRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryAccountRequest; - })(); - - v1beta1.QueryAccountResponse = (function() { - - /** - * Properties of a QueryAccountResponse. - * @memberof cosmos.auth.v1beta1 - * @interface IQueryAccountResponse - * @property {google.protobuf.IAny|null} [account] QueryAccountResponse account - */ - - /** - * Constructs a new QueryAccountResponse. - * @memberof cosmos.auth.v1beta1 - * @classdesc Represents a QueryAccountResponse. - * @implements IQueryAccountResponse - * @constructor - * @param {cosmos.auth.v1beta1.IQueryAccountResponse=} [properties] Properties to set - */ - function QueryAccountResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryAccountResponse account. - * @member {google.protobuf.IAny|null|undefined} account - * @memberof cosmos.auth.v1beta1.QueryAccountResponse - * @instance - */ - QueryAccountResponse.prototype.account = null; - - /** - * Encodes the specified QueryAccountResponse message. Does not implicitly {@link cosmos.auth.v1beta1.QueryAccountResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.auth.v1beta1.QueryAccountResponse - * @static - * @param {cosmos.auth.v1beta1.IQueryAccountResponse} message QueryAccountResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryAccountResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.account != null && Object.hasOwnProperty.call(message, "account")) - $root.google.protobuf.Any.encode(message.account, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryAccountResponse message, length delimited. Does not implicitly {@link cosmos.auth.v1beta1.QueryAccountResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.auth.v1beta1.QueryAccountResponse - * @static - * @param {cosmos.auth.v1beta1.IQueryAccountResponse} message QueryAccountResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryAccountResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryAccountResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.auth.v1beta1.QueryAccountResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.auth.v1beta1.QueryAccountResponse} QueryAccountResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryAccountResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.auth.v1beta1.QueryAccountResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.account = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryAccountResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.auth.v1beta1.QueryAccountResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.auth.v1beta1.QueryAccountResponse} QueryAccountResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryAccountResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryAccountResponse message. - * @function verify - * @memberof cosmos.auth.v1beta1.QueryAccountResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryAccountResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.account != null && message.hasOwnProperty("account")) { - let error = $root.google.protobuf.Any.verify(message.account); - if (error) - return "account." + error; - } - return null; - }; - - /** - * Creates a QueryAccountResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.auth.v1beta1.QueryAccountResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.auth.v1beta1.QueryAccountResponse} QueryAccountResponse - */ - QueryAccountResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.auth.v1beta1.QueryAccountResponse) - return object; - let message = new $root.cosmos.auth.v1beta1.QueryAccountResponse(); - if (object.account != null) { - if (typeof object.account !== "object") - throw TypeError(".cosmos.auth.v1beta1.QueryAccountResponse.account: object expected"); - message.account = $root.google.protobuf.Any.fromObject(object.account); - } - return message; - }; - - /** - * Creates a plain object from a QueryAccountResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.auth.v1beta1.QueryAccountResponse - * @static - * @param {cosmos.auth.v1beta1.QueryAccountResponse} message QueryAccountResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryAccountResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.account = null; - if (message.account != null && message.hasOwnProperty("account")) - object.account = $root.google.protobuf.Any.toObject(message.account, options); - return object; - }; - - /** - * Converts this QueryAccountResponse to JSON. - * @function toJSON - * @memberof cosmos.auth.v1beta1.QueryAccountResponse - * @instance - * @returns {Object.} JSON object - */ - QueryAccountResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryAccountResponse; - })(); - - v1beta1.QueryParamsRequest = (function() { - - /** - * Properties of a QueryParamsRequest. - * @memberof cosmos.auth.v1beta1 - * @interface IQueryParamsRequest - */ - - /** - * Constructs a new QueryParamsRequest. - * @memberof cosmos.auth.v1beta1 - * @classdesc Represents a QueryParamsRequest. - * @implements IQueryParamsRequest - * @constructor - * @param {cosmos.auth.v1beta1.IQueryParamsRequest=} [properties] Properties to set - */ - function QueryParamsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified QueryParamsRequest message. Does not implicitly {@link cosmos.auth.v1beta1.QueryParamsRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.auth.v1beta1.QueryParamsRequest - * @static - * @param {cosmos.auth.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified QueryParamsRequest message, length delimited. Does not implicitly {@link cosmos.auth.v1beta1.QueryParamsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.auth.v1beta1.QueryParamsRequest - * @static - * @param {cosmos.auth.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryParamsRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.auth.v1beta1.QueryParamsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.auth.v1beta1.QueryParamsRequest} QueryParamsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.auth.v1beta1.QueryParamsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryParamsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.auth.v1beta1.QueryParamsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.auth.v1beta1.QueryParamsRequest} QueryParamsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryParamsRequest message. - * @function verify - * @memberof cosmos.auth.v1beta1.QueryParamsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryParamsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a QueryParamsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.auth.v1beta1.QueryParamsRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.auth.v1beta1.QueryParamsRequest} QueryParamsRequest - */ - QueryParamsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.auth.v1beta1.QueryParamsRequest) - return object; - return new $root.cosmos.auth.v1beta1.QueryParamsRequest(); - }; - - /** - * Creates a plain object from a QueryParamsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.auth.v1beta1.QueryParamsRequest - * @static - * @param {cosmos.auth.v1beta1.QueryParamsRequest} message QueryParamsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryParamsRequest.toObject = function toObject() { - return {}; - }; - - /** - * Converts this QueryParamsRequest to JSON. - * @function toJSON - * @memberof cosmos.auth.v1beta1.QueryParamsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryParamsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryParamsRequest; - })(); - - v1beta1.QueryParamsResponse = (function() { - - /** - * Properties of a QueryParamsResponse. - * @memberof cosmos.auth.v1beta1 - * @interface IQueryParamsResponse - * @property {cosmos.auth.v1beta1.IParams|null} [params] QueryParamsResponse params - */ - - /** - * Constructs a new QueryParamsResponse. - * @memberof cosmos.auth.v1beta1 - * @classdesc Represents a QueryParamsResponse. - * @implements IQueryParamsResponse - * @constructor - * @param {cosmos.auth.v1beta1.IQueryParamsResponse=} [properties] Properties to set - */ - function QueryParamsResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryParamsResponse params. - * @member {cosmos.auth.v1beta1.IParams|null|undefined} params - * @memberof cosmos.auth.v1beta1.QueryParamsResponse - * @instance - */ - QueryParamsResponse.prototype.params = null; - - /** - * Encodes the specified QueryParamsResponse message. Does not implicitly {@link cosmos.auth.v1beta1.QueryParamsResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.auth.v1beta1.QueryParamsResponse - * @static - * @param {cosmos.auth.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.params != null && Object.hasOwnProperty.call(message, "params")) - $root.cosmos.auth.v1beta1.Params.encode(message.params, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryParamsResponse message, length delimited. Does not implicitly {@link cosmos.auth.v1beta1.QueryParamsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.auth.v1beta1.QueryParamsResponse - * @static - * @param {cosmos.auth.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryParamsResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.auth.v1beta1.QueryParamsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.auth.v1beta1.QueryParamsResponse} QueryParamsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.auth.v1beta1.QueryParamsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.params = $root.cosmos.auth.v1beta1.Params.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryParamsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.auth.v1beta1.QueryParamsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.auth.v1beta1.QueryParamsResponse} QueryParamsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryParamsResponse message. - * @function verify - * @memberof cosmos.auth.v1beta1.QueryParamsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryParamsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.params != null && message.hasOwnProperty("params")) { - let error = $root.cosmos.auth.v1beta1.Params.verify(message.params); - if (error) - return "params." + error; - } - return null; - }; - - /** - * Creates a QueryParamsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.auth.v1beta1.QueryParamsResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.auth.v1beta1.QueryParamsResponse} QueryParamsResponse - */ - QueryParamsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.auth.v1beta1.QueryParamsResponse) - return object; - let message = new $root.cosmos.auth.v1beta1.QueryParamsResponse(); - if (object.params != null) { - if (typeof object.params !== "object") - throw TypeError(".cosmos.auth.v1beta1.QueryParamsResponse.params: object expected"); - message.params = $root.cosmos.auth.v1beta1.Params.fromObject(object.params); - } - return message; - }; - - /** - * Creates a plain object from a QueryParamsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.auth.v1beta1.QueryParamsResponse - * @static - * @param {cosmos.auth.v1beta1.QueryParamsResponse} message QueryParamsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryParamsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.params = null; - if (message.params != null && message.hasOwnProperty("params")) - object.params = $root.cosmos.auth.v1beta1.Params.toObject(message.params, options); - return object; - }; - - /** - * Converts this QueryParamsResponse to JSON. - * @function toJSON - * @memberof cosmos.auth.v1beta1.QueryParamsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryParamsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryParamsResponse; - })(); - - v1beta1.GenesisState = (function() { - - /** - * Properties of a GenesisState. - * @memberof cosmos.auth.v1beta1 - * @interface IGenesisState - * @property {cosmos.auth.v1beta1.IParams|null} [params] GenesisState params - * @property {Array.|null} [accounts] GenesisState accounts - */ - - /** - * Constructs a new GenesisState. - * @memberof cosmos.auth.v1beta1 - * @classdesc Represents a GenesisState. - * @implements IGenesisState - * @constructor - * @param {cosmos.auth.v1beta1.IGenesisState=} [properties] Properties to set - */ - function GenesisState(properties) { - this.accounts = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GenesisState params. - * @member {cosmos.auth.v1beta1.IParams|null|undefined} params - * @memberof cosmos.auth.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.params = null; - - /** - * GenesisState accounts. - * @member {Array.} accounts - * @memberof cosmos.auth.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.accounts = $util.emptyArray; - - /** - * Encodes the specified GenesisState message. Does not implicitly {@link cosmos.auth.v1beta1.GenesisState.verify|verify} messages. - * @function encode - * @memberof cosmos.auth.v1beta1.GenesisState - * @static - * @param {cosmos.auth.v1beta1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.params != null && Object.hasOwnProperty.call(message, "params")) - $root.cosmos.auth.v1beta1.Params.encode(message.params, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.accounts != null && message.accounts.length) - for (let i = 0; i < message.accounts.length; ++i) - $root.google.protobuf.Any.encode(message.accounts[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link cosmos.auth.v1beta1.GenesisState.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.auth.v1beta1.GenesisState - * @static - * @param {cosmos.auth.v1beta1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer. - * @function decode - * @memberof cosmos.auth.v1beta1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.auth.v1beta1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.auth.v1beta1.GenesisState(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.params = $root.cosmos.auth.v1beta1.Params.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.accounts && message.accounts.length)) - message.accounts = []; - message.accounts.push($root.google.protobuf.Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.auth.v1beta1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.auth.v1beta1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GenesisState message. - * @function verify - * @memberof cosmos.auth.v1beta1.GenesisState - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GenesisState.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.params != null && message.hasOwnProperty("params")) { - let error = $root.cosmos.auth.v1beta1.Params.verify(message.params); - if (error) - return "params." + error; - } - if (message.accounts != null && message.hasOwnProperty("accounts")) { - if (!Array.isArray(message.accounts)) - return "accounts: array expected"; - for (let i = 0; i < message.accounts.length; ++i) { - let error = $root.google.protobuf.Any.verify(message.accounts[i]); - if (error) - return "accounts." + error; - } - } - return null; - }; - - /** - * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.auth.v1beta1.GenesisState - * @static - * @param {Object.} object Plain object - * @returns {cosmos.auth.v1beta1.GenesisState} GenesisState - */ - GenesisState.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.auth.v1beta1.GenesisState) - return object; - let message = new $root.cosmos.auth.v1beta1.GenesisState(); - if (object.params != null) { - if (typeof object.params !== "object") - throw TypeError(".cosmos.auth.v1beta1.GenesisState.params: object expected"); - message.params = $root.cosmos.auth.v1beta1.Params.fromObject(object.params); - } - if (object.accounts) { - if (!Array.isArray(object.accounts)) - throw TypeError(".cosmos.auth.v1beta1.GenesisState.accounts: array expected"); - message.accounts = []; - for (let i = 0; i < object.accounts.length; ++i) { - if (typeof object.accounts[i] !== "object") - throw TypeError(".cosmos.auth.v1beta1.GenesisState.accounts: object expected"); - message.accounts[i] = $root.google.protobuf.Any.fromObject(object.accounts[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a GenesisState message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.auth.v1beta1.GenesisState - * @static - * @param {cosmos.auth.v1beta1.GenesisState} message GenesisState - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GenesisState.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.accounts = []; - if (options.defaults) - object.params = null; - if (message.params != null && message.hasOwnProperty("params")) - object.params = $root.cosmos.auth.v1beta1.Params.toObject(message.params, options); - if (message.accounts && message.accounts.length) { - object.accounts = []; - for (let j = 0; j < message.accounts.length; ++j) - object.accounts[j] = $root.google.protobuf.Any.toObject(message.accounts[j], options); - } - return object; - }; - - /** - * Converts this GenesisState to JSON. - * @function toJSON - * @memberof cosmos.auth.v1beta1.GenesisState - * @instance - * @returns {Object.} JSON object - */ - GenesisState.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GenesisState; - })(); - - v1beta1.BaseAccount = (function() { - - /** - * Properties of a BaseAccount. - * @memberof cosmos.auth.v1beta1 - * @interface IBaseAccount - * @property {string|null} [address] BaseAccount address - * @property {google.protobuf.IAny|null} [pub_key] BaseAccount pub_key - * @property {Long|null} [account_number] BaseAccount account_number - * @property {Long|null} [sequence] BaseAccount sequence - */ - - /** - * Constructs a new BaseAccount. - * @memberof cosmos.auth.v1beta1 - * @classdesc Represents a BaseAccount. - * @implements IBaseAccount - * @constructor - * @param {cosmos.auth.v1beta1.IBaseAccount=} [properties] Properties to set - */ - function BaseAccount(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * BaseAccount address. - * @member {string} address - * @memberof cosmos.auth.v1beta1.BaseAccount - * @instance - */ - BaseAccount.prototype.address = ""; - - /** - * BaseAccount pub_key. - * @member {google.protobuf.IAny|null|undefined} pub_key - * @memberof cosmos.auth.v1beta1.BaseAccount - * @instance - */ - BaseAccount.prototype.pub_key = null; - - /** - * BaseAccount account_number. - * @member {Long} account_number - * @memberof cosmos.auth.v1beta1.BaseAccount - * @instance - */ - BaseAccount.prototype.account_number = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * BaseAccount sequence. - * @member {Long} sequence - * @memberof cosmos.auth.v1beta1.BaseAccount - * @instance - */ - BaseAccount.prototype.sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified BaseAccount message. Does not implicitly {@link cosmos.auth.v1beta1.BaseAccount.verify|verify} messages. - * @function encode - * @memberof cosmos.auth.v1beta1.BaseAccount - * @static - * @param {cosmos.auth.v1beta1.IBaseAccount} message BaseAccount message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BaseAccount.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.address != null && Object.hasOwnProperty.call(message, "address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.address); - if (message.pub_key != null && Object.hasOwnProperty.call(message, "pub_key")) - $root.google.protobuf.Any.encode(message.pub_key, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.account_number != null && Object.hasOwnProperty.call(message, "account_number")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.account_number); - if (message.sequence != null && Object.hasOwnProperty.call(message, "sequence")) - writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.sequence); - return writer; - }; - - /** - * Encodes the specified BaseAccount message, length delimited. Does not implicitly {@link cosmos.auth.v1beta1.BaseAccount.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.auth.v1beta1.BaseAccount - * @static - * @param {cosmos.auth.v1beta1.IBaseAccount} message BaseAccount message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BaseAccount.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BaseAccount message from the specified reader or buffer. - * @function decode - * @memberof cosmos.auth.v1beta1.BaseAccount - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.auth.v1beta1.BaseAccount} BaseAccount - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BaseAccount.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.auth.v1beta1.BaseAccount(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.address = reader.string(); - break; - case 2: - message.pub_key = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - case 3: - message.account_number = reader.uint64(); - break; - case 4: - message.sequence = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BaseAccount message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.auth.v1beta1.BaseAccount - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.auth.v1beta1.BaseAccount} BaseAccount - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BaseAccount.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BaseAccount message. - * @function verify - * @memberof cosmos.auth.v1beta1.BaseAccount - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BaseAccount.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.address != null && message.hasOwnProperty("address")) - if (!$util.isString(message.address)) - return "address: string expected"; - if (message.pub_key != null && message.hasOwnProperty("pub_key")) { - let error = $root.google.protobuf.Any.verify(message.pub_key); - if (error) - return "pub_key." + error; - } - if (message.account_number != null && message.hasOwnProperty("account_number")) - if (!$util.isInteger(message.account_number) && !(message.account_number && $util.isInteger(message.account_number.low) && $util.isInteger(message.account_number.high))) - return "account_number: integer|Long expected"; - if (message.sequence != null && message.hasOwnProperty("sequence")) - if (!$util.isInteger(message.sequence) && !(message.sequence && $util.isInteger(message.sequence.low) && $util.isInteger(message.sequence.high))) - return "sequence: integer|Long expected"; - return null; - }; - - /** - * Creates a BaseAccount message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.auth.v1beta1.BaseAccount - * @static - * @param {Object.} object Plain object - * @returns {cosmos.auth.v1beta1.BaseAccount} BaseAccount - */ - BaseAccount.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.auth.v1beta1.BaseAccount) - return object; - let message = new $root.cosmos.auth.v1beta1.BaseAccount(); - if (object.address != null) - message.address = String(object.address); - if (object.pub_key != null) { - if (typeof object.pub_key !== "object") - throw TypeError(".cosmos.auth.v1beta1.BaseAccount.pub_key: object expected"); - message.pub_key = $root.google.protobuf.Any.fromObject(object.pub_key); - } - if (object.account_number != null) - if ($util.Long) - (message.account_number = $util.Long.fromValue(object.account_number)).unsigned = true; - else if (typeof object.account_number === "string") - message.account_number = parseInt(object.account_number, 10); - else if (typeof object.account_number === "number") - message.account_number = object.account_number; - else if (typeof object.account_number === "object") - message.account_number = new $util.LongBits(object.account_number.low >>> 0, object.account_number.high >>> 0).toNumber(true); - if (object.sequence != null) - if ($util.Long) - (message.sequence = $util.Long.fromValue(object.sequence)).unsigned = true; - else if (typeof object.sequence === "string") - message.sequence = parseInt(object.sequence, 10); - else if (typeof object.sequence === "number") - message.sequence = object.sequence; - else if (typeof object.sequence === "object") - message.sequence = new $util.LongBits(object.sequence.low >>> 0, object.sequence.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a BaseAccount message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.auth.v1beta1.BaseAccount - * @static - * @param {cosmos.auth.v1beta1.BaseAccount} message BaseAccount - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BaseAccount.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.address = ""; - object.pub_key = null; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.account_number = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.account_number = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.sequence = options.longs === String ? "0" : 0; - } - if (message.address != null && message.hasOwnProperty("address")) - object.address = message.address; - if (message.pub_key != null && message.hasOwnProperty("pub_key")) - object.pub_key = $root.google.protobuf.Any.toObject(message.pub_key, options); - if (message.account_number != null && message.hasOwnProperty("account_number")) - if (typeof message.account_number === "number") - object.account_number = options.longs === String ? String(message.account_number) : message.account_number; - else - object.account_number = options.longs === String ? $util.Long.prototype.toString.call(message.account_number) : options.longs === Number ? new $util.LongBits(message.account_number.low >>> 0, message.account_number.high >>> 0).toNumber(true) : message.account_number; - if (message.sequence != null && message.hasOwnProperty("sequence")) - if (typeof message.sequence === "number") - object.sequence = options.longs === String ? String(message.sequence) : message.sequence; - else - object.sequence = options.longs === String ? $util.Long.prototype.toString.call(message.sequence) : options.longs === Number ? new $util.LongBits(message.sequence.low >>> 0, message.sequence.high >>> 0).toNumber(true) : message.sequence; - return object; - }; - - /** - * Converts this BaseAccount to JSON. - * @function toJSON - * @memberof cosmos.auth.v1beta1.BaseAccount - * @instance - * @returns {Object.} JSON object - */ - BaseAccount.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return BaseAccount; - })(); - - v1beta1.ModuleAccount = (function() { - - /** - * Properties of a ModuleAccount. - * @memberof cosmos.auth.v1beta1 - * @interface IModuleAccount - * @property {cosmos.auth.v1beta1.IBaseAccount|null} [base_account] ModuleAccount base_account - * @property {string|null} [name] ModuleAccount name - * @property {Array.|null} [permissions] ModuleAccount permissions - */ - - /** - * Constructs a new ModuleAccount. - * @memberof cosmos.auth.v1beta1 - * @classdesc Represents a ModuleAccount. - * @implements IModuleAccount - * @constructor - * @param {cosmos.auth.v1beta1.IModuleAccount=} [properties] Properties to set - */ - function ModuleAccount(properties) { - this.permissions = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ModuleAccount base_account. - * @member {cosmos.auth.v1beta1.IBaseAccount|null|undefined} base_account - * @memberof cosmos.auth.v1beta1.ModuleAccount - * @instance - */ - ModuleAccount.prototype.base_account = null; - - /** - * ModuleAccount name. - * @member {string} name - * @memberof cosmos.auth.v1beta1.ModuleAccount - * @instance - */ - ModuleAccount.prototype.name = ""; - - /** - * ModuleAccount permissions. - * @member {Array.} permissions - * @memberof cosmos.auth.v1beta1.ModuleAccount - * @instance - */ - ModuleAccount.prototype.permissions = $util.emptyArray; - - /** - * Encodes the specified ModuleAccount message. Does not implicitly {@link cosmos.auth.v1beta1.ModuleAccount.verify|verify} messages. - * @function encode - * @memberof cosmos.auth.v1beta1.ModuleAccount - * @static - * @param {cosmos.auth.v1beta1.IModuleAccount} message ModuleAccount message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ModuleAccount.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.base_account != null && Object.hasOwnProperty.call(message, "base_account")) - $root.cosmos.auth.v1beta1.BaseAccount.encode(message.base_account, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.name); - if (message.permissions != null && message.permissions.length) - for (let i = 0; i < message.permissions.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.permissions[i]); - return writer; - }; - - /** - * Encodes the specified ModuleAccount message, length delimited. Does not implicitly {@link cosmos.auth.v1beta1.ModuleAccount.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.auth.v1beta1.ModuleAccount - * @static - * @param {cosmos.auth.v1beta1.IModuleAccount} message ModuleAccount message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ModuleAccount.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ModuleAccount message from the specified reader or buffer. - * @function decode - * @memberof cosmos.auth.v1beta1.ModuleAccount - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.auth.v1beta1.ModuleAccount} ModuleAccount - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ModuleAccount.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.auth.v1beta1.ModuleAccount(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.base_account = $root.cosmos.auth.v1beta1.BaseAccount.decode(reader, reader.uint32()); - break; - case 2: - message.name = reader.string(); - break; - case 3: - if (!(message.permissions && message.permissions.length)) - message.permissions = []; - message.permissions.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ModuleAccount message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.auth.v1beta1.ModuleAccount - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.auth.v1beta1.ModuleAccount} ModuleAccount - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ModuleAccount.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ModuleAccount message. - * @function verify - * @memberof cosmos.auth.v1beta1.ModuleAccount - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ModuleAccount.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.base_account != null && message.hasOwnProperty("base_account")) { - let error = $root.cosmos.auth.v1beta1.BaseAccount.verify(message.base_account); - if (error) - return "base_account." + error; - } - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.permissions != null && message.hasOwnProperty("permissions")) { - if (!Array.isArray(message.permissions)) - return "permissions: array expected"; - for (let i = 0; i < message.permissions.length; ++i) - if (!$util.isString(message.permissions[i])) - return "permissions: string[] expected"; - } - return null; - }; - - /** - * Creates a ModuleAccount message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.auth.v1beta1.ModuleAccount - * @static - * @param {Object.} object Plain object - * @returns {cosmos.auth.v1beta1.ModuleAccount} ModuleAccount - */ - ModuleAccount.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.auth.v1beta1.ModuleAccount) - return object; - let message = new $root.cosmos.auth.v1beta1.ModuleAccount(); - if (object.base_account != null) { - if (typeof object.base_account !== "object") - throw TypeError(".cosmos.auth.v1beta1.ModuleAccount.base_account: object expected"); - message.base_account = $root.cosmos.auth.v1beta1.BaseAccount.fromObject(object.base_account); - } - if (object.name != null) - message.name = String(object.name); - if (object.permissions) { - if (!Array.isArray(object.permissions)) - throw TypeError(".cosmos.auth.v1beta1.ModuleAccount.permissions: array expected"); - message.permissions = []; - for (let i = 0; i < object.permissions.length; ++i) - message.permissions[i] = String(object.permissions[i]); - } - return message; - }; - - /** - * Creates a plain object from a ModuleAccount message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.auth.v1beta1.ModuleAccount - * @static - * @param {cosmos.auth.v1beta1.ModuleAccount} message ModuleAccount - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ModuleAccount.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.permissions = []; - if (options.defaults) { - object.base_account = null; - object.name = ""; - } - if (message.base_account != null && message.hasOwnProperty("base_account")) - object.base_account = $root.cosmos.auth.v1beta1.BaseAccount.toObject(message.base_account, options); - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.permissions && message.permissions.length) { - object.permissions = []; - for (let j = 0; j < message.permissions.length; ++j) - object.permissions[j] = message.permissions[j]; - } - return object; - }; - - /** - * Converts this ModuleAccount to JSON. - * @function toJSON - * @memberof cosmos.auth.v1beta1.ModuleAccount - * @instance - * @returns {Object.} JSON object - */ - ModuleAccount.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ModuleAccount; - })(); - - v1beta1.Params = (function() { - - /** - * Properties of a Params. - * @memberof cosmos.auth.v1beta1 - * @interface IParams - * @property {Long|null} [max_memo_characters] Params max_memo_characters - * @property {Long|null} [tx_sig_limit] Params tx_sig_limit - * @property {Long|null} [tx_size_cost_per_byte] Params tx_size_cost_per_byte - * @property {Long|null} [sig_verify_cost_ed25519] Params sig_verify_cost_ed25519 - * @property {Long|null} [sig_verify_cost_secp256k1] Params sig_verify_cost_secp256k1 - */ - - /** - * Constructs a new Params. - * @memberof cosmos.auth.v1beta1 - * @classdesc Represents a Params. - * @implements IParams - * @constructor - * @param {cosmos.auth.v1beta1.IParams=} [properties] Properties to set - */ - function Params(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Params max_memo_characters. - * @member {Long} max_memo_characters - * @memberof cosmos.auth.v1beta1.Params - * @instance - */ - Params.prototype.max_memo_characters = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Params tx_sig_limit. - * @member {Long} tx_sig_limit - * @memberof cosmos.auth.v1beta1.Params - * @instance - */ - Params.prototype.tx_sig_limit = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Params tx_size_cost_per_byte. - * @member {Long} tx_size_cost_per_byte - * @memberof cosmos.auth.v1beta1.Params - * @instance - */ - Params.prototype.tx_size_cost_per_byte = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Params sig_verify_cost_ed25519. - * @member {Long} sig_verify_cost_ed25519 - * @memberof cosmos.auth.v1beta1.Params - * @instance - */ - Params.prototype.sig_verify_cost_ed25519 = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Params sig_verify_cost_secp256k1. - * @member {Long} sig_verify_cost_secp256k1 - * @memberof cosmos.auth.v1beta1.Params - * @instance - */ - Params.prototype.sig_verify_cost_secp256k1 = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified Params message. Does not implicitly {@link cosmos.auth.v1beta1.Params.verify|verify} messages. - * @function encode - * @memberof cosmos.auth.v1beta1.Params - * @static - * @param {cosmos.auth.v1beta1.IParams} message Params message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Params.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.max_memo_characters != null && Object.hasOwnProperty.call(message, "max_memo_characters")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.max_memo_characters); - if (message.tx_sig_limit != null && Object.hasOwnProperty.call(message, "tx_sig_limit")) - writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.tx_sig_limit); - if (message.tx_size_cost_per_byte != null && Object.hasOwnProperty.call(message, "tx_size_cost_per_byte")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.tx_size_cost_per_byte); - if (message.sig_verify_cost_ed25519 != null && Object.hasOwnProperty.call(message, "sig_verify_cost_ed25519")) - writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.sig_verify_cost_ed25519); - if (message.sig_verify_cost_secp256k1 != null && Object.hasOwnProperty.call(message, "sig_verify_cost_secp256k1")) - writer.uint32(/* id 5, wireType 0 =*/40).uint64(message.sig_verify_cost_secp256k1); - return writer; - }; - - /** - * Encodes the specified Params message, length delimited. Does not implicitly {@link cosmos.auth.v1beta1.Params.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.auth.v1beta1.Params - * @static - * @param {cosmos.auth.v1beta1.IParams} message Params message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Params.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Params message from the specified reader or buffer. - * @function decode - * @memberof cosmos.auth.v1beta1.Params - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.auth.v1beta1.Params} Params - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Params.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.auth.v1beta1.Params(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.max_memo_characters = reader.uint64(); - break; - case 2: - message.tx_sig_limit = reader.uint64(); - break; - case 3: - message.tx_size_cost_per_byte = reader.uint64(); - break; - case 4: - message.sig_verify_cost_ed25519 = reader.uint64(); - break; - case 5: - message.sig_verify_cost_secp256k1 = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Params message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.auth.v1beta1.Params - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.auth.v1beta1.Params} Params - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Params.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Params message. - * @function verify - * @memberof cosmos.auth.v1beta1.Params - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Params.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.max_memo_characters != null && message.hasOwnProperty("max_memo_characters")) - if (!$util.isInteger(message.max_memo_characters) && !(message.max_memo_characters && $util.isInteger(message.max_memo_characters.low) && $util.isInteger(message.max_memo_characters.high))) - return "max_memo_characters: integer|Long expected"; - if (message.tx_sig_limit != null && message.hasOwnProperty("tx_sig_limit")) - if (!$util.isInteger(message.tx_sig_limit) && !(message.tx_sig_limit && $util.isInteger(message.tx_sig_limit.low) && $util.isInteger(message.tx_sig_limit.high))) - return "tx_sig_limit: integer|Long expected"; - if (message.tx_size_cost_per_byte != null && message.hasOwnProperty("tx_size_cost_per_byte")) - if (!$util.isInteger(message.tx_size_cost_per_byte) && !(message.tx_size_cost_per_byte && $util.isInteger(message.tx_size_cost_per_byte.low) && $util.isInteger(message.tx_size_cost_per_byte.high))) - return "tx_size_cost_per_byte: integer|Long expected"; - if (message.sig_verify_cost_ed25519 != null && message.hasOwnProperty("sig_verify_cost_ed25519")) - if (!$util.isInteger(message.sig_verify_cost_ed25519) && !(message.sig_verify_cost_ed25519 && $util.isInteger(message.sig_verify_cost_ed25519.low) && $util.isInteger(message.sig_verify_cost_ed25519.high))) - return "sig_verify_cost_ed25519: integer|Long expected"; - if (message.sig_verify_cost_secp256k1 != null && message.hasOwnProperty("sig_verify_cost_secp256k1")) - if (!$util.isInteger(message.sig_verify_cost_secp256k1) && !(message.sig_verify_cost_secp256k1 && $util.isInteger(message.sig_verify_cost_secp256k1.low) && $util.isInteger(message.sig_verify_cost_secp256k1.high))) - return "sig_verify_cost_secp256k1: integer|Long expected"; - return null; - }; - - /** - * Creates a Params message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.auth.v1beta1.Params - * @static - * @param {Object.} object Plain object - * @returns {cosmos.auth.v1beta1.Params} Params - */ - Params.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.auth.v1beta1.Params) - return object; - let message = new $root.cosmos.auth.v1beta1.Params(); - if (object.max_memo_characters != null) - if ($util.Long) - (message.max_memo_characters = $util.Long.fromValue(object.max_memo_characters)).unsigned = true; - else if (typeof object.max_memo_characters === "string") - message.max_memo_characters = parseInt(object.max_memo_characters, 10); - else if (typeof object.max_memo_characters === "number") - message.max_memo_characters = object.max_memo_characters; - else if (typeof object.max_memo_characters === "object") - message.max_memo_characters = new $util.LongBits(object.max_memo_characters.low >>> 0, object.max_memo_characters.high >>> 0).toNumber(true); - if (object.tx_sig_limit != null) - if ($util.Long) - (message.tx_sig_limit = $util.Long.fromValue(object.tx_sig_limit)).unsigned = true; - else if (typeof object.tx_sig_limit === "string") - message.tx_sig_limit = parseInt(object.tx_sig_limit, 10); - else if (typeof object.tx_sig_limit === "number") - message.tx_sig_limit = object.tx_sig_limit; - else if (typeof object.tx_sig_limit === "object") - message.tx_sig_limit = new $util.LongBits(object.tx_sig_limit.low >>> 0, object.tx_sig_limit.high >>> 0).toNumber(true); - if (object.tx_size_cost_per_byte != null) - if ($util.Long) - (message.tx_size_cost_per_byte = $util.Long.fromValue(object.tx_size_cost_per_byte)).unsigned = true; - else if (typeof object.tx_size_cost_per_byte === "string") - message.tx_size_cost_per_byte = parseInt(object.tx_size_cost_per_byte, 10); - else if (typeof object.tx_size_cost_per_byte === "number") - message.tx_size_cost_per_byte = object.tx_size_cost_per_byte; - else if (typeof object.tx_size_cost_per_byte === "object") - message.tx_size_cost_per_byte = new $util.LongBits(object.tx_size_cost_per_byte.low >>> 0, object.tx_size_cost_per_byte.high >>> 0).toNumber(true); - if (object.sig_verify_cost_ed25519 != null) - if ($util.Long) - (message.sig_verify_cost_ed25519 = $util.Long.fromValue(object.sig_verify_cost_ed25519)).unsigned = true; - else if (typeof object.sig_verify_cost_ed25519 === "string") - message.sig_verify_cost_ed25519 = parseInt(object.sig_verify_cost_ed25519, 10); - else if (typeof object.sig_verify_cost_ed25519 === "number") - message.sig_verify_cost_ed25519 = object.sig_verify_cost_ed25519; - else if (typeof object.sig_verify_cost_ed25519 === "object") - message.sig_verify_cost_ed25519 = new $util.LongBits(object.sig_verify_cost_ed25519.low >>> 0, object.sig_verify_cost_ed25519.high >>> 0).toNumber(true); - if (object.sig_verify_cost_secp256k1 != null) - if ($util.Long) - (message.sig_verify_cost_secp256k1 = $util.Long.fromValue(object.sig_verify_cost_secp256k1)).unsigned = true; - else if (typeof object.sig_verify_cost_secp256k1 === "string") - message.sig_verify_cost_secp256k1 = parseInt(object.sig_verify_cost_secp256k1, 10); - else if (typeof object.sig_verify_cost_secp256k1 === "number") - message.sig_verify_cost_secp256k1 = object.sig_verify_cost_secp256k1; - else if (typeof object.sig_verify_cost_secp256k1 === "object") - message.sig_verify_cost_secp256k1 = new $util.LongBits(object.sig_verify_cost_secp256k1.low >>> 0, object.sig_verify_cost_secp256k1.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a Params message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.auth.v1beta1.Params - * @static - * @param {cosmos.auth.v1beta1.Params} message Params - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Params.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.max_memo_characters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.max_memo_characters = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.tx_sig_limit = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.tx_sig_limit = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.tx_size_cost_per_byte = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.tx_size_cost_per_byte = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.sig_verify_cost_ed25519 = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.sig_verify_cost_ed25519 = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.sig_verify_cost_secp256k1 = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.sig_verify_cost_secp256k1 = options.longs === String ? "0" : 0; - } - if (message.max_memo_characters != null && message.hasOwnProperty("max_memo_characters")) - if (typeof message.max_memo_characters === "number") - object.max_memo_characters = options.longs === String ? String(message.max_memo_characters) : message.max_memo_characters; - else - object.max_memo_characters = options.longs === String ? $util.Long.prototype.toString.call(message.max_memo_characters) : options.longs === Number ? new $util.LongBits(message.max_memo_characters.low >>> 0, message.max_memo_characters.high >>> 0).toNumber(true) : message.max_memo_characters; - if (message.tx_sig_limit != null && message.hasOwnProperty("tx_sig_limit")) - if (typeof message.tx_sig_limit === "number") - object.tx_sig_limit = options.longs === String ? String(message.tx_sig_limit) : message.tx_sig_limit; - else - object.tx_sig_limit = options.longs === String ? $util.Long.prototype.toString.call(message.tx_sig_limit) : options.longs === Number ? new $util.LongBits(message.tx_sig_limit.low >>> 0, message.tx_sig_limit.high >>> 0).toNumber(true) : message.tx_sig_limit; - if (message.tx_size_cost_per_byte != null && message.hasOwnProperty("tx_size_cost_per_byte")) - if (typeof message.tx_size_cost_per_byte === "number") - object.tx_size_cost_per_byte = options.longs === String ? String(message.tx_size_cost_per_byte) : message.tx_size_cost_per_byte; - else - object.tx_size_cost_per_byte = options.longs === String ? $util.Long.prototype.toString.call(message.tx_size_cost_per_byte) : options.longs === Number ? new $util.LongBits(message.tx_size_cost_per_byte.low >>> 0, message.tx_size_cost_per_byte.high >>> 0).toNumber(true) : message.tx_size_cost_per_byte; - if (message.sig_verify_cost_ed25519 != null && message.hasOwnProperty("sig_verify_cost_ed25519")) - if (typeof message.sig_verify_cost_ed25519 === "number") - object.sig_verify_cost_ed25519 = options.longs === String ? String(message.sig_verify_cost_ed25519) : message.sig_verify_cost_ed25519; - else - object.sig_verify_cost_ed25519 = options.longs === String ? $util.Long.prototype.toString.call(message.sig_verify_cost_ed25519) : options.longs === Number ? new $util.LongBits(message.sig_verify_cost_ed25519.low >>> 0, message.sig_verify_cost_ed25519.high >>> 0).toNumber(true) : message.sig_verify_cost_ed25519; - if (message.sig_verify_cost_secp256k1 != null && message.hasOwnProperty("sig_verify_cost_secp256k1")) - if (typeof message.sig_verify_cost_secp256k1 === "number") - object.sig_verify_cost_secp256k1 = options.longs === String ? String(message.sig_verify_cost_secp256k1) : message.sig_verify_cost_secp256k1; - else - object.sig_verify_cost_secp256k1 = options.longs === String ? $util.Long.prototype.toString.call(message.sig_verify_cost_secp256k1) : options.longs === Number ? new $util.LongBits(message.sig_verify_cost_secp256k1.low >>> 0, message.sig_verify_cost_secp256k1.high >>> 0).toNumber(true) : message.sig_verify_cost_secp256k1; - return object; - }; - - /** - * Converts this Params to JSON. - * @function toJSON - * @memberof cosmos.auth.v1beta1.Params - * @instance - * @returns {Object.} JSON object - */ - Params.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Params; - })(); - - return v1beta1; - })(); - - return auth; - })(); - - cosmos.bank = (function() { - - /** - * Namespace bank. - * @memberof cosmos - * @namespace - */ - const bank = {}; - - bank.v1beta1 = (function() { - - /** - * Namespace v1beta1. - * @memberof cosmos.bank - * @namespace - */ - const v1beta1 = {}; - - v1beta1.Msg = (function() { - - /** - * Constructs a new Msg service. - * @memberof cosmos.bank.v1beta1 - * @classdesc Represents a Msg - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function Msg(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Msg.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Msg; - - /** - * Callback as used by {@link cosmos.bank.v1beta1.Msg#send}. - * @memberof cosmos.bank.v1beta1.Msg - * @typedef SendCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.bank.v1beta1.MsgSendResponse} [response] MsgSendResponse - */ - - /** - * Calls Send. - * @function send - * @memberof cosmos.bank.v1beta1.Msg - * @instance - * @param {cosmos.bank.v1beta1.IMsgSend} request MsgSend message or plain object - * @param {cosmos.bank.v1beta1.Msg.SendCallback} callback Node-style callback called with the error, if any, and MsgSendResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.send = function send(request, callback) { - return this.rpcCall(send, $root.cosmos.bank.v1beta1.MsgSend, $root.cosmos.bank.v1beta1.MsgSendResponse, request, callback); - }, "name", { value: "Send" }); - - /** - * Calls Send. - * @function send - * @memberof cosmos.bank.v1beta1.Msg - * @instance - * @param {cosmos.bank.v1beta1.IMsgSend} request MsgSend message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.bank.v1beta1.Msg#multiSend}. - * @memberof cosmos.bank.v1beta1.Msg - * @typedef MultiSendCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.bank.v1beta1.MsgMultiSendResponse} [response] MsgMultiSendResponse - */ - - /** - * Calls MultiSend. - * @function multiSend - * @memberof cosmos.bank.v1beta1.Msg - * @instance - * @param {cosmos.bank.v1beta1.IMsgMultiSend} request MsgMultiSend message or plain object - * @param {cosmos.bank.v1beta1.Msg.MultiSendCallback} callback Node-style callback called with the error, if any, and MsgMultiSendResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.multiSend = function multiSend(request, callback) { - return this.rpcCall(multiSend, $root.cosmos.bank.v1beta1.MsgMultiSend, $root.cosmos.bank.v1beta1.MsgMultiSendResponse, request, callback); - }, "name", { value: "MultiSend" }); - - /** - * Calls MultiSend. - * @function multiSend - * @memberof cosmos.bank.v1beta1.Msg - * @instance - * @param {cosmos.bank.v1beta1.IMsgMultiSend} request MsgMultiSend message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return Msg; - })(); - - v1beta1.MsgSend = (function() { - - /** - * Properties of a MsgSend. - * @memberof cosmos.bank.v1beta1 - * @interface IMsgSend - * @property {string|null} [from_address] MsgSend from_address - * @property {string|null} [to_address] MsgSend to_address - * @property {Array.|null} [amount] MsgSend amount - */ - - /** - * Constructs a new MsgSend. - * @memberof cosmos.bank.v1beta1 - * @classdesc Represents a MsgSend. - * @implements IMsgSend - * @constructor - * @param {cosmos.bank.v1beta1.IMsgSend=} [properties] Properties to set - */ - function MsgSend(properties) { - this.amount = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgSend from_address. - * @member {string} from_address - * @memberof cosmos.bank.v1beta1.MsgSend - * @instance - */ - MsgSend.prototype.from_address = ""; - - /** - * MsgSend to_address. - * @member {string} to_address - * @memberof cosmos.bank.v1beta1.MsgSend - * @instance - */ - MsgSend.prototype.to_address = ""; - - /** - * MsgSend amount. - * @member {Array.} amount - * @memberof cosmos.bank.v1beta1.MsgSend - * @instance - */ - MsgSend.prototype.amount = $util.emptyArray; - - /** - * Encodes the specified MsgSend message. Does not implicitly {@link cosmos.bank.v1beta1.MsgSend.verify|verify} messages. - * @function encode - * @memberof cosmos.bank.v1beta1.MsgSend - * @static - * @param {cosmos.bank.v1beta1.IMsgSend} message MsgSend message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgSend.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.from_address != null && Object.hasOwnProperty.call(message, "from_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.from_address); - if (message.to_address != null && Object.hasOwnProperty.call(message, "to_address")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.to_address); - if (message.amount != null && message.amount.length) - for (let i = 0; i < message.amount.length; ++i) - $root.cosmos.base.v1beta1.Coin.encode(message.amount[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified MsgSend message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.MsgSend.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.bank.v1beta1.MsgSend - * @static - * @param {cosmos.bank.v1beta1.IMsgSend} message MsgSend message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgSend.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgSend message from the specified reader or buffer. - * @function decode - * @memberof cosmos.bank.v1beta1.MsgSend - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.bank.v1beta1.MsgSend} MsgSend - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgSend.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.MsgSend(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.from_address = reader.string(); - break; - case 2: - message.to_address = reader.string(); - break; - case 3: - if (!(message.amount && message.amount.length)) - message.amount = []; - message.amount.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgSend message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.bank.v1beta1.MsgSend - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.bank.v1beta1.MsgSend} MsgSend - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgSend.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgSend message. - * @function verify - * @memberof cosmos.bank.v1beta1.MsgSend - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgSend.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.from_address != null && message.hasOwnProperty("from_address")) - if (!$util.isString(message.from_address)) - return "from_address: string expected"; - if (message.to_address != null && message.hasOwnProperty("to_address")) - if (!$util.isString(message.to_address)) - return "to_address: string expected"; - if (message.amount != null && message.hasOwnProperty("amount")) { - if (!Array.isArray(message.amount)) - return "amount: array expected"; - for (let i = 0; i < message.amount.length; ++i) { - let error = $root.cosmos.base.v1beta1.Coin.verify(message.amount[i]); - if (error) - return "amount." + error; - } - } - return null; - }; - - /** - * Creates a MsgSend message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.bank.v1beta1.MsgSend - * @static - * @param {Object.} object Plain object - * @returns {cosmos.bank.v1beta1.MsgSend} MsgSend - */ - MsgSend.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.bank.v1beta1.MsgSend) - return object; - let message = new $root.cosmos.bank.v1beta1.MsgSend(); - if (object.from_address != null) - message.from_address = String(object.from_address); - if (object.to_address != null) - message.to_address = String(object.to_address); - if (object.amount) { - if (!Array.isArray(object.amount)) - throw TypeError(".cosmos.bank.v1beta1.MsgSend.amount: array expected"); - message.amount = []; - for (let i = 0; i < object.amount.length; ++i) { - if (typeof object.amount[i] !== "object") - throw TypeError(".cosmos.bank.v1beta1.MsgSend.amount: object expected"); - message.amount[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.amount[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a MsgSend message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.bank.v1beta1.MsgSend - * @static - * @param {cosmos.bank.v1beta1.MsgSend} message MsgSend - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgSend.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.amount = []; - if (options.defaults) { - object.from_address = ""; - object.to_address = ""; - } - if (message.from_address != null && message.hasOwnProperty("from_address")) - object.from_address = message.from_address; - if (message.to_address != null && message.hasOwnProperty("to_address")) - object.to_address = message.to_address; - if (message.amount && message.amount.length) { - object.amount = []; - for (let j = 0; j < message.amount.length; ++j) - object.amount[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.amount[j], options); - } - return object; - }; - - /** - * Converts this MsgSend to JSON. - * @function toJSON - * @memberof cosmos.bank.v1beta1.MsgSend - * @instance - * @returns {Object.} JSON object - */ - MsgSend.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgSend; - })(); - - v1beta1.MsgSendResponse = (function() { - - /** - * Properties of a MsgSendResponse. - * @memberof cosmos.bank.v1beta1 - * @interface IMsgSendResponse - */ - - /** - * Constructs a new MsgSendResponse. - * @memberof cosmos.bank.v1beta1 - * @classdesc Represents a MsgSendResponse. - * @implements IMsgSendResponse - * @constructor - * @param {cosmos.bank.v1beta1.IMsgSendResponse=} [properties] Properties to set - */ - function MsgSendResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgSendResponse message. Does not implicitly {@link cosmos.bank.v1beta1.MsgSendResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.bank.v1beta1.MsgSendResponse - * @static - * @param {cosmos.bank.v1beta1.IMsgSendResponse} message MsgSendResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgSendResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgSendResponse message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.MsgSendResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.bank.v1beta1.MsgSendResponse - * @static - * @param {cosmos.bank.v1beta1.IMsgSendResponse} message MsgSendResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgSendResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgSendResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.bank.v1beta1.MsgSendResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.bank.v1beta1.MsgSendResponse} MsgSendResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgSendResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.MsgSendResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgSendResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.bank.v1beta1.MsgSendResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.bank.v1beta1.MsgSendResponse} MsgSendResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgSendResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgSendResponse message. - * @function verify - * @memberof cosmos.bank.v1beta1.MsgSendResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgSendResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgSendResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.bank.v1beta1.MsgSendResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.bank.v1beta1.MsgSendResponse} MsgSendResponse - */ - MsgSendResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.bank.v1beta1.MsgSendResponse) - return object; - return new $root.cosmos.bank.v1beta1.MsgSendResponse(); - }; - - /** - * Creates a plain object from a MsgSendResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.bank.v1beta1.MsgSendResponse - * @static - * @param {cosmos.bank.v1beta1.MsgSendResponse} message MsgSendResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgSendResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgSendResponse to JSON. - * @function toJSON - * @memberof cosmos.bank.v1beta1.MsgSendResponse - * @instance - * @returns {Object.} JSON object - */ - MsgSendResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgSendResponse; - })(); - - v1beta1.MsgMultiSend = (function() { - - /** - * Properties of a MsgMultiSend. - * @memberof cosmos.bank.v1beta1 - * @interface IMsgMultiSend - * @property {Array.|null} [inputs] MsgMultiSend inputs - * @property {Array.|null} [outputs] MsgMultiSend outputs - */ - - /** - * Constructs a new MsgMultiSend. - * @memberof cosmos.bank.v1beta1 - * @classdesc Represents a MsgMultiSend. - * @implements IMsgMultiSend - * @constructor - * @param {cosmos.bank.v1beta1.IMsgMultiSend=} [properties] Properties to set - */ - function MsgMultiSend(properties) { - this.inputs = []; - this.outputs = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgMultiSend inputs. - * @member {Array.} inputs - * @memberof cosmos.bank.v1beta1.MsgMultiSend - * @instance - */ - MsgMultiSend.prototype.inputs = $util.emptyArray; - - /** - * MsgMultiSend outputs. - * @member {Array.} outputs - * @memberof cosmos.bank.v1beta1.MsgMultiSend - * @instance - */ - MsgMultiSend.prototype.outputs = $util.emptyArray; - - /** - * Encodes the specified MsgMultiSend message. Does not implicitly {@link cosmos.bank.v1beta1.MsgMultiSend.verify|verify} messages. - * @function encode - * @memberof cosmos.bank.v1beta1.MsgMultiSend - * @static - * @param {cosmos.bank.v1beta1.IMsgMultiSend} message MsgMultiSend message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgMultiSend.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.inputs != null && message.inputs.length) - for (let i = 0; i < message.inputs.length; ++i) - $root.cosmos.bank.v1beta1.Input.encode(message.inputs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.outputs != null && message.outputs.length) - for (let i = 0; i < message.outputs.length; ++i) - $root.cosmos.bank.v1beta1.Output.encode(message.outputs[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified MsgMultiSend message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.MsgMultiSend.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.bank.v1beta1.MsgMultiSend - * @static - * @param {cosmos.bank.v1beta1.IMsgMultiSend} message MsgMultiSend message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgMultiSend.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgMultiSend message from the specified reader or buffer. - * @function decode - * @memberof cosmos.bank.v1beta1.MsgMultiSend - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.bank.v1beta1.MsgMultiSend} MsgMultiSend - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgMultiSend.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.MsgMultiSend(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.inputs && message.inputs.length)) - message.inputs = []; - message.inputs.push($root.cosmos.bank.v1beta1.Input.decode(reader, reader.uint32())); - break; - case 2: - if (!(message.outputs && message.outputs.length)) - message.outputs = []; - message.outputs.push($root.cosmos.bank.v1beta1.Output.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgMultiSend message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.bank.v1beta1.MsgMultiSend - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.bank.v1beta1.MsgMultiSend} MsgMultiSend - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgMultiSend.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgMultiSend message. - * @function verify - * @memberof cosmos.bank.v1beta1.MsgMultiSend - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgMultiSend.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.inputs != null && message.hasOwnProperty("inputs")) { - if (!Array.isArray(message.inputs)) - return "inputs: array expected"; - for (let i = 0; i < message.inputs.length; ++i) { - let error = $root.cosmos.bank.v1beta1.Input.verify(message.inputs[i]); - if (error) - return "inputs." + error; - } - } - if (message.outputs != null && message.hasOwnProperty("outputs")) { - if (!Array.isArray(message.outputs)) - return "outputs: array expected"; - for (let i = 0; i < message.outputs.length; ++i) { - let error = $root.cosmos.bank.v1beta1.Output.verify(message.outputs[i]); - if (error) - return "outputs." + error; - } - } - return null; - }; - - /** - * Creates a MsgMultiSend message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.bank.v1beta1.MsgMultiSend - * @static - * @param {Object.} object Plain object - * @returns {cosmos.bank.v1beta1.MsgMultiSend} MsgMultiSend - */ - MsgMultiSend.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.bank.v1beta1.MsgMultiSend) - return object; - let message = new $root.cosmos.bank.v1beta1.MsgMultiSend(); - if (object.inputs) { - if (!Array.isArray(object.inputs)) - throw TypeError(".cosmos.bank.v1beta1.MsgMultiSend.inputs: array expected"); - message.inputs = []; - for (let i = 0; i < object.inputs.length; ++i) { - if (typeof object.inputs[i] !== "object") - throw TypeError(".cosmos.bank.v1beta1.MsgMultiSend.inputs: object expected"); - message.inputs[i] = $root.cosmos.bank.v1beta1.Input.fromObject(object.inputs[i]); - } - } - if (object.outputs) { - if (!Array.isArray(object.outputs)) - throw TypeError(".cosmos.bank.v1beta1.MsgMultiSend.outputs: array expected"); - message.outputs = []; - for (let i = 0; i < object.outputs.length; ++i) { - if (typeof object.outputs[i] !== "object") - throw TypeError(".cosmos.bank.v1beta1.MsgMultiSend.outputs: object expected"); - message.outputs[i] = $root.cosmos.bank.v1beta1.Output.fromObject(object.outputs[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a MsgMultiSend message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.bank.v1beta1.MsgMultiSend - * @static - * @param {cosmos.bank.v1beta1.MsgMultiSend} message MsgMultiSend - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgMultiSend.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) { - object.inputs = []; - object.outputs = []; - } - if (message.inputs && message.inputs.length) { - object.inputs = []; - for (let j = 0; j < message.inputs.length; ++j) - object.inputs[j] = $root.cosmos.bank.v1beta1.Input.toObject(message.inputs[j], options); - } - if (message.outputs && message.outputs.length) { - object.outputs = []; - for (let j = 0; j < message.outputs.length; ++j) - object.outputs[j] = $root.cosmos.bank.v1beta1.Output.toObject(message.outputs[j], options); - } - return object; - }; - - /** - * Converts this MsgMultiSend to JSON. - * @function toJSON - * @memberof cosmos.bank.v1beta1.MsgMultiSend - * @instance - * @returns {Object.} JSON object - */ - MsgMultiSend.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgMultiSend; - })(); - - v1beta1.MsgMultiSendResponse = (function() { - - /** - * Properties of a MsgMultiSendResponse. - * @memberof cosmos.bank.v1beta1 - * @interface IMsgMultiSendResponse - */ - - /** - * Constructs a new MsgMultiSendResponse. - * @memberof cosmos.bank.v1beta1 - * @classdesc Represents a MsgMultiSendResponse. - * @implements IMsgMultiSendResponse - * @constructor - * @param {cosmos.bank.v1beta1.IMsgMultiSendResponse=} [properties] Properties to set - */ - function MsgMultiSendResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgMultiSendResponse message. Does not implicitly {@link cosmos.bank.v1beta1.MsgMultiSendResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.bank.v1beta1.MsgMultiSendResponse - * @static - * @param {cosmos.bank.v1beta1.IMsgMultiSendResponse} message MsgMultiSendResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgMultiSendResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgMultiSendResponse message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.MsgMultiSendResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.bank.v1beta1.MsgMultiSendResponse - * @static - * @param {cosmos.bank.v1beta1.IMsgMultiSendResponse} message MsgMultiSendResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgMultiSendResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgMultiSendResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.bank.v1beta1.MsgMultiSendResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.bank.v1beta1.MsgMultiSendResponse} MsgMultiSendResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgMultiSendResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.MsgMultiSendResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgMultiSendResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.bank.v1beta1.MsgMultiSendResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.bank.v1beta1.MsgMultiSendResponse} MsgMultiSendResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgMultiSendResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgMultiSendResponse message. - * @function verify - * @memberof cosmos.bank.v1beta1.MsgMultiSendResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgMultiSendResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgMultiSendResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.bank.v1beta1.MsgMultiSendResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.bank.v1beta1.MsgMultiSendResponse} MsgMultiSendResponse - */ - MsgMultiSendResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.bank.v1beta1.MsgMultiSendResponse) - return object; - return new $root.cosmos.bank.v1beta1.MsgMultiSendResponse(); - }; - - /** - * Creates a plain object from a MsgMultiSendResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.bank.v1beta1.MsgMultiSendResponse - * @static - * @param {cosmos.bank.v1beta1.MsgMultiSendResponse} message MsgMultiSendResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgMultiSendResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgMultiSendResponse to JSON. - * @function toJSON - * @memberof cosmos.bank.v1beta1.MsgMultiSendResponse - * @instance - * @returns {Object.} JSON object - */ - MsgMultiSendResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgMultiSendResponse; - })(); - - v1beta1.Params = (function() { - - /** - * Properties of a Params. - * @memberof cosmos.bank.v1beta1 - * @interface IParams - * @property {Array.|null} [send_enabled] Params send_enabled - * @property {boolean|null} [default_send_enabled] Params default_send_enabled - */ - - /** - * Constructs a new Params. - * @memberof cosmos.bank.v1beta1 - * @classdesc Represents a Params. - * @implements IParams - * @constructor - * @param {cosmos.bank.v1beta1.IParams=} [properties] Properties to set - */ - function Params(properties) { - this.send_enabled = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Params send_enabled. - * @member {Array.} send_enabled - * @memberof cosmos.bank.v1beta1.Params - * @instance - */ - Params.prototype.send_enabled = $util.emptyArray; - - /** - * Params default_send_enabled. - * @member {boolean} default_send_enabled - * @memberof cosmos.bank.v1beta1.Params - * @instance - */ - Params.prototype.default_send_enabled = false; - - /** - * Encodes the specified Params message. Does not implicitly {@link cosmos.bank.v1beta1.Params.verify|verify} messages. - * @function encode - * @memberof cosmos.bank.v1beta1.Params - * @static - * @param {cosmos.bank.v1beta1.IParams} message Params message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Params.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.send_enabled != null && message.send_enabled.length) - for (let i = 0; i < message.send_enabled.length; ++i) - $root.cosmos.bank.v1beta1.SendEnabled.encode(message.send_enabled[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.default_send_enabled != null && Object.hasOwnProperty.call(message, "default_send_enabled")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.default_send_enabled); - return writer; - }; - - /** - * Encodes the specified Params message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.Params.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.bank.v1beta1.Params - * @static - * @param {cosmos.bank.v1beta1.IParams} message Params message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Params.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Params message from the specified reader or buffer. - * @function decode - * @memberof cosmos.bank.v1beta1.Params - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.bank.v1beta1.Params} Params - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Params.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.Params(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.send_enabled && message.send_enabled.length)) - message.send_enabled = []; - message.send_enabled.push($root.cosmos.bank.v1beta1.SendEnabled.decode(reader, reader.uint32())); - break; - case 2: - message.default_send_enabled = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Params message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.bank.v1beta1.Params - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.bank.v1beta1.Params} Params - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Params.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Params message. - * @function verify - * @memberof cosmos.bank.v1beta1.Params - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Params.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.send_enabled != null && message.hasOwnProperty("send_enabled")) { - if (!Array.isArray(message.send_enabled)) - return "send_enabled: array expected"; - for (let i = 0; i < message.send_enabled.length; ++i) { - let error = $root.cosmos.bank.v1beta1.SendEnabled.verify(message.send_enabled[i]); - if (error) - return "send_enabled." + error; - } - } - if (message.default_send_enabled != null && message.hasOwnProperty("default_send_enabled")) - if (typeof message.default_send_enabled !== "boolean") - return "default_send_enabled: boolean expected"; - return null; - }; - - /** - * Creates a Params message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.bank.v1beta1.Params - * @static - * @param {Object.} object Plain object - * @returns {cosmos.bank.v1beta1.Params} Params - */ - Params.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.bank.v1beta1.Params) - return object; - let message = new $root.cosmos.bank.v1beta1.Params(); - if (object.send_enabled) { - if (!Array.isArray(object.send_enabled)) - throw TypeError(".cosmos.bank.v1beta1.Params.send_enabled: array expected"); - message.send_enabled = []; - for (let i = 0; i < object.send_enabled.length; ++i) { - if (typeof object.send_enabled[i] !== "object") - throw TypeError(".cosmos.bank.v1beta1.Params.send_enabled: object expected"); - message.send_enabled[i] = $root.cosmos.bank.v1beta1.SendEnabled.fromObject(object.send_enabled[i]); - } - } - if (object.default_send_enabled != null) - message.default_send_enabled = Boolean(object.default_send_enabled); - return message; - }; - - /** - * Creates a plain object from a Params message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.bank.v1beta1.Params - * @static - * @param {cosmos.bank.v1beta1.Params} message Params - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Params.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.send_enabled = []; - if (options.defaults) - object.default_send_enabled = false; - if (message.send_enabled && message.send_enabled.length) { - object.send_enabled = []; - for (let j = 0; j < message.send_enabled.length; ++j) - object.send_enabled[j] = $root.cosmos.bank.v1beta1.SendEnabled.toObject(message.send_enabled[j], options); - } - if (message.default_send_enabled != null && message.hasOwnProperty("default_send_enabled")) - object.default_send_enabled = message.default_send_enabled; - return object; - }; - - /** - * Converts this Params to JSON. - * @function toJSON - * @memberof cosmos.bank.v1beta1.Params - * @instance - * @returns {Object.} JSON object - */ - Params.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Params; - })(); - - v1beta1.SendEnabled = (function() { - - /** - * Properties of a SendEnabled. - * @memberof cosmos.bank.v1beta1 - * @interface ISendEnabled - * @property {string|null} [denom] SendEnabled denom - * @property {boolean|null} [enabled] SendEnabled enabled - */ - - /** - * Constructs a new SendEnabled. - * @memberof cosmos.bank.v1beta1 - * @classdesc Represents a SendEnabled. - * @implements ISendEnabled - * @constructor - * @param {cosmos.bank.v1beta1.ISendEnabled=} [properties] Properties to set - */ - function SendEnabled(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SendEnabled denom. - * @member {string} denom - * @memberof cosmos.bank.v1beta1.SendEnabled - * @instance - */ - SendEnabled.prototype.denom = ""; - - /** - * SendEnabled enabled. - * @member {boolean} enabled - * @memberof cosmos.bank.v1beta1.SendEnabled - * @instance - */ - SendEnabled.prototype.enabled = false; - - /** - * Encodes the specified SendEnabled message. Does not implicitly {@link cosmos.bank.v1beta1.SendEnabled.verify|verify} messages. - * @function encode - * @memberof cosmos.bank.v1beta1.SendEnabled - * @static - * @param {cosmos.bank.v1beta1.ISendEnabled} message SendEnabled message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SendEnabled.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.denom != null && Object.hasOwnProperty.call(message, "denom")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.denom); - if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.enabled); - return writer; - }; - - /** - * Encodes the specified SendEnabled message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.SendEnabled.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.bank.v1beta1.SendEnabled - * @static - * @param {cosmos.bank.v1beta1.ISendEnabled} message SendEnabled message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SendEnabled.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SendEnabled message from the specified reader or buffer. - * @function decode - * @memberof cosmos.bank.v1beta1.SendEnabled - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.bank.v1beta1.SendEnabled} SendEnabled - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SendEnabled.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.SendEnabled(); - while (reader.pos < end) { - let 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; - }; - - /** - * Decodes a SendEnabled message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.bank.v1beta1.SendEnabled - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.bank.v1beta1.SendEnabled} SendEnabled - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SendEnabled.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SendEnabled message. - * @function verify - * @memberof cosmos.bank.v1beta1.SendEnabled - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SendEnabled.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.denom != null && message.hasOwnProperty("denom")) - if (!$util.isString(message.denom)) - return "denom: string expected"; - if (message.enabled != null && message.hasOwnProperty("enabled")) - if (typeof message.enabled !== "boolean") - return "enabled: boolean expected"; - return null; - }; - - /** - * Creates a SendEnabled message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.bank.v1beta1.SendEnabled - * @static - * @param {Object.} object Plain object - * @returns {cosmos.bank.v1beta1.SendEnabled} SendEnabled - */ - SendEnabled.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.bank.v1beta1.SendEnabled) - return object; - let message = new $root.cosmos.bank.v1beta1.SendEnabled(); - if (object.denom != null) - message.denom = String(object.denom); - if (object.enabled != null) - message.enabled = Boolean(object.enabled); - return message; - }; - - /** - * Creates a plain object from a SendEnabled message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.bank.v1beta1.SendEnabled - * @static - * @param {cosmos.bank.v1beta1.SendEnabled} message SendEnabled - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SendEnabled.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.denom = ""; - object.enabled = false; - } - if (message.denom != null && message.hasOwnProperty("denom")) - object.denom = message.denom; - if (message.enabled != null && message.hasOwnProperty("enabled")) - object.enabled = message.enabled; - return object; - }; - - /** - * Converts this SendEnabled to JSON. - * @function toJSON - * @memberof cosmos.bank.v1beta1.SendEnabled - * @instance - * @returns {Object.} JSON object - */ - SendEnabled.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return SendEnabled; - })(); - - v1beta1.Input = (function() { - - /** - * Properties of an Input. - * @memberof cosmos.bank.v1beta1 - * @interface IInput - * @property {string|null} [address] Input address - * @property {Array.|null} [coins] Input coins - */ - - /** - * Constructs a new Input. - * @memberof cosmos.bank.v1beta1 - * @classdesc Represents an Input. - * @implements IInput - * @constructor - * @param {cosmos.bank.v1beta1.IInput=} [properties] Properties to set - */ - function Input(properties) { - this.coins = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Input address. - * @member {string} address - * @memberof cosmos.bank.v1beta1.Input - * @instance - */ - Input.prototype.address = ""; - - /** - * Input coins. - * @member {Array.} coins - * @memberof cosmos.bank.v1beta1.Input - * @instance - */ - Input.prototype.coins = $util.emptyArray; - - /** - * Encodes the specified Input message. Does not implicitly {@link cosmos.bank.v1beta1.Input.verify|verify} messages. - * @function encode - * @memberof cosmos.bank.v1beta1.Input - * @static - * @param {cosmos.bank.v1beta1.IInput} message Input message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Input.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.address != null && Object.hasOwnProperty.call(message, "address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.address); - if (message.coins != null && message.coins.length) - for (let i = 0; i < message.coins.length; ++i) - $root.cosmos.base.v1beta1.Coin.encode(message.coins[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Input message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.Input.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.bank.v1beta1.Input - * @static - * @param {cosmos.bank.v1beta1.IInput} message Input message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Input.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Input message from the specified reader or buffer. - * @function decode - * @memberof cosmos.bank.v1beta1.Input - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.bank.v1beta1.Input} Input - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Input.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.Input(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.address = reader.string(); - break; - case 2: - if (!(message.coins && message.coins.length)) - message.coins = []; - message.coins.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Input message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.bank.v1beta1.Input - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.bank.v1beta1.Input} Input - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Input.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Input message. - * @function verify - * @memberof cosmos.bank.v1beta1.Input - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Input.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.address != null && message.hasOwnProperty("address")) - if (!$util.isString(message.address)) - return "address: string expected"; - if (message.coins != null && message.hasOwnProperty("coins")) { - if (!Array.isArray(message.coins)) - return "coins: array expected"; - for (let i = 0; i < message.coins.length; ++i) { - let error = $root.cosmos.base.v1beta1.Coin.verify(message.coins[i]); - if (error) - return "coins." + error; - } - } - return null; - }; - - /** - * Creates an Input message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.bank.v1beta1.Input - * @static - * @param {Object.} object Plain object - * @returns {cosmos.bank.v1beta1.Input} Input - */ - Input.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.bank.v1beta1.Input) - return object; - let message = new $root.cosmos.bank.v1beta1.Input(); - if (object.address != null) - message.address = String(object.address); - if (object.coins) { - if (!Array.isArray(object.coins)) - throw TypeError(".cosmos.bank.v1beta1.Input.coins: array expected"); - message.coins = []; - for (let i = 0; i < object.coins.length; ++i) { - if (typeof object.coins[i] !== "object") - throw TypeError(".cosmos.bank.v1beta1.Input.coins: object expected"); - message.coins[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.coins[i]); - } - } - return message; - }; - - /** - * Creates a plain object from an Input message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.bank.v1beta1.Input - * @static - * @param {cosmos.bank.v1beta1.Input} message Input - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Input.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.coins = []; - if (options.defaults) - object.address = ""; - if (message.address != null && message.hasOwnProperty("address")) - object.address = message.address; - if (message.coins && message.coins.length) { - object.coins = []; - for (let j = 0; j < message.coins.length; ++j) - object.coins[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.coins[j], options); - } - return object; - }; - - /** - * Converts this Input to JSON. - * @function toJSON - * @memberof cosmos.bank.v1beta1.Input - * @instance - * @returns {Object.} JSON object - */ - Input.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Input; - })(); - - v1beta1.Output = (function() { - - /** - * Properties of an Output. - * @memberof cosmos.bank.v1beta1 - * @interface IOutput - * @property {string|null} [address] Output address - * @property {Array.|null} [coins] Output coins - */ - - /** - * Constructs a new Output. - * @memberof cosmos.bank.v1beta1 - * @classdesc Represents an Output. - * @implements IOutput - * @constructor - * @param {cosmos.bank.v1beta1.IOutput=} [properties] Properties to set - */ - function Output(properties) { - this.coins = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Output address. - * @member {string} address - * @memberof cosmos.bank.v1beta1.Output - * @instance - */ - Output.prototype.address = ""; - - /** - * Output coins. - * @member {Array.} coins - * @memberof cosmos.bank.v1beta1.Output - * @instance - */ - Output.prototype.coins = $util.emptyArray; - - /** - * Encodes the specified Output message. Does not implicitly {@link cosmos.bank.v1beta1.Output.verify|verify} messages. - * @function encode - * @memberof cosmos.bank.v1beta1.Output - * @static - * @param {cosmos.bank.v1beta1.IOutput} message Output message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Output.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.address != null && Object.hasOwnProperty.call(message, "address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.address); - if (message.coins != null && message.coins.length) - for (let i = 0; i < message.coins.length; ++i) - $root.cosmos.base.v1beta1.Coin.encode(message.coins[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Output message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.Output.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.bank.v1beta1.Output - * @static - * @param {cosmos.bank.v1beta1.IOutput} message Output message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Output.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Output message from the specified reader or buffer. - * @function decode - * @memberof cosmos.bank.v1beta1.Output - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.bank.v1beta1.Output} Output - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Output.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.Output(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.address = reader.string(); - break; - case 2: - if (!(message.coins && message.coins.length)) - message.coins = []; - message.coins.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Output message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.bank.v1beta1.Output - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.bank.v1beta1.Output} Output - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Output.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Output message. - * @function verify - * @memberof cosmos.bank.v1beta1.Output - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Output.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.address != null && message.hasOwnProperty("address")) - if (!$util.isString(message.address)) - return "address: string expected"; - if (message.coins != null && message.hasOwnProperty("coins")) { - if (!Array.isArray(message.coins)) - return "coins: array expected"; - for (let i = 0; i < message.coins.length; ++i) { - let error = $root.cosmos.base.v1beta1.Coin.verify(message.coins[i]); - if (error) - return "coins." + error; - } - } - return null; - }; - - /** - * Creates an Output message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.bank.v1beta1.Output - * @static - * @param {Object.} object Plain object - * @returns {cosmos.bank.v1beta1.Output} Output - */ - Output.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.bank.v1beta1.Output) - return object; - let message = new $root.cosmos.bank.v1beta1.Output(); - if (object.address != null) - message.address = String(object.address); - if (object.coins) { - if (!Array.isArray(object.coins)) - throw TypeError(".cosmos.bank.v1beta1.Output.coins: array expected"); - message.coins = []; - for (let i = 0; i < object.coins.length; ++i) { - if (typeof object.coins[i] !== "object") - throw TypeError(".cosmos.bank.v1beta1.Output.coins: object expected"); - message.coins[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.coins[i]); - } - } - return message; - }; - - /** - * Creates a plain object from an Output message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.bank.v1beta1.Output - * @static - * @param {cosmos.bank.v1beta1.Output} message Output - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Output.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.coins = []; - if (options.defaults) - object.address = ""; - if (message.address != null && message.hasOwnProperty("address")) - object.address = message.address; - if (message.coins && message.coins.length) { - object.coins = []; - for (let j = 0; j < message.coins.length; ++j) - object.coins[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.coins[j], options); - } - return object; - }; - - /** - * Converts this Output to JSON. - * @function toJSON - * @memberof cosmos.bank.v1beta1.Output - * @instance - * @returns {Object.} JSON object - */ - Output.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Output; - })(); - - v1beta1.Supply = (function() { - - /** - * Properties of a Supply. - * @memberof cosmos.bank.v1beta1 - * @interface ISupply - * @property {Array.|null} [total] Supply total - */ - - /** - * Constructs a new Supply. - * @memberof cosmos.bank.v1beta1 - * @classdesc Represents a Supply. - * @implements ISupply - * @constructor - * @param {cosmos.bank.v1beta1.ISupply=} [properties] Properties to set - */ - function Supply(properties) { - this.total = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Supply total. - * @member {Array.} total - * @memberof cosmos.bank.v1beta1.Supply - * @instance - */ - Supply.prototype.total = $util.emptyArray; - - /** - * Encodes the specified Supply message. Does not implicitly {@link cosmos.bank.v1beta1.Supply.verify|verify} messages. - * @function encode - * @memberof cosmos.bank.v1beta1.Supply - * @static - * @param {cosmos.bank.v1beta1.ISupply} message Supply message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Supply.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.total != null && message.total.length) - for (let i = 0; i < message.total.length; ++i) - $root.cosmos.base.v1beta1.Coin.encode(message.total[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Supply message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.Supply.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.bank.v1beta1.Supply - * @static - * @param {cosmos.bank.v1beta1.ISupply} message Supply message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Supply.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Supply message from the specified reader or buffer. - * @function decode - * @memberof cosmos.bank.v1beta1.Supply - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.bank.v1beta1.Supply} Supply - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Supply.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.Supply(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.total && message.total.length)) - message.total = []; - message.total.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Supply message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.bank.v1beta1.Supply - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.bank.v1beta1.Supply} Supply - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Supply.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Supply message. - * @function verify - * @memberof cosmos.bank.v1beta1.Supply - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Supply.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.total != null && message.hasOwnProperty("total")) { - if (!Array.isArray(message.total)) - return "total: array expected"; - for (let i = 0; i < message.total.length; ++i) { - let error = $root.cosmos.base.v1beta1.Coin.verify(message.total[i]); - if (error) - return "total." + error; - } - } - return null; - }; - - /** - * Creates a Supply message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.bank.v1beta1.Supply - * @static - * @param {Object.} object Plain object - * @returns {cosmos.bank.v1beta1.Supply} Supply - */ - Supply.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.bank.v1beta1.Supply) - return object; - let message = new $root.cosmos.bank.v1beta1.Supply(); - if (object.total) { - if (!Array.isArray(object.total)) - throw TypeError(".cosmos.bank.v1beta1.Supply.total: array expected"); - message.total = []; - for (let i = 0; i < object.total.length; ++i) { - if (typeof object.total[i] !== "object") - throw TypeError(".cosmos.bank.v1beta1.Supply.total: object expected"); - message.total[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.total[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a Supply message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.bank.v1beta1.Supply - * @static - * @param {cosmos.bank.v1beta1.Supply} message Supply - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Supply.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.total = []; - if (message.total && message.total.length) { - object.total = []; - for (let j = 0; j < message.total.length; ++j) - object.total[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.total[j], options); - } - return object; - }; - - /** - * Converts this Supply to JSON. - * @function toJSON - * @memberof cosmos.bank.v1beta1.Supply - * @instance - * @returns {Object.} JSON object - */ - Supply.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Supply; - })(); - - v1beta1.DenomUnit = (function() { - - /** - * Properties of a DenomUnit. - * @memberof cosmos.bank.v1beta1 - * @interface IDenomUnit - * @property {string|null} [denom] DenomUnit denom - * @property {number|null} [exponent] DenomUnit exponent - * @property {Array.|null} [aliases] DenomUnit aliases - */ - - /** - * Constructs a new DenomUnit. - * @memberof cosmos.bank.v1beta1 - * @classdesc Represents a DenomUnit. - * @implements IDenomUnit - * @constructor - * @param {cosmos.bank.v1beta1.IDenomUnit=} [properties] Properties to set - */ - function DenomUnit(properties) { - this.aliases = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DenomUnit denom. - * @member {string} denom - * @memberof cosmos.bank.v1beta1.DenomUnit - * @instance - */ - DenomUnit.prototype.denom = ""; - - /** - * DenomUnit exponent. - * @member {number} exponent - * @memberof cosmos.bank.v1beta1.DenomUnit - * @instance - */ - DenomUnit.prototype.exponent = 0; - - /** - * DenomUnit aliases. - * @member {Array.} aliases - * @memberof cosmos.bank.v1beta1.DenomUnit - * @instance - */ - DenomUnit.prototype.aliases = $util.emptyArray; - - /** - * Encodes the specified DenomUnit message. Does not implicitly {@link cosmos.bank.v1beta1.DenomUnit.verify|verify} messages. - * @function encode - * @memberof cosmos.bank.v1beta1.DenomUnit - * @static - * @param {cosmos.bank.v1beta1.IDenomUnit} message DenomUnit message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DenomUnit.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.denom != null && Object.hasOwnProperty.call(message, "denom")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.denom); - if (message.exponent != null && Object.hasOwnProperty.call(message, "exponent")) - writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.exponent); - if (message.aliases != null && message.aliases.length) - for (let i = 0; i < message.aliases.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.aliases[i]); - return writer; - }; - - /** - * Encodes the specified DenomUnit message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.DenomUnit.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.bank.v1beta1.DenomUnit - * @static - * @param {cosmos.bank.v1beta1.IDenomUnit} message DenomUnit message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DenomUnit.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DenomUnit message from the specified reader or buffer. - * @function decode - * @memberof cosmos.bank.v1beta1.DenomUnit - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.bank.v1beta1.DenomUnit} DenomUnit - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DenomUnit.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.DenomUnit(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.denom = reader.string(); - break; - case 2: - message.exponent = reader.uint32(); - break; - case 3: - if (!(message.aliases && message.aliases.length)) - message.aliases = []; - message.aliases.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DenomUnit message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.bank.v1beta1.DenomUnit - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.bank.v1beta1.DenomUnit} DenomUnit - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DenomUnit.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DenomUnit message. - * @function verify - * @memberof cosmos.bank.v1beta1.DenomUnit - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DenomUnit.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.denom != null && message.hasOwnProperty("denom")) - if (!$util.isString(message.denom)) - return "denom: string expected"; - if (message.exponent != null && message.hasOwnProperty("exponent")) - if (!$util.isInteger(message.exponent)) - return "exponent: integer expected"; - if (message.aliases != null && message.hasOwnProperty("aliases")) { - if (!Array.isArray(message.aliases)) - return "aliases: array expected"; - for (let i = 0; i < message.aliases.length; ++i) - if (!$util.isString(message.aliases[i])) - return "aliases: string[] expected"; - } - return null; - }; - - /** - * Creates a DenomUnit message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.bank.v1beta1.DenomUnit - * @static - * @param {Object.} object Plain object - * @returns {cosmos.bank.v1beta1.DenomUnit} DenomUnit - */ - DenomUnit.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.bank.v1beta1.DenomUnit) - return object; - let message = new $root.cosmos.bank.v1beta1.DenomUnit(); - if (object.denom != null) - message.denom = String(object.denom); - if (object.exponent != null) - message.exponent = object.exponent >>> 0; - if (object.aliases) { - if (!Array.isArray(object.aliases)) - throw TypeError(".cosmos.bank.v1beta1.DenomUnit.aliases: array expected"); - message.aliases = []; - for (let i = 0; i < object.aliases.length; ++i) - message.aliases[i] = String(object.aliases[i]); - } - return message; - }; - - /** - * Creates a plain object from a DenomUnit message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.bank.v1beta1.DenomUnit - * @static - * @param {cosmos.bank.v1beta1.DenomUnit} message DenomUnit - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DenomUnit.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.aliases = []; - if (options.defaults) { - object.denom = ""; - object.exponent = 0; - } - if (message.denom != null && message.hasOwnProperty("denom")) - object.denom = message.denom; - if (message.exponent != null && message.hasOwnProperty("exponent")) - object.exponent = message.exponent; - if (message.aliases && message.aliases.length) { - object.aliases = []; - for (let j = 0; j < message.aliases.length; ++j) - object.aliases[j] = message.aliases[j]; - } - return object; - }; - - /** - * Converts this DenomUnit to JSON. - * @function toJSON - * @memberof cosmos.bank.v1beta1.DenomUnit - * @instance - * @returns {Object.} JSON object - */ - DenomUnit.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return DenomUnit; - })(); - - v1beta1.Metadata = (function() { - - /** - * Properties of a Metadata. - * @memberof cosmos.bank.v1beta1 - * @interface IMetadata - * @property {string|null} [description] Metadata description - * @property {Array.|null} [denom_units] Metadata denom_units - * @property {string|null} [base] Metadata base - * @property {string|null} [display] Metadata display - */ - - /** - * Constructs a new Metadata. - * @memberof cosmos.bank.v1beta1 - * @classdesc Represents a Metadata. - * @implements IMetadata - * @constructor - * @param {cosmos.bank.v1beta1.IMetadata=} [properties] Properties to set - */ - function Metadata(properties) { - this.denom_units = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Metadata description. - * @member {string} description - * @memberof cosmos.bank.v1beta1.Metadata - * @instance - */ - Metadata.prototype.description = ""; - - /** - * Metadata denom_units. - * @member {Array.} denom_units - * @memberof cosmos.bank.v1beta1.Metadata - * @instance - */ - Metadata.prototype.denom_units = $util.emptyArray; - - /** - * Metadata base. - * @member {string} base - * @memberof cosmos.bank.v1beta1.Metadata - * @instance - */ - Metadata.prototype.base = ""; - - /** - * Metadata display. - * @member {string} display - * @memberof cosmos.bank.v1beta1.Metadata - * @instance - */ - Metadata.prototype.display = ""; - - /** - * Encodes the specified Metadata message. Does not implicitly {@link cosmos.bank.v1beta1.Metadata.verify|verify} messages. - * @function encode - * @memberof cosmos.bank.v1beta1.Metadata - * @static - * @param {cosmos.bank.v1beta1.IMetadata} message Metadata message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Metadata.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.description); - if (message.denom_units != null && message.denom_units.length) - for (let i = 0; i < message.denom_units.length; ++i) - $root.cosmos.bank.v1beta1.DenomUnit.encode(message.denom_units[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.base != null && Object.hasOwnProperty.call(message, "base")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.base); - if (message.display != null && Object.hasOwnProperty.call(message, "display")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.display); - return writer; - }; - - /** - * Encodes the specified Metadata message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.Metadata.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.bank.v1beta1.Metadata - * @static - * @param {cosmos.bank.v1beta1.IMetadata} message Metadata message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Metadata.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Metadata message from the specified reader or buffer. - * @function decode - * @memberof cosmos.bank.v1beta1.Metadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.bank.v1beta1.Metadata} Metadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Metadata.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.Metadata(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.description = reader.string(); - break; - case 2: - if (!(message.denom_units && message.denom_units.length)) - message.denom_units = []; - message.denom_units.push($root.cosmos.bank.v1beta1.DenomUnit.decode(reader, reader.uint32())); - break; - case 3: - message.base = reader.string(); - break; - case 4: - message.display = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Metadata message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.bank.v1beta1.Metadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.bank.v1beta1.Metadata} Metadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Metadata.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Metadata message. - * @function verify - * @memberof cosmos.bank.v1beta1.Metadata - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Metadata.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - if (message.denom_units != null && message.hasOwnProperty("denom_units")) { - if (!Array.isArray(message.denom_units)) - return "denom_units: array expected"; - for (let i = 0; i < message.denom_units.length; ++i) { - let error = $root.cosmos.bank.v1beta1.DenomUnit.verify(message.denom_units[i]); - if (error) - return "denom_units." + error; - } - } - if (message.base != null && message.hasOwnProperty("base")) - if (!$util.isString(message.base)) - return "base: string expected"; - if (message.display != null && message.hasOwnProperty("display")) - if (!$util.isString(message.display)) - return "display: string expected"; - return null; - }; - - /** - * Creates a Metadata message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.bank.v1beta1.Metadata - * @static - * @param {Object.} object Plain object - * @returns {cosmos.bank.v1beta1.Metadata} Metadata - */ - Metadata.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.bank.v1beta1.Metadata) - return object; - let message = new $root.cosmos.bank.v1beta1.Metadata(); - if (object.description != null) - message.description = String(object.description); - if (object.denom_units) { - if (!Array.isArray(object.denom_units)) - throw TypeError(".cosmos.bank.v1beta1.Metadata.denom_units: array expected"); - message.denom_units = []; - for (let i = 0; i < object.denom_units.length; ++i) { - if (typeof object.denom_units[i] !== "object") - throw TypeError(".cosmos.bank.v1beta1.Metadata.denom_units: object expected"); - message.denom_units[i] = $root.cosmos.bank.v1beta1.DenomUnit.fromObject(object.denom_units[i]); - } - } - if (object.base != null) - message.base = String(object.base); - if (object.display != null) - message.display = String(object.display); - return message; - }; - - /** - * Creates a plain object from a Metadata message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.bank.v1beta1.Metadata - * @static - * @param {cosmos.bank.v1beta1.Metadata} message Metadata - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Metadata.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.denom_units = []; - if (options.defaults) { - object.description = ""; - object.base = ""; - object.display = ""; - } - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - if (message.denom_units && message.denom_units.length) { - object.denom_units = []; - for (let j = 0; j < message.denom_units.length; ++j) - object.denom_units[j] = $root.cosmos.bank.v1beta1.DenomUnit.toObject(message.denom_units[j], options); - } - if (message.base != null && message.hasOwnProperty("base")) - object.base = message.base; - if (message.display != null && message.hasOwnProperty("display")) - object.display = message.display; - return object; - }; - - /** - * Converts this Metadata to JSON. - * @function toJSON - * @memberof cosmos.bank.v1beta1.Metadata - * @instance - * @returns {Object.} JSON object - */ - Metadata.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Metadata; - })(); - - v1beta1.Query = (function() { - - /** - * Constructs a new Query service. - * @memberof cosmos.bank.v1beta1 - * @classdesc Represents a Query - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function Query(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Query.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Query; - - /** - * Callback as used by {@link cosmos.bank.v1beta1.Query#balance}. - * @memberof cosmos.bank.v1beta1.Query - * @typedef BalanceCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.bank.v1beta1.QueryBalanceResponse} [response] QueryBalanceResponse - */ - - /** - * Calls Balance. - * @function balance - * @memberof cosmos.bank.v1beta1.Query - * @instance - * @param {cosmos.bank.v1beta1.IQueryBalanceRequest} request QueryBalanceRequest message or plain object - * @param {cosmos.bank.v1beta1.Query.BalanceCallback} callback Node-style callback called with the error, if any, and QueryBalanceResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.balance = function balance(request, callback) { - return this.rpcCall(balance, $root.cosmos.bank.v1beta1.QueryBalanceRequest, $root.cosmos.bank.v1beta1.QueryBalanceResponse, request, callback); - }, "name", { value: "Balance" }); - - /** - * Calls Balance. - * @function balance - * @memberof cosmos.bank.v1beta1.Query - * @instance - * @param {cosmos.bank.v1beta1.IQueryBalanceRequest} request QueryBalanceRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.bank.v1beta1.Query#allBalances}. - * @memberof cosmos.bank.v1beta1.Query - * @typedef AllBalancesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.bank.v1beta1.QueryAllBalancesResponse} [response] QueryAllBalancesResponse - */ - - /** - * Calls AllBalances. - * @function allBalances - * @memberof cosmos.bank.v1beta1.Query - * @instance - * @param {cosmos.bank.v1beta1.IQueryAllBalancesRequest} request QueryAllBalancesRequest message or plain object - * @param {cosmos.bank.v1beta1.Query.AllBalancesCallback} callback Node-style callback called with the error, if any, and QueryAllBalancesResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.allBalances = function allBalances(request, callback) { - return this.rpcCall(allBalances, $root.cosmos.bank.v1beta1.QueryAllBalancesRequest, $root.cosmos.bank.v1beta1.QueryAllBalancesResponse, request, callback); - }, "name", { value: "AllBalances" }); - - /** - * Calls AllBalances. - * @function allBalances - * @memberof cosmos.bank.v1beta1.Query - * @instance - * @param {cosmos.bank.v1beta1.IQueryAllBalancesRequest} request QueryAllBalancesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.bank.v1beta1.Query#totalSupply}. - * @memberof cosmos.bank.v1beta1.Query - * @typedef TotalSupplyCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.bank.v1beta1.QueryTotalSupplyResponse} [response] QueryTotalSupplyResponse - */ - - /** - * Calls TotalSupply. - * @function totalSupply - * @memberof cosmos.bank.v1beta1.Query - * @instance - * @param {cosmos.bank.v1beta1.IQueryTotalSupplyRequest} request QueryTotalSupplyRequest message or plain object - * @param {cosmos.bank.v1beta1.Query.TotalSupplyCallback} callback Node-style callback called with the error, if any, and QueryTotalSupplyResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.totalSupply = function totalSupply(request, callback) { - return this.rpcCall(totalSupply, $root.cosmos.bank.v1beta1.QueryTotalSupplyRequest, $root.cosmos.bank.v1beta1.QueryTotalSupplyResponse, request, callback); - }, "name", { value: "TotalSupply" }); - - /** - * Calls TotalSupply. - * @function totalSupply - * @memberof cosmos.bank.v1beta1.Query - * @instance - * @param {cosmos.bank.v1beta1.IQueryTotalSupplyRequest} request QueryTotalSupplyRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.bank.v1beta1.Query#supplyOf}. - * @memberof cosmos.bank.v1beta1.Query - * @typedef SupplyOfCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.bank.v1beta1.QuerySupplyOfResponse} [response] QuerySupplyOfResponse - */ - - /** - * Calls SupplyOf. - * @function supplyOf - * @memberof cosmos.bank.v1beta1.Query - * @instance - * @param {cosmos.bank.v1beta1.IQuerySupplyOfRequest} request QuerySupplyOfRequest message or plain object - * @param {cosmos.bank.v1beta1.Query.SupplyOfCallback} callback Node-style callback called with the error, if any, and QuerySupplyOfResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.supplyOf = function supplyOf(request, callback) { - return this.rpcCall(supplyOf, $root.cosmos.bank.v1beta1.QuerySupplyOfRequest, $root.cosmos.bank.v1beta1.QuerySupplyOfResponse, request, callback); - }, "name", { value: "SupplyOf" }); - - /** - * Calls SupplyOf. - * @function supplyOf - * @memberof cosmos.bank.v1beta1.Query - * @instance - * @param {cosmos.bank.v1beta1.IQuerySupplyOfRequest} request QuerySupplyOfRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.bank.v1beta1.Query#params}. - * @memberof cosmos.bank.v1beta1.Query - * @typedef ParamsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.bank.v1beta1.QueryParamsResponse} [response] QueryParamsResponse - */ - - /** - * Calls Params. - * @function params - * @memberof cosmos.bank.v1beta1.Query - * @instance - * @param {cosmos.bank.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object - * @param {cosmos.bank.v1beta1.Query.ParamsCallback} callback Node-style callback called with the error, if any, and QueryParamsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.params = function params(request, callback) { - return this.rpcCall(params, $root.cosmos.bank.v1beta1.QueryParamsRequest, $root.cosmos.bank.v1beta1.QueryParamsResponse, request, callback); - }, "name", { value: "Params" }); - - /** - * Calls Params. - * @function params - * @memberof cosmos.bank.v1beta1.Query - * @instance - * @param {cosmos.bank.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.bank.v1beta1.Query#denomMetadata}. - * @memberof cosmos.bank.v1beta1.Query - * @typedef DenomMetadataCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.bank.v1beta1.QueryDenomMetadataResponse} [response] QueryDenomMetadataResponse - */ - - /** - * Calls DenomMetadata. - * @function denomMetadata - * @memberof cosmos.bank.v1beta1.Query - * @instance - * @param {cosmos.bank.v1beta1.IQueryDenomMetadataRequest} request QueryDenomMetadataRequest message or plain object - * @param {cosmos.bank.v1beta1.Query.DenomMetadataCallback} callback Node-style callback called with the error, if any, and QueryDenomMetadataResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.denomMetadata = function denomMetadata(request, callback) { - return this.rpcCall(denomMetadata, $root.cosmos.bank.v1beta1.QueryDenomMetadataRequest, $root.cosmos.bank.v1beta1.QueryDenomMetadataResponse, request, callback); - }, "name", { value: "DenomMetadata" }); - - /** - * Calls DenomMetadata. - * @function denomMetadata - * @memberof cosmos.bank.v1beta1.Query - * @instance - * @param {cosmos.bank.v1beta1.IQueryDenomMetadataRequest} request QueryDenomMetadataRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.bank.v1beta1.Query#denomsMetadata}. - * @memberof cosmos.bank.v1beta1.Query - * @typedef DenomsMetadataCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.bank.v1beta1.QueryDenomsMetadataResponse} [response] QueryDenomsMetadataResponse - */ - - /** - * Calls DenomsMetadata. - * @function denomsMetadata - * @memberof cosmos.bank.v1beta1.Query - * @instance - * @param {cosmos.bank.v1beta1.IQueryDenomsMetadataRequest} request QueryDenomsMetadataRequest message or plain object - * @param {cosmos.bank.v1beta1.Query.DenomsMetadataCallback} callback Node-style callback called with the error, if any, and QueryDenomsMetadataResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.denomsMetadata = function denomsMetadata(request, callback) { - return this.rpcCall(denomsMetadata, $root.cosmos.bank.v1beta1.QueryDenomsMetadataRequest, $root.cosmos.bank.v1beta1.QueryDenomsMetadataResponse, request, callback); - }, "name", { value: "DenomsMetadata" }); - - /** - * Calls DenomsMetadata. - * @function denomsMetadata - * @memberof cosmos.bank.v1beta1.Query - * @instance - * @param {cosmos.bank.v1beta1.IQueryDenomsMetadataRequest} request QueryDenomsMetadataRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return Query; - })(); - - v1beta1.QueryBalanceRequest = (function() { - - /** - * Properties of a QueryBalanceRequest. - * @memberof cosmos.bank.v1beta1 - * @interface IQueryBalanceRequest - * @property {string|null} [address] QueryBalanceRequest address - * @property {string|null} [denom] QueryBalanceRequest denom - */ - - /** - * Constructs a new QueryBalanceRequest. - * @memberof cosmos.bank.v1beta1 - * @classdesc Represents a QueryBalanceRequest. - * @implements IQueryBalanceRequest - * @constructor - * @param {cosmos.bank.v1beta1.IQueryBalanceRequest=} [properties] Properties to set - */ - function QueryBalanceRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryBalanceRequest address. - * @member {string} address - * @memberof cosmos.bank.v1beta1.QueryBalanceRequest - * @instance - */ - QueryBalanceRequest.prototype.address = ""; - - /** - * QueryBalanceRequest denom. - * @member {string} denom - * @memberof cosmos.bank.v1beta1.QueryBalanceRequest - * @instance - */ - QueryBalanceRequest.prototype.denom = ""; - - /** - * Encodes the specified QueryBalanceRequest message. Does not implicitly {@link cosmos.bank.v1beta1.QueryBalanceRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.bank.v1beta1.QueryBalanceRequest - * @static - * @param {cosmos.bank.v1beta1.IQueryBalanceRequest} message QueryBalanceRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryBalanceRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.address != null && Object.hasOwnProperty.call(message, "address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.address); - if (message.denom != null && Object.hasOwnProperty.call(message, "denom")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.denom); - return writer; - }; - - /** - * Encodes the specified QueryBalanceRequest message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.QueryBalanceRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.bank.v1beta1.QueryBalanceRequest - * @static - * @param {cosmos.bank.v1beta1.IQueryBalanceRequest} message QueryBalanceRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryBalanceRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryBalanceRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.bank.v1beta1.QueryBalanceRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.bank.v1beta1.QueryBalanceRequest} QueryBalanceRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryBalanceRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.QueryBalanceRequest(); - while (reader.pos < end) { - let 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; - }; - - /** - * Decodes a QueryBalanceRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.bank.v1beta1.QueryBalanceRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.bank.v1beta1.QueryBalanceRequest} QueryBalanceRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryBalanceRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryBalanceRequest message. - * @function verify - * @memberof cosmos.bank.v1beta1.QueryBalanceRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryBalanceRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.address != null && message.hasOwnProperty("address")) - if (!$util.isString(message.address)) - return "address: string expected"; - if (message.denom != null && message.hasOwnProperty("denom")) - if (!$util.isString(message.denom)) - return "denom: string expected"; - return null; - }; - - /** - * Creates a QueryBalanceRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.bank.v1beta1.QueryBalanceRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.bank.v1beta1.QueryBalanceRequest} QueryBalanceRequest - */ - QueryBalanceRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.bank.v1beta1.QueryBalanceRequest) - return object; - let message = new $root.cosmos.bank.v1beta1.QueryBalanceRequest(); - if (object.address != null) - message.address = String(object.address); - if (object.denom != null) - message.denom = String(object.denom); - return message; - }; - - /** - * Creates a plain object from a QueryBalanceRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.bank.v1beta1.QueryBalanceRequest - * @static - * @param {cosmos.bank.v1beta1.QueryBalanceRequest} message QueryBalanceRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryBalanceRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.address = ""; - object.denom = ""; - } - if (message.address != null && message.hasOwnProperty("address")) - object.address = message.address; - if (message.denom != null && message.hasOwnProperty("denom")) - object.denom = message.denom; - return object; - }; - - /** - * Converts this QueryBalanceRequest to JSON. - * @function toJSON - * @memberof cosmos.bank.v1beta1.QueryBalanceRequest - * @instance - * @returns {Object.} JSON object - */ - QueryBalanceRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryBalanceRequest; - })(); - - v1beta1.QueryBalanceResponse = (function() { - - /** - * Properties of a QueryBalanceResponse. - * @memberof cosmos.bank.v1beta1 - * @interface IQueryBalanceResponse - * @property {cosmos.base.v1beta1.ICoin|null} [balance] QueryBalanceResponse balance - */ - - /** - * Constructs a new QueryBalanceResponse. - * @memberof cosmos.bank.v1beta1 - * @classdesc Represents a QueryBalanceResponse. - * @implements IQueryBalanceResponse - * @constructor - * @param {cosmos.bank.v1beta1.IQueryBalanceResponse=} [properties] Properties to set - */ - function QueryBalanceResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryBalanceResponse balance. - * @member {cosmos.base.v1beta1.ICoin|null|undefined} balance - * @memberof cosmos.bank.v1beta1.QueryBalanceResponse - * @instance - */ - QueryBalanceResponse.prototype.balance = null; - - /** - * Encodes the specified QueryBalanceResponse message. Does not implicitly {@link cosmos.bank.v1beta1.QueryBalanceResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.bank.v1beta1.QueryBalanceResponse - * @static - * @param {cosmos.bank.v1beta1.IQueryBalanceResponse} message QueryBalanceResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryBalanceResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.balance != null && Object.hasOwnProperty.call(message, "balance")) - $root.cosmos.base.v1beta1.Coin.encode(message.balance, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryBalanceResponse message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.QueryBalanceResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.bank.v1beta1.QueryBalanceResponse - * @static - * @param {cosmos.bank.v1beta1.IQueryBalanceResponse} message QueryBalanceResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryBalanceResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryBalanceResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.bank.v1beta1.QueryBalanceResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.bank.v1beta1.QueryBalanceResponse} QueryBalanceResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryBalanceResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.QueryBalanceResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.balance = $root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryBalanceResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.bank.v1beta1.QueryBalanceResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.bank.v1beta1.QueryBalanceResponse} QueryBalanceResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryBalanceResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryBalanceResponse message. - * @function verify - * @memberof cosmos.bank.v1beta1.QueryBalanceResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryBalanceResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.balance != null && message.hasOwnProperty("balance")) { - let error = $root.cosmos.base.v1beta1.Coin.verify(message.balance); - if (error) - return "balance." + error; - } - return null; - }; - - /** - * Creates a QueryBalanceResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.bank.v1beta1.QueryBalanceResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.bank.v1beta1.QueryBalanceResponse} QueryBalanceResponse - */ - QueryBalanceResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.bank.v1beta1.QueryBalanceResponse) - return object; - let message = new $root.cosmos.bank.v1beta1.QueryBalanceResponse(); - if (object.balance != null) { - if (typeof object.balance !== "object") - throw TypeError(".cosmos.bank.v1beta1.QueryBalanceResponse.balance: object expected"); - message.balance = $root.cosmos.base.v1beta1.Coin.fromObject(object.balance); - } - return message; - }; - - /** - * Creates a plain object from a QueryBalanceResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.bank.v1beta1.QueryBalanceResponse - * @static - * @param {cosmos.bank.v1beta1.QueryBalanceResponse} message QueryBalanceResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryBalanceResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.balance = null; - if (message.balance != null && message.hasOwnProperty("balance")) - object.balance = $root.cosmos.base.v1beta1.Coin.toObject(message.balance, options); - return object; - }; - - /** - * Converts this QueryBalanceResponse to JSON. - * @function toJSON - * @memberof cosmos.bank.v1beta1.QueryBalanceResponse - * @instance - * @returns {Object.} JSON object - */ - QueryBalanceResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryBalanceResponse; - })(); - - v1beta1.QueryAllBalancesRequest = (function() { - - /** - * Properties of a QueryAllBalancesRequest. - * @memberof cosmos.bank.v1beta1 - * @interface IQueryAllBalancesRequest - * @property {string|null} [address] QueryAllBalancesRequest address - * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryAllBalancesRequest pagination - */ - - /** - * Constructs a new QueryAllBalancesRequest. - * @memberof cosmos.bank.v1beta1 - * @classdesc Represents a QueryAllBalancesRequest. - * @implements IQueryAllBalancesRequest - * @constructor - * @param {cosmos.bank.v1beta1.IQueryAllBalancesRequest=} [properties] Properties to set - */ - function QueryAllBalancesRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryAllBalancesRequest address. - * @member {string} address - * @memberof cosmos.bank.v1beta1.QueryAllBalancesRequest - * @instance - */ - QueryAllBalancesRequest.prototype.address = ""; - - /** - * QueryAllBalancesRequest pagination. - * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination - * @memberof cosmos.bank.v1beta1.QueryAllBalancesRequest - * @instance - */ - QueryAllBalancesRequest.prototype.pagination = null; - - /** - * Encodes the specified QueryAllBalancesRequest message. Does not implicitly {@link cosmos.bank.v1beta1.QueryAllBalancesRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.bank.v1beta1.QueryAllBalancesRequest - * @static - * @param {cosmos.bank.v1beta1.IQueryAllBalancesRequest} message QueryAllBalancesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryAllBalancesRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.address != null && Object.hasOwnProperty.call(message, "address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.address); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryAllBalancesRequest message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.QueryAllBalancesRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.bank.v1beta1.QueryAllBalancesRequest - * @static - * @param {cosmos.bank.v1beta1.IQueryAllBalancesRequest} message QueryAllBalancesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryAllBalancesRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryAllBalancesRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.bank.v1beta1.QueryAllBalancesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.bank.v1beta1.QueryAllBalancesRequest} QueryAllBalancesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryAllBalancesRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.QueryAllBalancesRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.address = reader.string(); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryAllBalancesRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.bank.v1beta1.QueryAllBalancesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.bank.v1beta1.QueryAllBalancesRequest} QueryAllBalancesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryAllBalancesRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryAllBalancesRequest message. - * @function verify - * @memberof cosmos.bank.v1beta1.QueryAllBalancesRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryAllBalancesRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.address != null && message.hasOwnProperty("address")) - if (!$util.isString(message.address)) - return "address: string expected"; - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryAllBalancesRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.bank.v1beta1.QueryAllBalancesRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.bank.v1beta1.QueryAllBalancesRequest} QueryAllBalancesRequest - */ - QueryAllBalancesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.bank.v1beta1.QueryAllBalancesRequest) - return object; - let message = new $root.cosmos.bank.v1beta1.QueryAllBalancesRequest(); - if (object.address != null) - message.address = String(object.address); - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.bank.v1beta1.QueryAllBalancesRequest.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryAllBalancesRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.bank.v1beta1.QueryAllBalancesRequest - * @static - * @param {cosmos.bank.v1beta1.QueryAllBalancesRequest} message QueryAllBalancesRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryAllBalancesRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.address = ""; - object.pagination = null; - } - if (message.address != null && message.hasOwnProperty("address")) - object.address = message.address; - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryAllBalancesRequest to JSON. - * @function toJSON - * @memberof cosmos.bank.v1beta1.QueryAllBalancesRequest - * @instance - * @returns {Object.} JSON object - */ - QueryAllBalancesRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryAllBalancesRequest; - })(); - - v1beta1.QueryAllBalancesResponse = (function() { - - /** - * Properties of a QueryAllBalancesResponse. - * @memberof cosmos.bank.v1beta1 - * @interface IQueryAllBalancesResponse - * @property {Array.|null} [balances] QueryAllBalancesResponse balances - * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryAllBalancesResponse pagination - */ - - /** - * Constructs a new QueryAllBalancesResponse. - * @memberof cosmos.bank.v1beta1 - * @classdesc Represents a QueryAllBalancesResponse. - * @implements IQueryAllBalancesResponse - * @constructor - * @param {cosmos.bank.v1beta1.IQueryAllBalancesResponse=} [properties] Properties to set - */ - function QueryAllBalancesResponse(properties) { - this.balances = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryAllBalancesResponse balances. - * @member {Array.} balances - * @memberof cosmos.bank.v1beta1.QueryAllBalancesResponse - * @instance - */ - QueryAllBalancesResponse.prototype.balances = $util.emptyArray; - - /** - * QueryAllBalancesResponse pagination. - * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination - * @memberof cosmos.bank.v1beta1.QueryAllBalancesResponse - * @instance - */ - QueryAllBalancesResponse.prototype.pagination = null; - - /** - * Encodes the specified QueryAllBalancesResponse message. Does not implicitly {@link cosmos.bank.v1beta1.QueryAllBalancesResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.bank.v1beta1.QueryAllBalancesResponse - * @static - * @param {cosmos.bank.v1beta1.IQueryAllBalancesResponse} message QueryAllBalancesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryAllBalancesResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.balances != null && message.balances.length) - for (let i = 0; i < message.balances.length; ++i) - $root.cosmos.base.v1beta1.Coin.encode(message.balances[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryAllBalancesResponse message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.QueryAllBalancesResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.bank.v1beta1.QueryAllBalancesResponse - * @static - * @param {cosmos.bank.v1beta1.IQueryAllBalancesResponse} message QueryAllBalancesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryAllBalancesResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryAllBalancesResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.bank.v1beta1.QueryAllBalancesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.bank.v1beta1.QueryAllBalancesResponse} QueryAllBalancesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryAllBalancesResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.QueryAllBalancesResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.balances && message.balances.length)) - message.balances = []; - message.balances.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryAllBalancesResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.bank.v1beta1.QueryAllBalancesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.bank.v1beta1.QueryAllBalancesResponse} QueryAllBalancesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryAllBalancesResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryAllBalancesResponse message. - * @function verify - * @memberof cosmos.bank.v1beta1.QueryAllBalancesResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryAllBalancesResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.balances != null && message.hasOwnProperty("balances")) { - if (!Array.isArray(message.balances)) - return "balances: array expected"; - for (let i = 0; i < message.balances.length; ++i) { - let error = $root.cosmos.base.v1beta1.Coin.verify(message.balances[i]); - if (error) - return "balances." + error; - } - } - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryAllBalancesResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.bank.v1beta1.QueryAllBalancesResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.bank.v1beta1.QueryAllBalancesResponse} QueryAllBalancesResponse - */ - QueryAllBalancesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.bank.v1beta1.QueryAllBalancesResponse) - return object; - let message = new $root.cosmos.bank.v1beta1.QueryAllBalancesResponse(); - if (object.balances) { - if (!Array.isArray(object.balances)) - throw TypeError(".cosmos.bank.v1beta1.QueryAllBalancesResponse.balances: array expected"); - message.balances = []; - for (let i = 0; i < object.balances.length; ++i) { - if (typeof object.balances[i] !== "object") - throw TypeError(".cosmos.bank.v1beta1.QueryAllBalancesResponse.balances: object expected"); - message.balances[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.balances[i]); - } - } - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.bank.v1beta1.QueryAllBalancesResponse.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryAllBalancesResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.bank.v1beta1.QueryAllBalancesResponse - * @static - * @param {cosmos.bank.v1beta1.QueryAllBalancesResponse} message QueryAllBalancesResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryAllBalancesResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.balances = []; - if (options.defaults) - object.pagination = null; - if (message.balances && message.balances.length) { - object.balances = []; - for (let j = 0; j < message.balances.length; ++j) - object.balances[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.balances[j], options); - } - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryAllBalancesResponse to JSON. - * @function toJSON - * @memberof cosmos.bank.v1beta1.QueryAllBalancesResponse - * @instance - * @returns {Object.} JSON object - */ - QueryAllBalancesResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryAllBalancesResponse; - })(); - - v1beta1.QueryTotalSupplyRequest = (function() { - - /** - * Properties of a QueryTotalSupplyRequest. - * @memberof cosmos.bank.v1beta1 - * @interface IQueryTotalSupplyRequest - */ - - /** - * Constructs a new QueryTotalSupplyRequest. - * @memberof cosmos.bank.v1beta1 - * @classdesc Represents a QueryTotalSupplyRequest. - * @implements IQueryTotalSupplyRequest - * @constructor - * @param {cosmos.bank.v1beta1.IQueryTotalSupplyRequest=} [properties] Properties to set - */ - function QueryTotalSupplyRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified QueryTotalSupplyRequest message. Does not implicitly {@link cosmos.bank.v1beta1.QueryTotalSupplyRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.bank.v1beta1.QueryTotalSupplyRequest - * @static - * @param {cosmos.bank.v1beta1.IQueryTotalSupplyRequest} message QueryTotalSupplyRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryTotalSupplyRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified QueryTotalSupplyRequest message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.QueryTotalSupplyRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.bank.v1beta1.QueryTotalSupplyRequest - * @static - * @param {cosmos.bank.v1beta1.IQueryTotalSupplyRequest} message QueryTotalSupplyRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryTotalSupplyRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryTotalSupplyRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.bank.v1beta1.QueryTotalSupplyRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.bank.v1beta1.QueryTotalSupplyRequest} QueryTotalSupplyRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryTotalSupplyRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.QueryTotalSupplyRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryTotalSupplyRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.bank.v1beta1.QueryTotalSupplyRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.bank.v1beta1.QueryTotalSupplyRequest} QueryTotalSupplyRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryTotalSupplyRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryTotalSupplyRequest message. - * @function verify - * @memberof cosmos.bank.v1beta1.QueryTotalSupplyRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryTotalSupplyRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a QueryTotalSupplyRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.bank.v1beta1.QueryTotalSupplyRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.bank.v1beta1.QueryTotalSupplyRequest} QueryTotalSupplyRequest - */ - QueryTotalSupplyRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.bank.v1beta1.QueryTotalSupplyRequest) - return object; - return new $root.cosmos.bank.v1beta1.QueryTotalSupplyRequest(); - }; - - /** - * Creates a plain object from a QueryTotalSupplyRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.bank.v1beta1.QueryTotalSupplyRequest - * @static - * @param {cosmos.bank.v1beta1.QueryTotalSupplyRequest} message QueryTotalSupplyRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryTotalSupplyRequest.toObject = function toObject() { - return {}; - }; - - /** - * Converts this QueryTotalSupplyRequest to JSON. - * @function toJSON - * @memberof cosmos.bank.v1beta1.QueryTotalSupplyRequest - * @instance - * @returns {Object.} JSON object - */ - QueryTotalSupplyRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryTotalSupplyRequest; - })(); - - v1beta1.QueryTotalSupplyResponse = (function() { - - /** - * Properties of a QueryTotalSupplyResponse. - * @memberof cosmos.bank.v1beta1 - * @interface IQueryTotalSupplyResponse - * @property {Array.|null} [supply] QueryTotalSupplyResponse supply - */ - - /** - * Constructs a new QueryTotalSupplyResponse. - * @memberof cosmos.bank.v1beta1 - * @classdesc Represents a QueryTotalSupplyResponse. - * @implements IQueryTotalSupplyResponse - * @constructor - * @param {cosmos.bank.v1beta1.IQueryTotalSupplyResponse=} [properties] Properties to set - */ - function QueryTotalSupplyResponse(properties) { - this.supply = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryTotalSupplyResponse supply. - * @member {Array.} supply - * @memberof cosmos.bank.v1beta1.QueryTotalSupplyResponse - * @instance - */ - QueryTotalSupplyResponse.prototype.supply = $util.emptyArray; - - /** - * Encodes the specified QueryTotalSupplyResponse message. Does not implicitly {@link cosmos.bank.v1beta1.QueryTotalSupplyResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.bank.v1beta1.QueryTotalSupplyResponse - * @static - * @param {cosmos.bank.v1beta1.IQueryTotalSupplyResponse} message QueryTotalSupplyResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryTotalSupplyResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.supply != null && message.supply.length) - for (let i = 0; i < message.supply.length; ++i) - $root.cosmos.base.v1beta1.Coin.encode(message.supply[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryTotalSupplyResponse message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.QueryTotalSupplyResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.bank.v1beta1.QueryTotalSupplyResponse - * @static - * @param {cosmos.bank.v1beta1.IQueryTotalSupplyResponse} message QueryTotalSupplyResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryTotalSupplyResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryTotalSupplyResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.bank.v1beta1.QueryTotalSupplyResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.bank.v1beta1.QueryTotalSupplyResponse} QueryTotalSupplyResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryTotalSupplyResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.QueryTotalSupplyResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.supply && message.supply.length)) - message.supply = []; - message.supply.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryTotalSupplyResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.bank.v1beta1.QueryTotalSupplyResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.bank.v1beta1.QueryTotalSupplyResponse} QueryTotalSupplyResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryTotalSupplyResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryTotalSupplyResponse message. - * @function verify - * @memberof cosmos.bank.v1beta1.QueryTotalSupplyResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryTotalSupplyResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.supply != null && message.hasOwnProperty("supply")) { - if (!Array.isArray(message.supply)) - return "supply: array expected"; - for (let i = 0; i < message.supply.length; ++i) { - let error = $root.cosmos.base.v1beta1.Coin.verify(message.supply[i]); - if (error) - return "supply." + error; - } - } - return null; - }; - - /** - * Creates a QueryTotalSupplyResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.bank.v1beta1.QueryTotalSupplyResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.bank.v1beta1.QueryTotalSupplyResponse} QueryTotalSupplyResponse - */ - QueryTotalSupplyResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.bank.v1beta1.QueryTotalSupplyResponse) - return object; - let message = new $root.cosmos.bank.v1beta1.QueryTotalSupplyResponse(); - if (object.supply) { - if (!Array.isArray(object.supply)) - throw TypeError(".cosmos.bank.v1beta1.QueryTotalSupplyResponse.supply: array expected"); - message.supply = []; - for (let i = 0; i < object.supply.length; ++i) { - if (typeof object.supply[i] !== "object") - throw TypeError(".cosmos.bank.v1beta1.QueryTotalSupplyResponse.supply: object expected"); - message.supply[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.supply[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a QueryTotalSupplyResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.bank.v1beta1.QueryTotalSupplyResponse - * @static - * @param {cosmos.bank.v1beta1.QueryTotalSupplyResponse} message QueryTotalSupplyResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryTotalSupplyResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.supply = []; - if (message.supply && message.supply.length) { - object.supply = []; - for (let j = 0; j < message.supply.length; ++j) - object.supply[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.supply[j], options); - } - return object; - }; - - /** - * Converts this QueryTotalSupplyResponse to JSON. - * @function toJSON - * @memberof cosmos.bank.v1beta1.QueryTotalSupplyResponse - * @instance - * @returns {Object.} JSON object - */ - QueryTotalSupplyResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryTotalSupplyResponse; - })(); - - v1beta1.QuerySupplyOfRequest = (function() { - - /** - * Properties of a QuerySupplyOfRequest. - * @memberof cosmos.bank.v1beta1 - * @interface IQuerySupplyOfRequest - * @property {string|null} [denom] QuerySupplyOfRequest denom - */ - - /** - * Constructs a new QuerySupplyOfRequest. - * @memberof cosmos.bank.v1beta1 - * @classdesc Represents a QuerySupplyOfRequest. - * @implements IQuerySupplyOfRequest - * @constructor - * @param {cosmos.bank.v1beta1.IQuerySupplyOfRequest=} [properties] Properties to set - */ - function QuerySupplyOfRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QuerySupplyOfRequest denom. - * @member {string} denom - * @memberof cosmos.bank.v1beta1.QuerySupplyOfRequest - * @instance - */ - QuerySupplyOfRequest.prototype.denom = ""; - - /** - * Encodes the specified QuerySupplyOfRequest message. Does not implicitly {@link cosmos.bank.v1beta1.QuerySupplyOfRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.bank.v1beta1.QuerySupplyOfRequest - * @static - * @param {cosmos.bank.v1beta1.IQuerySupplyOfRequest} message QuerySupplyOfRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QuerySupplyOfRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.denom != null && Object.hasOwnProperty.call(message, "denom")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.denom); - return writer; - }; - - /** - * Encodes the specified QuerySupplyOfRequest message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.QuerySupplyOfRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.bank.v1beta1.QuerySupplyOfRequest - * @static - * @param {cosmos.bank.v1beta1.IQuerySupplyOfRequest} message QuerySupplyOfRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QuerySupplyOfRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QuerySupplyOfRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.bank.v1beta1.QuerySupplyOfRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.bank.v1beta1.QuerySupplyOfRequest} QuerySupplyOfRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QuerySupplyOfRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.QuerySupplyOfRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.denom = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QuerySupplyOfRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.bank.v1beta1.QuerySupplyOfRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.bank.v1beta1.QuerySupplyOfRequest} QuerySupplyOfRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QuerySupplyOfRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QuerySupplyOfRequest message. - * @function verify - * @memberof cosmos.bank.v1beta1.QuerySupplyOfRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QuerySupplyOfRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.denom != null && message.hasOwnProperty("denom")) - if (!$util.isString(message.denom)) - return "denom: string expected"; - return null; - }; - - /** - * Creates a QuerySupplyOfRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.bank.v1beta1.QuerySupplyOfRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.bank.v1beta1.QuerySupplyOfRequest} QuerySupplyOfRequest - */ - QuerySupplyOfRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.bank.v1beta1.QuerySupplyOfRequest) - return object; - let message = new $root.cosmos.bank.v1beta1.QuerySupplyOfRequest(); - if (object.denom != null) - message.denom = String(object.denom); - return message; - }; - - /** - * Creates a plain object from a QuerySupplyOfRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.bank.v1beta1.QuerySupplyOfRequest - * @static - * @param {cosmos.bank.v1beta1.QuerySupplyOfRequest} message QuerySupplyOfRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QuerySupplyOfRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.denom = ""; - if (message.denom != null && message.hasOwnProperty("denom")) - object.denom = message.denom; - return object; - }; - - /** - * Converts this QuerySupplyOfRequest to JSON. - * @function toJSON - * @memberof cosmos.bank.v1beta1.QuerySupplyOfRequest - * @instance - * @returns {Object.} JSON object - */ - QuerySupplyOfRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QuerySupplyOfRequest; - })(); - - v1beta1.QuerySupplyOfResponse = (function() { - - /** - * Properties of a QuerySupplyOfResponse. - * @memberof cosmos.bank.v1beta1 - * @interface IQuerySupplyOfResponse - * @property {cosmos.base.v1beta1.ICoin|null} [amount] QuerySupplyOfResponse amount - */ - - /** - * Constructs a new QuerySupplyOfResponse. - * @memberof cosmos.bank.v1beta1 - * @classdesc Represents a QuerySupplyOfResponse. - * @implements IQuerySupplyOfResponse - * @constructor - * @param {cosmos.bank.v1beta1.IQuerySupplyOfResponse=} [properties] Properties to set - */ - function QuerySupplyOfResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QuerySupplyOfResponse amount. - * @member {cosmos.base.v1beta1.ICoin|null|undefined} amount - * @memberof cosmos.bank.v1beta1.QuerySupplyOfResponse - * @instance - */ - QuerySupplyOfResponse.prototype.amount = null; - - /** - * Encodes the specified QuerySupplyOfResponse message. Does not implicitly {@link cosmos.bank.v1beta1.QuerySupplyOfResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.bank.v1beta1.QuerySupplyOfResponse - * @static - * @param {cosmos.bank.v1beta1.IQuerySupplyOfResponse} message QuerySupplyOfResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QuerySupplyOfResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.amount != null && Object.hasOwnProperty.call(message, "amount")) - $root.cosmos.base.v1beta1.Coin.encode(message.amount, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QuerySupplyOfResponse message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.QuerySupplyOfResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.bank.v1beta1.QuerySupplyOfResponse - * @static - * @param {cosmos.bank.v1beta1.IQuerySupplyOfResponse} message QuerySupplyOfResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QuerySupplyOfResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QuerySupplyOfResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.bank.v1beta1.QuerySupplyOfResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.bank.v1beta1.QuerySupplyOfResponse} QuerySupplyOfResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QuerySupplyOfResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.QuerySupplyOfResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.amount = $root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QuerySupplyOfResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.bank.v1beta1.QuerySupplyOfResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.bank.v1beta1.QuerySupplyOfResponse} QuerySupplyOfResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QuerySupplyOfResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QuerySupplyOfResponse message. - * @function verify - * @memberof cosmos.bank.v1beta1.QuerySupplyOfResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QuerySupplyOfResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.amount != null && message.hasOwnProperty("amount")) { - let error = $root.cosmos.base.v1beta1.Coin.verify(message.amount); - if (error) - return "amount." + error; - } - return null; - }; - - /** - * Creates a QuerySupplyOfResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.bank.v1beta1.QuerySupplyOfResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.bank.v1beta1.QuerySupplyOfResponse} QuerySupplyOfResponse - */ - QuerySupplyOfResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.bank.v1beta1.QuerySupplyOfResponse) - return object; - let message = new $root.cosmos.bank.v1beta1.QuerySupplyOfResponse(); - if (object.amount != null) { - if (typeof object.amount !== "object") - throw TypeError(".cosmos.bank.v1beta1.QuerySupplyOfResponse.amount: object expected"); - message.amount = $root.cosmos.base.v1beta1.Coin.fromObject(object.amount); - } - return message; - }; - - /** - * Creates a plain object from a QuerySupplyOfResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.bank.v1beta1.QuerySupplyOfResponse - * @static - * @param {cosmos.bank.v1beta1.QuerySupplyOfResponse} message QuerySupplyOfResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QuerySupplyOfResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.amount = null; - if (message.amount != null && message.hasOwnProperty("amount")) - object.amount = $root.cosmos.base.v1beta1.Coin.toObject(message.amount, options); - return object; - }; - - /** - * Converts this QuerySupplyOfResponse to JSON. - * @function toJSON - * @memberof cosmos.bank.v1beta1.QuerySupplyOfResponse - * @instance - * @returns {Object.} JSON object - */ - QuerySupplyOfResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QuerySupplyOfResponse; - })(); - - v1beta1.QueryParamsRequest = (function() { - - /** - * Properties of a QueryParamsRequest. - * @memberof cosmos.bank.v1beta1 - * @interface IQueryParamsRequest - */ - - /** - * Constructs a new QueryParamsRequest. - * @memberof cosmos.bank.v1beta1 - * @classdesc Represents a QueryParamsRequest. - * @implements IQueryParamsRequest - * @constructor - * @param {cosmos.bank.v1beta1.IQueryParamsRequest=} [properties] Properties to set - */ - function QueryParamsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified QueryParamsRequest message. Does not implicitly {@link cosmos.bank.v1beta1.QueryParamsRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.bank.v1beta1.QueryParamsRequest - * @static - * @param {cosmos.bank.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified QueryParamsRequest message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.QueryParamsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.bank.v1beta1.QueryParamsRequest - * @static - * @param {cosmos.bank.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryParamsRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.bank.v1beta1.QueryParamsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.bank.v1beta1.QueryParamsRequest} QueryParamsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.QueryParamsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryParamsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.bank.v1beta1.QueryParamsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.bank.v1beta1.QueryParamsRequest} QueryParamsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryParamsRequest message. - * @function verify - * @memberof cosmos.bank.v1beta1.QueryParamsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryParamsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a QueryParamsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.bank.v1beta1.QueryParamsRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.bank.v1beta1.QueryParamsRequest} QueryParamsRequest - */ - QueryParamsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.bank.v1beta1.QueryParamsRequest) - return object; - return new $root.cosmos.bank.v1beta1.QueryParamsRequest(); - }; - - /** - * Creates a plain object from a QueryParamsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.bank.v1beta1.QueryParamsRequest - * @static - * @param {cosmos.bank.v1beta1.QueryParamsRequest} message QueryParamsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryParamsRequest.toObject = function toObject() { - return {}; - }; - - /** - * Converts this QueryParamsRequest to JSON. - * @function toJSON - * @memberof cosmos.bank.v1beta1.QueryParamsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryParamsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryParamsRequest; - })(); - - v1beta1.QueryParamsResponse = (function() { - - /** - * Properties of a QueryParamsResponse. - * @memberof cosmos.bank.v1beta1 - * @interface IQueryParamsResponse - * @property {cosmos.bank.v1beta1.IParams|null} [params] QueryParamsResponse params - */ - - /** - * Constructs a new QueryParamsResponse. - * @memberof cosmos.bank.v1beta1 - * @classdesc Represents a QueryParamsResponse. - * @implements IQueryParamsResponse - * @constructor - * @param {cosmos.bank.v1beta1.IQueryParamsResponse=} [properties] Properties to set - */ - function QueryParamsResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryParamsResponse params. - * @member {cosmos.bank.v1beta1.IParams|null|undefined} params - * @memberof cosmos.bank.v1beta1.QueryParamsResponse - * @instance - */ - QueryParamsResponse.prototype.params = null; - - /** - * Encodes the specified QueryParamsResponse message. Does not implicitly {@link cosmos.bank.v1beta1.QueryParamsResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.bank.v1beta1.QueryParamsResponse - * @static - * @param {cosmos.bank.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.params != null && Object.hasOwnProperty.call(message, "params")) - $root.cosmos.bank.v1beta1.Params.encode(message.params, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryParamsResponse message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.QueryParamsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.bank.v1beta1.QueryParamsResponse - * @static - * @param {cosmos.bank.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryParamsResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.bank.v1beta1.QueryParamsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.bank.v1beta1.QueryParamsResponse} QueryParamsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.QueryParamsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.params = $root.cosmos.bank.v1beta1.Params.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryParamsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.bank.v1beta1.QueryParamsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.bank.v1beta1.QueryParamsResponse} QueryParamsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryParamsResponse message. - * @function verify - * @memberof cosmos.bank.v1beta1.QueryParamsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryParamsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.params != null && message.hasOwnProperty("params")) { - let error = $root.cosmos.bank.v1beta1.Params.verify(message.params); - if (error) - return "params." + error; - } - return null; - }; - - /** - * Creates a QueryParamsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.bank.v1beta1.QueryParamsResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.bank.v1beta1.QueryParamsResponse} QueryParamsResponse - */ - QueryParamsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.bank.v1beta1.QueryParamsResponse) - return object; - let message = new $root.cosmos.bank.v1beta1.QueryParamsResponse(); - if (object.params != null) { - if (typeof object.params !== "object") - throw TypeError(".cosmos.bank.v1beta1.QueryParamsResponse.params: object expected"); - message.params = $root.cosmos.bank.v1beta1.Params.fromObject(object.params); - } - return message; - }; - - /** - * Creates a plain object from a QueryParamsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.bank.v1beta1.QueryParamsResponse - * @static - * @param {cosmos.bank.v1beta1.QueryParamsResponse} message QueryParamsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryParamsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.params = null; - if (message.params != null && message.hasOwnProperty("params")) - object.params = $root.cosmos.bank.v1beta1.Params.toObject(message.params, options); - return object; - }; - - /** - * Converts this QueryParamsResponse to JSON. - * @function toJSON - * @memberof cosmos.bank.v1beta1.QueryParamsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryParamsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryParamsResponse; - })(); - - v1beta1.QueryDenomsMetadataRequest = (function() { - - /** - * Properties of a QueryDenomsMetadataRequest. - * @memberof cosmos.bank.v1beta1 - * @interface IQueryDenomsMetadataRequest - * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryDenomsMetadataRequest pagination - */ - - /** - * Constructs a new QueryDenomsMetadataRequest. - * @memberof cosmos.bank.v1beta1 - * @classdesc Represents a QueryDenomsMetadataRequest. - * @implements IQueryDenomsMetadataRequest - * @constructor - * @param {cosmos.bank.v1beta1.IQueryDenomsMetadataRequest=} [properties] Properties to set - */ - function QueryDenomsMetadataRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryDenomsMetadataRequest pagination. - * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination - * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataRequest - * @instance - */ - QueryDenomsMetadataRequest.prototype.pagination = null; - - /** - * Encodes the specified QueryDenomsMetadataRequest message. Does not implicitly {@link cosmos.bank.v1beta1.QueryDenomsMetadataRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataRequest - * @static - * @param {cosmos.bank.v1beta1.IQueryDenomsMetadataRequest} message QueryDenomsMetadataRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDenomsMetadataRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryDenomsMetadataRequest message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.QueryDenomsMetadataRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataRequest - * @static - * @param {cosmos.bank.v1beta1.IQueryDenomsMetadataRequest} message QueryDenomsMetadataRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDenomsMetadataRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryDenomsMetadataRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.bank.v1beta1.QueryDenomsMetadataRequest} QueryDenomsMetadataRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDenomsMetadataRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.QueryDenomsMetadataRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryDenomsMetadataRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.bank.v1beta1.QueryDenomsMetadataRequest} QueryDenomsMetadataRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDenomsMetadataRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryDenomsMetadataRequest message. - * @function verify - * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryDenomsMetadataRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryDenomsMetadataRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.bank.v1beta1.QueryDenomsMetadataRequest} QueryDenomsMetadataRequest - */ - QueryDenomsMetadataRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.bank.v1beta1.QueryDenomsMetadataRequest) - return object; - let message = new $root.cosmos.bank.v1beta1.QueryDenomsMetadataRequest(); - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.bank.v1beta1.QueryDenomsMetadataRequest.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryDenomsMetadataRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataRequest - * @static - * @param {cosmos.bank.v1beta1.QueryDenomsMetadataRequest} message QueryDenomsMetadataRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryDenomsMetadataRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.pagination = null; - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryDenomsMetadataRequest to JSON. - * @function toJSON - * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataRequest - * @instance - * @returns {Object.} JSON object - */ - QueryDenomsMetadataRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryDenomsMetadataRequest; - })(); - - v1beta1.QueryDenomsMetadataResponse = (function() { - - /** - * Properties of a QueryDenomsMetadataResponse. - * @memberof cosmos.bank.v1beta1 - * @interface IQueryDenomsMetadataResponse - * @property {Array.|null} [metadatas] QueryDenomsMetadataResponse metadatas - * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryDenomsMetadataResponse pagination - */ - - /** - * Constructs a new QueryDenomsMetadataResponse. - * @memberof cosmos.bank.v1beta1 - * @classdesc Represents a QueryDenomsMetadataResponse. - * @implements IQueryDenomsMetadataResponse - * @constructor - * @param {cosmos.bank.v1beta1.IQueryDenomsMetadataResponse=} [properties] Properties to set - */ - function QueryDenomsMetadataResponse(properties) { - this.metadatas = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryDenomsMetadataResponse metadatas. - * @member {Array.} metadatas - * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataResponse - * @instance - */ - QueryDenomsMetadataResponse.prototype.metadatas = $util.emptyArray; - - /** - * QueryDenomsMetadataResponse pagination. - * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination - * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataResponse - * @instance - */ - QueryDenomsMetadataResponse.prototype.pagination = null; - - /** - * Encodes the specified QueryDenomsMetadataResponse message. Does not implicitly {@link cosmos.bank.v1beta1.QueryDenomsMetadataResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataResponse - * @static - * @param {cosmos.bank.v1beta1.IQueryDenomsMetadataResponse} message QueryDenomsMetadataResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDenomsMetadataResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.metadatas != null && message.metadatas.length) - for (let i = 0; i < message.metadatas.length; ++i) - $root.cosmos.bank.v1beta1.Metadata.encode(message.metadatas[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryDenomsMetadataResponse message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.QueryDenomsMetadataResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataResponse - * @static - * @param {cosmos.bank.v1beta1.IQueryDenomsMetadataResponse} message QueryDenomsMetadataResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDenomsMetadataResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryDenomsMetadataResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.bank.v1beta1.QueryDenomsMetadataResponse} QueryDenomsMetadataResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDenomsMetadataResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.QueryDenomsMetadataResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.metadatas && message.metadatas.length)) - message.metadatas = []; - message.metadatas.push($root.cosmos.bank.v1beta1.Metadata.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryDenomsMetadataResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.bank.v1beta1.QueryDenomsMetadataResponse} QueryDenomsMetadataResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDenomsMetadataResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryDenomsMetadataResponse message. - * @function verify - * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryDenomsMetadataResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.metadatas != null && message.hasOwnProperty("metadatas")) { - if (!Array.isArray(message.metadatas)) - return "metadatas: array expected"; - for (let i = 0; i < message.metadatas.length; ++i) { - let error = $root.cosmos.bank.v1beta1.Metadata.verify(message.metadatas[i]); - if (error) - return "metadatas." + error; - } - } - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryDenomsMetadataResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.bank.v1beta1.QueryDenomsMetadataResponse} QueryDenomsMetadataResponse - */ - QueryDenomsMetadataResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.bank.v1beta1.QueryDenomsMetadataResponse) - return object; - let message = new $root.cosmos.bank.v1beta1.QueryDenomsMetadataResponse(); - if (object.metadatas) { - if (!Array.isArray(object.metadatas)) - throw TypeError(".cosmos.bank.v1beta1.QueryDenomsMetadataResponse.metadatas: array expected"); - message.metadatas = []; - for (let i = 0; i < object.metadatas.length; ++i) { - if (typeof object.metadatas[i] !== "object") - throw TypeError(".cosmos.bank.v1beta1.QueryDenomsMetadataResponse.metadatas: object expected"); - message.metadatas[i] = $root.cosmos.bank.v1beta1.Metadata.fromObject(object.metadatas[i]); - } - } - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.bank.v1beta1.QueryDenomsMetadataResponse.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryDenomsMetadataResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataResponse - * @static - * @param {cosmos.bank.v1beta1.QueryDenomsMetadataResponse} message QueryDenomsMetadataResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryDenomsMetadataResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.metadatas = []; - if (options.defaults) - object.pagination = null; - if (message.metadatas && message.metadatas.length) { - object.metadatas = []; - for (let j = 0; j < message.metadatas.length; ++j) - object.metadatas[j] = $root.cosmos.bank.v1beta1.Metadata.toObject(message.metadatas[j], options); - } - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryDenomsMetadataResponse to JSON. - * @function toJSON - * @memberof cosmos.bank.v1beta1.QueryDenomsMetadataResponse - * @instance - * @returns {Object.} JSON object - */ - QueryDenomsMetadataResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryDenomsMetadataResponse; - })(); - - v1beta1.QueryDenomMetadataRequest = (function() { - - /** - * Properties of a QueryDenomMetadataRequest. - * @memberof cosmos.bank.v1beta1 - * @interface IQueryDenomMetadataRequest - * @property {string|null} [denom] QueryDenomMetadataRequest denom - */ - - /** - * Constructs a new QueryDenomMetadataRequest. - * @memberof cosmos.bank.v1beta1 - * @classdesc Represents a QueryDenomMetadataRequest. - * @implements IQueryDenomMetadataRequest - * @constructor - * @param {cosmos.bank.v1beta1.IQueryDenomMetadataRequest=} [properties] Properties to set - */ - function QueryDenomMetadataRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryDenomMetadataRequest denom. - * @member {string} denom - * @memberof cosmos.bank.v1beta1.QueryDenomMetadataRequest - * @instance - */ - QueryDenomMetadataRequest.prototype.denom = ""; - - /** - * Encodes the specified QueryDenomMetadataRequest message. Does not implicitly {@link cosmos.bank.v1beta1.QueryDenomMetadataRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.bank.v1beta1.QueryDenomMetadataRequest - * @static - * @param {cosmos.bank.v1beta1.IQueryDenomMetadataRequest} message QueryDenomMetadataRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDenomMetadataRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.denom != null && Object.hasOwnProperty.call(message, "denom")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.denom); - return writer; - }; - - /** - * Encodes the specified QueryDenomMetadataRequest message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.QueryDenomMetadataRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.bank.v1beta1.QueryDenomMetadataRequest - * @static - * @param {cosmos.bank.v1beta1.IQueryDenomMetadataRequest} message QueryDenomMetadataRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDenomMetadataRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryDenomMetadataRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.bank.v1beta1.QueryDenomMetadataRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.bank.v1beta1.QueryDenomMetadataRequest} QueryDenomMetadataRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDenomMetadataRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.QueryDenomMetadataRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.denom = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryDenomMetadataRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.bank.v1beta1.QueryDenomMetadataRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.bank.v1beta1.QueryDenomMetadataRequest} QueryDenomMetadataRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDenomMetadataRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryDenomMetadataRequest message. - * @function verify - * @memberof cosmos.bank.v1beta1.QueryDenomMetadataRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryDenomMetadataRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.denom != null && message.hasOwnProperty("denom")) - if (!$util.isString(message.denom)) - return "denom: string expected"; - return null; - }; - - /** - * Creates a QueryDenomMetadataRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.bank.v1beta1.QueryDenomMetadataRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.bank.v1beta1.QueryDenomMetadataRequest} QueryDenomMetadataRequest - */ - QueryDenomMetadataRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.bank.v1beta1.QueryDenomMetadataRequest) - return object; - let message = new $root.cosmos.bank.v1beta1.QueryDenomMetadataRequest(); - if (object.denom != null) - message.denom = String(object.denom); - return message; - }; - - /** - * Creates a plain object from a QueryDenomMetadataRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.bank.v1beta1.QueryDenomMetadataRequest - * @static - * @param {cosmos.bank.v1beta1.QueryDenomMetadataRequest} message QueryDenomMetadataRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryDenomMetadataRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.denom = ""; - if (message.denom != null && message.hasOwnProperty("denom")) - object.denom = message.denom; - return object; - }; - - /** - * Converts this QueryDenomMetadataRequest to JSON. - * @function toJSON - * @memberof cosmos.bank.v1beta1.QueryDenomMetadataRequest - * @instance - * @returns {Object.} JSON object - */ - QueryDenomMetadataRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryDenomMetadataRequest; - })(); - - v1beta1.QueryDenomMetadataResponse = (function() { - - /** - * Properties of a QueryDenomMetadataResponse. - * @memberof cosmos.bank.v1beta1 - * @interface IQueryDenomMetadataResponse - * @property {cosmos.bank.v1beta1.IMetadata|null} [metadata] QueryDenomMetadataResponse metadata - */ - - /** - * Constructs a new QueryDenomMetadataResponse. - * @memberof cosmos.bank.v1beta1 - * @classdesc Represents a QueryDenomMetadataResponse. - * @implements IQueryDenomMetadataResponse - * @constructor - * @param {cosmos.bank.v1beta1.IQueryDenomMetadataResponse=} [properties] Properties to set - */ - function QueryDenomMetadataResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryDenomMetadataResponse metadata. - * @member {cosmos.bank.v1beta1.IMetadata|null|undefined} metadata - * @memberof cosmos.bank.v1beta1.QueryDenomMetadataResponse - * @instance - */ - QueryDenomMetadataResponse.prototype.metadata = null; - - /** - * Encodes the specified QueryDenomMetadataResponse message. Does not implicitly {@link cosmos.bank.v1beta1.QueryDenomMetadataResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.bank.v1beta1.QueryDenomMetadataResponse - * @static - * @param {cosmos.bank.v1beta1.IQueryDenomMetadataResponse} message QueryDenomMetadataResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDenomMetadataResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - $root.cosmos.bank.v1beta1.Metadata.encode(message.metadata, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryDenomMetadataResponse message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.QueryDenomMetadataResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.bank.v1beta1.QueryDenomMetadataResponse - * @static - * @param {cosmos.bank.v1beta1.IQueryDenomMetadataResponse} message QueryDenomMetadataResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDenomMetadataResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryDenomMetadataResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.bank.v1beta1.QueryDenomMetadataResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.bank.v1beta1.QueryDenomMetadataResponse} QueryDenomMetadataResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDenomMetadataResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.QueryDenomMetadataResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.metadata = $root.cosmos.bank.v1beta1.Metadata.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryDenomMetadataResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.bank.v1beta1.QueryDenomMetadataResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.bank.v1beta1.QueryDenomMetadataResponse} QueryDenomMetadataResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDenomMetadataResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryDenomMetadataResponse message. - * @function verify - * @memberof cosmos.bank.v1beta1.QueryDenomMetadataResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryDenomMetadataResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.metadata != null && message.hasOwnProperty("metadata")) { - let error = $root.cosmos.bank.v1beta1.Metadata.verify(message.metadata); - if (error) - return "metadata." + error; - } - return null; - }; - - /** - * Creates a QueryDenomMetadataResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.bank.v1beta1.QueryDenomMetadataResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.bank.v1beta1.QueryDenomMetadataResponse} QueryDenomMetadataResponse - */ - QueryDenomMetadataResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.bank.v1beta1.QueryDenomMetadataResponse) - return object; - let message = new $root.cosmos.bank.v1beta1.QueryDenomMetadataResponse(); - if (object.metadata != null) { - if (typeof object.metadata !== "object") - throw TypeError(".cosmos.bank.v1beta1.QueryDenomMetadataResponse.metadata: object expected"); - message.metadata = $root.cosmos.bank.v1beta1.Metadata.fromObject(object.metadata); - } - return message; - }; - - /** - * Creates a plain object from a QueryDenomMetadataResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.bank.v1beta1.QueryDenomMetadataResponse - * @static - * @param {cosmos.bank.v1beta1.QueryDenomMetadataResponse} message QueryDenomMetadataResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryDenomMetadataResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.metadata = null; - if (message.metadata != null && message.hasOwnProperty("metadata")) - object.metadata = $root.cosmos.bank.v1beta1.Metadata.toObject(message.metadata, options); - return object; - }; - - /** - * Converts this QueryDenomMetadataResponse to JSON. - * @function toJSON - * @memberof cosmos.bank.v1beta1.QueryDenomMetadataResponse - * @instance - * @returns {Object.} JSON object - */ - QueryDenomMetadataResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryDenomMetadataResponse; - })(); - - v1beta1.GenesisState = (function() { - - /** - * Properties of a GenesisState. - * @memberof cosmos.bank.v1beta1 - * @interface IGenesisState - * @property {cosmos.bank.v1beta1.IParams|null} [params] GenesisState params - * @property {Array.|null} [balances] GenesisState balances - * @property {Array.|null} [supply] GenesisState supply - * @property {Array.|null} [denom_metadata] GenesisState denom_metadata - */ - - /** - * Constructs a new GenesisState. - * @memberof cosmos.bank.v1beta1 - * @classdesc Represents a GenesisState. - * @implements IGenesisState - * @constructor - * @param {cosmos.bank.v1beta1.IGenesisState=} [properties] Properties to set - */ - function GenesisState(properties) { - this.balances = []; - this.supply = []; - this.denom_metadata = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GenesisState params. - * @member {cosmos.bank.v1beta1.IParams|null|undefined} params - * @memberof cosmos.bank.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.params = null; - - /** - * GenesisState balances. - * @member {Array.} balances - * @memberof cosmos.bank.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.balances = $util.emptyArray; - - /** - * GenesisState supply. - * @member {Array.} supply - * @memberof cosmos.bank.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.supply = $util.emptyArray; - - /** - * GenesisState denom_metadata. - * @member {Array.} denom_metadata - * @memberof cosmos.bank.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.denom_metadata = $util.emptyArray; - - /** - * Encodes the specified GenesisState message. Does not implicitly {@link cosmos.bank.v1beta1.GenesisState.verify|verify} messages. - * @function encode - * @memberof cosmos.bank.v1beta1.GenesisState - * @static - * @param {cosmos.bank.v1beta1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.params != null && Object.hasOwnProperty.call(message, "params")) - $root.cosmos.bank.v1beta1.Params.encode(message.params, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.balances != null && message.balances.length) - for (let i = 0; i < message.balances.length; ++i) - $root.cosmos.bank.v1beta1.Balance.encode(message.balances[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.supply != null && message.supply.length) - for (let i = 0; i < message.supply.length; ++i) - $root.cosmos.base.v1beta1.Coin.encode(message.supply[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.denom_metadata != null && message.denom_metadata.length) - for (let i = 0; i < message.denom_metadata.length; ++i) - $root.cosmos.bank.v1beta1.Metadata.encode(message.denom_metadata[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.GenesisState.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.bank.v1beta1.GenesisState - * @static - * @param {cosmos.bank.v1beta1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer. - * @function decode - * @memberof cosmos.bank.v1beta1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.bank.v1beta1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.GenesisState(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.params = $root.cosmos.bank.v1beta1.Params.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.balances && message.balances.length)) - message.balances = []; - message.balances.push($root.cosmos.bank.v1beta1.Balance.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.supply && message.supply.length)) - message.supply = []; - message.supply.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); - break; - case 4: - if (!(message.denom_metadata && message.denom_metadata.length)) - message.denom_metadata = []; - message.denom_metadata.push($root.cosmos.bank.v1beta1.Metadata.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.bank.v1beta1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.bank.v1beta1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GenesisState message. - * @function verify - * @memberof cosmos.bank.v1beta1.GenesisState - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GenesisState.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.params != null && message.hasOwnProperty("params")) { - let error = $root.cosmos.bank.v1beta1.Params.verify(message.params); - if (error) - return "params." + error; - } - if (message.balances != null && message.hasOwnProperty("balances")) { - if (!Array.isArray(message.balances)) - return "balances: array expected"; - for (let i = 0; i < message.balances.length; ++i) { - let error = $root.cosmos.bank.v1beta1.Balance.verify(message.balances[i]); - if (error) - return "balances." + error; - } - } - if (message.supply != null && message.hasOwnProperty("supply")) { - if (!Array.isArray(message.supply)) - return "supply: array expected"; - for (let i = 0; i < message.supply.length; ++i) { - let error = $root.cosmos.base.v1beta1.Coin.verify(message.supply[i]); - if (error) - return "supply." + error; - } - } - if (message.denom_metadata != null && message.hasOwnProperty("denom_metadata")) { - if (!Array.isArray(message.denom_metadata)) - return "denom_metadata: array expected"; - for (let i = 0; i < message.denom_metadata.length; ++i) { - let error = $root.cosmos.bank.v1beta1.Metadata.verify(message.denom_metadata[i]); - if (error) - return "denom_metadata." + error; - } - } - return null; - }; - - /** - * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.bank.v1beta1.GenesisState - * @static - * @param {Object.} object Plain object - * @returns {cosmos.bank.v1beta1.GenesisState} GenesisState - */ - GenesisState.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.bank.v1beta1.GenesisState) - return object; - let message = new $root.cosmos.bank.v1beta1.GenesisState(); - if (object.params != null) { - if (typeof object.params !== "object") - throw TypeError(".cosmos.bank.v1beta1.GenesisState.params: object expected"); - message.params = $root.cosmos.bank.v1beta1.Params.fromObject(object.params); - } - if (object.balances) { - if (!Array.isArray(object.balances)) - throw TypeError(".cosmos.bank.v1beta1.GenesisState.balances: array expected"); - message.balances = []; - for (let i = 0; i < object.balances.length; ++i) { - if (typeof object.balances[i] !== "object") - throw TypeError(".cosmos.bank.v1beta1.GenesisState.balances: object expected"); - message.balances[i] = $root.cosmos.bank.v1beta1.Balance.fromObject(object.balances[i]); - } - } - if (object.supply) { - if (!Array.isArray(object.supply)) - throw TypeError(".cosmos.bank.v1beta1.GenesisState.supply: array expected"); - message.supply = []; - for (let i = 0; i < object.supply.length; ++i) { - if (typeof object.supply[i] !== "object") - throw TypeError(".cosmos.bank.v1beta1.GenesisState.supply: object expected"); - message.supply[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.supply[i]); - } - } - if (object.denom_metadata) { - if (!Array.isArray(object.denom_metadata)) - throw TypeError(".cosmos.bank.v1beta1.GenesisState.denom_metadata: array expected"); - message.denom_metadata = []; - for (let i = 0; i < object.denom_metadata.length; ++i) { - if (typeof object.denom_metadata[i] !== "object") - throw TypeError(".cosmos.bank.v1beta1.GenesisState.denom_metadata: object expected"); - message.denom_metadata[i] = $root.cosmos.bank.v1beta1.Metadata.fromObject(object.denom_metadata[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a GenesisState message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.bank.v1beta1.GenesisState - * @static - * @param {cosmos.bank.v1beta1.GenesisState} message GenesisState - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GenesisState.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) { - object.balances = []; - object.supply = []; - object.denom_metadata = []; - } - if (options.defaults) - object.params = null; - if (message.params != null && message.hasOwnProperty("params")) - object.params = $root.cosmos.bank.v1beta1.Params.toObject(message.params, options); - if (message.balances && message.balances.length) { - object.balances = []; - for (let j = 0; j < message.balances.length; ++j) - object.balances[j] = $root.cosmos.bank.v1beta1.Balance.toObject(message.balances[j], options); - } - if (message.supply && message.supply.length) { - object.supply = []; - for (let j = 0; j < message.supply.length; ++j) - object.supply[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.supply[j], options); - } - if (message.denom_metadata && message.denom_metadata.length) { - object.denom_metadata = []; - for (let j = 0; j < message.denom_metadata.length; ++j) - object.denom_metadata[j] = $root.cosmos.bank.v1beta1.Metadata.toObject(message.denom_metadata[j], options); - } - return object; - }; - - /** - * Converts this GenesisState to JSON. - * @function toJSON - * @memberof cosmos.bank.v1beta1.GenesisState - * @instance - * @returns {Object.} JSON object - */ - GenesisState.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GenesisState; - })(); - - v1beta1.Balance = (function() { - - /** - * Properties of a Balance. - * @memberof cosmos.bank.v1beta1 - * @interface IBalance - * @property {string|null} [address] Balance address - * @property {Array.|null} [coins] Balance coins - */ - - /** - * Constructs a new Balance. - * @memberof cosmos.bank.v1beta1 - * @classdesc Represents a Balance. - * @implements IBalance - * @constructor - * @param {cosmos.bank.v1beta1.IBalance=} [properties] Properties to set - */ - function Balance(properties) { - this.coins = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Balance address. - * @member {string} address - * @memberof cosmos.bank.v1beta1.Balance - * @instance - */ - Balance.prototype.address = ""; - - /** - * Balance coins. - * @member {Array.} coins - * @memberof cosmos.bank.v1beta1.Balance - * @instance - */ - Balance.prototype.coins = $util.emptyArray; - - /** - * Encodes the specified Balance message. Does not implicitly {@link cosmos.bank.v1beta1.Balance.verify|verify} messages. - * @function encode - * @memberof cosmos.bank.v1beta1.Balance - * @static - * @param {cosmos.bank.v1beta1.IBalance} message Balance message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Balance.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.address != null && Object.hasOwnProperty.call(message, "address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.address); - if (message.coins != null && message.coins.length) - for (let i = 0; i < message.coins.length; ++i) - $root.cosmos.base.v1beta1.Coin.encode(message.coins[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Balance message, length delimited. Does not implicitly {@link cosmos.bank.v1beta1.Balance.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.bank.v1beta1.Balance - * @static - * @param {cosmos.bank.v1beta1.IBalance} message Balance message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Balance.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Balance message from the specified reader or buffer. - * @function decode - * @memberof cosmos.bank.v1beta1.Balance - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.bank.v1beta1.Balance} Balance - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Balance.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.bank.v1beta1.Balance(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.address = reader.string(); - break; - case 2: - if (!(message.coins && message.coins.length)) - message.coins = []; - message.coins.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Balance message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.bank.v1beta1.Balance - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.bank.v1beta1.Balance} Balance - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Balance.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Balance message. - * @function verify - * @memberof cosmos.bank.v1beta1.Balance - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Balance.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.address != null && message.hasOwnProperty("address")) - if (!$util.isString(message.address)) - return "address: string expected"; - if (message.coins != null && message.hasOwnProperty("coins")) { - if (!Array.isArray(message.coins)) - return "coins: array expected"; - for (let i = 0; i < message.coins.length; ++i) { - let error = $root.cosmos.base.v1beta1.Coin.verify(message.coins[i]); - if (error) - return "coins." + error; - } - } - return null; - }; - - /** - * Creates a Balance message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.bank.v1beta1.Balance - * @static - * @param {Object.} object Plain object - * @returns {cosmos.bank.v1beta1.Balance} Balance - */ - Balance.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.bank.v1beta1.Balance) - return object; - let message = new $root.cosmos.bank.v1beta1.Balance(); - if (object.address != null) - message.address = String(object.address); - if (object.coins) { - if (!Array.isArray(object.coins)) - throw TypeError(".cosmos.bank.v1beta1.Balance.coins: array expected"); - message.coins = []; - for (let i = 0; i < object.coins.length; ++i) { - if (typeof object.coins[i] !== "object") - throw TypeError(".cosmos.bank.v1beta1.Balance.coins: object expected"); - message.coins[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.coins[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a Balance message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.bank.v1beta1.Balance - * @static - * @param {cosmos.bank.v1beta1.Balance} message Balance - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Balance.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.coins = []; - if (options.defaults) - object.address = ""; - if (message.address != null && message.hasOwnProperty("address")) - object.address = message.address; - if (message.coins && message.coins.length) { - object.coins = []; - for (let j = 0; j < message.coins.length; ++j) - object.coins[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.coins[j], options); - } - return object; - }; - - /** - * Converts this Balance to JSON. - * @function toJSON - * @memberof cosmos.bank.v1beta1.Balance - * @instance - * @returns {Object.} JSON object - */ - Balance.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Balance; - })(); - - return v1beta1; - })(); - - return bank; - })(); - - cosmos.base = (function() { - - /** - * Namespace base. - * @memberof cosmos - * @namespace - */ - const base = {}; - - base.abci = (function() { - - /** - * Namespace abci. - * @memberof cosmos.base - * @namespace - */ - const abci = {}; - - abci.v1beta1 = (function() { - - /** - * Namespace v1beta1. - * @memberof cosmos.base.abci - * @namespace - */ - const v1beta1 = {}; - - v1beta1.TxResponse = (function() { - - /** - * Properties of a TxResponse. - * @memberof cosmos.base.abci.v1beta1 - * @interface ITxResponse - * @property {Long|null} [height] TxResponse height - * @property {string|null} [txhash] TxResponse txhash - * @property {string|null} [codespace] TxResponse codespace - * @property {number|null} [code] TxResponse code - * @property {string|null} [data] TxResponse data - * @property {string|null} [raw_log] TxResponse raw_log - * @property {Array.|null} [logs] TxResponse logs - * @property {string|null} [info] TxResponse info - * @property {Long|null} [gas_wanted] TxResponse gas_wanted - * @property {Long|null} [gas_used] TxResponse gas_used - * @property {google.protobuf.IAny|null} [tx] TxResponse tx - * @property {string|null} [timestamp] TxResponse timestamp - */ - - /** - * Constructs a new TxResponse. - * @memberof cosmos.base.abci.v1beta1 - * @classdesc Represents a TxResponse. - * @implements ITxResponse - * @constructor - * @param {cosmos.base.abci.v1beta1.ITxResponse=} [properties] Properties to set - */ - function TxResponse(properties) { - this.logs = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * TxResponse height. - * @member {Long} height - * @memberof cosmos.base.abci.v1beta1.TxResponse - * @instance - */ - TxResponse.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * TxResponse txhash. - * @member {string} txhash - * @memberof cosmos.base.abci.v1beta1.TxResponse - * @instance - */ - TxResponse.prototype.txhash = ""; - - /** - * TxResponse codespace. - * @member {string} codespace - * @memberof cosmos.base.abci.v1beta1.TxResponse - * @instance - */ - TxResponse.prototype.codespace = ""; - - /** - * TxResponse code. - * @member {number} code - * @memberof cosmos.base.abci.v1beta1.TxResponse - * @instance - */ - TxResponse.prototype.code = 0; - - /** - * TxResponse data. - * @member {string} data - * @memberof cosmos.base.abci.v1beta1.TxResponse - * @instance - */ - TxResponse.prototype.data = ""; - - /** - * TxResponse raw_log. - * @member {string} raw_log - * @memberof cosmos.base.abci.v1beta1.TxResponse - * @instance - */ - TxResponse.prototype.raw_log = ""; - - /** - * TxResponse logs. - * @member {Array.} logs - * @memberof cosmos.base.abci.v1beta1.TxResponse - * @instance - */ - TxResponse.prototype.logs = $util.emptyArray; - - /** - * TxResponse info. - * @member {string} info - * @memberof cosmos.base.abci.v1beta1.TxResponse - * @instance - */ - TxResponse.prototype.info = ""; - - /** - * TxResponse gas_wanted. - * @member {Long} gas_wanted - * @memberof cosmos.base.abci.v1beta1.TxResponse - * @instance - */ - TxResponse.prototype.gas_wanted = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * TxResponse gas_used. - * @member {Long} gas_used - * @memberof cosmos.base.abci.v1beta1.TxResponse - * @instance - */ - TxResponse.prototype.gas_used = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * TxResponse tx. - * @member {google.protobuf.IAny|null|undefined} tx - * @memberof cosmos.base.abci.v1beta1.TxResponse - * @instance - */ - TxResponse.prototype.tx = null; - - /** - * TxResponse timestamp. - * @member {string} timestamp - * @memberof cosmos.base.abci.v1beta1.TxResponse - * @instance - */ - TxResponse.prototype.timestamp = ""; - - /** - * Encodes the specified TxResponse message. Does not implicitly {@link cosmos.base.abci.v1beta1.TxResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.base.abci.v1beta1.TxResponse - * @static - * @param {cosmos.base.abci.v1beta1.ITxResponse} message TxResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TxResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.height); - if (message.txhash != null && Object.hasOwnProperty.call(message, "txhash")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.txhash); - if (message.codespace != null && Object.hasOwnProperty.call(message, "codespace")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.codespace); - if (message.code != null && Object.hasOwnProperty.call(message, "code")) - writer.uint32(/* id 4, wireType 0 =*/32).uint32(message.code); - if (message.data != null && Object.hasOwnProperty.call(message, "data")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.data); - if (message.raw_log != null && Object.hasOwnProperty.call(message, "raw_log")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.raw_log); - if (message.logs != null && message.logs.length) - for (let i = 0; i < message.logs.length; ++i) - $root.cosmos.base.abci.v1beta1.ABCIMessageLog.encode(message.logs[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.info != null && Object.hasOwnProperty.call(message, "info")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.info); - if (message.gas_wanted != null && Object.hasOwnProperty.call(message, "gas_wanted")) - writer.uint32(/* id 9, wireType 0 =*/72).int64(message.gas_wanted); - if (message.gas_used != null && Object.hasOwnProperty.call(message, "gas_used")) - writer.uint32(/* id 10, wireType 0 =*/80).int64(message.gas_used); - if (message.tx != null && Object.hasOwnProperty.call(message, "tx")) - $root.google.protobuf.Any.encode(message.tx, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) - writer.uint32(/* id 12, wireType 2 =*/98).string(message.timestamp); - return writer; - }; - - /** - * Encodes the specified TxResponse message, length delimited. Does not implicitly {@link cosmos.base.abci.v1beta1.TxResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.abci.v1beta1.TxResponse - * @static - * @param {cosmos.base.abci.v1beta1.ITxResponse} message TxResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TxResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TxResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.abci.v1beta1.TxResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.abci.v1beta1.TxResponse} TxResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TxResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.abci.v1beta1.TxResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.height = reader.int64(); - break; - case 2: - message.txhash = reader.string(); - break; - case 3: - message.codespace = reader.string(); - break; - case 4: - message.code = reader.uint32(); - break; - case 5: - message.data = reader.string(); - break; - case 6: - message.raw_log = reader.string(); - break; - case 7: - if (!(message.logs && message.logs.length)) - message.logs = []; - message.logs.push($root.cosmos.base.abci.v1beta1.ABCIMessageLog.decode(reader, reader.uint32())); - break; - case 8: - message.info = reader.string(); - break; - case 9: - message.gas_wanted = reader.int64(); - break; - case 10: - message.gas_used = reader.int64(); - break; - case 11: - message.tx = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - case 12: - message.timestamp = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a TxResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.abci.v1beta1.TxResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.abci.v1beta1.TxResponse} TxResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TxResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TxResponse message. - * @function verify - * @memberof cosmos.base.abci.v1beta1.TxResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TxResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) - return "height: integer|Long expected"; - if (message.txhash != null && message.hasOwnProperty("txhash")) - if (!$util.isString(message.txhash)) - return "txhash: string expected"; - if (message.codespace != null && message.hasOwnProperty("codespace")) - if (!$util.isString(message.codespace)) - return "codespace: string expected"; - if (message.code != null && message.hasOwnProperty("code")) - if (!$util.isInteger(message.code)) - return "code: integer expected"; - if (message.data != null && message.hasOwnProperty("data")) - if (!$util.isString(message.data)) - return "data: string expected"; - if (message.raw_log != null && message.hasOwnProperty("raw_log")) - if (!$util.isString(message.raw_log)) - return "raw_log: string expected"; - if (message.logs != null && message.hasOwnProperty("logs")) { - if (!Array.isArray(message.logs)) - return "logs: array expected"; - for (let i = 0; i < message.logs.length; ++i) { - let error = $root.cosmos.base.abci.v1beta1.ABCIMessageLog.verify(message.logs[i]); - if (error) - return "logs." + error; - } - } - if (message.info != null && message.hasOwnProperty("info")) - if (!$util.isString(message.info)) - return "info: string expected"; - if (message.gas_wanted != null && message.hasOwnProperty("gas_wanted")) - if (!$util.isInteger(message.gas_wanted) && !(message.gas_wanted && $util.isInteger(message.gas_wanted.low) && $util.isInteger(message.gas_wanted.high))) - return "gas_wanted: integer|Long expected"; - if (message.gas_used != null && message.hasOwnProperty("gas_used")) - if (!$util.isInteger(message.gas_used) && !(message.gas_used && $util.isInteger(message.gas_used.low) && $util.isInteger(message.gas_used.high))) - return "gas_used: integer|Long expected"; - if (message.tx != null && message.hasOwnProperty("tx")) { - let error = $root.google.protobuf.Any.verify(message.tx); - if (error) - return "tx." + error; - } - if (message.timestamp != null && message.hasOwnProperty("timestamp")) - if (!$util.isString(message.timestamp)) - return "timestamp: string expected"; - return null; - }; - - /** - * Creates a TxResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.abci.v1beta1.TxResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.abci.v1beta1.TxResponse} TxResponse - */ - TxResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.abci.v1beta1.TxResponse) - return object; - let message = new $root.cosmos.base.abci.v1beta1.TxResponse(); - if (object.height != null) - if ($util.Long) - (message.height = $util.Long.fromValue(object.height)).unsigned = false; - else if (typeof object.height === "string") - message.height = parseInt(object.height, 10); - else if (typeof object.height === "number") - message.height = object.height; - else if (typeof object.height === "object") - message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); - if (object.txhash != null) - message.txhash = String(object.txhash); - if (object.codespace != null) - message.codespace = String(object.codespace); - if (object.code != null) - message.code = object.code >>> 0; - if (object.data != null) - message.data = String(object.data); - if (object.raw_log != null) - message.raw_log = String(object.raw_log); - if (object.logs) { - if (!Array.isArray(object.logs)) - throw TypeError(".cosmos.base.abci.v1beta1.TxResponse.logs: array expected"); - message.logs = []; - for (let i = 0; i < object.logs.length; ++i) { - if (typeof object.logs[i] !== "object") - throw TypeError(".cosmos.base.abci.v1beta1.TxResponse.logs: object expected"); - message.logs[i] = $root.cosmos.base.abci.v1beta1.ABCIMessageLog.fromObject(object.logs[i]); - } - } - if (object.info != null) - message.info = String(object.info); - if (object.gas_wanted != null) - if ($util.Long) - (message.gas_wanted = $util.Long.fromValue(object.gas_wanted)).unsigned = false; - else if (typeof object.gas_wanted === "string") - message.gas_wanted = parseInt(object.gas_wanted, 10); - else if (typeof object.gas_wanted === "number") - message.gas_wanted = object.gas_wanted; - else if (typeof object.gas_wanted === "object") - message.gas_wanted = new $util.LongBits(object.gas_wanted.low >>> 0, object.gas_wanted.high >>> 0).toNumber(); - if (object.gas_used != null) - if ($util.Long) - (message.gas_used = $util.Long.fromValue(object.gas_used)).unsigned = false; - else if (typeof object.gas_used === "string") - message.gas_used = parseInt(object.gas_used, 10); - else if (typeof object.gas_used === "number") - message.gas_used = object.gas_used; - else if (typeof object.gas_used === "object") - message.gas_used = new $util.LongBits(object.gas_used.low >>> 0, object.gas_used.high >>> 0).toNumber(); - if (object.tx != null) { - if (typeof object.tx !== "object") - throw TypeError(".cosmos.base.abci.v1beta1.TxResponse.tx: object expected"); - message.tx = $root.google.protobuf.Any.fromObject(object.tx); - } - if (object.timestamp != null) - message.timestamp = String(object.timestamp); - return message; - }; - - /** - * Creates a plain object from a TxResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.abci.v1beta1.TxResponse - * @static - * @param {cosmos.base.abci.v1beta1.TxResponse} message TxResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TxResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.logs = []; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.height = options.longs === String ? "0" : 0; - object.txhash = ""; - object.codespace = ""; - object.code = 0; - object.data = ""; - object.raw_log = ""; - object.info = ""; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.gas_wanted = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.gas_wanted = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.gas_used = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.gas_used = options.longs === String ? "0" : 0; - object.tx = null; - object.timestamp = ""; - } - if (message.height != null && message.hasOwnProperty("height")) - if (typeof message.height === "number") - object.height = options.longs === String ? String(message.height) : message.height; - else - object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; - if (message.txhash != null && message.hasOwnProperty("txhash")) - object.txhash = message.txhash; - if (message.codespace != null && message.hasOwnProperty("codespace")) - object.codespace = message.codespace; - if (message.code != null && message.hasOwnProperty("code")) - object.code = message.code; - if (message.data != null && message.hasOwnProperty("data")) - object.data = message.data; - if (message.raw_log != null && message.hasOwnProperty("raw_log")) - object.raw_log = message.raw_log; - if (message.logs && message.logs.length) { - object.logs = []; - for (let j = 0; j < message.logs.length; ++j) - object.logs[j] = $root.cosmos.base.abci.v1beta1.ABCIMessageLog.toObject(message.logs[j], options); - } - if (message.info != null && message.hasOwnProperty("info")) - object.info = message.info; - if (message.gas_wanted != null && message.hasOwnProperty("gas_wanted")) - if (typeof message.gas_wanted === "number") - object.gas_wanted = options.longs === String ? String(message.gas_wanted) : message.gas_wanted; - else - object.gas_wanted = options.longs === String ? $util.Long.prototype.toString.call(message.gas_wanted) : options.longs === Number ? new $util.LongBits(message.gas_wanted.low >>> 0, message.gas_wanted.high >>> 0).toNumber() : message.gas_wanted; - if (message.gas_used != null && message.hasOwnProperty("gas_used")) - if (typeof message.gas_used === "number") - object.gas_used = options.longs === String ? String(message.gas_used) : message.gas_used; - else - object.gas_used = options.longs === String ? $util.Long.prototype.toString.call(message.gas_used) : options.longs === Number ? new $util.LongBits(message.gas_used.low >>> 0, message.gas_used.high >>> 0).toNumber() : message.gas_used; - if (message.tx != null && message.hasOwnProperty("tx")) - object.tx = $root.google.protobuf.Any.toObject(message.tx, options); - if (message.timestamp != null && message.hasOwnProperty("timestamp")) - object.timestamp = message.timestamp; - return object; - }; - - /** - * Converts this TxResponse to JSON. - * @function toJSON - * @memberof cosmos.base.abci.v1beta1.TxResponse - * @instance - * @returns {Object.} JSON object - */ - TxResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return TxResponse; - })(); - - v1beta1.ABCIMessageLog = (function() { - - /** - * Properties of a ABCIMessageLog. - * @memberof cosmos.base.abci.v1beta1 - * @interface IABCIMessageLog - * @property {number|null} [msg_index] ABCIMessageLog msg_index - * @property {string|null} [log] ABCIMessageLog log - * @property {Array.|null} [events] ABCIMessageLog events - */ - - /** - * Constructs a new ABCIMessageLog. - * @memberof cosmos.base.abci.v1beta1 - * @classdesc Represents a ABCIMessageLog. - * @implements IABCIMessageLog - * @constructor - * @param {cosmos.base.abci.v1beta1.IABCIMessageLog=} [properties] Properties to set - */ - function ABCIMessageLog(properties) { - this.events = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ABCIMessageLog msg_index. - * @member {number} msg_index - * @memberof cosmos.base.abci.v1beta1.ABCIMessageLog - * @instance - */ - ABCIMessageLog.prototype.msg_index = 0; - - /** - * ABCIMessageLog log. - * @member {string} log - * @memberof cosmos.base.abci.v1beta1.ABCIMessageLog - * @instance - */ - ABCIMessageLog.prototype.log = ""; - - /** - * ABCIMessageLog events. - * @member {Array.} events - * @memberof cosmos.base.abci.v1beta1.ABCIMessageLog - * @instance - */ - ABCIMessageLog.prototype.events = $util.emptyArray; - - /** - * Encodes the specified ABCIMessageLog message. Does not implicitly {@link cosmos.base.abci.v1beta1.ABCIMessageLog.verify|verify} messages. - * @function encode - * @memberof cosmos.base.abci.v1beta1.ABCIMessageLog - * @static - * @param {cosmos.base.abci.v1beta1.IABCIMessageLog} message ABCIMessageLog message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ABCIMessageLog.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.msg_index != null && Object.hasOwnProperty.call(message, "msg_index")) - writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.msg_index); - if (message.log != null && Object.hasOwnProperty.call(message, "log")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.log); - if (message.events != null && message.events.length) - for (let i = 0; i < message.events.length; ++i) - $root.cosmos.base.abci.v1beta1.StringEvent.encode(message.events[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ABCIMessageLog message, length delimited. Does not implicitly {@link cosmos.base.abci.v1beta1.ABCIMessageLog.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.abci.v1beta1.ABCIMessageLog - * @static - * @param {cosmos.base.abci.v1beta1.IABCIMessageLog} message ABCIMessageLog message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ABCIMessageLog.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ABCIMessageLog message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.abci.v1beta1.ABCIMessageLog - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.abci.v1beta1.ABCIMessageLog} ABCIMessageLog - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ABCIMessageLog.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.abci.v1beta1.ABCIMessageLog(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.msg_index = reader.uint32(); - break; - case 2: - message.log = reader.string(); - break; - case 3: - if (!(message.events && message.events.length)) - message.events = []; - message.events.push($root.cosmos.base.abci.v1beta1.StringEvent.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ABCIMessageLog message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.abci.v1beta1.ABCIMessageLog - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.abci.v1beta1.ABCIMessageLog} ABCIMessageLog - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ABCIMessageLog.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ABCIMessageLog message. - * @function verify - * @memberof cosmos.base.abci.v1beta1.ABCIMessageLog - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ABCIMessageLog.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.msg_index != null && message.hasOwnProperty("msg_index")) - if (!$util.isInteger(message.msg_index)) - return "msg_index: integer expected"; - if (message.log != null && message.hasOwnProperty("log")) - if (!$util.isString(message.log)) - return "log: string expected"; - if (message.events != null && message.hasOwnProperty("events")) { - if (!Array.isArray(message.events)) - return "events: array expected"; - for (let i = 0; i < message.events.length; ++i) { - let error = $root.cosmos.base.abci.v1beta1.StringEvent.verify(message.events[i]); - if (error) - return "events." + error; - } - } - return null; - }; - - /** - * Creates a ABCIMessageLog message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.abci.v1beta1.ABCIMessageLog - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.abci.v1beta1.ABCIMessageLog} ABCIMessageLog - */ - ABCIMessageLog.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.abci.v1beta1.ABCIMessageLog) - return object; - let message = new $root.cosmos.base.abci.v1beta1.ABCIMessageLog(); - if (object.msg_index != null) - message.msg_index = object.msg_index >>> 0; - if (object.log != null) - message.log = String(object.log); - if (object.events) { - if (!Array.isArray(object.events)) - throw TypeError(".cosmos.base.abci.v1beta1.ABCIMessageLog.events: array expected"); - message.events = []; - for (let i = 0; i < object.events.length; ++i) { - if (typeof object.events[i] !== "object") - throw TypeError(".cosmos.base.abci.v1beta1.ABCIMessageLog.events: object expected"); - message.events[i] = $root.cosmos.base.abci.v1beta1.StringEvent.fromObject(object.events[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a ABCIMessageLog message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.abci.v1beta1.ABCIMessageLog - * @static - * @param {cosmos.base.abci.v1beta1.ABCIMessageLog} message ABCIMessageLog - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ABCIMessageLog.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.events = []; - if (options.defaults) { - object.msg_index = 0; - object.log = ""; - } - if (message.msg_index != null && message.hasOwnProperty("msg_index")) - object.msg_index = message.msg_index; - if (message.log != null && message.hasOwnProperty("log")) - object.log = message.log; - if (message.events && message.events.length) { - object.events = []; - for (let j = 0; j < message.events.length; ++j) - object.events[j] = $root.cosmos.base.abci.v1beta1.StringEvent.toObject(message.events[j], options); - } - return object; - }; - - /** - * Converts this ABCIMessageLog to JSON. - * @function toJSON - * @memberof cosmos.base.abci.v1beta1.ABCIMessageLog - * @instance - * @returns {Object.} JSON object - */ - ABCIMessageLog.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ABCIMessageLog; - })(); - - v1beta1.StringEvent = (function() { - - /** - * Properties of a StringEvent. - * @memberof cosmos.base.abci.v1beta1 - * @interface IStringEvent - * @property {string|null} [type] StringEvent type - * @property {Array.|null} [attributes] StringEvent attributes - */ - - /** - * Constructs a new StringEvent. - * @memberof cosmos.base.abci.v1beta1 - * @classdesc Represents a StringEvent. - * @implements IStringEvent - * @constructor - * @param {cosmos.base.abci.v1beta1.IStringEvent=} [properties] Properties to set - */ - function StringEvent(properties) { - this.attributes = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * StringEvent type. - * @member {string} type - * @memberof cosmos.base.abci.v1beta1.StringEvent - * @instance - */ - StringEvent.prototype.type = ""; - - /** - * StringEvent attributes. - * @member {Array.} attributes - * @memberof cosmos.base.abci.v1beta1.StringEvent - * @instance - */ - StringEvent.prototype.attributes = $util.emptyArray; - - /** - * Encodes the specified StringEvent message. Does not implicitly {@link cosmos.base.abci.v1beta1.StringEvent.verify|verify} messages. - * @function encode - * @memberof cosmos.base.abci.v1beta1.StringEvent - * @static - * @param {cosmos.base.abci.v1beta1.IStringEvent} message StringEvent message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - StringEvent.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); - if (message.attributes != null && message.attributes.length) - for (let i = 0; i < message.attributes.length; ++i) - $root.cosmos.base.abci.v1beta1.Attribute.encode(message.attributes[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified StringEvent message, length delimited. Does not implicitly {@link cosmos.base.abci.v1beta1.StringEvent.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.abci.v1beta1.StringEvent - * @static - * @param {cosmos.base.abci.v1beta1.IStringEvent} message StringEvent message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - StringEvent.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a StringEvent message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.abci.v1beta1.StringEvent - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.abci.v1beta1.StringEvent} StringEvent - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - StringEvent.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.abci.v1beta1.StringEvent(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.type = reader.string(); - break; - case 2: - if (!(message.attributes && message.attributes.length)) - message.attributes = []; - message.attributes.push($root.cosmos.base.abci.v1beta1.Attribute.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a StringEvent message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.abci.v1beta1.StringEvent - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.abci.v1beta1.StringEvent} StringEvent - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - StringEvent.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a StringEvent message. - * @function verify - * @memberof cosmos.base.abci.v1beta1.StringEvent - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - StringEvent.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - if (message.attributes != null && message.hasOwnProperty("attributes")) { - if (!Array.isArray(message.attributes)) - return "attributes: array expected"; - for (let i = 0; i < message.attributes.length; ++i) { - let error = $root.cosmos.base.abci.v1beta1.Attribute.verify(message.attributes[i]); - if (error) - return "attributes." + error; - } - } - return null; - }; - - /** - * Creates a StringEvent message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.abci.v1beta1.StringEvent - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.abci.v1beta1.StringEvent} StringEvent - */ - StringEvent.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.abci.v1beta1.StringEvent) - return object; - let message = new $root.cosmos.base.abci.v1beta1.StringEvent(); - if (object.type != null) - message.type = String(object.type); - if (object.attributes) { - if (!Array.isArray(object.attributes)) - throw TypeError(".cosmos.base.abci.v1beta1.StringEvent.attributes: array expected"); - message.attributes = []; - for (let i = 0; i < object.attributes.length; ++i) { - if (typeof object.attributes[i] !== "object") - throw TypeError(".cosmos.base.abci.v1beta1.StringEvent.attributes: object expected"); - message.attributes[i] = $root.cosmos.base.abci.v1beta1.Attribute.fromObject(object.attributes[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a StringEvent message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.abci.v1beta1.StringEvent - * @static - * @param {cosmos.base.abci.v1beta1.StringEvent} message StringEvent - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - StringEvent.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.attributes = []; - if (options.defaults) - object.type = ""; - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; - if (message.attributes && message.attributes.length) { - object.attributes = []; - for (let j = 0; j < message.attributes.length; ++j) - object.attributes[j] = $root.cosmos.base.abci.v1beta1.Attribute.toObject(message.attributes[j], options); - } - return object; - }; - - /** - * Converts this StringEvent to JSON. - * @function toJSON - * @memberof cosmos.base.abci.v1beta1.StringEvent - * @instance - * @returns {Object.} JSON object - */ - StringEvent.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return StringEvent; - })(); - - v1beta1.Attribute = (function() { - - /** - * Properties of an Attribute. - * @memberof cosmos.base.abci.v1beta1 - * @interface IAttribute - * @property {string|null} [key] Attribute key - * @property {string|null} [value] Attribute value - */ - - /** - * Constructs a new Attribute. - * @memberof cosmos.base.abci.v1beta1 - * @classdesc Represents an Attribute. - * @implements IAttribute - * @constructor - * @param {cosmos.base.abci.v1beta1.IAttribute=} [properties] Properties to set - */ - function Attribute(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Attribute key. - * @member {string} key - * @memberof cosmos.base.abci.v1beta1.Attribute - * @instance - */ - Attribute.prototype.key = ""; - - /** - * Attribute value. - * @member {string} value - * @memberof cosmos.base.abci.v1beta1.Attribute - * @instance - */ - Attribute.prototype.value = ""; - - /** - * Encodes the specified Attribute message. Does not implicitly {@link cosmos.base.abci.v1beta1.Attribute.verify|verify} messages. - * @function encode - * @memberof cosmos.base.abci.v1beta1.Attribute - * @static - * @param {cosmos.base.abci.v1beta1.IAttribute} message Attribute message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Attribute.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); - return writer; - }; - - /** - * Encodes the specified Attribute message, length delimited. Does not implicitly {@link cosmos.base.abci.v1beta1.Attribute.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.abci.v1beta1.Attribute - * @static - * @param {cosmos.base.abci.v1beta1.IAttribute} message Attribute message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Attribute.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Attribute message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.abci.v1beta1.Attribute - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.abci.v1beta1.Attribute} Attribute - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Attribute.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.abci.v1beta1.Attribute(); - while (reader.pos < end) { - let 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; - }; - - /** - * Decodes an Attribute message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.abci.v1beta1.Attribute - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.abci.v1beta1.Attribute} Attribute - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Attribute.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Attribute message. - * @function verify - * @memberof cosmos.base.abci.v1beta1.Attribute - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Attribute.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!$util.isString(message.key)) - return "key: string expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isString(message.value)) - return "value: string expected"; - return null; - }; - - /** - * Creates an Attribute message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.abci.v1beta1.Attribute - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.abci.v1beta1.Attribute} Attribute - */ - Attribute.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.abci.v1beta1.Attribute) - return object; - let message = new $root.cosmos.base.abci.v1beta1.Attribute(); - if (object.key != null) - message.key = String(object.key); - if (object.value != null) - message.value = String(object.value); - return message; - }; - - /** - * Creates a plain object from an Attribute message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.abci.v1beta1.Attribute - * @static - * @param {cosmos.base.abci.v1beta1.Attribute} message Attribute - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Attribute.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.key = ""; - object.value = ""; - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = message.key; - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - return object; - }; - - /** - * Converts this Attribute to JSON. - * @function toJSON - * @memberof cosmos.base.abci.v1beta1.Attribute - * @instance - * @returns {Object.} JSON object - */ - Attribute.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Attribute; - })(); - - v1beta1.GasInfo = (function() { - - /** - * Properties of a GasInfo. - * @memberof cosmos.base.abci.v1beta1 - * @interface IGasInfo - * @property {Long|null} [gas_wanted] GasInfo gas_wanted - * @property {Long|null} [gas_used] GasInfo gas_used - */ - - /** - * Constructs a new GasInfo. - * @memberof cosmos.base.abci.v1beta1 - * @classdesc Represents a GasInfo. - * @implements IGasInfo - * @constructor - * @param {cosmos.base.abci.v1beta1.IGasInfo=} [properties] Properties to set - */ - function GasInfo(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GasInfo gas_wanted. - * @member {Long} gas_wanted - * @memberof cosmos.base.abci.v1beta1.GasInfo - * @instance - */ - GasInfo.prototype.gas_wanted = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * GasInfo gas_used. - * @member {Long} gas_used - * @memberof cosmos.base.abci.v1beta1.GasInfo - * @instance - */ - GasInfo.prototype.gas_used = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified GasInfo message. Does not implicitly {@link cosmos.base.abci.v1beta1.GasInfo.verify|verify} messages. - * @function encode - * @memberof cosmos.base.abci.v1beta1.GasInfo - * @static - * @param {cosmos.base.abci.v1beta1.IGasInfo} message GasInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GasInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.gas_wanted != null && Object.hasOwnProperty.call(message, "gas_wanted")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.gas_wanted); - if (message.gas_used != null && Object.hasOwnProperty.call(message, "gas_used")) - writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.gas_used); - return writer; - }; - - /** - * Encodes the specified GasInfo message, length delimited. Does not implicitly {@link cosmos.base.abci.v1beta1.GasInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.abci.v1beta1.GasInfo - * @static - * @param {cosmos.base.abci.v1beta1.IGasInfo} message GasInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GasInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GasInfo message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.abci.v1beta1.GasInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.abci.v1beta1.GasInfo} GasInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GasInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.abci.v1beta1.GasInfo(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.gas_wanted = reader.uint64(); - break; - case 2: - message.gas_used = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GasInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.abci.v1beta1.GasInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.abci.v1beta1.GasInfo} GasInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GasInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GasInfo message. - * @function verify - * @memberof cosmos.base.abci.v1beta1.GasInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GasInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.gas_wanted != null && message.hasOwnProperty("gas_wanted")) - if (!$util.isInteger(message.gas_wanted) && !(message.gas_wanted && $util.isInteger(message.gas_wanted.low) && $util.isInteger(message.gas_wanted.high))) - return "gas_wanted: integer|Long expected"; - if (message.gas_used != null && message.hasOwnProperty("gas_used")) - if (!$util.isInteger(message.gas_used) && !(message.gas_used && $util.isInteger(message.gas_used.low) && $util.isInteger(message.gas_used.high))) - return "gas_used: integer|Long expected"; - return null; - }; - - /** - * Creates a GasInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.abci.v1beta1.GasInfo - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.abci.v1beta1.GasInfo} GasInfo - */ - GasInfo.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.abci.v1beta1.GasInfo) - return object; - let message = new $root.cosmos.base.abci.v1beta1.GasInfo(); - if (object.gas_wanted != null) - if ($util.Long) - (message.gas_wanted = $util.Long.fromValue(object.gas_wanted)).unsigned = true; - else if (typeof object.gas_wanted === "string") - message.gas_wanted = parseInt(object.gas_wanted, 10); - else if (typeof object.gas_wanted === "number") - message.gas_wanted = object.gas_wanted; - else if (typeof object.gas_wanted === "object") - message.gas_wanted = new $util.LongBits(object.gas_wanted.low >>> 0, object.gas_wanted.high >>> 0).toNumber(true); - if (object.gas_used != null) - if ($util.Long) - (message.gas_used = $util.Long.fromValue(object.gas_used)).unsigned = true; - else if (typeof object.gas_used === "string") - message.gas_used = parseInt(object.gas_used, 10); - else if (typeof object.gas_used === "number") - message.gas_used = object.gas_used; - else if (typeof object.gas_used === "object") - message.gas_used = new $util.LongBits(object.gas_used.low >>> 0, object.gas_used.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a GasInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.abci.v1beta1.GasInfo - * @static - * @param {cosmos.base.abci.v1beta1.GasInfo} message GasInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GasInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.gas_wanted = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.gas_wanted = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.gas_used = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.gas_used = options.longs === String ? "0" : 0; - } - if (message.gas_wanted != null && message.hasOwnProperty("gas_wanted")) - if (typeof message.gas_wanted === "number") - object.gas_wanted = options.longs === String ? String(message.gas_wanted) : message.gas_wanted; - else - object.gas_wanted = options.longs === String ? $util.Long.prototype.toString.call(message.gas_wanted) : options.longs === Number ? new $util.LongBits(message.gas_wanted.low >>> 0, message.gas_wanted.high >>> 0).toNumber(true) : message.gas_wanted; - if (message.gas_used != null && message.hasOwnProperty("gas_used")) - if (typeof message.gas_used === "number") - object.gas_used = options.longs === String ? String(message.gas_used) : message.gas_used; - else - object.gas_used = options.longs === String ? $util.Long.prototype.toString.call(message.gas_used) : options.longs === Number ? new $util.LongBits(message.gas_used.low >>> 0, message.gas_used.high >>> 0).toNumber(true) : message.gas_used; - return object; - }; - - /** - * Converts this GasInfo to JSON. - * @function toJSON - * @memberof cosmos.base.abci.v1beta1.GasInfo - * @instance - * @returns {Object.} JSON object - */ - GasInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GasInfo; - })(); - - v1beta1.Result = (function() { - - /** - * Properties of a Result. - * @memberof cosmos.base.abci.v1beta1 - * @interface IResult - * @property {Uint8Array|null} [data] Result data - * @property {string|null} [log] Result log - * @property {Array.|null} [events] Result events - */ - - /** - * Constructs a new Result. - * @memberof cosmos.base.abci.v1beta1 - * @classdesc Represents a Result. - * @implements IResult - * @constructor - * @param {cosmos.base.abci.v1beta1.IResult=} [properties] Properties to set - */ - function Result(properties) { - this.events = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Result data. - * @member {Uint8Array} data - * @memberof cosmos.base.abci.v1beta1.Result - * @instance - */ - Result.prototype.data = $util.newBuffer([]); - - /** - * Result log. - * @member {string} log - * @memberof cosmos.base.abci.v1beta1.Result - * @instance - */ - Result.prototype.log = ""; - - /** - * Result events. - * @member {Array.} events - * @memberof cosmos.base.abci.v1beta1.Result - * @instance - */ - Result.prototype.events = $util.emptyArray; - - /** - * Encodes the specified Result message. Does not implicitly {@link cosmos.base.abci.v1beta1.Result.verify|verify} messages. - * @function encode - * @memberof cosmos.base.abci.v1beta1.Result - * @static - * @param {cosmos.base.abci.v1beta1.IResult} message Result message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Result.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.data != null && Object.hasOwnProperty.call(message, "data")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.data); - if (message.log != null && Object.hasOwnProperty.call(message, "log")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.log); - if (message.events != null && message.events.length) - for (let i = 0; i < message.events.length; ++i) - $root.tendermint.abci.Event.encode(message.events[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Result message, length delimited. Does not implicitly {@link cosmos.base.abci.v1beta1.Result.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.abci.v1beta1.Result - * @static - * @param {cosmos.base.abci.v1beta1.IResult} message Result message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Result.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Result message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.abci.v1beta1.Result - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.abci.v1beta1.Result} Result - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Result.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.abci.v1beta1.Result(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.data = reader.bytes(); - break; - case 2: - message.log = reader.string(); - break; - case 3: - if (!(message.events && message.events.length)) - message.events = []; - message.events.push($root.tendermint.abci.Event.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Result message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.abci.v1beta1.Result - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.abci.v1beta1.Result} Result - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Result.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Result message. - * @function verify - * @memberof cosmos.base.abci.v1beta1.Result - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Result.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.data != null && message.hasOwnProperty("data")) - if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) - return "data: buffer expected"; - if (message.log != null && message.hasOwnProperty("log")) - if (!$util.isString(message.log)) - return "log: string expected"; - if (message.events != null && message.hasOwnProperty("events")) { - if (!Array.isArray(message.events)) - return "events: array expected"; - for (let i = 0; i < message.events.length; ++i) { - let error = $root.tendermint.abci.Event.verify(message.events[i]); - if (error) - return "events." + error; - } - } - return null; - }; - - /** - * Creates a Result message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.abci.v1beta1.Result - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.abci.v1beta1.Result} Result - */ - Result.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.abci.v1beta1.Result) - return object; - let message = new $root.cosmos.base.abci.v1beta1.Result(); - if (object.data != null) - if (typeof object.data === "string") - $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); - else if (object.data.length) - message.data = object.data; - if (object.log != null) - message.log = String(object.log); - if (object.events) { - if (!Array.isArray(object.events)) - throw TypeError(".cosmos.base.abci.v1beta1.Result.events: array expected"); - message.events = []; - for (let i = 0; i < object.events.length; ++i) { - if (typeof object.events[i] !== "object") - throw TypeError(".cosmos.base.abci.v1beta1.Result.events: object expected"); - message.events[i] = $root.tendermint.abci.Event.fromObject(object.events[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a Result message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.abci.v1beta1.Result - * @static - * @param {cosmos.base.abci.v1beta1.Result} message Result - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Result.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.events = []; - if (options.defaults) { - if (options.bytes === String) - object.data = ""; - else { - object.data = []; - if (options.bytes !== Array) - object.data = $util.newBuffer(object.data); - } - object.log = ""; - } - if (message.data != null && message.hasOwnProperty("data")) - object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; - if (message.log != null && message.hasOwnProperty("log")) - object.log = message.log; - if (message.events && message.events.length) { - object.events = []; - for (let j = 0; j < message.events.length; ++j) - object.events[j] = $root.tendermint.abci.Event.toObject(message.events[j], options); - } - return object; - }; - - /** - * Converts this Result to JSON. - * @function toJSON - * @memberof cosmos.base.abci.v1beta1.Result - * @instance - * @returns {Object.} JSON object - */ - Result.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Result; - })(); - - v1beta1.SimulationResponse = (function() { - - /** - * Properties of a SimulationResponse. - * @memberof cosmos.base.abci.v1beta1 - * @interface ISimulationResponse - * @property {cosmos.base.abci.v1beta1.IGasInfo|null} [gas_info] SimulationResponse gas_info - * @property {cosmos.base.abci.v1beta1.IResult|null} [result] SimulationResponse result - */ - - /** - * Constructs a new SimulationResponse. - * @memberof cosmos.base.abci.v1beta1 - * @classdesc Represents a SimulationResponse. - * @implements ISimulationResponse - * @constructor - * @param {cosmos.base.abci.v1beta1.ISimulationResponse=} [properties] Properties to set - */ - function SimulationResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SimulationResponse gas_info. - * @member {cosmos.base.abci.v1beta1.IGasInfo|null|undefined} gas_info - * @memberof cosmos.base.abci.v1beta1.SimulationResponse - * @instance - */ - SimulationResponse.prototype.gas_info = null; - - /** - * SimulationResponse result. - * @member {cosmos.base.abci.v1beta1.IResult|null|undefined} result - * @memberof cosmos.base.abci.v1beta1.SimulationResponse - * @instance - */ - SimulationResponse.prototype.result = null; - - /** - * Encodes the specified SimulationResponse message. Does not implicitly {@link cosmos.base.abci.v1beta1.SimulationResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.base.abci.v1beta1.SimulationResponse - * @static - * @param {cosmos.base.abci.v1beta1.ISimulationResponse} message SimulationResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SimulationResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.gas_info != null && Object.hasOwnProperty.call(message, "gas_info")) - $root.cosmos.base.abci.v1beta1.GasInfo.encode(message.gas_info, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.result != null && Object.hasOwnProperty.call(message, "result")) - $root.cosmos.base.abci.v1beta1.Result.encode(message.result, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SimulationResponse message, length delimited. Does not implicitly {@link cosmos.base.abci.v1beta1.SimulationResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.abci.v1beta1.SimulationResponse - * @static - * @param {cosmos.base.abci.v1beta1.ISimulationResponse} message SimulationResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SimulationResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SimulationResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.abci.v1beta1.SimulationResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.abci.v1beta1.SimulationResponse} SimulationResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SimulationResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.abci.v1beta1.SimulationResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.gas_info = $root.cosmos.base.abci.v1beta1.GasInfo.decode(reader, reader.uint32()); - break; - case 2: - message.result = $root.cosmos.base.abci.v1beta1.Result.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SimulationResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.abci.v1beta1.SimulationResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.abci.v1beta1.SimulationResponse} SimulationResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SimulationResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SimulationResponse message. - * @function verify - * @memberof cosmos.base.abci.v1beta1.SimulationResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SimulationResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.gas_info != null && message.hasOwnProperty("gas_info")) { - let error = $root.cosmos.base.abci.v1beta1.GasInfo.verify(message.gas_info); - if (error) - return "gas_info." + error; - } - if (message.result != null && message.hasOwnProperty("result")) { - let error = $root.cosmos.base.abci.v1beta1.Result.verify(message.result); - if (error) - return "result." + error; - } - return null; - }; - - /** - * Creates a SimulationResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.abci.v1beta1.SimulationResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.abci.v1beta1.SimulationResponse} SimulationResponse - */ - SimulationResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.abci.v1beta1.SimulationResponse) - return object; - let message = new $root.cosmos.base.abci.v1beta1.SimulationResponse(); - if (object.gas_info != null) { - if (typeof object.gas_info !== "object") - throw TypeError(".cosmos.base.abci.v1beta1.SimulationResponse.gas_info: object expected"); - message.gas_info = $root.cosmos.base.abci.v1beta1.GasInfo.fromObject(object.gas_info); - } - if (object.result != null) { - if (typeof object.result !== "object") - throw TypeError(".cosmos.base.abci.v1beta1.SimulationResponse.result: object expected"); - message.result = $root.cosmos.base.abci.v1beta1.Result.fromObject(object.result); - } - return message; - }; - - /** - * Creates a plain object from a SimulationResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.abci.v1beta1.SimulationResponse - * @static - * @param {cosmos.base.abci.v1beta1.SimulationResponse} message SimulationResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SimulationResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.gas_info = null; - object.result = null; - } - if (message.gas_info != null && message.hasOwnProperty("gas_info")) - object.gas_info = $root.cosmos.base.abci.v1beta1.GasInfo.toObject(message.gas_info, options); - if (message.result != null && message.hasOwnProperty("result")) - object.result = $root.cosmos.base.abci.v1beta1.Result.toObject(message.result, options); - return object; - }; - - /** - * Converts this SimulationResponse to JSON. - * @function toJSON - * @memberof cosmos.base.abci.v1beta1.SimulationResponse - * @instance - * @returns {Object.} JSON object - */ - SimulationResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return SimulationResponse; - })(); - - v1beta1.MsgData = (function() { - - /** - * Properties of a MsgData. - * @memberof cosmos.base.abci.v1beta1 - * @interface IMsgData - * @property {string|null} [msg_type] MsgData msg_type - * @property {Uint8Array|null} [data] MsgData data - */ - - /** - * Constructs a new MsgData. - * @memberof cosmos.base.abci.v1beta1 - * @classdesc Represents a MsgData. - * @implements IMsgData - * @constructor - * @param {cosmos.base.abci.v1beta1.IMsgData=} [properties] Properties to set - */ - function MsgData(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgData msg_type. - * @member {string} msg_type - * @memberof cosmos.base.abci.v1beta1.MsgData - * @instance - */ - MsgData.prototype.msg_type = ""; - - /** - * MsgData data. - * @member {Uint8Array} data - * @memberof cosmos.base.abci.v1beta1.MsgData - * @instance - */ - MsgData.prototype.data = $util.newBuffer([]); - - /** - * Encodes the specified MsgData message. Does not implicitly {@link cosmos.base.abci.v1beta1.MsgData.verify|verify} messages. - * @function encode - * @memberof cosmos.base.abci.v1beta1.MsgData - * @static - * @param {cosmos.base.abci.v1beta1.IMsgData} message MsgData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgData.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.msg_type != null && Object.hasOwnProperty.call(message, "msg_type")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.msg_type); - if (message.data != null && Object.hasOwnProperty.call(message, "data")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.data); - return writer; - }; - - /** - * Encodes the specified MsgData message, length delimited. Does not implicitly {@link cosmos.base.abci.v1beta1.MsgData.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.abci.v1beta1.MsgData - * @static - * @param {cosmos.base.abci.v1beta1.IMsgData} message MsgData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgData.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgData message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.abci.v1beta1.MsgData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.abci.v1beta1.MsgData} MsgData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgData.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.abci.v1beta1.MsgData(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.msg_type = reader.string(); - break; - case 2: - message.data = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgData message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.abci.v1beta1.MsgData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.abci.v1beta1.MsgData} MsgData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgData.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgData message. - * @function verify - * @memberof cosmos.base.abci.v1beta1.MsgData - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgData.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.msg_type != null && message.hasOwnProperty("msg_type")) - if (!$util.isString(message.msg_type)) - return "msg_type: string expected"; - if (message.data != null && message.hasOwnProperty("data")) - if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) - return "data: buffer expected"; - return null; - }; - - /** - * Creates a MsgData message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.abci.v1beta1.MsgData - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.abci.v1beta1.MsgData} MsgData - */ - MsgData.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.abci.v1beta1.MsgData) - return object; - let message = new $root.cosmos.base.abci.v1beta1.MsgData(); - if (object.msg_type != null) - message.msg_type = String(object.msg_type); - if (object.data != null) - if (typeof object.data === "string") - $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); - else if (object.data.length) - message.data = object.data; - return message; - }; - - /** - * Creates a plain object from a MsgData message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.abci.v1beta1.MsgData - * @static - * @param {cosmos.base.abci.v1beta1.MsgData} message MsgData - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgData.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.msg_type = ""; - if (options.bytes === String) - object.data = ""; - else { - object.data = []; - if (options.bytes !== Array) - object.data = $util.newBuffer(object.data); - } - } - if (message.msg_type != null && message.hasOwnProperty("msg_type")) - object.msg_type = message.msg_type; - if (message.data != null && message.hasOwnProperty("data")) - object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; - return object; - }; - - /** - * Converts this MsgData to JSON. - * @function toJSON - * @memberof cosmos.base.abci.v1beta1.MsgData - * @instance - * @returns {Object.} JSON object - */ - MsgData.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgData; - })(); - - v1beta1.TxMsgData = (function() { - - /** - * Properties of a TxMsgData. - * @memberof cosmos.base.abci.v1beta1 - * @interface ITxMsgData - * @property {Array.|null} [data] TxMsgData data - */ - - /** - * Constructs a new TxMsgData. - * @memberof cosmos.base.abci.v1beta1 - * @classdesc Represents a TxMsgData. - * @implements ITxMsgData - * @constructor - * @param {cosmos.base.abci.v1beta1.ITxMsgData=} [properties] Properties to set - */ - function TxMsgData(properties) { - this.data = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * TxMsgData data. - * @member {Array.} data - * @memberof cosmos.base.abci.v1beta1.TxMsgData - * @instance - */ - TxMsgData.prototype.data = $util.emptyArray; - - /** - * Encodes the specified TxMsgData message. Does not implicitly {@link cosmos.base.abci.v1beta1.TxMsgData.verify|verify} messages. - * @function encode - * @memberof cosmos.base.abci.v1beta1.TxMsgData - * @static - * @param {cosmos.base.abci.v1beta1.ITxMsgData} message TxMsgData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TxMsgData.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.data != null && message.data.length) - for (let i = 0; i < message.data.length; ++i) - $root.cosmos.base.abci.v1beta1.MsgData.encode(message.data[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified TxMsgData message, length delimited. Does not implicitly {@link cosmos.base.abci.v1beta1.TxMsgData.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.abci.v1beta1.TxMsgData - * @static - * @param {cosmos.base.abci.v1beta1.ITxMsgData} message TxMsgData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TxMsgData.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TxMsgData message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.abci.v1beta1.TxMsgData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.abci.v1beta1.TxMsgData} TxMsgData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TxMsgData.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.abci.v1beta1.TxMsgData(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.data && message.data.length)) - message.data = []; - message.data.push($root.cosmos.base.abci.v1beta1.MsgData.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a TxMsgData message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.abci.v1beta1.TxMsgData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.abci.v1beta1.TxMsgData} TxMsgData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TxMsgData.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TxMsgData message. - * @function verify - * @memberof cosmos.base.abci.v1beta1.TxMsgData - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TxMsgData.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.data != null && message.hasOwnProperty("data")) { - if (!Array.isArray(message.data)) - return "data: array expected"; - for (let i = 0; i < message.data.length; ++i) { - let error = $root.cosmos.base.abci.v1beta1.MsgData.verify(message.data[i]); - if (error) - return "data." + error; - } - } - return null; - }; - - /** - * Creates a TxMsgData message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.abci.v1beta1.TxMsgData - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.abci.v1beta1.TxMsgData} TxMsgData - */ - TxMsgData.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.abci.v1beta1.TxMsgData) - return object; - let message = new $root.cosmos.base.abci.v1beta1.TxMsgData(); - if (object.data) { - if (!Array.isArray(object.data)) - throw TypeError(".cosmos.base.abci.v1beta1.TxMsgData.data: array expected"); - message.data = []; - for (let i = 0; i < object.data.length; ++i) { - if (typeof object.data[i] !== "object") - throw TypeError(".cosmos.base.abci.v1beta1.TxMsgData.data: object expected"); - message.data[i] = $root.cosmos.base.abci.v1beta1.MsgData.fromObject(object.data[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a TxMsgData message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.abci.v1beta1.TxMsgData - * @static - * @param {cosmos.base.abci.v1beta1.TxMsgData} message TxMsgData - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TxMsgData.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.data = []; - if (message.data && message.data.length) { - object.data = []; - for (let j = 0; j < message.data.length; ++j) - object.data[j] = $root.cosmos.base.abci.v1beta1.MsgData.toObject(message.data[j], options); - } - return object; - }; - - /** - * Converts this TxMsgData to JSON. - * @function toJSON - * @memberof cosmos.base.abci.v1beta1.TxMsgData - * @instance - * @returns {Object.} JSON object - */ - TxMsgData.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return TxMsgData; - })(); - - v1beta1.SearchTxsResult = (function() { - - /** - * Properties of a SearchTxsResult. - * @memberof cosmos.base.abci.v1beta1 - * @interface ISearchTxsResult - * @property {Long|null} [total_count] SearchTxsResult total_count - * @property {Long|null} [count] SearchTxsResult count - * @property {Long|null} [page_number] SearchTxsResult page_number - * @property {Long|null} [page_total] SearchTxsResult page_total - * @property {Long|null} [limit] SearchTxsResult limit - * @property {Array.|null} [txs] SearchTxsResult txs - */ - - /** - * Constructs a new SearchTxsResult. - * @memberof cosmos.base.abci.v1beta1 - * @classdesc Represents a SearchTxsResult. - * @implements ISearchTxsResult - * @constructor - * @param {cosmos.base.abci.v1beta1.ISearchTxsResult=} [properties] Properties to set - */ - function SearchTxsResult(properties) { - this.txs = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SearchTxsResult total_count. - * @member {Long} total_count - * @memberof cosmos.base.abci.v1beta1.SearchTxsResult - * @instance - */ - SearchTxsResult.prototype.total_count = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * SearchTxsResult count. - * @member {Long} count - * @memberof cosmos.base.abci.v1beta1.SearchTxsResult - * @instance - */ - SearchTxsResult.prototype.count = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * SearchTxsResult page_number. - * @member {Long} page_number - * @memberof cosmos.base.abci.v1beta1.SearchTxsResult - * @instance - */ - SearchTxsResult.prototype.page_number = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * SearchTxsResult page_total. - * @member {Long} page_total - * @memberof cosmos.base.abci.v1beta1.SearchTxsResult - * @instance - */ - SearchTxsResult.prototype.page_total = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * SearchTxsResult limit. - * @member {Long} limit - * @memberof cosmos.base.abci.v1beta1.SearchTxsResult - * @instance - */ - SearchTxsResult.prototype.limit = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * SearchTxsResult txs. - * @member {Array.} txs - * @memberof cosmos.base.abci.v1beta1.SearchTxsResult - * @instance - */ - SearchTxsResult.prototype.txs = $util.emptyArray; - - /** - * Encodes the specified SearchTxsResult message. Does not implicitly {@link cosmos.base.abci.v1beta1.SearchTxsResult.verify|verify} messages. - * @function encode - * @memberof cosmos.base.abci.v1beta1.SearchTxsResult - * @static - * @param {cosmos.base.abci.v1beta1.ISearchTxsResult} message SearchTxsResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SearchTxsResult.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.total_count != null && Object.hasOwnProperty.call(message, "total_count")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.total_count); - if (message.count != null && Object.hasOwnProperty.call(message, "count")) - writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.count); - if (message.page_number != null && Object.hasOwnProperty.call(message, "page_number")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.page_number); - if (message.page_total != null && Object.hasOwnProperty.call(message, "page_total")) - writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.page_total); - if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) - writer.uint32(/* id 5, wireType 0 =*/40).uint64(message.limit); - if (message.txs != null && message.txs.length) - for (let i = 0; i < message.txs.length; ++i) - $root.cosmos.base.abci.v1beta1.TxResponse.encode(message.txs[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SearchTxsResult message, length delimited. Does not implicitly {@link cosmos.base.abci.v1beta1.SearchTxsResult.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.abci.v1beta1.SearchTxsResult - * @static - * @param {cosmos.base.abci.v1beta1.ISearchTxsResult} message SearchTxsResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SearchTxsResult.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SearchTxsResult message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.abci.v1beta1.SearchTxsResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.abci.v1beta1.SearchTxsResult} SearchTxsResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SearchTxsResult.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.abci.v1beta1.SearchTxsResult(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.total_count = reader.uint64(); - break; - case 2: - message.count = reader.uint64(); - break; - case 3: - message.page_number = reader.uint64(); - break; - case 4: - message.page_total = reader.uint64(); - break; - case 5: - message.limit = reader.uint64(); - break; - case 6: - if (!(message.txs && message.txs.length)) - message.txs = []; - message.txs.push($root.cosmos.base.abci.v1beta1.TxResponse.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SearchTxsResult message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.abci.v1beta1.SearchTxsResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.abci.v1beta1.SearchTxsResult} SearchTxsResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SearchTxsResult.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SearchTxsResult message. - * @function verify - * @memberof cosmos.base.abci.v1beta1.SearchTxsResult - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SearchTxsResult.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.total_count != null && message.hasOwnProperty("total_count")) - if (!$util.isInteger(message.total_count) && !(message.total_count && $util.isInteger(message.total_count.low) && $util.isInteger(message.total_count.high))) - return "total_count: integer|Long expected"; - if (message.count != null && message.hasOwnProperty("count")) - if (!$util.isInteger(message.count) && !(message.count && $util.isInteger(message.count.low) && $util.isInteger(message.count.high))) - return "count: integer|Long expected"; - if (message.page_number != null && message.hasOwnProperty("page_number")) - if (!$util.isInteger(message.page_number) && !(message.page_number && $util.isInteger(message.page_number.low) && $util.isInteger(message.page_number.high))) - return "page_number: integer|Long expected"; - if (message.page_total != null && message.hasOwnProperty("page_total")) - if (!$util.isInteger(message.page_total) && !(message.page_total && $util.isInteger(message.page_total.low) && $util.isInteger(message.page_total.high))) - return "page_total: integer|Long expected"; - if (message.limit != null && message.hasOwnProperty("limit")) - if (!$util.isInteger(message.limit) && !(message.limit && $util.isInteger(message.limit.low) && $util.isInteger(message.limit.high))) - return "limit: integer|Long expected"; - if (message.txs != null && message.hasOwnProperty("txs")) { - if (!Array.isArray(message.txs)) - return "txs: array expected"; - for (let i = 0; i < message.txs.length; ++i) { - let error = $root.cosmos.base.abci.v1beta1.TxResponse.verify(message.txs[i]); - if (error) - return "txs." + error; - } - } - return null; - }; - - /** - * Creates a SearchTxsResult message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.abci.v1beta1.SearchTxsResult - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.abci.v1beta1.SearchTxsResult} SearchTxsResult - */ - SearchTxsResult.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.abci.v1beta1.SearchTxsResult) - return object; - let message = new $root.cosmos.base.abci.v1beta1.SearchTxsResult(); - if (object.total_count != null) - if ($util.Long) - (message.total_count = $util.Long.fromValue(object.total_count)).unsigned = true; - else if (typeof object.total_count === "string") - message.total_count = parseInt(object.total_count, 10); - else if (typeof object.total_count === "number") - message.total_count = object.total_count; - else if (typeof object.total_count === "object") - message.total_count = new $util.LongBits(object.total_count.low >>> 0, object.total_count.high >>> 0).toNumber(true); - if (object.count != null) - if ($util.Long) - (message.count = $util.Long.fromValue(object.count)).unsigned = true; - else if (typeof object.count === "string") - message.count = parseInt(object.count, 10); - else if (typeof object.count === "number") - message.count = object.count; - else if (typeof object.count === "object") - message.count = new $util.LongBits(object.count.low >>> 0, object.count.high >>> 0).toNumber(true); - if (object.page_number != null) - if ($util.Long) - (message.page_number = $util.Long.fromValue(object.page_number)).unsigned = true; - else if (typeof object.page_number === "string") - message.page_number = parseInt(object.page_number, 10); - else if (typeof object.page_number === "number") - message.page_number = object.page_number; - else if (typeof object.page_number === "object") - message.page_number = new $util.LongBits(object.page_number.low >>> 0, object.page_number.high >>> 0).toNumber(true); - if (object.page_total != null) - if ($util.Long) - (message.page_total = $util.Long.fromValue(object.page_total)).unsigned = true; - else if (typeof object.page_total === "string") - message.page_total = parseInt(object.page_total, 10); - else if (typeof object.page_total === "number") - message.page_total = object.page_total; - else if (typeof object.page_total === "object") - message.page_total = new $util.LongBits(object.page_total.low >>> 0, object.page_total.high >>> 0).toNumber(true); - if (object.limit != null) - if ($util.Long) - (message.limit = $util.Long.fromValue(object.limit)).unsigned = true; - else if (typeof object.limit === "string") - message.limit = parseInt(object.limit, 10); - else if (typeof object.limit === "number") - message.limit = object.limit; - else if (typeof object.limit === "object") - message.limit = new $util.LongBits(object.limit.low >>> 0, object.limit.high >>> 0).toNumber(true); - if (object.txs) { - if (!Array.isArray(object.txs)) - throw TypeError(".cosmos.base.abci.v1beta1.SearchTxsResult.txs: array expected"); - message.txs = []; - for (let i = 0; i < object.txs.length; ++i) { - if (typeof object.txs[i] !== "object") - throw TypeError(".cosmos.base.abci.v1beta1.SearchTxsResult.txs: object expected"); - message.txs[i] = $root.cosmos.base.abci.v1beta1.TxResponse.fromObject(object.txs[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a SearchTxsResult message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.abci.v1beta1.SearchTxsResult - * @static - * @param {cosmos.base.abci.v1beta1.SearchTxsResult} message SearchTxsResult - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SearchTxsResult.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.txs = []; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.total_count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.total_count = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.count = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.page_number = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.page_number = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.page_total = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.page_total = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.limit = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.limit = options.longs === String ? "0" : 0; - } - if (message.total_count != null && message.hasOwnProperty("total_count")) - if (typeof message.total_count === "number") - object.total_count = options.longs === String ? String(message.total_count) : message.total_count; - else - object.total_count = options.longs === String ? $util.Long.prototype.toString.call(message.total_count) : options.longs === Number ? new $util.LongBits(message.total_count.low >>> 0, message.total_count.high >>> 0).toNumber(true) : message.total_count; - if (message.count != null && message.hasOwnProperty("count")) - if (typeof message.count === "number") - object.count = options.longs === String ? String(message.count) : message.count; - else - object.count = options.longs === String ? $util.Long.prototype.toString.call(message.count) : options.longs === Number ? new $util.LongBits(message.count.low >>> 0, message.count.high >>> 0).toNumber(true) : message.count; - if (message.page_number != null && message.hasOwnProperty("page_number")) - if (typeof message.page_number === "number") - object.page_number = options.longs === String ? String(message.page_number) : message.page_number; - else - object.page_number = options.longs === String ? $util.Long.prototype.toString.call(message.page_number) : options.longs === Number ? new $util.LongBits(message.page_number.low >>> 0, message.page_number.high >>> 0).toNumber(true) : message.page_number; - if (message.page_total != null && message.hasOwnProperty("page_total")) - if (typeof message.page_total === "number") - object.page_total = options.longs === String ? String(message.page_total) : message.page_total; - else - object.page_total = options.longs === String ? $util.Long.prototype.toString.call(message.page_total) : options.longs === Number ? new $util.LongBits(message.page_total.low >>> 0, message.page_total.high >>> 0).toNumber(true) : message.page_total; - if (message.limit != null && message.hasOwnProperty("limit")) - if (typeof message.limit === "number") - object.limit = options.longs === String ? String(message.limit) : message.limit; - else - object.limit = options.longs === String ? $util.Long.prototype.toString.call(message.limit) : options.longs === Number ? new $util.LongBits(message.limit.low >>> 0, message.limit.high >>> 0).toNumber(true) : message.limit; - if (message.txs && message.txs.length) { - object.txs = []; - for (let j = 0; j < message.txs.length; ++j) - object.txs[j] = $root.cosmos.base.abci.v1beta1.TxResponse.toObject(message.txs[j], options); - } - return object; - }; - - /** - * Converts this SearchTxsResult to JSON. - * @function toJSON - * @memberof cosmos.base.abci.v1beta1.SearchTxsResult - * @instance - * @returns {Object.} JSON object - */ - SearchTxsResult.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return SearchTxsResult; - })(); - - return v1beta1; - })(); - - return abci; - })(); - - base.kv = (function() { - - /** - * Namespace kv. - * @memberof cosmos.base - * @namespace - */ - const kv = {}; - - kv.v1beta1 = (function() { - - /** - * Namespace v1beta1. - * @memberof cosmos.base.kv - * @namespace - */ - const v1beta1 = {}; - - v1beta1.Pairs = (function() { - - /** - * Properties of a Pairs. - * @memberof cosmos.base.kv.v1beta1 - * @interface IPairs - * @property {Array.|null} [pairs] Pairs pairs - */ - - /** - * Constructs a new Pairs. - * @memberof cosmos.base.kv.v1beta1 - * @classdesc Represents a Pairs. - * @implements IPairs - * @constructor - * @param {cosmos.base.kv.v1beta1.IPairs=} [properties] Properties to set - */ - function Pairs(properties) { - this.pairs = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Pairs pairs. - * @member {Array.} pairs - * @memberof cosmos.base.kv.v1beta1.Pairs - * @instance - */ - Pairs.prototype.pairs = $util.emptyArray; - - /** - * Encodes the specified Pairs message. Does not implicitly {@link cosmos.base.kv.v1beta1.Pairs.verify|verify} messages. - * @function encode - * @memberof cosmos.base.kv.v1beta1.Pairs - * @static - * @param {cosmos.base.kv.v1beta1.IPairs} message Pairs message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Pairs.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.pairs != null && message.pairs.length) - for (let i = 0; i < message.pairs.length; ++i) - $root.cosmos.base.kv.v1beta1.Pair.encode(message.pairs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Pairs message, length delimited. Does not implicitly {@link cosmos.base.kv.v1beta1.Pairs.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.kv.v1beta1.Pairs - * @static - * @param {cosmos.base.kv.v1beta1.IPairs} message Pairs message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Pairs.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Pairs message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.kv.v1beta1.Pairs - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.kv.v1beta1.Pairs} Pairs - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Pairs.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.kv.v1beta1.Pairs(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.pairs && message.pairs.length)) - message.pairs = []; - message.pairs.push($root.cosmos.base.kv.v1beta1.Pair.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Pairs message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.kv.v1beta1.Pairs - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.kv.v1beta1.Pairs} Pairs - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Pairs.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Pairs message. - * @function verify - * @memberof cosmos.base.kv.v1beta1.Pairs - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Pairs.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.pairs != null && message.hasOwnProperty("pairs")) { - if (!Array.isArray(message.pairs)) - return "pairs: array expected"; - for (let i = 0; i < message.pairs.length; ++i) { - let error = $root.cosmos.base.kv.v1beta1.Pair.verify(message.pairs[i]); - if (error) - return "pairs." + error; - } - } - return null; - }; - - /** - * Creates a Pairs message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.kv.v1beta1.Pairs - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.kv.v1beta1.Pairs} Pairs - */ - Pairs.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.kv.v1beta1.Pairs) - return object; - let message = new $root.cosmos.base.kv.v1beta1.Pairs(); - if (object.pairs) { - if (!Array.isArray(object.pairs)) - throw TypeError(".cosmos.base.kv.v1beta1.Pairs.pairs: array expected"); - message.pairs = []; - for (let i = 0; i < object.pairs.length; ++i) { - if (typeof object.pairs[i] !== "object") - throw TypeError(".cosmos.base.kv.v1beta1.Pairs.pairs: object expected"); - message.pairs[i] = $root.cosmos.base.kv.v1beta1.Pair.fromObject(object.pairs[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a Pairs message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.kv.v1beta1.Pairs - * @static - * @param {cosmos.base.kv.v1beta1.Pairs} message Pairs - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Pairs.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.pairs = []; - if (message.pairs && message.pairs.length) { - object.pairs = []; - for (let j = 0; j < message.pairs.length; ++j) - object.pairs[j] = $root.cosmos.base.kv.v1beta1.Pair.toObject(message.pairs[j], options); - } - return object; - }; - - /** - * Converts this Pairs to JSON. - * @function toJSON - * @memberof cosmos.base.kv.v1beta1.Pairs - * @instance - * @returns {Object.} JSON object - */ - Pairs.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Pairs; - })(); - - v1beta1.Pair = (function() { - - /** - * Properties of a Pair. - * @memberof cosmos.base.kv.v1beta1 - * @interface IPair - * @property {Uint8Array|null} [key] Pair key - * @property {Uint8Array|null} [value] Pair value - */ - - /** - * Constructs a new Pair. - * @memberof cosmos.base.kv.v1beta1 - * @classdesc Represents a Pair. - * @implements IPair - * @constructor - * @param {cosmos.base.kv.v1beta1.IPair=} [properties] Properties to set - */ - function Pair(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Pair key. - * @member {Uint8Array} key - * @memberof cosmos.base.kv.v1beta1.Pair - * @instance - */ - Pair.prototype.key = $util.newBuffer([]); - - /** - * Pair value. - * @member {Uint8Array} value - * @memberof cosmos.base.kv.v1beta1.Pair - * @instance - */ - Pair.prototype.value = $util.newBuffer([]); - - /** - * Encodes the specified Pair message. Does not implicitly {@link cosmos.base.kv.v1beta1.Pair.verify|verify} messages. - * @function encode - * @memberof cosmos.base.kv.v1beta1.Pair - * @static - * @param {cosmos.base.kv.v1beta1.IPair} message Pair message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Pair.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value); - return writer; - }; - - /** - * Encodes the specified Pair message, length delimited. Does not implicitly {@link cosmos.base.kv.v1beta1.Pair.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.kv.v1beta1.Pair - * @static - * @param {cosmos.base.kv.v1beta1.IPair} message Pair message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Pair.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Pair message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.kv.v1beta1.Pair - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.kv.v1beta1.Pair} Pair - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Pair.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.kv.v1beta1.Pair(); - while (reader.pos < end) { - let 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; - }; - - /** - * Decodes a Pair message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.kv.v1beta1.Pair - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.kv.v1beta1.Pair} Pair - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Pair.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Pair message. - * @function verify - * @memberof cosmos.base.kv.v1beta1.Pair - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Pair.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) - return "key: buffer expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) - return "value: buffer expected"; - return null; - }; - - /** - * Creates a Pair message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.kv.v1beta1.Pair - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.kv.v1beta1.Pair} Pair - */ - Pair.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.kv.v1beta1.Pair) - return object; - let message = new $root.cosmos.base.kv.v1beta1.Pair(); - if (object.key != null) - if (typeof object.key === "string") - $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); - else if (object.key.length) - message.key = object.key; - if (object.value != null) - if (typeof object.value === "string") - $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); - else if (object.value.length) - message.value = object.value; - return message; - }; - - /** - * Creates a plain object from a Pair message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.kv.v1beta1.Pair - * @static - * @param {cosmos.base.kv.v1beta1.Pair} message Pair - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Pair.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if (options.bytes === String) - object.key = ""; - else { - object.key = []; - if (options.bytes !== Array) - object.key = $util.newBuffer(object.key); - } - if (options.bytes === String) - object.value = ""; - else { - object.value = []; - if (options.bytes !== Array) - object.value = $util.newBuffer(object.value); - } - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; - if (message.value != null && message.hasOwnProperty("value")) - object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; - return object; - }; - - /** - * Converts this Pair to JSON. - * @function toJSON - * @memberof cosmos.base.kv.v1beta1.Pair - * @instance - * @returns {Object.} JSON object - */ - Pair.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Pair; - })(); - - return v1beta1; - })(); - - return kv; - })(); - - base.query = (function() { - - /** - * Namespace query. - * @memberof cosmos.base - * @namespace - */ - const query = {}; - - query.v1beta1 = (function() { - - /** - * Namespace v1beta1. - * @memberof cosmos.base.query - * @namespace - */ - const v1beta1 = {}; - - v1beta1.PageRequest = (function() { - - /** - * Properties of a PageRequest. - * @memberof cosmos.base.query.v1beta1 - * @interface IPageRequest - * @property {Uint8Array|null} [key] PageRequest key - * @property {Long|null} [offset] PageRequest offset - * @property {Long|null} [limit] PageRequest limit - * @property {boolean|null} [count_total] PageRequest count_total - */ - - /** - * Constructs a new PageRequest. - * @memberof cosmos.base.query.v1beta1 - * @classdesc Represents a PageRequest. - * @implements IPageRequest - * @constructor - * @param {cosmos.base.query.v1beta1.IPageRequest=} [properties] Properties to set - */ - function PageRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PageRequest key. - * @member {Uint8Array} key - * @memberof cosmos.base.query.v1beta1.PageRequest - * @instance - */ - PageRequest.prototype.key = $util.newBuffer([]); - - /** - * PageRequest offset. - * @member {Long} offset - * @memberof cosmos.base.query.v1beta1.PageRequest - * @instance - */ - PageRequest.prototype.offset = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * PageRequest limit. - * @member {Long} limit - * @memberof cosmos.base.query.v1beta1.PageRequest - * @instance - */ - PageRequest.prototype.limit = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * PageRequest count_total. - * @member {boolean} count_total - * @memberof cosmos.base.query.v1beta1.PageRequest - * @instance - */ - PageRequest.prototype.count_total = false; - - /** - * Encodes the specified PageRequest message. Does not implicitly {@link cosmos.base.query.v1beta1.PageRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.base.query.v1beta1.PageRequest - * @static - * @param {cosmos.base.query.v1beta1.IPageRequest} message PageRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PageRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); - if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) - writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.offset); - if (message.limit != null && Object.hasOwnProperty.call(message, "limit")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.limit); - if (message.count_total != null && Object.hasOwnProperty.call(message, "count_total")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.count_total); - return writer; - }; - - /** - * Encodes the specified PageRequest message, length delimited. Does not implicitly {@link cosmos.base.query.v1beta1.PageRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.query.v1beta1.PageRequest - * @static - * @param {cosmos.base.query.v1beta1.IPageRequest} message PageRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PageRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PageRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.query.v1beta1.PageRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.query.v1beta1.PageRequest} PageRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PageRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.query.v1beta1.PageRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.bytes(); - break; - case 2: - message.offset = reader.uint64(); - break; - case 3: - message.limit = reader.uint64(); - break; - case 4: - message.count_total = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PageRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.query.v1beta1.PageRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.query.v1beta1.PageRequest} PageRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PageRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PageRequest message. - * @function verify - * @memberof cosmos.base.query.v1beta1.PageRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PageRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) - return "key: buffer expected"; - if (message.offset != null && message.hasOwnProperty("offset")) - if (!$util.isInteger(message.offset) && !(message.offset && $util.isInteger(message.offset.low) && $util.isInteger(message.offset.high))) - return "offset: integer|Long expected"; - if (message.limit != null && message.hasOwnProperty("limit")) - if (!$util.isInteger(message.limit) && !(message.limit && $util.isInteger(message.limit.low) && $util.isInteger(message.limit.high))) - return "limit: integer|Long expected"; - if (message.count_total != null && message.hasOwnProperty("count_total")) - if (typeof message.count_total !== "boolean") - return "count_total: boolean expected"; - return null; - }; - - /** - * Creates a PageRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.query.v1beta1.PageRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.query.v1beta1.PageRequest} PageRequest - */ - PageRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.query.v1beta1.PageRequest) - return object; - let message = new $root.cosmos.base.query.v1beta1.PageRequest(); - if (object.key != null) - if (typeof object.key === "string") - $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); - else if (object.key.length) - message.key = object.key; - if (object.offset != null) - if ($util.Long) - (message.offset = $util.Long.fromValue(object.offset)).unsigned = true; - else if (typeof object.offset === "string") - message.offset = parseInt(object.offset, 10); - else if (typeof object.offset === "number") - message.offset = object.offset; - else if (typeof object.offset === "object") - message.offset = new $util.LongBits(object.offset.low >>> 0, object.offset.high >>> 0).toNumber(true); - if (object.limit != null) - if ($util.Long) - (message.limit = $util.Long.fromValue(object.limit)).unsigned = true; - else if (typeof object.limit === "string") - message.limit = parseInt(object.limit, 10); - else if (typeof object.limit === "number") - message.limit = object.limit; - else if (typeof object.limit === "object") - message.limit = new $util.LongBits(object.limit.low >>> 0, object.limit.high >>> 0).toNumber(true); - if (object.count_total != null) - message.count_total = Boolean(object.count_total); - return message; - }; - - /** - * Creates a plain object from a PageRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.query.v1beta1.PageRequest - * @static - * @param {cosmos.base.query.v1beta1.PageRequest} message PageRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PageRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if (options.bytes === String) - object.key = ""; - else { - object.key = []; - if (options.bytes !== Array) - object.key = $util.newBuffer(object.key); - } - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.offset = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.offset = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.limit = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.limit = options.longs === String ? "0" : 0; - object.count_total = false; - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; - if (message.offset != null && message.hasOwnProperty("offset")) - if (typeof message.offset === "number") - object.offset = options.longs === String ? String(message.offset) : message.offset; - else - object.offset = options.longs === String ? $util.Long.prototype.toString.call(message.offset) : options.longs === Number ? new $util.LongBits(message.offset.low >>> 0, message.offset.high >>> 0).toNumber(true) : message.offset; - if (message.limit != null && message.hasOwnProperty("limit")) - if (typeof message.limit === "number") - object.limit = options.longs === String ? String(message.limit) : message.limit; - else - object.limit = options.longs === String ? $util.Long.prototype.toString.call(message.limit) : options.longs === Number ? new $util.LongBits(message.limit.low >>> 0, message.limit.high >>> 0).toNumber(true) : message.limit; - if (message.count_total != null && message.hasOwnProperty("count_total")) - object.count_total = message.count_total; - return object; - }; - - /** - * Converts this PageRequest to JSON. - * @function toJSON - * @memberof cosmos.base.query.v1beta1.PageRequest - * @instance - * @returns {Object.} JSON object - */ - PageRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return PageRequest; - })(); - - v1beta1.PageResponse = (function() { - - /** - * Properties of a PageResponse. - * @memberof cosmos.base.query.v1beta1 - * @interface IPageResponse - * @property {Uint8Array|null} [next_key] PageResponse next_key - * @property {Long|null} [total] PageResponse total - */ - - /** - * Constructs a new PageResponse. - * @memberof cosmos.base.query.v1beta1 - * @classdesc Represents a PageResponse. - * @implements IPageResponse - * @constructor - * @param {cosmos.base.query.v1beta1.IPageResponse=} [properties] Properties to set - */ - function PageResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PageResponse next_key. - * @member {Uint8Array} next_key - * @memberof cosmos.base.query.v1beta1.PageResponse - * @instance - */ - PageResponse.prototype.next_key = $util.newBuffer([]); - - /** - * PageResponse total. - * @member {Long} total - * @memberof cosmos.base.query.v1beta1.PageResponse - * @instance - */ - PageResponse.prototype.total = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified PageResponse message. Does not implicitly {@link cosmos.base.query.v1beta1.PageResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.base.query.v1beta1.PageResponse - * @static - * @param {cosmos.base.query.v1beta1.IPageResponse} message PageResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PageResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.next_key != null && Object.hasOwnProperty.call(message, "next_key")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.next_key); - if (message.total != null && Object.hasOwnProperty.call(message, "total")) - writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.total); - return writer; - }; - - /** - * Encodes the specified PageResponse message, length delimited. Does not implicitly {@link cosmos.base.query.v1beta1.PageResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.query.v1beta1.PageResponse - * @static - * @param {cosmos.base.query.v1beta1.IPageResponse} message PageResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PageResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PageResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.query.v1beta1.PageResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.query.v1beta1.PageResponse} PageResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PageResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.query.v1beta1.PageResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.next_key = reader.bytes(); - break; - case 2: - message.total = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PageResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.query.v1beta1.PageResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.query.v1beta1.PageResponse} PageResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PageResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PageResponse message. - * @function verify - * @memberof cosmos.base.query.v1beta1.PageResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PageResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.next_key != null && message.hasOwnProperty("next_key")) - if (!(message.next_key && typeof message.next_key.length === "number" || $util.isString(message.next_key))) - return "next_key: buffer expected"; - if (message.total != null && message.hasOwnProperty("total")) - if (!$util.isInteger(message.total) && !(message.total && $util.isInteger(message.total.low) && $util.isInteger(message.total.high))) - return "total: integer|Long expected"; - return null; - }; - - /** - * Creates a PageResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.query.v1beta1.PageResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.query.v1beta1.PageResponse} PageResponse - */ - PageResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.query.v1beta1.PageResponse) - return object; - let message = new $root.cosmos.base.query.v1beta1.PageResponse(); - if (object.next_key != null) - if (typeof object.next_key === "string") - $util.base64.decode(object.next_key, message.next_key = $util.newBuffer($util.base64.length(object.next_key)), 0); - else if (object.next_key.length) - message.next_key = object.next_key; - if (object.total != null) - if ($util.Long) - (message.total = $util.Long.fromValue(object.total)).unsigned = true; - else if (typeof object.total === "string") - message.total = parseInt(object.total, 10); - else if (typeof object.total === "number") - message.total = object.total; - else if (typeof object.total === "object") - message.total = new $util.LongBits(object.total.low >>> 0, object.total.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a PageResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.query.v1beta1.PageResponse - * @static - * @param {cosmos.base.query.v1beta1.PageResponse} message PageResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PageResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if (options.bytes === String) - object.next_key = ""; - else { - object.next_key = []; - if (options.bytes !== Array) - object.next_key = $util.newBuffer(object.next_key); - } - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.total = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.total = options.longs === String ? "0" : 0; - } - if (message.next_key != null && message.hasOwnProperty("next_key")) - object.next_key = options.bytes === String ? $util.base64.encode(message.next_key, 0, message.next_key.length) : options.bytes === Array ? Array.prototype.slice.call(message.next_key) : message.next_key; - if (message.total != null && message.hasOwnProperty("total")) - if (typeof message.total === "number") - object.total = options.longs === String ? String(message.total) : message.total; - else - object.total = options.longs === String ? $util.Long.prototype.toString.call(message.total) : options.longs === Number ? new $util.LongBits(message.total.low >>> 0, message.total.high >>> 0).toNumber(true) : message.total; - return object; - }; - - /** - * Converts this PageResponse to JSON. - * @function toJSON - * @memberof cosmos.base.query.v1beta1.PageResponse - * @instance - * @returns {Object.} JSON object - */ - PageResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return PageResponse; - })(); - - return v1beta1; - })(); - - return query; - })(); - - base.reflection = (function() { - - /** - * Namespace reflection. - * @memberof cosmos.base - * @namespace - */ - const reflection = {}; - - reflection.v1beta1 = (function() { - - /** - * Namespace v1beta1. - * @memberof cosmos.base.reflection - * @namespace - */ - const v1beta1 = {}; - - v1beta1.ReflectionService = (function() { - - /** - * Constructs a new ReflectionService service. - * @memberof cosmos.base.reflection.v1beta1 - * @classdesc Represents a ReflectionService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function ReflectionService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (ReflectionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ReflectionService; - - /** - * Callback as used by {@link cosmos.base.reflection.v1beta1.ReflectionService#listAllInterfaces}. - * @memberof cosmos.base.reflection.v1beta1.ReflectionService - * @typedef ListAllInterfacesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.base.reflection.v1beta1.ListAllInterfacesResponse} [response] ListAllInterfacesResponse - */ - - /** - * Calls ListAllInterfaces. - * @function listAllInterfaces - * @memberof cosmos.base.reflection.v1beta1.ReflectionService - * @instance - * @param {cosmos.base.reflection.v1beta1.IListAllInterfacesRequest} request ListAllInterfacesRequest message or plain object - * @param {cosmos.base.reflection.v1beta1.ReflectionService.ListAllInterfacesCallback} callback Node-style callback called with the error, if any, and ListAllInterfacesResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ReflectionService.prototype.listAllInterfaces = function listAllInterfaces(request, callback) { - return this.rpcCall(listAllInterfaces, $root.cosmos.base.reflection.v1beta1.ListAllInterfacesRequest, $root.cosmos.base.reflection.v1beta1.ListAllInterfacesResponse, request, callback); - }, "name", { value: "ListAllInterfaces" }); - - /** - * Calls ListAllInterfaces. - * @function listAllInterfaces - * @memberof cosmos.base.reflection.v1beta1.ReflectionService - * @instance - * @param {cosmos.base.reflection.v1beta1.IListAllInterfacesRequest} request ListAllInterfacesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.base.reflection.v1beta1.ReflectionService#listImplementations}. - * @memberof cosmos.base.reflection.v1beta1.ReflectionService - * @typedef ListImplementationsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.base.reflection.v1beta1.ListImplementationsResponse} [response] ListImplementationsResponse - */ - - /** - * Calls ListImplementations. - * @function listImplementations - * @memberof cosmos.base.reflection.v1beta1.ReflectionService - * @instance - * @param {cosmos.base.reflection.v1beta1.IListImplementationsRequest} request ListImplementationsRequest message or plain object - * @param {cosmos.base.reflection.v1beta1.ReflectionService.ListImplementationsCallback} callback Node-style callback called with the error, if any, and ListImplementationsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ReflectionService.prototype.listImplementations = function listImplementations(request, callback) { - return this.rpcCall(listImplementations, $root.cosmos.base.reflection.v1beta1.ListImplementationsRequest, $root.cosmos.base.reflection.v1beta1.ListImplementationsResponse, request, callback); - }, "name", { value: "ListImplementations" }); - - /** - * Calls ListImplementations. - * @function listImplementations - * @memberof cosmos.base.reflection.v1beta1.ReflectionService - * @instance - * @param {cosmos.base.reflection.v1beta1.IListImplementationsRequest} request ListImplementationsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return ReflectionService; - })(); - - v1beta1.ListAllInterfacesRequest = (function() { - - /** - * Properties of a ListAllInterfacesRequest. - * @memberof cosmos.base.reflection.v1beta1 - * @interface IListAllInterfacesRequest - */ - - /** - * Constructs a new ListAllInterfacesRequest. - * @memberof cosmos.base.reflection.v1beta1 - * @classdesc Represents a ListAllInterfacesRequest. - * @implements IListAllInterfacesRequest - * @constructor - * @param {cosmos.base.reflection.v1beta1.IListAllInterfacesRequest=} [properties] Properties to set - */ - function ListAllInterfacesRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified ListAllInterfacesRequest message. Does not implicitly {@link cosmos.base.reflection.v1beta1.ListAllInterfacesRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesRequest - * @static - * @param {cosmos.base.reflection.v1beta1.IListAllInterfacesRequest} message ListAllInterfacesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListAllInterfacesRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified ListAllInterfacesRequest message, length delimited. Does not implicitly {@link cosmos.base.reflection.v1beta1.ListAllInterfacesRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesRequest - * @static - * @param {cosmos.base.reflection.v1beta1.IListAllInterfacesRequest} message ListAllInterfacesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListAllInterfacesRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListAllInterfacesRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.reflection.v1beta1.ListAllInterfacesRequest} ListAllInterfacesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListAllInterfacesRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.reflection.v1beta1.ListAllInterfacesRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListAllInterfacesRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.reflection.v1beta1.ListAllInterfacesRequest} ListAllInterfacesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListAllInterfacesRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListAllInterfacesRequest message. - * @function verify - * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListAllInterfacesRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a ListAllInterfacesRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.reflection.v1beta1.ListAllInterfacesRequest} ListAllInterfacesRequest - */ - ListAllInterfacesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.reflection.v1beta1.ListAllInterfacesRequest) - return object; - return new $root.cosmos.base.reflection.v1beta1.ListAllInterfacesRequest(); - }; - - /** - * Creates a plain object from a ListAllInterfacesRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesRequest - * @static - * @param {cosmos.base.reflection.v1beta1.ListAllInterfacesRequest} message ListAllInterfacesRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListAllInterfacesRequest.toObject = function toObject() { - return {}; - }; - - /** - * Converts this ListAllInterfacesRequest to JSON. - * @function toJSON - * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesRequest - * @instance - * @returns {Object.} JSON object - */ - ListAllInterfacesRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ListAllInterfacesRequest; - })(); - - v1beta1.ListAllInterfacesResponse = (function() { - - /** - * Properties of a ListAllInterfacesResponse. - * @memberof cosmos.base.reflection.v1beta1 - * @interface IListAllInterfacesResponse - * @property {Array.|null} [interface_names] ListAllInterfacesResponse interface_names - */ - - /** - * Constructs a new ListAllInterfacesResponse. - * @memberof cosmos.base.reflection.v1beta1 - * @classdesc Represents a ListAllInterfacesResponse. - * @implements IListAllInterfacesResponse - * @constructor - * @param {cosmos.base.reflection.v1beta1.IListAllInterfacesResponse=} [properties] Properties to set - */ - function ListAllInterfacesResponse(properties) { - this.interface_names = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ListAllInterfacesResponse interface_names. - * @member {Array.} interface_names - * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesResponse - * @instance - */ - ListAllInterfacesResponse.prototype.interface_names = $util.emptyArray; - - /** - * Encodes the specified ListAllInterfacesResponse message. Does not implicitly {@link cosmos.base.reflection.v1beta1.ListAllInterfacesResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesResponse - * @static - * @param {cosmos.base.reflection.v1beta1.IListAllInterfacesResponse} message ListAllInterfacesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListAllInterfacesResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.interface_names != null && message.interface_names.length) - for (let i = 0; i < message.interface_names.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.interface_names[i]); - return writer; - }; - - /** - * Encodes the specified ListAllInterfacesResponse message, length delimited. Does not implicitly {@link cosmos.base.reflection.v1beta1.ListAllInterfacesResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesResponse - * @static - * @param {cosmos.base.reflection.v1beta1.IListAllInterfacesResponse} message ListAllInterfacesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListAllInterfacesResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListAllInterfacesResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.reflection.v1beta1.ListAllInterfacesResponse} ListAllInterfacesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListAllInterfacesResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.reflection.v1beta1.ListAllInterfacesResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.interface_names && message.interface_names.length)) - message.interface_names = []; - message.interface_names.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListAllInterfacesResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.reflection.v1beta1.ListAllInterfacesResponse} ListAllInterfacesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListAllInterfacesResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListAllInterfacesResponse message. - * @function verify - * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListAllInterfacesResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.interface_names != null && message.hasOwnProperty("interface_names")) { - if (!Array.isArray(message.interface_names)) - return "interface_names: array expected"; - for (let i = 0; i < message.interface_names.length; ++i) - if (!$util.isString(message.interface_names[i])) - return "interface_names: string[] expected"; - } - return null; - }; - - /** - * Creates a ListAllInterfacesResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.reflection.v1beta1.ListAllInterfacesResponse} ListAllInterfacesResponse - */ - ListAllInterfacesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.reflection.v1beta1.ListAllInterfacesResponse) - return object; - let message = new $root.cosmos.base.reflection.v1beta1.ListAllInterfacesResponse(); - if (object.interface_names) { - if (!Array.isArray(object.interface_names)) - throw TypeError(".cosmos.base.reflection.v1beta1.ListAllInterfacesResponse.interface_names: array expected"); - message.interface_names = []; - for (let i = 0; i < object.interface_names.length; ++i) - message.interface_names[i] = String(object.interface_names[i]); - } - return message; - }; - - /** - * Creates a plain object from a ListAllInterfacesResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesResponse - * @static - * @param {cosmos.base.reflection.v1beta1.ListAllInterfacesResponse} message ListAllInterfacesResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListAllInterfacesResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.interface_names = []; - if (message.interface_names && message.interface_names.length) { - object.interface_names = []; - for (let j = 0; j < message.interface_names.length; ++j) - object.interface_names[j] = message.interface_names[j]; - } - return object; - }; - - /** - * Converts this ListAllInterfacesResponse to JSON. - * @function toJSON - * @memberof cosmos.base.reflection.v1beta1.ListAllInterfacesResponse - * @instance - * @returns {Object.} JSON object - */ - ListAllInterfacesResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ListAllInterfacesResponse; - })(); - - v1beta1.ListImplementationsRequest = (function() { - - /** - * Properties of a ListImplementationsRequest. - * @memberof cosmos.base.reflection.v1beta1 - * @interface IListImplementationsRequest - * @property {string|null} [interface_name] ListImplementationsRequest interface_name - */ - - /** - * Constructs a new ListImplementationsRequest. - * @memberof cosmos.base.reflection.v1beta1 - * @classdesc Represents a ListImplementationsRequest. - * @implements IListImplementationsRequest - * @constructor - * @param {cosmos.base.reflection.v1beta1.IListImplementationsRequest=} [properties] Properties to set - */ - function ListImplementationsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ListImplementationsRequest interface_name. - * @member {string} interface_name - * @memberof cosmos.base.reflection.v1beta1.ListImplementationsRequest - * @instance - */ - ListImplementationsRequest.prototype.interface_name = ""; - - /** - * Encodes the specified ListImplementationsRequest message. Does not implicitly {@link cosmos.base.reflection.v1beta1.ListImplementationsRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.base.reflection.v1beta1.ListImplementationsRequest - * @static - * @param {cosmos.base.reflection.v1beta1.IListImplementationsRequest} message ListImplementationsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListImplementationsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.interface_name != null && Object.hasOwnProperty.call(message, "interface_name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.interface_name); - return writer; - }; - - /** - * Encodes the specified ListImplementationsRequest message, length delimited. Does not implicitly {@link cosmos.base.reflection.v1beta1.ListImplementationsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.reflection.v1beta1.ListImplementationsRequest - * @static - * @param {cosmos.base.reflection.v1beta1.IListImplementationsRequest} message ListImplementationsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListImplementationsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListImplementationsRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.reflection.v1beta1.ListImplementationsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.reflection.v1beta1.ListImplementationsRequest} ListImplementationsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListImplementationsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.reflection.v1beta1.ListImplementationsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.interface_name = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListImplementationsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.reflection.v1beta1.ListImplementationsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.reflection.v1beta1.ListImplementationsRequest} ListImplementationsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListImplementationsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListImplementationsRequest message. - * @function verify - * @memberof cosmos.base.reflection.v1beta1.ListImplementationsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListImplementationsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.interface_name != null && message.hasOwnProperty("interface_name")) - if (!$util.isString(message.interface_name)) - return "interface_name: string expected"; - return null; - }; - - /** - * Creates a ListImplementationsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.reflection.v1beta1.ListImplementationsRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.reflection.v1beta1.ListImplementationsRequest} ListImplementationsRequest - */ - ListImplementationsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.reflection.v1beta1.ListImplementationsRequest) - return object; - let message = new $root.cosmos.base.reflection.v1beta1.ListImplementationsRequest(); - if (object.interface_name != null) - message.interface_name = String(object.interface_name); - return message; - }; - - /** - * Creates a plain object from a ListImplementationsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.reflection.v1beta1.ListImplementationsRequest - * @static - * @param {cosmos.base.reflection.v1beta1.ListImplementationsRequest} message ListImplementationsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListImplementationsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.interface_name = ""; - if (message.interface_name != null && message.hasOwnProperty("interface_name")) - object.interface_name = message.interface_name; - return object; - }; - - /** - * Converts this ListImplementationsRequest to JSON. - * @function toJSON - * @memberof cosmos.base.reflection.v1beta1.ListImplementationsRequest - * @instance - * @returns {Object.} JSON object - */ - ListImplementationsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ListImplementationsRequest; - })(); - - v1beta1.ListImplementationsResponse = (function() { - - /** - * Properties of a ListImplementationsResponse. - * @memberof cosmos.base.reflection.v1beta1 - * @interface IListImplementationsResponse - * @property {Array.|null} [implementation_message_names] ListImplementationsResponse implementation_message_names - */ - - /** - * Constructs a new ListImplementationsResponse. - * @memberof cosmos.base.reflection.v1beta1 - * @classdesc Represents a ListImplementationsResponse. - * @implements IListImplementationsResponse - * @constructor - * @param {cosmos.base.reflection.v1beta1.IListImplementationsResponse=} [properties] Properties to set - */ - function ListImplementationsResponse(properties) { - this.implementation_message_names = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ListImplementationsResponse implementation_message_names. - * @member {Array.} implementation_message_names - * @memberof cosmos.base.reflection.v1beta1.ListImplementationsResponse - * @instance - */ - ListImplementationsResponse.prototype.implementation_message_names = $util.emptyArray; - - /** - * Encodes the specified ListImplementationsResponse message. Does not implicitly {@link cosmos.base.reflection.v1beta1.ListImplementationsResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.base.reflection.v1beta1.ListImplementationsResponse - * @static - * @param {cosmos.base.reflection.v1beta1.IListImplementationsResponse} message ListImplementationsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListImplementationsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.implementation_message_names != null && message.implementation_message_names.length) - for (let i = 0; i < message.implementation_message_names.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.implementation_message_names[i]); - return writer; - }; - - /** - * Encodes the specified ListImplementationsResponse message, length delimited. Does not implicitly {@link cosmos.base.reflection.v1beta1.ListImplementationsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.reflection.v1beta1.ListImplementationsResponse - * @static - * @param {cosmos.base.reflection.v1beta1.IListImplementationsResponse} message ListImplementationsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListImplementationsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListImplementationsResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.reflection.v1beta1.ListImplementationsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.reflection.v1beta1.ListImplementationsResponse} ListImplementationsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListImplementationsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.reflection.v1beta1.ListImplementationsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.implementation_message_names && message.implementation_message_names.length)) - message.implementation_message_names = []; - message.implementation_message_names.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListImplementationsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.reflection.v1beta1.ListImplementationsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.reflection.v1beta1.ListImplementationsResponse} ListImplementationsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListImplementationsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListImplementationsResponse message. - * @function verify - * @memberof cosmos.base.reflection.v1beta1.ListImplementationsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListImplementationsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.implementation_message_names != null && message.hasOwnProperty("implementation_message_names")) { - if (!Array.isArray(message.implementation_message_names)) - return "implementation_message_names: array expected"; - for (let i = 0; i < message.implementation_message_names.length; ++i) - if (!$util.isString(message.implementation_message_names[i])) - return "implementation_message_names: string[] expected"; - } - return null; - }; - - /** - * Creates a ListImplementationsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.reflection.v1beta1.ListImplementationsResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.reflection.v1beta1.ListImplementationsResponse} ListImplementationsResponse - */ - ListImplementationsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.reflection.v1beta1.ListImplementationsResponse) - return object; - let message = new $root.cosmos.base.reflection.v1beta1.ListImplementationsResponse(); - if (object.implementation_message_names) { - if (!Array.isArray(object.implementation_message_names)) - throw TypeError(".cosmos.base.reflection.v1beta1.ListImplementationsResponse.implementation_message_names: array expected"); - message.implementation_message_names = []; - for (let i = 0; i < object.implementation_message_names.length; ++i) - message.implementation_message_names[i] = String(object.implementation_message_names[i]); - } - return message; - }; - - /** - * Creates a plain object from a ListImplementationsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.reflection.v1beta1.ListImplementationsResponse - * @static - * @param {cosmos.base.reflection.v1beta1.ListImplementationsResponse} message ListImplementationsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListImplementationsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.implementation_message_names = []; - if (message.implementation_message_names && message.implementation_message_names.length) { - object.implementation_message_names = []; - for (let j = 0; j < message.implementation_message_names.length; ++j) - object.implementation_message_names[j] = message.implementation_message_names[j]; - } - return object; - }; - - /** - * Converts this ListImplementationsResponse to JSON. - * @function toJSON - * @memberof cosmos.base.reflection.v1beta1.ListImplementationsResponse - * @instance - * @returns {Object.} JSON object - */ - ListImplementationsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ListImplementationsResponse; - })(); - - return v1beta1; - })(); - - return reflection; - })(); - - base.snapshots = (function() { - - /** - * Namespace snapshots. - * @memberof cosmos.base - * @namespace - */ - const snapshots = {}; - - snapshots.v1beta1 = (function() { - - /** - * Namespace v1beta1. - * @memberof cosmos.base.snapshots - * @namespace - */ - const v1beta1 = {}; - - v1beta1.Snapshot = (function() { - - /** - * Properties of a Snapshot. - * @memberof cosmos.base.snapshots.v1beta1 - * @interface ISnapshot - * @property {Long|null} [height] Snapshot height - * @property {number|null} [format] Snapshot format - * @property {number|null} [chunks] Snapshot chunks - * @property {Uint8Array|null} [hash] Snapshot hash - * @property {cosmos.base.snapshots.v1beta1.IMetadata|null} [metadata] Snapshot metadata - */ - - /** - * Constructs a new Snapshot. - * @memberof cosmos.base.snapshots.v1beta1 - * @classdesc Represents a Snapshot. - * @implements ISnapshot - * @constructor - * @param {cosmos.base.snapshots.v1beta1.ISnapshot=} [properties] Properties to set - */ - function Snapshot(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Snapshot height. - * @member {Long} height - * @memberof cosmos.base.snapshots.v1beta1.Snapshot - * @instance - */ - Snapshot.prototype.height = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Snapshot format. - * @member {number} format - * @memberof cosmos.base.snapshots.v1beta1.Snapshot - * @instance - */ - Snapshot.prototype.format = 0; - - /** - * Snapshot chunks. - * @member {number} chunks - * @memberof cosmos.base.snapshots.v1beta1.Snapshot - * @instance - */ - Snapshot.prototype.chunks = 0; - - /** - * Snapshot hash. - * @member {Uint8Array} hash - * @memberof cosmos.base.snapshots.v1beta1.Snapshot - * @instance - */ - Snapshot.prototype.hash = $util.newBuffer([]); - - /** - * Snapshot metadata. - * @member {cosmos.base.snapshots.v1beta1.IMetadata|null|undefined} metadata - * @memberof cosmos.base.snapshots.v1beta1.Snapshot - * @instance - */ - Snapshot.prototype.metadata = null; - - /** - * Encodes the specified Snapshot message. Does not implicitly {@link cosmos.base.snapshots.v1beta1.Snapshot.verify|verify} messages. - * @function encode - * @memberof cosmos.base.snapshots.v1beta1.Snapshot - * @static - * @param {cosmos.base.snapshots.v1beta1.ISnapshot} message Snapshot message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Snapshot.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.height); - if (message.format != null && Object.hasOwnProperty.call(message, "format")) - writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.format); - if (message.chunks != null && Object.hasOwnProperty.call(message, "chunks")) - writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.chunks); - if (message.hash != null && Object.hasOwnProperty.call(message, "hash")) - writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.hash); - if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - $root.cosmos.base.snapshots.v1beta1.Metadata.encode(message.metadata, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Snapshot message, length delimited. Does not implicitly {@link cosmos.base.snapshots.v1beta1.Snapshot.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.snapshots.v1beta1.Snapshot - * @static - * @param {cosmos.base.snapshots.v1beta1.ISnapshot} message Snapshot message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Snapshot.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Snapshot message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.snapshots.v1beta1.Snapshot - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.snapshots.v1beta1.Snapshot} Snapshot - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Snapshot.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.snapshots.v1beta1.Snapshot(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.height = reader.uint64(); - break; - case 2: - message.format = reader.uint32(); - break; - case 3: - message.chunks = reader.uint32(); - break; - case 4: - message.hash = reader.bytes(); - break; - case 5: - message.metadata = $root.cosmos.base.snapshots.v1beta1.Metadata.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Snapshot message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.snapshots.v1beta1.Snapshot - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.snapshots.v1beta1.Snapshot} Snapshot - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Snapshot.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Snapshot message. - * @function verify - * @memberof cosmos.base.snapshots.v1beta1.Snapshot - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Snapshot.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) - return "height: integer|Long expected"; - if (message.format != null && message.hasOwnProperty("format")) - if (!$util.isInteger(message.format)) - return "format: integer expected"; - if (message.chunks != null && message.hasOwnProperty("chunks")) - if (!$util.isInteger(message.chunks)) - return "chunks: integer expected"; - if (message.hash != null && message.hasOwnProperty("hash")) - if (!(message.hash && typeof message.hash.length === "number" || $util.isString(message.hash))) - return "hash: buffer expected"; - if (message.metadata != null && message.hasOwnProperty("metadata")) { - let error = $root.cosmos.base.snapshots.v1beta1.Metadata.verify(message.metadata); - if (error) - return "metadata." + error; - } - return null; - }; - - /** - * Creates a Snapshot message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.snapshots.v1beta1.Snapshot - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.snapshots.v1beta1.Snapshot} Snapshot - */ - Snapshot.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.snapshots.v1beta1.Snapshot) - return object; - let message = new $root.cosmos.base.snapshots.v1beta1.Snapshot(); - if (object.height != null) - if ($util.Long) - (message.height = $util.Long.fromValue(object.height)).unsigned = true; - else if (typeof object.height === "string") - message.height = parseInt(object.height, 10); - else if (typeof object.height === "number") - message.height = object.height; - else if (typeof object.height === "object") - message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(true); - if (object.format != null) - message.format = object.format >>> 0; - if (object.chunks != null) - message.chunks = object.chunks >>> 0; - if (object.hash != null) - if (typeof object.hash === "string") - $util.base64.decode(object.hash, message.hash = $util.newBuffer($util.base64.length(object.hash)), 0); - else if (object.hash.length) - message.hash = object.hash; - if (object.metadata != null) { - if (typeof object.metadata !== "object") - throw TypeError(".cosmos.base.snapshots.v1beta1.Snapshot.metadata: object expected"); - message.metadata = $root.cosmos.base.snapshots.v1beta1.Metadata.fromObject(object.metadata); - } - return message; - }; - - /** - * Creates a plain object from a Snapshot message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.snapshots.v1beta1.Snapshot - * @static - * @param {cosmos.base.snapshots.v1beta1.Snapshot} message Snapshot - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Snapshot.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.height = options.longs === String ? "0" : 0; - object.format = 0; - object.chunks = 0; - if (options.bytes === String) - object.hash = ""; - else { - object.hash = []; - if (options.bytes !== Array) - object.hash = $util.newBuffer(object.hash); - } - object.metadata = null; - } - if (message.height != null && message.hasOwnProperty("height")) - if (typeof message.height === "number") - object.height = options.longs === String ? String(message.height) : message.height; - else - object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber(true) : message.height; - if (message.format != null && message.hasOwnProperty("format")) - object.format = message.format; - if (message.chunks != null && message.hasOwnProperty("chunks")) - object.chunks = message.chunks; - if (message.hash != null && message.hasOwnProperty("hash")) - object.hash = options.bytes === String ? $util.base64.encode(message.hash, 0, message.hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.hash) : message.hash; - if (message.metadata != null && message.hasOwnProperty("metadata")) - object.metadata = $root.cosmos.base.snapshots.v1beta1.Metadata.toObject(message.metadata, options); - return object; - }; - - /** - * Converts this Snapshot to JSON. - * @function toJSON - * @memberof cosmos.base.snapshots.v1beta1.Snapshot - * @instance - * @returns {Object.} JSON object - */ - Snapshot.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Snapshot; - })(); - - v1beta1.Metadata = (function() { - - /** - * Properties of a Metadata. - * @memberof cosmos.base.snapshots.v1beta1 - * @interface IMetadata - * @property {Array.|null} [chunk_hashes] Metadata chunk_hashes - */ - - /** - * Constructs a new Metadata. - * @memberof cosmos.base.snapshots.v1beta1 - * @classdesc Represents a Metadata. - * @implements IMetadata - * @constructor - * @param {cosmos.base.snapshots.v1beta1.IMetadata=} [properties] Properties to set - */ - function Metadata(properties) { - this.chunk_hashes = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Metadata chunk_hashes. - * @member {Array.} chunk_hashes - * @memberof cosmos.base.snapshots.v1beta1.Metadata - * @instance - */ - Metadata.prototype.chunk_hashes = $util.emptyArray; - - /** - * Encodes the specified Metadata message. Does not implicitly {@link cosmos.base.snapshots.v1beta1.Metadata.verify|verify} messages. - * @function encode - * @memberof cosmos.base.snapshots.v1beta1.Metadata - * @static - * @param {cosmos.base.snapshots.v1beta1.IMetadata} message Metadata message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Metadata.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.chunk_hashes != null && message.chunk_hashes.length) - for (let i = 0; i < message.chunk_hashes.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.chunk_hashes[i]); - return writer; - }; - - /** - * Encodes the specified Metadata message, length delimited. Does not implicitly {@link cosmos.base.snapshots.v1beta1.Metadata.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.snapshots.v1beta1.Metadata - * @static - * @param {cosmos.base.snapshots.v1beta1.IMetadata} message Metadata message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Metadata.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Metadata message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.snapshots.v1beta1.Metadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.snapshots.v1beta1.Metadata} Metadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Metadata.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.snapshots.v1beta1.Metadata(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.chunk_hashes && message.chunk_hashes.length)) - message.chunk_hashes = []; - message.chunk_hashes.push(reader.bytes()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Metadata message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.snapshots.v1beta1.Metadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.snapshots.v1beta1.Metadata} Metadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Metadata.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Metadata message. - * @function verify - * @memberof cosmos.base.snapshots.v1beta1.Metadata - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Metadata.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.chunk_hashes != null && message.hasOwnProperty("chunk_hashes")) { - if (!Array.isArray(message.chunk_hashes)) - return "chunk_hashes: array expected"; - for (let i = 0; i < message.chunk_hashes.length; ++i) - if (!(message.chunk_hashes[i] && typeof message.chunk_hashes[i].length === "number" || $util.isString(message.chunk_hashes[i]))) - return "chunk_hashes: buffer[] expected"; - } - return null; - }; - - /** - * Creates a Metadata message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.snapshots.v1beta1.Metadata - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.snapshots.v1beta1.Metadata} Metadata - */ - Metadata.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.snapshots.v1beta1.Metadata) - return object; - let message = new $root.cosmos.base.snapshots.v1beta1.Metadata(); - if (object.chunk_hashes) { - if (!Array.isArray(object.chunk_hashes)) - throw TypeError(".cosmos.base.snapshots.v1beta1.Metadata.chunk_hashes: array expected"); - message.chunk_hashes = []; - for (let i = 0; i < object.chunk_hashes.length; ++i) - if (typeof object.chunk_hashes[i] === "string") - $util.base64.decode(object.chunk_hashes[i], message.chunk_hashes[i] = $util.newBuffer($util.base64.length(object.chunk_hashes[i])), 0); - else if (object.chunk_hashes[i].length) - message.chunk_hashes[i] = object.chunk_hashes[i]; - } - return message; - }; - - /** - * Creates a plain object from a Metadata message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.snapshots.v1beta1.Metadata - * @static - * @param {cosmos.base.snapshots.v1beta1.Metadata} message Metadata - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Metadata.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.chunk_hashes = []; - if (message.chunk_hashes && message.chunk_hashes.length) { - object.chunk_hashes = []; - for (let j = 0; j < message.chunk_hashes.length; ++j) - object.chunk_hashes[j] = options.bytes === String ? $util.base64.encode(message.chunk_hashes[j], 0, message.chunk_hashes[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.chunk_hashes[j]) : message.chunk_hashes[j]; - } - return object; - }; - - /** - * Converts this Metadata to JSON. - * @function toJSON - * @memberof cosmos.base.snapshots.v1beta1.Metadata - * @instance - * @returns {Object.} JSON object - */ - Metadata.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Metadata; - })(); - - return v1beta1; - })(); - - return snapshots; - })(); - - base.store = (function() { - - /** - * Namespace store. - * @memberof cosmos.base - * @namespace - */ - const store = {}; - - store.v1beta1 = (function() { - - /** - * Namespace v1beta1. - * @memberof cosmos.base.store - * @namespace - */ - const v1beta1 = {}; - - v1beta1.CommitInfo = (function() { - - /** - * Properties of a CommitInfo. - * @memberof cosmos.base.store.v1beta1 - * @interface ICommitInfo - * @property {Long|null} [version] CommitInfo version - * @property {Array.|null} [store_infos] CommitInfo store_infos - */ - - /** - * Constructs a new CommitInfo. - * @memberof cosmos.base.store.v1beta1 - * @classdesc Represents a CommitInfo. - * @implements ICommitInfo - * @constructor - * @param {cosmos.base.store.v1beta1.ICommitInfo=} [properties] Properties to set - */ - function CommitInfo(properties) { - this.store_infos = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * CommitInfo version. - * @member {Long} version - * @memberof cosmos.base.store.v1beta1.CommitInfo - * @instance - */ - CommitInfo.prototype.version = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * CommitInfo store_infos. - * @member {Array.} store_infos - * @memberof cosmos.base.store.v1beta1.CommitInfo - * @instance - */ - CommitInfo.prototype.store_infos = $util.emptyArray; - - /** - * Encodes the specified CommitInfo message. Does not implicitly {@link cosmos.base.store.v1beta1.CommitInfo.verify|verify} messages. - * @function encode - * @memberof cosmos.base.store.v1beta1.CommitInfo - * @static - * @param {cosmos.base.store.v1beta1.ICommitInfo} message CommitInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CommitInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.version != null && Object.hasOwnProperty.call(message, "version")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.version); - if (message.store_infos != null && message.store_infos.length) - for (let i = 0; i < message.store_infos.length; ++i) - $root.cosmos.base.store.v1beta1.StoreInfo.encode(message.store_infos[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified CommitInfo message, length delimited. Does not implicitly {@link cosmos.base.store.v1beta1.CommitInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.store.v1beta1.CommitInfo - * @static - * @param {cosmos.base.store.v1beta1.ICommitInfo} message CommitInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CommitInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CommitInfo message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.store.v1beta1.CommitInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.store.v1beta1.CommitInfo} CommitInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CommitInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.store.v1beta1.CommitInfo(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.version = reader.int64(); - break; - case 2: - if (!(message.store_infos && message.store_infos.length)) - message.store_infos = []; - message.store_infos.push($root.cosmos.base.store.v1beta1.StoreInfo.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CommitInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.store.v1beta1.CommitInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.store.v1beta1.CommitInfo} CommitInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CommitInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CommitInfo message. - * @function verify - * @memberof cosmos.base.store.v1beta1.CommitInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CommitInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.version != null && message.hasOwnProperty("version")) - if (!$util.isInteger(message.version) && !(message.version && $util.isInteger(message.version.low) && $util.isInteger(message.version.high))) - return "version: integer|Long expected"; - if (message.store_infos != null && message.hasOwnProperty("store_infos")) { - if (!Array.isArray(message.store_infos)) - return "store_infos: array expected"; - for (let i = 0; i < message.store_infos.length; ++i) { - let error = $root.cosmos.base.store.v1beta1.StoreInfo.verify(message.store_infos[i]); - if (error) - return "store_infos." + error; - } - } - return null; - }; - - /** - * Creates a CommitInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.store.v1beta1.CommitInfo - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.store.v1beta1.CommitInfo} CommitInfo - */ - CommitInfo.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.store.v1beta1.CommitInfo) - return object; - let message = new $root.cosmos.base.store.v1beta1.CommitInfo(); - if (object.version != null) - if ($util.Long) - (message.version = $util.Long.fromValue(object.version)).unsigned = false; - else if (typeof object.version === "string") - message.version = parseInt(object.version, 10); - else if (typeof object.version === "number") - message.version = object.version; - else if (typeof object.version === "object") - message.version = new $util.LongBits(object.version.low >>> 0, object.version.high >>> 0).toNumber(); - if (object.store_infos) { - if (!Array.isArray(object.store_infos)) - throw TypeError(".cosmos.base.store.v1beta1.CommitInfo.store_infos: array expected"); - message.store_infos = []; - for (let i = 0; i < object.store_infos.length; ++i) { - if (typeof object.store_infos[i] !== "object") - throw TypeError(".cosmos.base.store.v1beta1.CommitInfo.store_infos: object expected"); - message.store_infos[i] = $root.cosmos.base.store.v1beta1.StoreInfo.fromObject(object.store_infos[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a CommitInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.store.v1beta1.CommitInfo - * @static - * @param {cosmos.base.store.v1beta1.CommitInfo} message CommitInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CommitInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.store_infos = []; - if (options.defaults) - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.version = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.version = options.longs === String ? "0" : 0; - if (message.version != null && message.hasOwnProperty("version")) - if (typeof message.version === "number") - object.version = options.longs === String ? String(message.version) : message.version; - else - object.version = options.longs === String ? $util.Long.prototype.toString.call(message.version) : options.longs === Number ? new $util.LongBits(message.version.low >>> 0, message.version.high >>> 0).toNumber() : message.version; - if (message.store_infos && message.store_infos.length) { - object.store_infos = []; - for (let j = 0; j < message.store_infos.length; ++j) - object.store_infos[j] = $root.cosmos.base.store.v1beta1.StoreInfo.toObject(message.store_infos[j], options); - } - return object; - }; - - /** - * Converts this CommitInfo to JSON. - * @function toJSON - * @memberof cosmos.base.store.v1beta1.CommitInfo - * @instance - * @returns {Object.} JSON object - */ - CommitInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return CommitInfo; - })(); - - v1beta1.StoreInfo = (function() { - - /** - * Properties of a StoreInfo. - * @memberof cosmos.base.store.v1beta1 - * @interface IStoreInfo - * @property {string|null} [name] StoreInfo name - * @property {cosmos.base.store.v1beta1.ICommitID|null} [commit_id] StoreInfo commit_id - */ - - /** - * Constructs a new StoreInfo. - * @memberof cosmos.base.store.v1beta1 - * @classdesc Represents a StoreInfo. - * @implements IStoreInfo - * @constructor - * @param {cosmos.base.store.v1beta1.IStoreInfo=} [properties] Properties to set - */ - function StoreInfo(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * StoreInfo name. - * @member {string} name - * @memberof cosmos.base.store.v1beta1.StoreInfo - * @instance - */ - StoreInfo.prototype.name = ""; - - /** - * StoreInfo commit_id. - * @member {cosmos.base.store.v1beta1.ICommitID|null|undefined} commit_id - * @memberof cosmos.base.store.v1beta1.StoreInfo - * @instance - */ - StoreInfo.prototype.commit_id = null; - - /** - * Encodes the specified StoreInfo message. Does not implicitly {@link cosmos.base.store.v1beta1.StoreInfo.verify|verify} messages. - * @function encode - * @memberof cosmos.base.store.v1beta1.StoreInfo - * @static - * @param {cosmos.base.store.v1beta1.IStoreInfo} message StoreInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - StoreInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.commit_id != null && Object.hasOwnProperty.call(message, "commit_id")) - $root.cosmos.base.store.v1beta1.CommitID.encode(message.commit_id, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified StoreInfo message, length delimited. Does not implicitly {@link cosmos.base.store.v1beta1.StoreInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.store.v1beta1.StoreInfo - * @static - * @param {cosmos.base.store.v1beta1.IStoreInfo} message StoreInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - StoreInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a StoreInfo message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.store.v1beta1.StoreInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.store.v1beta1.StoreInfo} StoreInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - StoreInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.store.v1beta1.StoreInfo(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.commit_id = $root.cosmos.base.store.v1beta1.CommitID.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a StoreInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.store.v1beta1.StoreInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.store.v1beta1.StoreInfo} StoreInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - StoreInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a StoreInfo message. - * @function verify - * @memberof cosmos.base.store.v1beta1.StoreInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - StoreInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.commit_id != null && message.hasOwnProperty("commit_id")) { - let error = $root.cosmos.base.store.v1beta1.CommitID.verify(message.commit_id); - if (error) - return "commit_id." + error; - } - return null; - }; - - /** - * Creates a StoreInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.store.v1beta1.StoreInfo - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.store.v1beta1.StoreInfo} StoreInfo - */ - StoreInfo.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.store.v1beta1.StoreInfo) - return object; - let message = new $root.cosmos.base.store.v1beta1.StoreInfo(); - if (object.name != null) - message.name = String(object.name); - if (object.commit_id != null) { - if (typeof object.commit_id !== "object") - throw TypeError(".cosmos.base.store.v1beta1.StoreInfo.commit_id: object expected"); - message.commit_id = $root.cosmos.base.store.v1beta1.CommitID.fromObject(object.commit_id); - } - return message; - }; - - /** - * Creates a plain object from a StoreInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.store.v1beta1.StoreInfo - * @static - * @param {cosmos.base.store.v1beta1.StoreInfo} message StoreInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - StoreInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.name = ""; - object.commit_id = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.commit_id != null && message.hasOwnProperty("commit_id")) - object.commit_id = $root.cosmos.base.store.v1beta1.CommitID.toObject(message.commit_id, options); - return object; - }; - - /** - * Converts this StoreInfo to JSON. - * @function toJSON - * @memberof cosmos.base.store.v1beta1.StoreInfo - * @instance - * @returns {Object.} JSON object - */ - StoreInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return StoreInfo; - })(); - - v1beta1.CommitID = (function() { - - /** - * Properties of a CommitID. - * @memberof cosmos.base.store.v1beta1 - * @interface ICommitID - * @property {Long|null} [version] CommitID version - * @property {Uint8Array|null} [hash] CommitID hash - */ - - /** - * Constructs a new CommitID. - * @memberof cosmos.base.store.v1beta1 - * @classdesc Represents a CommitID. - * @implements ICommitID - * @constructor - * @param {cosmos.base.store.v1beta1.ICommitID=} [properties] Properties to set - */ - function CommitID(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * CommitID version. - * @member {Long} version - * @memberof cosmos.base.store.v1beta1.CommitID - * @instance - */ - CommitID.prototype.version = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * CommitID hash. - * @member {Uint8Array} hash - * @memberof cosmos.base.store.v1beta1.CommitID - * @instance - */ - CommitID.prototype.hash = $util.newBuffer([]); - - /** - * Encodes the specified CommitID message. Does not implicitly {@link cosmos.base.store.v1beta1.CommitID.verify|verify} messages. - * @function encode - * @memberof cosmos.base.store.v1beta1.CommitID - * @static - * @param {cosmos.base.store.v1beta1.ICommitID} message CommitID message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CommitID.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.version != null && Object.hasOwnProperty.call(message, "version")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.version); - if (message.hash != null && Object.hasOwnProperty.call(message, "hash")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.hash); - return writer; - }; - - /** - * Encodes the specified CommitID message, length delimited. Does not implicitly {@link cosmos.base.store.v1beta1.CommitID.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.store.v1beta1.CommitID - * @static - * @param {cosmos.base.store.v1beta1.ICommitID} message CommitID message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CommitID.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CommitID message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.store.v1beta1.CommitID - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.store.v1beta1.CommitID} CommitID - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CommitID.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.store.v1beta1.CommitID(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.version = reader.int64(); - break; - case 2: - message.hash = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CommitID message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.store.v1beta1.CommitID - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.store.v1beta1.CommitID} CommitID - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CommitID.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CommitID message. - * @function verify - * @memberof cosmos.base.store.v1beta1.CommitID - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CommitID.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.version != null && message.hasOwnProperty("version")) - if (!$util.isInteger(message.version) && !(message.version && $util.isInteger(message.version.low) && $util.isInteger(message.version.high))) - return "version: integer|Long expected"; - if (message.hash != null && message.hasOwnProperty("hash")) - if (!(message.hash && typeof message.hash.length === "number" || $util.isString(message.hash))) - return "hash: buffer expected"; - return null; - }; - - /** - * Creates a CommitID message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.store.v1beta1.CommitID - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.store.v1beta1.CommitID} CommitID - */ - CommitID.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.store.v1beta1.CommitID) - return object; - let message = new $root.cosmos.base.store.v1beta1.CommitID(); - if (object.version != null) - if ($util.Long) - (message.version = $util.Long.fromValue(object.version)).unsigned = false; - else if (typeof object.version === "string") - message.version = parseInt(object.version, 10); - else if (typeof object.version === "number") - message.version = object.version; - else if (typeof object.version === "object") - message.version = new $util.LongBits(object.version.low >>> 0, object.version.high >>> 0).toNumber(); - if (object.hash != null) - if (typeof object.hash === "string") - $util.base64.decode(object.hash, message.hash = $util.newBuffer($util.base64.length(object.hash)), 0); - else if (object.hash.length) - message.hash = object.hash; - return message; - }; - - /** - * Creates a plain object from a CommitID message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.store.v1beta1.CommitID - * @static - * @param {cosmos.base.store.v1beta1.CommitID} message CommitID - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CommitID.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.version = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.version = options.longs === String ? "0" : 0; - if (options.bytes === String) - object.hash = ""; - else { - object.hash = []; - if (options.bytes !== Array) - object.hash = $util.newBuffer(object.hash); - } - } - if (message.version != null && message.hasOwnProperty("version")) - if (typeof message.version === "number") - object.version = options.longs === String ? String(message.version) : message.version; - else - object.version = options.longs === String ? $util.Long.prototype.toString.call(message.version) : options.longs === Number ? new $util.LongBits(message.version.low >>> 0, message.version.high >>> 0).toNumber() : message.version; - if (message.hash != null && message.hasOwnProperty("hash")) - object.hash = options.bytes === String ? $util.base64.encode(message.hash, 0, message.hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.hash) : message.hash; - return object; - }; - - /** - * Converts this CommitID to JSON. - * @function toJSON - * @memberof cosmos.base.store.v1beta1.CommitID - * @instance - * @returns {Object.} JSON object - */ - CommitID.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return CommitID; - })(); - - v1beta1.SnapshotItem = (function() { - - /** - * Properties of a SnapshotItem. - * @memberof cosmos.base.store.v1beta1 - * @interface ISnapshotItem - * @property {cosmos.base.store.v1beta1.ISnapshotStoreItem|null} [store] SnapshotItem store - * @property {cosmos.base.store.v1beta1.ISnapshotIAVLItem|null} [iavl] SnapshotItem iavl - */ - - /** - * Constructs a new SnapshotItem. - * @memberof cosmos.base.store.v1beta1 - * @classdesc Represents a SnapshotItem. - * @implements ISnapshotItem - * @constructor - * @param {cosmos.base.store.v1beta1.ISnapshotItem=} [properties] Properties to set - */ - function SnapshotItem(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SnapshotItem store. - * @member {cosmos.base.store.v1beta1.ISnapshotStoreItem|null|undefined} store - * @memberof cosmos.base.store.v1beta1.SnapshotItem - * @instance - */ - SnapshotItem.prototype.store = null; - - /** - * SnapshotItem iavl. - * @member {cosmos.base.store.v1beta1.ISnapshotIAVLItem|null|undefined} iavl - * @memberof cosmos.base.store.v1beta1.SnapshotItem - * @instance - */ - SnapshotItem.prototype.iavl = null; - - // OneOf field names bound to virtual getters and setters - let $oneOfFields; - - /** - * SnapshotItem item. - * @member {"store"|"iavl"|undefined} item - * @memberof cosmos.base.store.v1beta1.SnapshotItem - * @instance - */ - Object.defineProperty(SnapshotItem.prototype, "item", { - get: $util.oneOfGetter($oneOfFields = ["store", "iavl"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Encodes the specified SnapshotItem message. Does not implicitly {@link cosmos.base.store.v1beta1.SnapshotItem.verify|verify} messages. - * @function encode - * @memberof cosmos.base.store.v1beta1.SnapshotItem - * @static - * @param {cosmos.base.store.v1beta1.ISnapshotItem} message SnapshotItem message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SnapshotItem.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.store != null && Object.hasOwnProperty.call(message, "store")) - $root.cosmos.base.store.v1beta1.SnapshotStoreItem.encode(message.store, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.iavl != null && Object.hasOwnProperty.call(message, "iavl")) - $root.cosmos.base.store.v1beta1.SnapshotIAVLItem.encode(message.iavl, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SnapshotItem message, length delimited. Does not implicitly {@link cosmos.base.store.v1beta1.SnapshotItem.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.store.v1beta1.SnapshotItem - * @static - * @param {cosmos.base.store.v1beta1.ISnapshotItem} message SnapshotItem message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SnapshotItem.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SnapshotItem message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.store.v1beta1.SnapshotItem - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.store.v1beta1.SnapshotItem} SnapshotItem - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SnapshotItem.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.store.v1beta1.SnapshotItem(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.store = $root.cosmos.base.store.v1beta1.SnapshotStoreItem.decode(reader, reader.uint32()); - break; - case 2: - message.iavl = $root.cosmos.base.store.v1beta1.SnapshotIAVLItem.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SnapshotItem message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.store.v1beta1.SnapshotItem - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.store.v1beta1.SnapshotItem} SnapshotItem - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SnapshotItem.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SnapshotItem message. - * @function verify - * @memberof cosmos.base.store.v1beta1.SnapshotItem - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SnapshotItem.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - let properties = {}; - if (message.store != null && message.hasOwnProperty("store")) { - properties.item = 1; - { - let error = $root.cosmos.base.store.v1beta1.SnapshotStoreItem.verify(message.store); - if (error) - return "store." + error; - } - } - if (message.iavl != null && message.hasOwnProperty("iavl")) { - if (properties.item === 1) - return "item: multiple values"; - properties.item = 1; - { - let error = $root.cosmos.base.store.v1beta1.SnapshotIAVLItem.verify(message.iavl); - if (error) - return "iavl." + error; - } - } - return null; - }; - - /** - * Creates a SnapshotItem message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.store.v1beta1.SnapshotItem - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.store.v1beta1.SnapshotItem} SnapshotItem - */ - SnapshotItem.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.store.v1beta1.SnapshotItem) - return object; - let message = new $root.cosmos.base.store.v1beta1.SnapshotItem(); - if (object.store != null) { - if (typeof object.store !== "object") - throw TypeError(".cosmos.base.store.v1beta1.SnapshotItem.store: object expected"); - message.store = $root.cosmos.base.store.v1beta1.SnapshotStoreItem.fromObject(object.store); - } - if (object.iavl != null) { - if (typeof object.iavl !== "object") - throw TypeError(".cosmos.base.store.v1beta1.SnapshotItem.iavl: object expected"); - message.iavl = $root.cosmos.base.store.v1beta1.SnapshotIAVLItem.fromObject(object.iavl); - } - return message; - }; - - /** - * Creates a plain object from a SnapshotItem message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.store.v1beta1.SnapshotItem - * @static - * @param {cosmos.base.store.v1beta1.SnapshotItem} message SnapshotItem - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SnapshotItem.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (message.store != null && message.hasOwnProperty("store")) { - object.store = $root.cosmos.base.store.v1beta1.SnapshotStoreItem.toObject(message.store, options); - if (options.oneofs) - object.item = "store"; - } - if (message.iavl != null && message.hasOwnProperty("iavl")) { - object.iavl = $root.cosmos.base.store.v1beta1.SnapshotIAVLItem.toObject(message.iavl, options); - if (options.oneofs) - object.item = "iavl"; - } - return object; - }; - - /** - * Converts this SnapshotItem to JSON. - * @function toJSON - * @memberof cosmos.base.store.v1beta1.SnapshotItem - * @instance - * @returns {Object.} JSON object - */ - SnapshotItem.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return SnapshotItem; - })(); - - v1beta1.SnapshotStoreItem = (function() { - - /** - * Properties of a SnapshotStoreItem. - * @memberof cosmos.base.store.v1beta1 - * @interface ISnapshotStoreItem - * @property {string|null} [name] SnapshotStoreItem name - */ - - /** - * Constructs a new SnapshotStoreItem. - * @memberof cosmos.base.store.v1beta1 - * @classdesc Represents a SnapshotStoreItem. - * @implements ISnapshotStoreItem - * @constructor - * @param {cosmos.base.store.v1beta1.ISnapshotStoreItem=} [properties] Properties to set - */ - function SnapshotStoreItem(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SnapshotStoreItem name. - * @member {string} name - * @memberof cosmos.base.store.v1beta1.SnapshotStoreItem - * @instance - */ - SnapshotStoreItem.prototype.name = ""; - - /** - * Encodes the specified SnapshotStoreItem message. Does not implicitly {@link cosmos.base.store.v1beta1.SnapshotStoreItem.verify|verify} messages. - * @function encode - * @memberof cosmos.base.store.v1beta1.SnapshotStoreItem - * @static - * @param {cosmos.base.store.v1beta1.ISnapshotStoreItem} message SnapshotStoreItem message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SnapshotStoreItem.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified SnapshotStoreItem message, length delimited. Does not implicitly {@link cosmos.base.store.v1beta1.SnapshotStoreItem.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.store.v1beta1.SnapshotStoreItem - * @static - * @param {cosmos.base.store.v1beta1.ISnapshotStoreItem} message SnapshotStoreItem message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SnapshotStoreItem.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SnapshotStoreItem message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.store.v1beta1.SnapshotStoreItem - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.store.v1beta1.SnapshotStoreItem} SnapshotStoreItem - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SnapshotStoreItem.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.store.v1beta1.SnapshotStoreItem(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SnapshotStoreItem message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.store.v1beta1.SnapshotStoreItem - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.store.v1beta1.SnapshotStoreItem} SnapshotStoreItem - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SnapshotStoreItem.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SnapshotStoreItem message. - * @function verify - * @memberof cosmos.base.store.v1beta1.SnapshotStoreItem - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SnapshotStoreItem.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a SnapshotStoreItem message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.store.v1beta1.SnapshotStoreItem - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.store.v1beta1.SnapshotStoreItem} SnapshotStoreItem - */ - SnapshotStoreItem.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.store.v1beta1.SnapshotStoreItem) - return object; - let message = new $root.cosmos.base.store.v1beta1.SnapshotStoreItem(); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a SnapshotStoreItem message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.store.v1beta1.SnapshotStoreItem - * @static - * @param {cosmos.base.store.v1beta1.SnapshotStoreItem} message SnapshotStoreItem - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SnapshotStoreItem.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this SnapshotStoreItem to JSON. - * @function toJSON - * @memberof cosmos.base.store.v1beta1.SnapshotStoreItem - * @instance - * @returns {Object.} JSON object - */ - SnapshotStoreItem.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return SnapshotStoreItem; - })(); - - v1beta1.SnapshotIAVLItem = (function() { - - /** - * Properties of a SnapshotIAVLItem. - * @memberof cosmos.base.store.v1beta1 - * @interface ISnapshotIAVLItem - * @property {Uint8Array|null} [key] SnapshotIAVLItem key - * @property {Uint8Array|null} [value] SnapshotIAVLItem value - * @property {Long|null} [version] SnapshotIAVLItem version - * @property {number|null} [height] SnapshotIAVLItem height - */ - - /** - * Constructs a new SnapshotIAVLItem. - * @memberof cosmos.base.store.v1beta1 - * @classdesc Represents a SnapshotIAVLItem. - * @implements ISnapshotIAVLItem - * @constructor - * @param {cosmos.base.store.v1beta1.ISnapshotIAVLItem=} [properties] Properties to set - */ - function SnapshotIAVLItem(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SnapshotIAVLItem key. - * @member {Uint8Array} key - * @memberof cosmos.base.store.v1beta1.SnapshotIAVLItem - * @instance - */ - SnapshotIAVLItem.prototype.key = $util.newBuffer([]); - - /** - * SnapshotIAVLItem value. - * @member {Uint8Array} value - * @memberof cosmos.base.store.v1beta1.SnapshotIAVLItem - * @instance - */ - SnapshotIAVLItem.prototype.value = $util.newBuffer([]); - - /** - * SnapshotIAVLItem version. - * @member {Long} version - * @memberof cosmos.base.store.v1beta1.SnapshotIAVLItem - * @instance - */ - SnapshotIAVLItem.prototype.version = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * SnapshotIAVLItem height. - * @member {number} height - * @memberof cosmos.base.store.v1beta1.SnapshotIAVLItem - * @instance - */ - SnapshotIAVLItem.prototype.height = 0; - - /** - * Encodes the specified SnapshotIAVLItem message. Does not implicitly {@link cosmos.base.store.v1beta1.SnapshotIAVLItem.verify|verify} messages. - * @function encode - * @memberof cosmos.base.store.v1beta1.SnapshotIAVLItem - * @static - * @param {cosmos.base.store.v1beta1.ISnapshotIAVLItem} message SnapshotIAVLItem message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SnapshotIAVLItem.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value); - if (message.version != null && Object.hasOwnProperty.call(message, "version")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.version); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.height); - return writer; - }; - - /** - * Encodes the specified SnapshotIAVLItem message, length delimited. Does not implicitly {@link cosmos.base.store.v1beta1.SnapshotIAVLItem.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.store.v1beta1.SnapshotIAVLItem - * @static - * @param {cosmos.base.store.v1beta1.ISnapshotIAVLItem} message SnapshotIAVLItem message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SnapshotIAVLItem.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SnapshotIAVLItem message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.store.v1beta1.SnapshotIAVLItem - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.store.v1beta1.SnapshotIAVLItem} SnapshotIAVLItem - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SnapshotIAVLItem.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.store.v1beta1.SnapshotIAVLItem(); - while (reader.pos < end) { - let 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(); - break; - case 4: - message.height = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SnapshotIAVLItem message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.store.v1beta1.SnapshotIAVLItem - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.store.v1beta1.SnapshotIAVLItem} SnapshotIAVLItem - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SnapshotIAVLItem.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SnapshotIAVLItem message. - * @function verify - * @memberof cosmos.base.store.v1beta1.SnapshotIAVLItem - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SnapshotIAVLItem.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) - return "key: buffer expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) - return "value: buffer expected"; - if (message.version != null && message.hasOwnProperty("version")) - if (!$util.isInteger(message.version) && !(message.version && $util.isInteger(message.version.low) && $util.isInteger(message.version.high))) - return "version: integer|Long expected"; - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height)) - return "height: integer expected"; - return null; - }; - - /** - * Creates a SnapshotIAVLItem message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.store.v1beta1.SnapshotIAVLItem - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.store.v1beta1.SnapshotIAVLItem} SnapshotIAVLItem - */ - SnapshotIAVLItem.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.store.v1beta1.SnapshotIAVLItem) - return object; - let message = new $root.cosmos.base.store.v1beta1.SnapshotIAVLItem(); - if (object.key != null) - if (typeof object.key === "string") - $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); - else if (object.key.length) - message.key = object.key; - if (object.value != null) - if (typeof object.value === "string") - $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); - else if (object.value.length) - message.value = object.value; - if (object.version != null) - if ($util.Long) - (message.version = $util.Long.fromValue(object.version)).unsigned = false; - else if (typeof object.version === "string") - message.version = parseInt(object.version, 10); - else if (typeof object.version === "number") - message.version = object.version; - else if (typeof object.version === "object") - message.version = new $util.LongBits(object.version.low >>> 0, object.version.high >>> 0).toNumber(); - if (object.height != null) - message.height = object.height | 0; - return message; - }; - - /** - * Creates a plain object from a SnapshotIAVLItem message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.store.v1beta1.SnapshotIAVLItem - * @static - * @param {cosmos.base.store.v1beta1.SnapshotIAVLItem} message SnapshotIAVLItem - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SnapshotIAVLItem.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if (options.bytes === String) - object.key = ""; - else { - object.key = []; - if (options.bytes !== Array) - object.key = $util.newBuffer(object.key); - } - if (options.bytes === String) - object.value = ""; - else { - object.value = []; - if (options.bytes !== Array) - object.value = $util.newBuffer(object.value); - } - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.version = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.version = options.longs === String ? "0" : 0; - object.height = 0; - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; - if (message.value != null && message.hasOwnProperty("value")) - object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; - if (message.version != null && message.hasOwnProperty("version")) - if (typeof message.version === "number") - object.version = options.longs === String ? String(message.version) : message.version; - else - object.version = options.longs === String ? $util.Long.prototype.toString.call(message.version) : options.longs === Number ? new $util.LongBits(message.version.low >>> 0, message.version.high >>> 0).toNumber() : message.version; - if (message.height != null && message.hasOwnProperty("height")) - object.height = message.height; - return object; - }; - - /** - * Converts this SnapshotIAVLItem to JSON. - * @function toJSON - * @memberof cosmos.base.store.v1beta1.SnapshotIAVLItem - * @instance - * @returns {Object.} JSON object - */ - SnapshotIAVLItem.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return SnapshotIAVLItem; - })(); - - return v1beta1; - })(); - - return store; - })(); - - base.tendermint = (function() { - - /** - * Namespace tendermint. - * @memberof cosmos.base - * @namespace - */ - const tendermint = {}; - - tendermint.v1beta1 = (function() { - - /** - * Namespace v1beta1. - * @memberof cosmos.base.tendermint - * @namespace - */ - const v1beta1 = {}; - - v1beta1.Service = (function() { - - /** - * Constructs a new Service service. - * @memberof cosmos.base.tendermint.v1beta1 - * @classdesc Represents a Service - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function Service(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Service.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Service; - - /** - * Callback as used by {@link cosmos.base.tendermint.v1beta1.Service#getNodeInfo}. - * @memberof cosmos.base.tendermint.v1beta1.Service - * @typedef GetNodeInfoCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.base.tendermint.v1beta1.GetNodeInfoResponse} [response] GetNodeInfoResponse - */ - - /** - * Calls GetNodeInfo. - * @function getNodeInfo - * @memberof cosmos.base.tendermint.v1beta1.Service - * @instance - * @param {cosmos.base.tendermint.v1beta1.IGetNodeInfoRequest} request GetNodeInfoRequest message or plain object - * @param {cosmos.base.tendermint.v1beta1.Service.GetNodeInfoCallback} callback Node-style callback called with the error, if any, and GetNodeInfoResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Service.prototype.getNodeInfo = function getNodeInfo(request, callback) { - return this.rpcCall(getNodeInfo, $root.cosmos.base.tendermint.v1beta1.GetNodeInfoRequest, $root.cosmos.base.tendermint.v1beta1.GetNodeInfoResponse, request, callback); - }, "name", { value: "GetNodeInfo" }); - - /** - * Calls GetNodeInfo. - * @function getNodeInfo - * @memberof cosmos.base.tendermint.v1beta1.Service - * @instance - * @param {cosmos.base.tendermint.v1beta1.IGetNodeInfoRequest} request GetNodeInfoRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.base.tendermint.v1beta1.Service#getSyncing}. - * @memberof cosmos.base.tendermint.v1beta1.Service - * @typedef GetSyncingCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.base.tendermint.v1beta1.GetSyncingResponse} [response] GetSyncingResponse - */ - - /** - * Calls GetSyncing. - * @function getSyncing - * @memberof cosmos.base.tendermint.v1beta1.Service - * @instance - * @param {cosmos.base.tendermint.v1beta1.IGetSyncingRequest} request GetSyncingRequest message or plain object - * @param {cosmos.base.tendermint.v1beta1.Service.GetSyncingCallback} callback Node-style callback called with the error, if any, and GetSyncingResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Service.prototype.getSyncing = function getSyncing(request, callback) { - return this.rpcCall(getSyncing, $root.cosmos.base.tendermint.v1beta1.GetSyncingRequest, $root.cosmos.base.tendermint.v1beta1.GetSyncingResponse, request, callback); - }, "name", { value: "GetSyncing" }); - - /** - * Calls GetSyncing. - * @function getSyncing - * @memberof cosmos.base.tendermint.v1beta1.Service - * @instance - * @param {cosmos.base.tendermint.v1beta1.IGetSyncingRequest} request GetSyncingRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.base.tendermint.v1beta1.Service#getLatestBlock}. - * @memberof cosmos.base.tendermint.v1beta1.Service - * @typedef GetLatestBlockCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.base.tendermint.v1beta1.GetLatestBlockResponse} [response] GetLatestBlockResponse - */ - - /** - * Calls GetLatestBlock. - * @function getLatestBlock - * @memberof cosmos.base.tendermint.v1beta1.Service - * @instance - * @param {cosmos.base.tendermint.v1beta1.IGetLatestBlockRequest} request GetLatestBlockRequest message or plain object - * @param {cosmos.base.tendermint.v1beta1.Service.GetLatestBlockCallback} callback Node-style callback called with the error, if any, and GetLatestBlockResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Service.prototype.getLatestBlock = function getLatestBlock(request, callback) { - return this.rpcCall(getLatestBlock, $root.cosmos.base.tendermint.v1beta1.GetLatestBlockRequest, $root.cosmos.base.tendermint.v1beta1.GetLatestBlockResponse, request, callback); - }, "name", { value: "GetLatestBlock" }); - - /** - * Calls GetLatestBlock. - * @function getLatestBlock - * @memberof cosmos.base.tendermint.v1beta1.Service - * @instance - * @param {cosmos.base.tendermint.v1beta1.IGetLatestBlockRequest} request GetLatestBlockRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.base.tendermint.v1beta1.Service#getBlockByHeight}. - * @memberof cosmos.base.tendermint.v1beta1.Service - * @typedef GetBlockByHeightCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse} [response] GetBlockByHeightResponse - */ - - /** - * Calls GetBlockByHeight. - * @function getBlockByHeight - * @memberof cosmos.base.tendermint.v1beta1.Service - * @instance - * @param {cosmos.base.tendermint.v1beta1.IGetBlockByHeightRequest} request GetBlockByHeightRequest message or plain object - * @param {cosmos.base.tendermint.v1beta1.Service.GetBlockByHeightCallback} callback Node-style callback called with the error, if any, and GetBlockByHeightResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Service.prototype.getBlockByHeight = function getBlockByHeight(request, callback) { - return this.rpcCall(getBlockByHeight, $root.cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest, $root.cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse, request, callback); - }, "name", { value: "GetBlockByHeight" }); - - /** - * Calls GetBlockByHeight. - * @function getBlockByHeight - * @memberof cosmos.base.tendermint.v1beta1.Service - * @instance - * @param {cosmos.base.tendermint.v1beta1.IGetBlockByHeightRequest} request GetBlockByHeightRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.base.tendermint.v1beta1.Service#getLatestValidatorSet}. - * @memberof cosmos.base.tendermint.v1beta1.Service - * @typedef GetLatestValidatorSetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse} [response] GetLatestValidatorSetResponse - */ - - /** - * Calls GetLatestValidatorSet. - * @function getLatestValidatorSet - * @memberof cosmos.base.tendermint.v1beta1.Service - * @instance - * @param {cosmos.base.tendermint.v1beta1.IGetLatestValidatorSetRequest} request GetLatestValidatorSetRequest message or plain object - * @param {cosmos.base.tendermint.v1beta1.Service.GetLatestValidatorSetCallback} callback Node-style callback called with the error, if any, and GetLatestValidatorSetResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Service.prototype.getLatestValidatorSet = function getLatestValidatorSet(request, callback) { - return this.rpcCall(getLatestValidatorSet, $root.cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest, $root.cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse, request, callback); - }, "name", { value: "GetLatestValidatorSet" }); - - /** - * Calls GetLatestValidatorSet. - * @function getLatestValidatorSet - * @memberof cosmos.base.tendermint.v1beta1.Service - * @instance - * @param {cosmos.base.tendermint.v1beta1.IGetLatestValidatorSetRequest} request GetLatestValidatorSetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.base.tendermint.v1beta1.Service#getValidatorSetByHeight}. - * @memberof cosmos.base.tendermint.v1beta1.Service - * @typedef GetValidatorSetByHeightCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse} [response] GetValidatorSetByHeightResponse - */ - - /** - * Calls GetValidatorSetByHeight. - * @function getValidatorSetByHeight - * @memberof cosmos.base.tendermint.v1beta1.Service - * @instance - * @param {cosmos.base.tendermint.v1beta1.IGetValidatorSetByHeightRequest} request GetValidatorSetByHeightRequest message or plain object - * @param {cosmos.base.tendermint.v1beta1.Service.GetValidatorSetByHeightCallback} callback Node-style callback called with the error, if any, and GetValidatorSetByHeightResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Service.prototype.getValidatorSetByHeight = function getValidatorSetByHeight(request, callback) { - return this.rpcCall(getValidatorSetByHeight, $root.cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest, $root.cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse, request, callback); - }, "name", { value: "GetValidatorSetByHeight" }); - - /** - * Calls GetValidatorSetByHeight. - * @function getValidatorSetByHeight - * @memberof cosmos.base.tendermint.v1beta1.Service - * @instance - * @param {cosmos.base.tendermint.v1beta1.IGetValidatorSetByHeightRequest} request GetValidatorSetByHeightRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return Service; - })(); - - v1beta1.GetValidatorSetByHeightRequest = (function() { - - /** - * Properties of a GetValidatorSetByHeightRequest. - * @memberof cosmos.base.tendermint.v1beta1 - * @interface IGetValidatorSetByHeightRequest - * @property {Long|null} [height] GetValidatorSetByHeightRequest height - * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] GetValidatorSetByHeightRequest pagination - */ - - /** - * Constructs a new GetValidatorSetByHeightRequest. - * @memberof cosmos.base.tendermint.v1beta1 - * @classdesc Represents a GetValidatorSetByHeightRequest. - * @implements IGetValidatorSetByHeightRequest - * @constructor - * @param {cosmos.base.tendermint.v1beta1.IGetValidatorSetByHeightRequest=} [properties] Properties to set - */ - function GetValidatorSetByHeightRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GetValidatorSetByHeightRequest height. - * @member {Long} height - * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest - * @instance - */ - GetValidatorSetByHeightRequest.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * GetValidatorSetByHeightRequest pagination. - * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination - * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest - * @instance - */ - GetValidatorSetByHeightRequest.prototype.pagination = null; - - /** - * Encodes the specified GetValidatorSetByHeightRequest message. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest - * @static - * @param {cosmos.base.tendermint.v1beta1.IGetValidatorSetByHeightRequest} message GetValidatorSetByHeightRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetValidatorSetByHeightRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.height); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GetValidatorSetByHeightRequest message, length delimited. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest - * @static - * @param {cosmos.base.tendermint.v1beta1.IGetValidatorSetByHeightRequest} message GetValidatorSetByHeightRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetValidatorSetByHeightRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetValidatorSetByHeightRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest} GetValidatorSetByHeightRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetValidatorSetByHeightRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.height = reader.int64(); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetValidatorSetByHeightRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest} GetValidatorSetByHeightRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetValidatorSetByHeightRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetValidatorSetByHeightRequest message. - * @function verify - * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetValidatorSetByHeightRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) - return "height: integer|Long expected"; - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a GetValidatorSetByHeightRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest} GetValidatorSetByHeightRequest - */ - GetValidatorSetByHeightRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest) - return object; - let message = new $root.cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest(); - if (object.height != null) - if ($util.Long) - (message.height = $util.Long.fromValue(object.height)).unsigned = false; - else if (typeof object.height === "string") - message.height = parseInt(object.height, 10); - else if (typeof object.height === "number") - message.height = object.height; - else if (typeof object.height === "object") - message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a GetValidatorSetByHeightRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest - * @static - * @param {cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest} message GetValidatorSetByHeightRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetValidatorSetByHeightRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.height = options.longs === String ? "0" : 0; - object.pagination = null; - } - if (message.height != null && message.hasOwnProperty("height")) - if (typeof message.height === "number") - object.height = options.longs === String ? String(message.height) : message.height; - else - object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this GetValidatorSetByHeightRequest to JSON. - * @function toJSON - * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest - * @instance - * @returns {Object.} JSON object - */ - GetValidatorSetByHeightRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GetValidatorSetByHeightRequest; - })(); - - v1beta1.GetValidatorSetByHeightResponse = (function() { - - /** - * Properties of a GetValidatorSetByHeightResponse. - * @memberof cosmos.base.tendermint.v1beta1 - * @interface IGetValidatorSetByHeightResponse - * @property {Long|null} [block_height] GetValidatorSetByHeightResponse block_height - * @property {Array.|null} [validators] GetValidatorSetByHeightResponse validators - * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] GetValidatorSetByHeightResponse pagination - */ - - /** - * Constructs a new GetValidatorSetByHeightResponse. - * @memberof cosmos.base.tendermint.v1beta1 - * @classdesc Represents a GetValidatorSetByHeightResponse. - * @implements IGetValidatorSetByHeightResponse - * @constructor - * @param {cosmos.base.tendermint.v1beta1.IGetValidatorSetByHeightResponse=} [properties] Properties to set - */ - function GetValidatorSetByHeightResponse(properties) { - this.validators = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GetValidatorSetByHeightResponse block_height. - * @member {Long} block_height - * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse - * @instance - */ - GetValidatorSetByHeightResponse.prototype.block_height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * GetValidatorSetByHeightResponse validators. - * @member {Array.} validators - * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse - * @instance - */ - GetValidatorSetByHeightResponse.prototype.validators = $util.emptyArray; - - /** - * GetValidatorSetByHeightResponse pagination. - * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination - * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse - * @instance - */ - GetValidatorSetByHeightResponse.prototype.pagination = null; - - /** - * Encodes the specified GetValidatorSetByHeightResponse message. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse - * @static - * @param {cosmos.base.tendermint.v1beta1.IGetValidatorSetByHeightResponse} message GetValidatorSetByHeightResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetValidatorSetByHeightResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.block_height != null && Object.hasOwnProperty.call(message, "block_height")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.block_height); - if (message.validators != null && message.validators.length) - for (let i = 0; i < message.validators.length; ++i) - $root.cosmos.base.tendermint.v1beta1.Validator.encode(message.validators[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GetValidatorSetByHeightResponse message, length delimited. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse - * @static - * @param {cosmos.base.tendermint.v1beta1.IGetValidatorSetByHeightResponse} message GetValidatorSetByHeightResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetValidatorSetByHeightResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetValidatorSetByHeightResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse} GetValidatorSetByHeightResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetValidatorSetByHeightResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.block_height = reader.int64(); - break; - case 2: - if (!(message.validators && message.validators.length)) - message.validators = []; - message.validators.push($root.cosmos.base.tendermint.v1beta1.Validator.decode(reader, reader.uint32())); - break; - case 3: - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetValidatorSetByHeightResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse} GetValidatorSetByHeightResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetValidatorSetByHeightResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetValidatorSetByHeightResponse message. - * @function verify - * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetValidatorSetByHeightResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.block_height != null && message.hasOwnProperty("block_height")) - if (!$util.isInteger(message.block_height) && !(message.block_height && $util.isInteger(message.block_height.low) && $util.isInteger(message.block_height.high))) - return "block_height: integer|Long expected"; - if (message.validators != null && message.hasOwnProperty("validators")) { - if (!Array.isArray(message.validators)) - return "validators: array expected"; - for (let i = 0; i < message.validators.length; ++i) { - let error = $root.cosmos.base.tendermint.v1beta1.Validator.verify(message.validators[i]); - if (error) - return "validators." + error; - } - } - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a GetValidatorSetByHeightResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse} GetValidatorSetByHeightResponse - */ - GetValidatorSetByHeightResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse) - return object; - let message = new $root.cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse(); - if (object.block_height != null) - if ($util.Long) - (message.block_height = $util.Long.fromValue(object.block_height)).unsigned = false; - else if (typeof object.block_height === "string") - message.block_height = parseInt(object.block_height, 10); - else if (typeof object.block_height === "number") - message.block_height = object.block_height; - else if (typeof object.block_height === "object") - message.block_height = new $util.LongBits(object.block_height.low >>> 0, object.block_height.high >>> 0).toNumber(); - if (object.validators) { - if (!Array.isArray(object.validators)) - throw TypeError(".cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse.validators: array expected"); - message.validators = []; - for (let i = 0; i < object.validators.length; ++i) { - if (typeof object.validators[i] !== "object") - throw TypeError(".cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse.validators: object expected"); - message.validators[i] = $root.cosmos.base.tendermint.v1beta1.Validator.fromObject(object.validators[i]); - } - } - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a GetValidatorSetByHeightResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse - * @static - * @param {cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse} message GetValidatorSetByHeightResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetValidatorSetByHeightResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.validators = []; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.block_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.block_height = options.longs === String ? "0" : 0; - object.pagination = null; - } - if (message.block_height != null && message.hasOwnProperty("block_height")) - if (typeof message.block_height === "number") - object.block_height = options.longs === String ? String(message.block_height) : message.block_height; - else - object.block_height = options.longs === String ? $util.Long.prototype.toString.call(message.block_height) : options.longs === Number ? new $util.LongBits(message.block_height.low >>> 0, message.block_height.high >>> 0).toNumber() : message.block_height; - if (message.validators && message.validators.length) { - object.validators = []; - for (let j = 0; j < message.validators.length; ++j) - object.validators[j] = $root.cosmos.base.tendermint.v1beta1.Validator.toObject(message.validators[j], options); - } - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this GetValidatorSetByHeightResponse to JSON. - * @function toJSON - * @memberof cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse - * @instance - * @returns {Object.} JSON object - */ - GetValidatorSetByHeightResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GetValidatorSetByHeightResponse; - })(); - - v1beta1.GetLatestValidatorSetRequest = (function() { - - /** - * Properties of a GetLatestValidatorSetRequest. - * @memberof cosmos.base.tendermint.v1beta1 - * @interface IGetLatestValidatorSetRequest - * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] GetLatestValidatorSetRequest pagination - */ - - /** - * Constructs a new GetLatestValidatorSetRequest. - * @memberof cosmos.base.tendermint.v1beta1 - * @classdesc Represents a GetLatestValidatorSetRequest. - * @implements IGetLatestValidatorSetRequest - * @constructor - * @param {cosmos.base.tendermint.v1beta1.IGetLatestValidatorSetRequest=} [properties] Properties to set - */ - function GetLatestValidatorSetRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GetLatestValidatorSetRequest pagination. - * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination - * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest - * @instance - */ - GetLatestValidatorSetRequest.prototype.pagination = null; - - /** - * Encodes the specified GetLatestValidatorSetRequest message. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest - * @static - * @param {cosmos.base.tendermint.v1beta1.IGetLatestValidatorSetRequest} message GetLatestValidatorSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetLatestValidatorSetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GetLatestValidatorSetRequest message, length delimited. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest - * @static - * @param {cosmos.base.tendermint.v1beta1.IGetLatestValidatorSetRequest} message GetLatestValidatorSetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetLatestValidatorSetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetLatestValidatorSetRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest} GetLatestValidatorSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetLatestValidatorSetRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetLatestValidatorSetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest} GetLatestValidatorSetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetLatestValidatorSetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetLatestValidatorSetRequest message. - * @function verify - * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetLatestValidatorSetRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a GetLatestValidatorSetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest} GetLatestValidatorSetRequest - */ - GetLatestValidatorSetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest) - return object; - let message = new $root.cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest(); - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a GetLatestValidatorSetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest - * @static - * @param {cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest} message GetLatestValidatorSetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetLatestValidatorSetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.pagination = null; - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this GetLatestValidatorSetRequest to JSON. - * @function toJSON - * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest - * @instance - * @returns {Object.} JSON object - */ - GetLatestValidatorSetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GetLatestValidatorSetRequest; - })(); - - v1beta1.GetLatestValidatorSetResponse = (function() { - - /** - * Properties of a GetLatestValidatorSetResponse. - * @memberof cosmos.base.tendermint.v1beta1 - * @interface IGetLatestValidatorSetResponse - * @property {Long|null} [block_height] GetLatestValidatorSetResponse block_height - * @property {Array.|null} [validators] GetLatestValidatorSetResponse validators - * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] GetLatestValidatorSetResponse pagination - */ - - /** - * Constructs a new GetLatestValidatorSetResponse. - * @memberof cosmos.base.tendermint.v1beta1 - * @classdesc Represents a GetLatestValidatorSetResponse. - * @implements IGetLatestValidatorSetResponse - * @constructor - * @param {cosmos.base.tendermint.v1beta1.IGetLatestValidatorSetResponse=} [properties] Properties to set - */ - function GetLatestValidatorSetResponse(properties) { - this.validators = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GetLatestValidatorSetResponse block_height. - * @member {Long} block_height - * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse - * @instance - */ - GetLatestValidatorSetResponse.prototype.block_height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * GetLatestValidatorSetResponse validators. - * @member {Array.} validators - * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse - * @instance - */ - GetLatestValidatorSetResponse.prototype.validators = $util.emptyArray; - - /** - * GetLatestValidatorSetResponse pagination. - * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination - * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse - * @instance - */ - GetLatestValidatorSetResponse.prototype.pagination = null; - - /** - * Encodes the specified GetLatestValidatorSetResponse message. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse - * @static - * @param {cosmos.base.tendermint.v1beta1.IGetLatestValidatorSetResponse} message GetLatestValidatorSetResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetLatestValidatorSetResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.block_height != null && Object.hasOwnProperty.call(message, "block_height")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.block_height); - if (message.validators != null && message.validators.length) - for (let i = 0; i < message.validators.length; ++i) - $root.cosmos.base.tendermint.v1beta1.Validator.encode(message.validators[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GetLatestValidatorSetResponse message, length delimited. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse - * @static - * @param {cosmos.base.tendermint.v1beta1.IGetLatestValidatorSetResponse} message GetLatestValidatorSetResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetLatestValidatorSetResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetLatestValidatorSetResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse} GetLatestValidatorSetResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetLatestValidatorSetResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.block_height = reader.int64(); - break; - case 2: - if (!(message.validators && message.validators.length)) - message.validators = []; - message.validators.push($root.cosmos.base.tendermint.v1beta1.Validator.decode(reader, reader.uint32())); - break; - case 3: - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetLatestValidatorSetResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse} GetLatestValidatorSetResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetLatestValidatorSetResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetLatestValidatorSetResponse message. - * @function verify - * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetLatestValidatorSetResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.block_height != null && message.hasOwnProperty("block_height")) - if (!$util.isInteger(message.block_height) && !(message.block_height && $util.isInteger(message.block_height.low) && $util.isInteger(message.block_height.high))) - return "block_height: integer|Long expected"; - if (message.validators != null && message.hasOwnProperty("validators")) { - if (!Array.isArray(message.validators)) - return "validators: array expected"; - for (let i = 0; i < message.validators.length; ++i) { - let error = $root.cosmos.base.tendermint.v1beta1.Validator.verify(message.validators[i]); - if (error) - return "validators." + error; - } - } - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a GetLatestValidatorSetResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse} GetLatestValidatorSetResponse - */ - GetLatestValidatorSetResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse) - return object; - let message = new $root.cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse(); - if (object.block_height != null) - if ($util.Long) - (message.block_height = $util.Long.fromValue(object.block_height)).unsigned = false; - else if (typeof object.block_height === "string") - message.block_height = parseInt(object.block_height, 10); - else if (typeof object.block_height === "number") - message.block_height = object.block_height; - else if (typeof object.block_height === "object") - message.block_height = new $util.LongBits(object.block_height.low >>> 0, object.block_height.high >>> 0).toNumber(); - if (object.validators) { - if (!Array.isArray(object.validators)) - throw TypeError(".cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse.validators: array expected"); - message.validators = []; - for (let i = 0; i < object.validators.length; ++i) { - if (typeof object.validators[i] !== "object") - throw TypeError(".cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse.validators: object expected"); - message.validators[i] = $root.cosmos.base.tendermint.v1beta1.Validator.fromObject(object.validators[i]); - } - } - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a GetLatestValidatorSetResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse - * @static - * @param {cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse} message GetLatestValidatorSetResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetLatestValidatorSetResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.validators = []; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.block_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.block_height = options.longs === String ? "0" : 0; - object.pagination = null; - } - if (message.block_height != null && message.hasOwnProperty("block_height")) - if (typeof message.block_height === "number") - object.block_height = options.longs === String ? String(message.block_height) : message.block_height; - else - object.block_height = options.longs === String ? $util.Long.prototype.toString.call(message.block_height) : options.longs === Number ? new $util.LongBits(message.block_height.low >>> 0, message.block_height.high >>> 0).toNumber() : message.block_height; - if (message.validators && message.validators.length) { - object.validators = []; - for (let j = 0; j < message.validators.length; ++j) - object.validators[j] = $root.cosmos.base.tendermint.v1beta1.Validator.toObject(message.validators[j], options); - } - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this GetLatestValidatorSetResponse to JSON. - * @function toJSON - * @memberof cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse - * @instance - * @returns {Object.} JSON object - */ - GetLatestValidatorSetResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GetLatestValidatorSetResponse; - })(); - - v1beta1.Validator = (function() { - - /** - * Properties of a Validator. - * @memberof cosmos.base.tendermint.v1beta1 - * @interface IValidator - * @property {string|null} [address] Validator address - * @property {google.protobuf.IAny|null} [pub_key] Validator pub_key - * @property {Long|null} [voting_power] Validator voting_power - * @property {Long|null} [proposer_priority] Validator proposer_priority - */ - - /** - * Constructs a new Validator. - * @memberof cosmos.base.tendermint.v1beta1 - * @classdesc Represents a Validator. - * @implements IValidator - * @constructor - * @param {cosmos.base.tendermint.v1beta1.IValidator=} [properties] Properties to set - */ - function Validator(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Validator address. - * @member {string} address - * @memberof cosmos.base.tendermint.v1beta1.Validator - * @instance - */ - Validator.prototype.address = ""; - - /** - * Validator pub_key. - * @member {google.protobuf.IAny|null|undefined} pub_key - * @memberof cosmos.base.tendermint.v1beta1.Validator - * @instance - */ - Validator.prototype.pub_key = null; - - /** - * Validator voting_power. - * @member {Long} voting_power - * @memberof cosmos.base.tendermint.v1beta1.Validator - * @instance - */ - Validator.prototype.voting_power = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Validator proposer_priority. - * @member {Long} proposer_priority - * @memberof cosmos.base.tendermint.v1beta1.Validator - * @instance - */ - Validator.prototype.proposer_priority = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Encodes the specified Validator message. Does not implicitly {@link cosmos.base.tendermint.v1beta1.Validator.verify|verify} messages. - * @function encode - * @memberof cosmos.base.tendermint.v1beta1.Validator - * @static - * @param {cosmos.base.tendermint.v1beta1.IValidator} message Validator message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Validator.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.address != null && Object.hasOwnProperty.call(message, "address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.address); - if (message.pub_key != null && Object.hasOwnProperty.call(message, "pub_key")) - $root.google.protobuf.Any.encode(message.pub_key, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.voting_power != null && Object.hasOwnProperty.call(message, "voting_power")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.voting_power); - if (message.proposer_priority != null && Object.hasOwnProperty.call(message, "proposer_priority")) - writer.uint32(/* id 4, wireType 0 =*/32).int64(message.proposer_priority); - return writer; - }; - - /** - * Encodes the specified Validator message, length delimited. Does not implicitly {@link cosmos.base.tendermint.v1beta1.Validator.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.tendermint.v1beta1.Validator - * @static - * @param {cosmos.base.tendermint.v1beta1.IValidator} message Validator message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Validator.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Validator message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.tendermint.v1beta1.Validator - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.tendermint.v1beta1.Validator} Validator - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Validator.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.tendermint.v1beta1.Validator(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.address = reader.string(); - break; - case 2: - message.pub_key = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - case 3: - message.voting_power = reader.int64(); - break; - case 4: - message.proposer_priority = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Validator message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.tendermint.v1beta1.Validator - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.tendermint.v1beta1.Validator} Validator - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Validator.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Validator message. - * @function verify - * @memberof cosmos.base.tendermint.v1beta1.Validator - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Validator.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.address != null && message.hasOwnProperty("address")) - if (!$util.isString(message.address)) - return "address: string expected"; - if (message.pub_key != null && message.hasOwnProperty("pub_key")) { - let error = $root.google.protobuf.Any.verify(message.pub_key); - if (error) - return "pub_key." + error; - } - if (message.voting_power != null && message.hasOwnProperty("voting_power")) - if (!$util.isInteger(message.voting_power) && !(message.voting_power && $util.isInteger(message.voting_power.low) && $util.isInteger(message.voting_power.high))) - return "voting_power: integer|Long expected"; - if (message.proposer_priority != null && message.hasOwnProperty("proposer_priority")) - if (!$util.isInteger(message.proposer_priority) && !(message.proposer_priority && $util.isInteger(message.proposer_priority.low) && $util.isInteger(message.proposer_priority.high))) - return "proposer_priority: integer|Long expected"; - return null; - }; - - /** - * Creates a Validator message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.tendermint.v1beta1.Validator - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.tendermint.v1beta1.Validator} Validator - */ - Validator.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.tendermint.v1beta1.Validator) - return object; - let message = new $root.cosmos.base.tendermint.v1beta1.Validator(); - if (object.address != null) - message.address = String(object.address); - if (object.pub_key != null) { - if (typeof object.pub_key !== "object") - throw TypeError(".cosmos.base.tendermint.v1beta1.Validator.pub_key: object expected"); - message.pub_key = $root.google.protobuf.Any.fromObject(object.pub_key); - } - if (object.voting_power != null) - if ($util.Long) - (message.voting_power = $util.Long.fromValue(object.voting_power)).unsigned = false; - else if (typeof object.voting_power === "string") - message.voting_power = parseInt(object.voting_power, 10); - else if (typeof object.voting_power === "number") - message.voting_power = object.voting_power; - else if (typeof object.voting_power === "object") - message.voting_power = new $util.LongBits(object.voting_power.low >>> 0, object.voting_power.high >>> 0).toNumber(); - if (object.proposer_priority != null) - if ($util.Long) - (message.proposer_priority = $util.Long.fromValue(object.proposer_priority)).unsigned = false; - else if (typeof object.proposer_priority === "string") - message.proposer_priority = parseInt(object.proposer_priority, 10); - else if (typeof object.proposer_priority === "number") - message.proposer_priority = object.proposer_priority; - else if (typeof object.proposer_priority === "object") - message.proposer_priority = new $util.LongBits(object.proposer_priority.low >>> 0, object.proposer_priority.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a Validator message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.tendermint.v1beta1.Validator - * @static - * @param {cosmos.base.tendermint.v1beta1.Validator} message Validator - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Validator.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.address = ""; - object.pub_key = null; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.voting_power = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.voting_power = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.proposer_priority = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.proposer_priority = options.longs === String ? "0" : 0; - } - if (message.address != null && message.hasOwnProperty("address")) - object.address = message.address; - if (message.pub_key != null && message.hasOwnProperty("pub_key")) - object.pub_key = $root.google.protobuf.Any.toObject(message.pub_key, options); - if (message.voting_power != null && message.hasOwnProperty("voting_power")) - if (typeof message.voting_power === "number") - object.voting_power = options.longs === String ? String(message.voting_power) : message.voting_power; - else - object.voting_power = options.longs === String ? $util.Long.prototype.toString.call(message.voting_power) : options.longs === Number ? new $util.LongBits(message.voting_power.low >>> 0, message.voting_power.high >>> 0).toNumber() : message.voting_power; - if (message.proposer_priority != null && message.hasOwnProperty("proposer_priority")) - if (typeof message.proposer_priority === "number") - object.proposer_priority = options.longs === String ? String(message.proposer_priority) : message.proposer_priority; - else - object.proposer_priority = options.longs === String ? $util.Long.prototype.toString.call(message.proposer_priority) : options.longs === Number ? new $util.LongBits(message.proposer_priority.low >>> 0, message.proposer_priority.high >>> 0).toNumber() : message.proposer_priority; - return object; - }; - - /** - * Converts this Validator to JSON. - * @function toJSON - * @memberof cosmos.base.tendermint.v1beta1.Validator - * @instance - * @returns {Object.} JSON object - */ - Validator.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Validator; - })(); - - v1beta1.GetBlockByHeightRequest = (function() { - - /** - * Properties of a GetBlockByHeightRequest. - * @memberof cosmos.base.tendermint.v1beta1 - * @interface IGetBlockByHeightRequest - * @property {Long|null} [height] GetBlockByHeightRequest height - */ - - /** - * Constructs a new GetBlockByHeightRequest. - * @memberof cosmos.base.tendermint.v1beta1 - * @classdesc Represents a GetBlockByHeightRequest. - * @implements IGetBlockByHeightRequest - * @constructor - * @param {cosmos.base.tendermint.v1beta1.IGetBlockByHeightRequest=} [properties] Properties to set - */ - function GetBlockByHeightRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GetBlockByHeightRequest height. - * @member {Long} height - * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest - * @instance - */ - GetBlockByHeightRequest.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Encodes the specified GetBlockByHeightRequest message. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest - * @static - * @param {cosmos.base.tendermint.v1beta1.IGetBlockByHeightRequest} message GetBlockByHeightRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetBlockByHeightRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.height); - return writer; - }; - - /** - * Encodes the specified GetBlockByHeightRequest message, length delimited. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest - * @static - * @param {cosmos.base.tendermint.v1beta1.IGetBlockByHeightRequest} message GetBlockByHeightRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetBlockByHeightRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetBlockByHeightRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest} GetBlockByHeightRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetBlockByHeightRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.height = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetBlockByHeightRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest} GetBlockByHeightRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetBlockByHeightRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetBlockByHeightRequest message. - * @function verify - * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetBlockByHeightRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) - return "height: integer|Long expected"; - return null; - }; - - /** - * Creates a GetBlockByHeightRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest} GetBlockByHeightRequest - */ - GetBlockByHeightRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest) - return object; - let message = new $root.cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest(); - if (object.height != null) - if ($util.Long) - (message.height = $util.Long.fromValue(object.height)).unsigned = false; - else if (typeof object.height === "string") - message.height = parseInt(object.height, 10); - else if (typeof object.height === "number") - message.height = object.height; - else if (typeof object.height === "object") - message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a GetBlockByHeightRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest - * @static - * @param {cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest} message GetBlockByHeightRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetBlockByHeightRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.height = options.longs === String ? "0" : 0; - if (message.height != null && message.hasOwnProperty("height")) - if (typeof message.height === "number") - object.height = options.longs === String ? String(message.height) : message.height; - else - object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; - return object; - }; - - /** - * Converts this GetBlockByHeightRequest to JSON. - * @function toJSON - * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest - * @instance - * @returns {Object.} JSON object - */ - GetBlockByHeightRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GetBlockByHeightRequest; - })(); - - v1beta1.GetBlockByHeightResponse = (function() { - - /** - * Properties of a GetBlockByHeightResponse. - * @memberof cosmos.base.tendermint.v1beta1 - * @interface IGetBlockByHeightResponse - * @property {tendermint.types.IBlockID|null} [block_id] GetBlockByHeightResponse block_id - * @property {tendermint.types.IBlock|null} [block] GetBlockByHeightResponse block - */ - - /** - * Constructs a new GetBlockByHeightResponse. - * @memberof cosmos.base.tendermint.v1beta1 - * @classdesc Represents a GetBlockByHeightResponse. - * @implements IGetBlockByHeightResponse - * @constructor - * @param {cosmos.base.tendermint.v1beta1.IGetBlockByHeightResponse=} [properties] Properties to set - */ - function GetBlockByHeightResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GetBlockByHeightResponse block_id. - * @member {tendermint.types.IBlockID|null|undefined} block_id - * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse - * @instance - */ - GetBlockByHeightResponse.prototype.block_id = null; - - /** - * GetBlockByHeightResponse block. - * @member {tendermint.types.IBlock|null|undefined} block - * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse - * @instance - */ - GetBlockByHeightResponse.prototype.block = null; - - /** - * Encodes the specified GetBlockByHeightResponse message. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse - * @static - * @param {cosmos.base.tendermint.v1beta1.IGetBlockByHeightResponse} message GetBlockByHeightResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetBlockByHeightResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.block_id != null && Object.hasOwnProperty.call(message, "block_id")) - $root.tendermint.types.BlockID.encode(message.block_id, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.block != null && Object.hasOwnProperty.call(message, "block")) - $root.tendermint.types.Block.encode(message.block, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GetBlockByHeightResponse message, length delimited. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse - * @static - * @param {cosmos.base.tendermint.v1beta1.IGetBlockByHeightResponse} message GetBlockByHeightResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetBlockByHeightResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetBlockByHeightResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse} GetBlockByHeightResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetBlockByHeightResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.block_id = $root.tendermint.types.BlockID.decode(reader, reader.uint32()); - break; - case 2: - message.block = $root.tendermint.types.Block.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetBlockByHeightResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse} GetBlockByHeightResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetBlockByHeightResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetBlockByHeightResponse message. - * @function verify - * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetBlockByHeightResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.block_id != null && message.hasOwnProperty("block_id")) { - let error = $root.tendermint.types.BlockID.verify(message.block_id); - if (error) - return "block_id." + error; - } - if (message.block != null && message.hasOwnProperty("block")) { - let error = $root.tendermint.types.Block.verify(message.block); - if (error) - return "block." + error; - } - return null; - }; - - /** - * Creates a GetBlockByHeightResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse} GetBlockByHeightResponse - */ - GetBlockByHeightResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse) - return object; - let message = new $root.cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse(); - if (object.block_id != null) { - if (typeof object.block_id !== "object") - throw TypeError(".cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse.block_id: object expected"); - message.block_id = $root.tendermint.types.BlockID.fromObject(object.block_id); - } - if (object.block != null) { - if (typeof object.block !== "object") - throw TypeError(".cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse.block: object expected"); - message.block = $root.tendermint.types.Block.fromObject(object.block); - } - return message; - }; - - /** - * Creates a plain object from a GetBlockByHeightResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse - * @static - * @param {cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse} message GetBlockByHeightResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetBlockByHeightResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.block_id = null; - object.block = null; - } - if (message.block_id != null && message.hasOwnProperty("block_id")) - object.block_id = $root.tendermint.types.BlockID.toObject(message.block_id, options); - if (message.block != null && message.hasOwnProperty("block")) - object.block = $root.tendermint.types.Block.toObject(message.block, options); - return object; - }; - - /** - * Converts this GetBlockByHeightResponse to JSON. - * @function toJSON - * @memberof cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse - * @instance - * @returns {Object.} JSON object - */ - GetBlockByHeightResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GetBlockByHeightResponse; - })(); - - v1beta1.GetLatestBlockRequest = (function() { - - /** - * Properties of a GetLatestBlockRequest. - * @memberof cosmos.base.tendermint.v1beta1 - * @interface IGetLatestBlockRequest - */ - - /** - * Constructs a new GetLatestBlockRequest. - * @memberof cosmos.base.tendermint.v1beta1 - * @classdesc Represents a GetLatestBlockRequest. - * @implements IGetLatestBlockRequest - * @constructor - * @param {cosmos.base.tendermint.v1beta1.IGetLatestBlockRequest=} [properties] Properties to set - */ - function GetLatestBlockRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified GetLatestBlockRequest message. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetLatestBlockRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockRequest - * @static - * @param {cosmos.base.tendermint.v1beta1.IGetLatestBlockRequest} message GetLatestBlockRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetLatestBlockRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified GetLatestBlockRequest message, length delimited. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetLatestBlockRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockRequest - * @static - * @param {cosmos.base.tendermint.v1beta1.IGetLatestBlockRequest} message GetLatestBlockRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetLatestBlockRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetLatestBlockRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.tendermint.v1beta1.GetLatestBlockRequest} GetLatestBlockRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetLatestBlockRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.tendermint.v1beta1.GetLatestBlockRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetLatestBlockRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.tendermint.v1beta1.GetLatestBlockRequest} GetLatestBlockRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetLatestBlockRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetLatestBlockRequest message. - * @function verify - * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetLatestBlockRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a GetLatestBlockRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.tendermint.v1beta1.GetLatestBlockRequest} GetLatestBlockRequest - */ - GetLatestBlockRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.tendermint.v1beta1.GetLatestBlockRequest) - return object; - return new $root.cosmos.base.tendermint.v1beta1.GetLatestBlockRequest(); - }; - - /** - * Creates a plain object from a GetLatestBlockRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockRequest - * @static - * @param {cosmos.base.tendermint.v1beta1.GetLatestBlockRequest} message GetLatestBlockRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetLatestBlockRequest.toObject = function toObject() { - return {}; - }; - - /** - * Converts this GetLatestBlockRequest to JSON. - * @function toJSON - * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockRequest - * @instance - * @returns {Object.} JSON object - */ - GetLatestBlockRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GetLatestBlockRequest; - })(); - - v1beta1.GetLatestBlockResponse = (function() { - - /** - * Properties of a GetLatestBlockResponse. - * @memberof cosmos.base.tendermint.v1beta1 - * @interface IGetLatestBlockResponse - * @property {tendermint.types.IBlockID|null} [block_id] GetLatestBlockResponse block_id - * @property {tendermint.types.IBlock|null} [block] GetLatestBlockResponse block - */ - - /** - * Constructs a new GetLatestBlockResponse. - * @memberof cosmos.base.tendermint.v1beta1 - * @classdesc Represents a GetLatestBlockResponse. - * @implements IGetLatestBlockResponse - * @constructor - * @param {cosmos.base.tendermint.v1beta1.IGetLatestBlockResponse=} [properties] Properties to set - */ - function GetLatestBlockResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GetLatestBlockResponse block_id. - * @member {tendermint.types.IBlockID|null|undefined} block_id - * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockResponse - * @instance - */ - GetLatestBlockResponse.prototype.block_id = null; - - /** - * GetLatestBlockResponse block. - * @member {tendermint.types.IBlock|null|undefined} block - * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockResponse - * @instance - */ - GetLatestBlockResponse.prototype.block = null; - - /** - * Encodes the specified GetLatestBlockResponse message. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetLatestBlockResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockResponse - * @static - * @param {cosmos.base.tendermint.v1beta1.IGetLatestBlockResponse} message GetLatestBlockResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetLatestBlockResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.block_id != null && Object.hasOwnProperty.call(message, "block_id")) - $root.tendermint.types.BlockID.encode(message.block_id, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.block != null && Object.hasOwnProperty.call(message, "block")) - $root.tendermint.types.Block.encode(message.block, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GetLatestBlockResponse message, length delimited. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetLatestBlockResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockResponse - * @static - * @param {cosmos.base.tendermint.v1beta1.IGetLatestBlockResponse} message GetLatestBlockResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetLatestBlockResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetLatestBlockResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.tendermint.v1beta1.GetLatestBlockResponse} GetLatestBlockResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetLatestBlockResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.tendermint.v1beta1.GetLatestBlockResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.block_id = $root.tendermint.types.BlockID.decode(reader, reader.uint32()); - break; - case 2: - message.block = $root.tendermint.types.Block.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetLatestBlockResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.tendermint.v1beta1.GetLatestBlockResponse} GetLatestBlockResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetLatestBlockResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetLatestBlockResponse message. - * @function verify - * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetLatestBlockResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.block_id != null && message.hasOwnProperty("block_id")) { - let error = $root.tendermint.types.BlockID.verify(message.block_id); - if (error) - return "block_id." + error; - } - if (message.block != null && message.hasOwnProperty("block")) { - let error = $root.tendermint.types.Block.verify(message.block); - if (error) - return "block." + error; - } - return null; - }; - - /** - * Creates a GetLatestBlockResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.tendermint.v1beta1.GetLatestBlockResponse} GetLatestBlockResponse - */ - GetLatestBlockResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.tendermint.v1beta1.GetLatestBlockResponse) - return object; - let message = new $root.cosmos.base.tendermint.v1beta1.GetLatestBlockResponse(); - if (object.block_id != null) { - if (typeof object.block_id !== "object") - throw TypeError(".cosmos.base.tendermint.v1beta1.GetLatestBlockResponse.block_id: object expected"); - message.block_id = $root.tendermint.types.BlockID.fromObject(object.block_id); - } - if (object.block != null) { - if (typeof object.block !== "object") - throw TypeError(".cosmos.base.tendermint.v1beta1.GetLatestBlockResponse.block: object expected"); - message.block = $root.tendermint.types.Block.fromObject(object.block); - } - return message; - }; - - /** - * Creates a plain object from a GetLatestBlockResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockResponse - * @static - * @param {cosmos.base.tendermint.v1beta1.GetLatestBlockResponse} message GetLatestBlockResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetLatestBlockResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.block_id = null; - object.block = null; - } - if (message.block_id != null && message.hasOwnProperty("block_id")) - object.block_id = $root.tendermint.types.BlockID.toObject(message.block_id, options); - if (message.block != null && message.hasOwnProperty("block")) - object.block = $root.tendermint.types.Block.toObject(message.block, options); - return object; - }; - - /** - * Converts this GetLatestBlockResponse to JSON. - * @function toJSON - * @memberof cosmos.base.tendermint.v1beta1.GetLatestBlockResponse - * @instance - * @returns {Object.} JSON object - */ - GetLatestBlockResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GetLatestBlockResponse; - })(); - - v1beta1.GetSyncingRequest = (function() { - - /** - * Properties of a GetSyncingRequest. - * @memberof cosmos.base.tendermint.v1beta1 - * @interface IGetSyncingRequest - */ - - /** - * Constructs a new GetSyncingRequest. - * @memberof cosmos.base.tendermint.v1beta1 - * @classdesc Represents a GetSyncingRequest. - * @implements IGetSyncingRequest - * @constructor - * @param {cosmos.base.tendermint.v1beta1.IGetSyncingRequest=} [properties] Properties to set - */ - function GetSyncingRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified GetSyncingRequest message. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetSyncingRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.base.tendermint.v1beta1.GetSyncingRequest - * @static - * @param {cosmos.base.tendermint.v1beta1.IGetSyncingRequest} message GetSyncingRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetSyncingRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified GetSyncingRequest message, length delimited. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetSyncingRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.tendermint.v1beta1.GetSyncingRequest - * @static - * @param {cosmos.base.tendermint.v1beta1.IGetSyncingRequest} message GetSyncingRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetSyncingRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetSyncingRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.tendermint.v1beta1.GetSyncingRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.tendermint.v1beta1.GetSyncingRequest} GetSyncingRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetSyncingRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.tendermint.v1beta1.GetSyncingRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetSyncingRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.tendermint.v1beta1.GetSyncingRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.tendermint.v1beta1.GetSyncingRequest} GetSyncingRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetSyncingRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetSyncingRequest message. - * @function verify - * @memberof cosmos.base.tendermint.v1beta1.GetSyncingRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetSyncingRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a GetSyncingRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.tendermint.v1beta1.GetSyncingRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.tendermint.v1beta1.GetSyncingRequest} GetSyncingRequest - */ - GetSyncingRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.tendermint.v1beta1.GetSyncingRequest) - return object; - return new $root.cosmos.base.tendermint.v1beta1.GetSyncingRequest(); - }; - - /** - * Creates a plain object from a GetSyncingRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.tendermint.v1beta1.GetSyncingRequest - * @static - * @param {cosmos.base.tendermint.v1beta1.GetSyncingRequest} message GetSyncingRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetSyncingRequest.toObject = function toObject() { - return {}; - }; - - /** - * Converts this GetSyncingRequest to JSON. - * @function toJSON - * @memberof cosmos.base.tendermint.v1beta1.GetSyncingRequest - * @instance - * @returns {Object.} JSON object - */ - GetSyncingRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GetSyncingRequest; - })(); - - v1beta1.GetSyncingResponse = (function() { - - /** - * Properties of a GetSyncingResponse. - * @memberof cosmos.base.tendermint.v1beta1 - * @interface IGetSyncingResponse - * @property {boolean|null} [syncing] GetSyncingResponse syncing - */ - - /** - * Constructs a new GetSyncingResponse. - * @memberof cosmos.base.tendermint.v1beta1 - * @classdesc Represents a GetSyncingResponse. - * @implements IGetSyncingResponse - * @constructor - * @param {cosmos.base.tendermint.v1beta1.IGetSyncingResponse=} [properties] Properties to set - */ - function GetSyncingResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GetSyncingResponse syncing. - * @member {boolean} syncing - * @memberof cosmos.base.tendermint.v1beta1.GetSyncingResponse - * @instance - */ - GetSyncingResponse.prototype.syncing = false; - - /** - * Encodes the specified GetSyncingResponse message. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetSyncingResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.base.tendermint.v1beta1.GetSyncingResponse - * @static - * @param {cosmos.base.tendermint.v1beta1.IGetSyncingResponse} message GetSyncingResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetSyncingResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.syncing != null && Object.hasOwnProperty.call(message, "syncing")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.syncing); - return writer; - }; - - /** - * Encodes the specified GetSyncingResponse message, length delimited. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetSyncingResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.tendermint.v1beta1.GetSyncingResponse - * @static - * @param {cosmos.base.tendermint.v1beta1.IGetSyncingResponse} message GetSyncingResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetSyncingResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetSyncingResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.tendermint.v1beta1.GetSyncingResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.tendermint.v1beta1.GetSyncingResponse} GetSyncingResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetSyncingResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.tendermint.v1beta1.GetSyncingResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.syncing = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetSyncingResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.tendermint.v1beta1.GetSyncingResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.tendermint.v1beta1.GetSyncingResponse} GetSyncingResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetSyncingResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetSyncingResponse message. - * @function verify - * @memberof cosmos.base.tendermint.v1beta1.GetSyncingResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetSyncingResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.syncing != null && message.hasOwnProperty("syncing")) - if (typeof message.syncing !== "boolean") - return "syncing: boolean expected"; - return null; - }; - - /** - * Creates a GetSyncingResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.tendermint.v1beta1.GetSyncingResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.tendermint.v1beta1.GetSyncingResponse} GetSyncingResponse - */ - GetSyncingResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.tendermint.v1beta1.GetSyncingResponse) - return object; - let message = new $root.cosmos.base.tendermint.v1beta1.GetSyncingResponse(); - if (object.syncing != null) - message.syncing = Boolean(object.syncing); - return message; - }; - - /** - * Creates a plain object from a GetSyncingResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.tendermint.v1beta1.GetSyncingResponse - * @static - * @param {cosmos.base.tendermint.v1beta1.GetSyncingResponse} message GetSyncingResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetSyncingResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.syncing = false; - if (message.syncing != null && message.hasOwnProperty("syncing")) - object.syncing = message.syncing; - return object; - }; - - /** - * Converts this GetSyncingResponse to JSON. - * @function toJSON - * @memberof cosmos.base.tendermint.v1beta1.GetSyncingResponse - * @instance - * @returns {Object.} JSON object - */ - GetSyncingResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GetSyncingResponse; - })(); - - v1beta1.GetNodeInfoRequest = (function() { - - /** - * Properties of a GetNodeInfoRequest. - * @memberof cosmos.base.tendermint.v1beta1 - * @interface IGetNodeInfoRequest - */ - - /** - * Constructs a new GetNodeInfoRequest. - * @memberof cosmos.base.tendermint.v1beta1 - * @classdesc Represents a GetNodeInfoRequest. - * @implements IGetNodeInfoRequest - * @constructor - * @param {cosmos.base.tendermint.v1beta1.IGetNodeInfoRequest=} [properties] Properties to set - */ - function GetNodeInfoRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified GetNodeInfoRequest message. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetNodeInfoRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoRequest - * @static - * @param {cosmos.base.tendermint.v1beta1.IGetNodeInfoRequest} message GetNodeInfoRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetNodeInfoRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified GetNodeInfoRequest message, length delimited. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetNodeInfoRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoRequest - * @static - * @param {cosmos.base.tendermint.v1beta1.IGetNodeInfoRequest} message GetNodeInfoRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetNodeInfoRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetNodeInfoRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.tendermint.v1beta1.GetNodeInfoRequest} GetNodeInfoRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetNodeInfoRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.tendermint.v1beta1.GetNodeInfoRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetNodeInfoRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.tendermint.v1beta1.GetNodeInfoRequest} GetNodeInfoRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetNodeInfoRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetNodeInfoRequest message. - * @function verify - * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetNodeInfoRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a GetNodeInfoRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.tendermint.v1beta1.GetNodeInfoRequest} GetNodeInfoRequest - */ - GetNodeInfoRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.tendermint.v1beta1.GetNodeInfoRequest) - return object; - return new $root.cosmos.base.tendermint.v1beta1.GetNodeInfoRequest(); - }; - - /** - * Creates a plain object from a GetNodeInfoRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoRequest - * @static - * @param {cosmos.base.tendermint.v1beta1.GetNodeInfoRequest} message GetNodeInfoRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetNodeInfoRequest.toObject = function toObject() { - return {}; - }; - - /** - * Converts this GetNodeInfoRequest to JSON. - * @function toJSON - * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoRequest - * @instance - * @returns {Object.} JSON object - */ - GetNodeInfoRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GetNodeInfoRequest; - })(); - - v1beta1.GetNodeInfoResponse = (function() { - - /** - * Properties of a GetNodeInfoResponse. - * @memberof cosmos.base.tendermint.v1beta1 - * @interface IGetNodeInfoResponse - * @property {tendermint.p2p.IDefaultNodeInfo|null} [default_node_info] GetNodeInfoResponse default_node_info - * @property {cosmos.base.tendermint.v1beta1.IVersionInfo|null} [application_version] GetNodeInfoResponse application_version - */ - - /** - * Constructs a new GetNodeInfoResponse. - * @memberof cosmos.base.tendermint.v1beta1 - * @classdesc Represents a GetNodeInfoResponse. - * @implements IGetNodeInfoResponse - * @constructor - * @param {cosmos.base.tendermint.v1beta1.IGetNodeInfoResponse=} [properties] Properties to set - */ - function GetNodeInfoResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GetNodeInfoResponse default_node_info. - * @member {tendermint.p2p.IDefaultNodeInfo|null|undefined} default_node_info - * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoResponse - * @instance - */ - GetNodeInfoResponse.prototype.default_node_info = null; - - /** - * GetNodeInfoResponse application_version. - * @member {cosmos.base.tendermint.v1beta1.IVersionInfo|null|undefined} application_version - * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoResponse - * @instance - */ - GetNodeInfoResponse.prototype.application_version = null; - - /** - * Encodes the specified GetNodeInfoResponse message. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetNodeInfoResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoResponse - * @static - * @param {cosmos.base.tendermint.v1beta1.IGetNodeInfoResponse} message GetNodeInfoResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetNodeInfoResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.default_node_info != null && Object.hasOwnProperty.call(message, "default_node_info")) - $root.tendermint.p2p.DefaultNodeInfo.encode(message.default_node_info, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.application_version != null && Object.hasOwnProperty.call(message, "application_version")) - $root.cosmos.base.tendermint.v1beta1.VersionInfo.encode(message.application_version, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GetNodeInfoResponse message, length delimited. Does not implicitly {@link cosmos.base.tendermint.v1beta1.GetNodeInfoResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoResponse - * @static - * @param {cosmos.base.tendermint.v1beta1.IGetNodeInfoResponse} message GetNodeInfoResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetNodeInfoResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetNodeInfoResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.tendermint.v1beta1.GetNodeInfoResponse} GetNodeInfoResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetNodeInfoResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.tendermint.v1beta1.GetNodeInfoResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.default_node_info = $root.tendermint.p2p.DefaultNodeInfo.decode(reader, reader.uint32()); - break; - case 2: - message.application_version = $root.cosmos.base.tendermint.v1beta1.VersionInfo.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetNodeInfoResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.tendermint.v1beta1.GetNodeInfoResponse} GetNodeInfoResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetNodeInfoResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetNodeInfoResponse message. - * @function verify - * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetNodeInfoResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.default_node_info != null && message.hasOwnProperty("default_node_info")) { - let error = $root.tendermint.p2p.DefaultNodeInfo.verify(message.default_node_info); - if (error) - return "default_node_info." + error; - } - if (message.application_version != null && message.hasOwnProperty("application_version")) { - let error = $root.cosmos.base.tendermint.v1beta1.VersionInfo.verify(message.application_version); - if (error) - return "application_version." + error; - } - return null; - }; - - /** - * Creates a GetNodeInfoResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.tendermint.v1beta1.GetNodeInfoResponse} GetNodeInfoResponse - */ - GetNodeInfoResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.tendermint.v1beta1.GetNodeInfoResponse) - return object; - let message = new $root.cosmos.base.tendermint.v1beta1.GetNodeInfoResponse(); - if (object.default_node_info != null) { - if (typeof object.default_node_info !== "object") - throw TypeError(".cosmos.base.tendermint.v1beta1.GetNodeInfoResponse.default_node_info: object expected"); - message.default_node_info = $root.tendermint.p2p.DefaultNodeInfo.fromObject(object.default_node_info); - } - if (object.application_version != null) { - if (typeof object.application_version !== "object") - throw TypeError(".cosmos.base.tendermint.v1beta1.GetNodeInfoResponse.application_version: object expected"); - message.application_version = $root.cosmos.base.tendermint.v1beta1.VersionInfo.fromObject(object.application_version); - } - return message; - }; - - /** - * Creates a plain object from a GetNodeInfoResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoResponse - * @static - * @param {cosmos.base.tendermint.v1beta1.GetNodeInfoResponse} message GetNodeInfoResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetNodeInfoResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.default_node_info = null; - object.application_version = null; - } - if (message.default_node_info != null && message.hasOwnProperty("default_node_info")) - object.default_node_info = $root.tendermint.p2p.DefaultNodeInfo.toObject(message.default_node_info, options); - if (message.application_version != null && message.hasOwnProperty("application_version")) - object.application_version = $root.cosmos.base.tendermint.v1beta1.VersionInfo.toObject(message.application_version, options); - return object; - }; - - /** - * Converts this GetNodeInfoResponse to JSON. - * @function toJSON - * @memberof cosmos.base.tendermint.v1beta1.GetNodeInfoResponse - * @instance - * @returns {Object.} JSON object - */ - GetNodeInfoResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GetNodeInfoResponse; - })(); - - v1beta1.VersionInfo = (function() { - - /** - * Properties of a VersionInfo. - * @memberof cosmos.base.tendermint.v1beta1 - * @interface IVersionInfo - * @property {string|null} [name] VersionInfo name - * @property {string|null} [app_name] VersionInfo app_name - * @property {string|null} [version] VersionInfo version - * @property {string|null} [git_commit] VersionInfo git_commit - * @property {string|null} [build_tags] VersionInfo build_tags - * @property {string|null} [go_version] VersionInfo go_version - * @property {Array.|null} [build_deps] VersionInfo build_deps - */ - - /** - * Constructs a new VersionInfo. - * @memberof cosmos.base.tendermint.v1beta1 - * @classdesc Represents a VersionInfo. - * @implements IVersionInfo - * @constructor - * @param {cosmos.base.tendermint.v1beta1.IVersionInfo=} [properties] Properties to set - */ - function VersionInfo(properties) { - this.build_deps = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * VersionInfo name. - * @member {string} name - * @memberof cosmos.base.tendermint.v1beta1.VersionInfo - * @instance - */ - VersionInfo.prototype.name = ""; - - /** - * VersionInfo app_name. - * @member {string} app_name - * @memberof cosmos.base.tendermint.v1beta1.VersionInfo - * @instance - */ - VersionInfo.prototype.app_name = ""; - - /** - * VersionInfo version. - * @member {string} version - * @memberof cosmos.base.tendermint.v1beta1.VersionInfo - * @instance - */ - VersionInfo.prototype.version = ""; - - /** - * VersionInfo git_commit. - * @member {string} git_commit - * @memberof cosmos.base.tendermint.v1beta1.VersionInfo - * @instance - */ - VersionInfo.prototype.git_commit = ""; - - /** - * VersionInfo build_tags. - * @member {string} build_tags - * @memberof cosmos.base.tendermint.v1beta1.VersionInfo - * @instance - */ - VersionInfo.prototype.build_tags = ""; - - /** - * VersionInfo go_version. - * @member {string} go_version - * @memberof cosmos.base.tendermint.v1beta1.VersionInfo - * @instance - */ - VersionInfo.prototype.go_version = ""; - - /** - * VersionInfo build_deps. - * @member {Array.} build_deps - * @memberof cosmos.base.tendermint.v1beta1.VersionInfo - * @instance - */ - VersionInfo.prototype.build_deps = $util.emptyArray; - - /** - * Encodes the specified VersionInfo message. Does not implicitly {@link cosmos.base.tendermint.v1beta1.VersionInfo.verify|verify} messages. - * @function encode - * @memberof cosmos.base.tendermint.v1beta1.VersionInfo - * @static - * @param {cosmos.base.tendermint.v1beta1.IVersionInfo} message VersionInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - VersionInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.app_name != null && Object.hasOwnProperty.call(message, "app_name")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.app_name); - if (message.version != null && Object.hasOwnProperty.call(message, "version")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.version); - if (message.git_commit != null && Object.hasOwnProperty.call(message, "git_commit")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.git_commit); - if (message.build_tags != null && Object.hasOwnProperty.call(message, "build_tags")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.build_tags); - if (message.go_version != null && Object.hasOwnProperty.call(message, "go_version")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.go_version); - if (message.build_deps != null && message.build_deps.length) - for (let i = 0; i < message.build_deps.length; ++i) - $root.cosmos.base.tendermint.v1beta1.Module.encode(message.build_deps[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified VersionInfo message, length delimited. Does not implicitly {@link cosmos.base.tendermint.v1beta1.VersionInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.tendermint.v1beta1.VersionInfo - * @static - * @param {cosmos.base.tendermint.v1beta1.IVersionInfo} message VersionInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - VersionInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a VersionInfo message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.tendermint.v1beta1.VersionInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.tendermint.v1beta1.VersionInfo} VersionInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - VersionInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.tendermint.v1beta1.VersionInfo(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.app_name = reader.string(); - break; - case 3: - message.version = reader.string(); - break; - case 4: - message.git_commit = reader.string(); - break; - case 5: - message.build_tags = reader.string(); - break; - case 6: - message.go_version = reader.string(); - break; - case 7: - if (!(message.build_deps && message.build_deps.length)) - message.build_deps = []; - message.build_deps.push($root.cosmos.base.tendermint.v1beta1.Module.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a VersionInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.tendermint.v1beta1.VersionInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.tendermint.v1beta1.VersionInfo} VersionInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - VersionInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a VersionInfo message. - * @function verify - * @memberof cosmos.base.tendermint.v1beta1.VersionInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - VersionInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.app_name != null && message.hasOwnProperty("app_name")) - if (!$util.isString(message.app_name)) - return "app_name: string expected"; - if (message.version != null && message.hasOwnProperty("version")) - if (!$util.isString(message.version)) - return "version: string expected"; - if (message.git_commit != null && message.hasOwnProperty("git_commit")) - if (!$util.isString(message.git_commit)) - return "git_commit: string expected"; - if (message.build_tags != null && message.hasOwnProperty("build_tags")) - if (!$util.isString(message.build_tags)) - return "build_tags: string expected"; - if (message.go_version != null && message.hasOwnProperty("go_version")) - if (!$util.isString(message.go_version)) - return "go_version: string expected"; - if (message.build_deps != null && message.hasOwnProperty("build_deps")) { - if (!Array.isArray(message.build_deps)) - return "build_deps: array expected"; - for (let i = 0; i < message.build_deps.length; ++i) { - let error = $root.cosmos.base.tendermint.v1beta1.Module.verify(message.build_deps[i]); - if (error) - return "build_deps." + error; - } - } - return null; - }; - - /** - * Creates a VersionInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.tendermint.v1beta1.VersionInfo - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.tendermint.v1beta1.VersionInfo} VersionInfo - */ - VersionInfo.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.tendermint.v1beta1.VersionInfo) - return object; - let message = new $root.cosmos.base.tendermint.v1beta1.VersionInfo(); - if (object.name != null) - message.name = String(object.name); - if (object.app_name != null) - message.app_name = String(object.app_name); - if (object.version != null) - message.version = String(object.version); - if (object.git_commit != null) - message.git_commit = String(object.git_commit); - if (object.build_tags != null) - message.build_tags = String(object.build_tags); - if (object.go_version != null) - message.go_version = String(object.go_version); - if (object.build_deps) { - if (!Array.isArray(object.build_deps)) - throw TypeError(".cosmos.base.tendermint.v1beta1.VersionInfo.build_deps: array expected"); - message.build_deps = []; - for (let i = 0; i < object.build_deps.length; ++i) { - if (typeof object.build_deps[i] !== "object") - throw TypeError(".cosmos.base.tendermint.v1beta1.VersionInfo.build_deps: object expected"); - message.build_deps[i] = $root.cosmos.base.tendermint.v1beta1.Module.fromObject(object.build_deps[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a VersionInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.tendermint.v1beta1.VersionInfo - * @static - * @param {cosmos.base.tendermint.v1beta1.VersionInfo} message VersionInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - VersionInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.build_deps = []; - if (options.defaults) { - object.name = ""; - object.app_name = ""; - object.version = ""; - object.git_commit = ""; - object.build_tags = ""; - object.go_version = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.app_name != null && message.hasOwnProperty("app_name")) - object.app_name = message.app_name; - if (message.version != null && message.hasOwnProperty("version")) - object.version = message.version; - if (message.git_commit != null && message.hasOwnProperty("git_commit")) - object.git_commit = message.git_commit; - if (message.build_tags != null && message.hasOwnProperty("build_tags")) - object.build_tags = message.build_tags; - if (message.go_version != null && message.hasOwnProperty("go_version")) - object.go_version = message.go_version; - if (message.build_deps && message.build_deps.length) { - object.build_deps = []; - for (let j = 0; j < message.build_deps.length; ++j) - object.build_deps[j] = $root.cosmos.base.tendermint.v1beta1.Module.toObject(message.build_deps[j], options); - } - return object; - }; - - /** - * Converts this VersionInfo to JSON. - * @function toJSON - * @memberof cosmos.base.tendermint.v1beta1.VersionInfo - * @instance - * @returns {Object.} JSON object - */ - VersionInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return VersionInfo; - })(); - - v1beta1.Module = (function() { - - /** - * Properties of a Module. - * @memberof cosmos.base.tendermint.v1beta1 - * @interface IModule - * @property {string|null} [path] Module path - * @property {string|null} [version] Module version - * @property {string|null} [sum] Module sum - */ - - /** - * Constructs a new Module. - * @memberof cosmos.base.tendermint.v1beta1 - * @classdesc Represents a Module. - * @implements IModule - * @constructor - * @param {cosmos.base.tendermint.v1beta1.IModule=} [properties] Properties to set - */ - function Module(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Module path. - * @member {string} path - * @memberof cosmos.base.tendermint.v1beta1.Module - * @instance - */ - Module.prototype.path = ""; - - /** - * Module version. - * @member {string} version - * @memberof cosmos.base.tendermint.v1beta1.Module - * @instance - */ - Module.prototype.version = ""; - - /** - * Module sum. - * @member {string} sum - * @memberof cosmos.base.tendermint.v1beta1.Module - * @instance - */ - Module.prototype.sum = ""; - - /** - * Encodes the specified Module message. Does not implicitly {@link cosmos.base.tendermint.v1beta1.Module.verify|verify} messages. - * @function encode - * @memberof cosmos.base.tendermint.v1beta1.Module - * @static - * @param {cosmos.base.tendermint.v1beta1.IModule} message Module message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Module.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.path != null && Object.hasOwnProperty.call(message, "path")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.path); - if (message.version != null && Object.hasOwnProperty.call(message, "version")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.version); - if (message.sum != null && Object.hasOwnProperty.call(message, "sum")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.sum); - return writer; - }; - - /** - * Encodes the specified Module message, length delimited. Does not implicitly {@link cosmos.base.tendermint.v1beta1.Module.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.tendermint.v1beta1.Module - * @static - * @param {cosmos.base.tendermint.v1beta1.IModule} message Module message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Module.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Module message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.tendermint.v1beta1.Module - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.tendermint.v1beta1.Module} Module - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Module.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.tendermint.v1beta1.Module(); - while (reader.pos < end) { - let 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; - }; - - /** - * Decodes a Module message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.tendermint.v1beta1.Module - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.tendermint.v1beta1.Module} Module - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Module.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Module message. - * @function verify - * @memberof cosmos.base.tendermint.v1beta1.Module - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Module.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.path != null && message.hasOwnProperty("path")) - if (!$util.isString(message.path)) - return "path: string expected"; - if (message.version != null && message.hasOwnProperty("version")) - if (!$util.isString(message.version)) - return "version: string expected"; - if (message.sum != null && message.hasOwnProperty("sum")) - if (!$util.isString(message.sum)) - return "sum: string expected"; - return null; - }; - - /** - * Creates a Module message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.tendermint.v1beta1.Module - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.tendermint.v1beta1.Module} Module - */ - Module.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.tendermint.v1beta1.Module) - return object; - let message = new $root.cosmos.base.tendermint.v1beta1.Module(); - if (object.path != null) - message.path = String(object.path); - if (object.version != null) - message.version = String(object.version); - if (object.sum != null) - message.sum = String(object.sum); - return message; - }; - - /** - * Creates a plain object from a Module message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.tendermint.v1beta1.Module - * @static - * @param {cosmos.base.tendermint.v1beta1.Module} message Module - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Module.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.path = ""; - object.version = ""; - object.sum = ""; - } - if (message.path != null && message.hasOwnProperty("path")) - object.path = message.path; - if (message.version != null && message.hasOwnProperty("version")) - object.version = message.version; - if (message.sum != null && message.hasOwnProperty("sum")) - object.sum = message.sum; - return object; - }; - - /** - * Converts this Module to JSON. - * @function toJSON - * @memberof cosmos.base.tendermint.v1beta1.Module - * @instance - * @returns {Object.} JSON object - */ - Module.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Module; - })(); - - return v1beta1; - })(); - - return tendermint; - })(); - - base.v1beta1 = (function() { - - /** - * Namespace v1beta1. - * @memberof cosmos.base - * @namespace - */ - const v1beta1 = {}; - - v1beta1.Coin = (function() { - - /** - * Properties of a Coin. - * @memberof cosmos.base.v1beta1 - * @interface ICoin - * @property {string|null} [denom] Coin denom - * @property {string|null} [amount] Coin amount - */ - - /** - * Constructs a new Coin. - * @memberof cosmos.base.v1beta1 - * @classdesc Represents a Coin. - * @implements ICoin - * @constructor - * @param {cosmos.base.v1beta1.ICoin=} [properties] Properties to set - */ - function Coin(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Coin denom. - * @member {string} denom - * @memberof cosmos.base.v1beta1.Coin - * @instance - */ - Coin.prototype.denom = ""; - - /** - * Coin amount. - * @member {string} amount - * @memberof cosmos.base.v1beta1.Coin - * @instance - */ - Coin.prototype.amount = ""; - - /** - * Encodes the specified Coin message. Does not implicitly {@link cosmos.base.v1beta1.Coin.verify|verify} messages. - * @function encode - * @memberof cosmos.base.v1beta1.Coin - * @static - * @param {cosmos.base.v1beta1.ICoin} message Coin message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Coin.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.denom != null && Object.hasOwnProperty.call(message, "denom")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.denom); - if (message.amount != null && Object.hasOwnProperty.call(message, "amount")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.amount); - return writer; - }; - - /** - * Encodes the specified Coin message, length delimited. Does not implicitly {@link cosmos.base.v1beta1.Coin.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.v1beta1.Coin - * @static - * @param {cosmos.base.v1beta1.ICoin} message Coin message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Coin.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Coin message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.v1beta1.Coin - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.v1beta1.Coin} Coin - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Coin.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.v1beta1.Coin(); - while (reader.pos < end) { - let 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; - }; - - /** - * Decodes a Coin message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.v1beta1.Coin - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.v1beta1.Coin} Coin - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Coin.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Coin message. - * @function verify - * @memberof cosmos.base.v1beta1.Coin - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Coin.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.denom != null && message.hasOwnProperty("denom")) - if (!$util.isString(message.denom)) - return "denom: string expected"; - if (message.amount != null && message.hasOwnProperty("amount")) - if (!$util.isString(message.amount)) - return "amount: string expected"; - return null; - }; - - /** - * Creates a Coin message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.v1beta1.Coin - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.v1beta1.Coin} Coin - */ - Coin.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.v1beta1.Coin) - return object; - let message = new $root.cosmos.base.v1beta1.Coin(); - if (object.denom != null) - message.denom = String(object.denom); - if (object.amount != null) - message.amount = String(object.amount); - return message; - }; - - /** - * Creates a plain object from a Coin message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.v1beta1.Coin - * @static - * @param {cosmos.base.v1beta1.Coin} message Coin - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Coin.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.denom = ""; - object.amount = ""; - } - if (message.denom != null && message.hasOwnProperty("denom")) - object.denom = message.denom; - if (message.amount != null && message.hasOwnProperty("amount")) - object.amount = message.amount; - return object; - }; - - /** - * Converts this Coin to JSON. - * @function toJSON - * @memberof cosmos.base.v1beta1.Coin - * @instance - * @returns {Object.} JSON object - */ - Coin.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Coin; - })(); - - v1beta1.DecCoin = (function() { - - /** - * Properties of a DecCoin. - * @memberof cosmos.base.v1beta1 - * @interface IDecCoin - * @property {string|null} [denom] DecCoin denom - * @property {string|null} [amount] DecCoin amount - */ - - /** - * Constructs a new DecCoin. - * @memberof cosmos.base.v1beta1 - * @classdesc Represents a DecCoin. - * @implements IDecCoin - * @constructor - * @param {cosmos.base.v1beta1.IDecCoin=} [properties] Properties to set - */ - function DecCoin(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DecCoin denom. - * @member {string} denom - * @memberof cosmos.base.v1beta1.DecCoin - * @instance - */ - DecCoin.prototype.denom = ""; - - /** - * DecCoin amount. - * @member {string} amount - * @memberof cosmos.base.v1beta1.DecCoin - * @instance - */ - DecCoin.prototype.amount = ""; - - /** - * Encodes the specified DecCoin message. Does not implicitly {@link cosmos.base.v1beta1.DecCoin.verify|verify} messages. - * @function encode - * @memberof cosmos.base.v1beta1.DecCoin - * @static - * @param {cosmos.base.v1beta1.IDecCoin} message DecCoin message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DecCoin.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.denom != null && Object.hasOwnProperty.call(message, "denom")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.denom); - if (message.amount != null && Object.hasOwnProperty.call(message, "amount")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.amount); - return writer; - }; - - /** - * Encodes the specified DecCoin message, length delimited. Does not implicitly {@link cosmos.base.v1beta1.DecCoin.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.v1beta1.DecCoin - * @static - * @param {cosmos.base.v1beta1.IDecCoin} message DecCoin message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DecCoin.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DecCoin message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.v1beta1.DecCoin - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.v1beta1.DecCoin} DecCoin - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DecCoin.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.v1beta1.DecCoin(); - while (reader.pos < end) { - let 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; - }; - - /** - * Decodes a DecCoin message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.v1beta1.DecCoin - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.v1beta1.DecCoin} DecCoin - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DecCoin.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DecCoin message. - * @function verify - * @memberof cosmos.base.v1beta1.DecCoin - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DecCoin.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.denom != null && message.hasOwnProperty("denom")) - if (!$util.isString(message.denom)) - return "denom: string expected"; - if (message.amount != null && message.hasOwnProperty("amount")) - if (!$util.isString(message.amount)) - return "amount: string expected"; - return null; - }; - - /** - * Creates a DecCoin message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.v1beta1.DecCoin - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.v1beta1.DecCoin} DecCoin - */ - DecCoin.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.v1beta1.DecCoin) - return object; - let message = new $root.cosmos.base.v1beta1.DecCoin(); - if (object.denom != null) - message.denom = String(object.denom); - if (object.amount != null) - message.amount = String(object.amount); - return message; - }; - - /** - * Creates a plain object from a DecCoin message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.v1beta1.DecCoin - * @static - * @param {cosmos.base.v1beta1.DecCoin} message DecCoin - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DecCoin.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.denom = ""; - object.amount = ""; - } - if (message.denom != null && message.hasOwnProperty("denom")) - object.denom = message.denom; - if (message.amount != null && message.hasOwnProperty("amount")) - object.amount = message.amount; - return object; - }; - - /** - * Converts this DecCoin to JSON. - * @function toJSON - * @memberof cosmos.base.v1beta1.DecCoin - * @instance - * @returns {Object.} JSON object - */ - DecCoin.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return DecCoin; - })(); - - v1beta1.IntProto = (function() { - - /** - * Properties of an IntProto. - * @memberof cosmos.base.v1beta1 - * @interface IIntProto - * @property {string|null} [int] IntProto int - */ - - /** - * Constructs a new IntProto. - * @memberof cosmos.base.v1beta1 - * @classdesc Represents an IntProto. - * @implements IIntProto - * @constructor - * @param {cosmos.base.v1beta1.IIntProto=} [properties] Properties to set - */ - function IntProto(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * IntProto int. - * @member {string} int - * @memberof cosmos.base.v1beta1.IntProto - * @instance - */ - IntProto.prototype.int = ""; - - /** - * Encodes the specified IntProto message. Does not implicitly {@link cosmos.base.v1beta1.IntProto.verify|verify} messages. - * @function encode - * @memberof cosmos.base.v1beta1.IntProto - * @static - * @param {cosmos.base.v1beta1.IIntProto} message IntProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - IntProto.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.int != null && Object.hasOwnProperty.call(message, "int")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.int); - return writer; - }; - - /** - * Encodes the specified IntProto message, length delimited. Does not implicitly {@link cosmos.base.v1beta1.IntProto.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.v1beta1.IntProto - * @static - * @param {cosmos.base.v1beta1.IIntProto} message IntProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - IntProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an IntProto message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.v1beta1.IntProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.v1beta1.IntProto} IntProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - IntProto.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.v1beta1.IntProto(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.int = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an IntProto message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.v1beta1.IntProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.v1beta1.IntProto} IntProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - IntProto.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an IntProto message. - * @function verify - * @memberof cosmos.base.v1beta1.IntProto - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - IntProto.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.int != null && message.hasOwnProperty("int")) - if (!$util.isString(message.int)) - return "int: string expected"; - return null; - }; - - /** - * Creates an IntProto message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.v1beta1.IntProto - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.v1beta1.IntProto} IntProto - */ - IntProto.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.v1beta1.IntProto) - return object; - let message = new $root.cosmos.base.v1beta1.IntProto(); - if (object.int != null) - message.int = String(object.int); - return message; - }; - - /** - * Creates a plain object from an IntProto message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.v1beta1.IntProto - * @static - * @param {cosmos.base.v1beta1.IntProto} message IntProto - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - IntProto.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.int = ""; - if (message.int != null && message.hasOwnProperty("int")) - object.int = message.int; - return object; - }; - - /** - * Converts this IntProto to JSON. - * @function toJSON - * @memberof cosmos.base.v1beta1.IntProto - * @instance - * @returns {Object.} JSON object - */ - IntProto.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return IntProto; - })(); - - v1beta1.DecProto = (function() { - - /** - * Properties of a DecProto. - * @memberof cosmos.base.v1beta1 - * @interface IDecProto - * @property {string|null} [dec] DecProto dec - */ - - /** - * Constructs a new DecProto. - * @memberof cosmos.base.v1beta1 - * @classdesc Represents a DecProto. - * @implements IDecProto - * @constructor - * @param {cosmos.base.v1beta1.IDecProto=} [properties] Properties to set - */ - function DecProto(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DecProto dec. - * @member {string} dec - * @memberof cosmos.base.v1beta1.DecProto - * @instance - */ - DecProto.prototype.dec = ""; - - /** - * Encodes the specified DecProto message. Does not implicitly {@link cosmos.base.v1beta1.DecProto.verify|verify} messages. - * @function encode - * @memberof cosmos.base.v1beta1.DecProto - * @static - * @param {cosmos.base.v1beta1.IDecProto} message DecProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DecProto.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.dec != null && Object.hasOwnProperty.call(message, "dec")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.dec); - return writer; - }; - - /** - * Encodes the specified DecProto message, length delimited. Does not implicitly {@link cosmos.base.v1beta1.DecProto.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.base.v1beta1.DecProto - * @static - * @param {cosmos.base.v1beta1.IDecProto} message DecProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DecProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DecProto message from the specified reader or buffer. - * @function decode - * @memberof cosmos.base.v1beta1.DecProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.base.v1beta1.DecProto} DecProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DecProto.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.base.v1beta1.DecProto(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.dec = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DecProto message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.base.v1beta1.DecProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.base.v1beta1.DecProto} DecProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DecProto.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DecProto message. - * @function verify - * @memberof cosmos.base.v1beta1.DecProto - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DecProto.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.dec != null && message.hasOwnProperty("dec")) - if (!$util.isString(message.dec)) - return "dec: string expected"; - return null; - }; - - /** - * Creates a DecProto message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.base.v1beta1.DecProto - * @static - * @param {Object.} object Plain object - * @returns {cosmos.base.v1beta1.DecProto} DecProto - */ - DecProto.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.base.v1beta1.DecProto) - return object; - let message = new $root.cosmos.base.v1beta1.DecProto(); - if (object.dec != null) - message.dec = String(object.dec); - return message; - }; - - /** - * Creates a plain object from a DecProto message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.base.v1beta1.DecProto - * @static - * @param {cosmos.base.v1beta1.DecProto} message DecProto - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DecProto.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.dec = ""; - if (message.dec != null && message.hasOwnProperty("dec")) - object.dec = message.dec; - return object; - }; - - /** - * Converts this DecProto to JSON. - * @function toJSON - * @memberof cosmos.base.v1beta1.DecProto - * @instance - * @returns {Object.} JSON object - */ - DecProto.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return DecProto; - })(); - - return v1beta1; - })(); - - return base; - })(); - - cosmos.capability = (function() { - - /** - * Namespace capability. - * @memberof cosmos - * @namespace - */ - const capability = {}; - - capability.v1beta1 = (function() { - - /** - * Namespace v1beta1. - * @memberof cosmos.capability - * @namespace - */ - const v1beta1 = {}; - - v1beta1.Capability = (function() { - - /** - * Properties of a Capability. - * @memberof cosmos.capability.v1beta1 - * @interface ICapability - * @property {Long|null} [index] Capability index - */ - - /** - * Constructs a new Capability. - * @memberof cosmos.capability.v1beta1 - * @classdesc Represents a Capability. - * @implements ICapability - * @constructor - * @param {cosmos.capability.v1beta1.ICapability=} [properties] Properties to set - */ - function Capability(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Capability index. - * @member {Long} index - * @memberof cosmos.capability.v1beta1.Capability - * @instance - */ - Capability.prototype.index = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified Capability message. Does not implicitly {@link cosmos.capability.v1beta1.Capability.verify|verify} messages. - * @function encode - * @memberof cosmos.capability.v1beta1.Capability - * @static - * @param {cosmos.capability.v1beta1.ICapability} message Capability message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Capability.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.index != null && Object.hasOwnProperty.call(message, "index")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.index); - return writer; - }; - - /** - * Encodes the specified Capability message, length delimited. Does not implicitly {@link cosmos.capability.v1beta1.Capability.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.capability.v1beta1.Capability - * @static - * @param {cosmos.capability.v1beta1.ICapability} message Capability message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Capability.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Capability message from the specified reader or buffer. - * @function decode - * @memberof cosmos.capability.v1beta1.Capability - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.capability.v1beta1.Capability} Capability - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Capability.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.capability.v1beta1.Capability(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.index = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Capability message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.capability.v1beta1.Capability - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.capability.v1beta1.Capability} Capability - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Capability.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Capability message. - * @function verify - * @memberof cosmos.capability.v1beta1.Capability - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Capability.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.index != null && message.hasOwnProperty("index")) - if (!$util.isInteger(message.index) && !(message.index && $util.isInteger(message.index.low) && $util.isInteger(message.index.high))) - return "index: integer|Long expected"; - return null; - }; - - /** - * Creates a Capability message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.capability.v1beta1.Capability - * @static - * @param {Object.} object Plain object - * @returns {cosmos.capability.v1beta1.Capability} Capability - */ - Capability.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.capability.v1beta1.Capability) - return object; - let message = new $root.cosmos.capability.v1beta1.Capability(); - if (object.index != null) - if ($util.Long) - (message.index = $util.Long.fromValue(object.index)).unsigned = true; - else if (typeof object.index === "string") - message.index = parseInt(object.index, 10); - else if (typeof object.index === "number") - message.index = object.index; - else if (typeof object.index === "object") - message.index = new $util.LongBits(object.index.low >>> 0, object.index.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a Capability message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.capability.v1beta1.Capability - * @static - * @param {cosmos.capability.v1beta1.Capability} message Capability - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Capability.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.index = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.index = options.longs === String ? "0" : 0; - if (message.index != null && message.hasOwnProperty("index")) - if (typeof message.index === "number") - object.index = options.longs === String ? String(message.index) : message.index; - else - object.index = options.longs === String ? $util.Long.prototype.toString.call(message.index) : options.longs === Number ? new $util.LongBits(message.index.low >>> 0, message.index.high >>> 0).toNumber(true) : message.index; - return object; - }; - - /** - * Converts this Capability to JSON. - * @function toJSON - * @memberof cosmos.capability.v1beta1.Capability - * @instance - * @returns {Object.} JSON object - */ - Capability.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Capability; - })(); - - v1beta1.Owner = (function() { - - /** - * Properties of an Owner. - * @memberof cosmos.capability.v1beta1 - * @interface IOwner - * @property {string|null} [module] Owner module - * @property {string|null} [name] Owner name - */ - - /** - * Constructs a new Owner. - * @memberof cosmos.capability.v1beta1 - * @classdesc Represents an Owner. - * @implements IOwner - * @constructor - * @param {cosmos.capability.v1beta1.IOwner=} [properties] Properties to set - */ - function Owner(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Owner module. - * @member {string} module - * @memberof cosmos.capability.v1beta1.Owner - * @instance - */ - Owner.prototype.module = ""; - - /** - * Owner name. - * @member {string} name - * @memberof cosmos.capability.v1beta1.Owner - * @instance - */ - Owner.prototype.name = ""; - - /** - * Encodes the specified Owner message. Does not implicitly {@link cosmos.capability.v1beta1.Owner.verify|verify} messages. - * @function encode - * @memberof cosmos.capability.v1beta1.Owner - * @static - * @param {cosmos.capability.v1beta1.IOwner} message Owner message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Owner.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.module != null && Object.hasOwnProperty.call(message, "module")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.module); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.name); - return writer; - }; - - /** - * Encodes the specified Owner message, length delimited. Does not implicitly {@link cosmos.capability.v1beta1.Owner.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.capability.v1beta1.Owner - * @static - * @param {cosmos.capability.v1beta1.IOwner} message Owner message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Owner.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Owner message from the specified reader or buffer. - * @function decode - * @memberof cosmos.capability.v1beta1.Owner - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.capability.v1beta1.Owner} Owner - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Owner.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.capability.v1beta1.Owner(); - while (reader.pos < end) { - let 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; - }; - - /** - * Decodes an Owner message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.capability.v1beta1.Owner - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.capability.v1beta1.Owner} Owner - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Owner.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Owner message. - * @function verify - * @memberof cosmos.capability.v1beta1.Owner - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Owner.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.module != null && message.hasOwnProperty("module")) - if (!$util.isString(message.module)) - return "module: string expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates an Owner message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.capability.v1beta1.Owner - * @static - * @param {Object.} object Plain object - * @returns {cosmos.capability.v1beta1.Owner} Owner - */ - Owner.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.capability.v1beta1.Owner) - return object; - let message = new $root.cosmos.capability.v1beta1.Owner(); - if (object.module != null) - message.module = String(object.module); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from an Owner message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.capability.v1beta1.Owner - * @static - * @param {cosmos.capability.v1beta1.Owner} message Owner - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Owner.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.module = ""; - object.name = ""; - } - if (message.module != null && message.hasOwnProperty("module")) - object.module = message.module; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this Owner to JSON. - * @function toJSON - * @memberof cosmos.capability.v1beta1.Owner - * @instance - * @returns {Object.} JSON object - */ - Owner.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Owner; - })(); - - v1beta1.CapabilityOwners = (function() { - - /** - * Properties of a CapabilityOwners. - * @memberof cosmos.capability.v1beta1 - * @interface ICapabilityOwners - * @property {Array.|null} [owners] CapabilityOwners owners - */ - - /** - * Constructs a new CapabilityOwners. - * @memberof cosmos.capability.v1beta1 - * @classdesc Represents a CapabilityOwners. - * @implements ICapabilityOwners - * @constructor - * @param {cosmos.capability.v1beta1.ICapabilityOwners=} [properties] Properties to set - */ - function CapabilityOwners(properties) { - this.owners = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * CapabilityOwners owners. - * @member {Array.} owners - * @memberof cosmos.capability.v1beta1.CapabilityOwners - * @instance - */ - CapabilityOwners.prototype.owners = $util.emptyArray; - - /** - * Encodes the specified CapabilityOwners message. Does not implicitly {@link cosmos.capability.v1beta1.CapabilityOwners.verify|verify} messages. - * @function encode - * @memberof cosmos.capability.v1beta1.CapabilityOwners - * @static - * @param {cosmos.capability.v1beta1.ICapabilityOwners} message CapabilityOwners message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CapabilityOwners.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.owners != null && message.owners.length) - for (let i = 0; i < message.owners.length; ++i) - $root.cosmos.capability.v1beta1.Owner.encode(message.owners[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified CapabilityOwners message, length delimited. Does not implicitly {@link cosmos.capability.v1beta1.CapabilityOwners.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.capability.v1beta1.CapabilityOwners - * @static - * @param {cosmos.capability.v1beta1.ICapabilityOwners} message CapabilityOwners message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CapabilityOwners.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CapabilityOwners message from the specified reader or buffer. - * @function decode - * @memberof cosmos.capability.v1beta1.CapabilityOwners - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.capability.v1beta1.CapabilityOwners} CapabilityOwners - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CapabilityOwners.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.capability.v1beta1.CapabilityOwners(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.owners && message.owners.length)) - message.owners = []; - message.owners.push($root.cosmos.capability.v1beta1.Owner.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CapabilityOwners message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.capability.v1beta1.CapabilityOwners - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.capability.v1beta1.CapabilityOwners} CapabilityOwners - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CapabilityOwners.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CapabilityOwners message. - * @function verify - * @memberof cosmos.capability.v1beta1.CapabilityOwners - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CapabilityOwners.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.owners != null && message.hasOwnProperty("owners")) { - if (!Array.isArray(message.owners)) - return "owners: array expected"; - for (let i = 0; i < message.owners.length; ++i) { - let error = $root.cosmos.capability.v1beta1.Owner.verify(message.owners[i]); - if (error) - return "owners." + error; - } - } - return null; - }; - - /** - * Creates a CapabilityOwners message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.capability.v1beta1.CapabilityOwners - * @static - * @param {Object.} object Plain object - * @returns {cosmos.capability.v1beta1.CapabilityOwners} CapabilityOwners - */ - CapabilityOwners.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.capability.v1beta1.CapabilityOwners) - return object; - let message = new $root.cosmos.capability.v1beta1.CapabilityOwners(); - if (object.owners) { - if (!Array.isArray(object.owners)) - throw TypeError(".cosmos.capability.v1beta1.CapabilityOwners.owners: array expected"); - message.owners = []; - for (let i = 0; i < object.owners.length; ++i) { - if (typeof object.owners[i] !== "object") - throw TypeError(".cosmos.capability.v1beta1.CapabilityOwners.owners: object expected"); - message.owners[i] = $root.cosmos.capability.v1beta1.Owner.fromObject(object.owners[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a CapabilityOwners message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.capability.v1beta1.CapabilityOwners - * @static - * @param {cosmos.capability.v1beta1.CapabilityOwners} message CapabilityOwners - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CapabilityOwners.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.owners = []; - if (message.owners && message.owners.length) { - object.owners = []; - for (let j = 0; j < message.owners.length; ++j) - object.owners[j] = $root.cosmos.capability.v1beta1.Owner.toObject(message.owners[j], options); - } - return object; - }; - - /** - * Converts this CapabilityOwners to JSON. - * @function toJSON - * @memberof cosmos.capability.v1beta1.CapabilityOwners - * @instance - * @returns {Object.} JSON object - */ - CapabilityOwners.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return CapabilityOwners; - })(); - - v1beta1.GenesisOwners = (function() { - - /** - * Properties of a GenesisOwners. - * @memberof cosmos.capability.v1beta1 - * @interface IGenesisOwners - * @property {Long|null} [index] GenesisOwners index - * @property {cosmos.capability.v1beta1.ICapabilityOwners|null} [index_owners] GenesisOwners index_owners - */ - - /** - * Constructs a new GenesisOwners. - * @memberof cosmos.capability.v1beta1 - * @classdesc Represents a GenesisOwners. - * @implements IGenesisOwners - * @constructor - * @param {cosmos.capability.v1beta1.IGenesisOwners=} [properties] Properties to set - */ - function GenesisOwners(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GenesisOwners index. - * @member {Long} index - * @memberof cosmos.capability.v1beta1.GenesisOwners - * @instance - */ - GenesisOwners.prototype.index = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * GenesisOwners index_owners. - * @member {cosmos.capability.v1beta1.ICapabilityOwners|null|undefined} index_owners - * @memberof cosmos.capability.v1beta1.GenesisOwners - * @instance - */ - GenesisOwners.prototype.index_owners = null; - - /** - * Encodes the specified GenesisOwners message. Does not implicitly {@link cosmos.capability.v1beta1.GenesisOwners.verify|verify} messages. - * @function encode - * @memberof cosmos.capability.v1beta1.GenesisOwners - * @static - * @param {cosmos.capability.v1beta1.IGenesisOwners} message GenesisOwners message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisOwners.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.index != null && Object.hasOwnProperty.call(message, "index")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.index); - if (message.index_owners != null && Object.hasOwnProperty.call(message, "index_owners")) - $root.cosmos.capability.v1beta1.CapabilityOwners.encode(message.index_owners, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GenesisOwners message, length delimited. Does not implicitly {@link cosmos.capability.v1beta1.GenesisOwners.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.capability.v1beta1.GenesisOwners - * @static - * @param {cosmos.capability.v1beta1.IGenesisOwners} message GenesisOwners message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisOwners.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GenesisOwners message from the specified reader or buffer. - * @function decode - * @memberof cosmos.capability.v1beta1.GenesisOwners - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.capability.v1beta1.GenesisOwners} GenesisOwners - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisOwners.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.capability.v1beta1.GenesisOwners(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.index = reader.uint64(); - break; - case 2: - message.index_owners = $root.cosmos.capability.v1beta1.CapabilityOwners.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GenesisOwners message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.capability.v1beta1.GenesisOwners - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.capability.v1beta1.GenesisOwners} GenesisOwners - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisOwners.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GenesisOwners message. - * @function verify - * @memberof cosmos.capability.v1beta1.GenesisOwners - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GenesisOwners.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.index != null && message.hasOwnProperty("index")) - if (!$util.isInteger(message.index) && !(message.index && $util.isInteger(message.index.low) && $util.isInteger(message.index.high))) - return "index: integer|Long expected"; - if (message.index_owners != null && message.hasOwnProperty("index_owners")) { - let error = $root.cosmos.capability.v1beta1.CapabilityOwners.verify(message.index_owners); - if (error) - return "index_owners." + error; - } - return null; - }; - - /** - * Creates a GenesisOwners message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.capability.v1beta1.GenesisOwners - * @static - * @param {Object.} object Plain object - * @returns {cosmos.capability.v1beta1.GenesisOwners} GenesisOwners - */ - GenesisOwners.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.capability.v1beta1.GenesisOwners) - return object; - let message = new $root.cosmos.capability.v1beta1.GenesisOwners(); - if (object.index != null) - if ($util.Long) - (message.index = $util.Long.fromValue(object.index)).unsigned = true; - else if (typeof object.index === "string") - message.index = parseInt(object.index, 10); - else if (typeof object.index === "number") - message.index = object.index; - else if (typeof object.index === "object") - message.index = new $util.LongBits(object.index.low >>> 0, object.index.high >>> 0).toNumber(true); - if (object.index_owners != null) { - if (typeof object.index_owners !== "object") - throw TypeError(".cosmos.capability.v1beta1.GenesisOwners.index_owners: object expected"); - message.index_owners = $root.cosmos.capability.v1beta1.CapabilityOwners.fromObject(object.index_owners); - } - return message; - }; - - /** - * Creates a plain object from a GenesisOwners message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.capability.v1beta1.GenesisOwners - * @static - * @param {cosmos.capability.v1beta1.GenesisOwners} message GenesisOwners - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GenesisOwners.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.index = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.index = options.longs === String ? "0" : 0; - object.index_owners = null; - } - if (message.index != null && message.hasOwnProperty("index")) - if (typeof message.index === "number") - object.index = options.longs === String ? String(message.index) : message.index; - else - object.index = options.longs === String ? $util.Long.prototype.toString.call(message.index) : options.longs === Number ? new $util.LongBits(message.index.low >>> 0, message.index.high >>> 0).toNumber(true) : message.index; - if (message.index_owners != null && message.hasOwnProperty("index_owners")) - object.index_owners = $root.cosmos.capability.v1beta1.CapabilityOwners.toObject(message.index_owners, options); - return object; - }; - - /** - * Converts this GenesisOwners to JSON. - * @function toJSON - * @memberof cosmos.capability.v1beta1.GenesisOwners - * @instance - * @returns {Object.} JSON object - */ - GenesisOwners.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GenesisOwners; - })(); - - v1beta1.GenesisState = (function() { - - /** - * Properties of a GenesisState. - * @memberof cosmos.capability.v1beta1 - * @interface IGenesisState - * @property {Long|null} [index] GenesisState index - * @property {Array.|null} [owners] GenesisState owners - */ - - /** - * Constructs a new GenesisState. - * @memberof cosmos.capability.v1beta1 - * @classdesc Represents a GenesisState. - * @implements IGenesisState - * @constructor - * @param {cosmos.capability.v1beta1.IGenesisState=} [properties] Properties to set - */ - function GenesisState(properties) { - this.owners = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GenesisState index. - * @member {Long} index - * @memberof cosmos.capability.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.index = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * GenesisState owners. - * @member {Array.} owners - * @memberof cosmos.capability.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.owners = $util.emptyArray; - - /** - * Encodes the specified GenesisState message. Does not implicitly {@link cosmos.capability.v1beta1.GenesisState.verify|verify} messages. - * @function encode - * @memberof cosmos.capability.v1beta1.GenesisState - * @static - * @param {cosmos.capability.v1beta1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.index != null && Object.hasOwnProperty.call(message, "index")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.index); - if (message.owners != null && message.owners.length) - for (let i = 0; i < message.owners.length; ++i) - $root.cosmos.capability.v1beta1.GenesisOwners.encode(message.owners[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link cosmos.capability.v1beta1.GenesisState.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.capability.v1beta1.GenesisState - * @static - * @param {cosmos.capability.v1beta1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer. - * @function decode - * @memberof cosmos.capability.v1beta1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.capability.v1beta1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.capability.v1beta1.GenesisState(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.index = reader.uint64(); - break; - case 2: - if (!(message.owners && message.owners.length)) - message.owners = []; - message.owners.push($root.cosmos.capability.v1beta1.GenesisOwners.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.capability.v1beta1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.capability.v1beta1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GenesisState message. - * @function verify - * @memberof cosmos.capability.v1beta1.GenesisState - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GenesisState.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.index != null && message.hasOwnProperty("index")) - if (!$util.isInteger(message.index) && !(message.index && $util.isInteger(message.index.low) && $util.isInteger(message.index.high))) - return "index: integer|Long expected"; - if (message.owners != null && message.hasOwnProperty("owners")) { - if (!Array.isArray(message.owners)) - return "owners: array expected"; - for (let i = 0; i < message.owners.length; ++i) { - let error = $root.cosmos.capability.v1beta1.GenesisOwners.verify(message.owners[i]); - if (error) - return "owners." + error; - } - } - return null; - }; - - /** - * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.capability.v1beta1.GenesisState - * @static - * @param {Object.} object Plain object - * @returns {cosmos.capability.v1beta1.GenesisState} GenesisState - */ - GenesisState.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.capability.v1beta1.GenesisState) - return object; - let message = new $root.cosmos.capability.v1beta1.GenesisState(); - if (object.index != null) - if ($util.Long) - (message.index = $util.Long.fromValue(object.index)).unsigned = true; - else if (typeof object.index === "string") - message.index = parseInt(object.index, 10); - else if (typeof object.index === "number") - message.index = object.index; - else if (typeof object.index === "object") - message.index = new $util.LongBits(object.index.low >>> 0, object.index.high >>> 0).toNumber(true); - if (object.owners) { - if (!Array.isArray(object.owners)) - throw TypeError(".cosmos.capability.v1beta1.GenesisState.owners: array expected"); - message.owners = []; - for (let i = 0; i < object.owners.length; ++i) { - if (typeof object.owners[i] !== "object") - throw TypeError(".cosmos.capability.v1beta1.GenesisState.owners: object expected"); - message.owners[i] = $root.cosmos.capability.v1beta1.GenesisOwners.fromObject(object.owners[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a GenesisState message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.capability.v1beta1.GenesisState - * @static - * @param {cosmos.capability.v1beta1.GenesisState} message GenesisState - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GenesisState.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.owners = []; - if (options.defaults) - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.index = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.index = options.longs === String ? "0" : 0; - if (message.index != null && message.hasOwnProperty("index")) - if (typeof message.index === "number") - object.index = options.longs === String ? String(message.index) : message.index; - else - object.index = options.longs === String ? $util.Long.prototype.toString.call(message.index) : options.longs === Number ? new $util.LongBits(message.index.low >>> 0, message.index.high >>> 0).toNumber(true) : message.index; - if (message.owners && message.owners.length) { - object.owners = []; - for (let j = 0; j < message.owners.length; ++j) - object.owners[j] = $root.cosmos.capability.v1beta1.GenesisOwners.toObject(message.owners[j], options); - } - return object; - }; - - /** - * Converts this GenesisState to JSON. - * @function toJSON - * @memberof cosmos.capability.v1beta1.GenesisState - * @instance - * @returns {Object.} JSON object - */ - GenesisState.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GenesisState; - })(); - - return v1beta1; - })(); - - return capability; - })(); - - cosmos.crisis = (function() { - - /** - * Namespace crisis. - * @memberof cosmos - * @namespace - */ - const crisis = {}; - - crisis.v1beta1 = (function() { - - /** - * Namespace v1beta1. - * @memberof cosmos.crisis - * @namespace - */ - const v1beta1 = {}; - - v1beta1.Msg = (function() { - - /** - * Constructs a new Msg service. - * @memberof cosmos.crisis.v1beta1 - * @classdesc Represents a Msg - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function Msg(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Msg.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Msg; - - /** - * Callback as used by {@link cosmos.crisis.v1beta1.Msg#verifyInvariant}. - * @memberof cosmos.crisis.v1beta1.Msg - * @typedef VerifyInvariantCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.crisis.v1beta1.MsgVerifyInvariantResponse} [response] MsgVerifyInvariantResponse - */ - - /** - * Calls VerifyInvariant. - * @function verifyInvariant - * @memberof cosmos.crisis.v1beta1.Msg - * @instance - * @param {cosmos.crisis.v1beta1.IMsgVerifyInvariant} request MsgVerifyInvariant message or plain object - * @param {cosmos.crisis.v1beta1.Msg.VerifyInvariantCallback} callback Node-style callback called with the error, if any, and MsgVerifyInvariantResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.verifyInvariant = function verifyInvariant(request, callback) { - return this.rpcCall(verifyInvariant, $root.cosmos.crisis.v1beta1.MsgVerifyInvariant, $root.cosmos.crisis.v1beta1.MsgVerifyInvariantResponse, request, callback); - }, "name", { value: "VerifyInvariant" }); - - /** - * Calls VerifyInvariant. - * @function verifyInvariant - * @memberof cosmos.crisis.v1beta1.Msg - * @instance - * @param {cosmos.crisis.v1beta1.IMsgVerifyInvariant} request MsgVerifyInvariant message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return Msg; - })(); - - v1beta1.MsgVerifyInvariant = (function() { - - /** - * Properties of a MsgVerifyInvariant. - * @memberof cosmos.crisis.v1beta1 - * @interface IMsgVerifyInvariant - * @property {string|null} [sender] MsgVerifyInvariant sender - * @property {string|null} [invariant_module_name] MsgVerifyInvariant invariant_module_name - * @property {string|null} [invariant_route] MsgVerifyInvariant invariant_route - */ - - /** - * Constructs a new MsgVerifyInvariant. - * @memberof cosmos.crisis.v1beta1 - * @classdesc Represents a MsgVerifyInvariant. - * @implements IMsgVerifyInvariant - * @constructor - * @param {cosmos.crisis.v1beta1.IMsgVerifyInvariant=} [properties] Properties to set - */ - function MsgVerifyInvariant(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgVerifyInvariant sender. - * @member {string} sender - * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariant - * @instance - */ - MsgVerifyInvariant.prototype.sender = ""; - - /** - * MsgVerifyInvariant invariant_module_name. - * @member {string} invariant_module_name - * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariant - * @instance - */ - MsgVerifyInvariant.prototype.invariant_module_name = ""; - - /** - * MsgVerifyInvariant invariant_route. - * @member {string} invariant_route - * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariant - * @instance - */ - MsgVerifyInvariant.prototype.invariant_route = ""; - - /** - * Encodes the specified MsgVerifyInvariant message. Does not implicitly {@link cosmos.crisis.v1beta1.MsgVerifyInvariant.verify|verify} messages. - * @function encode - * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariant - * @static - * @param {cosmos.crisis.v1beta1.IMsgVerifyInvariant} message MsgVerifyInvariant message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgVerifyInvariant.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.sender != null && Object.hasOwnProperty.call(message, "sender")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.sender); - if (message.invariant_module_name != null && Object.hasOwnProperty.call(message, "invariant_module_name")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.invariant_module_name); - if (message.invariant_route != null && Object.hasOwnProperty.call(message, "invariant_route")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.invariant_route); - return writer; - }; - - /** - * Encodes the specified MsgVerifyInvariant message, length delimited. Does not implicitly {@link cosmos.crisis.v1beta1.MsgVerifyInvariant.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariant - * @static - * @param {cosmos.crisis.v1beta1.IMsgVerifyInvariant} message MsgVerifyInvariant message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgVerifyInvariant.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgVerifyInvariant message from the specified reader or buffer. - * @function decode - * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariant - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.crisis.v1beta1.MsgVerifyInvariant} MsgVerifyInvariant - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgVerifyInvariant.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.crisis.v1beta1.MsgVerifyInvariant(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.sender = reader.string(); - break; - case 2: - message.invariant_module_name = reader.string(); - break; - case 3: - message.invariant_route = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgVerifyInvariant message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariant - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.crisis.v1beta1.MsgVerifyInvariant} MsgVerifyInvariant - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgVerifyInvariant.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgVerifyInvariant message. - * @function verify - * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariant - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgVerifyInvariant.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.sender != null && message.hasOwnProperty("sender")) - if (!$util.isString(message.sender)) - return "sender: string expected"; - if (message.invariant_module_name != null && message.hasOwnProperty("invariant_module_name")) - if (!$util.isString(message.invariant_module_name)) - return "invariant_module_name: string expected"; - if (message.invariant_route != null && message.hasOwnProperty("invariant_route")) - if (!$util.isString(message.invariant_route)) - return "invariant_route: string expected"; - return null; - }; - - /** - * Creates a MsgVerifyInvariant message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariant - * @static - * @param {Object.} object Plain object - * @returns {cosmos.crisis.v1beta1.MsgVerifyInvariant} MsgVerifyInvariant - */ - MsgVerifyInvariant.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.crisis.v1beta1.MsgVerifyInvariant) - return object; - let message = new $root.cosmos.crisis.v1beta1.MsgVerifyInvariant(); - if (object.sender != null) - message.sender = String(object.sender); - if (object.invariant_module_name != null) - message.invariant_module_name = String(object.invariant_module_name); - if (object.invariant_route != null) - message.invariant_route = String(object.invariant_route); - return message; - }; - - /** - * Creates a plain object from a MsgVerifyInvariant message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariant - * @static - * @param {cosmos.crisis.v1beta1.MsgVerifyInvariant} message MsgVerifyInvariant - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgVerifyInvariant.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.sender = ""; - object.invariant_module_name = ""; - object.invariant_route = ""; - } - if (message.sender != null && message.hasOwnProperty("sender")) - object.sender = message.sender; - if (message.invariant_module_name != null && message.hasOwnProperty("invariant_module_name")) - object.invariant_module_name = message.invariant_module_name; - if (message.invariant_route != null && message.hasOwnProperty("invariant_route")) - object.invariant_route = message.invariant_route; - return object; - }; - - /** - * Converts this MsgVerifyInvariant to JSON. - * @function toJSON - * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariant - * @instance - * @returns {Object.} JSON object - */ - MsgVerifyInvariant.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgVerifyInvariant; - })(); - - v1beta1.MsgVerifyInvariantResponse = (function() { - - /** - * Properties of a MsgVerifyInvariantResponse. - * @memberof cosmos.crisis.v1beta1 - * @interface IMsgVerifyInvariantResponse - */ - - /** - * Constructs a new MsgVerifyInvariantResponse. - * @memberof cosmos.crisis.v1beta1 - * @classdesc Represents a MsgVerifyInvariantResponse. - * @implements IMsgVerifyInvariantResponse - * @constructor - * @param {cosmos.crisis.v1beta1.IMsgVerifyInvariantResponse=} [properties] Properties to set - */ - function MsgVerifyInvariantResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgVerifyInvariantResponse message. Does not implicitly {@link cosmos.crisis.v1beta1.MsgVerifyInvariantResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariantResponse - * @static - * @param {cosmos.crisis.v1beta1.IMsgVerifyInvariantResponse} message MsgVerifyInvariantResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgVerifyInvariantResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgVerifyInvariantResponse message, length delimited. Does not implicitly {@link cosmos.crisis.v1beta1.MsgVerifyInvariantResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariantResponse - * @static - * @param {cosmos.crisis.v1beta1.IMsgVerifyInvariantResponse} message MsgVerifyInvariantResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgVerifyInvariantResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgVerifyInvariantResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariantResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.crisis.v1beta1.MsgVerifyInvariantResponse} MsgVerifyInvariantResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgVerifyInvariantResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.crisis.v1beta1.MsgVerifyInvariantResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgVerifyInvariantResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariantResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.crisis.v1beta1.MsgVerifyInvariantResponse} MsgVerifyInvariantResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgVerifyInvariantResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgVerifyInvariantResponse message. - * @function verify - * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariantResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgVerifyInvariantResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgVerifyInvariantResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariantResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.crisis.v1beta1.MsgVerifyInvariantResponse} MsgVerifyInvariantResponse - */ - MsgVerifyInvariantResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.crisis.v1beta1.MsgVerifyInvariantResponse) - return object; - return new $root.cosmos.crisis.v1beta1.MsgVerifyInvariantResponse(); - }; - - /** - * Creates a plain object from a MsgVerifyInvariantResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariantResponse - * @static - * @param {cosmos.crisis.v1beta1.MsgVerifyInvariantResponse} message MsgVerifyInvariantResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgVerifyInvariantResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgVerifyInvariantResponse to JSON. - * @function toJSON - * @memberof cosmos.crisis.v1beta1.MsgVerifyInvariantResponse - * @instance - * @returns {Object.} JSON object - */ - MsgVerifyInvariantResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgVerifyInvariantResponse; - })(); - - v1beta1.GenesisState = (function() { - - /** - * Properties of a GenesisState. - * @memberof cosmos.crisis.v1beta1 - * @interface IGenesisState - * @property {cosmos.base.v1beta1.ICoin|null} [constant_fee] GenesisState constant_fee - */ - - /** - * Constructs a new GenesisState. - * @memberof cosmos.crisis.v1beta1 - * @classdesc Represents a GenesisState. - * @implements IGenesisState - * @constructor - * @param {cosmos.crisis.v1beta1.IGenesisState=} [properties] Properties to set - */ - function GenesisState(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GenesisState constant_fee. - * @member {cosmos.base.v1beta1.ICoin|null|undefined} constant_fee - * @memberof cosmos.crisis.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.constant_fee = null; - - /** - * Encodes the specified GenesisState message. Does not implicitly {@link cosmos.crisis.v1beta1.GenesisState.verify|verify} messages. - * @function encode - * @memberof cosmos.crisis.v1beta1.GenesisState - * @static - * @param {cosmos.crisis.v1beta1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.constant_fee != null && Object.hasOwnProperty.call(message, "constant_fee")) - $root.cosmos.base.v1beta1.Coin.encode(message.constant_fee, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link cosmos.crisis.v1beta1.GenesisState.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.crisis.v1beta1.GenesisState - * @static - * @param {cosmos.crisis.v1beta1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer. - * @function decode - * @memberof cosmos.crisis.v1beta1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.crisis.v1beta1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.crisis.v1beta1.GenesisState(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 3: - message.constant_fee = $root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.crisis.v1beta1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.crisis.v1beta1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GenesisState message. - * @function verify - * @memberof cosmos.crisis.v1beta1.GenesisState - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GenesisState.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.constant_fee != null && message.hasOwnProperty("constant_fee")) { - let error = $root.cosmos.base.v1beta1.Coin.verify(message.constant_fee); - if (error) - return "constant_fee." + error; - } - return null; - }; - - /** - * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.crisis.v1beta1.GenesisState - * @static - * @param {Object.} object Plain object - * @returns {cosmos.crisis.v1beta1.GenesisState} GenesisState - */ - GenesisState.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.crisis.v1beta1.GenesisState) - return object; - let message = new $root.cosmos.crisis.v1beta1.GenesisState(); - if (object.constant_fee != null) { - if (typeof object.constant_fee !== "object") - throw TypeError(".cosmos.crisis.v1beta1.GenesisState.constant_fee: object expected"); - message.constant_fee = $root.cosmos.base.v1beta1.Coin.fromObject(object.constant_fee); - } - return message; - }; - - /** - * Creates a plain object from a GenesisState message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.crisis.v1beta1.GenesisState - * @static - * @param {cosmos.crisis.v1beta1.GenesisState} message GenesisState - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GenesisState.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.constant_fee = null; - if (message.constant_fee != null && message.hasOwnProperty("constant_fee")) - object.constant_fee = $root.cosmos.base.v1beta1.Coin.toObject(message.constant_fee, options); - return object; - }; - - /** - * Converts this GenesisState to JSON. - * @function toJSON - * @memberof cosmos.crisis.v1beta1.GenesisState - * @instance - * @returns {Object.} JSON object - */ - GenesisState.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GenesisState; - })(); - - return v1beta1; - })(); - - return crisis; - })(); - - cosmos.crypto = (function() { - - /** - * Namespace crypto. - * @memberof cosmos - * @namespace - */ - const crypto = {}; - - crypto.ed25519 = (function() { - - /** - * Namespace ed25519. - * @memberof cosmos.crypto - * @namespace - */ - const ed25519 = {}; - - ed25519.PubKey = (function() { - - /** - * Properties of a PubKey. - * @memberof cosmos.crypto.ed25519 - * @interface IPubKey - * @property {Uint8Array|null} [key] PubKey key - */ - - /** - * Constructs a new PubKey. - * @memberof cosmos.crypto.ed25519 - * @classdesc Represents a PubKey. - * @implements IPubKey - * @constructor - * @param {cosmos.crypto.ed25519.IPubKey=} [properties] Properties to set - */ - function PubKey(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PubKey key. - * @member {Uint8Array} key - * @memberof cosmos.crypto.ed25519.PubKey - * @instance - */ - PubKey.prototype.key = $util.newBuffer([]); - - /** - * Encodes the specified PubKey message. Does not implicitly {@link cosmos.crypto.ed25519.PubKey.verify|verify} messages. - * @function encode - * @memberof cosmos.crypto.ed25519.PubKey - * @static - * @param {cosmos.crypto.ed25519.IPubKey} message PubKey message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PubKey.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); - return writer; - }; - - /** - * Encodes the specified PubKey message, length delimited. Does not implicitly {@link cosmos.crypto.ed25519.PubKey.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.crypto.ed25519.PubKey - * @static - * @param {cosmos.crypto.ed25519.IPubKey} message PubKey message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PubKey.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PubKey message from the specified reader or buffer. - * @function decode - * @memberof cosmos.crypto.ed25519.PubKey - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.crypto.ed25519.PubKey} PubKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PubKey.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.crypto.ed25519.PubKey(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PubKey message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.crypto.ed25519.PubKey - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.crypto.ed25519.PubKey} PubKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PubKey.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PubKey message. - * @function verify - * @memberof cosmos.crypto.ed25519.PubKey - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PubKey.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) - return "key: buffer expected"; - return null; - }; - - /** - * Creates a PubKey message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.crypto.ed25519.PubKey - * @static - * @param {Object.} object Plain object - * @returns {cosmos.crypto.ed25519.PubKey} PubKey - */ - PubKey.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.crypto.ed25519.PubKey) - return object; - let message = new $root.cosmos.crypto.ed25519.PubKey(); - if (object.key != null) - if (typeof object.key === "string") - $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); - else if (object.key.length) - message.key = object.key; - return message; - }; - - /** - * Creates a plain object from a PubKey message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.crypto.ed25519.PubKey - * @static - * @param {cosmos.crypto.ed25519.PubKey} message PubKey - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PubKey.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - if (options.bytes === String) - object.key = ""; - else { - object.key = []; - if (options.bytes !== Array) - object.key = $util.newBuffer(object.key); - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; - return object; - }; - - /** - * Converts this PubKey to JSON. - * @function toJSON - * @memberof cosmos.crypto.ed25519.PubKey - * @instance - * @returns {Object.} JSON object - */ - PubKey.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return PubKey; - })(); - - ed25519.PrivKey = (function() { - - /** - * Properties of a PrivKey. - * @memberof cosmos.crypto.ed25519 - * @interface IPrivKey - * @property {Uint8Array|null} [key] PrivKey key - */ - - /** - * Constructs a new PrivKey. - * @memberof cosmos.crypto.ed25519 - * @classdesc Represents a PrivKey. - * @implements IPrivKey - * @constructor - * @param {cosmos.crypto.ed25519.IPrivKey=} [properties] Properties to set - */ - function PrivKey(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PrivKey key. - * @member {Uint8Array} key - * @memberof cosmos.crypto.ed25519.PrivKey - * @instance - */ - PrivKey.prototype.key = $util.newBuffer([]); - - /** - * Encodes the specified PrivKey message. Does not implicitly {@link cosmos.crypto.ed25519.PrivKey.verify|verify} messages. - * @function encode - * @memberof cosmos.crypto.ed25519.PrivKey - * @static - * @param {cosmos.crypto.ed25519.IPrivKey} message PrivKey message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PrivKey.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); - return writer; - }; - - /** - * Encodes the specified PrivKey message, length delimited. Does not implicitly {@link cosmos.crypto.ed25519.PrivKey.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.crypto.ed25519.PrivKey - * @static - * @param {cosmos.crypto.ed25519.IPrivKey} message PrivKey message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PrivKey.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PrivKey message from the specified reader or buffer. - * @function decode - * @memberof cosmos.crypto.ed25519.PrivKey - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.crypto.ed25519.PrivKey} PrivKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PrivKey.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.crypto.ed25519.PrivKey(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PrivKey message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.crypto.ed25519.PrivKey - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.crypto.ed25519.PrivKey} PrivKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PrivKey.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PrivKey message. - * @function verify - * @memberof cosmos.crypto.ed25519.PrivKey - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PrivKey.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) - return "key: buffer expected"; - return null; - }; - - /** - * Creates a PrivKey message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.crypto.ed25519.PrivKey - * @static - * @param {Object.} object Plain object - * @returns {cosmos.crypto.ed25519.PrivKey} PrivKey - */ - PrivKey.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.crypto.ed25519.PrivKey) - return object; - let message = new $root.cosmos.crypto.ed25519.PrivKey(); - if (object.key != null) - if (typeof object.key === "string") - $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); - else if (object.key.length) - message.key = object.key; - return message; - }; - - /** - * Creates a plain object from a PrivKey message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.crypto.ed25519.PrivKey - * @static - * @param {cosmos.crypto.ed25519.PrivKey} message PrivKey - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PrivKey.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - if (options.bytes === String) - object.key = ""; - else { - object.key = []; - if (options.bytes !== Array) - object.key = $util.newBuffer(object.key); - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; - return object; - }; - - /** - * Converts this PrivKey to JSON. - * @function toJSON - * @memberof cosmos.crypto.ed25519.PrivKey - * @instance - * @returns {Object.} JSON object - */ - PrivKey.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return PrivKey; - })(); - - return ed25519; - })(); - - crypto.multisig = (function() { - - /** - * Namespace multisig. - * @memberof cosmos.crypto - * @namespace - */ - const multisig = {}; - - multisig.LegacyAminoPubKey = (function() { - - /** - * Properties of a LegacyAminoPubKey. - * @memberof cosmos.crypto.multisig - * @interface ILegacyAminoPubKey - * @property {number|null} [threshold] LegacyAminoPubKey threshold - * @property {Array.|null} [public_keys] LegacyAminoPubKey public_keys - */ - - /** - * Constructs a new LegacyAminoPubKey. - * @memberof cosmos.crypto.multisig - * @classdesc Represents a LegacyAminoPubKey. - * @implements ILegacyAminoPubKey - * @constructor - * @param {cosmos.crypto.multisig.ILegacyAminoPubKey=} [properties] Properties to set - */ - function LegacyAminoPubKey(properties) { - this.public_keys = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * LegacyAminoPubKey threshold. - * @member {number} threshold - * @memberof cosmos.crypto.multisig.LegacyAminoPubKey - * @instance - */ - LegacyAminoPubKey.prototype.threshold = 0; - - /** - * LegacyAminoPubKey public_keys. - * @member {Array.} public_keys - * @memberof cosmos.crypto.multisig.LegacyAminoPubKey - * @instance - */ - LegacyAminoPubKey.prototype.public_keys = $util.emptyArray; - - /** - * Encodes the specified LegacyAminoPubKey message. Does not implicitly {@link cosmos.crypto.multisig.LegacyAminoPubKey.verify|verify} messages. - * @function encode - * @memberof cosmos.crypto.multisig.LegacyAminoPubKey - * @static - * @param {cosmos.crypto.multisig.ILegacyAminoPubKey} message LegacyAminoPubKey message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LegacyAminoPubKey.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.threshold != null && Object.hasOwnProperty.call(message, "threshold")) - writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.threshold); - if (message.public_keys != null && message.public_keys.length) - for (let i = 0; i < message.public_keys.length; ++i) - $root.google.protobuf.Any.encode(message.public_keys[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified LegacyAminoPubKey message, length delimited. Does not implicitly {@link cosmos.crypto.multisig.LegacyAminoPubKey.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.crypto.multisig.LegacyAminoPubKey - * @static - * @param {cosmos.crypto.multisig.ILegacyAminoPubKey} message LegacyAminoPubKey message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LegacyAminoPubKey.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a LegacyAminoPubKey message from the specified reader or buffer. - * @function decode - * @memberof cosmos.crypto.multisig.LegacyAminoPubKey - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.crypto.multisig.LegacyAminoPubKey} LegacyAminoPubKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LegacyAminoPubKey.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.crypto.multisig.LegacyAminoPubKey(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.threshold = reader.uint32(); - break; - case 2: - if (!(message.public_keys && message.public_keys.length)) - message.public_keys = []; - message.public_keys.push($root.google.protobuf.Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a LegacyAminoPubKey message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.crypto.multisig.LegacyAminoPubKey - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.crypto.multisig.LegacyAminoPubKey} LegacyAminoPubKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LegacyAminoPubKey.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a LegacyAminoPubKey message. - * @function verify - * @memberof cosmos.crypto.multisig.LegacyAminoPubKey - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - LegacyAminoPubKey.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.threshold != null && message.hasOwnProperty("threshold")) - if (!$util.isInteger(message.threshold)) - return "threshold: integer expected"; - if (message.public_keys != null && message.hasOwnProperty("public_keys")) { - if (!Array.isArray(message.public_keys)) - return "public_keys: array expected"; - for (let i = 0; i < message.public_keys.length; ++i) { - let error = $root.google.protobuf.Any.verify(message.public_keys[i]); - if (error) - return "public_keys." + error; - } - } - return null; - }; - - /** - * Creates a LegacyAminoPubKey message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.crypto.multisig.LegacyAminoPubKey - * @static - * @param {Object.} object Plain object - * @returns {cosmos.crypto.multisig.LegacyAminoPubKey} LegacyAminoPubKey - */ - LegacyAminoPubKey.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.crypto.multisig.LegacyAminoPubKey) - return object; - let message = new $root.cosmos.crypto.multisig.LegacyAminoPubKey(); - if (object.threshold != null) - message.threshold = object.threshold >>> 0; - if (object.public_keys) { - if (!Array.isArray(object.public_keys)) - throw TypeError(".cosmos.crypto.multisig.LegacyAminoPubKey.public_keys: array expected"); - message.public_keys = []; - for (let i = 0; i < object.public_keys.length; ++i) { - if (typeof object.public_keys[i] !== "object") - throw TypeError(".cosmos.crypto.multisig.LegacyAminoPubKey.public_keys: object expected"); - message.public_keys[i] = $root.google.protobuf.Any.fromObject(object.public_keys[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a LegacyAminoPubKey message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.crypto.multisig.LegacyAminoPubKey - * @static - * @param {cosmos.crypto.multisig.LegacyAminoPubKey} message LegacyAminoPubKey - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - LegacyAminoPubKey.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.public_keys = []; - if (options.defaults) - object.threshold = 0; - if (message.threshold != null && message.hasOwnProperty("threshold")) - object.threshold = message.threshold; - if (message.public_keys && message.public_keys.length) { - object.public_keys = []; - for (let j = 0; j < message.public_keys.length; ++j) - object.public_keys[j] = $root.google.protobuf.Any.toObject(message.public_keys[j], options); - } - return object; - }; - - /** - * Converts this LegacyAminoPubKey to JSON. - * @function toJSON - * @memberof cosmos.crypto.multisig.LegacyAminoPubKey - * @instance - * @returns {Object.} JSON object - */ - LegacyAminoPubKey.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return LegacyAminoPubKey; - })(); - - multisig.v1beta1 = (function() { - - /** - * Namespace v1beta1. - * @memberof cosmos.crypto.multisig - * @namespace - */ - const v1beta1 = {}; - - v1beta1.MultiSignature = (function() { - - /** - * Properties of a MultiSignature. - * @memberof cosmos.crypto.multisig.v1beta1 - * @interface IMultiSignature - * @property {Array.|null} [signatures] MultiSignature signatures - */ - - /** - * Constructs a new MultiSignature. - * @memberof cosmos.crypto.multisig.v1beta1 - * @classdesc Represents a MultiSignature. - * @implements IMultiSignature - * @constructor - * @param {cosmos.crypto.multisig.v1beta1.IMultiSignature=} [properties] Properties to set - */ - function MultiSignature(properties) { - this.signatures = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MultiSignature signatures. - * @member {Array.} signatures - * @memberof cosmos.crypto.multisig.v1beta1.MultiSignature - * @instance - */ - MultiSignature.prototype.signatures = $util.emptyArray; - - /** - * Encodes the specified MultiSignature message. Does not implicitly {@link cosmos.crypto.multisig.v1beta1.MultiSignature.verify|verify} messages. - * @function encode - * @memberof cosmos.crypto.multisig.v1beta1.MultiSignature - * @static - * @param {cosmos.crypto.multisig.v1beta1.IMultiSignature} message MultiSignature message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MultiSignature.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.signatures != null && message.signatures.length) - for (let i = 0; i < message.signatures.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.signatures[i]); - return writer; - }; - - /** - * Encodes the specified MultiSignature message, length delimited. Does not implicitly {@link cosmos.crypto.multisig.v1beta1.MultiSignature.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.crypto.multisig.v1beta1.MultiSignature - * @static - * @param {cosmos.crypto.multisig.v1beta1.IMultiSignature} message MultiSignature message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MultiSignature.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MultiSignature message from the specified reader or buffer. - * @function decode - * @memberof cosmos.crypto.multisig.v1beta1.MultiSignature - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.crypto.multisig.v1beta1.MultiSignature} MultiSignature - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MultiSignature.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.crypto.multisig.v1beta1.MultiSignature(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.signatures && message.signatures.length)) - message.signatures = []; - message.signatures.push(reader.bytes()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MultiSignature message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.crypto.multisig.v1beta1.MultiSignature - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.crypto.multisig.v1beta1.MultiSignature} MultiSignature - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MultiSignature.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MultiSignature message. - * @function verify - * @memberof cosmos.crypto.multisig.v1beta1.MultiSignature - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MultiSignature.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.signatures != null && message.hasOwnProperty("signatures")) { - if (!Array.isArray(message.signatures)) - return "signatures: array expected"; - for (let i = 0; i < message.signatures.length; ++i) - if (!(message.signatures[i] && typeof message.signatures[i].length === "number" || $util.isString(message.signatures[i]))) - return "signatures: buffer[] expected"; - } - return null; - }; - - /** - * Creates a MultiSignature message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.crypto.multisig.v1beta1.MultiSignature - * @static - * @param {Object.} object Plain object - * @returns {cosmos.crypto.multisig.v1beta1.MultiSignature} MultiSignature - */ - MultiSignature.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.crypto.multisig.v1beta1.MultiSignature) - return object; - let message = new $root.cosmos.crypto.multisig.v1beta1.MultiSignature(); - if (object.signatures) { - if (!Array.isArray(object.signatures)) - throw TypeError(".cosmos.crypto.multisig.v1beta1.MultiSignature.signatures: array expected"); - message.signatures = []; - for (let i = 0; i < object.signatures.length; ++i) - if (typeof object.signatures[i] === "string") - $util.base64.decode(object.signatures[i], message.signatures[i] = $util.newBuffer($util.base64.length(object.signatures[i])), 0); - else if (object.signatures[i].length) - message.signatures[i] = object.signatures[i]; - } - return message; - }; - - /** - * Creates a plain object from a MultiSignature message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.crypto.multisig.v1beta1.MultiSignature - * @static - * @param {cosmos.crypto.multisig.v1beta1.MultiSignature} message MultiSignature - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MultiSignature.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.signatures = []; - if (message.signatures && message.signatures.length) { - object.signatures = []; - for (let j = 0; j < message.signatures.length; ++j) - object.signatures[j] = options.bytes === String ? $util.base64.encode(message.signatures[j], 0, message.signatures[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.signatures[j]) : message.signatures[j]; - } - return object; - }; - - /** - * Converts this MultiSignature to JSON. - * @function toJSON - * @memberof cosmos.crypto.multisig.v1beta1.MultiSignature - * @instance - * @returns {Object.} JSON object - */ - MultiSignature.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MultiSignature; - })(); - - v1beta1.CompactBitArray = (function() { - - /** - * Properties of a CompactBitArray. - * @memberof cosmos.crypto.multisig.v1beta1 - * @interface ICompactBitArray - * @property {number|null} [extra_bits_stored] CompactBitArray extra_bits_stored - * @property {Uint8Array|null} [elems] CompactBitArray elems - */ - - /** - * Constructs a new CompactBitArray. - * @memberof cosmos.crypto.multisig.v1beta1 - * @classdesc Represents a CompactBitArray. - * @implements ICompactBitArray - * @constructor - * @param {cosmos.crypto.multisig.v1beta1.ICompactBitArray=} [properties] Properties to set - */ - function CompactBitArray(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * CompactBitArray extra_bits_stored. - * @member {number} extra_bits_stored - * @memberof cosmos.crypto.multisig.v1beta1.CompactBitArray - * @instance - */ - CompactBitArray.prototype.extra_bits_stored = 0; - - /** - * CompactBitArray elems. - * @member {Uint8Array} elems - * @memberof cosmos.crypto.multisig.v1beta1.CompactBitArray - * @instance - */ - CompactBitArray.prototype.elems = $util.newBuffer([]); - - /** - * Encodes the specified CompactBitArray message. Does not implicitly {@link cosmos.crypto.multisig.v1beta1.CompactBitArray.verify|verify} messages. - * @function encode - * @memberof cosmos.crypto.multisig.v1beta1.CompactBitArray - * @static - * @param {cosmos.crypto.multisig.v1beta1.ICompactBitArray} message CompactBitArray message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CompactBitArray.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.extra_bits_stored != null && Object.hasOwnProperty.call(message, "extra_bits_stored")) - writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.extra_bits_stored); - if (message.elems != null && Object.hasOwnProperty.call(message, "elems")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.elems); - return writer; - }; - - /** - * Encodes the specified CompactBitArray message, length delimited. Does not implicitly {@link cosmos.crypto.multisig.v1beta1.CompactBitArray.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.crypto.multisig.v1beta1.CompactBitArray - * @static - * @param {cosmos.crypto.multisig.v1beta1.ICompactBitArray} message CompactBitArray message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CompactBitArray.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CompactBitArray message from the specified reader or buffer. - * @function decode - * @memberof cosmos.crypto.multisig.v1beta1.CompactBitArray - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.crypto.multisig.v1beta1.CompactBitArray} CompactBitArray - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CompactBitArray.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.crypto.multisig.v1beta1.CompactBitArray(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.extra_bits_stored = reader.uint32(); - break; - case 2: - message.elems = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CompactBitArray message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.crypto.multisig.v1beta1.CompactBitArray - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.crypto.multisig.v1beta1.CompactBitArray} CompactBitArray - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CompactBitArray.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CompactBitArray message. - * @function verify - * @memberof cosmos.crypto.multisig.v1beta1.CompactBitArray - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CompactBitArray.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.extra_bits_stored != null && message.hasOwnProperty("extra_bits_stored")) - if (!$util.isInteger(message.extra_bits_stored)) - return "extra_bits_stored: integer expected"; - if (message.elems != null && message.hasOwnProperty("elems")) - if (!(message.elems && typeof message.elems.length === "number" || $util.isString(message.elems))) - return "elems: buffer expected"; - return null; - }; - - /** - * Creates a CompactBitArray message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.crypto.multisig.v1beta1.CompactBitArray - * @static - * @param {Object.} object Plain object - * @returns {cosmos.crypto.multisig.v1beta1.CompactBitArray} CompactBitArray - */ - CompactBitArray.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.crypto.multisig.v1beta1.CompactBitArray) - return object; - let message = new $root.cosmos.crypto.multisig.v1beta1.CompactBitArray(); - if (object.extra_bits_stored != null) - message.extra_bits_stored = object.extra_bits_stored >>> 0; - if (object.elems != null) - if (typeof object.elems === "string") - $util.base64.decode(object.elems, message.elems = $util.newBuffer($util.base64.length(object.elems)), 0); - else if (object.elems.length) - message.elems = object.elems; - return message; - }; - - /** - * Creates a plain object from a CompactBitArray message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.crypto.multisig.v1beta1.CompactBitArray - * @static - * @param {cosmos.crypto.multisig.v1beta1.CompactBitArray} message CompactBitArray - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CompactBitArray.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.extra_bits_stored = 0; - if (options.bytes === String) - object.elems = ""; - else { - object.elems = []; - if (options.bytes !== Array) - object.elems = $util.newBuffer(object.elems); - } - } - if (message.extra_bits_stored != null && message.hasOwnProperty("extra_bits_stored")) - object.extra_bits_stored = message.extra_bits_stored; - if (message.elems != null && message.hasOwnProperty("elems")) - object.elems = options.bytes === String ? $util.base64.encode(message.elems, 0, message.elems.length) : options.bytes === Array ? Array.prototype.slice.call(message.elems) : message.elems; - return object; - }; - - /** - * Converts this CompactBitArray to JSON. - * @function toJSON - * @memberof cosmos.crypto.multisig.v1beta1.CompactBitArray - * @instance - * @returns {Object.} JSON object - */ - CompactBitArray.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return CompactBitArray; - })(); - - return v1beta1; - })(); - - return multisig; - })(); - - crypto.secp256k1 = (function() { - - /** - * Namespace secp256k1. - * @memberof cosmos.crypto - * @namespace - */ - const secp256k1 = {}; - - secp256k1.PubKey = (function() { - - /** - * Properties of a PubKey. - * @memberof cosmos.crypto.secp256k1 - * @interface IPubKey - * @property {Uint8Array|null} [key] PubKey key - */ - - /** - * Constructs a new PubKey. - * @memberof cosmos.crypto.secp256k1 - * @classdesc Represents a PubKey. - * @implements IPubKey - * @constructor - * @param {cosmos.crypto.secp256k1.IPubKey=} [properties] Properties to set - */ - function PubKey(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PubKey key. - * @member {Uint8Array} key - * @memberof cosmos.crypto.secp256k1.PubKey - * @instance - */ - PubKey.prototype.key = $util.newBuffer([]); - - /** - * Encodes the specified PubKey message. Does not implicitly {@link cosmos.crypto.secp256k1.PubKey.verify|verify} messages. - * @function encode - * @memberof cosmos.crypto.secp256k1.PubKey - * @static - * @param {cosmos.crypto.secp256k1.IPubKey} message PubKey message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PubKey.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); - return writer; - }; - - /** - * Encodes the specified PubKey message, length delimited. Does not implicitly {@link cosmos.crypto.secp256k1.PubKey.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.crypto.secp256k1.PubKey - * @static - * @param {cosmos.crypto.secp256k1.IPubKey} message PubKey message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PubKey.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PubKey message from the specified reader or buffer. - * @function decode - * @memberof cosmos.crypto.secp256k1.PubKey - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.crypto.secp256k1.PubKey} PubKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PubKey.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.crypto.secp256k1.PubKey(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PubKey message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.crypto.secp256k1.PubKey - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.crypto.secp256k1.PubKey} PubKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PubKey.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PubKey message. - * @function verify - * @memberof cosmos.crypto.secp256k1.PubKey - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PubKey.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) - return "key: buffer expected"; - return null; - }; - - /** - * Creates a PubKey message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.crypto.secp256k1.PubKey - * @static - * @param {Object.} object Plain object - * @returns {cosmos.crypto.secp256k1.PubKey} PubKey - */ - PubKey.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.crypto.secp256k1.PubKey) - return object; - let message = new $root.cosmos.crypto.secp256k1.PubKey(); - if (object.key != null) - if (typeof object.key === "string") - $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); - else if (object.key.length) - message.key = object.key; - return message; - }; - - /** - * Creates a plain object from a PubKey message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.crypto.secp256k1.PubKey - * @static - * @param {cosmos.crypto.secp256k1.PubKey} message PubKey - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PubKey.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - if (options.bytes === String) - object.key = ""; - else { - object.key = []; - if (options.bytes !== Array) - object.key = $util.newBuffer(object.key); - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; - return object; - }; - - /** - * Converts this PubKey to JSON. - * @function toJSON - * @memberof cosmos.crypto.secp256k1.PubKey - * @instance - * @returns {Object.} JSON object - */ - PubKey.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return PubKey; - })(); - - secp256k1.PrivKey = (function() { - - /** - * Properties of a PrivKey. - * @memberof cosmos.crypto.secp256k1 - * @interface IPrivKey - * @property {Uint8Array|null} [key] PrivKey key - */ - - /** - * Constructs a new PrivKey. - * @memberof cosmos.crypto.secp256k1 - * @classdesc Represents a PrivKey. - * @implements IPrivKey - * @constructor - * @param {cosmos.crypto.secp256k1.IPrivKey=} [properties] Properties to set - */ - function PrivKey(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PrivKey key. - * @member {Uint8Array} key - * @memberof cosmos.crypto.secp256k1.PrivKey - * @instance - */ - PrivKey.prototype.key = $util.newBuffer([]); - - /** - * Encodes the specified PrivKey message. Does not implicitly {@link cosmos.crypto.secp256k1.PrivKey.verify|verify} messages. - * @function encode - * @memberof cosmos.crypto.secp256k1.PrivKey - * @static - * @param {cosmos.crypto.secp256k1.IPrivKey} message PrivKey message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PrivKey.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); - return writer; - }; - - /** - * Encodes the specified PrivKey message, length delimited. Does not implicitly {@link cosmos.crypto.secp256k1.PrivKey.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.crypto.secp256k1.PrivKey - * @static - * @param {cosmos.crypto.secp256k1.IPrivKey} message PrivKey message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PrivKey.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PrivKey message from the specified reader or buffer. - * @function decode - * @memberof cosmos.crypto.secp256k1.PrivKey - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.crypto.secp256k1.PrivKey} PrivKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PrivKey.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.crypto.secp256k1.PrivKey(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PrivKey message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.crypto.secp256k1.PrivKey - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.crypto.secp256k1.PrivKey} PrivKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PrivKey.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PrivKey message. - * @function verify - * @memberof cosmos.crypto.secp256k1.PrivKey - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PrivKey.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) - return "key: buffer expected"; - return null; - }; - - /** - * Creates a PrivKey message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.crypto.secp256k1.PrivKey - * @static - * @param {Object.} object Plain object - * @returns {cosmos.crypto.secp256k1.PrivKey} PrivKey - */ - PrivKey.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.crypto.secp256k1.PrivKey) - return object; - let message = new $root.cosmos.crypto.secp256k1.PrivKey(); - if (object.key != null) - if (typeof object.key === "string") - $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); - else if (object.key.length) - message.key = object.key; - return message; - }; - - /** - * Creates a plain object from a PrivKey message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.crypto.secp256k1.PrivKey - * @static - * @param {cosmos.crypto.secp256k1.PrivKey} message PrivKey - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PrivKey.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - if (options.bytes === String) - object.key = ""; - else { - object.key = []; - if (options.bytes !== Array) - object.key = $util.newBuffer(object.key); - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; - return object; - }; - - /** - * Converts this PrivKey to JSON. - * @function toJSON - * @memberof cosmos.crypto.secp256k1.PrivKey - * @instance - * @returns {Object.} JSON object - */ - PrivKey.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return PrivKey; - })(); - - return secp256k1; - })(); - - return crypto; - })(); - - cosmos.distribution = (function() { - - /** - * Namespace distribution. - * @memberof cosmos - * @namespace - */ - const distribution = {}; - - distribution.v1beta1 = (function() { - - /** - * Namespace v1beta1. - * @memberof cosmos.distribution - * @namespace - */ - const v1beta1 = {}; - - v1beta1.Msg = (function() { - - /** - * Constructs a new Msg service. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a Msg - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function Msg(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Msg.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Msg; - - /** - * Callback as used by {@link cosmos.distribution.v1beta1.Msg#setWithdrawAddress}. - * @memberof cosmos.distribution.v1beta1.Msg - * @typedef SetWithdrawAddressCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse} [response] MsgSetWithdrawAddressResponse - */ - - /** - * Calls SetWithdrawAddress. - * @function setWithdrawAddress - * @memberof cosmos.distribution.v1beta1.Msg - * @instance - * @param {cosmos.distribution.v1beta1.IMsgSetWithdrawAddress} request MsgSetWithdrawAddress message or plain object - * @param {cosmos.distribution.v1beta1.Msg.SetWithdrawAddressCallback} callback Node-style callback called with the error, if any, and MsgSetWithdrawAddressResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.setWithdrawAddress = function setWithdrawAddress(request, callback) { - return this.rpcCall(setWithdrawAddress, $root.cosmos.distribution.v1beta1.MsgSetWithdrawAddress, $root.cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse, request, callback); - }, "name", { value: "SetWithdrawAddress" }); - - /** - * Calls SetWithdrawAddress. - * @function setWithdrawAddress - * @memberof cosmos.distribution.v1beta1.Msg - * @instance - * @param {cosmos.distribution.v1beta1.IMsgSetWithdrawAddress} request MsgSetWithdrawAddress message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.distribution.v1beta1.Msg#withdrawDelegatorReward}. - * @memberof cosmos.distribution.v1beta1.Msg - * @typedef WithdrawDelegatorRewardCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse} [response] MsgWithdrawDelegatorRewardResponse - */ - - /** - * Calls WithdrawDelegatorReward. - * @function withdrawDelegatorReward - * @memberof cosmos.distribution.v1beta1.Msg - * @instance - * @param {cosmos.distribution.v1beta1.IMsgWithdrawDelegatorReward} request MsgWithdrawDelegatorReward message or plain object - * @param {cosmos.distribution.v1beta1.Msg.WithdrawDelegatorRewardCallback} callback Node-style callback called with the error, if any, and MsgWithdrawDelegatorRewardResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.withdrawDelegatorReward = function withdrawDelegatorReward(request, callback) { - return this.rpcCall(withdrawDelegatorReward, $root.cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward, $root.cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse, request, callback); - }, "name", { value: "WithdrawDelegatorReward" }); - - /** - * Calls WithdrawDelegatorReward. - * @function withdrawDelegatorReward - * @memberof cosmos.distribution.v1beta1.Msg - * @instance - * @param {cosmos.distribution.v1beta1.IMsgWithdrawDelegatorReward} request MsgWithdrawDelegatorReward message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.distribution.v1beta1.Msg#withdrawValidatorCommission}. - * @memberof cosmos.distribution.v1beta1.Msg - * @typedef WithdrawValidatorCommissionCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse} [response] MsgWithdrawValidatorCommissionResponse - */ - - /** - * Calls WithdrawValidatorCommission. - * @function withdrawValidatorCommission - * @memberof cosmos.distribution.v1beta1.Msg - * @instance - * @param {cosmos.distribution.v1beta1.IMsgWithdrawValidatorCommission} request MsgWithdrawValidatorCommission message or plain object - * @param {cosmos.distribution.v1beta1.Msg.WithdrawValidatorCommissionCallback} callback Node-style callback called with the error, if any, and MsgWithdrawValidatorCommissionResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.withdrawValidatorCommission = function withdrawValidatorCommission(request, callback) { - return this.rpcCall(withdrawValidatorCommission, $root.cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission, $root.cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse, request, callback); - }, "name", { value: "WithdrawValidatorCommission" }); - - /** - * Calls WithdrawValidatorCommission. - * @function withdrawValidatorCommission - * @memberof cosmos.distribution.v1beta1.Msg - * @instance - * @param {cosmos.distribution.v1beta1.IMsgWithdrawValidatorCommission} request MsgWithdrawValidatorCommission message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.distribution.v1beta1.Msg#fundCommunityPool}. - * @memberof cosmos.distribution.v1beta1.Msg - * @typedef FundCommunityPoolCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse} [response] MsgFundCommunityPoolResponse - */ - - /** - * Calls FundCommunityPool. - * @function fundCommunityPool - * @memberof cosmos.distribution.v1beta1.Msg - * @instance - * @param {cosmos.distribution.v1beta1.IMsgFundCommunityPool} request MsgFundCommunityPool message or plain object - * @param {cosmos.distribution.v1beta1.Msg.FundCommunityPoolCallback} callback Node-style callback called with the error, if any, and MsgFundCommunityPoolResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.fundCommunityPool = function fundCommunityPool(request, callback) { - return this.rpcCall(fundCommunityPool, $root.cosmos.distribution.v1beta1.MsgFundCommunityPool, $root.cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse, request, callback); - }, "name", { value: "FundCommunityPool" }); - - /** - * Calls FundCommunityPool. - * @function fundCommunityPool - * @memberof cosmos.distribution.v1beta1.Msg - * @instance - * @param {cosmos.distribution.v1beta1.IMsgFundCommunityPool} request MsgFundCommunityPool message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return Msg; - })(); - - v1beta1.MsgSetWithdrawAddress = (function() { - - /** - * Properties of a MsgSetWithdrawAddress. - * @memberof cosmos.distribution.v1beta1 - * @interface IMsgSetWithdrawAddress - * @property {string|null} [delegator_address] MsgSetWithdrawAddress delegator_address - * @property {string|null} [withdraw_address] MsgSetWithdrawAddress withdraw_address - */ - - /** - * Constructs a new MsgSetWithdrawAddress. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a MsgSetWithdrawAddress. - * @implements IMsgSetWithdrawAddress - * @constructor - * @param {cosmos.distribution.v1beta1.IMsgSetWithdrawAddress=} [properties] Properties to set - */ - function MsgSetWithdrawAddress(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgSetWithdrawAddress delegator_address. - * @member {string} delegator_address - * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddress - * @instance - */ - MsgSetWithdrawAddress.prototype.delegator_address = ""; - - /** - * MsgSetWithdrawAddress withdraw_address. - * @member {string} withdraw_address - * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddress - * @instance - */ - MsgSetWithdrawAddress.prototype.withdraw_address = ""; - - /** - * Encodes the specified MsgSetWithdrawAddress message. Does not implicitly {@link cosmos.distribution.v1beta1.MsgSetWithdrawAddress.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddress - * @static - * @param {cosmos.distribution.v1beta1.IMsgSetWithdrawAddress} message MsgSetWithdrawAddress message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgSetWithdrawAddress.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); - if (message.withdraw_address != null && Object.hasOwnProperty.call(message, "withdraw_address")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.withdraw_address); - return writer; - }; - - /** - * Encodes the specified MsgSetWithdrawAddress message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.MsgSetWithdrawAddress.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddress - * @static - * @param {cosmos.distribution.v1beta1.IMsgSetWithdrawAddress} message MsgSetWithdrawAddress message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgSetWithdrawAddress.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgSetWithdrawAddress message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddress - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.MsgSetWithdrawAddress} MsgSetWithdrawAddress - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgSetWithdrawAddress.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.MsgSetWithdrawAddress(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.delegator_address = reader.string(); - break; - case 2: - message.withdraw_address = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgSetWithdrawAddress message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddress - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.MsgSetWithdrawAddress} MsgSetWithdrawAddress - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgSetWithdrawAddress.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgSetWithdrawAddress message. - * @function verify - * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddress - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgSetWithdrawAddress.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - if (!$util.isString(message.delegator_address)) - return "delegator_address: string expected"; - if (message.withdraw_address != null && message.hasOwnProperty("withdraw_address")) - if (!$util.isString(message.withdraw_address)) - return "withdraw_address: string expected"; - return null; - }; - - /** - * Creates a MsgSetWithdrawAddress message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddress - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.MsgSetWithdrawAddress} MsgSetWithdrawAddress - */ - MsgSetWithdrawAddress.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.MsgSetWithdrawAddress) - return object; - let message = new $root.cosmos.distribution.v1beta1.MsgSetWithdrawAddress(); - if (object.delegator_address != null) - message.delegator_address = String(object.delegator_address); - if (object.withdraw_address != null) - message.withdraw_address = String(object.withdraw_address); - return message; - }; - - /** - * Creates a plain object from a MsgSetWithdrawAddress message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddress - * @static - * @param {cosmos.distribution.v1beta1.MsgSetWithdrawAddress} message MsgSetWithdrawAddress - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgSetWithdrawAddress.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.delegator_address = ""; - object.withdraw_address = ""; - } - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - object.delegator_address = message.delegator_address; - if (message.withdraw_address != null && message.hasOwnProperty("withdraw_address")) - object.withdraw_address = message.withdraw_address; - return object; - }; - - /** - * Converts this MsgSetWithdrawAddress to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddress - * @instance - * @returns {Object.} JSON object - */ - MsgSetWithdrawAddress.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgSetWithdrawAddress; - })(); - - v1beta1.MsgSetWithdrawAddressResponse = (function() { - - /** - * Properties of a MsgSetWithdrawAddressResponse. - * @memberof cosmos.distribution.v1beta1 - * @interface IMsgSetWithdrawAddressResponse - */ - - /** - * Constructs a new MsgSetWithdrawAddressResponse. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a MsgSetWithdrawAddressResponse. - * @implements IMsgSetWithdrawAddressResponse - * @constructor - * @param {cosmos.distribution.v1beta1.IMsgSetWithdrawAddressResponse=} [properties] Properties to set - */ - function MsgSetWithdrawAddressResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgSetWithdrawAddressResponse message. Does not implicitly {@link cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse - * @static - * @param {cosmos.distribution.v1beta1.IMsgSetWithdrawAddressResponse} message MsgSetWithdrawAddressResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgSetWithdrawAddressResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgSetWithdrawAddressResponse message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse - * @static - * @param {cosmos.distribution.v1beta1.IMsgSetWithdrawAddressResponse} message MsgSetWithdrawAddressResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgSetWithdrawAddressResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgSetWithdrawAddressResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse} MsgSetWithdrawAddressResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgSetWithdrawAddressResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgSetWithdrawAddressResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse} MsgSetWithdrawAddressResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgSetWithdrawAddressResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgSetWithdrawAddressResponse message. - * @function verify - * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgSetWithdrawAddressResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgSetWithdrawAddressResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse} MsgSetWithdrawAddressResponse - */ - MsgSetWithdrawAddressResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse) - return object; - return new $root.cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse(); - }; - - /** - * Creates a plain object from a MsgSetWithdrawAddressResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse - * @static - * @param {cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse} message MsgSetWithdrawAddressResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgSetWithdrawAddressResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgSetWithdrawAddressResponse to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse - * @instance - * @returns {Object.} JSON object - */ - MsgSetWithdrawAddressResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgSetWithdrawAddressResponse; - })(); - - v1beta1.MsgWithdrawDelegatorReward = (function() { - - /** - * Properties of a MsgWithdrawDelegatorReward. - * @memberof cosmos.distribution.v1beta1 - * @interface IMsgWithdrawDelegatorReward - * @property {string|null} [delegator_address] MsgWithdrawDelegatorReward delegator_address - * @property {string|null} [validator_address] MsgWithdrawDelegatorReward validator_address - */ - - /** - * Constructs a new MsgWithdrawDelegatorReward. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a MsgWithdrawDelegatorReward. - * @implements IMsgWithdrawDelegatorReward - * @constructor - * @param {cosmos.distribution.v1beta1.IMsgWithdrawDelegatorReward=} [properties] Properties to set - */ - function MsgWithdrawDelegatorReward(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgWithdrawDelegatorReward delegator_address. - * @member {string} delegator_address - * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward - * @instance - */ - MsgWithdrawDelegatorReward.prototype.delegator_address = ""; - - /** - * MsgWithdrawDelegatorReward validator_address. - * @member {string} validator_address - * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward - * @instance - */ - MsgWithdrawDelegatorReward.prototype.validator_address = ""; - - /** - * Encodes the specified MsgWithdrawDelegatorReward message. Does not implicitly {@link cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward - * @static - * @param {cosmos.distribution.v1beta1.IMsgWithdrawDelegatorReward} message MsgWithdrawDelegatorReward message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgWithdrawDelegatorReward.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); - if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.validator_address); - return writer; - }; - - /** - * Encodes the specified MsgWithdrawDelegatorReward message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward - * @static - * @param {cosmos.distribution.v1beta1.IMsgWithdrawDelegatorReward} message MsgWithdrawDelegatorReward message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgWithdrawDelegatorReward.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgWithdrawDelegatorReward message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward} MsgWithdrawDelegatorReward - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgWithdrawDelegatorReward.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.delegator_address = reader.string(); - break; - case 2: - message.validator_address = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgWithdrawDelegatorReward message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward} MsgWithdrawDelegatorReward - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgWithdrawDelegatorReward.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgWithdrawDelegatorReward message. - * @function verify - * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgWithdrawDelegatorReward.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - if (!$util.isString(message.delegator_address)) - return "delegator_address: string expected"; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - if (!$util.isString(message.validator_address)) - return "validator_address: string expected"; - return null; - }; - - /** - * Creates a MsgWithdrawDelegatorReward message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward} MsgWithdrawDelegatorReward - */ - MsgWithdrawDelegatorReward.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward) - return object; - let message = new $root.cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward(); - if (object.delegator_address != null) - message.delegator_address = String(object.delegator_address); - if (object.validator_address != null) - message.validator_address = String(object.validator_address); - return message; - }; - - /** - * Creates a plain object from a MsgWithdrawDelegatorReward message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward - * @static - * @param {cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward} message MsgWithdrawDelegatorReward - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgWithdrawDelegatorReward.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.delegator_address = ""; - object.validator_address = ""; - } - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - object.delegator_address = message.delegator_address; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - object.validator_address = message.validator_address; - return object; - }; - - /** - * Converts this MsgWithdrawDelegatorReward to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward - * @instance - * @returns {Object.} JSON object - */ - MsgWithdrawDelegatorReward.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgWithdrawDelegatorReward; - })(); - - v1beta1.MsgWithdrawDelegatorRewardResponse = (function() { - - /** - * Properties of a MsgWithdrawDelegatorRewardResponse. - * @memberof cosmos.distribution.v1beta1 - * @interface IMsgWithdrawDelegatorRewardResponse - */ - - /** - * Constructs a new MsgWithdrawDelegatorRewardResponse. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a MsgWithdrawDelegatorRewardResponse. - * @implements IMsgWithdrawDelegatorRewardResponse - * @constructor - * @param {cosmos.distribution.v1beta1.IMsgWithdrawDelegatorRewardResponse=} [properties] Properties to set - */ - function MsgWithdrawDelegatorRewardResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgWithdrawDelegatorRewardResponse message. Does not implicitly {@link cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse - * @static - * @param {cosmos.distribution.v1beta1.IMsgWithdrawDelegatorRewardResponse} message MsgWithdrawDelegatorRewardResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgWithdrawDelegatorRewardResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgWithdrawDelegatorRewardResponse message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse - * @static - * @param {cosmos.distribution.v1beta1.IMsgWithdrawDelegatorRewardResponse} message MsgWithdrawDelegatorRewardResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgWithdrawDelegatorRewardResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgWithdrawDelegatorRewardResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse} MsgWithdrawDelegatorRewardResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgWithdrawDelegatorRewardResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgWithdrawDelegatorRewardResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse} MsgWithdrawDelegatorRewardResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgWithdrawDelegatorRewardResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgWithdrawDelegatorRewardResponse message. - * @function verify - * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgWithdrawDelegatorRewardResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgWithdrawDelegatorRewardResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse} MsgWithdrawDelegatorRewardResponse - */ - MsgWithdrawDelegatorRewardResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse) - return object; - return new $root.cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse(); - }; - - /** - * Creates a plain object from a MsgWithdrawDelegatorRewardResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse - * @static - * @param {cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse} message MsgWithdrawDelegatorRewardResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgWithdrawDelegatorRewardResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgWithdrawDelegatorRewardResponse to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse - * @instance - * @returns {Object.} JSON object - */ - MsgWithdrawDelegatorRewardResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgWithdrawDelegatorRewardResponse; - })(); - - v1beta1.MsgWithdrawValidatorCommission = (function() { - - /** - * Properties of a MsgWithdrawValidatorCommission. - * @memberof cosmos.distribution.v1beta1 - * @interface IMsgWithdrawValidatorCommission - * @property {string|null} [validator_address] MsgWithdrawValidatorCommission validator_address - */ - - /** - * Constructs a new MsgWithdrawValidatorCommission. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a MsgWithdrawValidatorCommission. - * @implements IMsgWithdrawValidatorCommission - * @constructor - * @param {cosmos.distribution.v1beta1.IMsgWithdrawValidatorCommission=} [properties] Properties to set - */ - function MsgWithdrawValidatorCommission(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgWithdrawValidatorCommission validator_address. - * @member {string} validator_address - * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission - * @instance - */ - MsgWithdrawValidatorCommission.prototype.validator_address = ""; - - /** - * Encodes the specified MsgWithdrawValidatorCommission message. Does not implicitly {@link cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission - * @static - * @param {cosmos.distribution.v1beta1.IMsgWithdrawValidatorCommission} message MsgWithdrawValidatorCommission message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgWithdrawValidatorCommission.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.validator_address); - return writer; - }; - - /** - * Encodes the specified MsgWithdrawValidatorCommission message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission - * @static - * @param {cosmos.distribution.v1beta1.IMsgWithdrawValidatorCommission} message MsgWithdrawValidatorCommission message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgWithdrawValidatorCommission.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgWithdrawValidatorCommission message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission} MsgWithdrawValidatorCommission - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgWithdrawValidatorCommission.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.validator_address = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgWithdrawValidatorCommission message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission} MsgWithdrawValidatorCommission - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgWithdrawValidatorCommission.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgWithdrawValidatorCommission message. - * @function verify - * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgWithdrawValidatorCommission.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - if (!$util.isString(message.validator_address)) - return "validator_address: string expected"; - return null; - }; - - /** - * Creates a MsgWithdrawValidatorCommission message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission} MsgWithdrawValidatorCommission - */ - MsgWithdrawValidatorCommission.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission) - return object; - let message = new $root.cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission(); - if (object.validator_address != null) - message.validator_address = String(object.validator_address); - return message; - }; - - /** - * Creates a plain object from a MsgWithdrawValidatorCommission message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission - * @static - * @param {cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission} message MsgWithdrawValidatorCommission - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgWithdrawValidatorCommission.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.validator_address = ""; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - object.validator_address = message.validator_address; - return object; - }; - - /** - * Converts this MsgWithdrawValidatorCommission to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission - * @instance - * @returns {Object.} JSON object - */ - MsgWithdrawValidatorCommission.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgWithdrawValidatorCommission; - })(); - - v1beta1.MsgWithdrawValidatorCommissionResponse = (function() { - - /** - * Properties of a MsgWithdrawValidatorCommissionResponse. - * @memberof cosmos.distribution.v1beta1 - * @interface IMsgWithdrawValidatorCommissionResponse - */ - - /** - * Constructs a new MsgWithdrawValidatorCommissionResponse. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a MsgWithdrawValidatorCommissionResponse. - * @implements IMsgWithdrawValidatorCommissionResponse - * @constructor - * @param {cosmos.distribution.v1beta1.IMsgWithdrawValidatorCommissionResponse=} [properties] Properties to set - */ - function MsgWithdrawValidatorCommissionResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgWithdrawValidatorCommissionResponse message. Does not implicitly {@link cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse - * @static - * @param {cosmos.distribution.v1beta1.IMsgWithdrawValidatorCommissionResponse} message MsgWithdrawValidatorCommissionResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgWithdrawValidatorCommissionResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgWithdrawValidatorCommissionResponse message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse - * @static - * @param {cosmos.distribution.v1beta1.IMsgWithdrawValidatorCommissionResponse} message MsgWithdrawValidatorCommissionResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgWithdrawValidatorCommissionResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgWithdrawValidatorCommissionResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse} MsgWithdrawValidatorCommissionResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgWithdrawValidatorCommissionResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgWithdrawValidatorCommissionResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse} MsgWithdrawValidatorCommissionResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgWithdrawValidatorCommissionResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgWithdrawValidatorCommissionResponse message. - * @function verify - * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgWithdrawValidatorCommissionResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgWithdrawValidatorCommissionResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse} MsgWithdrawValidatorCommissionResponse - */ - MsgWithdrawValidatorCommissionResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse) - return object; - return new $root.cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse(); - }; - - /** - * Creates a plain object from a MsgWithdrawValidatorCommissionResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse - * @static - * @param {cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse} message MsgWithdrawValidatorCommissionResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgWithdrawValidatorCommissionResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgWithdrawValidatorCommissionResponse to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse - * @instance - * @returns {Object.} JSON object - */ - MsgWithdrawValidatorCommissionResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgWithdrawValidatorCommissionResponse; - })(); - - v1beta1.MsgFundCommunityPool = (function() { - - /** - * Properties of a MsgFundCommunityPool. - * @memberof cosmos.distribution.v1beta1 - * @interface IMsgFundCommunityPool - * @property {Array.|null} [amount] MsgFundCommunityPool amount - * @property {string|null} [depositor] MsgFundCommunityPool depositor - */ - - /** - * Constructs a new MsgFundCommunityPool. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a MsgFundCommunityPool. - * @implements IMsgFundCommunityPool - * @constructor - * @param {cosmos.distribution.v1beta1.IMsgFundCommunityPool=} [properties] Properties to set - */ - function MsgFundCommunityPool(properties) { - this.amount = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgFundCommunityPool amount. - * @member {Array.} amount - * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPool - * @instance - */ - MsgFundCommunityPool.prototype.amount = $util.emptyArray; - - /** - * MsgFundCommunityPool depositor. - * @member {string} depositor - * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPool - * @instance - */ - MsgFundCommunityPool.prototype.depositor = ""; - - /** - * Encodes the specified MsgFundCommunityPool message. Does not implicitly {@link cosmos.distribution.v1beta1.MsgFundCommunityPool.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPool - * @static - * @param {cosmos.distribution.v1beta1.IMsgFundCommunityPool} message MsgFundCommunityPool message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgFundCommunityPool.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.amount != null && message.amount.length) - for (let i = 0; i < message.amount.length; ++i) - $root.cosmos.base.v1beta1.Coin.encode(message.amount[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.depositor != null && Object.hasOwnProperty.call(message, "depositor")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.depositor); - return writer; - }; - - /** - * Encodes the specified MsgFundCommunityPool message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.MsgFundCommunityPool.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPool - * @static - * @param {cosmos.distribution.v1beta1.IMsgFundCommunityPool} message MsgFundCommunityPool message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgFundCommunityPool.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgFundCommunityPool message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPool - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.MsgFundCommunityPool} MsgFundCommunityPool - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgFundCommunityPool.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.MsgFundCommunityPool(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.amount && message.amount.length)) - message.amount = []; - message.amount.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); - break; - case 2: - message.depositor = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgFundCommunityPool message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPool - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.MsgFundCommunityPool} MsgFundCommunityPool - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgFundCommunityPool.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgFundCommunityPool message. - * @function verify - * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPool - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgFundCommunityPool.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.amount != null && message.hasOwnProperty("amount")) { - if (!Array.isArray(message.amount)) - return "amount: array expected"; - for (let i = 0; i < message.amount.length; ++i) { - let error = $root.cosmos.base.v1beta1.Coin.verify(message.amount[i]); - if (error) - return "amount." + error; - } - } - if (message.depositor != null && message.hasOwnProperty("depositor")) - if (!$util.isString(message.depositor)) - return "depositor: string expected"; - return null; - }; - - /** - * Creates a MsgFundCommunityPool message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPool - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.MsgFundCommunityPool} MsgFundCommunityPool - */ - MsgFundCommunityPool.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.MsgFundCommunityPool) - return object; - let message = new $root.cosmos.distribution.v1beta1.MsgFundCommunityPool(); - if (object.amount) { - if (!Array.isArray(object.amount)) - throw TypeError(".cosmos.distribution.v1beta1.MsgFundCommunityPool.amount: array expected"); - message.amount = []; - for (let i = 0; i < object.amount.length; ++i) { - if (typeof object.amount[i] !== "object") - throw TypeError(".cosmos.distribution.v1beta1.MsgFundCommunityPool.amount: object expected"); - message.amount[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.amount[i]); - } - } - if (object.depositor != null) - message.depositor = String(object.depositor); - return message; - }; - - /** - * Creates a plain object from a MsgFundCommunityPool message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPool - * @static - * @param {cosmos.distribution.v1beta1.MsgFundCommunityPool} message MsgFundCommunityPool - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgFundCommunityPool.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.amount = []; - if (options.defaults) - object.depositor = ""; - if (message.amount && message.amount.length) { - object.amount = []; - for (let j = 0; j < message.amount.length; ++j) - object.amount[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.amount[j], options); - } - if (message.depositor != null && message.hasOwnProperty("depositor")) - object.depositor = message.depositor; - return object; - }; - - /** - * Converts this MsgFundCommunityPool to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPool - * @instance - * @returns {Object.} JSON object - */ - MsgFundCommunityPool.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgFundCommunityPool; - })(); - - v1beta1.MsgFundCommunityPoolResponse = (function() { - - /** - * Properties of a MsgFundCommunityPoolResponse. - * @memberof cosmos.distribution.v1beta1 - * @interface IMsgFundCommunityPoolResponse - */ - - /** - * Constructs a new MsgFundCommunityPoolResponse. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a MsgFundCommunityPoolResponse. - * @implements IMsgFundCommunityPoolResponse - * @constructor - * @param {cosmos.distribution.v1beta1.IMsgFundCommunityPoolResponse=} [properties] Properties to set - */ - function MsgFundCommunityPoolResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgFundCommunityPoolResponse message. Does not implicitly {@link cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse - * @static - * @param {cosmos.distribution.v1beta1.IMsgFundCommunityPoolResponse} message MsgFundCommunityPoolResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgFundCommunityPoolResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgFundCommunityPoolResponse message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse - * @static - * @param {cosmos.distribution.v1beta1.IMsgFundCommunityPoolResponse} message MsgFundCommunityPoolResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgFundCommunityPoolResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgFundCommunityPoolResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse} MsgFundCommunityPoolResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgFundCommunityPoolResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgFundCommunityPoolResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse} MsgFundCommunityPoolResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgFundCommunityPoolResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgFundCommunityPoolResponse message. - * @function verify - * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgFundCommunityPoolResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgFundCommunityPoolResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse} MsgFundCommunityPoolResponse - */ - MsgFundCommunityPoolResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse) - return object; - return new $root.cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse(); - }; - - /** - * Creates a plain object from a MsgFundCommunityPoolResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse - * @static - * @param {cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse} message MsgFundCommunityPoolResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgFundCommunityPoolResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgFundCommunityPoolResponse to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse - * @instance - * @returns {Object.} JSON object - */ - MsgFundCommunityPoolResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgFundCommunityPoolResponse; - })(); - - v1beta1.Params = (function() { - - /** - * Properties of a Params. - * @memberof cosmos.distribution.v1beta1 - * @interface IParams - * @property {string|null} [community_tax] Params community_tax - * @property {string|null} [base_proposer_reward] Params base_proposer_reward - * @property {string|null} [bonus_proposer_reward] Params bonus_proposer_reward - * @property {boolean|null} [withdraw_addr_enabled] Params withdraw_addr_enabled - */ - - /** - * Constructs a new Params. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a Params. - * @implements IParams - * @constructor - * @param {cosmos.distribution.v1beta1.IParams=} [properties] Properties to set - */ - function Params(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Params community_tax. - * @member {string} community_tax - * @memberof cosmos.distribution.v1beta1.Params - * @instance - */ - Params.prototype.community_tax = ""; - - /** - * Params base_proposer_reward. - * @member {string} base_proposer_reward - * @memberof cosmos.distribution.v1beta1.Params - * @instance - */ - Params.prototype.base_proposer_reward = ""; - - /** - * Params bonus_proposer_reward. - * @member {string} bonus_proposer_reward - * @memberof cosmos.distribution.v1beta1.Params - * @instance - */ - Params.prototype.bonus_proposer_reward = ""; - - /** - * Params withdraw_addr_enabled. - * @member {boolean} withdraw_addr_enabled - * @memberof cosmos.distribution.v1beta1.Params - * @instance - */ - Params.prototype.withdraw_addr_enabled = false; - - /** - * Encodes the specified Params message. Does not implicitly {@link cosmos.distribution.v1beta1.Params.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.Params - * @static - * @param {cosmos.distribution.v1beta1.IParams} message Params message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Params.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.community_tax != null && Object.hasOwnProperty.call(message, "community_tax")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.community_tax); - if (message.base_proposer_reward != null && Object.hasOwnProperty.call(message, "base_proposer_reward")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.base_proposer_reward); - if (message.bonus_proposer_reward != null && Object.hasOwnProperty.call(message, "bonus_proposer_reward")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.bonus_proposer_reward); - if (message.withdraw_addr_enabled != null && Object.hasOwnProperty.call(message, "withdraw_addr_enabled")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.withdraw_addr_enabled); - return writer; - }; - - /** - * Encodes the specified Params message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.Params.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.Params - * @static - * @param {cosmos.distribution.v1beta1.IParams} message Params message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Params.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Params message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.Params - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.Params} Params - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Params.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.Params(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.community_tax = reader.string(); - break; - case 2: - message.base_proposer_reward = reader.string(); - break; - case 3: - message.bonus_proposer_reward = reader.string(); - break; - case 4: - message.withdraw_addr_enabled = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Params message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.Params - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.Params} Params - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Params.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Params message. - * @function verify - * @memberof cosmos.distribution.v1beta1.Params - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Params.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.community_tax != null && message.hasOwnProperty("community_tax")) - if (!$util.isString(message.community_tax)) - return "community_tax: string expected"; - if (message.base_proposer_reward != null && message.hasOwnProperty("base_proposer_reward")) - if (!$util.isString(message.base_proposer_reward)) - return "base_proposer_reward: string expected"; - if (message.bonus_proposer_reward != null && message.hasOwnProperty("bonus_proposer_reward")) - if (!$util.isString(message.bonus_proposer_reward)) - return "bonus_proposer_reward: string expected"; - if (message.withdraw_addr_enabled != null && message.hasOwnProperty("withdraw_addr_enabled")) - if (typeof message.withdraw_addr_enabled !== "boolean") - return "withdraw_addr_enabled: boolean expected"; - return null; - }; - - /** - * Creates a Params message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.Params - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.Params} Params - */ - Params.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.Params) - return object; - let message = new $root.cosmos.distribution.v1beta1.Params(); - if (object.community_tax != null) - message.community_tax = String(object.community_tax); - if (object.base_proposer_reward != null) - message.base_proposer_reward = String(object.base_proposer_reward); - if (object.bonus_proposer_reward != null) - message.bonus_proposer_reward = String(object.bonus_proposer_reward); - if (object.withdraw_addr_enabled != null) - message.withdraw_addr_enabled = Boolean(object.withdraw_addr_enabled); - return message; - }; - - /** - * Creates a plain object from a Params message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.Params - * @static - * @param {cosmos.distribution.v1beta1.Params} message Params - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Params.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.community_tax = ""; - object.base_proposer_reward = ""; - object.bonus_proposer_reward = ""; - object.withdraw_addr_enabled = false; - } - if (message.community_tax != null && message.hasOwnProperty("community_tax")) - object.community_tax = message.community_tax; - if (message.base_proposer_reward != null && message.hasOwnProperty("base_proposer_reward")) - object.base_proposer_reward = message.base_proposer_reward; - if (message.bonus_proposer_reward != null && message.hasOwnProperty("bonus_proposer_reward")) - object.bonus_proposer_reward = message.bonus_proposer_reward; - if (message.withdraw_addr_enabled != null && message.hasOwnProperty("withdraw_addr_enabled")) - object.withdraw_addr_enabled = message.withdraw_addr_enabled; - return object; - }; - - /** - * Converts this Params to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.Params - * @instance - * @returns {Object.} JSON object - */ - Params.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Params; - })(); - - v1beta1.ValidatorHistoricalRewards = (function() { - - /** - * Properties of a ValidatorHistoricalRewards. - * @memberof cosmos.distribution.v1beta1 - * @interface IValidatorHistoricalRewards - * @property {Array.|null} [cumulative_reward_ratio] ValidatorHistoricalRewards cumulative_reward_ratio - * @property {number|null} [reference_count] ValidatorHistoricalRewards reference_count - */ - - /** - * Constructs a new ValidatorHistoricalRewards. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a ValidatorHistoricalRewards. - * @implements IValidatorHistoricalRewards - * @constructor - * @param {cosmos.distribution.v1beta1.IValidatorHistoricalRewards=} [properties] Properties to set - */ - function ValidatorHistoricalRewards(properties) { - this.cumulative_reward_ratio = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ValidatorHistoricalRewards cumulative_reward_ratio. - * @member {Array.} cumulative_reward_ratio - * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewards - * @instance - */ - ValidatorHistoricalRewards.prototype.cumulative_reward_ratio = $util.emptyArray; - - /** - * ValidatorHistoricalRewards reference_count. - * @member {number} reference_count - * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewards - * @instance - */ - ValidatorHistoricalRewards.prototype.reference_count = 0; - - /** - * Encodes the specified ValidatorHistoricalRewards message. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorHistoricalRewards.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewards - * @static - * @param {cosmos.distribution.v1beta1.IValidatorHistoricalRewards} message ValidatorHistoricalRewards message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorHistoricalRewards.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.cumulative_reward_ratio != null && message.cumulative_reward_ratio.length) - for (let i = 0; i < message.cumulative_reward_ratio.length; ++i) - $root.cosmos.base.v1beta1.DecCoin.encode(message.cumulative_reward_ratio[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.reference_count != null && Object.hasOwnProperty.call(message, "reference_count")) - writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.reference_count); - return writer; - }; - - /** - * Encodes the specified ValidatorHistoricalRewards message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorHistoricalRewards.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewards - * @static - * @param {cosmos.distribution.v1beta1.IValidatorHistoricalRewards} message ValidatorHistoricalRewards message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorHistoricalRewards.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ValidatorHistoricalRewards message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewards - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.ValidatorHistoricalRewards} ValidatorHistoricalRewards - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorHistoricalRewards.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.ValidatorHistoricalRewards(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.cumulative_reward_ratio && message.cumulative_reward_ratio.length)) - message.cumulative_reward_ratio = []; - message.cumulative_reward_ratio.push($root.cosmos.base.v1beta1.DecCoin.decode(reader, reader.uint32())); - break; - case 2: - message.reference_count = reader.uint32(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ValidatorHistoricalRewards message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewards - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.ValidatorHistoricalRewards} ValidatorHistoricalRewards - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorHistoricalRewards.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ValidatorHistoricalRewards message. - * @function verify - * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewards - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ValidatorHistoricalRewards.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.cumulative_reward_ratio != null && message.hasOwnProperty("cumulative_reward_ratio")) { - if (!Array.isArray(message.cumulative_reward_ratio)) - return "cumulative_reward_ratio: array expected"; - for (let i = 0; i < message.cumulative_reward_ratio.length; ++i) { - let error = $root.cosmos.base.v1beta1.DecCoin.verify(message.cumulative_reward_ratio[i]); - if (error) - return "cumulative_reward_ratio." + error; - } - } - if (message.reference_count != null && message.hasOwnProperty("reference_count")) - if (!$util.isInteger(message.reference_count)) - return "reference_count: integer expected"; - return null; - }; - - /** - * Creates a ValidatorHistoricalRewards message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewards - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.ValidatorHistoricalRewards} ValidatorHistoricalRewards - */ - ValidatorHistoricalRewards.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.ValidatorHistoricalRewards) - return object; - let message = new $root.cosmos.distribution.v1beta1.ValidatorHistoricalRewards(); - if (object.cumulative_reward_ratio) { - if (!Array.isArray(object.cumulative_reward_ratio)) - throw TypeError(".cosmos.distribution.v1beta1.ValidatorHistoricalRewards.cumulative_reward_ratio: array expected"); - message.cumulative_reward_ratio = []; - for (let i = 0; i < object.cumulative_reward_ratio.length; ++i) { - if (typeof object.cumulative_reward_ratio[i] !== "object") - throw TypeError(".cosmos.distribution.v1beta1.ValidatorHistoricalRewards.cumulative_reward_ratio: object expected"); - message.cumulative_reward_ratio[i] = $root.cosmos.base.v1beta1.DecCoin.fromObject(object.cumulative_reward_ratio[i]); - } - } - if (object.reference_count != null) - message.reference_count = object.reference_count >>> 0; - return message; - }; - - /** - * Creates a plain object from a ValidatorHistoricalRewards message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewards - * @static - * @param {cosmos.distribution.v1beta1.ValidatorHistoricalRewards} message ValidatorHistoricalRewards - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ValidatorHistoricalRewards.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.cumulative_reward_ratio = []; - if (options.defaults) - object.reference_count = 0; - if (message.cumulative_reward_ratio && message.cumulative_reward_ratio.length) { - object.cumulative_reward_ratio = []; - for (let j = 0; j < message.cumulative_reward_ratio.length; ++j) - object.cumulative_reward_ratio[j] = $root.cosmos.base.v1beta1.DecCoin.toObject(message.cumulative_reward_ratio[j], options); - } - if (message.reference_count != null && message.hasOwnProperty("reference_count")) - object.reference_count = message.reference_count; - return object; - }; - - /** - * Converts this ValidatorHistoricalRewards to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewards - * @instance - * @returns {Object.} JSON object - */ - ValidatorHistoricalRewards.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ValidatorHistoricalRewards; - })(); - - v1beta1.ValidatorCurrentRewards = (function() { - - /** - * Properties of a ValidatorCurrentRewards. - * @memberof cosmos.distribution.v1beta1 - * @interface IValidatorCurrentRewards - * @property {Array.|null} [rewards] ValidatorCurrentRewards rewards - * @property {Long|null} [period] ValidatorCurrentRewards period - */ - - /** - * Constructs a new ValidatorCurrentRewards. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a ValidatorCurrentRewards. - * @implements IValidatorCurrentRewards - * @constructor - * @param {cosmos.distribution.v1beta1.IValidatorCurrentRewards=} [properties] Properties to set - */ - function ValidatorCurrentRewards(properties) { - this.rewards = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ValidatorCurrentRewards rewards. - * @member {Array.} rewards - * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewards - * @instance - */ - ValidatorCurrentRewards.prototype.rewards = $util.emptyArray; - - /** - * ValidatorCurrentRewards period. - * @member {Long} period - * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewards - * @instance - */ - ValidatorCurrentRewards.prototype.period = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified ValidatorCurrentRewards message. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorCurrentRewards.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewards - * @static - * @param {cosmos.distribution.v1beta1.IValidatorCurrentRewards} message ValidatorCurrentRewards message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorCurrentRewards.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.rewards != null && message.rewards.length) - for (let i = 0; i < message.rewards.length; ++i) - $root.cosmos.base.v1beta1.DecCoin.encode(message.rewards[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.period != null && Object.hasOwnProperty.call(message, "period")) - writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.period); - return writer; - }; - - /** - * Encodes the specified ValidatorCurrentRewards message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorCurrentRewards.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewards - * @static - * @param {cosmos.distribution.v1beta1.IValidatorCurrentRewards} message ValidatorCurrentRewards message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorCurrentRewards.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ValidatorCurrentRewards message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewards - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.ValidatorCurrentRewards} ValidatorCurrentRewards - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorCurrentRewards.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.ValidatorCurrentRewards(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.rewards && message.rewards.length)) - message.rewards = []; - message.rewards.push($root.cosmos.base.v1beta1.DecCoin.decode(reader, reader.uint32())); - break; - case 2: - message.period = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ValidatorCurrentRewards message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewards - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.ValidatorCurrentRewards} ValidatorCurrentRewards - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorCurrentRewards.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ValidatorCurrentRewards message. - * @function verify - * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewards - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ValidatorCurrentRewards.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.rewards != null && message.hasOwnProperty("rewards")) { - if (!Array.isArray(message.rewards)) - return "rewards: array expected"; - for (let i = 0; i < message.rewards.length; ++i) { - let error = $root.cosmos.base.v1beta1.DecCoin.verify(message.rewards[i]); - if (error) - return "rewards." + error; - } - } - if (message.period != null && message.hasOwnProperty("period")) - if (!$util.isInteger(message.period) && !(message.period && $util.isInteger(message.period.low) && $util.isInteger(message.period.high))) - return "period: integer|Long expected"; - return null; - }; - - /** - * Creates a ValidatorCurrentRewards message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewards - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.ValidatorCurrentRewards} ValidatorCurrentRewards - */ - ValidatorCurrentRewards.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.ValidatorCurrentRewards) - return object; - let message = new $root.cosmos.distribution.v1beta1.ValidatorCurrentRewards(); - if (object.rewards) { - if (!Array.isArray(object.rewards)) - throw TypeError(".cosmos.distribution.v1beta1.ValidatorCurrentRewards.rewards: array expected"); - message.rewards = []; - for (let i = 0; i < object.rewards.length; ++i) { - if (typeof object.rewards[i] !== "object") - throw TypeError(".cosmos.distribution.v1beta1.ValidatorCurrentRewards.rewards: object expected"); - message.rewards[i] = $root.cosmos.base.v1beta1.DecCoin.fromObject(object.rewards[i]); - } - } - if (object.period != null) - if ($util.Long) - (message.period = $util.Long.fromValue(object.period)).unsigned = true; - else if (typeof object.period === "string") - message.period = parseInt(object.period, 10); - else if (typeof object.period === "number") - message.period = object.period; - else if (typeof object.period === "object") - message.period = new $util.LongBits(object.period.low >>> 0, object.period.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a ValidatorCurrentRewards message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewards - * @static - * @param {cosmos.distribution.v1beta1.ValidatorCurrentRewards} message ValidatorCurrentRewards - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ValidatorCurrentRewards.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.rewards = []; - if (options.defaults) - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.period = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.period = options.longs === String ? "0" : 0; - if (message.rewards && message.rewards.length) { - object.rewards = []; - for (let j = 0; j < message.rewards.length; ++j) - object.rewards[j] = $root.cosmos.base.v1beta1.DecCoin.toObject(message.rewards[j], options); - } - if (message.period != null && message.hasOwnProperty("period")) - if (typeof message.period === "number") - object.period = options.longs === String ? String(message.period) : message.period; - else - object.period = options.longs === String ? $util.Long.prototype.toString.call(message.period) : options.longs === Number ? new $util.LongBits(message.period.low >>> 0, message.period.high >>> 0).toNumber(true) : message.period; - return object; - }; - - /** - * Converts this ValidatorCurrentRewards to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewards - * @instance - * @returns {Object.} JSON object - */ - ValidatorCurrentRewards.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ValidatorCurrentRewards; - })(); - - v1beta1.ValidatorAccumulatedCommission = (function() { - - /** - * Properties of a ValidatorAccumulatedCommission. - * @memberof cosmos.distribution.v1beta1 - * @interface IValidatorAccumulatedCommission - * @property {Array.|null} [commission] ValidatorAccumulatedCommission commission - */ - - /** - * Constructs a new ValidatorAccumulatedCommission. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a ValidatorAccumulatedCommission. - * @implements IValidatorAccumulatedCommission - * @constructor - * @param {cosmos.distribution.v1beta1.IValidatorAccumulatedCommission=} [properties] Properties to set - */ - function ValidatorAccumulatedCommission(properties) { - this.commission = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ValidatorAccumulatedCommission commission. - * @member {Array.} commission - * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommission - * @instance - */ - ValidatorAccumulatedCommission.prototype.commission = $util.emptyArray; - - /** - * Encodes the specified ValidatorAccumulatedCommission message. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorAccumulatedCommission.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommission - * @static - * @param {cosmos.distribution.v1beta1.IValidatorAccumulatedCommission} message ValidatorAccumulatedCommission message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorAccumulatedCommission.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.commission != null && message.commission.length) - for (let i = 0; i < message.commission.length; ++i) - $root.cosmos.base.v1beta1.DecCoin.encode(message.commission[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ValidatorAccumulatedCommission message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorAccumulatedCommission.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommission - * @static - * @param {cosmos.distribution.v1beta1.IValidatorAccumulatedCommission} message ValidatorAccumulatedCommission message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorAccumulatedCommission.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ValidatorAccumulatedCommission message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommission - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.ValidatorAccumulatedCommission} ValidatorAccumulatedCommission - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorAccumulatedCommission.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommission(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.commission && message.commission.length)) - message.commission = []; - message.commission.push($root.cosmos.base.v1beta1.DecCoin.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ValidatorAccumulatedCommission message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommission - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.ValidatorAccumulatedCommission} ValidatorAccumulatedCommission - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorAccumulatedCommission.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ValidatorAccumulatedCommission message. - * @function verify - * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommission - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ValidatorAccumulatedCommission.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.commission != null && message.hasOwnProperty("commission")) { - if (!Array.isArray(message.commission)) - return "commission: array expected"; - for (let i = 0; i < message.commission.length; ++i) { - let error = $root.cosmos.base.v1beta1.DecCoin.verify(message.commission[i]); - if (error) - return "commission." + error; - } - } - return null; - }; - - /** - * Creates a ValidatorAccumulatedCommission message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommission - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.ValidatorAccumulatedCommission} ValidatorAccumulatedCommission - */ - ValidatorAccumulatedCommission.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommission) - return object; - let message = new $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommission(); - if (object.commission) { - if (!Array.isArray(object.commission)) - throw TypeError(".cosmos.distribution.v1beta1.ValidatorAccumulatedCommission.commission: array expected"); - message.commission = []; - for (let i = 0; i < object.commission.length; ++i) { - if (typeof object.commission[i] !== "object") - throw TypeError(".cosmos.distribution.v1beta1.ValidatorAccumulatedCommission.commission: object expected"); - message.commission[i] = $root.cosmos.base.v1beta1.DecCoin.fromObject(object.commission[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a ValidatorAccumulatedCommission message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommission - * @static - * @param {cosmos.distribution.v1beta1.ValidatorAccumulatedCommission} message ValidatorAccumulatedCommission - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ValidatorAccumulatedCommission.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.commission = []; - if (message.commission && message.commission.length) { - object.commission = []; - for (let j = 0; j < message.commission.length; ++j) - object.commission[j] = $root.cosmos.base.v1beta1.DecCoin.toObject(message.commission[j], options); - } - return object; - }; - - /** - * Converts this ValidatorAccumulatedCommission to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommission - * @instance - * @returns {Object.} JSON object - */ - ValidatorAccumulatedCommission.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ValidatorAccumulatedCommission; - })(); - - v1beta1.ValidatorOutstandingRewards = (function() { - - /** - * Properties of a ValidatorOutstandingRewards. - * @memberof cosmos.distribution.v1beta1 - * @interface IValidatorOutstandingRewards - * @property {Array.|null} [rewards] ValidatorOutstandingRewards rewards - */ - - /** - * Constructs a new ValidatorOutstandingRewards. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a ValidatorOutstandingRewards. - * @implements IValidatorOutstandingRewards - * @constructor - * @param {cosmos.distribution.v1beta1.IValidatorOutstandingRewards=} [properties] Properties to set - */ - function ValidatorOutstandingRewards(properties) { - this.rewards = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ValidatorOutstandingRewards rewards. - * @member {Array.} rewards - * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewards - * @instance - */ - ValidatorOutstandingRewards.prototype.rewards = $util.emptyArray; - - /** - * Encodes the specified ValidatorOutstandingRewards message. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorOutstandingRewards.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewards - * @static - * @param {cosmos.distribution.v1beta1.IValidatorOutstandingRewards} message ValidatorOutstandingRewards message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorOutstandingRewards.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.rewards != null && message.rewards.length) - for (let i = 0; i < message.rewards.length; ++i) - $root.cosmos.base.v1beta1.DecCoin.encode(message.rewards[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ValidatorOutstandingRewards message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorOutstandingRewards.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewards - * @static - * @param {cosmos.distribution.v1beta1.IValidatorOutstandingRewards} message ValidatorOutstandingRewards message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorOutstandingRewards.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ValidatorOutstandingRewards message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewards - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.ValidatorOutstandingRewards} ValidatorOutstandingRewards - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorOutstandingRewards.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.ValidatorOutstandingRewards(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.rewards && message.rewards.length)) - message.rewards = []; - message.rewards.push($root.cosmos.base.v1beta1.DecCoin.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ValidatorOutstandingRewards message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewards - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.ValidatorOutstandingRewards} ValidatorOutstandingRewards - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorOutstandingRewards.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ValidatorOutstandingRewards message. - * @function verify - * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewards - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ValidatorOutstandingRewards.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.rewards != null && message.hasOwnProperty("rewards")) { - if (!Array.isArray(message.rewards)) - return "rewards: array expected"; - for (let i = 0; i < message.rewards.length; ++i) { - let error = $root.cosmos.base.v1beta1.DecCoin.verify(message.rewards[i]); - if (error) - return "rewards." + error; - } - } - return null; - }; - - /** - * Creates a ValidatorOutstandingRewards message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewards - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.ValidatorOutstandingRewards} ValidatorOutstandingRewards - */ - ValidatorOutstandingRewards.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.ValidatorOutstandingRewards) - return object; - let message = new $root.cosmos.distribution.v1beta1.ValidatorOutstandingRewards(); - if (object.rewards) { - if (!Array.isArray(object.rewards)) - throw TypeError(".cosmos.distribution.v1beta1.ValidatorOutstandingRewards.rewards: array expected"); - message.rewards = []; - for (let i = 0; i < object.rewards.length; ++i) { - if (typeof object.rewards[i] !== "object") - throw TypeError(".cosmos.distribution.v1beta1.ValidatorOutstandingRewards.rewards: object expected"); - message.rewards[i] = $root.cosmos.base.v1beta1.DecCoin.fromObject(object.rewards[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a ValidatorOutstandingRewards message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewards - * @static - * @param {cosmos.distribution.v1beta1.ValidatorOutstandingRewards} message ValidatorOutstandingRewards - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ValidatorOutstandingRewards.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.rewards = []; - if (message.rewards && message.rewards.length) { - object.rewards = []; - for (let j = 0; j < message.rewards.length; ++j) - object.rewards[j] = $root.cosmos.base.v1beta1.DecCoin.toObject(message.rewards[j], options); - } - return object; - }; - - /** - * Converts this ValidatorOutstandingRewards to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewards - * @instance - * @returns {Object.} JSON object - */ - ValidatorOutstandingRewards.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ValidatorOutstandingRewards; - })(); - - v1beta1.ValidatorSlashEvent = (function() { - - /** - * Properties of a ValidatorSlashEvent. - * @memberof cosmos.distribution.v1beta1 - * @interface IValidatorSlashEvent - * @property {Long|null} [validator_period] ValidatorSlashEvent validator_period - * @property {string|null} [fraction] ValidatorSlashEvent fraction - */ - - /** - * Constructs a new ValidatorSlashEvent. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a ValidatorSlashEvent. - * @implements IValidatorSlashEvent - * @constructor - * @param {cosmos.distribution.v1beta1.IValidatorSlashEvent=} [properties] Properties to set - */ - function ValidatorSlashEvent(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ValidatorSlashEvent validator_period. - * @member {Long} validator_period - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvent - * @instance - */ - ValidatorSlashEvent.prototype.validator_period = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * ValidatorSlashEvent fraction. - * @member {string} fraction - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvent - * @instance - */ - ValidatorSlashEvent.prototype.fraction = ""; - - /** - * Encodes the specified ValidatorSlashEvent message. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorSlashEvent.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvent - * @static - * @param {cosmos.distribution.v1beta1.IValidatorSlashEvent} message ValidatorSlashEvent message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorSlashEvent.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.validator_period != null && Object.hasOwnProperty.call(message, "validator_period")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.validator_period); - if (message.fraction != null && Object.hasOwnProperty.call(message, "fraction")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.fraction); - return writer; - }; - - /** - * Encodes the specified ValidatorSlashEvent message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorSlashEvent.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvent - * @static - * @param {cosmos.distribution.v1beta1.IValidatorSlashEvent} message ValidatorSlashEvent message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorSlashEvent.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ValidatorSlashEvent message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvent - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.ValidatorSlashEvent} ValidatorSlashEvent - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorSlashEvent.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.ValidatorSlashEvent(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.validator_period = reader.uint64(); - break; - case 2: - message.fraction = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ValidatorSlashEvent message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvent - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.ValidatorSlashEvent} ValidatorSlashEvent - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorSlashEvent.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ValidatorSlashEvent message. - * @function verify - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvent - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ValidatorSlashEvent.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.validator_period != null && message.hasOwnProperty("validator_period")) - if (!$util.isInteger(message.validator_period) && !(message.validator_period && $util.isInteger(message.validator_period.low) && $util.isInteger(message.validator_period.high))) - return "validator_period: integer|Long expected"; - if (message.fraction != null && message.hasOwnProperty("fraction")) - if (!$util.isString(message.fraction)) - return "fraction: string expected"; - return null; - }; - - /** - * Creates a ValidatorSlashEvent message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvent - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.ValidatorSlashEvent} ValidatorSlashEvent - */ - ValidatorSlashEvent.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.ValidatorSlashEvent) - return object; - let message = new $root.cosmos.distribution.v1beta1.ValidatorSlashEvent(); - if (object.validator_period != null) - if ($util.Long) - (message.validator_period = $util.Long.fromValue(object.validator_period)).unsigned = true; - else if (typeof object.validator_period === "string") - message.validator_period = parseInt(object.validator_period, 10); - else if (typeof object.validator_period === "number") - message.validator_period = object.validator_period; - else if (typeof object.validator_period === "object") - message.validator_period = new $util.LongBits(object.validator_period.low >>> 0, object.validator_period.high >>> 0).toNumber(true); - if (object.fraction != null) - message.fraction = String(object.fraction); - return message; - }; - - /** - * Creates a plain object from a ValidatorSlashEvent message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvent - * @static - * @param {cosmos.distribution.v1beta1.ValidatorSlashEvent} message ValidatorSlashEvent - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ValidatorSlashEvent.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.validator_period = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.validator_period = options.longs === String ? "0" : 0; - object.fraction = ""; - } - if (message.validator_period != null && message.hasOwnProperty("validator_period")) - if (typeof message.validator_period === "number") - object.validator_period = options.longs === String ? String(message.validator_period) : message.validator_period; - else - object.validator_period = options.longs === String ? $util.Long.prototype.toString.call(message.validator_period) : options.longs === Number ? new $util.LongBits(message.validator_period.low >>> 0, message.validator_period.high >>> 0).toNumber(true) : message.validator_period; - if (message.fraction != null && message.hasOwnProperty("fraction")) - object.fraction = message.fraction; - return object; - }; - - /** - * Converts this ValidatorSlashEvent to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvent - * @instance - * @returns {Object.} JSON object - */ - ValidatorSlashEvent.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ValidatorSlashEvent; - })(); - - v1beta1.ValidatorSlashEvents = (function() { - - /** - * Properties of a ValidatorSlashEvents. - * @memberof cosmos.distribution.v1beta1 - * @interface IValidatorSlashEvents - * @property {Array.|null} [validator_slash_events] ValidatorSlashEvents validator_slash_events - */ - - /** - * Constructs a new ValidatorSlashEvents. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a ValidatorSlashEvents. - * @implements IValidatorSlashEvents - * @constructor - * @param {cosmos.distribution.v1beta1.IValidatorSlashEvents=} [properties] Properties to set - */ - function ValidatorSlashEvents(properties) { - this.validator_slash_events = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ValidatorSlashEvents validator_slash_events. - * @member {Array.} validator_slash_events - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvents - * @instance - */ - ValidatorSlashEvents.prototype.validator_slash_events = $util.emptyArray; - - /** - * Encodes the specified ValidatorSlashEvents message. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorSlashEvents.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvents - * @static - * @param {cosmos.distribution.v1beta1.IValidatorSlashEvents} message ValidatorSlashEvents message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorSlashEvents.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.validator_slash_events != null && message.validator_slash_events.length) - for (let i = 0; i < message.validator_slash_events.length; ++i) - $root.cosmos.distribution.v1beta1.ValidatorSlashEvent.encode(message.validator_slash_events[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ValidatorSlashEvents message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorSlashEvents.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvents - * @static - * @param {cosmos.distribution.v1beta1.IValidatorSlashEvents} message ValidatorSlashEvents message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorSlashEvents.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ValidatorSlashEvents message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvents - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.ValidatorSlashEvents} ValidatorSlashEvents - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorSlashEvents.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.ValidatorSlashEvents(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.validator_slash_events && message.validator_slash_events.length)) - message.validator_slash_events = []; - message.validator_slash_events.push($root.cosmos.distribution.v1beta1.ValidatorSlashEvent.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ValidatorSlashEvents message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvents - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.ValidatorSlashEvents} ValidatorSlashEvents - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorSlashEvents.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ValidatorSlashEvents message. - * @function verify - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvents - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ValidatorSlashEvents.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.validator_slash_events != null && message.hasOwnProperty("validator_slash_events")) { - if (!Array.isArray(message.validator_slash_events)) - return "validator_slash_events: array expected"; - for (let i = 0; i < message.validator_slash_events.length; ++i) { - let error = $root.cosmos.distribution.v1beta1.ValidatorSlashEvent.verify(message.validator_slash_events[i]); - if (error) - return "validator_slash_events." + error; - } - } - return null; - }; - - /** - * Creates a ValidatorSlashEvents message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvents - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.ValidatorSlashEvents} ValidatorSlashEvents - */ - ValidatorSlashEvents.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.ValidatorSlashEvents) - return object; - let message = new $root.cosmos.distribution.v1beta1.ValidatorSlashEvents(); - if (object.validator_slash_events) { - if (!Array.isArray(object.validator_slash_events)) - throw TypeError(".cosmos.distribution.v1beta1.ValidatorSlashEvents.validator_slash_events: array expected"); - message.validator_slash_events = []; - for (let i = 0; i < object.validator_slash_events.length; ++i) { - if (typeof object.validator_slash_events[i] !== "object") - throw TypeError(".cosmos.distribution.v1beta1.ValidatorSlashEvents.validator_slash_events: object expected"); - message.validator_slash_events[i] = $root.cosmos.distribution.v1beta1.ValidatorSlashEvent.fromObject(object.validator_slash_events[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a ValidatorSlashEvents message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvents - * @static - * @param {cosmos.distribution.v1beta1.ValidatorSlashEvents} message ValidatorSlashEvents - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ValidatorSlashEvents.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.validator_slash_events = []; - if (message.validator_slash_events && message.validator_slash_events.length) { - object.validator_slash_events = []; - for (let j = 0; j < message.validator_slash_events.length; ++j) - object.validator_slash_events[j] = $root.cosmos.distribution.v1beta1.ValidatorSlashEvent.toObject(message.validator_slash_events[j], options); - } - return object; - }; - - /** - * Converts this ValidatorSlashEvents to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEvents - * @instance - * @returns {Object.} JSON object - */ - ValidatorSlashEvents.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ValidatorSlashEvents; - })(); - - v1beta1.FeePool = (function() { - - /** - * Properties of a FeePool. - * @memberof cosmos.distribution.v1beta1 - * @interface IFeePool - * @property {Array.|null} [community_pool] FeePool community_pool - */ - - /** - * Constructs a new FeePool. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a FeePool. - * @implements IFeePool - * @constructor - * @param {cosmos.distribution.v1beta1.IFeePool=} [properties] Properties to set - */ - function FeePool(properties) { - this.community_pool = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * FeePool community_pool. - * @member {Array.} community_pool - * @memberof cosmos.distribution.v1beta1.FeePool - * @instance - */ - FeePool.prototype.community_pool = $util.emptyArray; - - /** - * Encodes the specified FeePool message. Does not implicitly {@link cosmos.distribution.v1beta1.FeePool.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.FeePool - * @static - * @param {cosmos.distribution.v1beta1.IFeePool} message FeePool message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FeePool.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.community_pool != null && message.community_pool.length) - for (let i = 0; i < message.community_pool.length; ++i) - $root.cosmos.base.v1beta1.DecCoin.encode(message.community_pool[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified FeePool message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.FeePool.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.FeePool - * @static - * @param {cosmos.distribution.v1beta1.IFeePool} message FeePool message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FeePool.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FeePool message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.FeePool - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.FeePool} FeePool - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FeePool.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.FeePool(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.community_pool && message.community_pool.length)) - message.community_pool = []; - message.community_pool.push($root.cosmos.base.v1beta1.DecCoin.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FeePool message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.FeePool - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.FeePool} FeePool - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FeePool.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FeePool message. - * @function verify - * @memberof cosmos.distribution.v1beta1.FeePool - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FeePool.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.community_pool != null && message.hasOwnProperty("community_pool")) { - if (!Array.isArray(message.community_pool)) - return "community_pool: array expected"; - for (let i = 0; i < message.community_pool.length; ++i) { - let error = $root.cosmos.base.v1beta1.DecCoin.verify(message.community_pool[i]); - if (error) - return "community_pool." + error; - } - } - return null; - }; - - /** - * Creates a FeePool message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.FeePool - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.FeePool} FeePool - */ - FeePool.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.FeePool) - return object; - let message = new $root.cosmos.distribution.v1beta1.FeePool(); - if (object.community_pool) { - if (!Array.isArray(object.community_pool)) - throw TypeError(".cosmos.distribution.v1beta1.FeePool.community_pool: array expected"); - message.community_pool = []; - for (let i = 0; i < object.community_pool.length; ++i) { - if (typeof object.community_pool[i] !== "object") - throw TypeError(".cosmos.distribution.v1beta1.FeePool.community_pool: object expected"); - message.community_pool[i] = $root.cosmos.base.v1beta1.DecCoin.fromObject(object.community_pool[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a FeePool message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.FeePool - * @static - * @param {cosmos.distribution.v1beta1.FeePool} message FeePool - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FeePool.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.community_pool = []; - if (message.community_pool && message.community_pool.length) { - object.community_pool = []; - for (let j = 0; j < message.community_pool.length; ++j) - object.community_pool[j] = $root.cosmos.base.v1beta1.DecCoin.toObject(message.community_pool[j], options); - } - return object; - }; - - /** - * Converts this FeePool to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.FeePool - * @instance - * @returns {Object.} JSON object - */ - FeePool.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return FeePool; - })(); - - v1beta1.CommunityPoolSpendProposal = (function() { - - /** - * Properties of a CommunityPoolSpendProposal. - * @memberof cosmos.distribution.v1beta1 - * @interface ICommunityPoolSpendProposal - * @property {string|null} [title] CommunityPoolSpendProposal title - * @property {string|null} [description] CommunityPoolSpendProposal description - * @property {string|null} [recipient] CommunityPoolSpendProposal recipient - * @property {Array.|null} [amount] CommunityPoolSpendProposal amount - */ - - /** - * Constructs a new CommunityPoolSpendProposal. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a CommunityPoolSpendProposal. - * @implements ICommunityPoolSpendProposal - * @constructor - * @param {cosmos.distribution.v1beta1.ICommunityPoolSpendProposal=} [properties] Properties to set - */ - function CommunityPoolSpendProposal(properties) { - this.amount = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * CommunityPoolSpendProposal title. - * @member {string} title - * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposal - * @instance - */ - CommunityPoolSpendProposal.prototype.title = ""; - - /** - * CommunityPoolSpendProposal description. - * @member {string} description - * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposal - * @instance - */ - CommunityPoolSpendProposal.prototype.description = ""; - - /** - * CommunityPoolSpendProposal recipient. - * @member {string} recipient - * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposal - * @instance - */ - CommunityPoolSpendProposal.prototype.recipient = ""; - - /** - * CommunityPoolSpendProposal amount. - * @member {Array.} amount - * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposal - * @instance - */ - CommunityPoolSpendProposal.prototype.amount = $util.emptyArray; - - /** - * Encodes the specified CommunityPoolSpendProposal message. Does not implicitly {@link cosmos.distribution.v1beta1.CommunityPoolSpendProposal.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposal - * @static - * @param {cosmos.distribution.v1beta1.ICommunityPoolSpendProposal} message CommunityPoolSpendProposal message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CommunityPoolSpendProposal.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.title != null && Object.hasOwnProperty.call(message, "title")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); - if (message.recipient != null && Object.hasOwnProperty.call(message, "recipient")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.recipient); - if (message.amount != null && message.amount.length) - for (let i = 0; i < message.amount.length; ++i) - $root.cosmos.base.v1beta1.Coin.encode(message.amount[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified CommunityPoolSpendProposal message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.CommunityPoolSpendProposal.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposal - * @static - * @param {cosmos.distribution.v1beta1.ICommunityPoolSpendProposal} message CommunityPoolSpendProposal message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CommunityPoolSpendProposal.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CommunityPoolSpendProposal message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposal - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.CommunityPoolSpendProposal} CommunityPoolSpendProposal - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CommunityPoolSpendProposal.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.CommunityPoolSpendProposal(); - while (reader.pos < end) { - let 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: - if (!(message.amount && message.amount.length)) - message.amount = []; - message.amount.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CommunityPoolSpendProposal message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposal - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.CommunityPoolSpendProposal} CommunityPoolSpendProposal - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CommunityPoolSpendProposal.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CommunityPoolSpendProposal message. - * @function verify - * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposal - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CommunityPoolSpendProposal.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.title != null && message.hasOwnProperty("title")) - if (!$util.isString(message.title)) - return "title: string expected"; - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - if (message.recipient != null && message.hasOwnProperty("recipient")) - if (!$util.isString(message.recipient)) - return "recipient: string expected"; - if (message.amount != null && message.hasOwnProperty("amount")) { - if (!Array.isArray(message.amount)) - return "amount: array expected"; - for (let i = 0; i < message.amount.length; ++i) { - let error = $root.cosmos.base.v1beta1.Coin.verify(message.amount[i]); - if (error) - return "amount." + error; - } - } - return null; - }; - - /** - * Creates a CommunityPoolSpendProposal message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposal - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.CommunityPoolSpendProposal} CommunityPoolSpendProposal - */ - CommunityPoolSpendProposal.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.CommunityPoolSpendProposal) - return object; - let message = new $root.cosmos.distribution.v1beta1.CommunityPoolSpendProposal(); - if (object.title != null) - message.title = String(object.title); - if (object.description != null) - message.description = String(object.description); - if (object.recipient != null) - message.recipient = String(object.recipient); - if (object.amount) { - if (!Array.isArray(object.amount)) - throw TypeError(".cosmos.distribution.v1beta1.CommunityPoolSpendProposal.amount: array expected"); - message.amount = []; - for (let i = 0; i < object.amount.length; ++i) { - if (typeof object.amount[i] !== "object") - throw TypeError(".cosmos.distribution.v1beta1.CommunityPoolSpendProposal.amount: object expected"); - message.amount[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.amount[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a CommunityPoolSpendProposal message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposal - * @static - * @param {cosmos.distribution.v1beta1.CommunityPoolSpendProposal} message CommunityPoolSpendProposal - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CommunityPoolSpendProposal.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.amount = []; - if (options.defaults) { - object.title = ""; - object.description = ""; - object.recipient = ""; - } - if (message.title != null && message.hasOwnProperty("title")) - object.title = message.title; - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - if (message.recipient != null && message.hasOwnProperty("recipient")) - object.recipient = message.recipient; - if (message.amount && message.amount.length) { - object.amount = []; - for (let j = 0; j < message.amount.length; ++j) - object.amount[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.amount[j], options); - } - return object; - }; - - /** - * Converts this CommunityPoolSpendProposal to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposal - * @instance - * @returns {Object.} JSON object - */ - CommunityPoolSpendProposal.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return CommunityPoolSpendProposal; - })(); - - v1beta1.DelegatorStartingInfo = (function() { - - /** - * Properties of a DelegatorStartingInfo. - * @memberof cosmos.distribution.v1beta1 - * @interface IDelegatorStartingInfo - * @property {Long|null} [previous_period] DelegatorStartingInfo previous_period - * @property {string|null} [stake] DelegatorStartingInfo stake - * @property {Long|null} [height] DelegatorStartingInfo height - */ - - /** - * Constructs a new DelegatorStartingInfo. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a DelegatorStartingInfo. - * @implements IDelegatorStartingInfo - * @constructor - * @param {cosmos.distribution.v1beta1.IDelegatorStartingInfo=} [properties] Properties to set - */ - function DelegatorStartingInfo(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DelegatorStartingInfo previous_period. - * @member {Long} previous_period - * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfo - * @instance - */ - DelegatorStartingInfo.prototype.previous_period = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * DelegatorStartingInfo stake. - * @member {string} stake - * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfo - * @instance - */ - DelegatorStartingInfo.prototype.stake = ""; - - /** - * DelegatorStartingInfo height. - * @member {Long} height - * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfo - * @instance - */ - DelegatorStartingInfo.prototype.height = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified DelegatorStartingInfo message. Does not implicitly {@link cosmos.distribution.v1beta1.DelegatorStartingInfo.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfo - * @static - * @param {cosmos.distribution.v1beta1.IDelegatorStartingInfo} message DelegatorStartingInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DelegatorStartingInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.previous_period != null && Object.hasOwnProperty.call(message, "previous_period")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.previous_period); - if (message.stake != null && Object.hasOwnProperty.call(message, "stake")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.stake); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.height); - return writer; - }; - - /** - * Encodes the specified DelegatorStartingInfo message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.DelegatorStartingInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfo - * @static - * @param {cosmos.distribution.v1beta1.IDelegatorStartingInfo} message DelegatorStartingInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DelegatorStartingInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DelegatorStartingInfo message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.DelegatorStartingInfo} DelegatorStartingInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DelegatorStartingInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.DelegatorStartingInfo(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.previous_period = reader.uint64(); - break; - case 2: - message.stake = reader.string(); - break; - case 3: - message.height = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DelegatorStartingInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.DelegatorStartingInfo} DelegatorStartingInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DelegatorStartingInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DelegatorStartingInfo message. - * @function verify - * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DelegatorStartingInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.previous_period != null && message.hasOwnProperty("previous_period")) - if (!$util.isInteger(message.previous_period) && !(message.previous_period && $util.isInteger(message.previous_period.low) && $util.isInteger(message.previous_period.high))) - return "previous_period: integer|Long expected"; - if (message.stake != null && message.hasOwnProperty("stake")) - if (!$util.isString(message.stake)) - return "stake: string expected"; - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) - return "height: integer|Long expected"; - return null; - }; - - /** - * Creates a DelegatorStartingInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfo - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.DelegatorStartingInfo} DelegatorStartingInfo - */ - DelegatorStartingInfo.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.DelegatorStartingInfo) - return object; - let message = new $root.cosmos.distribution.v1beta1.DelegatorStartingInfo(); - if (object.previous_period != null) - if ($util.Long) - (message.previous_period = $util.Long.fromValue(object.previous_period)).unsigned = true; - else if (typeof object.previous_period === "string") - message.previous_period = parseInt(object.previous_period, 10); - else if (typeof object.previous_period === "number") - message.previous_period = object.previous_period; - else if (typeof object.previous_period === "object") - message.previous_period = new $util.LongBits(object.previous_period.low >>> 0, object.previous_period.high >>> 0).toNumber(true); - if (object.stake != null) - message.stake = String(object.stake); - if (object.height != null) - if ($util.Long) - (message.height = $util.Long.fromValue(object.height)).unsigned = true; - else if (typeof object.height === "string") - message.height = parseInt(object.height, 10); - else if (typeof object.height === "number") - message.height = object.height; - else if (typeof object.height === "object") - message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a DelegatorStartingInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfo - * @static - * @param {cosmos.distribution.v1beta1.DelegatorStartingInfo} message DelegatorStartingInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DelegatorStartingInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.previous_period = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.previous_period = options.longs === String ? "0" : 0; - object.stake = ""; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.height = options.longs === String ? "0" : 0; - } - if (message.previous_period != null && message.hasOwnProperty("previous_period")) - if (typeof message.previous_period === "number") - object.previous_period = options.longs === String ? String(message.previous_period) : message.previous_period; - else - object.previous_period = options.longs === String ? $util.Long.prototype.toString.call(message.previous_period) : options.longs === Number ? new $util.LongBits(message.previous_period.low >>> 0, message.previous_period.high >>> 0).toNumber(true) : message.previous_period; - if (message.stake != null && message.hasOwnProperty("stake")) - object.stake = message.stake; - if (message.height != null && message.hasOwnProperty("height")) - if (typeof message.height === "number") - object.height = options.longs === String ? String(message.height) : message.height; - else - object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber(true) : message.height; - return object; - }; - - /** - * Converts this DelegatorStartingInfo to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfo - * @instance - * @returns {Object.} JSON object - */ - DelegatorStartingInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return DelegatorStartingInfo; - })(); - - v1beta1.DelegationDelegatorReward = (function() { - - /** - * Properties of a DelegationDelegatorReward. - * @memberof cosmos.distribution.v1beta1 - * @interface IDelegationDelegatorReward - * @property {string|null} [validator_address] DelegationDelegatorReward validator_address - * @property {Array.|null} [reward] DelegationDelegatorReward reward - */ - - /** - * Constructs a new DelegationDelegatorReward. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a DelegationDelegatorReward. - * @implements IDelegationDelegatorReward - * @constructor - * @param {cosmos.distribution.v1beta1.IDelegationDelegatorReward=} [properties] Properties to set - */ - function DelegationDelegatorReward(properties) { - this.reward = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DelegationDelegatorReward validator_address. - * @member {string} validator_address - * @memberof cosmos.distribution.v1beta1.DelegationDelegatorReward - * @instance - */ - DelegationDelegatorReward.prototype.validator_address = ""; - - /** - * DelegationDelegatorReward reward. - * @member {Array.} reward - * @memberof cosmos.distribution.v1beta1.DelegationDelegatorReward - * @instance - */ - DelegationDelegatorReward.prototype.reward = $util.emptyArray; - - /** - * Encodes the specified DelegationDelegatorReward message. Does not implicitly {@link cosmos.distribution.v1beta1.DelegationDelegatorReward.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.DelegationDelegatorReward - * @static - * @param {cosmos.distribution.v1beta1.IDelegationDelegatorReward} message DelegationDelegatorReward message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DelegationDelegatorReward.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.validator_address); - if (message.reward != null && message.reward.length) - for (let i = 0; i < message.reward.length; ++i) - $root.cosmos.base.v1beta1.DecCoin.encode(message.reward[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified DelegationDelegatorReward message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.DelegationDelegatorReward.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.DelegationDelegatorReward - * @static - * @param {cosmos.distribution.v1beta1.IDelegationDelegatorReward} message DelegationDelegatorReward message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DelegationDelegatorReward.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DelegationDelegatorReward message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.DelegationDelegatorReward - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.DelegationDelegatorReward} DelegationDelegatorReward - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DelegationDelegatorReward.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.DelegationDelegatorReward(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.validator_address = reader.string(); - break; - case 2: - if (!(message.reward && message.reward.length)) - message.reward = []; - message.reward.push($root.cosmos.base.v1beta1.DecCoin.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DelegationDelegatorReward message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.DelegationDelegatorReward - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.DelegationDelegatorReward} DelegationDelegatorReward - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DelegationDelegatorReward.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DelegationDelegatorReward message. - * @function verify - * @memberof cosmos.distribution.v1beta1.DelegationDelegatorReward - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DelegationDelegatorReward.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - if (!$util.isString(message.validator_address)) - return "validator_address: string expected"; - if (message.reward != null && message.hasOwnProperty("reward")) { - if (!Array.isArray(message.reward)) - return "reward: array expected"; - for (let i = 0; i < message.reward.length; ++i) { - let error = $root.cosmos.base.v1beta1.DecCoin.verify(message.reward[i]); - if (error) - return "reward." + error; - } - } - return null; - }; - - /** - * Creates a DelegationDelegatorReward message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.DelegationDelegatorReward - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.DelegationDelegatorReward} DelegationDelegatorReward - */ - DelegationDelegatorReward.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.DelegationDelegatorReward) - return object; - let message = new $root.cosmos.distribution.v1beta1.DelegationDelegatorReward(); - if (object.validator_address != null) - message.validator_address = String(object.validator_address); - if (object.reward) { - if (!Array.isArray(object.reward)) - throw TypeError(".cosmos.distribution.v1beta1.DelegationDelegatorReward.reward: array expected"); - message.reward = []; - for (let i = 0; i < object.reward.length; ++i) { - if (typeof object.reward[i] !== "object") - throw TypeError(".cosmos.distribution.v1beta1.DelegationDelegatorReward.reward: object expected"); - message.reward[i] = $root.cosmos.base.v1beta1.DecCoin.fromObject(object.reward[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a DelegationDelegatorReward message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.DelegationDelegatorReward - * @static - * @param {cosmos.distribution.v1beta1.DelegationDelegatorReward} message DelegationDelegatorReward - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DelegationDelegatorReward.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.reward = []; - if (options.defaults) - object.validator_address = ""; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - object.validator_address = message.validator_address; - if (message.reward && message.reward.length) { - object.reward = []; - for (let j = 0; j < message.reward.length; ++j) - object.reward[j] = $root.cosmos.base.v1beta1.DecCoin.toObject(message.reward[j], options); - } - return object; - }; - - /** - * Converts this DelegationDelegatorReward to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.DelegationDelegatorReward - * @instance - * @returns {Object.} JSON object - */ - DelegationDelegatorReward.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return DelegationDelegatorReward; - })(); - - v1beta1.CommunityPoolSpendProposalWithDeposit = (function() { - - /** - * Properties of a CommunityPoolSpendProposalWithDeposit. - * @memberof cosmos.distribution.v1beta1 - * @interface ICommunityPoolSpendProposalWithDeposit - * @property {string|null} [title] CommunityPoolSpendProposalWithDeposit title - * @property {string|null} [description] CommunityPoolSpendProposalWithDeposit description - * @property {string|null} [recipient] CommunityPoolSpendProposalWithDeposit recipient - * @property {string|null} [amount] CommunityPoolSpendProposalWithDeposit amount - * @property {string|null} [deposit] CommunityPoolSpendProposalWithDeposit deposit - */ - - /** - * Constructs a new CommunityPoolSpendProposalWithDeposit. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a CommunityPoolSpendProposalWithDeposit. - * @implements ICommunityPoolSpendProposalWithDeposit - * @constructor - * @param {cosmos.distribution.v1beta1.ICommunityPoolSpendProposalWithDeposit=} [properties] Properties to set - */ - function CommunityPoolSpendProposalWithDeposit(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * CommunityPoolSpendProposalWithDeposit title. - * @member {string} title - * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit - * @instance - */ - CommunityPoolSpendProposalWithDeposit.prototype.title = ""; - - /** - * CommunityPoolSpendProposalWithDeposit description. - * @member {string} description - * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit - * @instance - */ - CommunityPoolSpendProposalWithDeposit.prototype.description = ""; - - /** - * CommunityPoolSpendProposalWithDeposit recipient. - * @member {string} recipient - * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit - * @instance - */ - CommunityPoolSpendProposalWithDeposit.prototype.recipient = ""; - - /** - * CommunityPoolSpendProposalWithDeposit amount. - * @member {string} amount - * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit - * @instance - */ - CommunityPoolSpendProposalWithDeposit.prototype.amount = ""; - - /** - * CommunityPoolSpendProposalWithDeposit deposit. - * @member {string} deposit - * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit - * @instance - */ - CommunityPoolSpendProposalWithDeposit.prototype.deposit = ""; - - /** - * Encodes the specified CommunityPoolSpendProposalWithDeposit message. Does not implicitly {@link cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit - * @static - * @param {cosmos.distribution.v1beta1.ICommunityPoolSpendProposalWithDeposit} message CommunityPoolSpendProposalWithDeposit message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CommunityPoolSpendProposalWithDeposit.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.title != null && Object.hasOwnProperty.call(message, "title")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); - if (message.recipient != null && Object.hasOwnProperty.call(message, "recipient")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.recipient); - if (message.amount != null && Object.hasOwnProperty.call(message, "amount")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.amount); - if (message.deposit != null && Object.hasOwnProperty.call(message, "deposit")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.deposit); - return writer; - }; - - /** - * Encodes the specified CommunityPoolSpendProposalWithDeposit message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit - * @static - * @param {cosmos.distribution.v1beta1.ICommunityPoolSpendProposalWithDeposit} message CommunityPoolSpendProposalWithDeposit message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CommunityPoolSpendProposalWithDeposit.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CommunityPoolSpendProposalWithDeposit message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit} CommunityPoolSpendProposalWithDeposit - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CommunityPoolSpendProposalWithDeposit.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit(); - while (reader.pos < end) { - let 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; - }; - - /** - * Decodes a CommunityPoolSpendProposalWithDeposit message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit} CommunityPoolSpendProposalWithDeposit - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CommunityPoolSpendProposalWithDeposit.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CommunityPoolSpendProposalWithDeposit message. - * @function verify - * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CommunityPoolSpendProposalWithDeposit.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.title != null && message.hasOwnProperty("title")) - if (!$util.isString(message.title)) - return "title: string expected"; - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - if (message.recipient != null && message.hasOwnProperty("recipient")) - if (!$util.isString(message.recipient)) - return "recipient: string expected"; - if (message.amount != null && message.hasOwnProperty("amount")) - if (!$util.isString(message.amount)) - return "amount: string expected"; - if (message.deposit != null && message.hasOwnProperty("deposit")) - if (!$util.isString(message.deposit)) - return "deposit: string expected"; - return null; - }; - - /** - * Creates a CommunityPoolSpendProposalWithDeposit message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit} CommunityPoolSpendProposalWithDeposit - */ - CommunityPoolSpendProposalWithDeposit.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit) - return object; - let message = new $root.cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit(); - if (object.title != null) - message.title = String(object.title); - if (object.description != null) - message.description = String(object.description); - if (object.recipient != null) - message.recipient = String(object.recipient); - if (object.amount != null) - message.amount = String(object.amount); - if (object.deposit != null) - message.deposit = String(object.deposit); - return message; - }; - - /** - * Creates a plain object from a CommunityPoolSpendProposalWithDeposit message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit - * @static - * @param {cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit} message CommunityPoolSpendProposalWithDeposit - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CommunityPoolSpendProposalWithDeposit.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.title = ""; - object.description = ""; - object.recipient = ""; - object.amount = ""; - object.deposit = ""; - } - if (message.title != null && message.hasOwnProperty("title")) - object.title = message.title; - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - if (message.recipient != null && message.hasOwnProperty("recipient")) - object.recipient = message.recipient; - if (message.amount != null && message.hasOwnProperty("amount")) - object.amount = message.amount; - if (message.deposit != null && message.hasOwnProperty("deposit")) - object.deposit = message.deposit; - return object; - }; - - /** - * Converts this CommunityPoolSpendProposalWithDeposit to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit - * @instance - * @returns {Object.} JSON object - */ - CommunityPoolSpendProposalWithDeposit.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return CommunityPoolSpendProposalWithDeposit; - })(); - - v1beta1.Query = (function() { - - /** - * Constructs a new Query service. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a Query - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function Query(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Query.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Query; - - /** - * Callback as used by {@link cosmos.distribution.v1beta1.Query#params}. - * @memberof cosmos.distribution.v1beta1.Query - * @typedef ParamsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.distribution.v1beta1.QueryParamsResponse} [response] QueryParamsResponse - */ - - /** - * Calls Params. - * @function params - * @memberof cosmos.distribution.v1beta1.Query - * @instance - * @param {cosmos.distribution.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object - * @param {cosmos.distribution.v1beta1.Query.ParamsCallback} callback Node-style callback called with the error, if any, and QueryParamsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.params = function params(request, callback) { - return this.rpcCall(params, $root.cosmos.distribution.v1beta1.QueryParamsRequest, $root.cosmos.distribution.v1beta1.QueryParamsResponse, request, callback); - }, "name", { value: "Params" }); - - /** - * Calls Params. - * @function params - * @memberof cosmos.distribution.v1beta1.Query - * @instance - * @param {cosmos.distribution.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.distribution.v1beta1.Query#validatorOutstandingRewards}. - * @memberof cosmos.distribution.v1beta1.Query - * @typedef ValidatorOutstandingRewardsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse} [response] QueryValidatorOutstandingRewardsResponse - */ - - /** - * Calls ValidatorOutstandingRewards. - * @function validatorOutstandingRewards - * @memberof cosmos.distribution.v1beta1.Query - * @instance - * @param {cosmos.distribution.v1beta1.IQueryValidatorOutstandingRewardsRequest} request QueryValidatorOutstandingRewardsRequest message or plain object - * @param {cosmos.distribution.v1beta1.Query.ValidatorOutstandingRewardsCallback} callback Node-style callback called with the error, if any, and QueryValidatorOutstandingRewardsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.validatorOutstandingRewards = function validatorOutstandingRewards(request, callback) { - return this.rpcCall(validatorOutstandingRewards, $root.cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest, $root.cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse, request, callback); - }, "name", { value: "ValidatorOutstandingRewards" }); - - /** - * Calls ValidatorOutstandingRewards. - * @function validatorOutstandingRewards - * @memberof cosmos.distribution.v1beta1.Query - * @instance - * @param {cosmos.distribution.v1beta1.IQueryValidatorOutstandingRewardsRequest} request QueryValidatorOutstandingRewardsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.distribution.v1beta1.Query#validatorCommission}. - * @memberof cosmos.distribution.v1beta1.Query - * @typedef ValidatorCommissionCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.distribution.v1beta1.QueryValidatorCommissionResponse} [response] QueryValidatorCommissionResponse - */ - - /** - * Calls ValidatorCommission. - * @function validatorCommission - * @memberof cosmos.distribution.v1beta1.Query - * @instance - * @param {cosmos.distribution.v1beta1.IQueryValidatorCommissionRequest} request QueryValidatorCommissionRequest message or plain object - * @param {cosmos.distribution.v1beta1.Query.ValidatorCommissionCallback} callback Node-style callback called with the error, if any, and QueryValidatorCommissionResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.validatorCommission = function validatorCommission(request, callback) { - return this.rpcCall(validatorCommission, $root.cosmos.distribution.v1beta1.QueryValidatorCommissionRequest, $root.cosmos.distribution.v1beta1.QueryValidatorCommissionResponse, request, callback); - }, "name", { value: "ValidatorCommission" }); - - /** - * Calls ValidatorCommission. - * @function validatorCommission - * @memberof cosmos.distribution.v1beta1.Query - * @instance - * @param {cosmos.distribution.v1beta1.IQueryValidatorCommissionRequest} request QueryValidatorCommissionRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.distribution.v1beta1.Query#validatorSlashes}. - * @memberof cosmos.distribution.v1beta1.Query - * @typedef ValidatorSlashesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.distribution.v1beta1.QueryValidatorSlashesResponse} [response] QueryValidatorSlashesResponse - */ - - /** - * Calls ValidatorSlashes. - * @function validatorSlashes - * @memberof cosmos.distribution.v1beta1.Query - * @instance - * @param {cosmos.distribution.v1beta1.IQueryValidatorSlashesRequest} request QueryValidatorSlashesRequest message or plain object - * @param {cosmos.distribution.v1beta1.Query.ValidatorSlashesCallback} callback Node-style callback called with the error, if any, and QueryValidatorSlashesResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.validatorSlashes = function validatorSlashes(request, callback) { - return this.rpcCall(validatorSlashes, $root.cosmos.distribution.v1beta1.QueryValidatorSlashesRequest, $root.cosmos.distribution.v1beta1.QueryValidatorSlashesResponse, request, callback); - }, "name", { value: "ValidatorSlashes" }); - - /** - * Calls ValidatorSlashes. - * @function validatorSlashes - * @memberof cosmos.distribution.v1beta1.Query - * @instance - * @param {cosmos.distribution.v1beta1.IQueryValidatorSlashesRequest} request QueryValidatorSlashesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.distribution.v1beta1.Query#delegationRewards}. - * @memberof cosmos.distribution.v1beta1.Query - * @typedef DelegationRewardsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.distribution.v1beta1.QueryDelegationRewardsResponse} [response] QueryDelegationRewardsResponse - */ - - /** - * Calls DelegationRewards. - * @function delegationRewards - * @memberof cosmos.distribution.v1beta1.Query - * @instance - * @param {cosmos.distribution.v1beta1.IQueryDelegationRewardsRequest} request QueryDelegationRewardsRequest message or plain object - * @param {cosmos.distribution.v1beta1.Query.DelegationRewardsCallback} callback Node-style callback called with the error, if any, and QueryDelegationRewardsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.delegationRewards = function delegationRewards(request, callback) { - return this.rpcCall(delegationRewards, $root.cosmos.distribution.v1beta1.QueryDelegationRewardsRequest, $root.cosmos.distribution.v1beta1.QueryDelegationRewardsResponse, request, callback); - }, "name", { value: "DelegationRewards" }); - - /** - * Calls DelegationRewards. - * @function delegationRewards - * @memberof cosmos.distribution.v1beta1.Query - * @instance - * @param {cosmos.distribution.v1beta1.IQueryDelegationRewardsRequest} request QueryDelegationRewardsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.distribution.v1beta1.Query#delegationTotalRewards}. - * @memberof cosmos.distribution.v1beta1.Query - * @typedef DelegationTotalRewardsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse} [response] QueryDelegationTotalRewardsResponse - */ - - /** - * Calls DelegationTotalRewards. - * @function delegationTotalRewards - * @memberof cosmos.distribution.v1beta1.Query - * @instance - * @param {cosmos.distribution.v1beta1.IQueryDelegationTotalRewardsRequest} request QueryDelegationTotalRewardsRequest message or plain object - * @param {cosmos.distribution.v1beta1.Query.DelegationTotalRewardsCallback} callback Node-style callback called with the error, if any, and QueryDelegationTotalRewardsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.delegationTotalRewards = function delegationTotalRewards(request, callback) { - return this.rpcCall(delegationTotalRewards, $root.cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest, $root.cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse, request, callback); - }, "name", { value: "DelegationTotalRewards" }); - - /** - * Calls DelegationTotalRewards. - * @function delegationTotalRewards - * @memberof cosmos.distribution.v1beta1.Query - * @instance - * @param {cosmos.distribution.v1beta1.IQueryDelegationTotalRewardsRequest} request QueryDelegationTotalRewardsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.distribution.v1beta1.Query#delegatorValidators}. - * @memberof cosmos.distribution.v1beta1.Query - * @typedef DelegatorValidatorsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse} [response] QueryDelegatorValidatorsResponse - */ - - /** - * Calls DelegatorValidators. - * @function delegatorValidators - * @memberof cosmos.distribution.v1beta1.Query - * @instance - * @param {cosmos.distribution.v1beta1.IQueryDelegatorValidatorsRequest} request QueryDelegatorValidatorsRequest message or plain object - * @param {cosmos.distribution.v1beta1.Query.DelegatorValidatorsCallback} callback Node-style callback called with the error, if any, and QueryDelegatorValidatorsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.delegatorValidators = function delegatorValidators(request, callback) { - return this.rpcCall(delegatorValidators, $root.cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest, $root.cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse, request, callback); - }, "name", { value: "DelegatorValidators" }); - - /** - * Calls DelegatorValidators. - * @function delegatorValidators - * @memberof cosmos.distribution.v1beta1.Query - * @instance - * @param {cosmos.distribution.v1beta1.IQueryDelegatorValidatorsRequest} request QueryDelegatorValidatorsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.distribution.v1beta1.Query#delegatorWithdrawAddress}. - * @memberof cosmos.distribution.v1beta1.Query - * @typedef DelegatorWithdrawAddressCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse} [response] QueryDelegatorWithdrawAddressResponse - */ - - /** - * Calls DelegatorWithdrawAddress. - * @function delegatorWithdrawAddress - * @memberof cosmos.distribution.v1beta1.Query - * @instance - * @param {cosmos.distribution.v1beta1.IQueryDelegatorWithdrawAddressRequest} request QueryDelegatorWithdrawAddressRequest message or plain object - * @param {cosmos.distribution.v1beta1.Query.DelegatorWithdrawAddressCallback} callback Node-style callback called with the error, if any, and QueryDelegatorWithdrawAddressResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.delegatorWithdrawAddress = function delegatorWithdrawAddress(request, callback) { - return this.rpcCall(delegatorWithdrawAddress, $root.cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest, $root.cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse, request, callback); - }, "name", { value: "DelegatorWithdrawAddress" }); - - /** - * Calls DelegatorWithdrawAddress. - * @function delegatorWithdrawAddress - * @memberof cosmos.distribution.v1beta1.Query - * @instance - * @param {cosmos.distribution.v1beta1.IQueryDelegatorWithdrawAddressRequest} request QueryDelegatorWithdrawAddressRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.distribution.v1beta1.Query#communityPool}. - * @memberof cosmos.distribution.v1beta1.Query - * @typedef CommunityPoolCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.distribution.v1beta1.QueryCommunityPoolResponse} [response] QueryCommunityPoolResponse - */ - - /** - * Calls CommunityPool. - * @function communityPool - * @memberof cosmos.distribution.v1beta1.Query - * @instance - * @param {cosmos.distribution.v1beta1.IQueryCommunityPoolRequest} request QueryCommunityPoolRequest message or plain object - * @param {cosmos.distribution.v1beta1.Query.CommunityPoolCallback} callback Node-style callback called with the error, if any, and QueryCommunityPoolResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.communityPool = function communityPool(request, callback) { - return this.rpcCall(communityPool, $root.cosmos.distribution.v1beta1.QueryCommunityPoolRequest, $root.cosmos.distribution.v1beta1.QueryCommunityPoolResponse, request, callback); - }, "name", { value: "CommunityPool" }); - - /** - * Calls CommunityPool. - * @function communityPool - * @memberof cosmos.distribution.v1beta1.Query - * @instance - * @param {cosmos.distribution.v1beta1.IQueryCommunityPoolRequest} request QueryCommunityPoolRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return Query; - })(); - - v1beta1.QueryParamsRequest = (function() { - - /** - * Properties of a QueryParamsRequest. - * @memberof cosmos.distribution.v1beta1 - * @interface IQueryParamsRequest - */ - - /** - * Constructs a new QueryParamsRequest. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a QueryParamsRequest. - * @implements IQueryParamsRequest - * @constructor - * @param {cosmos.distribution.v1beta1.IQueryParamsRequest=} [properties] Properties to set - */ - function QueryParamsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified QueryParamsRequest message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryParamsRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.QueryParamsRequest - * @static - * @param {cosmos.distribution.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified QueryParamsRequest message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryParamsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryParamsRequest - * @static - * @param {cosmos.distribution.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryParamsRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.QueryParamsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.QueryParamsRequest} QueryParamsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryParamsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryParamsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryParamsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.QueryParamsRequest} QueryParamsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryParamsRequest message. - * @function verify - * @memberof cosmos.distribution.v1beta1.QueryParamsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryParamsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a QueryParamsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.QueryParamsRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.QueryParamsRequest} QueryParamsRequest - */ - QueryParamsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.QueryParamsRequest) - return object; - return new $root.cosmos.distribution.v1beta1.QueryParamsRequest(); - }; - - /** - * Creates a plain object from a QueryParamsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.QueryParamsRequest - * @static - * @param {cosmos.distribution.v1beta1.QueryParamsRequest} message QueryParamsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryParamsRequest.toObject = function toObject() { - return {}; - }; - - /** - * Converts this QueryParamsRequest to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.QueryParamsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryParamsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryParamsRequest; - })(); - - v1beta1.QueryParamsResponse = (function() { - - /** - * Properties of a QueryParamsResponse. - * @memberof cosmos.distribution.v1beta1 - * @interface IQueryParamsResponse - * @property {cosmos.distribution.v1beta1.IParams|null} [params] QueryParamsResponse params - */ - - /** - * Constructs a new QueryParamsResponse. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a QueryParamsResponse. - * @implements IQueryParamsResponse - * @constructor - * @param {cosmos.distribution.v1beta1.IQueryParamsResponse=} [properties] Properties to set - */ - function QueryParamsResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryParamsResponse params. - * @member {cosmos.distribution.v1beta1.IParams|null|undefined} params - * @memberof cosmos.distribution.v1beta1.QueryParamsResponse - * @instance - */ - QueryParamsResponse.prototype.params = null; - - /** - * Encodes the specified QueryParamsResponse message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryParamsResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.QueryParamsResponse - * @static - * @param {cosmos.distribution.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.params != null && Object.hasOwnProperty.call(message, "params")) - $root.cosmos.distribution.v1beta1.Params.encode(message.params, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryParamsResponse message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryParamsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryParamsResponse - * @static - * @param {cosmos.distribution.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryParamsResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.QueryParamsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.QueryParamsResponse} QueryParamsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryParamsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.params = $root.cosmos.distribution.v1beta1.Params.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryParamsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryParamsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.QueryParamsResponse} QueryParamsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryParamsResponse message. - * @function verify - * @memberof cosmos.distribution.v1beta1.QueryParamsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryParamsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.params != null && message.hasOwnProperty("params")) { - let error = $root.cosmos.distribution.v1beta1.Params.verify(message.params); - if (error) - return "params." + error; - } - return null; - }; - - /** - * Creates a QueryParamsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.QueryParamsResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.QueryParamsResponse} QueryParamsResponse - */ - QueryParamsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.QueryParamsResponse) - return object; - let message = new $root.cosmos.distribution.v1beta1.QueryParamsResponse(); - if (object.params != null) { - if (typeof object.params !== "object") - throw TypeError(".cosmos.distribution.v1beta1.QueryParamsResponse.params: object expected"); - message.params = $root.cosmos.distribution.v1beta1.Params.fromObject(object.params); - } - return message; - }; - - /** - * Creates a plain object from a QueryParamsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.QueryParamsResponse - * @static - * @param {cosmos.distribution.v1beta1.QueryParamsResponse} message QueryParamsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryParamsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.params = null; - if (message.params != null && message.hasOwnProperty("params")) - object.params = $root.cosmos.distribution.v1beta1.Params.toObject(message.params, options); - return object; - }; - - /** - * Converts this QueryParamsResponse to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.QueryParamsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryParamsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryParamsResponse; - })(); - - v1beta1.QueryValidatorOutstandingRewardsRequest = (function() { - - /** - * Properties of a QueryValidatorOutstandingRewardsRequest. - * @memberof cosmos.distribution.v1beta1 - * @interface IQueryValidatorOutstandingRewardsRequest - * @property {string|null} [validator_address] QueryValidatorOutstandingRewardsRequest validator_address - */ - - /** - * Constructs a new QueryValidatorOutstandingRewardsRequest. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a QueryValidatorOutstandingRewardsRequest. - * @implements IQueryValidatorOutstandingRewardsRequest - * @constructor - * @param {cosmos.distribution.v1beta1.IQueryValidatorOutstandingRewardsRequest=} [properties] Properties to set - */ - function QueryValidatorOutstandingRewardsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryValidatorOutstandingRewardsRequest validator_address. - * @member {string} validator_address - * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest - * @instance - */ - QueryValidatorOutstandingRewardsRequest.prototype.validator_address = ""; - - /** - * Encodes the specified QueryValidatorOutstandingRewardsRequest message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest - * @static - * @param {cosmos.distribution.v1beta1.IQueryValidatorOutstandingRewardsRequest} message QueryValidatorOutstandingRewardsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryValidatorOutstandingRewardsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.validator_address); - return writer; - }; - - /** - * Encodes the specified QueryValidatorOutstandingRewardsRequest message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest - * @static - * @param {cosmos.distribution.v1beta1.IQueryValidatorOutstandingRewardsRequest} message QueryValidatorOutstandingRewardsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryValidatorOutstandingRewardsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryValidatorOutstandingRewardsRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest} QueryValidatorOutstandingRewardsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryValidatorOutstandingRewardsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.validator_address = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryValidatorOutstandingRewardsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest} QueryValidatorOutstandingRewardsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryValidatorOutstandingRewardsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryValidatorOutstandingRewardsRequest message. - * @function verify - * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryValidatorOutstandingRewardsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - if (!$util.isString(message.validator_address)) - return "validator_address: string expected"; - return null; - }; - - /** - * Creates a QueryValidatorOutstandingRewardsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest} QueryValidatorOutstandingRewardsRequest - */ - QueryValidatorOutstandingRewardsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest) - return object; - let message = new $root.cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest(); - if (object.validator_address != null) - message.validator_address = String(object.validator_address); - return message; - }; - - /** - * Creates a plain object from a QueryValidatorOutstandingRewardsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest - * @static - * @param {cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest} message QueryValidatorOutstandingRewardsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryValidatorOutstandingRewardsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.validator_address = ""; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - object.validator_address = message.validator_address; - return object; - }; - - /** - * Converts this QueryValidatorOutstandingRewardsRequest to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryValidatorOutstandingRewardsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryValidatorOutstandingRewardsRequest; - })(); - - v1beta1.QueryValidatorOutstandingRewardsResponse = (function() { - - /** - * Properties of a QueryValidatorOutstandingRewardsResponse. - * @memberof cosmos.distribution.v1beta1 - * @interface IQueryValidatorOutstandingRewardsResponse - * @property {cosmos.distribution.v1beta1.IValidatorOutstandingRewards|null} [rewards] QueryValidatorOutstandingRewardsResponse rewards - */ - - /** - * Constructs a new QueryValidatorOutstandingRewardsResponse. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a QueryValidatorOutstandingRewardsResponse. - * @implements IQueryValidatorOutstandingRewardsResponse - * @constructor - * @param {cosmos.distribution.v1beta1.IQueryValidatorOutstandingRewardsResponse=} [properties] Properties to set - */ - function QueryValidatorOutstandingRewardsResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryValidatorOutstandingRewardsResponse rewards. - * @member {cosmos.distribution.v1beta1.IValidatorOutstandingRewards|null|undefined} rewards - * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse - * @instance - */ - QueryValidatorOutstandingRewardsResponse.prototype.rewards = null; - - /** - * Encodes the specified QueryValidatorOutstandingRewardsResponse message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse - * @static - * @param {cosmos.distribution.v1beta1.IQueryValidatorOutstandingRewardsResponse} message QueryValidatorOutstandingRewardsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryValidatorOutstandingRewardsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.rewards != null && Object.hasOwnProperty.call(message, "rewards")) - $root.cosmos.distribution.v1beta1.ValidatorOutstandingRewards.encode(message.rewards, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryValidatorOutstandingRewardsResponse message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse - * @static - * @param {cosmos.distribution.v1beta1.IQueryValidatorOutstandingRewardsResponse} message QueryValidatorOutstandingRewardsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryValidatorOutstandingRewardsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryValidatorOutstandingRewardsResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse} QueryValidatorOutstandingRewardsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryValidatorOutstandingRewardsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.rewards = $root.cosmos.distribution.v1beta1.ValidatorOutstandingRewards.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryValidatorOutstandingRewardsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse} QueryValidatorOutstandingRewardsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryValidatorOutstandingRewardsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryValidatorOutstandingRewardsResponse message. - * @function verify - * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryValidatorOutstandingRewardsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.rewards != null && message.hasOwnProperty("rewards")) { - let error = $root.cosmos.distribution.v1beta1.ValidatorOutstandingRewards.verify(message.rewards); - if (error) - return "rewards." + error; - } - return null; - }; - - /** - * Creates a QueryValidatorOutstandingRewardsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse} QueryValidatorOutstandingRewardsResponse - */ - QueryValidatorOutstandingRewardsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse) - return object; - let message = new $root.cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse(); - if (object.rewards != null) { - if (typeof object.rewards !== "object") - throw TypeError(".cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse.rewards: object expected"); - message.rewards = $root.cosmos.distribution.v1beta1.ValidatorOutstandingRewards.fromObject(object.rewards); - } - return message; - }; - - /** - * Creates a plain object from a QueryValidatorOutstandingRewardsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse - * @static - * @param {cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse} message QueryValidatorOutstandingRewardsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryValidatorOutstandingRewardsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.rewards = null; - if (message.rewards != null && message.hasOwnProperty("rewards")) - object.rewards = $root.cosmos.distribution.v1beta1.ValidatorOutstandingRewards.toObject(message.rewards, options); - return object; - }; - - /** - * Converts this QueryValidatorOutstandingRewardsResponse to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryValidatorOutstandingRewardsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryValidatorOutstandingRewardsResponse; - })(); - - v1beta1.QueryValidatorCommissionRequest = (function() { - - /** - * Properties of a QueryValidatorCommissionRequest. - * @memberof cosmos.distribution.v1beta1 - * @interface IQueryValidatorCommissionRequest - * @property {string|null} [validator_address] QueryValidatorCommissionRequest validator_address - */ - - /** - * Constructs a new QueryValidatorCommissionRequest. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a QueryValidatorCommissionRequest. - * @implements IQueryValidatorCommissionRequest - * @constructor - * @param {cosmos.distribution.v1beta1.IQueryValidatorCommissionRequest=} [properties] Properties to set - */ - function QueryValidatorCommissionRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryValidatorCommissionRequest validator_address. - * @member {string} validator_address - * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionRequest - * @instance - */ - QueryValidatorCommissionRequest.prototype.validator_address = ""; - - /** - * Encodes the specified QueryValidatorCommissionRequest message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryValidatorCommissionRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionRequest - * @static - * @param {cosmos.distribution.v1beta1.IQueryValidatorCommissionRequest} message QueryValidatorCommissionRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryValidatorCommissionRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.validator_address); - return writer; - }; - - /** - * Encodes the specified QueryValidatorCommissionRequest message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryValidatorCommissionRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionRequest - * @static - * @param {cosmos.distribution.v1beta1.IQueryValidatorCommissionRequest} message QueryValidatorCommissionRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryValidatorCommissionRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryValidatorCommissionRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.QueryValidatorCommissionRequest} QueryValidatorCommissionRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryValidatorCommissionRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryValidatorCommissionRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.validator_address = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryValidatorCommissionRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.QueryValidatorCommissionRequest} QueryValidatorCommissionRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryValidatorCommissionRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryValidatorCommissionRequest message. - * @function verify - * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryValidatorCommissionRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - if (!$util.isString(message.validator_address)) - return "validator_address: string expected"; - return null; - }; - - /** - * Creates a QueryValidatorCommissionRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.QueryValidatorCommissionRequest} QueryValidatorCommissionRequest - */ - QueryValidatorCommissionRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.QueryValidatorCommissionRequest) - return object; - let message = new $root.cosmos.distribution.v1beta1.QueryValidatorCommissionRequest(); - if (object.validator_address != null) - message.validator_address = String(object.validator_address); - return message; - }; - - /** - * Creates a plain object from a QueryValidatorCommissionRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionRequest - * @static - * @param {cosmos.distribution.v1beta1.QueryValidatorCommissionRequest} message QueryValidatorCommissionRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryValidatorCommissionRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.validator_address = ""; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - object.validator_address = message.validator_address; - return object; - }; - - /** - * Converts this QueryValidatorCommissionRequest to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionRequest - * @instance - * @returns {Object.} JSON object - */ - QueryValidatorCommissionRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryValidatorCommissionRequest; - })(); - - v1beta1.QueryValidatorCommissionResponse = (function() { - - /** - * Properties of a QueryValidatorCommissionResponse. - * @memberof cosmos.distribution.v1beta1 - * @interface IQueryValidatorCommissionResponse - * @property {cosmos.distribution.v1beta1.IValidatorAccumulatedCommission|null} [commission] QueryValidatorCommissionResponse commission - */ - - /** - * Constructs a new QueryValidatorCommissionResponse. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a QueryValidatorCommissionResponse. - * @implements IQueryValidatorCommissionResponse - * @constructor - * @param {cosmos.distribution.v1beta1.IQueryValidatorCommissionResponse=} [properties] Properties to set - */ - function QueryValidatorCommissionResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryValidatorCommissionResponse commission. - * @member {cosmos.distribution.v1beta1.IValidatorAccumulatedCommission|null|undefined} commission - * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionResponse - * @instance - */ - QueryValidatorCommissionResponse.prototype.commission = null; - - /** - * Encodes the specified QueryValidatorCommissionResponse message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryValidatorCommissionResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionResponse - * @static - * @param {cosmos.distribution.v1beta1.IQueryValidatorCommissionResponse} message QueryValidatorCommissionResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryValidatorCommissionResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.commission != null && Object.hasOwnProperty.call(message, "commission")) - $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommission.encode(message.commission, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryValidatorCommissionResponse message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryValidatorCommissionResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionResponse - * @static - * @param {cosmos.distribution.v1beta1.IQueryValidatorCommissionResponse} message QueryValidatorCommissionResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryValidatorCommissionResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryValidatorCommissionResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.QueryValidatorCommissionResponse} QueryValidatorCommissionResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryValidatorCommissionResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryValidatorCommissionResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.commission = $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommission.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryValidatorCommissionResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.QueryValidatorCommissionResponse} QueryValidatorCommissionResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryValidatorCommissionResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryValidatorCommissionResponse message. - * @function verify - * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryValidatorCommissionResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.commission != null && message.hasOwnProperty("commission")) { - let error = $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommission.verify(message.commission); - if (error) - return "commission." + error; - } - return null; - }; - - /** - * Creates a QueryValidatorCommissionResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.QueryValidatorCommissionResponse} QueryValidatorCommissionResponse - */ - QueryValidatorCommissionResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.QueryValidatorCommissionResponse) - return object; - let message = new $root.cosmos.distribution.v1beta1.QueryValidatorCommissionResponse(); - if (object.commission != null) { - if (typeof object.commission !== "object") - throw TypeError(".cosmos.distribution.v1beta1.QueryValidatorCommissionResponse.commission: object expected"); - message.commission = $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommission.fromObject(object.commission); - } - return message; - }; - - /** - * Creates a plain object from a QueryValidatorCommissionResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionResponse - * @static - * @param {cosmos.distribution.v1beta1.QueryValidatorCommissionResponse} message QueryValidatorCommissionResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryValidatorCommissionResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.commission = null; - if (message.commission != null && message.hasOwnProperty("commission")) - object.commission = $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommission.toObject(message.commission, options); - return object; - }; - - /** - * Converts this QueryValidatorCommissionResponse to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.QueryValidatorCommissionResponse - * @instance - * @returns {Object.} JSON object - */ - QueryValidatorCommissionResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryValidatorCommissionResponse; - })(); - - v1beta1.QueryValidatorSlashesRequest = (function() { - - /** - * Properties of a QueryValidatorSlashesRequest. - * @memberof cosmos.distribution.v1beta1 - * @interface IQueryValidatorSlashesRequest - * @property {string|null} [validator_address] QueryValidatorSlashesRequest validator_address - * @property {Long|null} [starting_height] QueryValidatorSlashesRequest starting_height - * @property {Long|null} [ending_height] QueryValidatorSlashesRequest ending_height - * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryValidatorSlashesRequest pagination - */ - - /** - * Constructs a new QueryValidatorSlashesRequest. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a QueryValidatorSlashesRequest. - * @implements IQueryValidatorSlashesRequest - * @constructor - * @param {cosmos.distribution.v1beta1.IQueryValidatorSlashesRequest=} [properties] Properties to set - */ - function QueryValidatorSlashesRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryValidatorSlashesRequest validator_address. - * @member {string} validator_address - * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesRequest - * @instance - */ - QueryValidatorSlashesRequest.prototype.validator_address = ""; - - /** - * QueryValidatorSlashesRequest starting_height. - * @member {Long} starting_height - * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesRequest - * @instance - */ - QueryValidatorSlashesRequest.prototype.starting_height = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * QueryValidatorSlashesRequest ending_height. - * @member {Long} ending_height - * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesRequest - * @instance - */ - QueryValidatorSlashesRequest.prototype.ending_height = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * QueryValidatorSlashesRequest pagination. - * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination - * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesRequest - * @instance - */ - QueryValidatorSlashesRequest.prototype.pagination = null; - - /** - * Encodes the specified QueryValidatorSlashesRequest message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryValidatorSlashesRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesRequest - * @static - * @param {cosmos.distribution.v1beta1.IQueryValidatorSlashesRequest} message QueryValidatorSlashesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryValidatorSlashesRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.validator_address); - if (message.starting_height != null && Object.hasOwnProperty.call(message, "starting_height")) - writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.starting_height); - if (message.ending_height != null && Object.hasOwnProperty.call(message, "ending_height")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.ending_height); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryValidatorSlashesRequest message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryValidatorSlashesRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesRequest - * @static - * @param {cosmos.distribution.v1beta1.IQueryValidatorSlashesRequest} message QueryValidatorSlashesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryValidatorSlashesRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryValidatorSlashesRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.QueryValidatorSlashesRequest} QueryValidatorSlashesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryValidatorSlashesRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryValidatorSlashesRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.validator_address = reader.string(); - break; - case 2: - message.starting_height = reader.uint64(); - break; - case 3: - message.ending_height = reader.uint64(); - break; - case 4: - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryValidatorSlashesRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.QueryValidatorSlashesRequest} QueryValidatorSlashesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryValidatorSlashesRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryValidatorSlashesRequest message. - * @function verify - * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryValidatorSlashesRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - if (!$util.isString(message.validator_address)) - return "validator_address: string expected"; - if (message.starting_height != null && message.hasOwnProperty("starting_height")) - if (!$util.isInteger(message.starting_height) && !(message.starting_height && $util.isInteger(message.starting_height.low) && $util.isInteger(message.starting_height.high))) - return "starting_height: integer|Long expected"; - if (message.ending_height != null && message.hasOwnProperty("ending_height")) - if (!$util.isInteger(message.ending_height) && !(message.ending_height && $util.isInteger(message.ending_height.low) && $util.isInteger(message.ending_height.high))) - return "ending_height: integer|Long expected"; - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryValidatorSlashesRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.QueryValidatorSlashesRequest} QueryValidatorSlashesRequest - */ - QueryValidatorSlashesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.QueryValidatorSlashesRequest) - return object; - let message = new $root.cosmos.distribution.v1beta1.QueryValidatorSlashesRequest(); - if (object.validator_address != null) - message.validator_address = String(object.validator_address); - if (object.starting_height != null) - if ($util.Long) - (message.starting_height = $util.Long.fromValue(object.starting_height)).unsigned = true; - else if (typeof object.starting_height === "string") - message.starting_height = parseInt(object.starting_height, 10); - else if (typeof object.starting_height === "number") - message.starting_height = object.starting_height; - else if (typeof object.starting_height === "object") - message.starting_height = new $util.LongBits(object.starting_height.low >>> 0, object.starting_height.high >>> 0).toNumber(true); - if (object.ending_height != null) - if ($util.Long) - (message.ending_height = $util.Long.fromValue(object.ending_height)).unsigned = true; - else if (typeof object.ending_height === "string") - message.ending_height = parseInt(object.ending_height, 10); - else if (typeof object.ending_height === "number") - message.ending_height = object.ending_height; - else if (typeof object.ending_height === "object") - message.ending_height = new $util.LongBits(object.ending_height.low >>> 0, object.ending_height.high >>> 0).toNumber(true); - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.distribution.v1beta1.QueryValidatorSlashesRequest.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryValidatorSlashesRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesRequest - * @static - * @param {cosmos.distribution.v1beta1.QueryValidatorSlashesRequest} message QueryValidatorSlashesRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryValidatorSlashesRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.validator_address = ""; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.starting_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.starting_height = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.ending_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.ending_height = options.longs === String ? "0" : 0; - object.pagination = null; - } - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - object.validator_address = message.validator_address; - if (message.starting_height != null && message.hasOwnProperty("starting_height")) - if (typeof message.starting_height === "number") - object.starting_height = options.longs === String ? String(message.starting_height) : message.starting_height; - else - object.starting_height = options.longs === String ? $util.Long.prototype.toString.call(message.starting_height) : options.longs === Number ? new $util.LongBits(message.starting_height.low >>> 0, message.starting_height.high >>> 0).toNumber(true) : message.starting_height; - if (message.ending_height != null && message.hasOwnProperty("ending_height")) - if (typeof message.ending_height === "number") - object.ending_height = options.longs === String ? String(message.ending_height) : message.ending_height; - else - object.ending_height = options.longs === String ? $util.Long.prototype.toString.call(message.ending_height) : options.longs === Number ? new $util.LongBits(message.ending_height.low >>> 0, message.ending_height.high >>> 0).toNumber(true) : message.ending_height; - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryValidatorSlashesRequest to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesRequest - * @instance - * @returns {Object.} JSON object - */ - QueryValidatorSlashesRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryValidatorSlashesRequest; - })(); - - v1beta1.QueryValidatorSlashesResponse = (function() { - - /** - * Properties of a QueryValidatorSlashesResponse. - * @memberof cosmos.distribution.v1beta1 - * @interface IQueryValidatorSlashesResponse - * @property {Array.|null} [slashes] QueryValidatorSlashesResponse slashes - * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryValidatorSlashesResponse pagination - */ - - /** - * Constructs a new QueryValidatorSlashesResponse. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a QueryValidatorSlashesResponse. - * @implements IQueryValidatorSlashesResponse - * @constructor - * @param {cosmos.distribution.v1beta1.IQueryValidatorSlashesResponse=} [properties] Properties to set - */ - function QueryValidatorSlashesResponse(properties) { - this.slashes = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryValidatorSlashesResponse slashes. - * @member {Array.} slashes - * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesResponse - * @instance - */ - QueryValidatorSlashesResponse.prototype.slashes = $util.emptyArray; - - /** - * QueryValidatorSlashesResponse pagination. - * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination - * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesResponse - * @instance - */ - QueryValidatorSlashesResponse.prototype.pagination = null; - - /** - * Encodes the specified QueryValidatorSlashesResponse message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryValidatorSlashesResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesResponse - * @static - * @param {cosmos.distribution.v1beta1.IQueryValidatorSlashesResponse} message QueryValidatorSlashesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryValidatorSlashesResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.slashes != null && message.slashes.length) - for (let i = 0; i < message.slashes.length; ++i) - $root.cosmos.distribution.v1beta1.ValidatorSlashEvent.encode(message.slashes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryValidatorSlashesResponse message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryValidatorSlashesResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesResponse - * @static - * @param {cosmos.distribution.v1beta1.IQueryValidatorSlashesResponse} message QueryValidatorSlashesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryValidatorSlashesResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryValidatorSlashesResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.QueryValidatorSlashesResponse} QueryValidatorSlashesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryValidatorSlashesResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryValidatorSlashesResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.slashes && message.slashes.length)) - message.slashes = []; - message.slashes.push($root.cosmos.distribution.v1beta1.ValidatorSlashEvent.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryValidatorSlashesResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.QueryValidatorSlashesResponse} QueryValidatorSlashesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryValidatorSlashesResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryValidatorSlashesResponse message. - * @function verify - * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryValidatorSlashesResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.slashes != null && message.hasOwnProperty("slashes")) { - if (!Array.isArray(message.slashes)) - return "slashes: array expected"; - for (let i = 0; i < message.slashes.length; ++i) { - let error = $root.cosmos.distribution.v1beta1.ValidatorSlashEvent.verify(message.slashes[i]); - if (error) - return "slashes." + error; - } - } - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryValidatorSlashesResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.QueryValidatorSlashesResponse} QueryValidatorSlashesResponse - */ - QueryValidatorSlashesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.QueryValidatorSlashesResponse) - return object; - let message = new $root.cosmos.distribution.v1beta1.QueryValidatorSlashesResponse(); - if (object.slashes) { - if (!Array.isArray(object.slashes)) - throw TypeError(".cosmos.distribution.v1beta1.QueryValidatorSlashesResponse.slashes: array expected"); - message.slashes = []; - for (let i = 0; i < object.slashes.length; ++i) { - if (typeof object.slashes[i] !== "object") - throw TypeError(".cosmos.distribution.v1beta1.QueryValidatorSlashesResponse.slashes: object expected"); - message.slashes[i] = $root.cosmos.distribution.v1beta1.ValidatorSlashEvent.fromObject(object.slashes[i]); - } - } - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.distribution.v1beta1.QueryValidatorSlashesResponse.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryValidatorSlashesResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesResponse - * @static - * @param {cosmos.distribution.v1beta1.QueryValidatorSlashesResponse} message QueryValidatorSlashesResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryValidatorSlashesResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.slashes = []; - if (options.defaults) - object.pagination = null; - if (message.slashes && message.slashes.length) { - object.slashes = []; - for (let j = 0; j < message.slashes.length; ++j) - object.slashes[j] = $root.cosmos.distribution.v1beta1.ValidatorSlashEvent.toObject(message.slashes[j], options); - } - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryValidatorSlashesResponse to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.QueryValidatorSlashesResponse - * @instance - * @returns {Object.} JSON object - */ - QueryValidatorSlashesResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryValidatorSlashesResponse; - })(); - - v1beta1.QueryDelegationRewardsRequest = (function() { - - /** - * Properties of a QueryDelegationRewardsRequest. - * @memberof cosmos.distribution.v1beta1 - * @interface IQueryDelegationRewardsRequest - * @property {string|null} [delegator_address] QueryDelegationRewardsRequest delegator_address - * @property {string|null} [validator_address] QueryDelegationRewardsRequest validator_address - */ - - /** - * Constructs a new QueryDelegationRewardsRequest. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a QueryDelegationRewardsRequest. - * @implements IQueryDelegationRewardsRequest - * @constructor - * @param {cosmos.distribution.v1beta1.IQueryDelegationRewardsRequest=} [properties] Properties to set - */ - function QueryDelegationRewardsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryDelegationRewardsRequest delegator_address. - * @member {string} delegator_address - * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsRequest - * @instance - */ - QueryDelegationRewardsRequest.prototype.delegator_address = ""; - - /** - * QueryDelegationRewardsRequest validator_address. - * @member {string} validator_address - * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsRequest - * @instance - */ - QueryDelegationRewardsRequest.prototype.validator_address = ""; - - /** - * Encodes the specified QueryDelegationRewardsRequest message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegationRewardsRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsRequest - * @static - * @param {cosmos.distribution.v1beta1.IQueryDelegationRewardsRequest} message QueryDelegationRewardsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegationRewardsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); - if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.validator_address); - return writer; - }; - - /** - * Encodes the specified QueryDelegationRewardsRequest message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegationRewardsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsRequest - * @static - * @param {cosmos.distribution.v1beta1.IQueryDelegationRewardsRequest} message QueryDelegationRewardsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegationRewardsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryDelegationRewardsRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.QueryDelegationRewardsRequest} QueryDelegationRewardsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegationRewardsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryDelegationRewardsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.delegator_address = reader.string(); - break; - case 2: - message.validator_address = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryDelegationRewardsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.QueryDelegationRewardsRequest} QueryDelegationRewardsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegationRewardsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryDelegationRewardsRequest message. - * @function verify - * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryDelegationRewardsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - if (!$util.isString(message.delegator_address)) - return "delegator_address: string expected"; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - if (!$util.isString(message.validator_address)) - return "validator_address: string expected"; - return null; - }; - - /** - * Creates a QueryDelegationRewardsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.QueryDelegationRewardsRequest} QueryDelegationRewardsRequest - */ - QueryDelegationRewardsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.QueryDelegationRewardsRequest) - return object; - let message = new $root.cosmos.distribution.v1beta1.QueryDelegationRewardsRequest(); - if (object.delegator_address != null) - message.delegator_address = String(object.delegator_address); - if (object.validator_address != null) - message.validator_address = String(object.validator_address); - return message; - }; - - /** - * Creates a plain object from a QueryDelegationRewardsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsRequest - * @static - * @param {cosmos.distribution.v1beta1.QueryDelegationRewardsRequest} message QueryDelegationRewardsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryDelegationRewardsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.delegator_address = ""; - object.validator_address = ""; - } - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - object.delegator_address = message.delegator_address; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - object.validator_address = message.validator_address; - return object; - }; - - /** - * Converts this QueryDelegationRewardsRequest to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryDelegationRewardsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryDelegationRewardsRequest; - })(); - - v1beta1.QueryDelegationRewardsResponse = (function() { - - /** - * Properties of a QueryDelegationRewardsResponse. - * @memberof cosmos.distribution.v1beta1 - * @interface IQueryDelegationRewardsResponse - * @property {Array.|null} [rewards] QueryDelegationRewardsResponse rewards - */ - - /** - * Constructs a new QueryDelegationRewardsResponse. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a QueryDelegationRewardsResponse. - * @implements IQueryDelegationRewardsResponse - * @constructor - * @param {cosmos.distribution.v1beta1.IQueryDelegationRewardsResponse=} [properties] Properties to set - */ - function QueryDelegationRewardsResponse(properties) { - this.rewards = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryDelegationRewardsResponse rewards. - * @member {Array.} rewards - * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsResponse - * @instance - */ - QueryDelegationRewardsResponse.prototype.rewards = $util.emptyArray; - - /** - * Encodes the specified QueryDelegationRewardsResponse message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegationRewardsResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsResponse - * @static - * @param {cosmos.distribution.v1beta1.IQueryDelegationRewardsResponse} message QueryDelegationRewardsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegationRewardsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.rewards != null && message.rewards.length) - for (let i = 0; i < message.rewards.length; ++i) - $root.cosmos.base.v1beta1.DecCoin.encode(message.rewards[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryDelegationRewardsResponse message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegationRewardsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsResponse - * @static - * @param {cosmos.distribution.v1beta1.IQueryDelegationRewardsResponse} message QueryDelegationRewardsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegationRewardsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryDelegationRewardsResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.QueryDelegationRewardsResponse} QueryDelegationRewardsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegationRewardsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryDelegationRewardsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.rewards && message.rewards.length)) - message.rewards = []; - message.rewards.push($root.cosmos.base.v1beta1.DecCoin.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryDelegationRewardsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.QueryDelegationRewardsResponse} QueryDelegationRewardsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegationRewardsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryDelegationRewardsResponse message. - * @function verify - * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryDelegationRewardsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.rewards != null && message.hasOwnProperty("rewards")) { - if (!Array.isArray(message.rewards)) - return "rewards: array expected"; - for (let i = 0; i < message.rewards.length; ++i) { - let error = $root.cosmos.base.v1beta1.DecCoin.verify(message.rewards[i]); - if (error) - return "rewards." + error; - } - } - return null; - }; - - /** - * Creates a QueryDelegationRewardsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.QueryDelegationRewardsResponse} QueryDelegationRewardsResponse - */ - QueryDelegationRewardsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.QueryDelegationRewardsResponse) - return object; - let message = new $root.cosmos.distribution.v1beta1.QueryDelegationRewardsResponse(); - if (object.rewards) { - if (!Array.isArray(object.rewards)) - throw TypeError(".cosmos.distribution.v1beta1.QueryDelegationRewardsResponse.rewards: array expected"); - message.rewards = []; - for (let i = 0; i < object.rewards.length; ++i) { - if (typeof object.rewards[i] !== "object") - throw TypeError(".cosmos.distribution.v1beta1.QueryDelegationRewardsResponse.rewards: object expected"); - message.rewards[i] = $root.cosmos.base.v1beta1.DecCoin.fromObject(object.rewards[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a QueryDelegationRewardsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsResponse - * @static - * @param {cosmos.distribution.v1beta1.QueryDelegationRewardsResponse} message QueryDelegationRewardsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryDelegationRewardsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.rewards = []; - if (message.rewards && message.rewards.length) { - object.rewards = []; - for (let j = 0; j < message.rewards.length; ++j) - object.rewards[j] = $root.cosmos.base.v1beta1.DecCoin.toObject(message.rewards[j], options); - } - return object; - }; - - /** - * Converts this QueryDelegationRewardsResponse to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.QueryDelegationRewardsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryDelegationRewardsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryDelegationRewardsResponse; - })(); - - v1beta1.QueryDelegationTotalRewardsRequest = (function() { - - /** - * Properties of a QueryDelegationTotalRewardsRequest. - * @memberof cosmos.distribution.v1beta1 - * @interface IQueryDelegationTotalRewardsRequest - * @property {string|null} [delegator_address] QueryDelegationTotalRewardsRequest delegator_address - */ - - /** - * Constructs a new QueryDelegationTotalRewardsRequest. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a QueryDelegationTotalRewardsRequest. - * @implements IQueryDelegationTotalRewardsRequest - * @constructor - * @param {cosmos.distribution.v1beta1.IQueryDelegationTotalRewardsRequest=} [properties] Properties to set - */ - function QueryDelegationTotalRewardsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryDelegationTotalRewardsRequest delegator_address. - * @member {string} delegator_address - * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest - * @instance - */ - QueryDelegationTotalRewardsRequest.prototype.delegator_address = ""; - - /** - * Encodes the specified QueryDelegationTotalRewardsRequest message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest - * @static - * @param {cosmos.distribution.v1beta1.IQueryDelegationTotalRewardsRequest} message QueryDelegationTotalRewardsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegationTotalRewardsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); - return writer; - }; - - /** - * Encodes the specified QueryDelegationTotalRewardsRequest message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest - * @static - * @param {cosmos.distribution.v1beta1.IQueryDelegationTotalRewardsRequest} message QueryDelegationTotalRewardsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegationTotalRewardsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryDelegationTotalRewardsRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest} QueryDelegationTotalRewardsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegationTotalRewardsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.delegator_address = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryDelegationTotalRewardsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest} QueryDelegationTotalRewardsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegationTotalRewardsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryDelegationTotalRewardsRequest message. - * @function verify - * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryDelegationTotalRewardsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - if (!$util.isString(message.delegator_address)) - return "delegator_address: string expected"; - return null; - }; - - /** - * Creates a QueryDelegationTotalRewardsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest} QueryDelegationTotalRewardsRequest - */ - QueryDelegationTotalRewardsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest) - return object; - let message = new $root.cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest(); - if (object.delegator_address != null) - message.delegator_address = String(object.delegator_address); - return message; - }; - - /** - * Creates a plain object from a QueryDelegationTotalRewardsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest - * @static - * @param {cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest} message QueryDelegationTotalRewardsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryDelegationTotalRewardsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.delegator_address = ""; - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - object.delegator_address = message.delegator_address; - return object; - }; - - /** - * Converts this QueryDelegationTotalRewardsRequest to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryDelegationTotalRewardsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryDelegationTotalRewardsRequest; - })(); - - v1beta1.QueryDelegationTotalRewardsResponse = (function() { - - /** - * Properties of a QueryDelegationTotalRewardsResponse. - * @memberof cosmos.distribution.v1beta1 - * @interface IQueryDelegationTotalRewardsResponse - * @property {Array.|null} [rewards] QueryDelegationTotalRewardsResponse rewards - * @property {Array.|null} [total] QueryDelegationTotalRewardsResponse total - */ - - /** - * Constructs a new QueryDelegationTotalRewardsResponse. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a QueryDelegationTotalRewardsResponse. - * @implements IQueryDelegationTotalRewardsResponse - * @constructor - * @param {cosmos.distribution.v1beta1.IQueryDelegationTotalRewardsResponse=} [properties] Properties to set - */ - function QueryDelegationTotalRewardsResponse(properties) { - this.rewards = []; - this.total = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryDelegationTotalRewardsResponse rewards. - * @member {Array.} rewards - * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse - * @instance - */ - QueryDelegationTotalRewardsResponse.prototype.rewards = $util.emptyArray; - - /** - * QueryDelegationTotalRewardsResponse total. - * @member {Array.} total - * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse - * @instance - */ - QueryDelegationTotalRewardsResponse.prototype.total = $util.emptyArray; - - /** - * Encodes the specified QueryDelegationTotalRewardsResponse message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse - * @static - * @param {cosmos.distribution.v1beta1.IQueryDelegationTotalRewardsResponse} message QueryDelegationTotalRewardsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegationTotalRewardsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.rewards != null && message.rewards.length) - for (let i = 0; i < message.rewards.length; ++i) - $root.cosmos.distribution.v1beta1.DelegationDelegatorReward.encode(message.rewards[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.total != null && message.total.length) - for (let i = 0; i < message.total.length; ++i) - $root.cosmos.base.v1beta1.DecCoin.encode(message.total[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryDelegationTotalRewardsResponse message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse - * @static - * @param {cosmos.distribution.v1beta1.IQueryDelegationTotalRewardsResponse} message QueryDelegationTotalRewardsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegationTotalRewardsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryDelegationTotalRewardsResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse} QueryDelegationTotalRewardsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegationTotalRewardsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.rewards && message.rewards.length)) - message.rewards = []; - message.rewards.push($root.cosmos.distribution.v1beta1.DelegationDelegatorReward.decode(reader, reader.uint32())); - break; - case 2: - if (!(message.total && message.total.length)) - message.total = []; - message.total.push($root.cosmos.base.v1beta1.DecCoin.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryDelegationTotalRewardsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse} QueryDelegationTotalRewardsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegationTotalRewardsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryDelegationTotalRewardsResponse message. - * @function verify - * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryDelegationTotalRewardsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.rewards != null && message.hasOwnProperty("rewards")) { - if (!Array.isArray(message.rewards)) - return "rewards: array expected"; - for (let i = 0; i < message.rewards.length; ++i) { - let error = $root.cosmos.distribution.v1beta1.DelegationDelegatorReward.verify(message.rewards[i]); - if (error) - return "rewards." + error; - } - } - if (message.total != null && message.hasOwnProperty("total")) { - if (!Array.isArray(message.total)) - return "total: array expected"; - for (let i = 0; i < message.total.length; ++i) { - let error = $root.cosmos.base.v1beta1.DecCoin.verify(message.total[i]); - if (error) - return "total." + error; - } - } - return null; - }; - - /** - * Creates a QueryDelegationTotalRewardsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse} QueryDelegationTotalRewardsResponse - */ - QueryDelegationTotalRewardsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse) - return object; - let message = new $root.cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse(); - if (object.rewards) { - if (!Array.isArray(object.rewards)) - throw TypeError(".cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse.rewards: array expected"); - message.rewards = []; - for (let i = 0; i < object.rewards.length; ++i) { - if (typeof object.rewards[i] !== "object") - throw TypeError(".cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse.rewards: object expected"); - message.rewards[i] = $root.cosmos.distribution.v1beta1.DelegationDelegatorReward.fromObject(object.rewards[i]); - } - } - if (object.total) { - if (!Array.isArray(object.total)) - throw TypeError(".cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse.total: array expected"); - message.total = []; - for (let i = 0; i < object.total.length; ++i) { - if (typeof object.total[i] !== "object") - throw TypeError(".cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse.total: object expected"); - message.total[i] = $root.cosmos.base.v1beta1.DecCoin.fromObject(object.total[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a QueryDelegationTotalRewardsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse - * @static - * @param {cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse} message QueryDelegationTotalRewardsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryDelegationTotalRewardsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) { - object.rewards = []; - object.total = []; - } - if (message.rewards && message.rewards.length) { - object.rewards = []; - for (let j = 0; j < message.rewards.length; ++j) - object.rewards[j] = $root.cosmos.distribution.v1beta1.DelegationDelegatorReward.toObject(message.rewards[j], options); - } - if (message.total && message.total.length) { - object.total = []; - for (let j = 0; j < message.total.length; ++j) - object.total[j] = $root.cosmos.base.v1beta1.DecCoin.toObject(message.total[j], options); - } - return object; - }; - - /** - * Converts this QueryDelegationTotalRewardsResponse to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryDelegationTotalRewardsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryDelegationTotalRewardsResponse; - })(); - - v1beta1.QueryDelegatorValidatorsRequest = (function() { - - /** - * Properties of a QueryDelegatorValidatorsRequest. - * @memberof cosmos.distribution.v1beta1 - * @interface IQueryDelegatorValidatorsRequest - * @property {string|null} [delegator_address] QueryDelegatorValidatorsRequest delegator_address - */ - - /** - * Constructs a new QueryDelegatorValidatorsRequest. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a QueryDelegatorValidatorsRequest. - * @implements IQueryDelegatorValidatorsRequest - * @constructor - * @param {cosmos.distribution.v1beta1.IQueryDelegatorValidatorsRequest=} [properties] Properties to set - */ - function QueryDelegatorValidatorsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryDelegatorValidatorsRequest delegator_address. - * @member {string} delegator_address - * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest - * @instance - */ - QueryDelegatorValidatorsRequest.prototype.delegator_address = ""; - - /** - * Encodes the specified QueryDelegatorValidatorsRequest message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest - * @static - * @param {cosmos.distribution.v1beta1.IQueryDelegatorValidatorsRequest} message QueryDelegatorValidatorsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegatorValidatorsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); - return writer; - }; - - /** - * Encodes the specified QueryDelegatorValidatorsRequest message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest - * @static - * @param {cosmos.distribution.v1beta1.IQueryDelegatorValidatorsRequest} message QueryDelegatorValidatorsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegatorValidatorsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryDelegatorValidatorsRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest} QueryDelegatorValidatorsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegatorValidatorsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.delegator_address = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryDelegatorValidatorsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest} QueryDelegatorValidatorsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegatorValidatorsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryDelegatorValidatorsRequest message. - * @function verify - * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryDelegatorValidatorsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - if (!$util.isString(message.delegator_address)) - return "delegator_address: string expected"; - return null; - }; - - /** - * Creates a QueryDelegatorValidatorsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest} QueryDelegatorValidatorsRequest - */ - QueryDelegatorValidatorsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest) - return object; - let message = new $root.cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest(); - if (object.delegator_address != null) - message.delegator_address = String(object.delegator_address); - return message; - }; - - /** - * Creates a plain object from a QueryDelegatorValidatorsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest - * @static - * @param {cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest} message QueryDelegatorValidatorsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryDelegatorValidatorsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.delegator_address = ""; - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - object.delegator_address = message.delegator_address; - return object; - }; - - /** - * Converts this QueryDelegatorValidatorsRequest to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryDelegatorValidatorsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryDelegatorValidatorsRequest; - })(); - - v1beta1.QueryDelegatorValidatorsResponse = (function() { - - /** - * Properties of a QueryDelegatorValidatorsResponse. - * @memberof cosmos.distribution.v1beta1 - * @interface IQueryDelegatorValidatorsResponse - * @property {Array.|null} [validators] QueryDelegatorValidatorsResponse validators - */ - - /** - * Constructs a new QueryDelegatorValidatorsResponse. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a QueryDelegatorValidatorsResponse. - * @implements IQueryDelegatorValidatorsResponse - * @constructor - * @param {cosmos.distribution.v1beta1.IQueryDelegatorValidatorsResponse=} [properties] Properties to set - */ - function QueryDelegatorValidatorsResponse(properties) { - this.validators = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryDelegatorValidatorsResponse validators. - * @member {Array.} validators - * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse - * @instance - */ - QueryDelegatorValidatorsResponse.prototype.validators = $util.emptyArray; - - /** - * Encodes the specified QueryDelegatorValidatorsResponse message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse - * @static - * @param {cosmos.distribution.v1beta1.IQueryDelegatorValidatorsResponse} message QueryDelegatorValidatorsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegatorValidatorsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.validators != null && message.validators.length) - for (let i = 0; i < message.validators.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.validators[i]); - return writer; - }; - - /** - * Encodes the specified QueryDelegatorValidatorsResponse message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse - * @static - * @param {cosmos.distribution.v1beta1.IQueryDelegatorValidatorsResponse} message QueryDelegatorValidatorsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegatorValidatorsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryDelegatorValidatorsResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse} QueryDelegatorValidatorsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegatorValidatorsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.validators && message.validators.length)) - message.validators = []; - message.validators.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryDelegatorValidatorsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse} QueryDelegatorValidatorsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegatorValidatorsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryDelegatorValidatorsResponse message. - * @function verify - * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryDelegatorValidatorsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.validators != null && message.hasOwnProperty("validators")) { - if (!Array.isArray(message.validators)) - return "validators: array expected"; - for (let i = 0; i < message.validators.length; ++i) - if (!$util.isString(message.validators[i])) - return "validators: string[] expected"; - } - return null; - }; - - /** - * Creates a QueryDelegatorValidatorsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse} QueryDelegatorValidatorsResponse - */ - QueryDelegatorValidatorsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse) - return object; - let message = new $root.cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse(); - if (object.validators) { - if (!Array.isArray(object.validators)) - throw TypeError(".cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse.validators: array expected"); - message.validators = []; - for (let i = 0; i < object.validators.length; ++i) - message.validators[i] = String(object.validators[i]); - } - return message; - }; - - /** - * Creates a plain object from a QueryDelegatorValidatorsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse - * @static - * @param {cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse} message QueryDelegatorValidatorsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryDelegatorValidatorsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.validators = []; - if (message.validators && message.validators.length) { - object.validators = []; - for (let j = 0; j < message.validators.length; ++j) - object.validators[j] = message.validators[j]; - } - return object; - }; - - /** - * Converts this QueryDelegatorValidatorsResponse to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryDelegatorValidatorsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryDelegatorValidatorsResponse; - })(); - - v1beta1.QueryDelegatorWithdrawAddressRequest = (function() { - - /** - * Properties of a QueryDelegatorWithdrawAddressRequest. - * @memberof cosmos.distribution.v1beta1 - * @interface IQueryDelegatorWithdrawAddressRequest - * @property {string|null} [delegator_address] QueryDelegatorWithdrawAddressRequest delegator_address - */ - - /** - * Constructs a new QueryDelegatorWithdrawAddressRequest. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a QueryDelegatorWithdrawAddressRequest. - * @implements IQueryDelegatorWithdrawAddressRequest - * @constructor - * @param {cosmos.distribution.v1beta1.IQueryDelegatorWithdrawAddressRequest=} [properties] Properties to set - */ - function QueryDelegatorWithdrawAddressRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryDelegatorWithdrawAddressRequest delegator_address. - * @member {string} delegator_address - * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest - * @instance - */ - QueryDelegatorWithdrawAddressRequest.prototype.delegator_address = ""; - - /** - * Encodes the specified QueryDelegatorWithdrawAddressRequest message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest - * @static - * @param {cosmos.distribution.v1beta1.IQueryDelegatorWithdrawAddressRequest} message QueryDelegatorWithdrawAddressRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegatorWithdrawAddressRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); - return writer; - }; - - /** - * Encodes the specified QueryDelegatorWithdrawAddressRequest message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest - * @static - * @param {cosmos.distribution.v1beta1.IQueryDelegatorWithdrawAddressRequest} message QueryDelegatorWithdrawAddressRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegatorWithdrawAddressRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryDelegatorWithdrawAddressRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest} QueryDelegatorWithdrawAddressRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegatorWithdrawAddressRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.delegator_address = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryDelegatorWithdrawAddressRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest} QueryDelegatorWithdrawAddressRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegatorWithdrawAddressRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryDelegatorWithdrawAddressRequest message. - * @function verify - * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryDelegatorWithdrawAddressRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - if (!$util.isString(message.delegator_address)) - return "delegator_address: string expected"; - return null; - }; - - /** - * Creates a QueryDelegatorWithdrawAddressRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest} QueryDelegatorWithdrawAddressRequest - */ - QueryDelegatorWithdrawAddressRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest) - return object; - let message = new $root.cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest(); - if (object.delegator_address != null) - message.delegator_address = String(object.delegator_address); - return message; - }; - - /** - * Creates a plain object from a QueryDelegatorWithdrawAddressRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest - * @static - * @param {cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest} message QueryDelegatorWithdrawAddressRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryDelegatorWithdrawAddressRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.delegator_address = ""; - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - object.delegator_address = message.delegator_address; - return object; - }; - - /** - * Converts this QueryDelegatorWithdrawAddressRequest to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest - * @instance - * @returns {Object.} JSON object - */ - QueryDelegatorWithdrawAddressRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryDelegatorWithdrawAddressRequest; - })(); - - v1beta1.QueryDelegatorWithdrawAddressResponse = (function() { - - /** - * Properties of a QueryDelegatorWithdrawAddressResponse. - * @memberof cosmos.distribution.v1beta1 - * @interface IQueryDelegatorWithdrawAddressResponse - * @property {string|null} [withdraw_address] QueryDelegatorWithdrawAddressResponse withdraw_address - */ - - /** - * Constructs a new QueryDelegatorWithdrawAddressResponse. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a QueryDelegatorWithdrawAddressResponse. - * @implements IQueryDelegatorWithdrawAddressResponse - * @constructor - * @param {cosmos.distribution.v1beta1.IQueryDelegatorWithdrawAddressResponse=} [properties] Properties to set - */ - function QueryDelegatorWithdrawAddressResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryDelegatorWithdrawAddressResponse withdraw_address. - * @member {string} withdraw_address - * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse - * @instance - */ - QueryDelegatorWithdrawAddressResponse.prototype.withdraw_address = ""; - - /** - * Encodes the specified QueryDelegatorWithdrawAddressResponse message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse - * @static - * @param {cosmos.distribution.v1beta1.IQueryDelegatorWithdrawAddressResponse} message QueryDelegatorWithdrawAddressResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegatorWithdrawAddressResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.withdraw_address != null && Object.hasOwnProperty.call(message, "withdraw_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.withdraw_address); - return writer; - }; - - /** - * Encodes the specified QueryDelegatorWithdrawAddressResponse message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse - * @static - * @param {cosmos.distribution.v1beta1.IQueryDelegatorWithdrawAddressResponse} message QueryDelegatorWithdrawAddressResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegatorWithdrawAddressResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryDelegatorWithdrawAddressResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse} QueryDelegatorWithdrawAddressResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegatorWithdrawAddressResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.withdraw_address = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryDelegatorWithdrawAddressResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse} QueryDelegatorWithdrawAddressResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegatorWithdrawAddressResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryDelegatorWithdrawAddressResponse message. - * @function verify - * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryDelegatorWithdrawAddressResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.withdraw_address != null && message.hasOwnProperty("withdraw_address")) - if (!$util.isString(message.withdraw_address)) - return "withdraw_address: string expected"; - return null; - }; - - /** - * Creates a QueryDelegatorWithdrawAddressResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse} QueryDelegatorWithdrawAddressResponse - */ - QueryDelegatorWithdrawAddressResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse) - return object; - let message = new $root.cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse(); - if (object.withdraw_address != null) - message.withdraw_address = String(object.withdraw_address); - return message; - }; - - /** - * Creates a plain object from a QueryDelegatorWithdrawAddressResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse - * @static - * @param {cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse} message QueryDelegatorWithdrawAddressResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryDelegatorWithdrawAddressResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.withdraw_address = ""; - if (message.withdraw_address != null && message.hasOwnProperty("withdraw_address")) - object.withdraw_address = message.withdraw_address; - return object; - }; - - /** - * Converts this QueryDelegatorWithdrawAddressResponse to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse - * @instance - * @returns {Object.} JSON object - */ - QueryDelegatorWithdrawAddressResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryDelegatorWithdrawAddressResponse; - })(); - - v1beta1.QueryCommunityPoolRequest = (function() { - - /** - * Properties of a QueryCommunityPoolRequest. - * @memberof cosmos.distribution.v1beta1 - * @interface IQueryCommunityPoolRequest - */ - - /** - * Constructs a new QueryCommunityPoolRequest. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a QueryCommunityPoolRequest. - * @implements IQueryCommunityPoolRequest - * @constructor - * @param {cosmos.distribution.v1beta1.IQueryCommunityPoolRequest=} [properties] Properties to set - */ - function QueryCommunityPoolRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified QueryCommunityPoolRequest message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryCommunityPoolRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolRequest - * @static - * @param {cosmos.distribution.v1beta1.IQueryCommunityPoolRequest} message QueryCommunityPoolRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryCommunityPoolRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified QueryCommunityPoolRequest message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryCommunityPoolRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolRequest - * @static - * @param {cosmos.distribution.v1beta1.IQueryCommunityPoolRequest} message QueryCommunityPoolRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryCommunityPoolRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryCommunityPoolRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.QueryCommunityPoolRequest} QueryCommunityPoolRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryCommunityPoolRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryCommunityPoolRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryCommunityPoolRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.QueryCommunityPoolRequest} QueryCommunityPoolRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryCommunityPoolRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryCommunityPoolRequest message. - * @function verify - * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryCommunityPoolRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a QueryCommunityPoolRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.QueryCommunityPoolRequest} QueryCommunityPoolRequest - */ - QueryCommunityPoolRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.QueryCommunityPoolRequest) - return object; - return new $root.cosmos.distribution.v1beta1.QueryCommunityPoolRequest(); - }; - - /** - * Creates a plain object from a QueryCommunityPoolRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolRequest - * @static - * @param {cosmos.distribution.v1beta1.QueryCommunityPoolRequest} message QueryCommunityPoolRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryCommunityPoolRequest.toObject = function toObject() { - return {}; - }; - - /** - * Converts this QueryCommunityPoolRequest to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolRequest - * @instance - * @returns {Object.} JSON object - */ - QueryCommunityPoolRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryCommunityPoolRequest; - })(); - - v1beta1.QueryCommunityPoolResponse = (function() { - - /** - * Properties of a QueryCommunityPoolResponse. - * @memberof cosmos.distribution.v1beta1 - * @interface IQueryCommunityPoolResponse - * @property {Array.|null} [pool] QueryCommunityPoolResponse pool - */ - - /** - * Constructs a new QueryCommunityPoolResponse. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a QueryCommunityPoolResponse. - * @implements IQueryCommunityPoolResponse - * @constructor - * @param {cosmos.distribution.v1beta1.IQueryCommunityPoolResponse=} [properties] Properties to set - */ - function QueryCommunityPoolResponse(properties) { - this.pool = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryCommunityPoolResponse pool. - * @member {Array.} pool - * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolResponse - * @instance - */ - QueryCommunityPoolResponse.prototype.pool = $util.emptyArray; - - /** - * Encodes the specified QueryCommunityPoolResponse message. Does not implicitly {@link cosmos.distribution.v1beta1.QueryCommunityPoolResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolResponse - * @static - * @param {cosmos.distribution.v1beta1.IQueryCommunityPoolResponse} message QueryCommunityPoolResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryCommunityPoolResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.pool != null && message.pool.length) - for (let i = 0; i < message.pool.length; ++i) - $root.cosmos.base.v1beta1.DecCoin.encode(message.pool[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryCommunityPoolResponse message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.QueryCommunityPoolResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolResponse - * @static - * @param {cosmos.distribution.v1beta1.IQueryCommunityPoolResponse} message QueryCommunityPoolResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryCommunityPoolResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryCommunityPoolResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.QueryCommunityPoolResponse} QueryCommunityPoolResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryCommunityPoolResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.QueryCommunityPoolResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.pool && message.pool.length)) - message.pool = []; - message.pool.push($root.cosmos.base.v1beta1.DecCoin.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryCommunityPoolResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.QueryCommunityPoolResponse} QueryCommunityPoolResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryCommunityPoolResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryCommunityPoolResponse message. - * @function verify - * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryCommunityPoolResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.pool != null && message.hasOwnProperty("pool")) { - if (!Array.isArray(message.pool)) - return "pool: array expected"; - for (let i = 0; i < message.pool.length; ++i) { - let error = $root.cosmos.base.v1beta1.DecCoin.verify(message.pool[i]); - if (error) - return "pool." + error; - } - } - return null; - }; - - /** - * Creates a QueryCommunityPoolResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.QueryCommunityPoolResponse} QueryCommunityPoolResponse - */ - QueryCommunityPoolResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.QueryCommunityPoolResponse) - return object; - let message = new $root.cosmos.distribution.v1beta1.QueryCommunityPoolResponse(); - if (object.pool) { - if (!Array.isArray(object.pool)) - throw TypeError(".cosmos.distribution.v1beta1.QueryCommunityPoolResponse.pool: array expected"); - message.pool = []; - for (let i = 0; i < object.pool.length; ++i) { - if (typeof object.pool[i] !== "object") - throw TypeError(".cosmos.distribution.v1beta1.QueryCommunityPoolResponse.pool: object expected"); - message.pool[i] = $root.cosmos.base.v1beta1.DecCoin.fromObject(object.pool[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a QueryCommunityPoolResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolResponse - * @static - * @param {cosmos.distribution.v1beta1.QueryCommunityPoolResponse} message QueryCommunityPoolResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryCommunityPoolResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.pool = []; - if (message.pool && message.pool.length) { - object.pool = []; - for (let j = 0; j < message.pool.length; ++j) - object.pool[j] = $root.cosmos.base.v1beta1.DecCoin.toObject(message.pool[j], options); - } - return object; - }; - - /** - * Converts this QueryCommunityPoolResponse to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.QueryCommunityPoolResponse - * @instance - * @returns {Object.} JSON object - */ - QueryCommunityPoolResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryCommunityPoolResponse; - })(); - - v1beta1.DelegatorWithdrawInfo = (function() { - - /** - * Properties of a DelegatorWithdrawInfo. - * @memberof cosmos.distribution.v1beta1 - * @interface IDelegatorWithdrawInfo - * @property {string|null} [delegator_address] DelegatorWithdrawInfo delegator_address - * @property {string|null} [withdraw_address] DelegatorWithdrawInfo withdraw_address - */ - - /** - * Constructs a new DelegatorWithdrawInfo. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a DelegatorWithdrawInfo. - * @implements IDelegatorWithdrawInfo - * @constructor - * @param {cosmos.distribution.v1beta1.IDelegatorWithdrawInfo=} [properties] Properties to set - */ - function DelegatorWithdrawInfo(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DelegatorWithdrawInfo delegator_address. - * @member {string} delegator_address - * @memberof cosmos.distribution.v1beta1.DelegatorWithdrawInfo - * @instance - */ - DelegatorWithdrawInfo.prototype.delegator_address = ""; - - /** - * DelegatorWithdrawInfo withdraw_address. - * @member {string} withdraw_address - * @memberof cosmos.distribution.v1beta1.DelegatorWithdrawInfo - * @instance - */ - DelegatorWithdrawInfo.prototype.withdraw_address = ""; - - /** - * Encodes the specified DelegatorWithdrawInfo message. Does not implicitly {@link cosmos.distribution.v1beta1.DelegatorWithdrawInfo.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.DelegatorWithdrawInfo - * @static - * @param {cosmos.distribution.v1beta1.IDelegatorWithdrawInfo} message DelegatorWithdrawInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DelegatorWithdrawInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); - if (message.withdraw_address != null && Object.hasOwnProperty.call(message, "withdraw_address")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.withdraw_address); - return writer; - }; - - /** - * Encodes the specified DelegatorWithdrawInfo message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.DelegatorWithdrawInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.DelegatorWithdrawInfo - * @static - * @param {cosmos.distribution.v1beta1.IDelegatorWithdrawInfo} message DelegatorWithdrawInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DelegatorWithdrawInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DelegatorWithdrawInfo message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.DelegatorWithdrawInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.DelegatorWithdrawInfo} DelegatorWithdrawInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DelegatorWithdrawInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.DelegatorWithdrawInfo(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.delegator_address = reader.string(); - break; - case 2: - message.withdraw_address = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DelegatorWithdrawInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.DelegatorWithdrawInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.DelegatorWithdrawInfo} DelegatorWithdrawInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DelegatorWithdrawInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DelegatorWithdrawInfo message. - * @function verify - * @memberof cosmos.distribution.v1beta1.DelegatorWithdrawInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DelegatorWithdrawInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - if (!$util.isString(message.delegator_address)) - return "delegator_address: string expected"; - if (message.withdraw_address != null && message.hasOwnProperty("withdraw_address")) - if (!$util.isString(message.withdraw_address)) - return "withdraw_address: string expected"; - return null; - }; - - /** - * Creates a DelegatorWithdrawInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.DelegatorWithdrawInfo - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.DelegatorWithdrawInfo} DelegatorWithdrawInfo - */ - DelegatorWithdrawInfo.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.DelegatorWithdrawInfo) - return object; - let message = new $root.cosmos.distribution.v1beta1.DelegatorWithdrawInfo(); - if (object.delegator_address != null) - message.delegator_address = String(object.delegator_address); - if (object.withdraw_address != null) - message.withdraw_address = String(object.withdraw_address); - return message; - }; - - /** - * Creates a plain object from a DelegatorWithdrawInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.DelegatorWithdrawInfo - * @static - * @param {cosmos.distribution.v1beta1.DelegatorWithdrawInfo} message DelegatorWithdrawInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DelegatorWithdrawInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.delegator_address = ""; - object.withdraw_address = ""; - } - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - object.delegator_address = message.delegator_address; - if (message.withdraw_address != null && message.hasOwnProperty("withdraw_address")) - object.withdraw_address = message.withdraw_address; - return object; - }; - - /** - * Converts this DelegatorWithdrawInfo to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.DelegatorWithdrawInfo - * @instance - * @returns {Object.} JSON object - */ - DelegatorWithdrawInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return DelegatorWithdrawInfo; - })(); - - v1beta1.ValidatorOutstandingRewardsRecord = (function() { - - /** - * Properties of a ValidatorOutstandingRewardsRecord. - * @memberof cosmos.distribution.v1beta1 - * @interface IValidatorOutstandingRewardsRecord - * @property {string|null} [validator_address] ValidatorOutstandingRewardsRecord validator_address - * @property {Array.|null} [outstanding_rewards] ValidatorOutstandingRewardsRecord outstanding_rewards - */ - - /** - * Constructs a new ValidatorOutstandingRewardsRecord. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a ValidatorOutstandingRewardsRecord. - * @implements IValidatorOutstandingRewardsRecord - * @constructor - * @param {cosmos.distribution.v1beta1.IValidatorOutstandingRewardsRecord=} [properties] Properties to set - */ - function ValidatorOutstandingRewardsRecord(properties) { - this.outstanding_rewards = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ValidatorOutstandingRewardsRecord validator_address. - * @member {string} validator_address - * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord - * @instance - */ - ValidatorOutstandingRewardsRecord.prototype.validator_address = ""; - - /** - * ValidatorOutstandingRewardsRecord outstanding_rewards. - * @member {Array.} outstanding_rewards - * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord - * @instance - */ - ValidatorOutstandingRewardsRecord.prototype.outstanding_rewards = $util.emptyArray; - - /** - * Encodes the specified ValidatorOutstandingRewardsRecord message. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord - * @static - * @param {cosmos.distribution.v1beta1.IValidatorOutstandingRewardsRecord} message ValidatorOutstandingRewardsRecord message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorOutstandingRewardsRecord.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.validator_address); - if (message.outstanding_rewards != null && message.outstanding_rewards.length) - for (let i = 0; i < message.outstanding_rewards.length; ++i) - $root.cosmos.base.v1beta1.DecCoin.encode(message.outstanding_rewards[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ValidatorOutstandingRewardsRecord message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord - * @static - * @param {cosmos.distribution.v1beta1.IValidatorOutstandingRewardsRecord} message ValidatorOutstandingRewardsRecord message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorOutstandingRewardsRecord.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ValidatorOutstandingRewardsRecord message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord} ValidatorOutstandingRewardsRecord - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorOutstandingRewardsRecord.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.validator_address = reader.string(); - break; - case 2: - if (!(message.outstanding_rewards && message.outstanding_rewards.length)) - message.outstanding_rewards = []; - message.outstanding_rewards.push($root.cosmos.base.v1beta1.DecCoin.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ValidatorOutstandingRewardsRecord message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord} ValidatorOutstandingRewardsRecord - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorOutstandingRewardsRecord.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ValidatorOutstandingRewardsRecord message. - * @function verify - * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ValidatorOutstandingRewardsRecord.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - if (!$util.isString(message.validator_address)) - return "validator_address: string expected"; - if (message.outstanding_rewards != null && message.hasOwnProperty("outstanding_rewards")) { - if (!Array.isArray(message.outstanding_rewards)) - return "outstanding_rewards: array expected"; - for (let i = 0; i < message.outstanding_rewards.length; ++i) { - let error = $root.cosmos.base.v1beta1.DecCoin.verify(message.outstanding_rewards[i]); - if (error) - return "outstanding_rewards." + error; - } - } - return null; - }; - - /** - * Creates a ValidatorOutstandingRewardsRecord message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord} ValidatorOutstandingRewardsRecord - */ - ValidatorOutstandingRewardsRecord.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord) - return object; - let message = new $root.cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord(); - if (object.validator_address != null) - message.validator_address = String(object.validator_address); - if (object.outstanding_rewards) { - if (!Array.isArray(object.outstanding_rewards)) - throw TypeError(".cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord.outstanding_rewards: array expected"); - message.outstanding_rewards = []; - for (let i = 0; i < object.outstanding_rewards.length; ++i) { - if (typeof object.outstanding_rewards[i] !== "object") - throw TypeError(".cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord.outstanding_rewards: object expected"); - message.outstanding_rewards[i] = $root.cosmos.base.v1beta1.DecCoin.fromObject(object.outstanding_rewards[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a ValidatorOutstandingRewardsRecord message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord - * @static - * @param {cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord} message ValidatorOutstandingRewardsRecord - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ValidatorOutstandingRewardsRecord.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.outstanding_rewards = []; - if (options.defaults) - object.validator_address = ""; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - object.validator_address = message.validator_address; - if (message.outstanding_rewards && message.outstanding_rewards.length) { - object.outstanding_rewards = []; - for (let j = 0; j < message.outstanding_rewards.length; ++j) - object.outstanding_rewards[j] = $root.cosmos.base.v1beta1.DecCoin.toObject(message.outstanding_rewards[j], options); - } - return object; - }; - - /** - * Converts this ValidatorOutstandingRewardsRecord to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord - * @instance - * @returns {Object.} JSON object - */ - ValidatorOutstandingRewardsRecord.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ValidatorOutstandingRewardsRecord; - })(); - - v1beta1.ValidatorAccumulatedCommissionRecord = (function() { - - /** - * Properties of a ValidatorAccumulatedCommissionRecord. - * @memberof cosmos.distribution.v1beta1 - * @interface IValidatorAccumulatedCommissionRecord - * @property {string|null} [validator_address] ValidatorAccumulatedCommissionRecord validator_address - * @property {cosmos.distribution.v1beta1.IValidatorAccumulatedCommission|null} [accumulated] ValidatorAccumulatedCommissionRecord accumulated - */ - - /** - * Constructs a new ValidatorAccumulatedCommissionRecord. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a ValidatorAccumulatedCommissionRecord. - * @implements IValidatorAccumulatedCommissionRecord - * @constructor - * @param {cosmos.distribution.v1beta1.IValidatorAccumulatedCommissionRecord=} [properties] Properties to set - */ - function ValidatorAccumulatedCommissionRecord(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ValidatorAccumulatedCommissionRecord validator_address. - * @member {string} validator_address - * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord - * @instance - */ - ValidatorAccumulatedCommissionRecord.prototype.validator_address = ""; - - /** - * ValidatorAccumulatedCommissionRecord accumulated. - * @member {cosmos.distribution.v1beta1.IValidatorAccumulatedCommission|null|undefined} accumulated - * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord - * @instance - */ - ValidatorAccumulatedCommissionRecord.prototype.accumulated = null; - - /** - * Encodes the specified ValidatorAccumulatedCommissionRecord message. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord - * @static - * @param {cosmos.distribution.v1beta1.IValidatorAccumulatedCommissionRecord} message ValidatorAccumulatedCommissionRecord message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorAccumulatedCommissionRecord.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.validator_address); - if (message.accumulated != null && Object.hasOwnProperty.call(message, "accumulated")) - $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommission.encode(message.accumulated, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ValidatorAccumulatedCommissionRecord message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord - * @static - * @param {cosmos.distribution.v1beta1.IValidatorAccumulatedCommissionRecord} message ValidatorAccumulatedCommissionRecord message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorAccumulatedCommissionRecord.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ValidatorAccumulatedCommissionRecord message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord} ValidatorAccumulatedCommissionRecord - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorAccumulatedCommissionRecord.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.validator_address = reader.string(); - break; - case 2: - message.accumulated = $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommission.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ValidatorAccumulatedCommissionRecord message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord} ValidatorAccumulatedCommissionRecord - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorAccumulatedCommissionRecord.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ValidatorAccumulatedCommissionRecord message. - * @function verify - * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ValidatorAccumulatedCommissionRecord.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - if (!$util.isString(message.validator_address)) - return "validator_address: string expected"; - if (message.accumulated != null && message.hasOwnProperty("accumulated")) { - let error = $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommission.verify(message.accumulated); - if (error) - return "accumulated." + error; - } - return null; - }; - - /** - * Creates a ValidatorAccumulatedCommissionRecord message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord} ValidatorAccumulatedCommissionRecord - */ - ValidatorAccumulatedCommissionRecord.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord) - return object; - let message = new $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord(); - if (object.validator_address != null) - message.validator_address = String(object.validator_address); - if (object.accumulated != null) { - if (typeof object.accumulated !== "object") - throw TypeError(".cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord.accumulated: object expected"); - message.accumulated = $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommission.fromObject(object.accumulated); - } - return message; - }; - - /** - * Creates a plain object from a ValidatorAccumulatedCommissionRecord message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord - * @static - * @param {cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord} message ValidatorAccumulatedCommissionRecord - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ValidatorAccumulatedCommissionRecord.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.validator_address = ""; - object.accumulated = null; - } - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - object.validator_address = message.validator_address; - if (message.accumulated != null && message.hasOwnProperty("accumulated")) - object.accumulated = $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommission.toObject(message.accumulated, options); - return object; - }; - - /** - * Converts this ValidatorAccumulatedCommissionRecord to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord - * @instance - * @returns {Object.} JSON object - */ - ValidatorAccumulatedCommissionRecord.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ValidatorAccumulatedCommissionRecord; - })(); - - v1beta1.ValidatorHistoricalRewardsRecord = (function() { - - /** - * Properties of a ValidatorHistoricalRewardsRecord. - * @memberof cosmos.distribution.v1beta1 - * @interface IValidatorHistoricalRewardsRecord - * @property {string|null} [validator_address] ValidatorHistoricalRewardsRecord validator_address - * @property {Long|null} [period] ValidatorHistoricalRewardsRecord period - * @property {cosmos.distribution.v1beta1.IValidatorHistoricalRewards|null} [rewards] ValidatorHistoricalRewardsRecord rewards - */ - - /** - * Constructs a new ValidatorHistoricalRewardsRecord. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a ValidatorHistoricalRewardsRecord. - * @implements IValidatorHistoricalRewardsRecord - * @constructor - * @param {cosmos.distribution.v1beta1.IValidatorHistoricalRewardsRecord=} [properties] Properties to set - */ - function ValidatorHistoricalRewardsRecord(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ValidatorHistoricalRewardsRecord validator_address. - * @member {string} validator_address - * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord - * @instance - */ - ValidatorHistoricalRewardsRecord.prototype.validator_address = ""; - - /** - * ValidatorHistoricalRewardsRecord period. - * @member {Long} period - * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord - * @instance - */ - ValidatorHistoricalRewardsRecord.prototype.period = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * ValidatorHistoricalRewardsRecord rewards. - * @member {cosmos.distribution.v1beta1.IValidatorHistoricalRewards|null|undefined} rewards - * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord - * @instance - */ - ValidatorHistoricalRewardsRecord.prototype.rewards = null; - - /** - * Encodes the specified ValidatorHistoricalRewardsRecord message. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord - * @static - * @param {cosmos.distribution.v1beta1.IValidatorHistoricalRewardsRecord} message ValidatorHistoricalRewardsRecord message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorHistoricalRewardsRecord.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.validator_address); - if (message.period != null && Object.hasOwnProperty.call(message, "period")) - writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.period); - if (message.rewards != null && Object.hasOwnProperty.call(message, "rewards")) - $root.cosmos.distribution.v1beta1.ValidatorHistoricalRewards.encode(message.rewards, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ValidatorHistoricalRewardsRecord message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord - * @static - * @param {cosmos.distribution.v1beta1.IValidatorHistoricalRewardsRecord} message ValidatorHistoricalRewardsRecord message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorHistoricalRewardsRecord.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ValidatorHistoricalRewardsRecord message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord} ValidatorHistoricalRewardsRecord - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorHistoricalRewardsRecord.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.validator_address = reader.string(); - break; - case 2: - message.period = reader.uint64(); - break; - case 3: - message.rewards = $root.cosmos.distribution.v1beta1.ValidatorHistoricalRewards.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ValidatorHistoricalRewardsRecord message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord} ValidatorHistoricalRewardsRecord - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorHistoricalRewardsRecord.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ValidatorHistoricalRewardsRecord message. - * @function verify - * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ValidatorHistoricalRewardsRecord.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - if (!$util.isString(message.validator_address)) - return "validator_address: string expected"; - if (message.period != null && message.hasOwnProperty("period")) - if (!$util.isInteger(message.period) && !(message.period && $util.isInteger(message.period.low) && $util.isInteger(message.period.high))) - return "period: integer|Long expected"; - if (message.rewards != null && message.hasOwnProperty("rewards")) { - let error = $root.cosmos.distribution.v1beta1.ValidatorHistoricalRewards.verify(message.rewards); - if (error) - return "rewards." + error; - } - return null; - }; - - /** - * Creates a ValidatorHistoricalRewardsRecord message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord} ValidatorHistoricalRewardsRecord - */ - ValidatorHistoricalRewardsRecord.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord) - return object; - let message = new $root.cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord(); - if (object.validator_address != null) - message.validator_address = String(object.validator_address); - if (object.period != null) - if ($util.Long) - (message.period = $util.Long.fromValue(object.period)).unsigned = true; - else if (typeof object.period === "string") - message.period = parseInt(object.period, 10); - else if (typeof object.period === "number") - message.period = object.period; - else if (typeof object.period === "object") - message.period = new $util.LongBits(object.period.low >>> 0, object.period.high >>> 0).toNumber(true); - if (object.rewards != null) { - if (typeof object.rewards !== "object") - throw TypeError(".cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord.rewards: object expected"); - message.rewards = $root.cosmos.distribution.v1beta1.ValidatorHistoricalRewards.fromObject(object.rewards); - } - return message; - }; - - /** - * Creates a plain object from a ValidatorHistoricalRewardsRecord message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord - * @static - * @param {cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord} message ValidatorHistoricalRewardsRecord - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ValidatorHistoricalRewardsRecord.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.validator_address = ""; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.period = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.period = options.longs === String ? "0" : 0; - object.rewards = null; - } - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - object.validator_address = message.validator_address; - if (message.period != null && message.hasOwnProperty("period")) - if (typeof message.period === "number") - object.period = options.longs === String ? String(message.period) : message.period; - else - object.period = options.longs === String ? $util.Long.prototype.toString.call(message.period) : options.longs === Number ? new $util.LongBits(message.period.low >>> 0, message.period.high >>> 0).toNumber(true) : message.period; - if (message.rewards != null && message.hasOwnProperty("rewards")) - object.rewards = $root.cosmos.distribution.v1beta1.ValidatorHistoricalRewards.toObject(message.rewards, options); - return object; - }; - - /** - * Converts this ValidatorHistoricalRewardsRecord to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord - * @instance - * @returns {Object.} JSON object - */ - ValidatorHistoricalRewardsRecord.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ValidatorHistoricalRewardsRecord; - })(); - - v1beta1.ValidatorCurrentRewardsRecord = (function() { - - /** - * Properties of a ValidatorCurrentRewardsRecord. - * @memberof cosmos.distribution.v1beta1 - * @interface IValidatorCurrentRewardsRecord - * @property {string|null} [validator_address] ValidatorCurrentRewardsRecord validator_address - * @property {cosmos.distribution.v1beta1.IValidatorCurrentRewards|null} [rewards] ValidatorCurrentRewardsRecord rewards - */ - - /** - * Constructs a new ValidatorCurrentRewardsRecord. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a ValidatorCurrentRewardsRecord. - * @implements IValidatorCurrentRewardsRecord - * @constructor - * @param {cosmos.distribution.v1beta1.IValidatorCurrentRewardsRecord=} [properties] Properties to set - */ - function ValidatorCurrentRewardsRecord(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ValidatorCurrentRewardsRecord validator_address. - * @member {string} validator_address - * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord - * @instance - */ - ValidatorCurrentRewardsRecord.prototype.validator_address = ""; - - /** - * ValidatorCurrentRewardsRecord rewards. - * @member {cosmos.distribution.v1beta1.IValidatorCurrentRewards|null|undefined} rewards - * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord - * @instance - */ - ValidatorCurrentRewardsRecord.prototype.rewards = null; - - /** - * Encodes the specified ValidatorCurrentRewardsRecord message. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord - * @static - * @param {cosmos.distribution.v1beta1.IValidatorCurrentRewardsRecord} message ValidatorCurrentRewardsRecord message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorCurrentRewardsRecord.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.validator_address); - if (message.rewards != null && Object.hasOwnProperty.call(message, "rewards")) - $root.cosmos.distribution.v1beta1.ValidatorCurrentRewards.encode(message.rewards, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ValidatorCurrentRewardsRecord message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord - * @static - * @param {cosmos.distribution.v1beta1.IValidatorCurrentRewardsRecord} message ValidatorCurrentRewardsRecord message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorCurrentRewardsRecord.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ValidatorCurrentRewardsRecord message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord} ValidatorCurrentRewardsRecord - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorCurrentRewardsRecord.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.validator_address = reader.string(); - break; - case 2: - message.rewards = $root.cosmos.distribution.v1beta1.ValidatorCurrentRewards.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ValidatorCurrentRewardsRecord message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord} ValidatorCurrentRewardsRecord - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorCurrentRewardsRecord.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ValidatorCurrentRewardsRecord message. - * @function verify - * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ValidatorCurrentRewardsRecord.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - if (!$util.isString(message.validator_address)) - return "validator_address: string expected"; - if (message.rewards != null && message.hasOwnProperty("rewards")) { - let error = $root.cosmos.distribution.v1beta1.ValidatorCurrentRewards.verify(message.rewards); - if (error) - return "rewards." + error; - } - return null; - }; - - /** - * Creates a ValidatorCurrentRewardsRecord message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord} ValidatorCurrentRewardsRecord - */ - ValidatorCurrentRewardsRecord.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord) - return object; - let message = new $root.cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord(); - if (object.validator_address != null) - message.validator_address = String(object.validator_address); - if (object.rewards != null) { - if (typeof object.rewards !== "object") - throw TypeError(".cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord.rewards: object expected"); - message.rewards = $root.cosmos.distribution.v1beta1.ValidatorCurrentRewards.fromObject(object.rewards); - } - return message; - }; - - /** - * Creates a plain object from a ValidatorCurrentRewardsRecord message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord - * @static - * @param {cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord} message ValidatorCurrentRewardsRecord - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ValidatorCurrentRewardsRecord.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.validator_address = ""; - object.rewards = null; - } - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - object.validator_address = message.validator_address; - if (message.rewards != null && message.hasOwnProperty("rewards")) - object.rewards = $root.cosmos.distribution.v1beta1.ValidatorCurrentRewards.toObject(message.rewards, options); - return object; - }; - - /** - * Converts this ValidatorCurrentRewardsRecord to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord - * @instance - * @returns {Object.} JSON object - */ - ValidatorCurrentRewardsRecord.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ValidatorCurrentRewardsRecord; - })(); - - v1beta1.DelegatorStartingInfoRecord = (function() { - - /** - * Properties of a DelegatorStartingInfoRecord. - * @memberof cosmos.distribution.v1beta1 - * @interface IDelegatorStartingInfoRecord - * @property {string|null} [delegator_address] DelegatorStartingInfoRecord delegator_address - * @property {string|null} [validator_address] DelegatorStartingInfoRecord validator_address - * @property {cosmos.distribution.v1beta1.IDelegatorStartingInfo|null} [starting_info] DelegatorStartingInfoRecord starting_info - */ - - /** - * Constructs a new DelegatorStartingInfoRecord. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a DelegatorStartingInfoRecord. - * @implements IDelegatorStartingInfoRecord - * @constructor - * @param {cosmos.distribution.v1beta1.IDelegatorStartingInfoRecord=} [properties] Properties to set - */ - function DelegatorStartingInfoRecord(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DelegatorStartingInfoRecord delegator_address. - * @member {string} delegator_address - * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfoRecord - * @instance - */ - DelegatorStartingInfoRecord.prototype.delegator_address = ""; - - /** - * DelegatorStartingInfoRecord validator_address. - * @member {string} validator_address - * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfoRecord - * @instance - */ - DelegatorStartingInfoRecord.prototype.validator_address = ""; - - /** - * DelegatorStartingInfoRecord starting_info. - * @member {cosmos.distribution.v1beta1.IDelegatorStartingInfo|null|undefined} starting_info - * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfoRecord - * @instance - */ - DelegatorStartingInfoRecord.prototype.starting_info = null; - - /** - * Encodes the specified DelegatorStartingInfoRecord message. Does not implicitly {@link cosmos.distribution.v1beta1.DelegatorStartingInfoRecord.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfoRecord - * @static - * @param {cosmos.distribution.v1beta1.IDelegatorStartingInfoRecord} message DelegatorStartingInfoRecord message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DelegatorStartingInfoRecord.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); - if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.validator_address); - if (message.starting_info != null && Object.hasOwnProperty.call(message, "starting_info")) - $root.cosmos.distribution.v1beta1.DelegatorStartingInfo.encode(message.starting_info, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified DelegatorStartingInfoRecord message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.DelegatorStartingInfoRecord.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfoRecord - * @static - * @param {cosmos.distribution.v1beta1.IDelegatorStartingInfoRecord} message DelegatorStartingInfoRecord message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DelegatorStartingInfoRecord.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DelegatorStartingInfoRecord message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfoRecord - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.DelegatorStartingInfoRecord} DelegatorStartingInfoRecord - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DelegatorStartingInfoRecord.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.DelegatorStartingInfoRecord(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.delegator_address = reader.string(); - break; - case 2: - message.validator_address = reader.string(); - break; - case 3: - message.starting_info = $root.cosmos.distribution.v1beta1.DelegatorStartingInfo.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DelegatorStartingInfoRecord message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfoRecord - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.DelegatorStartingInfoRecord} DelegatorStartingInfoRecord - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DelegatorStartingInfoRecord.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DelegatorStartingInfoRecord message. - * @function verify - * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfoRecord - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DelegatorStartingInfoRecord.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - if (!$util.isString(message.delegator_address)) - return "delegator_address: string expected"; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - if (!$util.isString(message.validator_address)) - return "validator_address: string expected"; - if (message.starting_info != null && message.hasOwnProperty("starting_info")) { - let error = $root.cosmos.distribution.v1beta1.DelegatorStartingInfo.verify(message.starting_info); - if (error) - return "starting_info." + error; - } - return null; - }; - - /** - * Creates a DelegatorStartingInfoRecord message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfoRecord - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.DelegatorStartingInfoRecord} DelegatorStartingInfoRecord - */ - DelegatorStartingInfoRecord.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.DelegatorStartingInfoRecord) - return object; - let message = new $root.cosmos.distribution.v1beta1.DelegatorStartingInfoRecord(); - if (object.delegator_address != null) - message.delegator_address = String(object.delegator_address); - if (object.validator_address != null) - message.validator_address = String(object.validator_address); - if (object.starting_info != null) { - if (typeof object.starting_info !== "object") - throw TypeError(".cosmos.distribution.v1beta1.DelegatorStartingInfoRecord.starting_info: object expected"); - message.starting_info = $root.cosmos.distribution.v1beta1.DelegatorStartingInfo.fromObject(object.starting_info); - } - return message; - }; - - /** - * Creates a plain object from a DelegatorStartingInfoRecord message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfoRecord - * @static - * @param {cosmos.distribution.v1beta1.DelegatorStartingInfoRecord} message DelegatorStartingInfoRecord - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DelegatorStartingInfoRecord.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.delegator_address = ""; - object.validator_address = ""; - object.starting_info = null; - } - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - object.delegator_address = message.delegator_address; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - object.validator_address = message.validator_address; - if (message.starting_info != null && message.hasOwnProperty("starting_info")) - object.starting_info = $root.cosmos.distribution.v1beta1.DelegatorStartingInfo.toObject(message.starting_info, options); - return object; - }; - - /** - * Converts this DelegatorStartingInfoRecord to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.DelegatorStartingInfoRecord - * @instance - * @returns {Object.} JSON object - */ - DelegatorStartingInfoRecord.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return DelegatorStartingInfoRecord; - })(); - - v1beta1.ValidatorSlashEventRecord = (function() { - - /** - * Properties of a ValidatorSlashEventRecord. - * @memberof cosmos.distribution.v1beta1 - * @interface IValidatorSlashEventRecord - * @property {string|null} [validator_address] ValidatorSlashEventRecord validator_address - * @property {Long|null} [height] ValidatorSlashEventRecord height - * @property {Long|null} [period] ValidatorSlashEventRecord period - * @property {cosmos.distribution.v1beta1.IValidatorSlashEvent|null} [validator_slash_event] ValidatorSlashEventRecord validator_slash_event - */ - - /** - * Constructs a new ValidatorSlashEventRecord. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a ValidatorSlashEventRecord. - * @implements IValidatorSlashEventRecord - * @constructor - * @param {cosmos.distribution.v1beta1.IValidatorSlashEventRecord=} [properties] Properties to set - */ - function ValidatorSlashEventRecord(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ValidatorSlashEventRecord validator_address. - * @member {string} validator_address - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEventRecord - * @instance - */ - ValidatorSlashEventRecord.prototype.validator_address = ""; - - /** - * ValidatorSlashEventRecord height. - * @member {Long} height - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEventRecord - * @instance - */ - ValidatorSlashEventRecord.prototype.height = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * ValidatorSlashEventRecord period. - * @member {Long} period - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEventRecord - * @instance - */ - ValidatorSlashEventRecord.prototype.period = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * ValidatorSlashEventRecord validator_slash_event. - * @member {cosmos.distribution.v1beta1.IValidatorSlashEvent|null|undefined} validator_slash_event - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEventRecord - * @instance - */ - ValidatorSlashEventRecord.prototype.validator_slash_event = null; - - /** - * Encodes the specified ValidatorSlashEventRecord message. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorSlashEventRecord.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEventRecord - * @static - * @param {cosmos.distribution.v1beta1.IValidatorSlashEventRecord} message ValidatorSlashEventRecord message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorSlashEventRecord.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.validator_address); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.height); - if (message.period != null && Object.hasOwnProperty.call(message, "period")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.period); - if (message.validator_slash_event != null && Object.hasOwnProperty.call(message, "validator_slash_event")) - $root.cosmos.distribution.v1beta1.ValidatorSlashEvent.encode(message.validator_slash_event, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ValidatorSlashEventRecord message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.ValidatorSlashEventRecord.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEventRecord - * @static - * @param {cosmos.distribution.v1beta1.IValidatorSlashEventRecord} message ValidatorSlashEventRecord message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorSlashEventRecord.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ValidatorSlashEventRecord message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEventRecord - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.ValidatorSlashEventRecord} ValidatorSlashEventRecord - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorSlashEventRecord.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.ValidatorSlashEventRecord(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.validator_address = reader.string(); - break; - case 2: - message.height = reader.uint64(); - break; - case 3: - message.period = reader.uint64(); - break; - case 4: - message.validator_slash_event = $root.cosmos.distribution.v1beta1.ValidatorSlashEvent.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ValidatorSlashEventRecord message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEventRecord - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.ValidatorSlashEventRecord} ValidatorSlashEventRecord - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorSlashEventRecord.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ValidatorSlashEventRecord message. - * @function verify - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEventRecord - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ValidatorSlashEventRecord.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - if (!$util.isString(message.validator_address)) - return "validator_address: string expected"; - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) - return "height: integer|Long expected"; - if (message.period != null && message.hasOwnProperty("period")) - if (!$util.isInteger(message.period) && !(message.period && $util.isInteger(message.period.low) && $util.isInteger(message.period.high))) - return "period: integer|Long expected"; - if (message.validator_slash_event != null && message.hasOwnProperty("validator_slash_event")) { - let error = $root.cosmos.distribution.v1beta1.ValidatorSlashEvent.verify(message.validator_slash_event); - if (error) - return "validator_slash_event." + error; - } - return null; - }; - - /** - * Creates a ValidatorSlashEventRecord message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEventRecord - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.ValidatorSlashEventRecord} ValidatorSlashEventRecord - */ - ValidatorSlashEventRecord.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.ValidatorSlashEventRecord) - return object; - let message = new $root.cosmos.distribution.v1beta1.ValidatorSlashEventRecord(); - if (object.validator_address != null) - message.validator_address = String(object.validator_address); - if (object.height != null) - if ($util.Long) - (message.height = $util.Long.fromValue(object.height)).unsigned = true; - else if (typeof object.height === "string") - message.height = parseInt(object.height, 10); - else if (typeof object.height === "number") - message.height = object.height; - else if (typeof object.height === "object") - message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(true); - if (object.period != null) - if ($util.Long) - (message.period = $util.Long.fromValue(object.period)).unsigned = true; - else if (typeof object.period === "string") - message.period = parseInt(object.period, 10); - else if (typeof object.period === "number") - message.period = object.period; - else if (typeof object.period === "object") - message.period = new $util.LongBits(object.period.low >>> 0, object.period.high >>> 0).toNumber(true); - if (object.validator_slash_event != null) { - if (typeof object.validator_slash_event !== "object") - throw TypeError(".cosmos.distribution.v1beta1.ValidatorSlashEventRecord.validator_slash_event: object expected"); - message.validator_slash_event = $root.cosmos.distribution.v1beta1.ValidatorSlashEvent.fromObject(object.validator_slash_event); - } - return message; - }; - - /** - * Creates a plain object from a ValidatorSlashEventRecord message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEventRecord - * @static - * @param {cosmos.distribution.v1beta1.ValidatorSlashEventRecord} message ValidatorSlashEventRecord - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ValidatorSlashEventRecord.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.validator_address = ""; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.height = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.period = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.period = options.longs === String ? "0" : 0; - object.validator_slash_event = null; - } - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - object.validator_address = message.validator_address; - if (message.height != null && message.hasOwnProperty("height")) - if (typeof message.height === "number") - object.height = options.longs === String ? String(message.height) : message.height; - else - object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber(true) : message.height; - if (message.period != null && message.hasOwnProperty("period")) - if (typeof message.period === "number") - object.period = options.longs === String ? String(message.period) : message.period; - else - object.period = options.longs === String ? $util.Long.prototype.toString.call(message.period) : options.longs === Number ? new $util.LongBits(message.period.low >>> 0, message.period.high >>> 0).toNumber(true) : message.period; - if (message.validator_slash_event != null && message.hasOwnProperty("validator_slash_event")) - object.validator_slash_event = $root.cosmos.distribution.v1beta1.ValidatorSlashEvent.toObject(message.validator_slash_event, options); - return object; - }; - - /** - * Converts this ValidatorSlashEventRecord to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.ValidatorSlashEventRecord - * @instance - * @returns {Object.} JSON object - */ - ValidatorSlashEventRecord.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ValidatorSlashEventRecord; - })(); - - v1beta1.GenesisState = (function() { - - /** - * Properties of a GenesisState. - * @memberof cosmos.distribution.v1beta1 - * @interface IGenesisState - * @property {cosmos.distribution.v1beta1.IParams|null} [params] GenesisState params - * @property {cosmos.distribution.v1beta1.IFeePool|null} [fee_pool] GenesisState fee_pool - * @property {Array.|null} [delegator_withdraw_infos] GenesisState delegator_withdraw_infos - * @property {string|null} [previous_proposer] GenesisState previous_proposer - * @property {Array.|null} [outstanding_rewards] GenesisState outstanding_rewards - * @property {Array.|null} [validator_accumulated_commissions] GenesisState validator_accumulated_commissions - * @property {Array.|null} [validator_historical_rewards] GenesisState validator_historical_rewards - * @property {Array.|null} [validator_current_rewards] GenesisState validator_current_rewards - * @property {Array.|null} [delegator_starting_infos] GenesisState delegator_starting_infos - * @property {Array.|null} [validator_slash_events] GenesisState validator_slash_events - */ - - /** - * Constructs a new GenesisState. - * @memberof cosmos.distribution.v1beta1 - * @classdesc Represents a GenesisState. - * @implements IGenesisState - * @constructor - * @param {cosmos.distribution.v1beta1.IGenesisState=} [properties] Properties to set - */ - function GenesisState(properties) { - this.delegator_withdraw_infos = []; - this.outstanding_rewards = []; - this.validator_accumulated_commissions = []; - this.validator_historical_rewards = []; - this.validator_current_rewards = []; - this.delegator_starting_infos = []; - this.validator_slash_events = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GenesisState params. - * @member {cosmos.distribution.v1beta1.IParams|null|undefined} params - * @memberof cosmos.distribution.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.params = null; - - /** - * GenesisState fee_pool. - * @member {cosmos.distribution.v1beta1.IFeePool|null|undefined} fee_pool - * @memberof cosmos.distribution.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.fee_pool = null; - - /** - * GenesisState delegator_withdraw_infos. - * @member {Array.} delegator_withdraw_infos - * @memberof cosmos.distribution.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.delegator_withdraw_infos = $util.emptyArray; - - /** - * GenesisState previous_proposer. - * @member {string} previous_proposer - * @memberof cosmos.distribution.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.previous_proposer = ""; - - /** - * GenesisState outstanding_rewards. - * @member {Array.} outstanding_rewards - * @memberof cosmos.distribution.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.outstanding_rewards = $util.emptyArray; - - /** - * GenesisState validator_accumulated_commissions. - * @member {Array.} validator_accumulated_commissions - * @memberof cosmos.distribution.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.validator_accumulated_commissions = $util.emptyArray; - - /** - * GenesisState validator_historical_rewards. - * @member {Array.} validator_historical_rewards - * @memberof cosmos.distribution.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.validator_historical_rewards = $util.emptyArray; - - /** - * GenesisState validator_current_rewards. - * @member {Array.} validator_current_rewards - * @memberof cosmos.distribution.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.validator_current_rewards = $util.emptyArray; - - /** - * GenesisState delegator_starting_infos. - * @member {Array.} delegator_starting_infos - * @memberof cosmos.distribution.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.delegator_starting_infos = $util.emptyArray; - - /** - * GenesisState validator_slash_events. - * @member {Array.} validator_slash_events - * @memberof cosmos.distribution.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.validator_slash_events = $util.emptyArray; - - /** - * Encodes the specified GenesisState message. Does not implicitly {@link cosmos.distribution.v1beta1.GenesisState.verify|verify} messages. - * @function encode - * @memberof cosmos.distribution.v1beta1.GenesisState - * @static - * @param {cosmos.distribution.v1beta1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.params != null && Object.hasOwnProperty.call(message, "params")) - $root.cosmos.distribution.v1beta1.Params.encode(message.params, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.fee_pool != null && Object.hasOwnProperty.call(message, "fee_pool")) - $root.cosmos.distribution.v1beta1.FeePool.encode(message.fee_pool, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.delegator_withdraw_infos != null && message.delegator_withdraw_infos.length) - for (let i = 0; i < message.delegator_withdraw_infos.length; ++i) - $root.cosmos.distribution.v1beta1.DelegatorWithdrawInfo.encode(message.delegator_withdraw_infos[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.previous_proposer != null && Object.hasOwnProperty.call(message, "previous_proposer")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.previous_proposer); - if (message.outstanding_rewards != null && message.outstanding_rewards.length) - for (let i = 0; i < message.outstanding_rewards.length; ++i) - $root.cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord.encode(message.outstanding_rewards[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.validator_accumulated_commissions != null && message.validator_accumulated_commissions.length) - for (let i = 0; i < message.validator_accumulated_commissions.length; ++i) - $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord.encode(message.validator_accumulated_commissions[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.validator_historical_rewards != null && message.validator_historical_rewards.length) - for (let i = 0; i < message.validator_historical_rewards.length; ++i) - $root.cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord.encode(message.validator_historical_rewards[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.validator_current_rewards != null && message.validator_current_rewards.length) - for (let i = 0; i < message.validator_current_rewards.length; ++i) - $root.cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord.encode(message.validator_current_rewards[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.delegator_starting_infos != null && message.delegator_starting_infos.length) - for (let i = 0; i < message.delegator_starting_infos.length; ++i) - $root.cosmos.distribution.v1beta1.DelegatorStartingInfoRecord.encode(message.delegator_starting_infos[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.validator_slash_events != null && message.validator_slash_events.length) - for (let i = 0; i < message.validator_slash_events.length; ++i) - $root.cosmos.distribution.v1beta1.ValidatorSlashEventRecord.encode(message.validator_slash_events[i], writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link cosmos.distribution.v1beta1.GenesisState.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.distribution.v1beta1.GenesisState - * @static - * @param {cosmos.distribution.v1beta1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer. - * @function decode - * @memberof cosmos.distribution.v1beta1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.distribution.v1beta1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.distribution.v1beta1.GenesisState(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.params = $root.cosmos.distribution.v1beta1.Params.decode(reader, reader.uint32()); - break; - case 2: - message.fee_pool = $root.cosmos.distribution.v1beta1.FeePool.decode(reader, reader.uint32()); - break; - case 3: - if (!(message.delegator_withdraw_infos && message.delegator_withdraw_infos.length)) - message.delegator_withdraw_infos = []; - message.delegator_withdraw_infos.push($root.cosmos.distribution.v1beta1.DelegatorWithdrawInfo.decode(reader, reader.uint32())); - break; - case 4: - message.previous_proposer = reader.string(); - break; - case 5: - if (!(message.outstanding_rewards && message.outstanding_rewards.length)) - message.outstanding_rewards = []; - message.outstanding_rewards.push($root.cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); - break; - case 6: - if (!(message.validator_accumulated_commissions && message.validator_accumulated_commissions.length)) - message.validator_accumulated_commissions = []; - message.validator_accumulated_commissions.push($root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32())); - break; - case 7: - if (!(message.validator_historical_rewards && message.validator_historical_rewards.length)) - message.validator_historical_rewards = []; - message.validator_historical_rewards.push($root.cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); - break; - case 8: - if (!(message.validator_current_rewards && message.validator_current_rewards.length)) - message.validator_current_rewards = []; - message.validator_current_rewards.push($root.cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); - break; - case 9: - if (!(message.delegator_starting_infos && message.delegator_starting_infos.length)) - message.delegator_starting_infos = []; - message.delegator_starting_infos.push($root.cosmos.distribution.v1beta1.DelegatorStartingInfoRecord.decode(reader, reader.uint32())); - break; - case 10: - if (!(message.validator_slash_events && message.validator_slash_events.length)) - message.validator_slash_events = []; - message.validator_slash_events.push($root.cosmos.distribution.v1beta1.ValidatorSlashEventRecord.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.distribution.v1beta1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.distribution.v1beta1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GenesisState message. - * @function verify - * @memberof cosmos.distribution.v1beta1.GenesisState - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GenesisState.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.params != null && message.hasOwnProperty("params")) { - let error = $root.cosmos.distribution.v1beta1.Params.verify(message.params); - if (error) - return "params." + error; - } - if (message.fee_pool != null && message.hasOwnProperty("fee_pool")) { - let error = $root.cosmos.distribution.v1beta1.FeePool.verify(message.fee_pool); - if (error) - return "fee_pool." + error; - } - if (message.delegator_withdraw_infos != null && message.hasOwnProperty("delegator_withdraw_infos")) { - if (!Array.isArray(message.delegator_withdraw_infos)) - return "delegator_withdraw_infos: array expected"; - for (let i = 0; i < message.delegator_withdraw_infos.length; ++i) { - let error = $root.cosmos.distribution.v1beta1.DelegatorWithdrawInfo.verify(message.delegator_withdraw_infos[i]); - if (error) - return "delegator_withdraw_infos." + error; - } - } - if (message.previous_proposer != null && message.hasOwnProperty("previous_proposer")) - if (!$util.isString(message.previous_proposer)) - return "previous_proposer: string expected"; - if (message.outstanding_rewards != null && message.hasOwnProperty("outstanding_rewards")) { - if (!Array.isArray(message.outstanding_rewards)) - return "outstanding_rewards: array expected"; - for (let i = 0; i < message.outstanding_rewards.length; ++i) { - let error = $root.cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord.verify(message.outstanding_rewards[i]); - if (error) - return "outstanding_rewards." + error; - } - } - if (message.validator_accumulated_commissions != null && message.hasOwnProperty("validator_accumulated_commissions")) { - if (!Array.isArray(message.validator_accumulated_commissions)) - return "validator_accumulated_commissions: array expected"; - for (let i = 0; i < message.validator_accumulated_commissions.length; ++i) { - let error = $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord.verify(message.validator_accumulated_commissions[i]); - if (error) - return "validator_accumulated_commissions." + error; - } - } - if (message.validator_historical_rewards != null && message.hasOwnProperty("validator_historical_rewards")) { - if (!Array.isArray(message.validator_historical_rewards)) - return "validator_historical_rewards: array expected"; - for (let i = 0; i < message.validator_historical_rewards.length; ++i) { - let error = $root.cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord.verify(message.validator_historical_rewards[i]); - if (error) - return "validator_historical_rewards." + error; - } - } - if (message.validator_current_rewards != null && message.hasOwnProperty("validator_current_rewards")) { - if (!Array.isArray(message.validator_current_rewards)) - return "validator_current_rewards: array expected"; - for (let i = 0; i < message.validator_current_rewards.length; ++i) { - let error = $root.cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord.verify(message.validator_current_rewards[i]); - if (error) - return "validator_current_rewards." + error; - } - } - if (message.delegator_starting_infos != null && message.hasOwnProperty("delegator_starting_infos")) { - if (!Array.isArray(message.delegator_starting_infos)) - return "delegator_starting_infos: array expected"; - for (let i = 0; i < message.delegator_starting_infos.length; ++i) { - let error = $root.cosmos.distribution.v1beta1.DelegatorStartingInfoRecord.verify(message.delegator_starting_infos[i]); - if (error) - return "delegator_starting_infos." + error; - } - } - if (message.validator_slash_events != null && message.hasOwnProperty("validator_slash_events")) { - if (!Array.isArray(message.validator_slash_events)) - return "validator_slash_events: array expected"; - for (let i = 0; i < message.validator_slash_events.length; ++i) { - let error = $root.cosmos.distribution.v1beta1.ValidatorSlashEventRecord.verify(message.validator_slash_events[i]); - if (error) - return "validator_slash_events." + error; - } - } - return null; - }; - - /** - * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.distribution.v1beta1.GenesisState - * @static - * @param {Object.} object Plain object - * @returns {cosmos.distribution.v1beta1.GenesisState} GenesisState - */ - GenesisState.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.distribution.v1beta1.GenesisState) - return object; - let message = new $root.cosmos.distribution.v1beta1.GenesisState(); - if (object.params != null) { - if (typeof object.params !== "object") - throw TypeError(".cosmos.distribution.v1beta1.GenesisState.params: object expected"); - message.params = $root.cosmos.distribution.v1beta1.Params.fromObject(object.params); - } - if (object.fee_pool != null) { - if (typeof object.fee_pool !== "object") - throw TypeError(".cosmos.distribution.v1beta1.GenesisState.fee_pool: object expected"); - message.fee_pool = $root.cosmos.distribution.v1beta1.FeePool.fromObject(object.fee_pool); - } - if (object.delegator_withdraw_infos) { - if (!Array.isArray(object.delegator_withdraw_infos)) - throw TypeError(".cosmos.distribution.v1beta1.GenesisState.delegator_withdraw_infos: array expected"); - message.delegator_withdraw_infos = []; - for (let i = 0; i < object.delegator_withdraw_infos.length; ++i) { - if (typeof object.delegator_withdraw_infos[i] !== "object") - throw TypeError(".cosmos.distribution.v1beta1.GenesisState.delegator_withdraw_infos: object expected"); - message.delegator_withdraw_infos[i] = $root.cosmos.distribution.v1beta1.DelegatorWithdrawInfo.fromObject(object.delegator_withdraw_infos[i]); - } - } - if (object.previous_proposer != null) - message.previous_proposer = String(object.previous_proposer); - if (object.outstanding_rewards) { - if (!Array.isArray(object.outstanding_rewards)) - throw TypeError(".cosmos.distribution.v1beta1.GenesisState.outstanding_rewards: array expected"); - message.outstanding_rewards = []; - for (let i = 0; i < object.outstanding_rewards.length; ++i) { - if (typeof object.outstanding_rewards[i] !== "object") - throw TypeError(".cosmos.distribution.v1beta1.GenesisState.outstanding_rewards: object expected"); - message.outstanding_rewards[i] = $root.cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord.fromObject(object.outstanding_rewards[i]); - } - } - if (object.validator_accumulated_commissions) { - if (!Array.isArray(object.validator_accumulated_commissions)) - throw TypeError(".cosmos.distribution.v1beta1.GenesisState.validator_accumulated_commissions: array expected"); - message.validator_accumulated_commissions = []; - for (let i = 0; i < object.validator_accumulated_commissions.length; ++i) { - if (typeof object.validator_accumulated_commissions[i] !== "object") - throw TypeError(".cosmos.distribution.v1beta1.GenesisState.validator_accumulated_commissions: object expected"); - message.validator_accumulated_commissions[i] = $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord.fromObject(object.validator_accumulated_commissions[i]); - } - } - if (object.validator_historical_rewards) { - if (!Array.isArray(object.validator_historical_rewards)) - throw TypeError(".cosmos.distribution.v1beta1.GenesisState.validator_historical_rewards: array expected"); - message.validator_historical_rewards = []; - for (let i = 0; i < object.validator_historical_rewards.length; ++i) { - if (typeof object.validator_historical_rewards[i] !== "object") - throw TypeError(".cosmos.distribution.v1beta1.GenesisState.validator_historical_rewards: object expected"); - message.validator_historical_rewards[i] = $root.cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord.fromObject(object.validator_historical_rewards[i]); - } - } - if (object.validator_current_rewards) { - if (!Array.isArray(object.validator_current_rewards)) - throw TypeError(".cosmos.distribution.v1beta1.GenesisState.validator_current_rewards: array expected"); - message.validator_current_rewards = []; - for (let i = 0; i < object.validator_current_rewards.length; ++i) { - if (typeof object.validator_current_rewards[i] !== "object") - throw TypeError(".cosmos.distribution.v1beta1.GenesisState.validator_current_rewards: object expected"); - message.validator_current_rewards[i] = $root.cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord.fromObject(object.validator_current_rewards[i]); - } - } - if (object.delegator_starting_infos) { - if (!Array.isArray(object.delegator_starting_infos)) - throw TypeError(".cosmos.distribution.v1beta1.GenesisState.delegator_starting_infos: array expected"); - message.delegator_starting_infos = []; - for (let i = 0; i < object.delegator_starting_infos.length; ++i) { - if (typeof object.delegator_starting_infos[i] !== "object") - throw TypeError(".cosmos.distribution.v1beta1.GenesisState.delegator_starting_infos: object expected"); - message.delegator_starting_infos[i] = $root.cosmos.distribution.v1beta1.DelegatorStartingInfoRecord.fromObject(object.delegator_starting_infos[i]); - } - } - if (object.validator_slash_events) { - if (!Array.isArray(object.validator_slash_events)) - throw TypeError(".cosmos.distribution.v1beta1.GenesisState.validator_slash_events: array expected"); - message.validator_slash_events = []; - for (let i = 0; i < object.validator_slash_events.length; ++i) { - if (typeof object.validator_slash_events[i] !== "object") - throw TypeError(".cosmos.distribution.v1beta1.GenesisState.validator_slash_events: object expected"); - message.validator_slash_events[i] = $root.cosmos.distribution.v1beta1.ValidatorSlashEventRecord.fromObject(object.validator_slash_events[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a GenesisState message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.distribution.v1beta1.GenesisState - * @static - * @param {cosmos.distribution.v1beta1.GenesisState} message GenesisState - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GenesisState.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) { - object.delegator_withdraw_infos = []; - object.outstanding_rewards = []; - object.validator_accumulated_commissions = []; - object.validator_historical_rewards = []; - object.validator_current_rewards = []; - object.delegator_starting_infos = []; - object.validator_slash_events = []; - } - if (options.defaults) { - object.params = null; - object.fee_pool = null; - object.previous_proposer = ""; - } - if (message.params != null && message.hasOwnProperty("params")) - object.params = $root.cosmos.distribution.v1beta1.Params.toObject(message.params, options); - if (message.fee_pool != null && message.hasOwnProperty("fee_pool")) - object.fee_pool = $root.cosmos.distribution.v1beta1.FeePool.toObject(message.fee_pool, options); - if (message.delegator_withdraw_infos && message.delegator_withdraw_infos.length) { - object.delegator_withdraw_infos = []; - for (let j = 0; j < message.delegator_withdraw_infos.length; ++j) - object.delegator_withdraw_infos[j] = $root.cosmos.distribution.v1beta1.DelegatorWithdrawInfo.toObject(message.delegator_withdraw_infos[j], options); - } - if (message.previous_proposer != null && message.hasOwnProperty("previous_proposer")) - object.previous_proposer = message.previous_proposer; - if (message.outstanding_rewards && message.outstanding_rewards.length) { - object.outstanding_rewards = []; - for (let j = 0; j < message.outstanding_rewards.length; ++j) - object.outstanding_rewards[j] = $root.cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord.toObject(message.outstanding_rewards[j], options); - } - if (message.validator_accumulated_commissions && message.validator_accumulated_commissions.length) { - object.validator_accumulated_commissions = []; - for (let j = 0; j < message.validator_accumulated_commissions.length; ++j) - object.validator_accumulated_commissions[j] = $root.cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord.toObject(message.validator_accumulated_commissions[j], options); - } - if (message.validator_historical_rewards && message.validator_historical_rewards.length) { - object.validator_historical_rewards = []; - for (let j = 0; j < message.validator_historical_rewards.length; ++j) - object.validator_historical_rewards[j] = $root.cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord.toObject(message.validator_historical_rewards[j], options); - } - if (message.validator_current_rewards && message.validator_current_rewards.length) { - object.validator_current_rewards = []; - for (let j = 0; j < message.validator_current_rewards.length; ++j) - object.validator_current_rewards[j] = $root.cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord.toObject(message.validator_current_rewards[j], options); - } - if (message.delegator_starting_infos && message.delegator_starting_infos.length) { - object.delegator_starting_infos = []; - for (let j = 0; j < message.delegator_starting_infos.length; ++j) - object.delegator_starting_infos[j] = $root.cosmos.distribution.v1beta1.DelegatorStartingInfoRecord.toObject(message.delegator_starting_infos[j], options); - } - if (message.validator_slash_events && message.validator_slash_events.length) { - object.validator_slash_events = []; - for (let j = 0; j < message.validator_slash_events.length; ++j) - object.validator_slash_events[j] = $root.cosmos.distribution.v1beta1.ValidatorSlashEventRecord.toObject(message.validator_slash_events[j], options); - } - return object; - }; - - /** - * Converts this GenesisState to JSON. - * @function toJSON - * @memberof cosmos.distribution.v1beta1.GenesisState - * @instance - * @returns {Object.} JSON object - */ - GenesisState.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GenesisState; - })(); - - return v1beta1; - })(); - - return distribution; - })(); - - cosmos.evidence = (function() { - - /** - * Namespace evidence. - * @memberof cosmos - * @namespace - */ - const evidence = {}; - - evidence.v1beta1 = (function() { - - /** - * Namespace v1beta1. - * @memberof cosmos.evidence - * @namespace - */ - const v1beta1 = {}; - - v1beta1.Msg = (function() { - - /** - * Constructs a new Msg service. - * @memberof cosmos.evidence.v1beta1 - * @classdesc Represents a Msg - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function Msg(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Msg.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Msg; - - /** - * Callback as used by {@link cosmos.evidence.v1beta1.Msg#submitEvidence}. - * @memberof cosmos.evidence.v1beta1.Msg - * @typedef SubmitEvidenceCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse} [response] MsgSubmitEvidenceResponse - */ - - /** - * Calls SubmitEvidence. - * @function submitEvidence - * @memberof cosmos.evidence.v1beta1.Msg - * @instance - * @param {cosmos.evidence.v1beta1.IMsgSubmitEvidence} request MsgSubmitEvidence message or plain object - * @param {cosmos.evidence.v1beta1.Msg.SubmitEvidenceCallback} callback Node-style callback called with the error, if any, and MsgSubmitEvidenceResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.submitEvidence = function submitEvidence(request, callback) { - return this.rpcCall(submitEvidence, $root.cosmos.evidence.v1beta1.MsgSubmitEvidence, $root.cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse, request, callback); - }, "name", { value: "SubmitEvidence" }); - - /** - * Calls SubmitEvidence. - * @function submitEvidence - * @memberof cosmos.evidence.v1beta1.Msg - * @instance - * @param {cosmos.evidence.v1beta1.IMsgSubmitEvidence} request MsgSubmitEvidence message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return Msg; - })(); - - v1beta1.MsgSubmitEvidence = (function() { - - /** - * Properties of a MsgSubmitEvidence. - * @memberof cosmos.evidence.v1beta1 - * @interface IMsgSubmitEvidence - * @property {string|null} [submitter] MsgSubmitEvidence submitter - * @property {google.protobuf.IAny|null} [evidence] MsgSubmitEvidence evidence - */ - - /** - * Constructs a new MsgSubmitEvidence. - * @memberof cosmos.evidence.v1beta1 - * @classdesc Represents a MsgSubmitEvidence. - * @implements IMsgSubmitEvidence - * @constructor - * @param {cosmos.evidence.v1beta1.IMsgSubmitEvidence=} [properties] Properties to set - */ - function MsgSubmitEvidence(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgSubmitEvidence submitter. - * @member {string} submitter - * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidence - * @instance - */ - MsgSubmitEvidence.prototype.submitter = ""; - - /** - * MsgSubmitEvidence evidence. - * @member {google.protobuf.IAny|null|undefined} evidence - * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidence - * @instance - */ - MsgSubmitEvidence.prototype.evidence = null; - - /** - * Encodes the specified MsgSubmitEvidence message. Does not implicitly {@link cosmos.evidence.v1beta1.MsgSubmitEvidence.verify|verify} messages. - * @function encode - * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidence - * @static - * @param {cosmos.evidence.v1beta1.IMsgSubmitEvidence} message MsgSubmitEvidence message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgSubmitEvidence.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.submitter != null && Object.hasOwnProperty.call(message, "submitter")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.submitter); - if (message.evidence != null && Object.hasOwnProperty.call(message, "evidence")) - $root.google.protobuf.Any.encode(message.evidence, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified MsgSubmitEvidence message, length delimited. Does not implicitly {@link cosmos.evidence.v1beta1.MsgSubmitEvidence.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidence - * @static - * @param {cosmos.evidence.v1beta1.IMsgSubmitEvidence} message MsgSubmitEvidence message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgSubmitEvidence.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgSubmitEvidence message from the specified reader or buffer. - * @function decode - * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidence - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.evidence.v1beta1.MsgSubmitEvidence} MsgSubmitEvidence - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgSubmitEvidence.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.evidence.v1beta1.MsgSubmitEvidence(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.submitter = reader.string(); - break; - case 2: - message.evidence = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgSubmitEvidence message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidence - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.evidence.v1beta1.MsgSubmitEvidence} MsgSubmitEvidence - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgSubmitEvidence.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgSubmitEvidence message. - * @function verify - * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidence - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgSubmitEvidence.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.submitter != null && message.hasOwnProperty("submitter")) - if (!$util.isString(message.submitter)) - return "submitter: string expected"; - if (message.evidence != null && message.hasOwnProperty("evidence")) { - let error = $root.google.protobuf.Any.verify(message.evidence); - if (error) - return "evidence." + error; - } - return null; - }; - - /** - * Creates a MsgSubmitEvidence message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidence - * @static - * @param {Object.} object Plain object - * @returns {cosmos.evidence.v1beta1.MsgSubmitEvidence} MsgSubmitEvidence - */ - MsgSubmitEvidence.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.evidence.v1beta1.MsgSubmitEvidence) - return object; - let message = new $root.cosmos.evidence.v1beta1.MsgSubmitEvidence(); - if (object.submitter != null) - message.submitter = String(object.submitter); - if (object.evidence != null) { - if (typeof object.evidence !== "object") - throw TypeError(".cosmos.evidence.v1beta1.MsgSubmitEvidence.evidence: object expected"); - message.evidence = $root.google.protobuf.Any.fromObject(object.evidence); - } - return message; - }; - - /** - * Creates a plain object from a MsgSubmitEvidence message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidence - * @static - * @param {cosmos.evidence.v1beta1.MsgSubmitEvidence} message MsgSubmitEvidence - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgSubmitEvidence.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.submitter = ""; - object.evidence = null; - } - if (message.submitter != null && message.hasOwnProperty("submitter")) - object.submitter = message.submitter; - if (message.evidence != null && message.hasOwnProperty("evidence")) - object.evidence = $root.google.protobuf.Any.toObject(message.evidence, options); - return object; - }; - - /** - * Converts this MsgSubmitEvidence to JSON. - * @function toJSON - * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidence - * @instance - * @returns {Object.} JSON object - */ - MsgSubmitEvidence.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgSubmitEvidence; - })(); - - v1beta1.MsgSubmitEvidenceResponse = (function() { - - /** - * Properties of a MsgSubmitEvidenceResponse. - * @memberof cosmos.evidence.v1beta1 - * @interface IMsgSubmitEvidenceResponse - * @property {Uint8Array|null} [hash] MsgSubmitEvidenceResponse hash - */ - - /** - * Constructs a new MsgSubmitEvidenceResponse. - * @memberof cosmos.evidence.v1beta1 - * @classdesc Represents a MsgSubmitEvidenceResponse. - * @implements IMsgSubmitEvidenceResponse - * @constructor - * @param {cosmos.evidence.v1beta1.IMsgSubmitEvidenceResponse=} [properties] Properties to set - */ - function MsgSubmitEvidenceResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgSubmitEvidenceResponse hash. - * @member {Uint8Array} hash - * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse - * @instance - */ - MsgSubmitEvidenceResponse.prototype.hash = $util.newBuffer([]); - - /** - * Encodes the specified MsgSubmitEvidenceResponse message. Does not implicitly {@link cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse - * @static - * @param {cosmos.evidence.v1beta1.IMsgSubmitEvidenceResponse} message MsgSubmitEvidenceResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgSubmitEvidenceResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.hash != null && Object.hasOwnProperty.call(message, "hash")) - writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.hash); - return writer; - }; - - /** - * Encodes the specified MsgSubmitEvidenceResponse message, length delimited. Does not implicitly {@link cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse - * @static - * @param {cosmos.evidence.v1beta1.IMsgSubmitEvidenceResponse} message MsgSubmitEvidenceResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgSubmitEvidenceResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgSubmitEvidenceResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse} MsgSubmitEvidenceResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgSubmitEvidenceResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 4: - message.hash = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgSubmitEvidenceResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse} MsgSubmitEvidenceResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgSubmitEvidenceResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgSubmitEvidenceResponse message. - * @function verify - * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgSubmitEvidenceResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.hash != null && message.hasOwnProperty("hash")) - if (!(message.hash && typeof message.hash.length === "number" || $util.isString(message.hash))) - return "hash: buffer expected"; - return null; - }; - - /** - * Creates a MsgSubmitEvidenceResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse} MsgSubmitEvidenceResponse - */ - MsgSubmitEvidenceResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse) - return object; - let message = new $root.cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse(); - if (object.hash != null) - if (typeof object.hash === "string") - $util.base64.decode(object.hash, message.hash = $util.newBuffer($util.base64.length(object.hash)), 0); - else if (object.hash.length) - message.hash = object.hash; - return message; - }; - - /** - * Creates a plain object from a MsgSubmitEvidenceResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse - * @static - * @param {cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse} message MsgSubmitEvidenceResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgSubmitEvidenceResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - if (options.bytes === String) - object.hash = ""; - else { - object.hash = []; - if (options.bytes !== Array) - object.hash = $util.newBuffer(object.hash); - } - if (message.hash != null && message.hasOwnProperty("hash")) - object.hash = options.bytes === String ? $util.base64.encode(message.hash, 0, message.hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.hash) : message.hash; - return object; - }; - - /** - * Converts this MsgSubmitEvidenceResponse to JSON. - * @function toJSON - * @memberof cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse - * @instance - * @returns {Object.} JSON object - */ - MsgSubmitEvidenceResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgSubmitEvidenceResponse; - })(); - - v1beta1.Equivocation = (function() { - - /** - * Properties of an Equivocation. - * @memberof cosmos.evidence.v1beta1 - * @interface IEquivocation - * @property {Long|null} [height] Equivocation height - * @property {google.protobuf.ITimestamp|null} [time] Equivocation time - * @property {Long|null} [power] Equivocation power - * @property {string|null} [consensus_address] Equivocation consensus_address - */ - - /** - * Constructs a new Equivocation. - * @memberof cosmos.evidence.v1beta1 - * @classdesc Represents an Equivocation. - * @implements IEquivocation - * @constructor - * @param {cosmos.evidence.v1beta1.IEquivocation=} [properties] Properties to set - */ - function Equivocation(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Equivocation height. - * @member {Long} height - * @memberof cosmos.evidence.v1beta1.Equivocation - * @instance - */ - Equivocation.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Equivocation time. - * @member {google.protobuf.ITimestamp|null|undefined} time - * @memberof cosmos.evidence.v1beta1.Equivocation - * @instance - */ - Equivocation.prototype.time = null; - - /** - * Equivocation power. - * @member {Long} power - * @memberof cosmos.evidence.v1beta1.Equivocation - * @instance - */ - Equivocation.prototype.power = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Equivocation consensus_address. - * @member {string} consensus_address - * @memberof cosmos.evidence.v1beta1.Equivocation - * @instance - */ - Equivocation.prototype.consensus_address = ""; - - /** - * Encodes the specified Equivocation message. Does not implicitly {@link cosmos.evidence.v1beta1.Equivocation.verify|verify} messages. - * @function encode - * @memberof cosmos.evidence.v1beta1.Equivocation - * @static - * @param {cosmos.evidence.v1beta1.IEquivocation} message Equivocation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Equivocation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.height); - if (message.time != null && Object.hasOwnProperty.call(message, "time")) - $root.google.protobuf.Timestamp.encode(message.time, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.power != null && Object.hasOwnProperty.call(message, "power")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.power); - if (message.consensus_address != null && Object.hasOwnProperty.call(message, "consensus_address")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.consensus_address); - return writer; - }; - - /** - * Encodes the specified Equivocation message, length delimited. Does not implicitly {@link cosmos.evidence.v1beta1.Equivocation.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.evidence.v1beta1.Equivocation - * @static - * @param {cosmos.evidence.v1beta1.IEquivocation} message Equivocation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Equivocation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Equivocation message from the specified reader or buffer. - * @function decode - * @memberof cosmos.evidence.v1beta1.Equivocation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.evidence.v1beta1.Equivocation} Equivocation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Equivocation.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.evidence.v1beta1.Equivocation(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.height = reader.int64(); - break; - case 2: - message.time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 3: - message.power = reader.int64(); - break; - case 4: - message.consensus_address = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Equivocation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.evidence.v1beta1.Equivocation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.evidence.v1beta1.Equivocation} Equivocation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Equivocation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Equivocation message. - * @function verify - * @memberof cosmos.evidence.v1beta1.Equivocation - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Equivocation.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) - return "height: integer|Long expected"; - if (message.time != null && message.hasOwnProperty("time")) { - let error = $root.google.protobuf.Timestamp.verify(message.time); - if (error) - return "time." + error; - } - if (message.power != null && message.hasOwnProperty("power")) - if (!$util.isInteger(message.power) && !(message.power && $util.isInteger(message.power.low) && $util.isInteger(message.power.high))) - return "power: integer|Long expected"; - if (message.consensus_address != null && message.hasOwnProperty("consensus_address")) - if (!$util.isString(message.consensus_address)) - return "consensus_address: string expected"; - return null; - }; - - /** - * Creates an Equivocation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.evidence.v1beta1.Equivocation - * @static - * @param {Object.} object Plain object - * @returns {cosmos.evidence.v1beta1.Equivocation} Equivocation - */ - Equivocation.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.evidence.v1beta1.Equivocation) - return object; - let message = new $root.cosmos.evidence.v1beta1.Equivocation(); - if (object.height != null) - if ($util.Long) - (message.height = $util.Long.fromValue(object.height)).unsigned = false; - else if (typeof object.height === "string") - message.height = parseInt(object.height, 10); - else if (typeof object.height === "number") - message.height = object.height; - else if (typeof object.height === "object") - message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); - if (object.time != null) { - if (typeof object.time !== "object") - throw TypeError(".cosmos.evidence.v1beta1.Equivocation.time: object expected"); - message.time = $root.google.protobuf.Timestamp.fromObject(object.time); - } - if (object.power != null) - if ($util.Long) - (message.power = $util.Long.fromValue(object.power)).unsigned = false; - else if (typeof object.power === "string") - message.power = parseInt(object.power, 10); - else if (typeof object.power === "number") - message.power = object.power; - else if (typeof object.power === "object") - message.power = new $util.LongBits(object.power.low >>> 0, object.power.high >>> 0).toNumber(); - if (object.consensus_address != null) - message.consensus_address = String(object.consensus_address); - return message; - }; - - /** - * Creates a plain object from an Equivocation message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.evidence.v1beta1.Equivocation - * @static - * @param {cosmos.evidence.v1beta1.Equivocation} message Equivocation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Equivocation.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.height = options.longs === String ? "0" : 0; - object.time = null; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.power = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.power = options.longs === String ? "0" : 0; - object.consensus_address = ""; - } - if (message.height != null && message.hasOwnProperty("height")) - if (typeof message.height === "number") - object.height = options.longs === String ? String(message.height) : message.height; - else - object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; - if (message.time != null && message.hasOwnProperty("time")) - object.time = $root.google.protobuf.Timestamp.toObject(message.time, options); - if (message.power != null && message.hasOwnProperty("power")) - if (typeof message.power === "number") - object.power = options.longs === String ? String(message.power) : message.power; - else - object.power = options.longs === String ? $util.Long.prototype.toString.call(message.power) : options.longs === Number ? new $util.LongBits(message.power.low >>> 0, message.power.high >>> 0).toNumber() : message.power; - if (message.consensus_address != null && message.hasOwnProperty("consensus_address")) - object.consensus_address = message.consensus_address; - return object; - }; - - /** - * Converts this Equivocation to JSON. - * @function toJSON - * @memberof cosmos.evidence.v1beta1.Equivocation - * @instance - * @returns {Object.} JSON object - */ - Equivocation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Equivocation; - })(); - - v1beta1.Query = (function() { - - /** - * Constructs a new Query service. - * @memberof cosmos.evidence.v1beta1 - * @classdesc Represents a Query - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function Query(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Query.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Query; - - /** - * Callback as used by {@link cosmos.evidence.v1beta1.Query#evidence}. - * @memberof cosmos.evidence.v1beta1.Query - * @typedef EvidenceCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.evidence.v1beta1.QueryEvidenceResponse} [response] QueryEvidenceResponse - */ - - /** - * Calls Evidence. - * @function evidence - * @memberof cosmos.evidence.v1beta1.Query - * @instance - * @param {cosmos.evidence.v1beta1.IQueryEvidenceRequest} request QueryEvidenceRequest message or plain object - * @param {cosmos.evidence.v1beta1.Query.EvidenceCallback} callback Node-style callback called with the error, if any, and QueryEvidenceResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.evidence = function evidence(request, callback) { - return this.rpcCall(evidence, $root.cosmos.evidence.v1beta1.QueryEvidenceRequest, $root.cosmos.evidence.v1beta1.QueryEvidenceResponse, request, callback); - }, "name", { value: "Evidence" }); - - /** - * Calls Evidence. - * @function evidence - * @memberof cosmos.evidence.v1beta1.Query - * @instance - * @param {cosmos.evidence.v1beta1.IQueryEvidenceRequest} request QueryEvidenceRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.evidence.v1beta1.Query#allEvidence}. - * @memberof cosmos.evidence.v1beta1.Query - * @typedef AllEvidenceCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.evidence.v1beta1.QueryAllEvidenceResponse} [response] QueryAllEvidenceResponse - */ - - /** - * Calls AllEvidence. - * @function allEvidence - * @memberof cosmos.evidence.v1beta1.Query - * @instance - * @param {cosmos.evidence.v1beta1.IQueryAllEvidenceRequest} request QueryAllEvidenceRequest message or plain object - * @param {cosmos.evidence.v1beta1.Query.AllEvidenceCallback} callback Node-style callback called with the error, if any, and QueryAllEvidenceResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.allEvidence = function allEvidence(request, callback) { - return this.rpcCall(allEvidence, $root.cosmos.evidence.v1beta1.QueryAllEvidenceRequest, $root.cosmos.evidence.v1beta1.QueryAllEvidenceResponse, request, callback); - }, "name", { value: "AllEvidence" }); - - /** - * Calls AllEvidence. - * @function allEvidence - * @memberof cosmos.evidence.v1beta1.Query - * @instance - * @param {cosmos.evidence.v1beta1.IQueryAllEvidenceRequest} request QueryAllEvidenceRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return Query; - })(); - - v1beta1.QueryEvidenceRequest = (function() { - - /** - * Properties of a QueryEvidenceRequest. - * @memberof cosmos.evidence.v1beta1 - * @interface IQueryEvidenceRequest - * @property {Uint8Array|null} [evidence_hash] QueryEvidenceRequest evidence_hash - */ - - /** - * Constructs a new QueryEvidenceRequest. - * @memberof cosmos.evidence.v1beta1 - * @classdesc Represents a QueryEvidenceRequest. - * @implements IQueryEvidenceRequest - * @constructor - * @param {cosmos.evidence.v1beta1.IQueryEvidenceRequest=} [properties] Properties to set - */ - function QueryEvidenceRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryEvidenceRequest evidence_hash. - * @member {Uint8Array} evidence_hash - * @memberof cosmos.evidence.v1beta1.QueryEvidenceRequest - * @instance - */ - QueryEvidenceRequest.prototype.evidence_hash = $util.newBuffer([]); - - /** - * Encodes the specified QueryEvidenceRequest message. Does not implicitly {@link cosmos.evidence.v1beta1.QueryEvidenceRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.evidence.v1beta1.QueryEvidenceRequest - * @static - * @param {cosmos.evidence.v1beta1.IQueryEvidenceRequest} message QueryEvidenceRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryEvidenceRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.evidence_hash != null && Object.hasOwnProperty.call(message, "evidence_hash")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.evidence_hash); - return writer; - }; - - /** - * Encodes the specified QueryEvidenceRequest message, length delimited. Does not implicitly {@link cosmos.evidence.v1beta1.QueryEvidenceRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.evidence.v1beta1.QueryEvidenceRequest - * @static - * @param {cosmos.evidence.v1beta1.IQueryEvidenceRequest} message QueryEvidenceRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryEvidenceRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryEvidenceRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.evidence.v1beta1.QueryEvidenceRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.evidence.v1beta1.QueryEvidenceRequest} QueryEvidenceRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryEvidenceRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.evidence.v1beta1.QueryEvidenceRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.evidence_hash = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryEvidenceRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.evidence.v1beta1.QueryEvidenceRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.evidence.v1beta1.QueryEvidenceRequest} QueryEvidenceRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryEvidenceRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryEvidenceRequest message. - * @function verify - * @memberof cosmos.evidence.v1beta1.QueryEvidenceRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryEvidenceRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.evidence_hash != null && message.hasOwnProperty("evidence_hash")) - if (!(message.evidence_hash && typeof message.evidence_hash.length === "number" || $util.isString(message.evidence_hash))) - return "evidence_hash: buffer expected"; - return null; - }; - - /** - * Creates a QueryEvidenceRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.evidence.v1beta1.QueryEvidenceRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.evidence.v1beta1.QueryEvidenceRequest} QueryEvidenceRequest - */ - QueryEvidenceRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.evidence.v1beta1.QueryEvidenceRequest) - return object; - let message = new $root.cosmos.evidence.v1beta1.QueryEvidenceRequest(); - if (object.evidence_hash != null) - if (typeof object.evidence_hash === "string") - $util.base64.decode(object.evidence_hash, message.evidence_hash = $util.newBuffer($util.base64.length(object.evidence_hash)), 0); - else if (object.evidence_hash.length) - message.evidence_hash = object.evidence_hash; - return message; - }; - - /** - * Creates a plain object from a QueryEvidenceRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.evidence.v1beta1.QueryEvidenceRequest - * @static - * @param {cosmos.evidence.v1beta1.QueryEvidenceRequest} message QueryEvidenceRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryEvidenceRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - if (options.bytes === String) - object.evidence_hash = ""; - else { - object.evidence_hash = []; - if (options.bytes !== Array) - object.evidence_hash = $util.newBuffer(object.evidence_hash); - } - if (message.evidence_hash != null && message.hasOwnProperty("evidence_hash")) - object.evidence_hash = options.bytes === String ? $util.base64.encode(message.evidence_hash, 0, message.evidence_hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.evidence_hash) : message.evidence_hash; - return object; - }; - - /** - * Converts this QueryEvidenceRequest to JSON. - * @function toJSON - * @memberof cosmos.evidence.v1beta1.QueryEvidenceRequest - * @instance - * @returns {Object.} JSON object - */ - QueryEvidenceRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryEvidenceRequest; - })(); - - v1beta1.QueryEvidenceResponse = (function() { - - /** - * Properties of a QueryEvidenceResponse. - * @memberof cosmos.evidence.v1beta1 - * @interface IQueryEvidenceResponse - * @property {google.protobuf.IAny|null} [evidence] QueryEvidenceResponse evidence - */ - - /** - * Constructs a new QueryEvidenceResponse. - * @memberof cosmos.evidence.v1beta1 - * @classdesc Represents a QueryEvidenceResponse. - * @implements IQueryEvidenceResponse - * @constructor - * @param {cosmos.evidence.v1beta1.IQueryEvidenceResponse=} [properties] Properties to set - */ - function QueryEvidenceResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryEvidenceResponse evidence. - * @member {google.protobuf.IAny|null|undefined} evidence - * @memberof cosmos.evidence.v1beta1.QueryEvidenceResponse - * @instance - */ - QueryEvidenceResponse.prototype.evidence = null; - - /** - * Encodes the specified QueryEvidenceResponse message. Does not implicitly {@link cosmos.evidence.v1beta1.QueryEvidenceResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.evidence.v1beta1.QueryEvidenceResponse - * @static - * @param {cosmos.evidence.v1beta1.IQueryEvidenceResponse} message QueryEvidenceResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryEvidenceResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.evidence != null && Object.hasOwnProperty.call(message, "evidence")) - $root.google.protobuf.Any.encode(message.evidence, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryEvidenceResponse message, length delimited. Does not implicitly {@link cosmos.evidence.v1beta1.QueryEvidenceResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.evidence.v1beta1.QueryEvidenceResponse - * @static - * @param {cosmos.evidence.v1beta1.IQueryEvidenceResponse} message QueryEvidenceResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryEvidenceResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryEvidenceResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.evidence.v1beta1.QueryEvidenceResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.evidence.v1beta1.QueryEvidenceResponse} QueryEvidenceResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryEvidenceResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.evidence.v1beta1.QueryEvidenceResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.evidence = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryEvidenceResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.evidence.v1beta1.QueryEvidenceResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.evidence.v1beta1.QueryEvidenceResponse} QueryEvidenceResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryEvidenceResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryEvidenceResponse message. - * @function verify - * @memberof cosmos.evidence.v1beta1.QueryEvidenceResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryEvidenceResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.evidence != null && message.hasOwnProperty("evidence")) { - let error = $root.google.protobuf.Any.verify(message.evidence); - if (error) - return "evidence." + error; - } - return null; - }; - - /** - * Creates a QueryEvidenceResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.evidence.v1beta1.QueryEvidenceResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.evidence.v1beta1.QueryEvidenceResponse} QueryEvidenceResponse - */ - QueryEvidenceResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.evidence.v1beta1.QueryEvidenceResponse) - return object; - let message = new $root.cosmos.evidence.v1beta1.QueryEvidenceResponse(); - if (object.evidence != null) { - if (typeof object.evidence !== "object") - throw TypeError(".cosmos.evidence.v1beta1.QueryEvidenceResponse.evidence: object expected"); - message.evidence = $root.google.protobuf.Any.fromObject(object.evidence); - } - return message; - }; - - /** - * Creates a plain object from a QueryEvidenceResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.evidence.v1beta1.QueryEvidenceResponse - * @static - * @param {cosmos.evidence.v1beta1.QueryEvidenceResponse} message QueryEvidenceResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryEvidenceResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.evidence = null; - if (message.evidence != null && message.hasOwnProperty("evidence")) - object.evidence = $root.google.protobuf.Any.toObject(message.evidence, options); - return object; - }; - - /** - * Converts this QueryEvidenceResponse to JSON. - * @function toJSON - * @memberof cosmos.evidence.v1beta1.QueryEvidenceResponse - * @instance - * @returns {Object.} JSON object - */ - QueryEvidenceResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryEvidenceResponse; - })(); - - v1beta1.QueryAllEvidenceRequest = (function() { - - /** - * Properties of a QueryAllEvidenceRequest. - * @memberof cosmos.evidence.v1beta1 - * @interface IQueryAllEvidenceRequest - * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryAllEvidenceRequest pagination - */ - - /** - * Constructs a new QueryAllEvidenceRequest. - * @memberof cosmos.evidence.v1beta1 - * @classdesc Represents a QueryAllEvidenceRequest. - * @implements IQueryAllEvidenceRequest - * @constructor - * @param {cosmos.evidence.v1beta1.IQueryAllEvidenceRequest=} [properties] Properties to set - */ - function QueryAllEvidenceRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryAllEvidenceRequest pagination. - * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination - * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceRequest - * @instance - */ - QueryAllEvidenceRequest.prototype.pagination = null; - - /** - * Encodes the specified QueryAllEvidenceRequest message. Does not implicitly {@link cosmos.evidence.v1beta1.QueryAllEvidenceRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceRequest - * @static - * @param {cosmos.evidence.v1beta1.IQueryAllEvidenceRequest} message QueryAllEvidenceRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryAllEvidenceRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryAllEvidenceRequest message, length delimited. Does not implicitly {@link cosmos.evidence.v1beta1.QueryAllEvidenceRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceRequest - * @static - * @param {cosmos.evidence.v1beta1.IQueryAllEvidenceRequest} message QueryAllEvidenceRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryAllEvidenceRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryAllEvidenceRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.evidence.v1beta1.QueryAllEvidenceRequest} QueryAllEvidenceRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryAllEvidenceRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.evidence.v1beta1.QueryAllEvidenceRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryAllEvidenceRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.evidence.v1beta1.QueryAllEvidenceRequest} QueryAllEvidenceRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryAllEvidenceRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryAllEvidenceRequest message. - * @function verify - * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryAllEvidenceRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryAllEvidenceRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.evidence.v1beta1.QueryAllEvidenceRequest} QueryAllEvidenceRequest - */ - QueryAllEvidenceRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.evidence.v1beta1.QueryAllEvidenceRequest) - return object; - let message = new $root.cosmos.evidence.v1beta1.QueryAllEvidenceRequest(); - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.evidence.v1beta1.QueryAllEvidenceRequest.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryAllEvidenceRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceRequest - * @static - * @param {cosmos.evidence.v1beta1.QueryAllEvidenceRequest} message QueryAllEvidenceRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryAllEvidenceRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.pagination = null; - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryAllEvidenceRequest to JSON. - * @function toJSON - * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceRequest - * @instance - * @returns {Object.} JSON object - */ - QueryAllEvidenceRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryAllEvidenceRequest; - })(); - - v1beta1.QueryAllEvidenceResponse = (function() { - - /** - * Properties of a QueryAllEvidenceResponse. - * @memberof cosmos.evidence.v1beta1 - * @interface IQueryAllEvidenceResponse - * @property {Array.|null} [evidence] QueryAllEvidenceResponse evidence - * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryAllEvidenceResponse pagination - */ - - /** - * Constructs a new QueryAllEvidenceResponse. - * @memberof cosmos.evidence.v1beta1 - * @classdesc Represents a QueryAllEvidenceResponse. - * @implements IQueryAllEvidenceResponse - * @constructor - * @param {cosmos.evidence.v1beta1.IQueryAllEvidenceResponse=} [properties] Properties to set - */ - function QueryAllEvidenceResponse(properties) { - this.evidence = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryAllEvidenceResponse evidence. - * @member {Array.} evidence - * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceResponse - * @instance - */ - QueryAllEvidenceResponse.prototype.evidence = $util.emptyArray; - - /** - * QueryAllEvidenceResponse pagination. - * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination - * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceResponse - * @instance - */ - QueryAllEvidenceResponse.prototype.pagination = null; - - /** - * Encodes the specified QueryAllEvidenceResponse message. Does not implicitly {@link cosmos.evidence.v1beta1.QueryAllEvidenceResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceResponse - * @static - * @param {cosmos.evidence.v1beta1.IQueryAllEvidenceResponse} message QueryAllEvidenceResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryAllEvidenceResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.evidence != null && message.evidence.length) - for (let i = 0; i < message.evidence.length; ++i) - $root.google.protobuf.Any.encode(message.evidence[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryAllEvidenceResponse message, length delimited. Does not implicitly {@link cosmos.evidence.v1beta1.QueryAllEvidenceResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceResponse - * @static - * @param {cosmos.evidence.v1beta1.IQueryAllEvidenceResponse} message QueryAllEvidenceResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryAllEvidenceResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryAllEvidenceResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.evidence.v1beta1.QueryAllEvidenceResponse} QueryAllEvidenceResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryAllEvidenceResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.evidence.v1beta1.QueryAllEvidenceResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.evidence && message.evidence.length)) - message.evidence = []; - message.evidence.push($root.google.protobuf.Any.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryAllEvidenceResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.evidence.v1beta1.QueryAllEvidenceResponse} QueryAllEvidenceResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryAllEvidenceResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryAllEvidenceResponse message. - * @function verify - * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryAllEvidenceResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.evidence != null && message.hasOwnProperty("evidence")) { - if (!Array.isArray(message.evidence)) - return "evidence: array expected"; - for (let i = 0; i < message.evidence.length; ++i) { - let error = $root.google.protobuf.Any.verify(message.evidence[i]); - if (error) - return "evidence." + error; - } - } - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryAllEvidenceResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.evidence.v1beta1.QueryAllEvidenceResponse} QueryAllEvidenceResponse - */ - QueryAllEvidenceResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.evidence.v1beta1.QueryAllEvidenceResponse) - return object; - let message = new $root.cosmos.evidence.v1beta1.QueryAllEvidenceResponse(); - if (object.evidence) { - if (!Array.isArray(object.evidence)) - throw TypeError(".cosmos.evidence.v1beta1.QueryAllEvidenceResponse.evidence: array expected"); - message.evidence = []; - for (let i = 0; i < object.evidence.length; ++i) { - if (typeof object.evidence[i] !== "object") - throw TypeError(".cosmos.evidence.v1beta1.QueryAllEvidenceResponse.evidence: object expected"); - message.evidence[i] = $root.google.protobuf.Any.fromObject(object.evidence[i]); - } - } - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.evidence.v1beta1.QueryAllEvidenceResponse.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryAllEvidenceResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceResponse - * @static - * @param {cosmos.evidence.v1beta1.QueryAllEvidenceResponse} message QueryAllEvidenceResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryAllEvidenceResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.evidence = []; - if (options.defaults) - object.pagination = null; - if (message.evidence && message.evidence.length) { - object.evidence = []; - for (let j = 0; j < message.evidence.length; ++j) - object.evidence[j] = $root.google.protobuf.Any.toObject(message.evidence[j], options); - } - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryAllEvidenceResponse to JSON. - * @function toJSON - * @memberof cosmos.evidence.v1beta1.QueryAllEvidenceResponse - * @instance - * @returns {Object.} JSON object - */ - QueryAllEvidenceResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryAllEvidenceResponse; - })(); - - v1beta1.GenesisState = (function() { - - /** - * Properties of a GenesisState. - * @memberof cosmos.evidence.v1beta1 - * @interface IGenesisState - * @property {Array.|null} [evidence] GenesisState evidence - */ - - /** - * Constructs a new GenesisState. - * @memberof cosmos.evidence.v1beta1 - * @classdesc Represents a GenesisState. - * @implements IGenesisState - * @constructor - * @param {cosmos.evidence.v1beta1.IGenesisState=} [properties] Properties to set - */ - function GenesisState(properties) { - this.evidence = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GenesisState evidence. - * @member {Array.} evidence - * @memberof cosmos.evidence.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.evidence = $util.emptyArray; - - /** - * Encodes the specified GenesisState message. Does not implicitly {@link cosmos.evidence.v1beta1.GenesisState.verify|verify} messages. - * @function encode - * @memberof cosmos.evidence.v1beta1.GenesisState - * @static - * @param {cosmos.evidence.v1beta1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.evidence != null && message.evidence.length) - for (let i = 0; i < message.evidence.length; ++i) - $root.google.protobuf.Any.encode(message.evidence[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link cosmos.evidence.v1beta1.GenesisState.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.evidence.v1beta1.GenesisState - * @static - * @param {cosmos.evidence.v1beta1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer. - * @function decode - * @memberof cosmos.evidence.v1beta1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.evidence.v1beta1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.evidence.v1beta1.GenesisState(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.evidence && message.evidence.length)) - message.evidence = []; - message.evidence.push($root.google.protobuf.Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.evidence.v1beta1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.evidence.v1beta1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GenesisState message. - * @function verify - * @memberof cosmos.evidence.v1beta1.GenesisState - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GenesisState.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.evidence != null && message.hasOwnProperty("evidence")) { - if (!Array.isArray(message.evidence)) - return "evidence: array expected"; - for (let i = 0; i < message.evidence.length; ++i) { - let error = $root.google.protobuf.Any.verify(message.evidence[i]); - if (error) - return "evidence." + error; - } - } - return null; - }; - - /** - * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.evidence.v1beta1.GenesisState - * @static - * @param {Object.} object Plain object - * @returns {cosmos.evidence.v1beta1.GenesisState} GenesisState - */ - GenesisState.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.evidence.v1beta1.GenesisState) - return object; - let message = new $root.cosmos.evidence.v1beta1.GenesisState(); - if (object.evidence) { - if (!Array.isArray(object.evidence)) - throw TypeError(".cosmos.evidence.v1beta1.GenesisState.evidence: array expected"); - message.evidence = []; - for (let i = 0; i < object.evidence.length; ++i) { - if (typeof object.evidence[i] !== "object") - throw TypeError(".cosmos.evidence.v1beta1.GenesisState.evidence: object expected"); - message.evidence[i] = $root.google.protobuf.Any.fromObject(object.evidence[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a GenesisState message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.evidence.v1beta1.GenesisState - * @static - * @param {cosmos.evidence.v1beta1.GenesisState} message GenesisState - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GenesisState.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.evidence = []; - if (message.evidence && message.evidence.length) { - object.evidence = []; - for (let j = 0; j < message.evidence.length; ++j) - object.evidence[j] = $root.google.protobuf.Any.toObject(message.evidence[j], options); - } - return object; - }; - - /** - * Converts this GenesisState to JSON. - * @function toJSON - * @memberof cosmos.evidence.v1beta1.GenesisState - * @instance - * @returns {Object.} JSON object - */ - GenesisState.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GenesisState; - })(); - - return v1beta1; - })(); - - return evidence; - })(); - - cosmos.genutil = (function() { - - /** - * Namespace genutil. - * @memberof cosmos - * @namespace - */ - const genutil = {}; - - genutil.v1beta1 = (function() { - - /** - * Namespace v1beta1. - * @memberof cosmos.genutil - * @namespace - */ - const v1beta1 = {}; - - v1beta1.GenesisState = (function() { - - /** - * Properties of a GenesisState. - * @memberof cosmos.genutil.v1beta1 - * @interface IGenesisState - * @property {Array.|null} [gen_txs] GenesisState gen_txs - */ - - /** - * Constructs a new GenesisState. - * @memberof cosmos.genutil.v1beta1 - * @classdesc Represents a GenesisState. - * @implements IGenesisState - * @constructor - * @param {cosmos.genutil.v1beta1.IGenesisState=} [properties] Properties to set - */ - function GenesisState(properties) { - this.gen_txs = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GenesisState gen_txs. - * @member {Array.} gen_txs - * @memberof cosmos.genutil.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.gen_txs = $util.emptyArray; - - /** - * Encodes the specified GenesisState message. Does not implicitly {@link cosmos.genutil.v1beta1.GenesisState.verify|verify} messages. - * @function encode - * @memberof cosmos.genutil.v1beta1.GenesisState - * @static - * @param {cosmos.genutil.v1beta1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.gen_txs != null && message.gen_txs.length) - for (let i = 0; i < message.gen_txs.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.gen_txs[i]); - return writer; - }; - - /** - * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link cosmos.genutil.v1beta1.GenesisState.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.genutil.v1beta1.GenesisState - * @static - * @param {cosmos.genutil.v1beta1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer. - * @function decode - * @memberof cosmos.genutil.v1beta1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.genutil.v1beta1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.genutil.v1beta1.GenesisState(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.gen_txs && message.gen_txs.length)) - message.gen_txs = []; - message.gen_txs.push(reader.bytes()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.genutil.v1beta1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.genutil.v1beta1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GenesisState message. - * @function verify - * @memberof cosmos.genutil.v1beta1.GenesisState - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GenesisState.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.gen_txs != null && message.hasOwnProperty("gen_txs")) { - if (!Array.isArray(message.gen_txs)) - return "gen_txs: array expected"; - for (let i = 0; i < message.gen_txs.length; ++i) - if (!(message.gen_txs[i] && typeof message.gen_txs[i].length === "number" || $util.isString(message.gen_txs[i]))) - return "gen_txs: buffer[] expected"; - } - return null; - }; - - /** - * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.genutil.v1beta1.GenesisState - * @static - * @param {Object.} object Plain object - * @returns {cosmos.genutil.v1beta1.GenesisState} GenesisState - */ - GenesisState.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.genutil.v1beta1.GenesisState) - return object; - let message = new $root.cosmos.genutil.v1beta1.GenesisState(); - if (object.gen_txs) { - if (!Array.isArray(object.gen_txs)) - throw TypeError(".cosmos.genutil.v1beta1.GenesisState.gen_txs: array expected"); - message.gen_txs = []; - for (let i = 0; i < object.gen_txs.length; ++i) - if (typeof object.gen_txs[i] === "string") - $util.base64.decode(object.gen_txs[i], message.gen_txs[i] = $util.newBuffer($util.base64.length(object.gen_txs[i])), 0); - else if (object.gen_txs[i].length) - message.gen_txs[i] = object.gen_txs[i]; - } - return message; - }; - - /** - * Creates a plain object from a GenesisState message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.genutil.v1beta1.GenesisState - * @static - * @param {cosmos.genutil.v1beta1.GenesisState} message GenesisState - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GenesisState.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.gen_txs = []; - if (message.gen_txs && message.gen_txs.length) { - object.gen_txs = []; - for (let j = 0; j < message.gen_txs.length; ++j) - object.gen_txs[j] = options.bytes === String ? $util.base64.encode(message.gen_txs[j], 0, message.gen_txs[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.gen_txs[j]) : message.gen_txs[j]; - } - return object; - }; - - /** - * Converts this GenesisState to JSON. - * @function toJSON - * @memberof cosmos.genutil.v1beta1.GenesisState - * @instance - * @returns {Object.} JSON object - */ - GenesisState.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GenesisState; - })(); - - return v1beta1; - })(); - - return genutil; - })(); - - cosmos.gov = (function() { - - /** - * Namespace gov. - * @memberof cosmos - * @namespace - */ - const gov = {}; - - gov.v1beta1 = (function() { - - /** - * Namespace v1beta1. - * @memberof cosmos.gov - * @namespace - */ - const v1beta1 = {}; - - v1beta1.Msg = (function() { - - /** - * Constructs a new Msg service. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a Msg - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function Msg(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Msg.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Msg; - - /** - * Callback as used by {@link cosmos.gov.v1beta1.Msg#submitProposal}. - * @memberof cosmos.gov.v1beta1.Msg - * @typedef SubmitProposalCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.gov.v1beta1.MsgSubmitProposalResponse} [response] MsgSubmitProposalResponse - */ - - /** - * Calls SubmitProposal. - * @function submitProposal - * @memberof cosmos.gov.v1beta1.Msg - * @instance - * @param {cosmos.gov.v1beta1.IMsgSubmitProposal} request MsgSubmitProposal message or plain object - * @param {cosmos.gov.v1beta1.Msg.SubmitProposalCallback} callback Node-style callback called with the error, if any, and MsgSubmitProposalResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.submitProposal = function submitProposal(request, callback) { - return this.rpcCall(submitProposal, $root.cosmos.gov.v1beta1.MsgSubmitProposal, $root.cosmos.gov.v1beta1.MsgSubmitProposalResponse, request, callback); - }, "name", { value: "SubmitProposal" }); - - /** - * Calls SubmitProposal. - * @function submitProposal - * @memberof cosmos.gov.v1beta1.Msg - * @instance - * @param {cosmos.gov.v1beta1.IMsgSubmitProposal} request MsgSubmitProposal message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.gov.v1beta1.Msg#vote}. - * @memberof cosmos.gov.v1beta1.Msg - * @typedef VoteCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.gov.v1beta1.MsgVoteResponse} [response] MsgVoteResponse - */ - - /** - * Calls Vote. - * @function vote - * @memberof cosmos.gov.v1beta1.Msg - * @instance - * @param {cosmos.gov.v1beta1.IMsgVote} request MsgVote message or plain object - * @param {cosmos.gov.v1beta1.Msg.VoteCallback} callback Node-style callback called with the error, if any, and MsgVoteResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.vote = function vote(request, callback) { - return this.rpcCall(vote, $root.cosmos.gov.v1beta1.MsgVote, $root.cosmos.gov.v1beta1.MsgVoteResponse, request, callback); - }, "name", { value: "Vote" }); - - /** - * Calls Vote. - * @function vote - * @memberof cosmos.gov.v1beta1.Msg - * @instance - * @param {cosmos.gov.v1beta1.IMsgVote} request MsgVote message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.gov.v1beta1.Msg#deposit}. - * @memberof cosmos.gov.v1beta1.Msg - * @typedef DepositCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.gov.v1beta1.MsgDepositResponse} [response] MsgDepositResponse - */ - - /** - * Calls Deposit. - * @function deposit - * @memberof cosmos.gov.v1beta1.Msg - * @instance - * @param {cosmos.gov.v1beta1.IMsgDeposit} request MsgDeposit message or plain object - * @param {cosmos.gov.v1beta1.Msg.DepositCallback} callback Node-style callback called with the error, if any, and MsgDepositResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.deposit = function deposit(request, callback) { - return this.rpcCall(deposit, $root.cosmos.gov.v1beta1.MsgDeposit, $root.cosmos.gov.v1beta1.MsgDepositResponse, request, callback); - }, "name", { value: "Deposit" }); - - /** - * Calls Deposit. - * @function deposit - * @memberof cosmos.gov.v1beta1.Msg - * @instance - * @param {cosmos.gov.v1beta1.IMsgDeposit} request MsgDeposit message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return Msg; - })(); - - v1beta1.MsgSubmitProposal = (function() { - - /** - * Properties of a MsgSubmitProposal. - * @memberof cosmos.gov.v1beta1 - * @interface IMsgSubmitProposal - * @property {google.protobuf.IAny|null} [content] MsgSubmitProposal content - * @property {Array.|null} [initial_deposit] MsgSubmitProposal initial_deposit - * @property {string|null} [proposer] MsgSubmitProposal proposer - */ - - /** - * Constructs a new MsgSubmitProposal. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a MsgSubmitProposal. - * @implements IMsgSubmitProposal - * @constructor - * @param {cosmos.gov.v1beta1.IMsgSubmitProposal=} [properties] Properties to set - */ - function MsgSubmitProposal(properties) { - this.initial_deposit = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgSubmitProposal content. - * @member {google.protobuf.IAny|null|undefined} content - * @memberof cosmos.gov.v1beta1.MsgSubmitProposal - * @instance - */ - MsgSubmitProposal.prototype.content = null; - - /** - * MsgSubmitProposal initial_deposit. - * @member {Array.} initial_deposit - * @memberof cosmos.gov.v1beta1.MsgSubmitProposal - * @instance - */ - MsgSubmitProposal.prototype.initial_deposit = $util.emptyArray; - - /** - * MsgSubmitProposal proposer. - * @member {string} proposer - * @memberof cosmos.gov.v1beta1.MsgSubmitProposal - * @instance - */ - MsgSubmitProposal.prototype.proposer = ""; - - /** - * Encodes the specified MsgSubmitProposal message. Does not implicitly {@link cosmos.gov.v1beta1.MsgSubmitProposal.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.MsgSubmitProposal - * @static - * @param {cosmos.gov.v1beta1.IMsgSubmitProposal} message MsgSubmitProposal message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgSubmitProposal.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.content != null && Object.hasOwnProperty.call(message, "content")) - $root.google.protobuf.Any.encode(message.content, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.initial_deposit != null && message.initial_deposit.length) - for (let i = 0; i < message.initial_deposit.length; ++i) - $root.cosmos.base.v1beta1.Coin.encode(message.initial_deposit[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.proposer != null && Object.hasOwnProperty.call(message, "proposer")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.proposer); - return writer; - }; - - /** - * Encodes the specified MsgSubmitProposal message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.MsgSubmitProposal.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.MsgSubmitProposal - * @static - * @param {cosmos.gov.v1beta1.IMsgSubmitProposal} message MsgSubmitProposal message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgSubmitProposal.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgSubmitProposal message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.MsgSubmitProposal - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.MsgSubmitProposal} MsgSubmitProposal - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgSubmitProposal.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.MsgSubmitProposal(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.content = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.initial_deposit && message.initial_deposit.length)) - message.initial_deposit = []; - message.initial_deposit.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); - break; - case 3: - message.proposer = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgSubmitProposal message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.MsgSubmitProposal - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.MsgSubmitProposal} MsgSubmitProposal - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgSubmitProposal.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgSubmitProposal message. - * @function verify - * @memberof cosmos.gov.v1beta1.MsgSubmitProposal - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgSubmitProposal.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.content != null && message.hasOwnProperty("content")) { - let error = $root.google.protobuf.Any.verify(message.content); - if (error) - return "content." + error; - } - if (message.initial_deposit != null && message.hasOwnProperty("initial_deposit")) { - if (!Array.isArray(message.initial_deposit)) - return "initial_deposit: array expected"; - for (let i = 0; i < message.initial_deposit.length; ++i) { - let error = $root.cosmos.base.v1beta1.Coin.verify(message.initial_deposit[i]); - if (error) - return "initial_deposit." + error; - } - } - if (message.proposer != null && message.hasOwnProperty("proposer")) - if (!$util.isString(message.proposer)) - return "proposer: string expected"; - return null; - }; - - /** - * Creates a MsgSubmitProposal message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.MsgSubmitProposal - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.MsgSubmitProposal} MsgSubmitProposal - */ - MsgSubmitProposal.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.MsgSubmitProposal) - return object; - let message = new $root.cosmos.gov.v1beta1.MsgSubmitProposal(); - if (object.content != null) { - if (typeof object.content !== "object") - throw TypeError(".cosmos.gov.v1beta1.MsgSubmitProposal.content: object expected"); - message.content = $root.google.protobuf.Any.fromObject(object.content); - } - if (object.initial_deposit) { - if (!Array.isArray(object.initial_deposit)) - throw TypeError(".cosmos.gov.v1beta1.MsgSubmitProposal.initial_deposit: array expected"); - message.initial_deposit = []; - for (let i = 0; i < object.initial_deposit.length; ++i) { - if (typeof object.initial_deposit[i] !== "object") - throw TypeError(".cosmos.gov.v1beta1.MsgSubmitProposal.initial_deposit: object expected"); - message.initial_deposit[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.initial_deposit[i]); - } - } - if (object.proposer != null) - message.proposer = String(object.proposer); - return message; - }; - - /** - * Creates a plain object from a MsgSubmitProposal message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.MsgSubmitProposal - * @static - * @param {cosmos.gov.v1beta1.MsgSubmitProposal} message MsgSubmitProposal - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgSubmitProposal.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.initial_deposit = []; - if (options.defaults) { - object.content = null; - object.proposer = ""; - } - if (message.content != null && message.hasOwnProperty("content")) - object.content = $root.google.protobuf.Any.toObject(message.content, options); - if (message.initial_deposit && message.initial_deposit.length) { - object.initial_deposit = []; - for (let j = 0; j < message.initial_deposit.length; ++j) - object.initial_deposit[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.initial_deposit[j], options); - } - if (message.proposer != null && message.hasOwnProperty("proposer")) - object.proposer = message.proposer; - return object; - }; - - /** - * Converts this MsgSubmitProposal to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.MsgSubmitProposal - * @instance - * @returns {Object.} JSON object - */ - MsgSubmitProposal.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgSubmitProposal; - })(); - - v1beta1.MsgSubmitProposalResponse = (function() { - - /** - * Properties of a MsgSubmitProposalResponse. - * @memberof cosmos.gov.v1beta1 - * @interface IMsgSubmitProposalResponse - * @property {Long|null} [proposal_id] MsgSubmitProposalResponse proposal_id - */ - - /** - * Constructs a new MsgSubmitProposalResponse. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a MsgSubmitProposalResponse. - * @implements IMsgSubmitProposalResponse - * @constructor - * @param {cosmos.gov.v1beta1.IMsgSubmitProposalResponse=} [properties] Properties to set - */ - function MsgSubmitProposalResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgSubmitProposalResponse proposal_id. - * @member {Long} proposal_id - * @memberof cosmos.gov.v1beta1.MsgSubmitProposalResponse - * @instance - */ - MsgSubmitProposalResponse.prototype.proposal_id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified MsgSubmitProposalResponse message. Does not implicitly {@link cosmos.gov.v1beta1.MsgSubmitProposalResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.MsgSubmitProposalResponse - * @static - * @param {cosmos.gov.v1beta1.IMsgSubmitProposalResponse} message MsgSubmitProposalResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgSubmitProposalResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.proposal_id != null && Object.hasOwnProperty.call(message, "proposal_id")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.proposal_id); - return writer; - }; - - /** - * Encodes the specified MsgSubmitProposalResponse message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.MsgSubmitProposalResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.MsgSubmitProposalResponse - * @static - * @param {cosmos.gov.v1beta1.IMsgSubmitProposalResponse} message MsgSubmitProposalResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgSubmitProposalResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgSubmitProposalResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.MsgSubmitProposalResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.MsgSubmitProposalResponse} MsgSubmitProposalResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgSubmitProposalResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.MsgSubmitProposalResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.proposal_id = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgSubmitProposalResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.MsgSubmitProposalResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.MsgSubmitProposalResponse} MsgSubmitProposalResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgSubmitProposalResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgSubmitProposalResponse message. - * @function verify - * @memberof cosmos.gov.v1beta1.MsgSubmitProposalResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgSubmitProposalResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) - if (!$util.isInteger(message.proposal_id) && !(message.proposal_id && $util.isInteger(message.proposal_id.low) && $util.isInteger(message.proposal_id.high))) - return "proposal_id: integer|Long expected"; - return null; - }; - - /** - * Creates a MsgSubmitProposalResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.MsgSubmitProposalResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.MsgSubmitProposalResponse} MsgSubmitProposalResponse - */ - MsgSubmitProposalResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.MsgSubmitProposalResponse) - return object; - let message = new $root.cosmos.gov.v1beta1.MsgSubmitProposalResponse(); - if (object.proposal_id != null) - if ($util.Long) - (message.proposal_id = $util.Long.fromValue(object.proposal_id)).unsigned = true; - else if (typeof object.proposal_id === "string") - message.proposal_id = parseInt(object.proposal_id, 10); - else if (typeof object.proposal_id === "number") - message.proposal_id = object.proposal_id; - else if (typeof object.proposal_id === "object") - message.proposal_id = new $util.LongBits(object.proposal_id.low >>> 0, object.proposal_id.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a MsgSubmitProposalResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.MsgSubmitProposalResponse - * @static - * @param {cosmos.gov.v1beta1.MsgSubmitProposalResponse} message MsgSubmitProposalResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgSubmitProposalResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.proposal_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.proposal_id = options.longs === String ? "0" : 0; - if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) - if (typeof message.proposal_id === "number") - object.proposal_id = options.longs === String ? String(message.proposal_id) : message.proposal_id; - else - object.proposal_id = options.longs === String ? $util.Long.prototype.toString.call(message.proposal_id) : options.longs === Number ? new $util.LongBits(message.proposal_id.low >>> 0, message.proposal_id.high >>> 0).toNumber(true) : message.proposal_id; - return object; - }; - - /** - * Converts this MsgSubmitProposalResponse to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.MsgSubmitProposalResponse - * @instance - * @returns {Object.} JSON object - */ - MsgSubmitProposalResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgSubmitProposalResponse; - })(); - - v1beta1.MsgVote = (function() { - - /** - * Properties of a MsgVote. - * @memberof cosmos.gov.v1beta1 - * @interface IMsgVote - * @property {Long|null} [proposal_id] MsgVote proposal_id - * @property {string|null} [voter] MsgVote voter - * @property {cosmos.gov.v1beta1.VoteOption|null} [option] MsgVote option - */ - - /** - * Constructs a new MsgVote. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a MsgVote. - * @implements IMsgVote - * @constructor - * @param {cosmos.gov.v1beta1.IMsgVote=} [properties] Properties to set - */ - function MsgVote(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgVote proposal_id. - * @member {Long} proposal_id - * @memberof cosmos.gov.v1beta1.MsgVote - * @instance - */ - MsgVote.prototype.proposal_id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * MsgVote voter. - * @member {string} voter - * @memberof cosmos.gov.v1beta1.MsgVote - * @instance - */ - MsgVote.prototype.voter = ""; - - /** - * MsgVote option. - * @member {cosmos.gov.v1beta1.VoteOption} option - * @memberof cosmos.gov.v1beta1.MsgVote - * @instance - */ - MsgVote.prototype.option = 0; - - /** - * Encodes the specified MsgVote message. Does not implicitly {@link cosmos.gov.v1beta1.MsgVote.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.MsgVote - * @static - * @param {cosmos.gov.v1beta1.IMsgVote} message MsgVote message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgVote.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.proposal_id != null && Object.hasOwnProperty.call(message, "proposal_id")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.proposal_id); - if (message.voter != null && Object.hasOwnProperty.call(message, "voter")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.voter); - if (message.option != null && Object.hasOwnProperty.call(message, "option")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.option); - return writer; - }; - - /** - * Encodes the specified MsgVote message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.MsgVote.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.MsgVote - * @static - * @param {cosmos.gov.v1beta1.IMsgVote} message MsgVote message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgVote.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgVote message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.MsgVote - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.MsgVote} MsgVote - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgVote.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.MsgVote(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.proposal_id = reader.uint64(); - break; - case 2: - message.voter = reader.string(); - break; - case 3: - message.option = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgVote message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.MsgVote - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.MsgVote} MsgVote - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgVote.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgVote message. - * @function verify - * @memberof cosmos.gov.v1beta1.MsgVote - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgVote.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) - if (!$util.isInteger(message.proposal_id) && !(message.proposal_id && $util.isInteger(message.proposal_id.low) && $util.isInteger(message.proposal_id.high))) - return "proposal_id: integer|Long expected"; - if (message.voter != null && message.hasOwnProperty("voter")) - if (!$util.isString(message.voter)) - return "voter: string expected"; - if (message.option != null && message.hasOwnProperty("option")) - switch (message.option) { - default: - return "option: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; - } - return null; - }; - - /** - * Creates a MsgVote message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.MsgVote - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.MsgVote} MsgVote - */ - MsgVote.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.MsgVote) - return object; - let message = new $root.cosmos.gov.v1beta1.MsgVote(); - if (object.proposal_id != null) - if ($util.Long) - (message.proposal_id = $util.Long.fromValue(object.proposal_id)).unsigned = true; - else if (typeof object.proposal_id === "string") - message.proposal_id = parseInt(object.proposal_id, 10); - else if (typeof object.proposal_id === "number") - message.proposal_id = object.proposal_id; - else if (typeof object.proposal_id === "object") - message.proposal_id = new $util.LongBits(object.proposal_id.low >>> 0, object.proposal_id.high >>> 0).toNumber(true); - if (object.voter != null) - message.voter = String(object.voter); - switch (object.option) { - case "VOTE_OPTION_UNSPECIFIED": - case 0: - message.option = 0; - break; - case "VOTE_OPTION_YES": - case 1: - message.option = 1; - break; - case "VOTE_OPTION_ABSTAIN": - case 2: - message.option = 2; - break; - case "VOTE_OPTION_NO": - case 3: - message.option = 3; - break; - case "VOTE_OPTION_NO_WITH_VETO": - case 4: - message.option = 4; - break; - } - return message; - }; - - /** - * Creates a plain object from a MsgVote message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.MsgVote - * @static - * @param {cosmos.gov.v1beta1.MsgVote} message MsgVote - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgVote.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.proposal_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.proposal_id = options.longs === String ? "0" : 0; - object.voter = ""; - object.option = options.enums === String ? "VOTE_OPTION_UNSPECIFIED" : 0; - } - if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) - if (typeof message.proposal_id === "number") - object.proposal_id = options.longs === String ? String(message.proposal_id) : message.proposal_id; - else - object.proposal_id = options.longs === String ? $util.Long.prototype.toString.call(message.proposal_id) : options.longs === Number ? new $util.LongBits(message.proposal_id.low >>> 0, message.proposal_id.high >>> 0).toNumber(true) : message.proposal_id; - if (message.voter != null && message.hasOwnProperty("voter")) - object.voter = message.voter; - if (message.option != null && message.hasOwnProperty("option")) - object.option = options.enums === String ? $root.cosmos.gov.v1beta1.VoteOption[message.option] : message.option; - return object; - }; - - /** - * Converts this MsgVote to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.MsgVote - * @instance - * @returns {Object.} JSON object - */ - MsgVote.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgVote; - })(); - - v1beta1.MsgVoteResponse = (function() { - - /** - * Properties of a MsgVoteResponse. - * @memberof cosmos.gov.v1beta1 - * @interface IMsgVoteResponse - */ - - /** - * Constructs a new MsgVoteResponse. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a MsgVoteResponse. - * @implements IMsgVoteResponse - * @constructor - * @param {cosmos.gov.v1beta1.IMsgVoteResponse=} [properties] Properties to set - */ - function MsgVoteResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgVoteResponse message. Does not implicitly {@link cosmos.gov.v1beta1.MsgVoteResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.MsgVoteResponse - * @static - * @param {cosmos.gov.v1beta1.IMsgVoteResponse} message MsgVoteResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgVoteResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgVoteResponse message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.MsgVoteResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.MsgVoteResponse - * @static - * @param {cosmos.gov.v1beta1.IMsgVoteResponse} message MsgVoteResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgVoteResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgVoteResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.MsgVoteResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.MsgVoteResponse} MsgVoteResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgVoteResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.MsgVoteResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgVoteResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.MsgVoteResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.MsgVoteResponse} MsgVoteResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgVoteResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgVoteResponse message. - * @function verify - * @memberof cosmos.gov.v1beta1.MsgVoteResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgVoteResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgVoteResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.MsgVoteResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.MsgVoteResponse} MsgVoteResponse - */ - MsgVoteResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.MsgVoteResponse) - return object; - return new $root.cosmos.gov.v1beta1.MsgVoteResponse(); - }; - - /** - * Creates a plain object from a MsgVoteResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.MsgVoteResponse - * @static - * @param {cosmos.gov.v1beta1.MsgVoteResponse} message MsgVoteResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgVoteResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgVoteResponse to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.MsgVoteResponse - * @instance - * @returns {Object.} JSON object - */ - MsgVoteResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgVoteResponse; - })(); - - v1beta1.MsgDeposit = (function() { - - /** - * Properties of a MsgDeposit. - * @memberof cosmos.gov.v1beta1 - * @interface IMsgDeposit - * @property {Long|null} [proposal_id] MsgDeposit proposal_id - * @property {string|null} [depositor] MsgDeposit depositor - * @property {Array.|null} [amount] MsgDeposit amount - */ - - /** - * Constructs a new MsgDeposit. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a MsgDeposit. - * @implements IMsgDeposit - * @constructor - * @param {cosmos.gov.v1beta1.IMsgDeposit=} [properties] Properties to set - */ - function MsgDeposit(properties) { - this.amount = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgDeposit proposal_id. - * @member {Long} proposal_id - * @memberof cosmos.gov.v1beta1.MsgDeposit - * @instance - */ - MsgDeposit.prototype.proposal_id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * MsgDeposit depositor. - * @member {string} depositor - * @memberof cosmos.gov.v1beta1.MsgDeposit - * @instance - */ - MsgDeposit.prototype.depositor = ""; - - /** - * MsgDeposit amount. - * @member {Array.} amount - * @memberof cosmos.gov.v1beta1.MsgDeposit - * @instance - */ - MsgDeposit.prototype.amount = $util.emptyArray; - - /** - * Encodes the specified MsgDeposit message. Does not implicitly {@link cosmos.gov.v1beta1.MsgDeposit.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.MsgDeposit - * @static - * @param {cosmos.gov.v1beta1.IMsgDeposit} message MsgDeposit message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgDeposit.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.proposal_id != null && Object.hasOwnProperty.call(message, "proposal_id")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.proposal_id); - if (message.depositor != null && Object.hasOwnProperty.call(message, "depositor")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.depositor); - if (message.amount != null && message.amount.length) - for (let i = 0; i < message.amount.length; ++i) - $root.cosmos.base.v1beta1.Coin.encode(message.amount[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified MsgDeposit message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.MsgDeposit.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.MsgDeposit - * @static - * @param {cosmos.gov.v1beta1.IMsgDeposit} message MsgDeposit message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgDeposit.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgDeposit message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.MsgDeposit - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.MsgDeposit} MsgDeposit - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgDeposit.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.MsgDeposit(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.proposal_id = reader.uint64(); - break; - case 2: - message.depositor = reader.string(); - break; - case 3: - if (!(message.amount && message.amount.length)) - message.amount = []; - message.amount.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgDeposit message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.MsgDeposit - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.MsgDeposit} MsgDeposit - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgDeposit.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgDeposit message. - * @function verify - * @memberof cosmos.gov.v1beta1.MsgDeposit - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgDeposit.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) - if (!$util.isInteger(message.proposal_id) && !(message.proposal_id && $util.isInteger(message.proposal_id.low) && $util.isInteger(message.proposal_id.high))) - return "proposal_id: integer|Long expected"; - if (message.depositor != null && message.hasOwnProperty("depositor")) - if (!$util.isString(message.depositor)) - return "depositor: string expected"; - if (message.amount != null && message.hasOwnProperty("amount")) { - if (!Array.isArray(message.amount)) - return "amount: array expected"; - for (let i = 0; i < message.amount.length; ++i) { - let error = $root.cosmos.base.v1beta1.Coin.verify(message.amount[i]); - if (error) - return "amount." + error; - } - } - return null; - }; - - /** - * Creates a MsgDeposit message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.MsgDeposit - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.MsgDeposit} MsgDeposit - */ - MsgDeposit.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.MsgDeposit) - return object; - let message = new $root.cosmos.gov.v1beta1.MsgDeposit(); - if (object.proposal_id != null) - if ($util.Long) - (message.proposal_id = $util.Long.fromValue(object.proposal_id)).unsigned = true; - else if (typeof object.proposal_id === "string") - message.proposal_id = parseInt(object.proposal_id, 10); - else if (typeof object.proposal_id === "number") - message.proposal_id = object.proposal_id; - else if (typeof object.proposal_id === "object") - message.proposal_id = new $util.LongBits(object.proposal_id.low >>> 0, object.proposal_id.high >>> 0).toNumber(true); - if (object.depositor != null) - message.depositor = String(object.depositor); - if (object.amount) { - if (!Array.isArray(object.amount)) - throw TypeError(".cosmos.gov.v1beta1.MsgDeposit.amount: array expected"); - message.amount = []; - for (let i = 0; i < object.amount.length; ++i) { - if (typeof object.amount[i] !== "object") - throw TypeError(".cosmos.gov.v1beta1.MsgDeposit.amount: object expected"); - message.amount[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.amount[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a MsgDeposit message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.MsgDeposit - * @static - * @param {cosmos.gov.v1beta1.MsgDeposit} message MsgDeposit - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgDeposit.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.amount = []; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.proposal_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.proposal_id = options.longs === String ? "0" : 0; - object.depositor = ""; - } - if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) - if (typeof message.proposal_id === "number") - object.proposal_id = options.longs === String ? String(message.proposal_id) : message.proposal_id; - else - object.proposal_id = options.longs === String ? $util.Long.prototype.toString.call(message.proposal_id) : options.longs === Number ? new $util.LongBits(message.proposal_id.low >>> 0, message.proposal_id.high >>> 0).toNumber(true) : message.proposal_id; - if (message.depositor != null && message.hasOwnProperty("depositor")) - object.depositor = message.depositor; - if (message.amount && message.amount.length) { - object.amount = []; - for (let j = 0; j < message.amount.length; ++j) - object.amount[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.amount[j], options); - } - return object; - }; - - /** - * Converts this MsgDeposit to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.MsgDeposit - * @instance - * @returns {Object.} JSON object - */ - MsgDeposit.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgDeposit; - })(); - - v1beta1.MsgDepositResponse = (function() { - - /** - * Properties of a MsgDepositResponse. - * @memberof cosmos.gov.v1beta1 - * @interface IMsgDepositResponse - */ - - /** - * Constructs a new MsgDepositResponse. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a MsgDepositResponse. - * @implements IMsgDepositResponse - * @constructor - * @param {cosmos.gov.v1beta1.IMsgDepositResponse=} [properties] Properties to set - */ - function MsgDepositResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgDepositResponse message. Does not implicitly {@link cosmos.gov.v1beta1.MsgDepositResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.MsgDepositResponse - * @static - * @param {cosmos.gov.v1beta1.IMsgDepositResponse} message MsgDepositResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgDepositResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgDepositResponse message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.MsgDepositResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.MsgDepositResponse - * @static - * @param {cosmos.gov.v1beta1.IMsgDepositResponse} message MsgDepositResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgDepositResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgDepositResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.MsgDepositResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.MsgDepositResponse} MsgDepositResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgDepositResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.MsgDepositResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgDepositResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.MsgDepositResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.MsgDepositResponse} MsgDepositResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgDepositResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgDepositResponse message. - * @function verify - * @memberof cosmos.gov.v1beta1.MsgDepositResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgDepositResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgDepositResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.MsgDepositResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.MsgDepositResponse} MsgDepositResponse - */ - MsgDepositResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.MsgDepositResponse) - return object; - return new $root.cosmos.gov.v1beta1.MsgDepositResponse(); - }; - - /** - * Creates a plain object from a MsgDepositResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.MsgDepositResponse - * @static - * @param {cosmos.gov.v1beta1.MsgDepositResponse} message MsgDepositResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgDepositResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgDepositResponse to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.MsgDepositResponse - * @instance - * @returns {Object.} JSON object - */ - MsgDepositResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgDepositResponse; - })(); - - /** - * VoteOption enum. - * @name cosmos.gov.v1beta1.VoteOption - * @enum {number} - * @property {number} VOTE_OPTION_UNSPECIFIED=0 VOTE_OPTION_UNSPECIFIED value - * @property {number} VOTE_OPTION_YES=1 VOTE_OPTION_YES value - * @property {number} VOTE_OPTION_ABSTAIN=2 VOTE_OPTION_ABSTAIN value - * @property {number} VOTE_OPTION_NO=3 VOTE_OPTION_NO value - * @property {number} VOTE_OPTION_NO_WITH_VETO=4 VOTE_OPTION_NO_WITH_VETO value - */ - v1beta1.VoteOption = (function() { - const valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "VOTE_OPTION_UNSPECIFIED"] = 0; - values[valuesById[1] = "VOTE_OPTION_YES"] = 1; - values[valuesById[2] = "VOTE_OPTION_ABSTAIN"] = 2; - values[valuesById[3] = "VOTE_OPTION_NO"] = 3; - values[valuesById[4] = "VOTE_OPTION_NO_WITH_VETO"] = 4; - return values; - })(); - - v1beta1.TextProposal = (function() { - - /** - * Properties of a TextProposal. - * @memberof cosmos.gov.v1beta1 - * @interface ITextProposal - * @property {string|null} [title] TextProposal title - * @property {string|null} [description] TextProposal description - */ - - /** - * Constructs a new TextProposal. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a TextProposal. - * @implements ITextProposal - * @constructor - * @param {cosmos.gov.v1beta1.ITextProposal=} [properties] Properties to set - */ - function TextProposal(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * TextProposal title. - * @member {string} title - * @memberof cosmos.gov.v1beta1.TextProposal - * @instance - */ - TextProposal.prototype.title = ""; - - /** - * TextProposal description. - * @member {string} description - * @memberof cosmos.gov.v1beta1.TextProposal - * @instance - */ - TextProposal.prototype.description = ""; - - /** - * Encodes the specified TextProposal message. Does not implicitly {@link cosmos.gov.v1beta1.TextProposal.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.TextProposal - * @static - * @param {cosmos.gov.v1beta1.ITextProposal} message TextProposal message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TextProposal.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.title != null && Object.hasOwnProperty.call(message, "title")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); - return writer; - }; - - /** - * Encodes the specified TextProposal message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.TextProposal.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.TextProposal - * @static - * @param {cosmos.gov.v1beta1.ITextProposal} message TextProposal message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TextProposal.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TextProposal message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.TextProposal - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.TextProposal} TextProposal - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TextProposal.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.TextProposal(); - while (reader.pos < end) { - let 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; - }; - - /** - * Decodes a TextProposal message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.TextProposal - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.TextProposal} TextProposal - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TextProposal.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TextProposal message. - * @function verify - * @memberof cosmos.gov.v1beta1.TextProposal - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TextProposal.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.title != null && message.hasOwnProperty("title")) - if (!$util.isString(message.title)) - return "title: string expected"; - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - return null; - }; - - /** - * Creates a TextProposal message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.TextProposal - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.TextProposal} TextProposal - */ - TextProposal.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.TextProposal) - return object; - let message = new $root.cosmos.gov.v1beta1.TextProposal(); - if (object.title != null) - message.title = String(object.title); - if (object.description != null) - message.description = String(object.description); - return message; - }; - - /** - * Creates a plain object from a TextProposal message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.TextProposal - * @static - * @param {cosmos.gov.v1beta1.TextProposal} message TextProposal - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TextProposal.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.title = ""; - object.description = ""; - } - if (message.title != null && message.hasOwnProperty("title")) - object.title = message.title; - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - return object; - }; - - /** - * Converts this TextProposal to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.TextProposal - * @instance - * @returns {Object.} JSON object - */ - TextProposal.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return TextProposal; - })(); - - v1beta1.Deposit = (function() { - - /** - * Properties of a Deposit. - * @memberof cosmos.gov.v1beta1 - * @interface IDeposit - * @property {Long|null} [proposal_id] Deposit proposal_id - * @property {string|null} [depositor] Deposit depositor - * @property {Array.|null} [amount] Deposit amount - */ - - /** - * Constructs a new Deposit. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a Deposit. - * @implements IDeposit - * @constructor - * @param {cosmos.gov.v1beta1.IDeposit=} [properties] Properties to set - */ - function Deposit(properties) { - this.amount = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Deposit proposal_id. - * @member {Long} proposal_id - * @memberof cosmos.gov.v1beta1.Deposit - * @instance - */ - Deposit.prototype.proposal_id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Deposit depositor. - * @member {string} depositor - * @memberof cosmos.gov.v1beta1.Deposit - * @instance - */ - Deposit.prototype.depositor = ""; - - /** - * Deposit amount. - * @member {Array.} amount - * @memberof cosmos.gov.v1beta1.Deposit - * @instance - */ - Deposit.prototype.amount = $util.emptyArray; - - /** - * Encodes the specified Deposit message. Does not implicitly {@link cosmos.gov.v1beta1.Deposit.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.Deposit - * @static - * @param {cosmos.gov.v1beta1.IDeposit} message Deposit message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Deposit.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.proposal_id != null && Object.hasOwnProperty.call(message, "proposal_id")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.proposal_id); - if (message.depositor != null && Object.hasOwnProperty.call(message, "depositor")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.depositor); - if (message.amount != null && message.amount.length) - for (let i = 0; i < message.amount.length; ++i) - $root.cosmos.base.v1beta1.Coin.encode(message.amount[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Deposit message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.Deposit.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.Deposit - * @static - * @param {cosmos.gov.v1beta1.IDeposit} message Deposit message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Deposit.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Deposit message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.Deposit - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.Deposit} Deposit - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Deposit.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.Deposit(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.proposal_id = reader.uint64(); - break; - case 2: - message.depositor = reader.string(); - break; - case 3: - if (!(message.amount && message.amount.length)) - message.amount = []; - message.amount.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Deposit message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.Deposit - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.Deposit} Deposit - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Deposit.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Deposit message. - * @function verify - * @memberof cosmos.gov.v1beta1.Deposit - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Deposit.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) - if (!$util.isInteger(message.proposal_id) && !(message.proposal_id && $util.isInteger(message.proposal_id.low) && $util.isInteger(message.proposal_id.high))) - return "proposal_id: integer|Long expected"; - if (message.depositor != null && message.hasOwnProperty("depositor")) - if (!$util.isString(message.depositor)) - return "depositor: string expected"; - if (message.amount != null && message.hasOwnProperty("amount")) { - if (!Array.isArray(message.amount)) - return "amount: array expected"; - for (let i = 0; i < message.amount.length; ++i) { - let error = $root.cosmos.base.v1beta1.Coin.verify(message.amount[i]); - if (error) - return "amount." + error; - } - } - return null; - }; - - /** - * Creates a Deposit message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.Deposit - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.Deposit} Deposit - */ - Deposit.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.Deposit) - return object; - let message = new $root.cosmos.gov.v1beta1.Deposit(); - if (object.proposal_id != null) - if ($util.Long) - (message.proposal_id = $util.Long.fromValue(object.proposal_id)).unsigned = true; - else if (typeof object.proposal_id === "string") - message.proposal_id = parseInt(object.proposal_id, 10); - else if (typeof object.proposal_id === "number") - message.proposal_id = object.proposal_id; - else if (typeof object.proposal_id === "object") - message.proposal_id = new $util.LongBits(object.proposal_id.low >>> 0, object.proposal_id.high >>> 0).toNumber(true); - if (object.depositor != null) - message.depositor = String(object.depositor); - if (object.amount) { - if (!Array.isArray(object.amount)) - throw TypeError(".cosmos.gov.v1beta1.Deposit.amount: array expected"); - message.amount = []; - for (let i = 0; i < object.amount.length; ++i) { - if (typeof object.amount[i] !== "object") - throw TypeError(".cosmos.gov.v1beta1.Deposit.amount: object expected"); - message.amount[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.amount[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a Deposit message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.Deposit - * @static - * @param {cosmos.gov.v1beta1.Deposit} message Deposit - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Deposit.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.amount = []; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.proposal_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.proposal_id = options.longs === String ? "0" : 0; - object.depositor = ""; - } - if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) - if (typeof message.proposal_id === "number") - object.proposal_id = options.longs === String ? String(message.proposal_id) : message.proposal_id; - else - object.proposal_id = options.longs === String ? $util.Long.prototype.toString.call(message.proposal_id) : options.longs === Number ? new $util.LongBits(message.proposal_id.low >>> 0, message.proposal_id.high >>> 0).toNumber(true) : message.proposal_id; - if (message.depositor != null && message.hasOwnProperty("depositor")) - object.depositor = message.depositor; - if (message.amount && message.amount.length) { - object.amount = []; - for (let j = 0; j < message.amount.length; ++j) - object.amount[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.amount[j], options); - } - return object; - }; - - /** - * Converts this Deposit to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.Deposit - * @instance - * @returns {Object.} JSON object - */ - Deposit.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Deposit; - })(); - - v1beta1.Proposal = (function() { - - /** - * Properties of a Proposal. - * @memberof cosmos.gov.v1beta1 - * @interface IProposal - * @property {Long|null} [proposal_id] Proposal proposal_id - * @property {google.protobuf.IAny|null} [content] Proposal content - * @property {cosmos.gov.v1beta1.ProposalStatus|null} [status] Proposal status - * @property {cosmos.gov.v1beta1.ITallyResult|null} [final_tally_result] Proposal final_tally_result - * @property {google.protobuf.ITimestamp|null} [submit_time] Proposal submit_time - * @property {google.protobuf.ITimestamp|null} [deposit_end_time] Proposal deposit_end_time - * @property {Array.|null} [total_deposit] Proposal total_deposit - * @property {google.protobuf.ITimestamp|null} [voting_start_time] Proposal voting_start_time - * @property {google.protobuf.ITimestamp|null} [voting_end_time] Proposal voting_end_time - */ - - /** - * Constructs a new Proposal. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a Proposal. - * @implements IProposal - * @constructor - * @param {cosmos.gov.v1beta1.IProposal=} [properties] Properties to set - */ - function Proposal(properties) { - this.total_deposit = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Proposal proposal_id. - * @member {Long} proposal_id - * @memberof cosmos.gov.v1beta1.Proposal - * @instance - */ - Proposal.prototype.proposal_id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Proposal content. - * @member {google.protobuf.IAny|null|undefined} content - * @memberof cosmos.gov.v1beta1.Proposal - * @instance - */ - Proposal.prototype.content = null; - - /** - * Proposal status. - * @member {cosmos.gov.v1beta1.ProposalStatus} status - * @memberof cosmos.gov.v1beta1.Proposal - * @instance - */ - Proposal.prototype.status = 0; - - /** - * Proposal final_tally_result. - * @member {cosmos.gov.v1beta1.ITallyResult|null|undefined} final_tally_result - * @memberof cosmos.gov.v1beta1.Proposal - * @instance - */ - Proposal.prototype.final_tally_result = null; - - /** - * Proposal submit_time. - * @member {google.protobuf.ITimestamp|null|undefined} submit_time - * @memberof cosmos.gov.v1beta1.Proposal - * @instance - */ - Proposal.prototype.submit_time = null; - - /** - * Proposal deposit_end_time. - * @member {google.protobuf.ITimestamp|null|undefined} deposit_end_time - * @memberof cosmos.gov.v1beta1.Proposal - * @instance - */ - Proposal.prototype.deposit_end_time = null; - - /** - * Proposal total_deposit. - * @member {Array.} total_deposit - * @memberof cosmos.gov.v1beta1.Proposal - * @instance - */ - Proposal.prototype.total_deposit = $util.emptyArray; - - /** - * Proposal voting_start_time. - * @member {google.protobuf.ITimestamp|null|undefined} voting_start_time - * @memberof cosmos.gov.v1beta1.Proposal - * @instance - */ - Proposal.prototype.voting_start_time = null; - - /** - * Proposal voting_end_time. - * @member {google.protobuf.ITimestamp|null|undefined} voting_end_time - * @memberof cosmos.gov.v1beta1.Proposal - * @instance - */ - Proposal.prototype.voting_end_time = null; - - /** - * Encodes the specified Proposal message. Does not implicitly {@link cosmos.gov.v1beta1.Proposal.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.Proposal - * @static - * @param {cosmos.gov.v1beta1.IProposal} message Proposal message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Proposal.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.proposal_id != null && Object.hasOwnProperty.call(message, "proposal_id")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.proposal_id); - if (message.content != null && Object.hasOwnProperty.call(message, "content")) - $root.google.protobuf.Any.encode(message.content, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.status != null && Object.hasOwnProperty.call(message, "status")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.status); - if (message.final_tally_result != null && Object.hasOwnProperty.call(message, "final_tally_result")) - $root.cosmos.gov.v1beta1.TallyResult.encode(message.final_tally_result, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.submit_time != null && Object.hasOwnProperty.call(message, "submit_time")) - $root.google.protobuf.Timestamp.encode(message.submit_time, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.deposit_end_time != null && Object.hasOwnProperty.call(message, "deposit_end_time")) - $root.google.protobuf.Timestamp.encode(message.deposit_end_time, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.total_deposit != null && message.total_deposit.length) - for (let i = 0; i < message.total_deposit.length; ++i) - $root.cosmos.base.v1beta1.Coin.encode(message.total_deposit[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.voting_start_time != null && Object.hasOwnProperty.call(message, "voting_start_time")) - $root.google.protobuf.Timestamp.encode(message.voting_start_time, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.voting_end_time != null && Object.hasOwnProperty.call(message, "voting_end_time")) - $root.google.protobuf.Timestamp.encode(message.voting_end_time, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Proposal message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.Proposal.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.Proposal - * @static - * @param {cosmos.gov.v1beta1.IProposal} message Proposal message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Proposal.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Proposal message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.Proposal - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.Proposal} Proposal - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Proposal.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.Proposal(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.proposal_id = reader.uint64(); - break; - case 2: - message.content = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - case 3: - message.status = reader.int32(); - break; - case 4: - message.final_tally_result = $root.cosmos.gov.v1beta1.TallyResult.decode(reader, reader.uint32()); - break; - case 5: - message.submit_time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 6: - message.deposit_end_time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 7: - if (!(message.total_deposit && message.total_deposit.length)) - message.total_deposit = []; - message.total_deposit.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); - break; - case 8: - message.voting_start_time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 9: - message.voting_end_time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Proposal message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.Proposal - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.Proposal} Proposal - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Proposal.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Proposal message. - * @function verify - * @memberof cosmos.gov.v1beta1.Proposal - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Proposal.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) - if (!$util.isInteger(message.proposal_id) && !(message.proposal_id && $util.isInteger(message.proposal_id.low) && $util.isInteger(message.proposal_id.high))) - return "proposal_id: integer|Long expected"; - if (message.content != null && message.hasOwnProperty("content")) { - let error = $root.google.protobuf.Any.verify(message.content); - if (error) - return "content." + error; - } - if (message.status != null && message.hasOwnProperty("status")) - switch (message.status) { - default: - return "status: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.final_tally_result != null && message.hasOwnProperty("final_tally_result")) { - let error = $root.cosmos.gov.v1beta1.TallyResult.verify(message.final_tally_result); - if (error) - return "final_tally_result." + error; - } - if (message.submit_time != null && message.hasOwnProperty("submit_time")) { - let error = $root.google.protobuf.Timestamp.verify(message.submit_time); - if (error) - return "submit_time." + error; - } - if (message.deposit_end_time != null && message.hasOwnProperty("deposit_end_time")) { - let error = $root.google.protobuf.Timestamp.verify(message.deposit_end_time); - if (error) - return "deposit_end_time." + error; - } - if (message.total_deposit != null && message.hasOwnProperty("total_deposit")) { - if (!Array.isArray(message.total_deposit)) - return "total_deposit: array expected"; - for (let i = 0; i < message.total_deposit.length; ++i) { - let error = $root.cosmos.base.v1beta1.Coin.verify(message.total_deposit[i]); - if (error) - return "total_deposit." + error; - } - } - if (message.voting_start_time != null && message.hasOwnProperty("voting_start_time")) { - let error = $root.google.protobuf.Timestamp.verify(message.voting_start_time); - if (error) - return "voting_start_time." + error; - } - if (message.voting_end_time != null && message.hasOwnProperty("voting_end_time")) { - let error = $root.google.protobuf.Timestamp.verify(message.voting_end_time); - if (error) - return "voting_end_time." + error; - } - return null; - }; - - /** - * Creates a Proposal message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.Proposal - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.Proposal} Proposal - */ - Proposal.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.Proposal) - return object; - let message = new $root.cosmos.gov.v1beta1.Proposal(); - if (object.proposal_id != null) - if ($util.Long) - (message.proposal_id = $util.Long.fromValue(object.proposal_id)).unsigned = true; - else if (typeof object.proposal_id === "string") - message.proposal_id = parseInt(object.proposal_id, 10); - else if (typeof object.proposal_id === "number") - message.proposal_id = object.proposal_id; - else if (typeof object.proposal_id === "object") - message.proposal_id = new $util.LongBits(object.proposal_id.low >>> 0, object.proposal_id.high >>> 0).toNumber(true); - if (object.content != null) { - if (typeof object.content !== "object") - throw TypeError(".cosmos.gov.v1beta1.Proposal.content: object expected"); - message.content = $root.google.protobuf.Any.fromObject(object.content); - } - switch (object.status) { - case "PROPOSAL_STATUS_UNSPECIFIED": - case 0: - message.status = 0; - break; - case "PROPOSAL_STATUS_DEPOSIT_PERIOD": - case 1: - message.status = 1; - break; - case "PROPOSAL_STATUS_VOTING_PERIOD": - case 2: - message.status = 2; - break; - case "PROPOSAL_STATUS_PASSED": - case 3: - message.status = 3; - break; - case "PROPOSAL_STATUS_REJECTED": - case 4: - message.status = 4; - break; - case "PROPOSAL_STATUS_FAILED": - case 5: - message.status = 5; - break; - } - if (object.final_tally_result != null) { - if (typeof object.final_tally_result !== "object") - throw TypeError(".cosmos.gov.v1beta1.Proposal.final_tally_result: object expected"); - message.final_tally_result = $root.cosmos.gov.v1beta1.TallyResult.fromObject(object.final_tally_result); - } - if (object.submit_time != null) { - if (typeof object.submit_time !== "object") - throw TypeError(".cosmos.gov.v1beta1.Proposal.submit_time: object expected"); - message.submit_time = $root.google.protobuf.Timestamp.fromObject(object.submit_time); - } - if (object.deposit_end_time != null) { - if (typeof object.deposit_end_time !== "object") - throw TypeError(".cosmos.gov.v1beta1.Proposal.deposit_end_time: object expected"); - message.deposit_end_time = $root.google.protobuf.Timestamp.fromObject(object.deposit_end_time); - } - if (object.total_deposit) { - if (!Array.isArray(object.total_deposit)) - throw TypeError(".cosmos.gov.v1beta1.Proposal.total_deposit: array expected"); - message.total_deposit = []; - for (let i = 0; i < object.total_deposit.length; ++i) { - if (typeof object.total_deposit[i] !== "object") - throw TypeError(".cosmos.gov.v1beta1.Proposal.total_deposit: object expected"); - message.total_deposit[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.total_deposit[i]); - } - } - if (object.voting_start_time != null) { - if (typeof object.voting_start_time !== "object") - throw TypeError(".cosmos.gov.v1beta1.Proposal.voting_start_time: object expected"); - message.voting_start_time = $root.google.protobuf.Timestamp.fromObject(object.voting_start_time); - } - if (object.voting_end_time != null) { - if (typeof object.voting_end_time !== "object") - throw TypeError(".cosmos.gov.v1beta1.Proposal.voting_end_time: object expected"); - message.voting_end_time = $root.google.protobuf.Timestamp.fromObject(object.voting_end_time); - } - return message; - }; - - /** - * Creates a plain object from a Proposal message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.Proposal - * @static - * @param {cosmos.gov.v1beta1.Proposal} message Proposal - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Proposal.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.total_deposit = []; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.proposal_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.proposal_id = options.longs === String ? "0" : 0; - object.content = null; - object.status = options.enums === String ? "PROPOSAL_STATUS_UNSPECIFIED" : 0; - object.final_tally_result = null; - object.submit_time = null; - object.deposit_end_time = null; - object.voting_start_time = null; - object.voting_end_time = null; - } - if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) - if (typeof message.proposal_id === "number") - object.proposal_id = options.longs === String ? String(message.proposal_id) : message.proposal_id; - else - object.proposal_id = options.longs === String ? $util.Long.prototype.toString.call(message.proposal_id) : options.longs === Number ? new $util.LongBits(message.proposal_id.low >>> 0, message.proposal_id.high >>> 0).toNumber(true) : message.proposal_id; - if (message.content != null && message.hasOwnProperty("content")) - object.content = $root.google.protobuf.Any.toObject(message.content, options); - if (message.status != null && message.hasOwnProperty("status")) - object.status = options.enums === String ? $root.cosmos.gov.v1beta1.ProposalStatus[message.status] : message.status; - if (message.final_tally_result != null && message.hasOwnProperty("final_tally_result")) - object.final_tally_result = $root.cosmos.gov.v1beta1.TallyResult.toObject(message.final_tally_result, options); - if (message.submit_time != null && message.hasOwnProperty("submit_time")) - object.submit_time = $root.google.protobuf.Timestamp.toObject(message.submit_time, options); - if (message.deposit_end_time != null && message.hasOwnProperty("deposit_end_time")) - object.deposit_end_time = $root.google.protobuf.Timestamp.toObject(message.deposit_end_time, options); - if (message.total_deposit && message.total_deposit.length) { - object.total_deposit = []; - for (let j = 0; j < message.total_deposit.length; ++j) - object.total_deposit[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.total_deposit[j], options); - } - if (message.voting_start_time != null && message.hasOwnProperty("voting_start_time")) - object.voting_start_time = $root.google.protobuf.Timestamp.toObject(message.voting_start_time, options); - if (message.voting_end_time != null && message.hasOwnProperty("voting_end_time")) - object.voting_end_time = $root.google.protobuf.Timestamp.toObject(message.voting_end_time, options); - return object; - }; - - /** - * Converts this Proposal to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.Proposal - * @instance - * @returns {Object.} JSON object - */ - Proposal.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Proposal; - })(); - - /** - * ProposalStatus enum. - * @name cosmos.gov.v1beta1.ProposalStatus - * @enum {number} - * @property {number} PROPOSAL_STATUS_UNSPECIFIED=0 PROPOSAL_STATUS_UNSPECIFIED value - * @property {number} PROPOSAL_STATUS_DEPOSIT_PERIOD=1 PROPOSAL_STATUS_DEPOSIT_PERIOD value - * @property {number} PROPOSAL_STATUS_VOTING_PERIOD=2 PROPOSAL_STATUS_VOTING_PERIOD value - * @property {number} PROPOSAL_STATUS_PASSED=3 PROPOSAL_STATUS_PASSED value - * @property {number} PROPOSAL_STATUS_REJECTED=4 PROPOSAL_STATUS_REJECTED value - * @property {number} PROPOSAL_STATUS_FAILED=5 PROPOSAL_STATUS_FAILED value - */ - v1beta1.ProposalStatus = (function() { - const valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "PROPOSAL_STATUS_UNSPECIFIED"] = 0; - values[valuesById[1] = "PROPOSAL_STATUS_DEPOSIT_PERIOD"] = 1; - values[valuesById[2] = "PROPOSAL_STATUS_VOTING_PERIOD"] = 2; - values[valuesById[3] = "PROPOSAL_STATUS_PASSED"] = 3; - values[valuesById[4] = "PROPOSAL_STATUS_REJECTED"] = 4; - values[valuesById[5] = "PROPOSAL_STATUS_FAILED"] = 5; - return values; - })(); - - v1beta1.TallyResult = (function() { - - /** - * Properties of a TallyResult. - * @memberof cosmos.gov.v1beta1 - * @interface ITallyResult - * @property {string|null} [yes] TallyResult yes - * @property {string|null} [abstain] TallyResult abstain - * @property {string|null} [no] TallyResult no - * @property {string|null} [no_with_veto] TallyResult no_with_veto - */ - - /** - * Constructs a new TallyResult. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a TallyResult. - * @implements ITallyResult - * @constructor - * @param {cosmos.gov.v1beta1.ITallyResult=} [properties] Properties to set - */ - function TallyResult(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * TallyResult yes. - * @member {string} yes - * @memberof cosmos.gov.v1beta1.TallyResult - * @instance - */ - TallyResult.prototype.yes = ""; - - /** - * TallyResult abstain. - * @member {string} abstain - * @memberof cosmos.gov.v1beta1.TallyResult - * @instance - */ - TallyResult.prototype.abstain = ""; - - /** - * TallyResult no. - * @member {string} no - * @memberof cosmos.gov.v1beta1.TallyResult - * @instance - */ - TallyResult.prototype.no = ""; - - /** - * TallyResult no_with_veto. - * @member {string} no_with_veto - * @memberof cosmos.gov.v1beta1.TallyResult - * @instance - */ - TallyResult.prototype.no_with_veto = ""; - - /** - * Encodes the specified TallyResult message. Does not implicitly {@link cosmos.gov.v1beta1.TallyResult.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.TallyResult - * @static - * @param {cosmos.gov.v1beta1.ITallyResult} message TallyResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TallyResult.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.yes != null && Object.hasOwnProperty.call(message, "yes")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.yes); - if (message.abstain != null && Object.hasOwnProperty.call(message, "abstain")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.abstain); - if (message.no != null && Object.hasOwnProperty.call(message, "no")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.no); - if (message.no_with_veto != null && Object.hasOwnProperty.call(message, "no_with_veto")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.no_with_veto); - return writer; - }; - - /** - * Encodes the specified TallyResult message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.TallyResult.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.TallyResult - * @static - * @param {cosmos.gov.v1beta1.ITallyResult} message TallyResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TallyResult.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TallyResult message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.TallyResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.TallyResult} TallyResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TallyResult.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.TallyResult(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.yes = reader.string(); - break; - case 2: - message.abstain = reader.string(); - break; - case 3: - message.no = reader.string(); - break; - case 4: - message.no_with_veto = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a TallyResult message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.TallyResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.TallyResult} TallyResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TallyResult.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TallyResult message. - * @function verify - * @memberof cosmos.gov.v1beta1.TallyResult - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TallyResult.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.yes != null && message.hasOwnProperty("yes")) - if (!$util.isString(message.yes)) - return "yes: string expected"; - if (message.abstain != null && message.hasOwnProperty("abstain")) - if (!$util.isString(message.abstain)) - return "abstain: string expected"; - if (message.no != null && message.hasOwnProperty("no")) - if (!$util.isString(message.no)) - return "no: string expected"; - if (message.no_with_veto != null && message.hasOwnProperty("no_with_veto")) - if (!$util.isString(message.no_with_veto)) - return "no_with_veto: string expected"; - return null; - }; - - /** - * Creates a TallyResult message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.TallyResult - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.TallyResult} TallyResult - */ - TallyResult.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.TallyResult) - return object; - let message = new $root.cosmos.gov.v1beta1.TallyResult(); - if (object.yes != null) - message.yes = String(object.yes); - if (object.abstain != null) - message.abstain = String(object.abstain); - if (object.no != null) - message.no = String(object.no); - if (object.no_with_veto != null) - message.no_with_veto = String(object.no_with_veto); - return message; - }; - - /** - * Creates a plain object from a TallyResult message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.TallyResult - * @static - * @param {cosmos.gov.v1beta1.TallyResult} message TallyResult - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TallyResult.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.yes = ""; - object.abstain = ""; - object.no = ""; - object.no_with_veto = ""; - } - if (message.yes != null && message.hasOwnProperty("yes")) - object.yes = message.yes; - if (message.abstain != null && message.hasOwnProperty("abstain")) - object.abstain = message.abstain; - if (message.no != null && message.hasOwnProperty("no")) - object.no = message.no; - if (message.no_with_veto != null && message.hasOwnProperty("no_with_veto")) - object.no_with_veto = message.no_with_veto; - return object; - }; - - /** - * Converts this TallyResult to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.TallyResult - * @instance - * @returns {Object.} JSON object - */ - TallyResult.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return TallyResult; - })(); - - v1beta1.Vote = (function() { - - /** - * Properties of a Vote. - * @memberof cosmos.gov.v1beta1 - * @interface IVote - * @property {Long|null} [proposal_id] Vote proposal_id - * @property {string|null} [voter] Vote voter - * @property {cosmos.gov.v1beta1.VoteOption|null} [option] Vote option - */ - - /** - * Constructs a new Vote. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a Vote. - * @implements IVote - * @constructor - * @param {cosmos.gov.v1beta1.IVote=} [properties] Properties to set - */ - function Vote(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Vote proposal_id. - * @member {Long} proposal_id - * @memberof cosmos.gov.v1beta1.Vote - * @instance - */ - Vote.prototype.proposal_id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Vote voter. - * @member {string} voter - * @memberof cosmos.gov.v1beta1.Vote - * @instance - */ - Vote.prototype.voter = ""; - - /** - * Vote option. - * @member {cosmos.gov.v1beta1.VoteOption} option - * @memberof cosmos.gov.v1beta1.Vote - * @instance - */ - Vote.prototype.option = 0; - - /** - * Encodes the specified Vote message. Does not implicitly {@link cosmos.gov.v1beta1.Vote.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.Vote - * @static - * @param {cosmos.gov.v1beta1.IVote} message Vote message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Vote.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.proposal_id != null && Object.hasOwnProperty.call(message, "proposal_id")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.proposal_id); - if (message.voter != null && Object.hasOwnProperty.call(message, "voter")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.voter); - if (message.option != null && Object.hasOwnProperty.call(message, "option")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.option); - return writer; - }; - - /** - * Encodes the specified Vote message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.Vote.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.Vote - * @static - * @param {cosmos.gov.v1beta1.IVote} message Vote message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Vote.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Vote message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.Vote - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.Vote} Vote - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Vote.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.Vote(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.proposal_id = reader.uint64(); - break; - case 2: - message.voter = reader.string(); - break; - case 3: - message.option = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Vote message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.Vote - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.Vote} Vote - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Vote.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Vote message. - * @function verify - * @memberof cosmos.gov.v1beta1.Vote - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Vote.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) - if (!$util.isInteger(message.proposal_id) && !(message.proposal_id && $util.isInteger(message.proposal_id.low) && $util.isInteger(message.proposal_id.high))) - return "proposal_id: integer|Long expected"; - if (message.voter != null && message.hasOwnProperty("voter")) - if (!$util.isString(message.voter)) - return "voter: string expected"; - if (message.option != null && message.hasOwnProperty("option")) - switch (message.option) { - default: - return "option: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; - } - return null; - }; - - /** - * Creates a Vote message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.Vote - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.Vote} Vote - */ - Vote.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.Vote) - return object; - let message = new $root.cosmos.gov.v1beta1.Vote(); - if (object.proposal_id != null) - if ($util.Long) - (message.proposal_id = $util.Long.fromValue(object.proposal_id)).unsigned = true; - else if (typeof object.proposal_id === "string") - message.proposal_id = parseInt(object.proposal_id, 10); - else if (typeof object.proposal_id === "number") - message.proposal_id = object.proposal_id; - else if (typeof object.proposal_id === "object") - message.proposal_id = new $util.LongBits(object.proposal_id.low >>> 0, object.proposal_id.high >>> 0).toNumber(true); - if (object.voter != null) - message.voter = String(object.voter); - switch (object.option) { - case "VOTE_OPTION_UNSPECIFIED": - case 0: - message.option = 0; - break; - case "VOTE_OPTION_YES": - case 1: - message.option = 1; - break; - case "VOTE_OPTION_ABSTAIN": - case 2: - message.option = 2; - break; - case "VOTE_OPTION_NO": - case 3: - message.option = 3; - break; - case "VOTE_OPTION_NO_WITH_VETO": - case 4: - message.option = 4; - break; - } - return message; - }; - - /** - * Creates a plain object from a Vote message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.Vote - * @static - * @param {cosmos.gov.v1beta1.Vote} message Vote - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Vote.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.proposal_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.proposal_id = options.longs === String ? "0" : 0; - object.voter = ""; - object.option = options.enums === String ? "VOTE_OPTION_UNSPECIFIED" : 0; - } - if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) - if (typeof message.proposal_id === "number") - object.proposal_id = options.longs === String ? String(message.proposal_id) : message.proposal_id; - else - object.proposal_id = options.longs === String ? $util.Long.prototype.toString.call(message.proposal_id) : options.longs === Number ? new $util.LongBits(message.proposal_id.low >>> 0, message.proposal_id.high >>> 0).toNumber(true) : message.proposal_id; - if (message.voter != null && message.hasOwnProperty("voter")) - object.voter = message.voter; - if (message.option != null && message.hasOwnProperty("option")) - object.option = options.enums === String ? $root.cosmos.gov.v1beta1.VoteOption[message.option] : message.option; - return object; - }; - - /** - * Converts this Vote to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.Vote - * @instance - * @returns {Object.} JSON object - */ - Vote.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Vote; - })(); - - v1beta1.DepositParams = (function() { - - /** - * Properties of a DepositParams. - * @memberof cosmos.gov.v1beta1 - * @interface IDepositParams - * @property {Array.|null} [min_deposit] DepositParams min_deposit - * @property {google.protobuf.IDuration|null} [max_deposit_period] DepositParams max_deposit_period - */ - - /** - * Constructs a new DepositParams. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a DepositParams. - * @implements IDepositParams - * @constructor - * @param {cosmos.gov.v1beta1.IDepositParams=} [properties] Properties to set - */ - function DepositParams(properties) { - this.min_deposit = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DepositParams min_deposit. - * @member {Array.} min_deposit - * @memberof cosmos.gov.v1beta1.DepositParams - * @instance - */ - DepositParams.prototype.min_deposit = $util.emptyArray; - - /** - * DepositParams max_deposit_period. - * @member {google.protobuf.IDuration|null|undefined} max_deposit_period - * @memberof cosmos.gov.v1beta1.DepositParams - * @instance - */ - DepositParams.prototype.max_deposit_period = null; - - /** - * Encodes the specified DepositParams message. Does not implicitly {@link cosmos.gov.v1beta1.DepositParams.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.DepositParams - * @static - * @param {cosmos.gov.v1beta1.IDepositParams} message DepositParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DepositParams.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.min_deposit != null && message.min_deposit.length) - for (let i = 0; i < message.min_deposit.length; ++i) - $root.cosmos.base.v1beta1.Coin.encode(message.min_deposit[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.max_deposit_period != null && Object.hasOwnProperty.call(message, "max_deposit_period")) - $root.google.protobuf.Duration.encode(message.max_deposit_period, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified DepositParams message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.DepositParams.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.DepositParams - * @static - * @param {cosmos.gov.v1beta1.IDepositParams} message DepositParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DepositParams.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DepositParams message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.DepositParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.DepositParams} DepositParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DepositParams.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.DepositParams(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.min_deposit && message.min_deposit.length)) - message.min_deposit = []; - message.min_deposit.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); - break; - case 2: - message.max_deposit_period = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DepositParams message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.DepositParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.DepositParams} DepositParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DepositParams.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DepositParams message. - * @function verify - * @memberof cosmos.gov.v1beta1.DepositParams - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DepositParams.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.min_deposit != null && message.hasOwnProperty("min_deposit")) { - if (!Array.isArray(message.min_deposit)) - return "min_deposit: array expected"; - for (let i = 0; i < message.min_deposit.length; ++i) { - let error = $root.cosmos.base.v1beta1.Coin.verify(message.min_deposit[i]); - if (error) - return "min_deposit." + error; - } - } - if (message.max_deposit_period != null && message.hasOwnProperty("max_deposit_period")) { - let error = $root.google.protobuf.Duration.verify(message.max_deposit_period); - if (error) - return "max_deposit_period." + error; - } - return null; - }; - - /** - * Creates a DepositParams message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.DepositParams - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.DepositParams} DepositParams - */ - DepositParams.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.DepositParams) - return object; - let message = new $root.cosmos.gov.v1beta1.DepositParams(); - if (object.min_deposit) { - if (!Array.isArray(object.min_deposit)) - throw TypeError(".cosmos.gov.v1beta1.DepositParams.min_deposit: array expected"); - message.min_deposit = []; - for (let i = 0; i < object.min_deposit.length; ++i) { - if (typeof object.min_deposit[i] !== "object") - throw TypeError(".cosmos.gov.v1beta1.DepositParams.min_deposit: object expected"); - message.min_deposit[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.min_deposit[i]); - } - } - if (object.max_deposit_period != null) { - if (typeof object.max_deposit_period !== "object") - throw TypeError(".cosmos.gov.v1beta1.DepositParams.max_deposit_period: object expected"); - message.max_deposit_period = $root.google.protobuf.Duration.fromObject(object.max_deposit_period); - } - return message; - }; - - /** - * Creates a plain object from a DepositParams message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.DepositParams - * @static - * @param {cosmos.gov.v1beta1.DepositParams} message DepositParams - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DepositParams.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.min_deposit = []; - if (options.defaults) - object.max_deposit_period = null; - if (message.min_deposit && message.min_deposit.length) { - object.min_deposit = []; - for (let j = 0; j < message.min_deposit.length; ++j) - object.min_deposit[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.min_deposit[j], options); - } - if (message.max_deposit_period != null && message.hasOwnProperty("max_deposit_period")) - object.max_deposit_period = $root.google.protobuf.Duration.toObject(message.max_deposit_period, options); - return object; - }; - - /** - * Converts this DepositParams to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.DepositParams - * @instance - * @returns {Object.} JSON object - */ - DepositParams.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return DepositParams; - })(); - - v1beta1.VotingParams = (function() { - - /** - * Properties of a VotingParams. - * @memberof cosmos.gov.v1beta1 - * @interface IVotingParams - * @property {google.protobuf.IDuration|null} [voting_period] VotingParams voting_period - */ - - /** - * Constructs a new VotingParams. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a VotingParams. - * @implements IVotingParams - * @constructor - * @param {cosmos.gov.v1beta1.IVotingParams=} [properties] Properties to set - */ - function VotingParams(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * VotingParams voting_period. - * @member {google.protobuf.IDuration|null|undefined} voting_period - * @memberof cosmos.gov.v1beta1.VotingParams - * @instance - */ - VotingParams.prototype.voting_period = null; - - /** - * Encodes the specified VotingParams message. Does not implicitly {@link cosmos.gov.v1beta1.VotingParams.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.VotingParams - * @static - * @param {cosmos.gov.v1beta1.IVotingParams} message VotingParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - VotingParams.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.voting_period != null && Object.hasOwnProperty.call(message, "voting_period")) - $root.google.protobuf.Duration.encode(message.voting_period, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified VotingParams message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.VotingParams.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.VotingParams - * @static - * @param {cosmos.gov.v1beta1.IVotingParams} message VotingParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - VotingParams.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a VotingParams message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.VotingParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.VotingParams} VotingParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - VotingParams.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.VotingParams(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.voting_period = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a VotingParams message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.VotingParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.VotingParams} VotingParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - VotingParams.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a VotingParams message. - * @function verify - * @memberof cosmos.gov.v1beta1.VotingParams - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - VotingParams.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.voting_period != null && message.hasOwnProperty("voting_period")) { - let error = $root.google.protobuf.Duration.verify(message.voting_period); - if (error) - return "voting_period." + error; - } - return null; - }; - - /** - * Creates a VotingParams message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.VotingParams - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.VotingParams} VotingParams - */ - VotingParams.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.VotingParams) - return object; - let message = new $root.cosmos.gov.v1beta1.VotingParams(); - if (object.voting_period != null) { - if (typeof object.voting_period !== "object") - throw TypeError(".cosmos.gov.v1beta1.VotingParams.voting_period: object expected"); - message.voting_period = $root.google.protobuf.Duration.fromObject(object.voting_period); - } - return message; - }; - - /** - * Creates a plain object from a VotingParams message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.VotingParams - * @static - * @param {cosmos.gov.v1beta1.VotingParams} message VotingParams - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - VotingParams.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.voting_period = null; - if (message.voting_period != null && message.hasOwnProperty("voting_period")) - object.voting_period = $root.google.protobuf.Duration.toObject(message.voting_period, options); - return object; - }; - - /** - * Converts this VotingParams to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.VotingParams - * @instance - * @returns {Object.} JSON object - */ - VotingParams.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return VotingParams; - })(); - - v1beta1.TallyParams = (function() { - - /** - * Properties of a TallyParams. - * @memberof cosmos.gov.v1beta1 - * @interface ITallyParams - * @property {Uint8Array|null} [quorum] TallyParams quorum - * @property {Uint8Array|null} [threshold] TallyParams threshold - * @property {Uint8Array|null} [veto_threshold] TallyParams veto_threshold - */ - - /** - * Constructs a new TallyParams. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a TallyParams. - * @implements ITallyParams - * @constructor - * @param {cosmos.gov.v1beta1.ITallyParams=} [properties] Properties to set - */ - function TallyParams(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * TallyParams quorum. - * @member {Uint8Array} quorum - * @memberof cosmos.gov.v1beta1.TallyParams - * @instance - */ - TallyParams.prototype.quorum = $util.newBuffer([]); - - /** - * TallyParams threshold. - * @member {Uint8Array} threshold - * @memberof cosmos.gov.v1beta1.TallyParams - * @instance - */ - TallyParams.prototype.threshold = $util.newBuffer([]); - - /** - * TallyParams veto_threshold. - * @member {Uint8Array} veto_threshold - * @memberof cosmos.gov.v1beta1.TallyParams - * @instance - */ - TallyParams.prototype.veto_threshold = $util.newBuffer([]); - - /** - * Encodes the specified TallyParams message. Does not implicitly {@link cosmos.gov.v1beta1.TallyParams.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.TallyParams - * @static - * @param {cosmos.gov.v1beta1.ITallyParams} message TallyParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TallyParams.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.quorum != null && Object.hasOwnProperty.call(message, "quorum")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.quorum); - if (message.threshold != null && Object.hasOwnProperty.call(message, "threshold")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.threshold); - if (message.veto_threshold != null && Object.hasOwnProperty.call(message, "veto_threshold")) - writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.veto_threshold); - return writer; - }; - - /** - * Encodes the specified TallyParams message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.TallyParams.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.TallyParams - * @static - * @param {cosmos.gov.v1beta1.ITallyParams} message TallyParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TallyParams.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TallyParams message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.TallyParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.TallyParams} TallyParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TallyParams.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.TallyParams(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.quorum = reader.bytes(); - break; - case 2: - message.threshold = reader.bytes(); - break; - case 3: - message.veto_threshold = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a TallyParams message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.TallyParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.TallyParams} TallyParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TallyParams.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TallyParams message. - * @function verify - * @memberof cosmos.gov.v1beta1.TallyParams - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TallyParams.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.quorum != null && message.hasOwnProperty("quorum")) - if (!(message.quorum && typeof message.quorum.length === "number" || $util.isString(message.quorum))) - return "quorum: buffer expected"; - if (message.threshold != null && message.hasOwnProperty("threshold")) - if (!(message.threshold && typeof message.threshold.length === "number" || $util.isString(message.threshold))) - return "threshold: buffer expected"; - if (message.veto_threshold != null && message.hasOwnProperty("veto_threshold")) - if (!(message.veto_threshold && typeof message.veto_threshold.length === "number" || $util.isString(message.veto_threshold))) - return "veto_threshold: buffer expected"; - return null; - }; - - /** - * Creates a TallyParams message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.TallyParams - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.TallyParams} TallyParams - */ - TallyParams.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.TallyParams) - return object; - let message = new $root.cosmos.gov.v1beta1.TallyParams(); - if (object.quorum != null) - if (typeof object.quorum === "string") - $util.base64.decode(object.quorum, message.quorum = $util.newBuffer($util.base64.length(object.quorum)), 0); - else if (object.quorum.length) - message.quorum = object.quorum; - if (object.threshold != null) - if (typeof object.threshold === "string") - $util.base64.decode(object.threshold, message.threshold = $util.newBuffer($util.base64.length(object.threshold)), 0); - else if (object.threshold.length) - message.threshold = object.threshold; - if (object.veto_threshold != null) - if (typeof object.veto_threshold === "string") - $util.base64.decode(object.veto_threshold, message.veto_threshold = $util.newBuffer($util.base64.length(object.veto_threshold)), 0); - else if (object.veto_threshold.length) - message.veto_threshold = object.veto_threshold; - return message; - }; - - /** - * Creates a plain object from a TallyParams message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.TallyParams - * @static - * @param {cosmos.gov.v1beta1.TallyParams} message TallyParams - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TallyParams.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if (options.bytes === String) - object.quorum = ""; - else { - object.quorum = []; - if (options.bytes !== Array) - object.quorum = $util.newBuffer(object.quorum); - } - if (options.bytes === String) - object.threshold = ""; - else { - object.threshold = []; - if (options.bytes !== Array) - object.threshold = $util.newBuffer(object.threshold); - } - if (options.bytes === String) - object.veto_threshold = ""; - else { - object.veto_threshold = []; - if (options.bytes !== Array) - object.veto_threshold = $util.newBuffer(object.veto_threshold); - } - } - if (message.quorum != null && message.hasOwnProperty("quorum")) - object.quorum = options.bytes === String ? $util.base64.encode(message.quorum, 0, message.quorum.length) : options.bytes === Array ? Array.prototype.slice.call(message.quorum) : message.quorum; - if (message.threshold != null && message.hasOwnProperty("threshold")) - object.threshold = options.bytes === String ? $util.base64.encode(message.threshold, 0, message.threshold.length) : options.bytes === Array ? Array.prototype.slice.call(message.threshold) : message.threshold; - if (message.veto_threshold != null && message.hasOwnProperty("veto_threshold")) - object.veto_threshold = options.bytes === String ? $util.base64.encode(message.veto_threshold, 0, message.veto_threshold.length) : options.bytes === Array ? Array.prototype.slice.call(message.veto_threshold) : message.veto_threshold; - return object; - }; - - /** - * Converts this TallyParams to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.TallyParams - * @instance - * @returns {Object.} JSON object - */ - TallyParams.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return TallyParams; - })(); - - v1beta1.Query = (function() { - - /** - * Constructs a new Query service. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a Query - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function Query(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Query.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Query; - - /** - * Callback as used by {@link cosmos.gov.v1beta1.Query#proposal}. - * @memberof cosmos.gov.v1beta1.Query - * @typedef ProposalCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.gov.v1beta1.QueryProposalResponse} [response] QueryProposalResponse - */ - - /** - * Calls Proposal. - * @function proposal - * @memberof cosmos.gov.v1beta1.Query - * @instance - * @param {cosmos.gov.v1beta1.IQueryProposalRequest} request QueryProposalRequest message or plain object - * @param {cosmos.gov.v1beta1.Query.ProposalCallback} callback Node-style callback called with the error, if any, and QueryProposalResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.proposal = function proposal(request, callback) { - return this.rpcCall(proposal, $root.cosmos.gov.v1beta1.QueryProposalRequest, $root.cosmos.gov.v1beta1.QueryProposalResponse, request, callback); - }, "name", { value: "Proposal" }); - - /** - * Calls Proposal. - * @function proposal - * @memberof cosmos.gov.v1beta1.Query - * @instance - * @param {cosmos.gov.v1beta1.IQueryProposalRequest} request QueryProposalRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.gov.v1beta1.Query#proposals}. - * @memberof cosmos.gov.v1beta1.Query - * @typedef ProposalsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.gov.v1beta1.QueryProposalsResponse} [response] QueryProposalsResponse - */ - - /** - * Calls Proposals. - * @function proposals - * @memberof cosmos.gov.v1beta1.Query - * @instance - * @param {cosmos.gov.v1beta1.IQueryProposalsRequest} request QueryProposalsRequest message or plain object - * @param {cosmos.gov.v1beta1.Query.ProposalsCallback} callback Node-style callback called with the error, if any, and QueryProposalsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.proposals = function proposals(request, callback) { - return this.rpcCall(proposals, $root.cosmos.gov.v1beta1.QueryProposalsRequest, $root.cosmos.gov.v1beta1.QueryProposalsResponse, request, callback); - }, "name", { value: "Proposals" }); - - /** - * Calls Proposals. - * @function proposals - * @memberof cosmos.gov.v1beta1.Query - * @instance - * @param {cosmos.gov.v1beta1.IQueryProposalsRequest} request QueryProposalsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.gov.v1beta1.Query#vote}. - * @memberof cosmos.gov.v1beta1.Query - * @typedef VoteCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.gov.v1beta1.QueryVoteResponse} [response] QueryVoteResponse - */ - - /** - * Calls Vote. - * @function vote - * @memberof cosmos.gov.v1beta1.Query - * @instance - * @param {cosmos.gov.v1beta1.IQueryVoteRequest} request QueryVoteRequest message or plain object - * @param {cosmos.gov.v1beta1.Query.VoteCallback} callback Node-style callback called with the error, if any, and QueryVoteResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.vote = function vote(request, callback) { - return this.rpcCall(vote, $root.cosmos.gov.v1beta1.QueryVoteRequest, $root.cosmos.gov.v1beta1.QueryVoteResponse, request, callback); - }, "name", { value: "Vote" }); - - /** - * Calls Vote. - * @function vote - * @memberof cosmos.gov.v1beta1.Query - * @instance - * @param {cosmos.gov.v1beta1.IQueryVoteRequest} request QueryVoteRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.gov.v1beta1.Query#votes}. - * @memberof cosmos.gov.v1beta1.Query - * @typedef VotesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.gov.v1beta1.QueryVotesResponse} [response] QueryVotesResponse - */ - - /** - * Calls Votes. - * @function votes - * @memberof cosmos.gov.v1beta1.Query - * @instance - * @param {cosmos.gov.v1beta1.IQueryVotesRequest} request QueryVotesRequest message or plain object - * @param {cosmos.gov.v1beta1.Query.VotesCallback} callback Node-style callback called with the error, if any, and QueryVotesResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.votes = function votes(request, callback) { - return this.rpcCall(votes, $root.cosmos.gov.v1beta1.QueryVotesRequest, $root.cosmos.gov.v1beta1.QueryVotesResponse, request, callback); - }, "name", { value: "Votes" }); - - /** - * Calls Votes. - * @function votes - * @memberof cosmos.gov.v1beta1.Query - * @instance - * @param {cosmos.gov.v1beta1.IQueryVotesRequest} request QueryVotesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.gov.v1beta1.Query#params}. - * @memberof cosmos.gov.v1beta1.Query - * @typedef ParamsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.gov.v1beta1.QueryParamsResponse} [response] QueryParamsResponse - */ - - /** - * Calls Params. - * @function params - * @memberof cosmos.gov.v1beta1.Query - * @instance - * @param {cosmos.gov.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object - * @param {cosmos.gov.v1beta1.Query.ParamsCallback} callback Node-style callback called with the error, if any, and QueryParamsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.params = function params(request, callback) { - return this.rpcCall(params, $root.cosmos.gov.v1beta1.QueryParamsRequest, $root.cosmos.gov.v1beta1.QueryParamsResponse, request, callback); - }, "name", { value: "Params" }); - - /** - * Calls Params. - * @function params - * @memberof cosmos.gov.v1beta1.Query - * @instance - * @param {cosmos.gov.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.gov.v1beta1.Query#deposit}. - * @memberof cosmos.gov.v1beta1.Query - * @typedef DepositCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.gov.v1beta1.QueryDepositResponse} [response] QueryDepositResponse - */ - - /** - * Calls Deposit. - * @function deposit - * @memberof cosmos.gov.v1beta1.Query - * @instance - * @param {cosmos.gov.v1beta1.IQueryDepositRequest} request QueryDepositRequest message or plain object - * @param {cosmos.gov.v1beta1.Query.DepositCallback} callback Node-style callback called with the error, if any, and QueryDepositResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.deposit = function deposit(request, callback) { - return this.rpcCall(deposit, $root.cosmos.gov.v1beta1.QueryDepositRequest, $root.cosmos.gov.v1beta1.QueryDepositResponse, request, callback); - }, "name", { value: "Deposit" }); - - /** - * Calls Deposit. - * @function deposit - * @memberof cosmos.gov.v1beta1.Query - * @instance - * @param {cosmos.gov.v1beta1.IQueryDepositRequest} request QueryDepositRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.gov.v1beta1.Query#deposits}. - * @memberof cosmos.gov.v1beta1.Query - * @typedef DepositsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.gov.v1beta1.QueryDepositsResponse} [response] QueryDepositsResponse - */ - - /** - * Calls Deposits. - * @function deposits - * @memberof cosmos.gov.v1beta1.Query - * @instance - * @param {cosmos.gov.v1beta1.IQueryDepositsRequest} request QueryDepositsRequest message or plain object - * @param {cosmos.gov.v1beta1.Query.DepositsCallback} callback Node-style callback called with the error, if any, and QueryDepositsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.deposits = function deposits(request, callback) { - return this.rpcCall(deposits, $root.cosmos.gov.v1beta1.QueryDepositsRequest, $root.cosmos.gov.v1beta1.QueryDepositsResponse, request, callback); - }, "name", { value: "Deposits" }); - - /** - * Calls Deposits. - * @function deposits - * @memberof cosmos.gov.v1beta1.Query - * @instance - * @param {cosmos.gov.v1beta1.IQueryDepositsRequest} request QueryDepositsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.gov.v1beta1.Query#tallyResult}. - * @memberof cosmos.gov.v1beta1.Query - * @typedef TallyResultCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.gov.v1beta1.QueryTallyResultResponse} [response] QueryTallyResultResponse - */ - - /** - * Calls TallyResult. - * @function tallyResult - * @memberof cosmos.gov.v1beta1.Query - * @instance - * @param {cosmos.gov.v1beta1.IQueryTallyResultRequest} request QueryTallyResultRequest message or plain object - * @param {cosmos.gov.v1beta1.Query.TallyResultCallback} callback Node-style callback called with the error, if any, and QueryTallyResultResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.tallyResult = function tallyResult(request, callback) { - return this.rpcCall(tallyResult, $root.cosmos.gov.v1beta1.QueryTallyResultRequest, $root.cosmos.gov.v1beta1.QueryTallyResultResponse, request, callback); - }, "name", { value: "TallyResult" }); - - /** - * Calls TallyResult. - * @function tallyResult - * @memberof cosmos.gov.v1beta1.Query - * @instance - * @param {cosmos.gov.v1beta1.IQueryTallyResultRequest} request QueryTallyResultRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return Query; - })(); - - v1beta1.QueryProposalRequest = (function() { - - /** - * Properties of a QueryProposalRequest. - * @memberof cosmos.gov.v1beta1 - * @interface IQueryProposalRequest - * @property {Long|null} [proposal_id] QueryProposalRequest proposal_id - */ - - /** - * Constructs a new QueryProposalRequest. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a QueryProposalRequest. - * @implements IQueryProposalRequest - * @constructor - * @param {cosmos.gov.v1beta1.IQueryProposalRequest=} [properties] Properties to set - */ - function QueryProposalRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryProposalRequest proposal_id. - * @member {Long} proposal_id - * @memberof cosmos.gov.v1beta1.QueryProposalRequest - * @instance - */ - QueryProposalRequest.prototype.proposal_id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified QueryProposalRequest message. Does not implicitly {@link cosmos.gov.v1beta1.QueryProposalRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.QueryProposalRequest - * @static - * @param {cosmos.gov.v1beta1.IQueryProposalRequest} message QueryProposalRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryProposalRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.proposal_id != null && Object.hasOwnProperty.call(message, "proposal_id")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.proposal_id); - return writer; - }; - - /** - * Encodes the specified QueryProposalRequest message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryProposalRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.QueryProposalRequest - * @static - * @param {cosmos.gov.v1beta1.IQueryProposalRequest} message QueryProposalRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryProposalRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryProposalRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.QueryProposalRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.QueryProposalRequest} QueryProposalRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryProposalRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryProposalRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.proposal_id = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryProposalRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.QueryProposalRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.QueryProposalRequest} QueryProposalRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryProposalRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryProposalRequest message. - * @function verify - * @memberof cosmos.gov.v1beta1.QueryProposalRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryProposalRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) - if (!$util.isInteger(message.proposal_id) && !(message.proposal_id && $util.isInteger(message.proposal_id.low) && $util.isInteger(message.proposal_id.high))) - return "proposal_id: integer|Long expected"; - return null; - }; - - /** - * Creates a QueryProposalRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.QueryProposalRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.QueryProposalRequest} QueryProposalRequest - */ - QueryProposalRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.QueryProposalRequest) - return object; - let message = new $root.cosmos.gov.v1beta1.QueryProposalRequest(); - if (object.proposal_id != null) - if ($util.Long) - (message.proposal_id = $util.Long.fromValue(object.proposal_id)).unsigned = true; - else if (typeof object.proposal_id === "string") - message.proposal_id = parseInt(object.proposal_id, 10); - else if (typeof object.proposal_id === "number") - message.proposal_id = object.proposal_id; - else if (typeof object.proposal_id === "object") - message.proposal_id = new $util.LongBits(object.proposal_id.low >>> 0, object.proposal_id.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a QueryProposalRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.QueryProposalRequest - * @static - * @param {cosmos.gov.v1beta1.QueryProposalRequest} message QueryProposalRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryProposalRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.proposal_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.proposal_id = options.longs === String ? "0" : 0; - if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) - if (typeof message.proposal_id === "number") - object.proposal_id = options.longs === String ? String(message.proposal_id) : message.proposal_id; - else - object.proposal_id = options.longs === String ? $util.Long.prototype.toString.call(message.proposal_id) : options.longs === Number ? new $util.LongBits(message.proposal_id.low >>> 0, message.proposal_id.high >>> 0).toNumber(true) : message.proposal_id; - return object; - }; - - /** - * Converts this QueryProposalRequest to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.QueryProposalRequest - * @instance - * @returns {Object.} JSON object - */ - QueryProposalRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryProposalRequest; - })(); - - v1beta1.QueryProposalResponse = (function() { - - /** - * Properties of a QueryProposalResponse. - * @memberof cosmos.gov.v1beta1 - * @interface IQueryProposalResponse - * @property {cosmos.gov.v1beta1.IProposal|null} [proposal] QueryProposalResponse proposal - */ - - /** - * Constructs a new QueryProposalResponse. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a QueryProposalResponse. - * @implements IQueryProposalResponse - * @constructor - * @param {cosmos.gov.v1beta1.IQueryProposalResponse=} [properties] Properties to set - */ - function QueryProposalResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryProposalResponse proposal. - * @member {cosmos.gov.v1beta1.IProposal|null|undefined} proposal - * @memberof cosmos.gov.v1beta1.QueryProposalResponse - * @instance - */ - QueryProposalResponse.prototype.proposal = null; - - /** - * Encodes the specified QueryProposalResponse message. Does not implicitly {@link cosmos.gov.v1beta1.QueryProposalResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.QueryProposalResponse - * @static - * @param {cosmos.gov.v1beta1.IQueryProposalResponse} message QueryProposalResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryProposalResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.proposal != null && Object.hasOwnProperty.call(message, "proposal")) - $root.cosmos.gov.v1beta1.Proposal.encode(message.proposal, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryProposalResponse message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryProposalResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.QueryProposalResponse - * @static - * @param {cosmos.gov.v1beta1.IQueryProposalResponse} message QueryProposalResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryProposalResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryProposalResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.QueryProposalResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.QueryProposalResponse} QueryProposalResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryProposalResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryProposalResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.proposal = $root.cosmos.gov.v1beta1.Proposal.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryProposalResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.QueryProposalResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.QueryProposalResponse} QueryProposalResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryProposalResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryProposalResponse message. - * @function verify - * @memberof cosmos.gov.v1beta1.QueryProposalResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryProposalResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.proposal != null && message.hasOwnProperty("proposal")) { - let error = $root.cosmos.gov.v1beta1.Proposal.verify(message.proposal); - if (error) - return "proposal." + error; - } - return null; - }; - - /** - * Creates a QueryProposalResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.QueryProposalResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.QueryProposalResponse} QueryProposalResponse - */ - QueryProposalResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.QueryProposalResponse) - return object; - let message = new $root.cosmos.gov.v1beta1.QueryProposalResponse(); - if (object.proposal != null) { - if (typeof object.proposal !== "object") - throw TypeError(".cosmos.gov.v1beta1.QueryProposalResponse.proposal: object expected"); - message.proposal = $root.cosmos.gov.v1beta1.Proposal.fromObject(object.proposal); - } - return message; - }; - - /** - * Creates a plain object from a QueryProposalResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.QueryProposalResponse - * @static - * @param {cosmos.gov.v1beta1.QueryProposalResponse} message QueryProposalResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryProposalResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.proposal = null; - if (message.proposal != null && message.hasOwnProperty("proposal")) - object.proposal = $root.cosmos.gov.v1beta1.Proposal.toObject(message.proposal, options); - return object; - }; - - /** - * Converts this QueryProposalResponse to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.QueryProposalResponse - * @instance - * @returns {Object.} JSON object - */ - QueryProposalResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryProposalResponse; - })(); - - v1beta1.QueryProposalsRequest = (function() { - - /** - * Properties of a QueryProposalsRequest. - * @memberof cosmos.gov.v1beta1 - * @interface IQueryProposalsRequest - * @property {cosmos.gov.v1beta1.ProposalStatus|null} [proposal_status] QueryProposalsRequest proposal_status - * @property {string|null} [voter] QueryProposalsRequest voter - * @property {string|null} [depositor] QueryProposalsRequest depositor - * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryProposalsRequest pagination - */ - - /** - * Constructs a new QueryProposalsRequest. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a QueryProposalsRequest. - * @implements IQueryProposalsRequest - * @constructor - * @param {cosmos.gov.v1beta1.IQueryProposalsRequest=} [properties] Properties to set - */ - function QueryProposalsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryProposalsRequest proposal_status. - * @member {cosmos.gov.v1beta1.ProposalStatus} proposal_status - * @memberof cosmos.gov.v1beta1.QueryProposalsRequest - * @instance - */ - QueryProposalsRequest.prototype.proposal_status = 0; - - /** - * QueryProposalsRequest voter. - * @member {string} voter - * @memberof cosmos.gov.v1beta1.QueryProposalsRequest - * @instance - */ - QueryProposalsRequest.prototype.voter = ""; - - /** - * QueryProposalsRequest depositor. - * @member {string} depositor - * @memberof cosmos.gov.v1beta1.QueryProposalsRequest - * @instance - */ - QueryProposalsRequest.prototype.depositor = ""; - - /** - * QueryProposalsRequest pagination. - * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination - * @memberof cosmos.gov.v1beta1.QueryProposalsRequest - * @instance - */ - QueryProposalsRequest.prototype.pagination = null; - - /** - * Encodes the specified QueryProposalsRequest message. Does not implicitly {@link cosmos.gov.v1beta1.QueryProposalsRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.QueryProposalsRequest - * @static - * @param {cosmos.gov.v1beta1.IQueryProposalsRequest} message QueryProposalsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryProposalsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.proposal_status != null && Object.hasOwnProperty.call(message, "proposal_status")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.proposal_status); - if (message.voter != null && Object.hasOwnProperty.call(message, "voter")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.voter); - if (message.depositor != null && Object.hasOwnProperty.call(message, "depositor")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.depositor); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryProposalsRequest message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryProposalsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.QueryProposalsRequest - * @static - * @param {cosmos.gov.v1beta1.IQueryProposalsRequest} message QueryProposalsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryProposalsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryProposalsRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.QueryProposalsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.QueryProposalsRequest} QueryProposalsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryProposalsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryProposalsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.proposal_status = reader.int32(); - break; - case 2: - message.voter = reader.string(); - break; - case 3: - message.depositor = reader.string(); - break; - case 4: - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryProposalsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.QueryProposalsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.QueryProposalsRequest} QueryProposalsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryProposalsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryProposalsRequest message. - * @function verify - * @memberof cosmos.gov.v1beta1.QueryProposalsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryProposalsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.proposal_status != null && message.hasOwnProperty("proposal_status")) - switch (message.proposal_status) { - default: - return "proposal_status: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.voter != null && message.hasOwnProperty("voter")) - if (!$util.isString(message.voter)) - return "voter: string expected"; - if (message.depositor != null && message.hasOwnProperty("depositor")) - if (!$util.isString(message.depositor)) - return "depositor: string expected"; - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryProposalsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.QueryProposalsRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.QueryProposalsRequest} QueryProposalsRequest - */ - QueryProposalsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.QueryProposalsRequest) - return object; - let message = new $root.cosmos.gov.v1beta1.QueryProposalsRequest(); - switch (object.proposal_status) { - case "PROPOSAL_STATUS_UNSPECIFIED": - case 0: - message.proposal_status = 0; - break; - case "PROPOSAL_STATUS_DEPOSIT_PERIOD": - case 1: - message.proposal_status = 1; - break; - case "PROPOSAL_STATUS_VOTING_PERIOD": - case 2: - message.proposal_status = 2; - break; - case "PROPOSAL_STATUS_PASSED": - case 3: - message.proposal_status = 3; - break; - case "PROPOSAL_STATUS_REJECTED": - case 4: - message.proposal_status = 4; - break; - case "PROPOSAL_STATUS_FAILED": - case 5: - message.proposal_status = 5; - break; - } - if (object.voter != null) - message.voter = String(object.voter); - if (object.depositor != null) - message.depositor = String(object.depositor); - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.gov.v1beta1.QueryProposalsRequest.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryProposalsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.QueryProposalsRequest - * @static - * @param {cosmos.gov.v1beta1.QueryProposalsRequest} message QueryProposalsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryProposalsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.proposal_status = options.enums === String ? "PROPOSAL_STATUS_UNSPECIFIED" : 0; - object.voter = ""; - object.depositor = ""; - object.pagination = null; - } - if (message.proposal_status != null && message.hasOwnProperty("proposal_status")) - object.proposal_status = options.enums === String ? $root.cosmos.gov.v1beta1.ProposalStatus[message.proposal_status] : message.proposal_status; - if (message.voter != null && message.hasOwnProperty("voter")) - object.voter = message.voter; - if (message.depositor != null && message.hasOwnProperty("depositor")) - object.depositor = message.depositor; - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryProposalsRequest to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.QueryProposalsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryProposalsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryProposalsRequest; - })(); - - v1beta1.QueryProposalsResponse = (function() { - - /** - * Properties of a QueryProposalsResponse. - * @memberof cosmos.gov.v1beta1 - * @interface IQueryProposalsResponse - * @property {Array.|null} [proposals] QueryProposalsResponse proposals - * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryProposalsResponse pagination - */ - - /** - * Constructs a new QueryProposalsResponse. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a QueryProposalsResponse. - * @implements IQueryProposalsResponse - * @constructor - * @param {cosmos.gov.v1beta1.IQueryProposalsResponse=} [properties] Properties to set - */ - function QueryProposalsResponse(properties) { - this.proposals = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryProposalsResponse proposals. - * @member {Array.} proposals - * @memberof cosmos.gov.v1beta1.QueryProposalsResponse - * @instance - */ - QueryProposalsResponse.prototype.proposals = $util.emptyArray; - - /** - * QueryProposalsResponse pagination. - * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination - * @memberof cosmos.gov.v1beta1.QueryProposalsResponse - * @instance - */ - QueryProposalsResponse.prototype.pagination = null; - - /** - * Encodes the specified QueryProposalsResponse message. Does not implicitly {@link cosmos.gov.v1beta1.QueryProposalsResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.QueryProposalsResponse - * @static - * @param {cosmos.gov.v1beta1.IQueryProposalsResponse} message QueryProposalsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryProposalsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.proposals != null && message.proposals.length) - for (let i = 0; i < message.proposals.length; ++i) - $root.cosmos.gov.v1beta1.Proposal.encode(message.proposals[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryProposalsResponse message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryProposalsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.QueryProposalsResponse - * @static - * @param {cosmos.gov.v1beta1.IQueryProposalsResponse} message QueryProposalsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryProposalsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryProposalsResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.QueryProposalsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.QueryProposalsResponse} QueryProposalsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryProposalsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryProposalsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.proposals && message.proposals.length)) - message.proposals = []; - message.proposals.push($root.cosmos.gov.v1beta1.Proposal.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryProposalsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.QueryProposalsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.QueryProposalsResponse} QueryProposalsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryProposalsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryProposalsResponse message. - * @function verify - * @memberof cosmos.gov.v1beta1.QueryProposalsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryProposalsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.proposals != null && message.hasOwnProperty("proposals")) { - if (!Array.isArray(message.proposals)) - return "proposals: array expected"; - for (let i = 0; i < message.proposals.length; ++i) { - let error = $root.cosmos.gov.v1beta1.Proposal.verify(message.proposals[i]); - if (error) - return "proposals." + error; - } - } - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryProposalsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.QueryProposalsResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.QueryProposalsResponse} QueryProposalsResponse - */ - QueryProposalsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.QueryProposalsResponse) - return object; - let message = new $root.cosmos.gov.v1beta1.QueryProposalsResponse(); - if (object.proposals) { - if (!Array.isArray(object.proposals)) - throw TypeError(".cosmos.gov.v1beta1.QueryProposalsResponse.proposals: array expected"); - message.proposals = []; - for (let i = 0; i < object.proposals.length; ++i) { - if (typeof object.proposals[i] !== "object") - throw TypeError(".cosmos.gov.v1beta1.QueryProposalsResponse.proposals: object expected"); - message.proposals[i] = $root.cosmos.gov.v1beta1.Proposal.fromObject(object.proposals[i]); - } - } - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.gov.v1beta1.QueryProposalsResponse.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryProposalsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.QueryProposalsResponse - * @static - * @param {cosmos.gov.v1beta1.QueryProposalsResponse} message QueryProposalsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryProposalsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.proposals = []; - if (options.defaults) - object.pagination = null; - if (message.proposals && message.proposals.length) { - object.proposals = []; - for (let j = 0; j < message.proposals.length; ++j) - object.proposals[j] = $root.cosmos.gov.v1beta1.Proposal.toObject(message.proposals[j], options); - } - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryProposalsResponse to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.QueryProposalsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryProposalsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryProposalsResponse; - })(); - - v1beta1.QueryVoteRequest = (function() { - - /** - * Properties of a QueryVoteRequest. - * @memberof cosmos.gov.v1beta1 - * @interface IQueryVoteRequest - * @property {Long|null} [proposal_id] QueryVoteRequest proposal_id - * @property {string|null} [voter] QueryVoteRequest voter - */ - - /** - * Constructs a new QueryVoteRequest. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a QueryVoteRequest. - * @implements IQueryVoteRequest - * @constructor - * @param {cosmos.gov.v1beta1.IQueryVoteRequest=} [properties] Properties to set - */ - function QueryVoteRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryVoteRequest proposal_id. - * @member {Long} proposal_id - * @memberof cosmos.gov.v1beta1.QueryVoteRequest - * @instance - */ - QueryVoteRequest.prototype.proposal_id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * QueryVoteRequest voter. - * @member {string} voter - * @memberof cosmos.gov.v1beta1.QueryVoteRequest - * @instance - */ - QueryVoteRequest.prototype.voter = ""; - - /** - * Encodes the specified QueryVoteRequest message. Does not implicitly {@link cosmos.gov.v1beta1.QueryVoteRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.QueryVoteRequest - * @static - * @param {cosmos.gov.v1beta1.IQueryVoteRequest} message QueryVoteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryVoteRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.proposal_id != null && Object.hasOwnProperty.call(message, "proposal_id")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.proposal_id); - if (message.voter != null && Object.hasOwnProperty.call(message, "voter")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.voter); - return writer; - }; - - /** - * Encodes the specified QueryVoteRequest message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryVoteRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.QueryVoteRequest - * @static - * @param {cosmos.gov.v1beta1.IQueryVoteRequest} message QueryVoteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryVoteRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryVoteRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.QueryVoteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.QueryVoteRequest} QueryVoteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryVoteRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryVoteRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.proposal_id = reader.uint64(); - break; - case 2: - message.voter = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryVoteRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.QueryVoteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.QueryVoteRequest} QueryVoteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryVoteRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryVoteRequest message. - * @function verify - * @memberof cosmos.gov.v1beta1.QueryVoteRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryVoteRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) - if (!$util.isInteger(message.proposal_id) && !(message.proposal_id && $util.isInteger(message.proposal_id.low) && $util.isInteger(message.proposal_id.high))) - return "proposal_id: integer|Long expected"; - if (message.voter != null && message.hasOwnProperty("voter")) - if (!$util.isString(message.voter)) - return "voter: string expected"; - return null; - }; - - /** - * Creates a QueryVoteRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.QueryVoteRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.QueryVoteRequest} QueryVoteRequest - */ - QueryVoteRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.QueryVoteRequest) - return object; - let message = new $root.cosmos.gov.v1beta1.QueryVoteRequest(); - if (object.proposal_id != null) - if ($util.Long) - (message.proposal_id = $util.Long.fromValue(object.proposal_id)).unsigned = true; - else if (typeof object.proposal_id === "string") - message.proposal_id = parseInt(object.proposal_id, 10); - else if (typeof object.proposal_id === "number") - message.proposal_id = object.proposal_id; - else if (typeof object.proposal_id === "object") - message.proposal_id = new $util.LongBits(object.proposal_id.low >>> 0, object.proposal_id.high >>> 0).toNumber(true); - if (object.voter != null) - message.voter = String(object.voter); - return message; - }; - - /** - * Creates a plain object from a QueryVoteRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.QueryVoteRequest - * @static - * @param {cosmos.gov.v1beta1.QueryVoteRequest} message QueryVoteRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryVoteRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.proposal_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.proposal_id = options.longs === String ? "0" : 0; - object.voter = ""; - } - if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) - if (typeof message.proposal_id === "number") - object.proposal_id = options.longs === String ? String(message.proposal_id) : message.proposal_id; - else - object.proposal_id = options.longs === String ? $util.Long.prototype.toString.call(message.proposal_id) : options.longs === Number ? new $util.LongBits(message.proposal_id.low >>> 0, message.proposal_id.high >>> 0).toNumber(true) : message.proposal_id; - if (message.voter != null && message.hasOwnProperty("voter")) - object.voter = message.voter; - return object; - }; - - /** - * Converts this QueryVoteRequest to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.QueryVoteRequest - * @instance - * @returns {Object.} JSON object - */ - QueryVoteRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryVoteRequest; - })(); - - v1beta1.QueryVoteResponse = (function() { - - /** - * Properties of a QueryVoteResponse. - * @memberof cosmos.gov.v1beta1 - * @interface IQueryVoteResponse - * @property {cosmos.gov.v1beta1.IVote|null} [vote] QueryVoteResponse vote - */ - - /** - * Constructs a new QueryVoteResponse. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a QueryVoteResponse. - * @implements IQueryVoteResponse - * @constructor - * @param {cosmos.gov.v1beta1.IQueryVoteResponse=} [properties] Properties to set - */ - function QueryVoteResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryVoteResponse vote. - * @member {cosmos.gov.v1beta1.IVote|null|undefined} vote - * @memberof cosmos.gov.v1beta1.QueryVoteResponse - * @instance - */ - QueryVoteResponse.prototype.vote = null; - - /** - * Encodes the specified QueryVoteResponse message. Does not implicitly {@link cosmos.gov.v1beta1.QueryVoteResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.QueryVoteResponse - * @static - * @param {cosmos.gov.v1beta1.IQueryVoteResponse} message QueryVoteResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryVoteResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.vote != null && Object.hasOwnProperty.call(message, "vote")) - $root.cosmos.gov.v1beta1.Vote.encode(message.vote, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryVoteResponse message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryVoteResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.QueryVoteResponse - * @static - * @param {cosmos.gov.v1beta1.IQueryVoteResponse} message QueryVoteResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryVoteResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryVoteResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.QueryVoteResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.QueryVoteResponse} QueryVoteResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryVoteResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryVoteResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.vote = $root.cosmos.gov.v1beta1.Vote.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryVoteResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.QueryVoteResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.QueryVoteResponse} QueryVoteResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryVoteResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryVoteResponse message. - * @function verify - * @memberof cosmos.gov.v1beta1.QueryVoteResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryVoteResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.vote != null && message.hasOwnProperty("vote")) { - let error = $root.cosmos.gov.v1beta1.Vote.verify(message.vote); - if (error) - return "vote." + error; - } - return null; - }; - - /** - * Creates a QueryVoteResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.QueryVoteResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.QueryVoteResponse} QueryVoteResponse - */ - QueryVoteResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.QueryVoteResponse) - return object; - let message = new $root.cosmos.gov.v1beta1.QueryVoteResponse(); - if (object.vote != null) { - if (typeof object.vote !== "object") - throw TypeError(".cosmos.gov.v1beta1.QueryVoteResponse.vote: object expected"); - message.vote = $root.cosmos.gov.v1beta1.Vote.fromObject(object.vote); - } - return message; - }; - - /** - * Creates a plain object from a QueryVoteResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.QueryVoteResponse - * @static - * @param {cosmos.gov.v1beta1.QueryVoteResponse} message QueryVoteResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryVoteResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.vote = null; - if (message.vote != null && message.hasOwnProperty("vote")) - object.vote = $root.cosmos.gov.v1beta1.Vote.toObject(message.vote, options); - return object; - }; - - /** - * Converts this QueryVoteResponse to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.QueryVoteResponse - * @instance - * @returns {Object.} JSON object - */ - QueryVoteResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryVoteResponse; - })(); - - v1beta1.QueryVotesRequest = (function() { - - /** - * Properties of a QueryVotesRequest. - * @memberof cosmos.gov.v1beta1 - * @interface IQueryVotesRequest - * @property {Long|null} [proposal_id] QueryVotesRequest proposal_id - * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryVotesRequest pagination - */ - - /** - * Constructs a new QueryVotesRequest. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a QueryVotesRequest. - * @implements IQueryVotesRequest - * @constructor - * @param {cosmos.gov.v1beta1.IQueryVotesRequest=} [properties] Properties to set - */ - function QueryVotesRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryVotesRequest proposal_id. - * @member {Long} proposal_id - * @memberof cosmos.gov.v1beta1.QueryVotesRequest - * @instance - */ - QueryVotesRequest.prototype.proposal_id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * QueryVotesRequest pagination. - * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination - * @memberof cosmos.gov.v1beta1.QueryVotesRequest - * @instance - */ - QueryVotesRequest.prototype.pagination = null; - - /** - * Encodes the specified QueryVotesRequest message. Does not implicitly {@link cosmos.gov.v1beta1.QueryVotesRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.QueryVotesRequest - * @static - * @param {cosmos.gov.v1beta1.IQueryVotesRequest} message QueryVotesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryVotesRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.proposal_id != null && Object.hasOwnProperty.call(message, "proposal_id")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.proposal_id); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryVotesRequest message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryVotesRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.QueryVotesRequest - * @static - * @param {cosmos.gov.v1beta1.IQueryVotesRequest} message QueryVotesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryVotesRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryVotesRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.QueryVotesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.QueryVotesRequest} QueryVotesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryVotesRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryVotesRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.proposal_id = reader.uint64(); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryVotesRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.QueryVotesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.QueryVotesRequest} QueryVotesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryVotesRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryVotesRequest message. - * @function verify - * @memberof cosmos.gov.v1beta1.QueryVotesRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryVotesRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) - if (!$util.isInteger(message.proposal_id) && !(message.proposal_id && $util.isInteger(message.proposal_id.low) && $util.isInteger(message.proposal_id.high))) - return "proposal_id: integer|Long expected"; - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryVotesRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.QueryVotesRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.QueryVotesRequest} QueryVotesRequest - */ - QueryVotesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.QueryVotesRequest) - return object; - let message = new $root.cosmos.gov.v1beta1.QueryVotesRequest(); - if (object.proposal_id != null) - if ($util.Long) - (message.proposal_id = $util.Long.fromValue(object.proposal_id)).unsigned = true; - else if (typeof object.proposal_id === "string") - message.proposal_id = parseInt(object.proposal_id, 10); - else if (typeof object.proposal_id === "number") - message.proposal_id = object.proposal_id; - else if (typeof object.proposal_id === "object") - message.proposal_id = new $util.LongBits(object.proposal_id.low >>> 0, object.proposal_id.high >>> 0).toNumber(true); - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.gov.v1beta1.QueryVotesRequest.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryVotesRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.QueryVotesRequest - * @static - * @param {cosmos.gov.v1beta1.QueryVotesRequest} message QueryVotesRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryVotesRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.proposal_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.proposal_id = options.longs === String ? "0" : 0; - object.pagination = null; - } - if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) - if (typeof message.proposal_id === "number") - object.proposal_id = options.longs === String ? String(message.proposal_id) : message.proposal_id; - else - object.proposal_id = options.longs === String ? $util.Long.prototype.toString.call(message.proposal_id) : options.longs === Number ? new $util.LongBits(message.proposal_id.low >>> 0, message.proposal_id.high >>> 0).toNumber(true) : message.proposal_id; - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryVotesRequest to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.QueryVotesRequest - * @instance - * @returns {Object.} JSON object - */ - QueryVotesRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryVotesRequest; - })(); - - v1beta1.QueryVotesResponse = (function() { - - /** - * Properties of a QueryVotesResponse. - * @memberof cosmos.gov.v1beta1 - * @interface IQueryVotesResponse - * @property {Array.|null} [votes] QueryVotesResponse votes - * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryVotesResponse pagination - */ - - /** - * Constructs a new QueryVotesResponse. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a QueryVotesResponse. - * @implements IQueryVotesResponse - * @constructor - * @param {cosmos.gov.v1beta1.IQueryVotesResponse=} [properties] Properties to set - */ - function QueryVotesResponse(properties) { - this.votes = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryVotesResponse votes. - * @member {Array.} votes - * @memberof cosmos.gov.v1beta1.QueryVotesResponse - * @instance - */ - QueryVotesResponse.prototype.votes = $util.emptyArray; - - /** - * QueryVotesResponse pagination. - * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination - * @memberof cosmos.gov.v1beta1.QueryVotesResponse - * @instance - */ - QueryVotesResponse.prototype.pagination = null; - - /** - * Encodes the specified QueryVotesResponse message. Does not implicitly {@link cosmos.gov.v1beta1.QueryVotesResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.QueryVotesResponse - * @static - * @param {cosmos.gov.v1beta1.IQueryVotesResponse} message QueryVotesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryVotesResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.votes != null && message.votes.length) - for (let i = 0; i < message.votes.length; ++i) - $root.cosmos.gov.v1beta1.Vote.encode(message.votes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryVotesResponse message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryVotesResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.QueryVotesResponse - * @static - * @param {cosmos.gov.v1beta1.IQueryVotesResponse} message QueryVotesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryVotesResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryVotesResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.QueryVotesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.QueryVotesResponse} QueryVotesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryVotesResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryVotesResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.votes && message.votes.length)) - message.votes = []; - message.votes.push($root.cosmos.gov.v1beta1.Vote.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryVotesResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.QueryVotesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.QueryVotesResponse} QueryVotesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryVotesResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryVotesResponse message. - * @function verify - * @memberof cosmos.gov.v1beta1.QueryVotesResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryVotesResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.votes != null && message.hasOwnProperty("votes")) { - if (!Array.isArray(message.votes)) - return "votes: array expected"; - for (let i = 0; i < message.votes.length; ++i) { - let error = $root.cosmos.gov.v1beta1.Vote.verify(message.votes[i]); - if (error) - return "votes." + error; - } - } - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryVotesResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.QueryVotesResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.QueryVotesResponse} QueryVotesResponse - */ - QueryVotesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.QueryVotesResponse) - return object; - let message = new $root.cosmos.gov.v1beta1.QueryVotesResponse(); - if (object.votes) { - if (!Array.isArray(object.votes)) - throw TypeError(".cosmos.gov.v1beta1.QueryVotesResponse.votes: array expected"); - message.votes = []; - for (let i = 0; i < object.votes.length; ++i) { - if (typeof object.votes[i] !== "object") - throw TypeError(".cosmos.gov.v1beta1.QueryVotesResponse.votes: object expected"); - message.votes[i] = $root.cosmos.gov.v1beta1.Vote.fromObject(object.votes[i]); - } - } - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.gov.v1beta1.QueryVotesResponse.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryVotesResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.QueryVotesResponse - * @static - * @param {cosmos.gov.v1beta1.QueryVotesResponse} message QueryVotesResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryVotesResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.votes = []; - if (options.defaults) - object.pagination = null; - if (message.votes && message.votes.length) { - object.votes = []; - for (let j = 0; j < message.votes.length; ++j) - object.votes[j] = $root.cosmos.gov.v1beta1.Vote.toObject(message.votes[j], options); - } - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryVotesResponse to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.QueryVotesResponse - * @instance - * @returns {Object.} JSON object - */ - QueryVotesResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryVotesResponse; - })(); - - v1beta1.QueryParamsRequest = (function() { - - /** - * Properties of a QueryParamsRequest. - * @memberof cosmos.gov.v1beta1 - * @interface IQueryParamsRequest - * @property {string|null} [params_type] QueryParamsRequest params_type - */ - - /** - * Constructs a new QueryParamsRequest. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a QueryParamsRequest. - * @implements IQueryParamsRequest - * @constructor - * @param {cosmos.gov.v1beta1.IQueryParamsRequest=} [properties] Properties to set - */ - function QueryParamsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryParamsRequest params_type. - * @member {string} params_type - * @memberof cosmos.gov.v1beta1.QueryParamsRequest - * @instance - */ - QueryParamsRequest.prototype.params_type = ""; - - /** - * Encodes the specified QueryParamsRequest message. Does not implicitly {@link cosmos.gov.v1beta1.QueryParamsRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.QueryParamsRequest - * @static - * @param {cosmos.gov.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.params_type != null && Object.hasOwnProperty.call(message, "params_type")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.params_type); - return writer; - }; - - /** - * Encodes the specified QueryParamsRequest message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryParamsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.QueryParamsRequest - * @static - * @param {cosmos.gov.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryParamsRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.QueryParamsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.QueryParamsRequest} QueryParamsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryParamsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.params_type = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryParamsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.QueryParamsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.QueryParamsRequest} QueryParamsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryParamsRequest message. - * @function verify - * @memberof cosmos.gov.v1beta1.QueryParamsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryParamsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.params_type != null && message.hasOwnProperty("params_type")) - if (!$util.isString(message.params_type)) - return "params_type: string expected"; - return null; - }; - - /** - * Creates a QueryParamsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.QueryParamsRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.QueryParamsRequest} QueryParamsRequest - */ - QueryParamsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.QueryParamsRequest) - return object; - let message = new $root.cosmos.gov.v1beta1.QueryParamsRequest(); - if (object.params_type != null) - message.params_type = String(object.params_type); - return message; - }; - - /** - * Creates a plain object from a QueryParamsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.QueryParamsRequest - * @static - * @param {cosmos.gov.v1beta1.QueryParamsRequest} message QueryParamsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryParamsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.params_type = ""; - if (message.params_type != null && message.hasOwnProperty("params_type")) - object.params_type = message.params_type; - return object; - }; - - /** - * Converts this QueryParamsRequest to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.QueryParamsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryParamsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryParamsRequest; - })(); - - v1beta1.QueryParamsResponse = (function() { - - /** - * Properties of a QueryParamsResponse. - * @memberof cosmos.gov.v1beta1 - * @interface IQueryParamsResponse - * @property {cosmos.gov.v1beta1.IVotingParams|null} [voting_params] QueryParamsResponse voting_params - * @property {cosmos.gov.v1beta1.IDepositParams|null} [deposit_params] QueryParamsResponse deposit_params - * @property {cosmos.gov.v1beta1.ITallyParams|null} [tally_params] QueryParamsResponse tally_params - */ - - /** - * Constructs a new QueryParamsResponse. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a QueryParamsResponse. - * @implements IQueryParamsResponse - * @constructor - * @param {cosmos.gov.v1beta1.IQueryParamsResponse=} [properties] Properties to set - */ - function QueryParamsResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryParamsResponse voting_params. - * @member {cosmos.gov.v1beta1.IVotingParams|null|undefined} voting_params - * @memberof cosmos.gov.v1beta1.QueryParamsResponse - * @instance - */ - QueryParamsResponse.prototype.voting_params = null; - - /** - * QueryParamsResponse deposit_params. - * @member {cosmos.gov.v1beta1.IDepositParams|null|undefined} deposit_params - * @memberof cosmos.gov.v1beta1.QueryParamsResponse - * @instance - */ - QueryParamsResponse.prototype.deposit_params = null; - - /** - * QueryParamsResponse tally_params. - * @member {cosmos.gov.v1beta1.ITallyParams|null|undefined} tally_params - * @memberof cosmos.gov.v1beta1.QueryParamsResponse - * @instance - */ - QueryParamsResponse.prototype.tally_params = null; - - /** - * Encodes the specified QueryParamsResponse message. Does not implicitly {@link cosmos.gov.v1beta1.QueryParamsResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.QueryParamsResponse - * @static - * @param {cosmos.gov.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.voting_params != null && Object.hasOwnProperty.call(message, "voting_params")) - $root.cosmos.gov.v1beta1.VotingParams.encode(message.voting_params, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.deposit_params != null && Object.hasOwnProperty.call(message, "deposit_params")) - $root.cosmos.gov.v1beta1.DepositParams.encode(message.deposit_params, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.tally_params != null && Object.hasOwnProperty.call(message, "tally_params")) - $root.cosmos.gov.v1beta1.TallyParams.encode(message.tally_params, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryParamsResponse message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryParamsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.QueryParamsResponse - * @static - * @param {cosmos.gov.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryParamsResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.QueryParamsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.QueryParamsResponse} QueryParamsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryParamsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.voting_params = $root.cosmos.gov.v1beta1.VotingParams.decode(reader, reader.uint32()); - break; - case 2: - message.deposit_params = $root.cosmos.gov.v1beta1.DepositParams.decode(reader, reader.uint32()); - break; - case 3: - message.tally_params = $root.cosmos.gov.v1beta1.TallyParams.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryParamsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.QueryParamsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.QueryParamsResponse} QueryParamsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryParamsResponse message. - * @function verify - * @memberof cosmos.gov.v1beta1.QueryParamsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryParamsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.voting_params != null && message.hasOwnProperty("voting_params")) { - let error = $root.cosmos.gov.v1beta1.VotingParams.verify(message.voting_params); - if (error) - return "voting_params." + error; - } - if (message.deposit_params != null && message.hasOwnProperty("deposit_params")) { - let error = $root.cosmos.gov.v1beta1.DepositParams.verify(message.deposit_params); - if (error) - return "deposit_params." + error; - } - if (message.tally_params != null && message.hasOwnProperty("tally_params")) { - let error = $root.cosmos.gov.v1beta1.TallyParams.verify(message.tally_params); - if (error) - return "tally_params." + error; - } - return null; - }; - - /** - * Creates a QueryParamsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.QueryParamsResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.QueryParamsResponse} QueryParamsResponse - */ - QueryParamsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.QueryParamsResponse) - return object; - let message = new $root.cosmos.gov.v1beta1.QueryParamsResponse(); - if (object.voting_params != null) { - if (typeof object.voting_params !== "object") - throw TypeError(".cosmos.gov.v1beta1.QueryParamsResponse.voting_params: object expected"); - message.voting_params = $root.cosmos.gov.v1beta1.VotingParams.fromObject(object.voting_params); - } - if (object.deposit_params != null) { - if (typeof object.deposit_params !== "object") - throw TypeError(".cosmos.gov.v1beta1.QueryParamsResponse.deposit_params: object expected"); - message.deposit_params = $root.cosmos.gov.v1beta1.DepositParams.fromObject(object.deposit_params); - } - if (object.tally_params != null) { - if (typeof object.tally_params !== "object") - throw TypeError(".cosmos.gov.v1beta1.QueryParamsResponse.tally_params: object expected"); - message.tally_params = $root.cosmos.gov.v1beta1.TallyParams.fromObject(object.tally_params); - } - return message; - }; - - /** - * Creates a plain object from a QueryParamsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.QueryParamsResponse - * @static - * @param {cosmos.gov.v1beta1.QueryParamsResponse} message QueryParamsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryParamsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.voting_params = null; - object.deposit_params = null; - object.tally_params = null; - } - if (message.voting_params != null && message.hasOwnProperty("voting_params")) - object.voting_params = $root.cosmos.gov.v1beta1.VotingParams.toObject(message.voting_params, options); - if (message.deposit_params != null && message.hasOwnProperty("deposit_params")) - object.deposit_params = $root.cosmos.gov.v1beta1.DepositParams.toObject(message.deposit_params, options); - if (message.tally_params != null && message.hasOwnProperty("tally_params")) - object.tally_params = $root.cosmos.gov.v1beta1.TallyParams.toObject(message.tally_params, options); - return object; - }; - - /** - * Converts this QueryParamsResponse to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.QueryParamsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryParamsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryParamsResponse; - })(); - - v1beta1.QueryDepositRequest = (function() { - - /** - * Properties of a QueryDepositRequest. - * @memberof cosmos.gov.v1beta1 - * @interface IQueryDepositRequest - * @property {Long|null} [proposal_id] QueryDepositRequest proposal_id - * @property {string|null} [depositor] QueryDepositRequest depositor - */ - - /** - * Constructs a new QueryDepositRequest. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a QueryDepositRequest. - * @implements IQueryDepositRequest - * @constructor - * @param {cosmos.gov.v1beta1.IQueryDepositRequest=} [properties] Properties to set - */ - function QueryDepositRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryDepositRequest proposal_id. - * @member {Long} proposal_id - * @memberof cosmos.gov.v1beta1.QueryDepositRequest - * @instance - */ - QueryDepositRequest.prototype.proposal_id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * QueryDepositRequest depositor. - * @member {string} depositor - * @memberof cosmos.gov.v1beta1.QueryDepositRequest - * @instance - */ - QueryDepositRequest.prototype.depositor = ""; - - /** - * Encodes the specified QueryDepositRequest message. Does not implicitly {@link cosmos.gov.v1beta1.QueryDepositRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.QueryDepositRequest - * @static - * @param {cosmos.gov.v1beta1.IQueryDepositRequest} message QueryDepositRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDepositRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.proposal_id != null && Object.hasOwnProperty.call(message, "proposal_id")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.proposal_id); - if (message.depositor != null && Object.hasOwnProperty.call(message, "depositor")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.depositor); - return writer; - }; - - /** - * Encodes the specified QueryDepositRequest message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryDepositRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.QueryDepositRequest - * @static - * @param {cosmos.gov.v1beta1.IQueryDepositRequest} message QueryDepositRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDepositRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryDepositRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.QueryDepositRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.QueryDepositRequest} QueryDepositRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDepositRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryDepositRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.proposal_id = reader.uint64(); - break; - case 2: - message.depositor = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryDepositRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.QueryDepositRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.QueryDepositRequest} QueryDepositRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDepositRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryDepositRequest message. - * @function verify - * @memberof cosmos.gov.v1beta1.QueryDepositRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryDepositRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) - if (!$util.isInteger(message.proposal_id) && !(message.proposal_id && $util.isInteger(message.proposal_id.low) && $util.isInteger(message.proposal_id.high))) - return "proposal_id: integer|Long expected"; - if (message.depositor != null && message.hasOwnProperty("depositor")) - if (!$util.isString(message.depositor)) - return "depositor: string expected"; - return null; - }; - - /** - * Creates a QueryDepositRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.QueryDepositRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.QueryDepositRequest} QueryDepositRequest - */ - QueryDepositRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.QueryDepositRequest) - return object; - let message = new $root.cosmos.gov.v1beta1.QueryDepositRequest(); - if (object.proposal_id != null) - if ($util.Long) - (message.proposal_id = $util.Long.fromValue(object.proposal_id)).unsigned = true; - else if (typeof object.proposal_id === "string") - message.proposal_id = parseInt(object.proposal_id, 10); - else if (typeof object.proposal_id === "number") - message.proposal_id = object.proposal_id; - else if (typeof object.proposal_id === "object") - message.proposal_id = new $util.LongBits(object.proposal_id.low >>> 0, object.proposal_id.high >>> 0).toNumber(true); - if (object.depositor != null) - message.depositor = String(object.depositor); - return message; - }; - - /** - * Creates a plain object from a QueryDepositRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.QueryDepositRequest - * @static - * @param {cosmos.gov.v1beta1.QueryDepositRequest} message QueryDepositRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryDepositRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.proposal_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.proposal_id = options.longs === String ? "0" : 0; - object.depositor = ""; - } - if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) - if (typeof message.proposal_id === "number") - object.proposal_id = options.longs === String ? String(message.proposal_id) : message.proposal_id; - else - object.proposal_id = options.longs === String ? $util.Long.prototype.toString.call(message.proposal_id) : options.longs === Number ? new $util.LongBits(message.proposal_id.low >>> 0, message.proposal_id.high >>> 0).toNumber(true) : message.proposal_id; - if (message.depositor != null && message.hasOwnProperty("depositor")) - object.depositor = message.depositor; - return object; - }; - - /** - * Converts this QueryDepositRequest to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.QueryDepositRequest - * @instance - * @returns {Object.} JSON object - */ - QueryDepositRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryDepositRequest; - })(); - - v1beta1.QueryDepositResponse = (function() { - - /** - * Properties of a QueryDepositResponse. - * @memberof cosmos.gov.v1beta1 - * @interface IQueryDepositResponse - * @property {cosmos.gov.v1beta1.IDeposit|null} [deposit] QueryDepositResponse deposit - */ - - /** - * Constructs a new QueryDepositResponse. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a QueryDepositResponse. - * @implements IQueryDepositResponse - * @constructor - * @param {cosmos.gov.v1beta1.IQueryDepositResponse=} [properties] Properties to set - */ - function QueryDepositResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryDepositResponse deposit. - * @member {cosmos.gov.v1beta1.IDeposit|null|undefined} deposit - * @memberof cosmos.gov.v1beta1.QueryDepositResponse - * @instance - */ - QueryDepositResponse.prototype.deposit = null; - - /** - * Encodes the specified QueryDepositResponse message. Does not implicitly {@link cosmos.gov.v1beta1.QueryDepositResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.QueryDepositResponse - * @static - * @param {cosmos.gov.v1beta1.IQueryDepositResponse} message QueryDepositResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDepositResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.deposit != null && Object.hasOwnProperty.call(message, "deposit")) - $root.cosmos.gov.v1beta1.Deposit.encode(message.deposit, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryDepositResponse message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryDepositResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.QueryDepositResponse - * @static - * @param {cosmos.gov.v1beta1.IQueryDepositResponse} message QueryDepositResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDepositResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryDepositResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.QueryDepositResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.QueryDepositResponse} QueryDepositResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDepositResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryDepositResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.deposit = $root.cosmos.gov.v1beta1.Deposit.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryDepositResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.QueryDepositResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.QueryDepositResponse} QueryDepositResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDepositResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryDepositResponse message. - * @function verify - * @memberof cosmos.gov.v1beta1.QueryDepositResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryDepositResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.deposit != null && message.hasOwnProperty("deposit")) { - let error = $root.cosmos.gov.v1beta1.Deposit.verify(message.deposit); - if (error) - return "deposit." + error; - } - return null; - }; - - /** - * Creates a QueryDepositResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.QueryDepositResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.QueryDepositResponse} QueryDepositResponse - */ - QueryDepositResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.QueryDepositResponse) - return object; - let message = new $root.cosmos.gov.v1beta1.QueryDepositResponse(); - if (object.deposit != null) { - if (typeof object.deposit !== "object") - throw TypeError(".cosmos.gov.v1beta1.QueryDepositResponse.deposit: object expected"); - message.deposit = $root.cosmos.gov.v1beta1.Deposit.fromObject(object.deposit); - } - return message; - }; - - /** - * Creates a plain object from a QueryDepositResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.QueryDepositResponse - * @static - * @param {cosmos.gov.v1beta1.QueryDepositResponse} message QueryDepositResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryDepositResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.deposit = null; - if (message.deposit != null && message.hasOwnProperty("deposit")) - object.deposit = $root.cosmos.gov.v1beta1.Deposit.toObject(message.deposit, options); - return object; - }; - - /** - * Converts this QueryDepositResponse to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.QueryDepositResponse - * @instance - * @returns {Object.} JSON object - */ - QueryDepositResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryDepositResponse; - })(); - - v1beta1.QueryDepositsRequest = (function() { - - /** - * Properties of a QueryDepositsRequest. - * @memberof cosmos.gov.v1beta1 - * @interface IQueryDepositsRequest - * @property {Long|null} [proposal_id] QueryDepositsRequest proposal_id - * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryDepositsRequest pagination - */ - - /** - * Constructs a new QueryDepositsRequest. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a QueryDepositsRequest. - * @implements IQueryDepositsRequest - * @constructor - * @param {cosmos.gov.v1beta1.IQueryDepositsRequest=} [properties] Properties to set - */ - function QueryDepositsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryDepositsRequest proposal_id. - * @member {Long} proposal_id - * @memberof cosmos.gov.v1beta1.QueryDepositsRequest - * @instance - */ - QueryDepositsRequest.prototype.proposal_id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * QueryDepositsRequest pagination. - * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination - * @memberof cosmos.gov.v1beta1.QueryDepositsRequest - * @instance - */ - QueryDepositsRequest.prototype.pagination = null; - - /** - * Encodes the specified QueryDepositsRequest message. Does not implicitly {@link cosmos.gov.v1beta1.QueryDepositsRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.QueryDepositsRequest - * @static - * @param {cosmos.gov.v1beta1.IQueryDepositsRequest} message QueryDepositsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDepositsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.proposal_id != null && Object.hasOwnProperty.call(message, "proposal_id")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.proposal_id); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryDepositsRequest message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryDepositsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.QueryDepositsRequest - * @static - * @param {cosmos.gov.v1beta1.IQueryDepositsRequest} message QueryDepositsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDepositsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryDepositsRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.QueryDepositsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.QueryDepositsRequest} QueryDepositsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDepositsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryDepositsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.proposal_id = reader.uint64(); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryDepositsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.QueryDepositsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.QueryDepositsRequest} QueryDepositsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDepositsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryDepositsRequest message. - * @function verify - * @memberof cosmos.gov.v1beta1.QueryDepositsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryDepositsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) - if (!$util.isInteger(message.proposal_id) && !(message.proposal_id && $util.isInteger(message.proposal_id.low) && $util.isInteger(message.proposal_id.high))) - return "proposal_id: integer|Long expected"; - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryDepositsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.QueryDepositsRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.QueryDepositsRequest} QueryDepositsRequest - */ - QueryDepositsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.QueryDepositsRequest) - return object; - let message = new $root.cosmos.gov.v1beta1.QueryDepositsRequest(); - if (object.proposal_id != null) - if ($util.Long) - (message.proposal_id = $util.Long.fromValue(object.proposal_id)).unsigned = true; - else if (typeof object.proposal_id === "string") - message.proposal_id = parseInt(object.proposal_id, 10); - else if (typeof object.proposal_id === "number") - message.proposal_id = object.proposal_id; - else if (typeof object.proposal_id === "object") - message.proposal_id = new $util.LongBits(object.proposal_id.low >>> 0, object.proposal_id.high >>> 0).toNumber(true); - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.gov.v1beta1.QueryDepositsRequest.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryDepositsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.QueryDepositsRequest - * @static - * @param {cosmos.gov.v1beta1.QueryDepositsRequest} message QueryDepositsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryDepositsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.proposal_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.proposal_id = options.longs === String ? "0" : 0; - object.pagination = null; - } - if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) - if (typeof message.proposal_id === "number") - object.proposal_id = options.longs === String ? String(message.proposal_id) : message.proposal_id; - else - object.proposal_id = options.longs === String ? $util.Long.prototype.toString.call(message.proposal_id) : options.longs === Number ? new $util.LongBits(message.proposal_id.low >>> 0, message.proposal_id.high >>> 0).toNumber(true) : message.proposal_id; - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryDepositsRequest to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.QueryDepositsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryDepositsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryDepositsRequest; - })(); - - v1beta1.QueryDepositsResponse = (function() { - - /** - * Properties of a QueryDepositsResponse. - * @memberof cosmos.gov.v1beta1 - * @interface IQueryDepositsResponse - * @property {Array.|null} [deposits] QueryDepositsResponse deposits - * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryDepositsResponse pagination - */ - - /** - * Constructs a new QueryDepositsResponse. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a QueryDepositsResponse. - * @implements IQueryDepositsResponse - * @constructor - * @param {cosmos.gov.v1beta1.IQueryDepositsResponse=} [properties] Properties to set - */ - function QueryDepositsResponse(properties) { - this.deposits = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryDepositsResponse deposits. - * @member {Array.} deposits - * @memberof cosmos.gov.v1beta1.QueryDepositsResponse - * @instance - */ - QueryDepositsResponse.prototype.deposits = $util.emptyArray; - - /** - * QueryDepositsResponse pagination. - * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination - * @memberof cosmos.gov.v1beta1.QueryDepositsResponse - * @instance - */ - QueryDepositsResponse.prototype.pagination = null; - - /** - * Encodes the specified QueryDepositsResponse message. Does not implicitly {@link cosmos.gov.v1beta1.QueryDepositsResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.QueryDepositsResponse - * @static - * @param {cosmos.gov.v1beta1.IQueryDepositsResponse} message QueryDepositsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDepositsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.deposits != null && message.deposits.length) - for (let i = 0; i < message.deposits.length; ++i) - $root.cosmos.gov.v1beta1.Deposit.encode(message.deposits[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryDepositsResponse message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryDepositsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.QueryDepositsResponse - * @static - * @param {cosmos.gov.v1beta1.IQueryDepositsResponse} message QueryDepositsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDepositsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryDepositsResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.QueryDepositsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.QueryDepositsResponse} QueryDepositsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDepositsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryDepositsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.deposits && message.deposits.length)) - message.deposits = []; - message.deposits.push($root.cosmos.gov.v1beta1.Deposit.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryDepositsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.QueryDepositsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.QueryDepositsResponse} QueryDepositsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDepositsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryDepositsResponse message. - * @function verify - * @memberof cosmos.gov.v1beta1.QueryDepositsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryDepositsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.deposits != null && message.hasOwnProperty("deposits")) { - if (!Array.isArray(message.deposits)) - return "deposits: array expected"; - for (let i = 0; i < message.deposits.length; ++i) { - let error = $root.cosmos.gov.v1beta1.Deposit.verify(message.deposits[i]); - if (error) - return "deposits." + error; - } - } - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryDepositsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.QueryDepositsResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.QueryDepositsResponse} QueryDepositsResponse - */ - QueryDepositsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.QueryDepositsResponse) - return object; - let message = new $root.cosmos.gov.v1beta1.QueryDepositsResponse(); - if (object.deposits) { - if (!Array.isArray(object.deposits)) - throw TypeError(".cosmos.gov.v1beta1.QueryDepositsResponse.deposits: array expected"); - message.deposits = []; - for (let i = 0; i < object.deposits.length; ++i) { - if (typeof object.deposits[i] !== "object") - throw TypeError(".cosmos.gov.v1beta1.QueryDepositsResponse.deposits: object expected"); - message.deposits[i] = $root.cosmos.gov.v1beta1.Deposit.fromObject(object.deposits[i]); - } - } - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.gov.v1beta1.QueryDepositsResponse.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryDepositsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.QueryDepositsResponse - * @static - * @param {cosmos.gov.v1beta1.QueryDepositsResponse} message QueryDepositsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryDepositsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.deposits = []; - if (options.defaults) - object.pagination = null; - if (message.deposits && message.deposits.length) { - object.deposits = []; - for (let j = 0; j < message.deposits.length; ++j) - object.deposits[j] = $root.cosmos.gov.v1beta1.Deposit.toObject(message.deposits[j], options); - } - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryDepositsResponse to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.QueryDepositsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryDepositsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryDepositsResponse; - })(); - - v1beta1.QueryTallyResultRequest = (function() { - - /** - * Properties of a QueryTallyResultRequest. - * @memberof cosmos.gov.v1beta1 - * @interface IQueryTallyResultRequest - * @property {Long|null} [proposal_id] QueryTallyResultRequest proposal_id - */ - - /** - * Constructs a new QueryTallyResultRequest. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a QueryTallyResultRequest. - * @implements IQueryTallyResultRequest - * @constructor - * @param {cosmos.gov.v1beta1.IQueryTallyResultRequest=} [properties] Properties to set - */ - function QueryTallyResultRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryTallyResultRequest proposal_id. - * @member {Long} proposal_id - * @memberof cosmos.gov.v1beta1.QueryTallyResultRequest - * @instance - */ - QueryTallyResultRequest.prototype.proposal_id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified QueryTallyResultRequest message. Does not implicitly {@link cosmos.gov.v1beta1.QueryTallyResultRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.QueryTallyResultRequest - * @static - * @param {cosmos.gov.v1beta1.IQueryTallyResultRequest} message QueryTallyResultRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryTallyResultRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.proposal_id != null && Object.hasOwnProperty.call(message, "proposal_id")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.proposal_id); - return writer; - }; - - /** - * Encodes the specified QueryTallyResultRequest message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryTallyResultRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.QueryTallyResultRequest - * @static - * @param {cosmos.gov.v1beta1.IQueryTallyResultRequest} message QueryTallyResultRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryTallyResultRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryTallyResultRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.QueryTallyResultRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.QueryTallyResultRequest} QueryTallyResultRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryTallyResultRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryTallyResultRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.proposal_id = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryTallyResultRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.QueryTallyResultRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.QueryTallyResultRequest} QueryTallyResultRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryTallyResultRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryTallyResultRequest message. - * @function verify - * @memberof cosmos.gov.v1beta1.QueryTallyResultRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryTallyResultRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) - if (!$util.isInteger(message.proposal_id) && !(message.proposal_id && $util.isInteger(message.proposal_id.low) && $util.isInteger(message.proposal_id.high))) - return "proposal_id: integer|Long expected"; - return null; - }; - - /** - * Creates a QueryTallyResultRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.QueryTallyResultRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.QueryTallyResultRequest} QueryTallyResultRequest - */ - QueryTallyResultRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.QueryTallyResultRequest) - return object; - let message = new $root.cosmos.gov.v1beta1.QueryTallyResultRequest(); - if (object.proposal_id != null) - if ($util.Long) - (message.proposal_id = $util.Long.fromValue(object.proposal_id)).unsigned = true; - else if (typeof object.proposal_id === "string") - message.proposal_id = parseInt(object.proposal_id, 10); - else if (typeof object.proposal_id === "number") - message.proposal_id = object.proposal_id; - else if (typeof object.proposal_id === "object") - message.proposal_id = new $util.LongBits(object.proposal_id.low >>> 0, object.proposal_id.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a QueryTallyResultRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.QueryTallyResultRequest - * @static - * @param {cosmos.gov.v1beta1.QueryTallyResultRequest} message QueryTallyResultRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryTallyResultRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.proposal_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.proposal_id = options.longs === String ? "0" : 0; - if (message.proposal_id != null && message.hasOwnProperty("proposal_id")) - if (typeof message.proposal_id === "number") - object.proposal_id = options.longs === String ? String(message.proposal_id) : message.proposal_id; - else - object.proposal_id = options.longs === String ? $util.Long.prototype.toString.call(message.proposal_id) : options.longs === Number ? new $util.LongBits(message.proposal_id.low >>> 0, message.proposal_id.high >>> 0).toNumber(true) : message.proposal_id; - return object; - }; - - /** - * Converts this QueryTallyResultRequest to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.QueryTallyResultRequest - * @instance - * @returns {Object.} JSON object - */ - QueryTallyResultRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryTallyResultRequest; - })(); - - v1beta1.QueryTallyResultResponse = (function() { - - /** - * Properties of a QueryTallyResultResponse. - * @memberof cosmos.gov.v1beta1 - * @interface IQueryTallyResultResponse - * @property {cosmos.gov.v1beta1.ITallyResult|null} [tally] QueryTallyResultResponse tally - */ - - /** - * Constructs a new QueryTallyResultResponse. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a QueryTallyResultResponse. - * @implements IQueryTallyResultResponse - * @constructor - * @param {cosmos.gov.v1beta1.IQueryTallyResultResponse=} [properties] Properties to set - */ - function QueryTallyResultResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryTallyResultResponse tally. - * @member {cosmos.gov.v1beta1.ITallyResult|null|undefined} tally - * @memberof cosmos.gov.v1beta1.QueryTallyResultResponse - * @instance - */ - QueryTallyResultResponse.prototype.tally = null; - - /** - * Encodes the specified QueryTallyResultResponse message. Does not implicitly {@link cosmos.gov.v1beta1.QueryTallyResultResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.QueryTallyResultResponse - * @static - * @param {cosmos.gov.v1beta1.IQueryTallyResultResponse} message QueryTallyResultResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryTallyResultResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.tally != null && Object.hasOwnProperty.call(message, "tally")) - $root.cosmos.gov.v1beta1.TallyResult.encode(message.tally, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryTallyResultResponse message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.QueryTallyResultResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.QueryTallyResultResponse - * @static - * @param {cosmos.gov.v1beta1.IQueryTallyResultResponse} message QueryTallyResultResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryTallyResultResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryTallyResultResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.QueryTallyResultResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.QueryTallyResultResponse} QueryTallyResultResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryTallyResultResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.QueryTallyResultResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.tally = $root.cosmos.gov.v1beta1.TallyResult.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryTallyResultResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.QueryTallyResultResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.QueryTallyResultResponse} QueryTallyResultResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryTallyResultResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryTallyResultResponse message. - * @function verify - * @memberof cosmos.gov.v1beta1.QueryTallyResultResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryTallyResultResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.tally != null && message.hasOwnProperty("tally")) { - let error = $root.cosmos.gov.v1beta1.TallyResult.verify(message.tally); - if (error) - return "tally." + error; - } - return null; - }; - - /** - * Creates a QueryTallyResultResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.QueryTallyResultResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.QueryTallyResultResponse} QueryTallyResultResponse - */ - QueryTallyResultResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.QueryTallyResultResponse) - return object; - let message = new $root.cosmos.gov.v1beta1.QueryTallyResultResponse(); - if (object.tally != null) { - if (typeof object.tally !== "object") - throw TypeError(".cosmos.gov.v1beta1.QueryTallyResultResponse.tally: object expected"); - message.tally = $root.cosmos.gov.v1beta1.TallyResult.fromObject(object.tally); - } - return message; - }; - - /** - * Creates a plain object from a QueryTallyResultResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.QueryTallyResultResponse - * @static - * @param {cosmos.gov.v1beta1.QueryTallyResultResponse} message QueryTallyResultResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryTallyResultResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.tally = null; - if (message.tally != null && message.hasOwnProperty("tally")) - object.tally = $root.cosmos.gov.v1beta1.TallyResult.toObject(message.tally, options); - return object; - }; - - /** - * Converts this QueryTallyResultResponse to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.QueryTallyResultResponse - * @instance - * @returns {Object.} JSON object - */ - QueryTallyResultResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryTallyResultResponse; - })(); - - v1beta1.GenesisState = (function() { - - /** - * Properties of a GenesisState. - * @memberof cosmos.gov.v1beta1 - * @interface IGenesisState - * @property {Long|null} [starting_proposal_id] GenesisState starting_proposal_id - * @property {Array.|null} [deposits] GenesisState deposits - * @property {Array.|null} [votes] GenesisState votes - * @property {Array.|null} [proposals] GenesisState proposals - * @property {cosmos.gov.v1beta1.IDepositParams|null} [deposit_params] GenesisState deposit_params - * @property {cosmos.gov.v1beta1.IVotingParams|null} [voting_params] GenesisState voting_params - * @property {cosmos.gov.v1beta1.ITallyParams|null} [tally_params] GenesisState tally_params - */ - - /** - * Constructs a new GenesisState. - * @memberof cosmos.gov.v1beta1 - * @classdesc Represents a GenesisState. - * @implements IGenesisState - * @constructor - * @param {cosmos.gov.v1beta1.IGenesisState=} [properties] Properties to set - */ - function GenesisState(properties) { - this.deposits = []; - this.votes = []; - this.proposals = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GenesisState starting_proposal_id. - * @member {Long} starting_proposal_id - * @memberof cosmos.gov.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.starting_proposal_id = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * GenesisState deposits. - * @member {Array.} deposits - * @memberof cosmos.gov.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.deposits = $util.emptyArray; - - /** - * GenesisState votes. - * @member {Array.} votes - * @memberof cosmos.gov.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.votes = $util.emptyArray; - - /** - * GenesisState proposals. - * @member {Array.} proposals - * @memberof cosmos.gov.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.proposals = $util.emptyArray; - - /** - * GenesisState deposit_params. - * @member {cosmos.gov.v1beta1.IDepositParams|null|undefined} deposit_params - * @memberof cosmos.gov.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.deposit_params = null; - - /** - * GenesisState voting_params. - * @member {cosmos.gov.v1beta1.IVotingParams|null|undefined} voting_params - * @memberof cosmos.gov.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.voting_params = null; - - /** - * GenesisState tally_params. - * @member {cosmos.gov.v1beta1.ITallyParams|null|undefined} tally_params - * @memberof cosmos.gov.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.tally_params = null; - - /** - * Encodes the specified GenesisState message. Does not implicitly {@link cosmos.gov.v1beta1.GenesisState.verify|verify} messages. - * @function encode - * @memberof cosmos.gov.v1beta1.GenesisState - * @static - * @param {cosmos.gov.v1beta1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.starting_proposal_id != null && Object.hasOwnProperty.call(message, "starting_proposal_id")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.starting_proposal_id); - if (message.deposits != null && message.deposits.length) - for (let i = 0; i < message.deposits.length; ++i) - $root.cosmos.gov.v1beta1.Deposit.encode(message.deposits[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.votes != null && message.votes.length) - for (let i = 0; i < message.votes.length; ++i) - $root.cosmos.gov.v1beta1.Vote.encode(message.votes[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.proposals != null && message.proposals.length) - for (let i = 0; i < message.proposals.length; ++i) - $root.cosmos.gov.v1beta1.Proposal.encode(message.proposals[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.deposit_params != null && Object.hasOwnProperty.call(message, "deposit_params")) - $root.cosmos.gov.v1beta1.DepositParams.encode(message.deposit_params, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.voting_params != null && Object.hasOwnProperty.call(message, "voting_params")) - $root.cosmos.gov.v1beta1.VotingParams.encode(message.voting_params, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.tally_params != null && Object.hasOwnProperty.call(message, "tally_params")) - $root.cosmos.gov.v1beta1.TallyParams.encode(message.tally_params, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link cosmos.gov.v1beta1.GenesisState.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.gov.v1beta1.GenesisState - * @static - * @param {cosmos.gov.v1beta1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer. - * @function decode - * @memberof cosmos.gov.v1beta1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.gov.v1beta1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.gov.v1beta1.GenesisState(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.starting_proposal_id = reader.uint64(); - break; - case 2: - if (!(message.deposits && message.deposits.length)) - message.deposits = []; - message.deposits.push($root.cosmos.gov.v1beta1.Deposit.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.votes && message.votes.length)) - message.votes = []; - message.votes.push($root.cosmos.gov.v1beta1.Vote.decode(reader, reader.uint32())); - break; - case 4: - if (!(message.proposals && message.proposals.length)) - message.proposals = []; - message.proposals.push($root.cosmos.gov.v1beta1.Proposal.decode(reader, reader.uint32())); - break; - case 5: - message.deposit_params = $root.cosmos.gov.v1beta1.DepositParams.decode(reader, reader.uint32()); - break; - case 6: - message.voting_params = $root.cosmos.gov.v1beta1.VotingParams.decode(reader, reader.uint32()); - break; - case 7: - message.tally_params = $root.cosmos.gov.v1beta1.TallyParams.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.gov.v1beta1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.gov.v1beta1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GenesisState message. - * @function verify - * @memberof cosmos.gov.v1beta1.GenesisState - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GenesisState.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.starting_proposal_id != null && message.hasOwnProperty("starting_proposal_id")) - if (!$util.isInteger(message.starting_proposal_id) && !(message.starting_proposal_id && $util.isInteger(message.starting_proposal_id.low) && $util.isInteger(message.starting_proposal_id.high))) - return "starting_proposal_id: integer|Long expected"; - if (message.deposits != null && message.hasOwnProperty("deposits")) { - if (!Array.isArray(message.deposits)) - return "deposits: array expected"; - for (let i = 0; i < message.deposits.length; ++i) { - let error = $root.cosmos.gov.v1beta1.Deposit.verify(message.deposits[i]); - if (error) - return "deposits." + error; - } - } - if (message.votes != null && message.hasOwnProperty("votes")) { - if (!Array.isArray(message.votes)) - return "votes: array expected"; - for (let i = 0; i < message.votes.length; ++i) { - let error = $root.cosmos.gov.v1beta1.Vote.verify(message.votes[i]); - if (error) - return "votes." + error; - } - } - if (message.proposals != null && message.hasOwnProperty("proposals")) { - if (!Array.isArray(message.proposals)) - return "proposals: array expected"; - for (let i = 0; i < message.proposals.length; ++i) { - let error = $root.cosmos.gov.v1beta1.Proposal.verify(message.proposals[i]); - if (error) - return "proposals." + error; - } - } - if (message.deposit_params != null && message.hasOwnProperty("deposit_params")) { - let error = $root.cosmos.gov.v1beta1.DepositParams.verify(message.deposit_params); - if (error) - return "deposit_params." + error; - } - if (message.voting_params != null && message.hasOwnProperty("voting_params")) { - let error = $root.cosmos.gov.v1beta1.VotingParams.verify(message.voting_params); - if (error) - return "voting_params." + error; - } - if (message.tally_params != null && message.hasOwnProperty("tally_params")) { - let error = $root.cosmos.gov.v1beta1.TallyParams.verify(message.tally_params); - if (error) - return "tally_params." + error; - } - return null; - }; - - /** - * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.gov.v1beta1.GenesisState - * @static - * @param {Object.} object Plain object - * @returns {cosmos.gov.v1beta1.GenesisState} GenesisState - */ - GenesisState.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.gov.v1beta1.GenesisState) - return object; - let message = new $root.cosmos.gov.v1beta1.GenesisState(); - if (object.starting_proposal_id != null) - if ($util.Long) - (message.starting_proposal_id = $util.Long.fromValue(object.starting_proposal_id)).unsigned = true; - else if (typeof object.starting_proposal_id === "string") - message.starting_proposal_id = parseInt(object.starting_proposal_id, 10); - else if (typeof object.starting_proposal_id === "number") - message.starting_proposal_id = object.starting_proposal_id; - else if (typeof object.starting_proposal_id === "object") - message.starting_proposal_id = new $util.LongBits(object.starting_proposal_id.low >>> 0, object.starting_proposal_id.high >>> 0).toNumber(true); - if (object.deposits) { - if (!Array.isArray(object.deposits)) - throw TypeError(".cosmos.gov.v1beta1.GenesisState.deposits: array expected"); - message.deposits = []; - for (let i = 0; i < object.deposits.length; ++i) { - if (typeof object.deposits[i] !== "object") - throw TypeError(".cosmos.gov.v1beta1.GenesisState.deposits: object expected"); - message.deposits[i] = $root.cosmos.gov.v1beta1.Deposit.fromObject(object.deposits[i]); - } - } - if (object.votes) { - if (!Array.isArray(object.votes)) - throw TypeError(".cosmos.gov.v1beta1.GenesisState.votes: array expected"); - message.votes = []; - for (let i = 0; i < object.votes.length; ++i) { - if (typeof object.votes[i] !== "object") - throw TypeError(".cosmos.gov.v1beta1.GenesisState.votes: object expected"); - message.votes[i] = $root.cosmos.gov.v1beta1.Vote.fromObject(object.votes[i]); - } - } - if (object.proposals) { - if (!Array.isArray(object.proposals)) - throw TypeError(".cosmos.gov.v1beta1.GenesisState.proposals: array expected"); - message.proposals = []; - for (let i = 0; i < object.proposals.length; ++i) { - if (typeof object.proposals[i] !== "object") - throw TypeError(".cosmos.gov.v1beta1.GenesisState.proposals: object expected"); - message.proposals[i] = $root.cosmos.gov.v1beta1.Proposal.fromObject(object.proposals[i]); - } - } - if (object.deposit_params != null) { - if (typeof object.deposit_params !== "object") - throw TypeError(".cosmos.gov.v1beta1.GenesisState.deposit_params: object expected"); - message.deposit_params = $root.cosmos.gov.v1beta1.DepositParams.fromObject(object.deposit_params); - } - if (object.voting_params != null) { - if (typeof object.voting_params !== "object") - throw TypeError(".cosmos.gov.v1beta1.GenesisState.voting_params: object expected"); - message.voting_params = $root.cosmos.gov.v1beta1.VotingParams.fromObject(object.voting_params); - } - if (object.tally_params != null) { - if (typeof object.tally_params !== "object") - throw TypeError(".cosmos.gov.v1beta1.GenesisState.tally_params: object expected"); - message.tally_params = $root.cosmos.gov.v1beta1.TallyParams.fromObject(object.tally_params); - } - return message; - }; - - /** - * Creates a plain object from a GenesisState message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.gov.v1beta1.GenesisState - * @static - * @param {cosmos.gov.v1beta1.GenesisState} message GenesisState - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GenesisState.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) { - object.deposits = []; - object.votes = []; - object.proposals = []; - } - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.starting_proposal_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.starting_proposal_id = options.longs === String ? "0" : 0; - object.deposit_params = null; - object.voting_params = null; - object.tally_params = null; - } - if (message.starting_proposal_id != null && message.hasOwnProperty("starting_proposal_id")) - if (typeof message.starting_proposal_id === "number") - object.starting_proposal_id = options.longs === String ? String(message.starting_proposal_id) : message.starting_proposal_id; - else - object.starting_proposal_id = options.longs === String ? $util.Long.prototype.toString.call(message.starting_proposal_id) : options.longs === Number ? new $util.LongBits(message.starting_proposal_id.low >>> 0, message.starting_proposal_id.high >>> 0).toNumber(true) : message.starting_proposal_id; - if (message.deposits && message.deposits.length) { - object.deposits = []; - for (let j = 0; j < message.deposits.length; ++j) - object.deposits[j] = $root.cosmos.gov.v1beta1.Deposit.toObject(message.deposits[j], options); - } - if (message.votes && message.votes.length) { - object.votes = []; - for (let j = 0; j < message.votes.length; ++j) - object.votes[j] = $root.cosmos.gov.v1beta1.Vote.toObject(message.votes[j], options); - } - if (message.proposals && message.proposals.length) { - object.proposals = []; - for (let j = 0; j < message.proposals.length; ++j) - object.proposals[j] = $root.cosmos.gov.v1beta1.Proposal.toObject(message.proposals[j], options); - } - if (message.deposit_params != null && message.hasOwnProperty("deposit_params")) - object.deposit_params = $root.cosmos.gov.v1beta1.DepositParams.toObject(message.deposit_params, options); - if (message.voting_params != null && message.hasOwnProperty("voting_params")) - object.voting_params = $root.cosmos.gov.v1beta1.VotingParams.toObject(message.voting_params, options); - if (message.tally_params != null && message.hasOwnProperty("tally_params")) - object.tally_params = $root.cosmos.gov.v1beta1.TallyParams.toObject(message.tally_params, options); - return object; - }; - - /** - * Converts this GenesisState to JSON. - * @function toJSON - * @memberof cosmos.gov.v1beta1.GenesisState - * @instance - * @returns {Object.} JSON object - */ - GenesisState.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GenesisState; - })(); - - return v1beta1; - })(); - - return gov; - })(); - - cosmos.mint = (function() { - - /** - * Namespace mint. - * @memberof cosmos - * @namespace - */ - const mint = {}; - - mint.v1beta1 = (function() { - - /** - * Namespace v1beta1. - * @memberof cosmos.mint - * @namespace - */ - const v1beta1 = {}; - - v1beta1.Query = (function() { - - /** - * Constructs a new Query service. - * @memberof cosmos.mint.v1beta1 - * @classdesc Represents a Query - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function Query(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Query.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Query; - - /** - * Callback as used by {@link cosmos.mint.v1beta1.Query#params}. - * @memberof cosmos.mint.v1beta1.Query - * @typedef ParamsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.mint.v1beta1.QueryParamsResponse} [response] QueryParamsResponse - */ - - /** - * Calls Params. - * @function params - * @memberof cosmos.mint.v1beta1.Query - * @instance - * @param {cosmos.mint.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object - * @param {cosmos.mint.v1beta1.Query.ParamsCallback} callback Node-style callback called with the error, if any, and QueryParamsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.params = function params(request, callback) { - return this.rpcCall(params, $root.cosmos.mint.v1beta1.QueryParamsRequest, $root.cosmos.mint.v1beta1.QueryParamsResponse, request, callback); - }, "name", { value: "Params" }); - - /** - * Calls Params. - * @function params - * @memberof cosmos.mint.v1beta1.Query - * @instance - * @param {cosmos.mint.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.mint.v1beta1.Query#inflation}. - * @memberof cosmos.mint.v1beta1.Query - * @typedef InflationCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.mint.v1beta1.QueryInflationResponse} [response] QueryInflationResponse - */ - - /** - * Calls Inflation. - * @function inflation - * @memberof cosmos.mint.v1beta1.Query - * @instance - * @param {cosmos.mint.v1beta1.IQueryInflationRequest} request QueryInflationRequest message or plain object - * @param {cosmos.mint.v1beta1.Query.InflationCallback} callback Node-style callback called with the error, if any, and QueryInflationResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.inflation = function inflation(request, callback) { - return this.rpcCall(inflation, $root.cosmos.mint.v1beta1.QueryInflationRequest, $root.cosmos.mint.v1beta1.QueryInflationResponse, request, callback); - }, "name", { value: "Inflation" }); - - /** - * Calls Inflation. - * @function inflation - * @memberof cosmos.mint.v1beta1.Query - * @instance - * @param {cosmos.mint.v1beta1.IQueryInflationRequest} request QueryInflationRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.mint.v1beta1.Query#annualProvisions}. - * @memberof cosmos.mint.v1beta1.Query - * @typedef AnnualProvisionsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.mint.v1beta1.QueryAnnualProvisionsResponse} [response] QueryAnnualProvisionsResponse - */ - - /** - * Calls AnnualProvisions. - * @function annualProvisions - * @memberof cosmos.mint.v1beta1.Query - * @instance - * @param {cosmos.mint.v1beta1.IQueryAnnualProvisionsRequest} request QueryAnnualProvisionsRequest message or plain object - * @param {cosmos.mint.v1beta1.Query.AnnualProvisionsCallback} callback Node-style callback called with the error, if any, and QueryAnnualProvisionsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.annualProvisions = function annualProvisions(request, callback) { - return this.rpcCall(annualProvisions, $root.cosmos.mint.v1beta1.QueryAnnualProvisionsRequest, $root.cosmos.mint.v1beta1.QueryAnnualProvisionsResponse, request, callback); - }, "name", { value: "AnnualProvisions" }); - - /** - * Calls AnnualProvisions. - * @function annualProvisions - * @memberof cosmos.mint.v1beta1.Query - * @instance - * @param {cosmos.mint.v1beta1.IQueryAnnualProvisionsRequest} request QueryAnnualProvisionsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return Query; - })(); - - v1beta1.QueryParamsRequest = (function() { - - /** - * Properties of a QueryParamsRequest. - * @memberof cosmos.mint.v1beta1 - * @interface IQueryParamsRequest - */ - - /** - * Constructs a new QueryParamsRequest. - * @memberof cosmos.mint.v1beta1 - * @classdesc Represents a QueryParamsRequest. - * @implements IQueryParamsRequest - * @constructor - * @param {cosmos.mint.v1beta1.IQueryParamsRequest=} [properties] Properties to set - */ - function QueryParamsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified QueryParamsRequest message. Does not implicitly {@link cosmos.mint.v1beta1.QueryParamsRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.mint.v1beta1.QueryParamsRequest - * @static - * @param {cosmos.mint.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified QueryParamsRequest message, length delimited. Does not implicitly {@link cosmos.mint.v1beta1.QueryParamsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.mint.v1beta1.QueryParamsRequest - * @static - * @param {cosmos.mint.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryParamsRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.mint.v1beta1.QueryParamsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.mint.v1beta1.QueryParamsRequest} QueryParamsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.mint.v1beta1.QueryParamsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryParamsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.mint.v1beta1.QueryParamsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.mint.v1beta1.QueryParamsRequest} QueryParamsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryParamsRequest message. - * @function verify - * @memberof cosmos.mint.v1beta1.QueryParamsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryParamsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a QueryParamsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.mint.v1beta1.QueryParamsRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.mint.v1beta1.QueryParamsRequest} QueryParamsRequest - */ - QueryParamsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.mint.v1beta1.QueryParamsRequest) - return object; - return new $root.cosmos.mint.v1beta1.QueryParamsRequest(); - }; - - /** - * Creates a plain object from a QueryParamsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.mint.v1beta1.QueryParamsRequest - * @static - * @param {cosmos.mint.v1beta1.QueryParamsRequest} message QueryParamsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryParamsRequest.toObject = function toObject() { - return {}; - }; - - /** - * Converts this QueryParamsRequest to JSON. - * @function toJSON - * @memberof cosmos.mint.v1beta1.QueryParamsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryParamsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryParamsRequest; - })(); - - v1beta1.QueryParamsResponse = (function() { - - /** - * Properties of a QueryParamsResponse. - * @memberof cosmos.mint.v1beta1 - * @interface IQueryParamsResponse - * @property {cosmos.mint.v1beta1.IParams|null} [params] QueryParamsResponse params - */ - - /** - * Constructs a new QueryParamsResponse. - * @memberof cosmos.mint.v1beta1 - * @classdesc Represents a QueryParamsResponse. - * @implements IQueryParamsResponse - * @constructor - * @param {cosmos.mint.v1beta1.IQueryParamsResponse=} [properties] Properties to set - */ - function QueryParamsResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryParamsResponse params. - * @member {cosmos.mint.v1beta1.IParams|null|undefined} params - * @memberof cosmos.mint.v1beta1.QueryParamsResponse - * @instance - */ - QueryParamsResponse.prototype.params = null; - - /** - * Encodes the specified QueryParamsResponse message. Does not implicitly {@link cosmos.mint.v1beta1.QueryParamsResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.mint.v1beta1.QueryParamsResponse - * @static - * @param {cosmos.mint.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.params != null && Object.hasOwnProperty.call(message, "params")) - $root.cosmos.mint.v1beta1.Params.encode(message.params, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryParamsResponse message, length delimited. Does not implicitly {@link cosmos.mint.v1beta1.QueryParamsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.mint.v1beta1.QueryParamsResponse - * @static - * @param {cosmos.mint.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryParamsResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.mint.v1beta1.QueryParamsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.mint.v1beta1.QueryParamsResponse} QueryParamsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.mint.v1beta1.QueryParamsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.params = $root.cosmos.mint.v1beta1.Params.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryParamsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.mint.v1beta1.QueryParamsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.mint.v1beta1.QueryParamsResponse} QueryParamsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryParamsResponse message. - * @function verify - * @memberof cosmos.mint.v1beta1.QueryParamsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryParamsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.params != null && message.hasOwnProperty("params")) { - let error = $root.cosmos.mint.v1beta1.Params.verify(message.params); - if (error) - return "params." + error; - } - return null; - }; - - /** - * Creates a QueryParamsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.mint.v1beta1.QueryParamsResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.mint.v1beta1.QueryParamsResponse} QueryParamsResponse - */ - QueryParamsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.mint.v1beta1.QueryParamsResponse) - return object; - let message = new $root.cosmos.mint.v1beta1.QueryParamsResponse(); - if (object.params != null) { - if (typeof object.params !== "object") - throw TypeError(".cosmos.mint.v1beta1.QueryParamsResponse.params: object expected"); - message.params = $root.cosmos.mint.v1beta1.Params.fromObject(object.params); - } - return message; - }; - - /** - * Creates a plain object from a QueryParamsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.mint.v1beta1.QueryParamsResponse - * @static - * @param {cosmos.mint.v1beta1.QueryParamsResponse} message QueryParamsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryParamsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.params = null; - if (message.params != null && message.hasOwnProperty("params")) - object.params = $root.cosmos.mint.v1beta1.Params.toObject(message.params, options); - return object; - }; - - /** - * Converts this QueryParamsResponse to JSON. - * @function toJSON - * @memberof cosmos.mint.v1beta1.QueryParamsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryParamsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryParamsResponse; - })(); - - v1beta1.QueryInflationRequest = (function() { - - /** - * Properties of a QueryInflationRequest. - * @memberof cosmos.mint.v1beta1 - * @interface IQueryInflationRequest - */ - - /** - * Constructs a new QueryInflationRequest. - * @memberof cosmos.mint.v1beta1 - * @classdesc Represents a QueryInflationRequest. - * @implements IQueryInflationRequest - * @constructor - * @param {cosmos.mint.v1beta1.IQueryInflationRequest=} [properties] Properties to set - */ - function QueryInflationRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified QueryInflationRequest message. Does not implicitly {@link cosmos.mint.v1beta1.QueryInflationRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.mint.v1beta1.QueryInflationRequest - * @static - * @param {cosmos.mint.v1beta1.IQueryInflationRequest} message QueryInflationRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryInflationRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified QueryInflationRequest message, length delimited. Does not implicitly {@link cosmos.mint.v1beta1.QueryInflationRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.mint.v1beta1.QueryInflationRequest - * @static - * @param {cosmos.mint.v1beta1.IQueryInflationRequest} message QueryInflationRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryInflationRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryInflationRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.mint.v1beta1.QueryInflationRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.mint.v1beta1.QueryInflationRequest} QueryInflationRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryInflationRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.mint.v1beta1.QueryInflationRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryInflationRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.mint.v1beta1.QueryInflationRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.mint.v1beta1.QueryInflationRequest} QueryInflationRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryInflationRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryInflationRequest message. - * @function verify - * @memberof cosmos.mint.v1beta1.QueryInflationRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryInflationRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a QueryInflationRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.mint.v1beta1.QueryInflationRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.mint.v1beta1.QueryInflationRequest} QueryInflationRequest - */ - QueryInflationRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.mint.v1beta1.QueryInflationRequest) - return object; - return new $root.cosmos.mint.v1beta1.QueryInflationRequest(); - }; - - /** - * Creates a plain object from a QueryInflationRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.mint.v1beta1.QueryInflationRequest - * @static - * @param {cosmos.mint.v1beta1.QueryInflationRequest} message QueryInflationRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryInflationRequest.toObject = function toObject() { - return {}; - }; - - /** - * Converts this QueryInflationRequest to JSON. - * @function toJSON - * @memberof cosmos.mint.v1beta1.QueryInflationRequest - * @instance - * @returns {Object.} JSON object - */ - QueryInflationRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryInflationRequest; - })(); - - v1beta1.QueryInflationResponse = (function() { - - /** - * Properties of a QueryInflationResponse. - * @memberof cosmos.mint.v1beta1 - * @interface IQueryInflationResponse - * @property {Uint8Array|null} [inflation] QueryInflationResponse inflation - */ - - /** - * Constructs a new QueryInflationResponse. - * @memberof cosmos.mint.v1beta1 - * @classdesc Represents a QueryInflationResponse. - * @implements IQueryInflationResponse - * @constructor - * @param {cosmos.mint.v1beta1.IQueryInflationResponse=} [properties] Properties to set - */ - function QueryInflationResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryInflationResponse inflation. - * @member {Uint8Array} inflation - * @memberof cosmos.mint.v1beta1.QueryInflationResponse - * @instance - */ - QueryInflationResponse.prototype.inflation = $util.newBuffer([]); - - /** - * Encodes the specified QueryInflationResponse message. Does not implicitly {@link cosmos.mint.v1beta1.QueryInflationResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.mint.v1beta1.QueryInflationResponse - * @static - * @param {cosmos.mint.v1beta1.IQueryInflationResponse} message QueryInflationResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryInflationResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.inflation != null && Object.hasOwnProperty.call(message, "inflation")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.inflation); - return writer; - }; - - /** - * Encodes the specified QueryInflationResponse message, length delimited. Does not implicitly {@link cosmos.mint.v1beta1.QueryInflationResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.mint.v1beta1.QueryInflationResponse - * @static - * @param {cosmos.mint.v1beta1.IQueryInflationResponse} message QueryInflationResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryInflationResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryInflationResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.mint.v1beta1.QueryInflationResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.mint.v1beta1.QueryInflationResponse} QueryInflationResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryInflationResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.mint.v1beta1.QueryInflationResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.inflation = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryInflationResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.mint.v1beta1.QueryInflationResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.mint.v1beta1.QueryInflationResponse} QueryInflationResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryInflationResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryInflationResponse message. - * @function verify - * @memberof cosmos.mint.v1beta1.QueryInflationResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryInflationResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.inflation != null && message.hasOwnProperty("inflation")) - if (!(message.inflation && typeof message.inflation.length === "number" || $util.isString(message.inflation))) - return "inflation: buffer expected"; - return null; - }; - - /** - * Creates a QueryInflationResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.mint.v1beta1.QueryInflationResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.mint.v1beta1.QueryInflationResponse} QueryInflationResponse - */ - QueryInflationResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.mint.v1beta1.QueryInflationResponse) - return object; - let message = new $root.cosmos.mint.v1beta1.QueryInflationResponse(); - if (object.inflation != null) - if (typeof object.inflation === "string") - $util.base64.decode(object.inflation, message.inflation = $util.newBuffer($util.base64.length(object.inflation)), 0); - else if (object.inflation.length) - message.inflation = object.inflation; - return message; - }; - - /** - * Creates a plain object from a QueryInflationResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.mint.v1beta1.QueryInflationResponse - * @static - * @param {cosmos.mint.v1beta1.QueryInflationResponse} message QueryInflationResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryInflationResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - if (options.bytes === String) - object.inflation = ""; - else { - object.inflation = []; - if (options.bytes !== Array) - object.inflation = $util.newBuffer(object.inflation); - } - if (message.inflation != null && message.hasOwnProperty("inflation")) - object.inflation = options.bytes === String ? $util.base64.encode(message.inflation, 0, message.inflation.length) : options.bytes === Array ? Array.prototype.slice.call(message.inflation) : message.inflation; - return object; - }; - - /** - * Converts this QueryInflationResponse to JSON. - * @function toJSON - * @memberof cosmos.mint.v1beta1.QueryInflationResponse - * @instance - * @returns {Object.} JSON object - */ - QueryInflationResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryInflationResponse; - })(); - - v1beta1.QueryAnnualProvisionsRequest = (function() { - - /** - * Properties of a QueryAnnualProvisionsRequest. - * @memberof cosmos.mint.v1beta1 - * @interface IQueryAnnualProvisionsRequest - */ - - /** - * Constructs a new QueryAnnualProvisionsRequest. - * @memberof cosmos.mint.v1beta1 - * @classdesc Represents a QueryAnnualProvisionsRequest. - * @implements IQueryAnnualProvisionsRequest - * @constructor - * @param {cosmos.mint.v1beta1.IQueryAnnualProvisionsRequest=} [properties] Properties to set - */ - function QueryAnnualProvisionsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified QueryAnnualProvisionsRequest message. Does not implicitly {@link cosmos.mint.v1beta1.QueryAnnualProvisionsRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsRequest - * @static - * @param {cosmos.mint.v1beta1.IQueryAnnualProvisionsRequest} message QueryAnnualProvisionsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryAnnualProvisionsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified QueryAnnualProvisionsRequest message, length delimited. Does not implicitly {@link cosmos.mint.v1beta1.QueryAnnualProvisionsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsRequest - * @static - * @param {cosmos.mint.v1beta1.IQueryAnnualProvisionsRequest} message QueryAnnualProvisionsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryAnnualProvisionsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryAnnualProvisionsRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.mint.v1beta1.QueryAnnualProvisionsRequest} QueryAnnualProvisionsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryAnnualProvisionsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.mint.v1beta1.QueryAnnualProvisionsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryAnnualProvisionsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.mint.v1beta1.QueryAnnualProvisionsRequest} QueryAnnualProvisionsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryAnnualProvisionsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryAnnualProvisionsRequest message. - * @function verify - * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryAnnualProvisionsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a QueryAnnualProvisionsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.mint.v1beta1.QueryAnnualProvisionsRequest} QueryAnnualProvisionsRequest - */ - QueryAnnualProvisionsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.mint.v1beta1.QueryAnnualProvisionsRequest) - return object; - return new $root.cosmos.mint.v1beta1.QueryAnnualProvisionsRequest(); - }; - - /** - * Creates a plain object from a QueryAnnualProvisionsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsRequest - * @static - * @param {cosmos.mint.v1beta1.QueryAnnualProvisionsRequest} message QueryAnnualProvisionsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryAnnualProvisionsRequest.toObject = function toObject() { - return {}; - }; - - /** - * Converts this QueryAnnualProvisionsRequest to JSON. - * @function toJSON - * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryAnnualProvisionsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryAnnualProvisionsRequest; - })(); - - v1beta1.QueryAnnualProvisionsResponse = (function() { - - /** - * Properties of a QueryAnnualProvisionsResponse. - * @memberof cosmos.mint.v1beta1 - * @interface IQueryAnnualProvisionsResponse - * @property {Uint8Array|null} [annual_provisions] QueryAnnualProvisionsResponse annual_provisions - */ - - /** - * Constructs a new QueryAnnualProvisionsResponse. - * @memberof cosmos.mint.v1beta1 - * @classdesc Represents a QueryAnnualProvisionsResponse. - * @implements IQueryAnnualProvisionsResponse - * @constructor - * @param {cosmos.mint.v1beta1.IQueryAnnualProvisionsResponse=} [properties] Properties to set - */ - function QueryAnnualProvisionsResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryAnnualProvisionsResponse annual_provisions. - * @member {Uint8Array} annual_provisions - * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsResponse - * @instance - */ - QueryAnnualProvisionsResponse.prototype.annual_provisions = $util.newBuffer([]); - - /** - * Encodes the specified QueryAnnualProvisionsResponse message. Does not implicitly {@link cosmos.mint.v1beta1.QueryAnnualProvisionsResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsResponse - * @static - * @param {cosmos.mint.v1beta1.IQueryAnnualProvisionsResponse} message QueryAnnualProvisionsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryAnnualProvisionsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.annual_provisions != null && Object.hasOwnProperty.call(message, "annual_provisions")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.annual_provisions); - return writer; - }; - - /** - * Encodes the specified QueryAnnualProvisionsResponse message, length delimited. Does not implicitly {@link cosmos.mint.v1beta1.QueryAnnualProvisionsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsResponse - * @static - * @param {cosmos.mint.v1beta1.IQueryAnnualProvisionsResponse} message QueryAnnualProvisionsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryAnnualProvisionsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryAnnualProvisionsResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.mint.v1beta1.QueryAnnualProvisionsResponse} QueryAnnualProvisionsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryAnnualProvisionsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.mint.v1beta1.QueryAnnualProvisionsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.annual_provisions = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryAnnualProvisionsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.mint.v1beta1.QueryAnnualProvisionsResponse} QueryAnnualProvisionsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryAnnualProvisionsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryAnnualProvisionsResponse message. - * @function verify - * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryAnnualProvisionsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.annual_provisions != null && message.hasOwnProperty("annual_provisions")) - if (!(message.annual_provisions && typeof message.annual_provisions.length === "number" || $util.isString(message.annual_provisions))) - return "annual_provisions: buffer expected"; - return null; - }; - - /** - * Creates a QueryAnnualProvisionsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.mint.v1beta1.QueryAnnualProvisionsResponse} QueryAnnualProvisionsResponse - */ - QueryAnnualProvisionsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.mint.v1beta1.QueryAnnualProvisionsResponse) - return object; - let message = new $root.cosmos.mint.v1beta1.QueryAnnualProvisionsResponse(); - if (object.annual_provisions != null) - if (typeof object.annual_provisions === "string") - $util.base64.decode(object.annual_provisions, message.annual_provisions = $util.newBuffer($util.base64.length(object.annual_provisions)), 0); - else if (object.annual_provisions.length) - message.annual_provisions = object.annual_provisions; - return message; - }; - - /** - * Creates a plain object from a QueryAnnualProvisionsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsResponse - * @static - * @param {cosmos.mint.v1beta1.QueryAnnualProvisionsResponse} message QueryAnnualProvisionsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryAnnualProvisionsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - if (options.bytes === String) - object.annual_provisions = ""; - else { - object.annual_provisions = []; - if (options.bytes !== Array) - object.annual_provisions = $util.newBuffer(object.annual_provisions); - } - if (message.annual_provisions != null && message.hasOwnProperty("annual_provisions")) - object.annual_provisions = options.bytes === String ? $util.base64.encode(message.annual_provisions, 0, message.annual_provisions.length) : options.bytes === Array ? Array.prototype.slice.call(message.annual_provisions) : message.annual_provisions; - return object; - }; - - /** - * Converts this QueryAnnualProvisionsResponse to JSON. - * @function toJSON - * @memberof cosmos.mint.v1beta1.QueryAnnualProvisionsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryAnnualProvisionsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryAnnualProvisionsResponse; - })(); - - v1beta1.GenesisState = (function() { - - /** - * Properties of a GenesisState. - * @memberof cosmos.mint.v1beta1 - * @interface IGenesisState - * @property {cosmos.mint.v1beta1.IMinter|null} [minter] GenesisState minter - * @property {cosmos.mint.v1beta1.IParams|null} [params] GenesisState params - */ - - /** - * Constructs a new GenesisState. - * @memberof cosmos.mint.v1beta1 - * @classdesc Represents a GenesisState. - * @implements IGenesisState - * @constructor - * @param {cosmos.mint.v1beta1.IGenesisState=} [properties] Properties to set - */ - function GenesisState(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GenesisState minter. - * @member {cosmos.mint.v1beta1.IMinter|null|undefined} minter - * @memberof cosmos.mint.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.minter = null; - - /** - * GenesisState params. - * @member {cosmos.mint.v1beta1.IParams|null|undefined} params - * @memberof cosmos.mint.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.params = null; - - /** - * Encodes the specified GenesisState message. Does not implicitly {@link cosmos.mint.v1beta1.GenesisState.verify|verify} messages. - * @function encode - * @memberof cosmos.mint.v1beta1.GenesisState - * @static - * @param {cosmos.mint.v1beta1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.minter != null && Object.hasOwnProperty.call(message, "minter")) - $root.cosmos.mint.v1beta1.Minter.encode(message.minter, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.params != null && Object.hasOwnProperty.call(message, "params")) - $root.cosmos.mint.v1beta1.Params.encode(message.params, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link cosmos.mint.v1beta1.GenesisState.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.mint.v1beta1.GenesisState - * @static - * @param {cosmos.mint.v1beta1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer. - * @function decode - * @memberof cosmos.mint.v1beta1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.mint.v1beta1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.mint.v1beta1.GenesisState(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.minter = $root.cosmos.mint.v1beta1.Minter.decode(reader, reader.uint32()); - break; - case 2: - message.params = $root.cosmos.mint.v1beta1.Params.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.mint.v1beta1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.mint.v1beta1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GenesisState message. - * @function verify - * @memberof cosmos.mint.v1beta1.GenesisState - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GenesisState.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.minter != null && message.hasOwnProperty("minter")) { - let error = $root.cosmos.mint.v1beta1.Minter.verify(message.minter); - if (error) - return "minter." + error; - } - if (message.params != null && message.hasOwnProperty("params")) { - let error = $root.cosmos.mint.v1beta1.Params.verify(message.params); - if (error) - return "params." + error; - } - return null; - }; - - /** - * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.mint.v1beta1.GenesisState - * @static - * @param {Object.} object Plain object - * @returns {cosmos.mint.v1beta1.GenesisState} GenesisState - */ - GenesisState.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.mint.v1beta1.GenesisState) - return object; - let message = new $root.cosmos.mint.v1beta1.GenesisState(); - if (object.minter != null) { - if (typeof object.minter !== "object") - throw TypeError(".cosmos.mint.v1beta1.GenesisState.minter: object expected"); - message.minter = $root.cosmos.mint.v1beta1.Minter.fromObject(object.minter); - } - if (object.params != null) { - if (typeof object.params !== "object") - throw TypeError(".cosmos.mint.v1beta1.GenesisState.params: object expected"); - message.params = $root.cosmos.mint.v1beta1.Params.fromObject(object.params); - } - return message; - }; - - /** - * Creates a plain object from a GenesisState message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.mint.v1beta1.GenesisState - * @static - * @param {cosmos.mint.v1beta1.GenesisState} message GenesisState - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GenesisState.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.minter = null; - object.params = null; - } - if (message.minter != null && message.hasOwnProperty("minter")) - object.minter = $root.cosmos.mint.v1beta1.Minter.toObject(message.minter, options); - if (message.params != null && message.hasOwnProperty("params")) - object.params = $root.cosmos.mint.v1beta1.Params.toObject(message.params, options); - return object; - }; - - /** - * Converts this GenesisState to JSON. - * @function toJSON - * @memberof cosmos.mint.v1beta1.GenesisState - * @instance - * @returns {Object.} JSON object - */ - GenesisState.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GenesisState; - })(); - - v1beta1.Minter = (function() { - - /** - * Properties of a Minter. - * @memberof cosmos.mint.v1beta1 - * @interface IMinter - * @property {string|null} [inflation] Minter inflation - * @property {string|null} [annual_provisions] Minter annual_provisions - */ - - /** - * Constructs a new Minter. - * @memberof cosmos.mint.v1beta1 - * @classdesc Represents a Minter. - * @implements IMinter - * @constructor - * @param {cosmos.mint.v1beta1.IMinter=} [properties] Properties to set - */ - function Minter(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Minter inflation. - * @member {string} inflation - * @memberof cosmos.mint.v1beta1.Minter - * @instance - */ - Minter.prototype.inflation = ""; - - /** - * Minter annual_provisions. - * @member {string} annual_provisions - * @memberof cosmos.mint.v1beta1.Minter - * @instance - */ - Minter.prototype.annual_provisions = ""; - - /** - * Encodes the specified Minter message. Does not implicitly {@link cosmos.mint.v1beta1.Minter.verify|verify} messages. - * @function encode - * @memberof cosmos.mint.v1beta1.Minter - * @static - * @param {cosmos.mint.v1beta1.IMinter} message Minter message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Minter.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.inflation != null && Object.hasOwnProperty.call(message, "inflation")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.inflation); - if (message.annual_provisions != null && Object.hasOwnProperty.call(message, "annual_provisions")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.annual_provisions); - return writer; - }; - - /** - * Encodes the specified Minter message, length delimited. Does not implicitly {@link cosmos.mint.v1beta1.Minter.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.mint.v1beta1.Minter - * @static - * @param {cosmos.mint.v1beta1.IMinter} message Minter message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Minter.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Minter message from the specified reader or buffer. - * @function decode - * @memberof cosmos.mint.v1beta1.Minter - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.mint.v1beta1.Minter} Minter - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Minter.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.mint.v1beta1.Minter(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.inflation = reader.string(); - break; - case 2: - message.annual_provisions = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Minter message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.mint.v1beta1.Minter - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.mint.v1beta1.Minter} Minter - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Minter.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Minter message. - * @function verify - * @memberof cosmos.mint.v1beta1.Minter - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Minter.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.inflation != null && message.hasOwnProperty("inflation")) - if (!$util.isString(message.inflation)) - return "inflation: string expected"; - if (message.annual_provisions != null && message.hasOwnProperty("annual_provisions")) - if (!$util.isString(message.annual_provisions)) - return "annual_provisions: string expected"; - return null; - }; - - /** - * Creates a Minter message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.mint.v1beta1.Minter - * @static - * @param {Object.} object Plain object - * @returns {cosmos.mint.v1beta1.Minter} Minter - */ - Minter.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.mint.v1beta1.Minter) - return object; - let message = new $root.cosmos.mint.v1beta1.Minter(); - if (object.inflation != null) - message.inflation = String(object.inflation); - if (object.annual_provisions != null) - message.annual_provisions = String(object.annual_provisions); - return message; - }; - - /** - * Creates a plain object from a Minter message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.mint.v1beta1.Minter - * @static - * @param {cosmos.mint.v1beta1.Minter} message Minter - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Minter.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.inflation = ""; - object.annual_provisions = ""; - } - if (message.inflation != null && message.hasOwnProperty("inflation")) - object.inflation = message.inflation; - if (message.annual_provisions != null && message.hasOwnProperty("annual_provisions")) - object.annual_provisions = message.annual_provisions; - return object; - }; - - /** - * Converts this Minter to JSON. - * @function toJSON - * @memberof cosmos.mint.v1beta1.Minter - * @instance - * @returns {Object.} JSON object - */ - Minter.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Minter; - })(); - - v1beta1.Params = (function() { - - /** - * Properties of a Params. - * @memberof cosmos.mint.v1beta1 - * @interface IParams - * @property {string|null} [mint_denom] Params mint_denom - * @property {string|null} [inflation_rate_change] Params inflation_rate_change - * @property {string|null} [inflation_max] Params inflation_max - * @property {string|null} [inflation_min] Params inflation_min - * @property {string|null} [goal_bonded] Params goal_bonded - * @property {Long|null} [blocks_per_year] Params blocks_per_year - */ - - /** - * Constructs a new Params. - * @memberof cosmos.mint.v1beta1 - * @classdesc Represents a Params. - * @implements IParams - * @constructor - * @param {cosmos.mint.v1beta1.IParams=} [properties] Properties to set - */ - function Params(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Params mint_denom. - * @member {string} mint_denom - * @memberof cosmos.mint.v1beta1.Params - * @instance - */ - Params.prototype.mint_denom = ""; - - /** - * Params inflation_rate_change. - * @member {string} inflation_rate_change - * @memberof cosmos.mint.v1beta1.Params - * @instance - */ - Params.prototype.inflation_rate_change = ""; - - /** - * Params inflation_max. - * @member {string} inflation_max - * @memberof cosmos.mint.v1beta1.Params - * @instance - */ - Params.prototype.inflation_max = ""; - - /** - * Params inflation_min. - * @member {string} inflation_min - * @memberof cosmos.mint.v1beta1.Params - * @instance - */ - Params.prototype.inflation_min = ""; - - /** - * Params goal_bonded. - * @member {string} goal_bonded - * @memberof cosmos.mint.v1beta1.Params - * @instance - */ - Params.prototype.goal_bonded = ""; - - /** - * Params blocks_per_year. - * @member {Long} blocks_per_year - * @memberof cosmos.mint.v1beta1.Params - * @instance - */ - Params.prototype.blocks_per_year = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified Params message. Does not implicitly {@link cosmos.mint.v1beta1.Params.verify|verify} messages. - * @function encode - * @memberof cosmos.mint.v1beta1.Params - * @static - * @param {cosmos.mint.v1beta1.IParams} message Params message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Params.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.mint_denom != null && Object.hasOwnProperty.call(message, "mint_denom")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.mint_denom); - if (message.inflation_rate_change != null && Object.hasOwnProperty.call(message, "inflation_rate_change")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.inflation_rate_change); - if (message.inflation_max != null && Object.hasOwnProperty.call(message, "inflation_max")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.inflation_max); - if (message.inflation_min != null && Object.hasOwnProperty.call(message, "inflation_min")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.inflation_min); - if (message.goal_bonded != null && Object.hasOwnProperty.call(message, "goal_bonded")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.goal_bonded); - if (message.blocks_per_year != null && Object.hasOwnProperty.call(message, "blocks_per_year")) - writer.uint32(/* id 6, wireType 0 =*/48).uint64(message.blocks_per_year); - return writer; - }; - - /** - * Encodes the specified Params message, length delimited. Does not implicitly {@link cosmos.mint.v1beta1.Params.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.mint.v1beta1.Params - * @static - * @param {cosmos.mint.v1beta1.IParams} message Params message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Params.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Params message from the specified reader or buffer. - * @function decode - * @memberof cosmos.mint.v1beta1.Params - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.mint.v1beta1.Params} Params - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Params.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.mint.v1beta1.Params(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.mint_denom = reader.string(); - break; - case 2: - message.inflation_rate_change = reader.string(); - break; - case 3: - message.inflation_max = reader.string(); - break; - case 4: - message.inflation_min = reader.string(); - break; - case 5: - message.goal_bonded = reader.string(); - break; - case 6: - message.blocks_per_year = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Params message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.mint.v1beta1.Params - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.mint.v1beta1.Params} Params - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Params.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Params message. - * @function verify - * @memberof cosmos.mint.v1beta1.Params - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Params.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.mint_denom != null && message.hasOwnProperty("mint_denom")) - if (!$util.isString(message.mint_denom)) - return "mint_denom: string expected"; - if (message.inflation_rate_change != null && message.hasOwnProperty("inflation_rate_change")) - if (!$util.isString(message.inflation_rate_change)) - return "inflation_rate_change: string expected"; - if (message.inflation_max != null && message.hasOwnProperty("inflation_max")) - if (!$util.isString(message.inflation_max)) - return "inflation_max: string expected"; - if (message.inflation_min != null && message.hasOwnProperty("inflation_min")) - if (!$util.isString(message.inflation_min)) - return "inflation_min: string expected"; - if (message.goal_bonded != null && message.hasOwnProperty("goal_bonded")) - if (!$util.isString(message.goal_bonded)) - return "goal_bonded: string expected"; - if (message.blocks_per_year != null && message.hasOwnProperty("blocks_per_year")) - if (!$util.isInteger(message.blocks_per_year) && !(message.blocks_per_year && $util.isInteger(message.blocks_per_year.low) && $util.isInteger(message.blocks_per_year.high))) - return "blocks_per_year: integer|Long expected"; - return null; - }; - - /** - * Creates a Params message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.mint.v1beta1.Params - * @static - * @param {Object.} object Plain object - * @returns {cosmos.mint.v1beta1.Params} Params - */ - Params.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.mint.v1beta1.Params) - return object; - let message = new $root.cosmos.mint.v1beta1.Params(); - if (object.mint_denom != null) - message.mint_denom = String(object.mint_denom); - if (object.inflation_rate_change != null) - message.inflation_rate_change = String(object.inflation_rate_change); - if (object.inflation_max != null) - message.inflation_max = String(object.inflation_max); - if (object.inflation_min != null) - message.inflation_min = String(object.inflation_min); - if (object.goal_bonded != null) - message.goal_bonded = String(object.goal_bonded); - if (object.blocks_per_year != null) - if ($util.Long) - (message.blocks_per_year = $util.Long.fromValue(object.blocks_per_year)).unsigned = true; - else if (typeof object.blocks_per_year === "string") - message.blocks_per_year = parseInt(object.blocks_per_year, 10); - else if (typeof object.blocks_per_year === "number") - message.blocks_per_year = object.blocks_per_year; - else if (typeof object.blocks_per_year === "object") - message.blocks_per_year = new $util.LongBits(object.blocks_per_year.low >>> 0, object.blocks_per_year.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a Params message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.mint.v1beta1.Params - * @static - * @param {cosmos.mint.v1beta1.Params} message Params - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Params.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.mint_denom = ""; - object.inflation_rate_change = ""; - object.inflation_max = ""; - object.inflation_min = ""; - object.goal_bonded = ""; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.blocks_per_year = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.blocks_per_year = options.longs === String ? "0" : 0; - } - if (message.mint_denom != null && message.hasOwnProperty("mint_denom")) - object.mint_denom = message.mint_denom; - if (message.inflation_rate_change != null && message.hasOwnProperty("inflation_rate_change")) - object.inflation_rate_change = message.inflation_rate_change; - if (message.inflation_max != null && message.hasOwnProperty("inflation_max")) - object.inflation_max = message.inflation_max; - if (message.inflation_min != null && message.hasOwnProperty("inflation_min")) - object.inflation_min = message.inflation_min; - if (message.goal_bonded != null && message.hasOwnProperty("goal_bonded")) - object.goal_bonded = message.goal_bonded; - if (message.blocks_per_year != null && message.hasOwnProperty("blocks_per_year")) - if (typeof message.blocks_per_year === "number") - object.blocks_per_year = options.longs === String ? String(message.blocks_per_year) : message.blocks_per_year; - else - object.blocks_per_year = options.longs === String ? $util.Long.prototype.toString.call(message.blocks_per_year) : options.longs === Number ? new $util.LongBits(message.blocks_per_year.low >>> 0, message.blocks_per_year.high >>> 0).toNumber(true) : message.blocks_per_year; - return object; - }; - - /** - * Converts this Params to JSON. - * @function toJSON - * @memberof cosmos.mint.v1beta1.Params - * @instance - * @returns {Object.} JSON object - */ - Params.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Params; - })(); - - return v1beta1; - })(); - - return mint; - })(); - - cosmos.params = (function() { - - /** - * Namespace params. - * @memberof cosmos - * @namespace - */ - const params = {}; - - params.v1beta1 = (function() { - - /** - * Namespace v1beta1. - * @memberof cosmos.params - * @namespace - */ - const v1beta1 = {}; - - v1beta1.Query = (function() { - - /** - * Constructs a new Query service. - * @memberof cosmos.params.v1beta1 - * @classdesc Represents a Query - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function Query(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Query.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Query; - - /** - * Callback as used by {@link cosmos.params.v1beta1.Query#params}. - * @memberof cosmos.params.v1beta1.Query - * @typedef ParamsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.params.v1beta1.QueryParamsResponse} [response] QueryParamsResponse - */ - - /** - * Calls Params. - * @function params - * @memberof cosmos.params.v1beta1.Query - * @instance - * @param {cosmos.params.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object - * @param {cosmos.params.v1beta1.Query.ParamsCallback} callback Node-style callback called with the error, if any, and QueryParamsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.params = function params(request, callback) { - return this.rpcCall(params, $root.cosmos.params.v1beta1.QueryParamsRequest, $root.cosmos.params.v1beta1.QueryParamsResponse, request, callback); - }, "name", { value: "Params" }); - - /** - * Calls Params. - * @function params - * @memberof cosmos.params.v1beta1.Query - * @instance - * @param {cosmos.params.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return Query; - })(); - - v1beta1.QueryParamsRequest = (function() { - - /** - * Properties of a QueryParamsRequest. - * @memberof cosmos.params.v1beta1 - * @interface IQueryParamsRequest - * @property {string|null} [subspace] QueryParamsRequest subspace - * @property {string|null} [key] QueryParamsRequest key - */ - - /** - * Constructs a new QueryParamsRequest. - * @memberof cosmos.params.v1beta1 - * @classdesc Represents a QueryParamsRequest. - * @implements IQueryParamsRequest - * @constructor - * @param {cosmos.params.v1beta1.IQueryParamsRequest=} [properties] Properties to set - */ - function QueryParamsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryParamsRequest subspace. - * @member {string} subspace - * @memberof cosmos.params.v1beta1.QueryParamsRequest - * @instance - */ - QueryParamsRequest.prototype.subspace = ""; - - /** - * QueryParamsRequest key. - * @member {string} key - * @memberof cosmos.params.v1beta1.QueryParamsRequest - * @instance - */ - QueryParamsRequest.prototype.key = ""; - - /** - * Encodes the specified QueryParamsRequest message. Does not implicitly {@link cosmos.params.v1beta1.QueryParamsRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.params.v1beta1.QueryParamsRequest - * @static - * @param {cosmos.params.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.subspace != null && Object.hasOwnProperty.call(message, "subspace")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.subspace); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.key); - return writer; - }; - - /** - * Encodes the specified QueryParamsRequest message, length delimited. Does not implicitly {@link cosmos.params.v1beta1.QueryParamsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.params.v1beta1.QueryParamsRequest - * @static - * @param {cosmos.params.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryParamsRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.params.v1beta1.QueryParamsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.params.v1beta1.QueryParamsRequest} QueryParamsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.params.v1beta1.QueryParamsRequest(); - while (reader.pos < end) { - let 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; - }; - - /** - * Decodes a QueryParamsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.params.v1beta1.QueryParamsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.params.v1beta1.QueryParamsRequest} QueryParamsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryParamsRequest message. - * @function verify - * @memberof cosmos.params.v1beta1.QueryParamsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryParamsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.subspace != null && message.hasOwnProperty("subspace")) - if (!$util.isString(message.subspace)) - return "subspace: string expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!$util.isString(message.key)) - return "key: string expected"; - return null; - }; - - /** - * Creates a QueryParamsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.params.v1beta1.QueryParamsRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.params.v1beta1.QueryParamsRequest} QueryParamsRequest - */ - QueryParamsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.params.v1beta1.QueryParamsRequest) - return object; - let message = new $root.cosmos.params.v1beta1.QueryParamsRequest(); - if (object.subspace != null) - message.subspace = String(object.subspace); - if (object.key != null) - message.key = String(object.key); - return message; - }; - - /** - * Creates a plain object from a QueryParamsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.params.v1beta1.QueryParamsRequest - * @static - * @param {cosmos.params.v1beta1.QueryParamsRequest} message QueryParamsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryParamsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.subspace = ""; - object.key = ""; - } - if (message.subspace != null && message.hasOwnProperty("subspace")) - object.subspace = message.subspace; - if (message.key != null && message.hasOwnProperty("key")) - object.key = message.key; - return object; - }; - - /** - * Converts this QueryParamsRequest to JSON. - * @function toJSON - * @memberof cosmos.params.v1beta1.QueryParamsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryParamsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryParamsRequest; - })(); - - v1beta1.QueryParamsResponse = (function() { - - /** - * Properties of a QueryParamsResponse. - * @memberof cosmos.params.v1beta1 - * @interface IQueryParamsResponse - * @property {cosmos.params.v1beta1.IParamChange|null} [param] QueryParamsResponse param - */ - - /** - * Constructs a new QueryParamsResponse. - * @memberof cosmos.params.v1beta1 - * @classdesc Represents a QueryParamsResponse. - * @implements IQueryParamsResponse - * @constructor - * @param {cosmos.params.v1beta1.IQueryParamsResponse=} [properties] Properties to set - */ - function QueryParamsResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryParamsResponse param. - * @member {cosmos.params.v1beta1.IParamChange|null|undefined} param - * @memberof cosmos.params.v1beta1.QueryParamsResponse - * @instance - */ - QueryParamsResponse.prototype.param = null; - - /** - * Encodes the specified QueryParamsResponse message. Does not implicitly {@link cosmos.params.v1beta1.QueryParamsResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.params.v1beta1.QueryParamsResponse - * @static - * @param {cosmos.params.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.param != null && Object.hasOwnProperty.call(message, "param")) - $root.cosmos.params.v1beta1.ParamChange.encode(message.param, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryParamsResponse message, length delimited. Does not implicitly {@link cosmos.params.v1beta1.QueryParamsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.params.v1beta1.QueryParamsResponse - * @static - * @param {cosmos.params.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryParamsResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.params.v1beta1.QueryParamsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.params.v1beta1.QueryParamsResponse} QueryParamsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.params.v1beta1.QueryParamsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.param = $root.cosmos.params.v1beta1.ParamChange.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryParamsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.params.v1beta1.QueryParamsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.params.v1beta1.QueryParamsResponse} QueryParamsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryParamsResponse message. - * @function verify - * @memberof cosmos.params.v1beta1.QueryParamsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryParamsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.param != null && message.hasOwnProperty("param")) { - let error = $root.cosmos.params.v1beta1.ParamChange.verify(message.param); - if (error) - return "param." + error; - } - return null; - }; - - /** - * Creates a QueryParamsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.params.v1beta1.QueryParamsResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.params.v1beta1.QueryParamsResponse} QueryParamsResponse - */ - QueryParamsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.params.v1beta1.QueryParamsResponse) - return object; - let message = new $root.cosmos.params.v1beta1.QueryParamsResponse(); - if (object.param != null) { - if (typeof object.param !== "object") - throw TypeError(".cosmos.params.v1beta1.QueryParamsResponse.param: object expected"); - message.param = $root.cosmos.params.v1beta1.ParamChange.fromObject(object.param); - } - return message; - }; - - /** - * Creates a plain object from a QueryParamsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.params.v1beta1.QueryParamsResponse - * @static - * @param {cosmos.params.v1beta1.QueryParamsResponse} message QueryParamsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryParamsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.param = null; - if (message.param != null && message.hasOwnProperty("param")) - object.param = $root.cosmos.params.v1beta1.ParamChange.toObject(message.param, options); - return object; - }; - - /** - * Converts this QueryParamsResponse to JSON. - * @function toJSON - * @memberof cosmos.params.v1beta1.QueryParamsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryParamsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryParamsResponse; - })(); - - v1beta1.ParameterChangeProposal = (function() { - - /** - * Properties of a ParameterChangeProposal. - * @memberof cosmos.params.v1beta1 - * @interface IParameterChangeProposal - * @property {string|null} [title] ParameterChangeProposal title - * @property {string|null} [description] ParameterChangeProposal description - * @property {Array.|null} [changes] ParameterChangeProposal changes - */ - - /** - * Constructs a new ParameterChangeProposal. - * @memberof cosmos.params.v1beta1 - * @classdesc Represents a ParameterChangeProposal. - * @implements IParameterChangeProposal - * @constructor - * @param {cosmos.params.v1beta1.IParameterChangeProposal=} [properties] Properties to set - */ - function ParameterChangeProposal(properties) { - this.changes = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ParameterChangeProposal title. - * @member {string} title - * @memberof cosmos.params.v1beta1.ParameterChangeProposal - * @instance - */ - ParameterChangeProposal.prototype.title = ""; - - /** - * ParameterChangeProposal description. - * @member {string} description - * @memberof cosmos.params.v1beta1.ParameterChangeProposal - * @instance - */ - ParameterChangeProposal.prototype.description = ""; - - /** - * ParameterChangeProposal changes. - * @member {Array.} changes - * @memberof cosmos.params.v1beta1.ParameterChangeProposal - * @instance - */ - ParameterChangeProposal.prototype.changes = $util.emptyArray; - - /** - * Encodes the specified ParameterChangeProposal message. Does not implicitly {@link cosmos.params.v1beta1.ParameterChangeProposal.verify|verify} messages. - * @function encode - * @memberof cosmos.params.v1beta1.ParameterChangeProposal - * @static - * @param {cosmos.params.v1beta1.IParameterChangeProposal} message ParameterChangeProposal message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ParameterChangeProposal.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.title != null && Object.hasOwnProperty.call(message, "title")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); - if (message.changes != null && message.changes.length) - for (let i = 0; i < message.changes.length; ++i) - $root.cosmos.params.v1beta1.ParamChange.encode(message.changes[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ParameterChangeProposal message, length delimited. Does not implicitly {@link cosmos.params.v1beta1.ParameterChangeProposal.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.params.v1beta1.ParameterChangeProposal - * @static - * @param {cosmos.params.v1beta1.IParameterChangeProposal} message ParameterChangeProposal message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ParameterChangeProposal.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ParameterChangeProposal message from the specified reader or buffer. - * @function decode - * @memberof cosmos.params.v1beta1.ParameterChangeProposal - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.params.v1beta1.ParameterChangeProposal} ParameterChangeProposal - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ParameterChangeProposal.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.params.v1beta1.ParameterChangeProposal(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.title = reader.string(); - break; - case 2: - message.description = reader.string(); - break; - case 3: - if (!(message.changes && message.changes.length)) - message.changes = []; - message.changes.push($root.cosmos.params.v1beta1.ParamChange.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ParameterChangeProposal message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.params.v1beta1.ParameterChangeProposal - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.params.v1beta1.ParameterChangeProposal} ParameterChangeProposal - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ParameterChangeProposal.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ParameterChangeProposal message. - * @function verify - * @memberof cosmos.params.v1beta1.ParameterChangeProposal - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ParameterChangeProposal.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.title != null && message.hasOwnProperty("title")) - if (!$util.isString(message.title)) - return "title: string expected"; - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - if (message.changes != null && message.hasOwnProperty("changes")) { - if (!Array.isArray(message.changes)) - return "changes: array expected"; - for (let i = 0; i < message.changes.length; ++i) { - let error = $root.cosmos.params.v1beta1.ParamChange.verify(message.changes[i]); - if (error) - return "changes." + error; - } - } - return null; - }; - - /** - * Creates a ParameterChangeProposal message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.params.v1beta1.ParameterChangeProposal - * @static - * @param {Object.} object Plain object - * @returns {cosmos.params.v1beta1.ParameterChangeProposal} ParameterChangeProposal - */ - ParameterChangeProposal.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.params.v1beta1.ParameterChangeProposal) - return object; - let message = new $root.cosmos.params.v1beta1.ParameterChangeProposal(); - if (object.title != null) - message.title = String(object.title); - if (object.description != null) - message.description = String(object.description); - if (object.changes) { - if (!Array.isArray(object.changes)) - throw TypeError(".cosmos.params.v1beta1.ParameterChangeProposal.changes: array expected"); - message.changes = []; - for (let i = 0; i < object.changes.length; ++i) { - if (typeof object.changes[i] !== "object") - throw TypeError(".cosmos.params.v1beta1.ParameterChangeProposal.changes: object expected"); - message.changes[i] = $root.cosmos.params.v1beta1.ParamChange.fromObject(object.changes[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a ParameterChangeProposal message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.params.v1beta1.ParameterChangeProposal - * @static - * @param {cosmos.params.v1beta1.ParameterChangeProposal} message ParameterChangeProposal - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ParameterChangeProposal.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.changes = []; - if (options.defaults) { - object.title = ""; - object.description = ""; - } - if (message.title != null && message.hasOwnProperty("title")) - object.title = message.title; - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - if (message.changes && message.changes.length) { - object.changes = []; - for (let j = 0; j < message.changes.length; ++j) - object.changes[j] = $root.cosmos.params.v1beta1.ParamChange.toObject(message.changes[j], options); - } - return object; - }; - - /** - * Converts this ParameterChangeProposal to JSON. - * @function toJSON - * @memberof cosmos.params.v1beta1.ParameterChangeProposal - * @instance - * @returns {Object.} JSON object - */ - ParameterChangeProposal.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ParameterChangeProposal; - })(); - - v1beta1.ParamChange = (function() { - - /** - * Properties of a ParamChange. - * @memberof cosmos.params.v1beta1 - * @interface IParamChange - * @property {string|null} [subspace] ParamChange subspace - * @property {string|null} [key] ParamChange key - * @property {string|null} [value] ParamChange value - */ - - /** - * Constructs a new ParamChange. - * @memberof cosmos.params.v1beta1 - * @classdesc Represents a ParamChange. - * @implements IParamChange - * @constructor - * @param {cosmos.params.v1beta1.IParamChange=} [properties] Properties to set - */ - function ParamChange(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ParamChange subspace. - * @member {string} subspace - * @memberof cosmos.params.v1beta1.ParamChange - * @instance - */ - ParamChange.prototype.subspace = ""; - - /** - * ParamChange key. - * @member {string} key - * @memberof cosmos.params.v1beta1.ParamChange - * @instance - */ - ParamChange.prototype.key = ""; - - /** - * ParamChange value. - * @member {string} value - * @memberof cosmos.params.v1beta1.ParamChange - * @instance - */ - ParamChange.prototype.value = ""; - - /** - * Encodes the specified ParamChange message. Does not implicitly {@link cosmos.params.v1beta1.ParamChange.verify|verify} messages. - * @function encode - * @memberof cosmos.params.v1beta1.ParamChange - * @static - * @param {cosmos.params.v1beta1.IParamChange} message ParamChange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ParamChange.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.subspace != null && Object.hasOwnProperty.call(message, "subspace")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.subspace); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.key); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.value); - return writer; - }; - - /** - * Encodes the specified ParamChange message, length delimited. Does not implicitly {@link cosmos.params.v1beta1.ParamChange.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.params.v1beta1.ParamChange - * @static - * @param {cosmos.params.v1beta1.IParamChange} message ParamChange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ParamChange.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ParamChange message from the specified reader or buffer. - * @function decode - * @memberof cosmos.params.v1beta1.ParamChange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.params.v1beta1.ParamChange} ParamChange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ParamChange.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.params.v1beta1.ParamChange(); - while (reader.pos < end) { - let 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; - }; - - /** - * Decodes a ParamChange message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.params.v1beta1.ParamChange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.params.v1beta1.ParamChange} ParamChange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ParamChange.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ParamChange message. - * @function verify - * @memberof cosmos.params.v1beta1.ParamChange - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ParamChange.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.subspace != null && message.hasOwnProperty("subspace")) - if (!$util.isString(message.subspace)) - return "subspace: string expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!$util.isString(message.key)) - return "key: string expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isString(message.value)) - return "value: string expected"; - return null; - }; - - /** - * Creates a ParamChange message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.params.v1beta1.ParamChange - * @static - * @param {Object.} object Plain object - * @returns {cosmos.params.v1beta1.ParamChange} ParamChange - */ - ParamChange.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.params.v1beta1.ParamChange) - return object; - let message = new $root.cosmos.params.v1beta1.ParamChange(); - if (object.subspace != null) - message.subspace = String(object.subspace); - if (object.key != null) - message.key = String(object.key); - if (object.value != null) - message.value = String(object.value); - return message; - }; - - /** - * Creates a plain object from a ParamChange message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.params.v1beta1.ParamChange - * @static - * @param {cosmos.params.v1beta1.ParamChange} message ParamChange - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ParamChange.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.subspace = ""; - object.key = ""; - object.value = ""; - } - if (message.subspace != null && message.hasOwnProperty("subspace")) - object.subspace = message.subspace; - if (message.key != null && message.hasOwnProperty("key")) - object.key = message.key; - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - return object; - }; - - /** - * Converts this ParamChange to JSON. - * @function toJSON - * @memberof cosmos.params.v1beta1.ParamChange - * @instance - * @returns {Object.} JSON object - */ - ParamChange.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ParamChange; - })(); - - return v1beta1; - })(); - - return params; - })(); - - cosmos.slashing = (function() { - - /** - * Namespace slashing. - * @memberof cosmos - * @namespace - */ - const slashing = {}; - - slashing.v1beta1 = (function() { - - /** - * Namespace v1beta1. - * @memberof cosmos.slashing - * @namespace - */ - const v1beta1 = {}; - - v1beta1.Msg = (function() { - - /** - * Constructs a new Msg service. - * @memberof cosmos.slashing.v1beta1 - * @classdesc Represents a Msg - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function Msg(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Msg.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Msg; - - /** - * Callback as used by {@link cosmos.slashing.v1beta1.Msg#unjail}. - * @memberof cosmos.slashing.v1beta1.Msg - * @typedef UnjailCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.slashing.v1beta1.MsgUnjailResponse} [response] MsgUnjailResponse - */ - - /** - * Calls Unjail. - * @function unjail - * @memberof cosmos.slashing.v1beta1.Msg - * @instance - * @param {cosmos.slashing.v1beta1.IMsgUnjail} request MsgUnjail message or plain object - * @param {cosmos.slashing.v1beta1.Msg.UnjailCallback} callback Node-style callback called with the error, if any, and MsgUnjailResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.unjail = function unjail(request, callback) { - return this.rpcCall(unjail, $root.cosmos.slashing.v1beta1.MsgUnjail, $root.cosmos.slashing.v1beta1.MsgUnjailResponse, request, callback); - }, "name", { value: "Unjail" }); - - /** - * Calls Unjail. - * @function unjail - * @memberof cosmos.slashing.v1beta1.Msg - * @instance - * @param {cosmos.slashing.v1beta1.IMsgUnjail} request MsgUnjail message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return Msg; - })(); - - v1beta1.MsgUnjail = (function() { - - /** - * Properties of a MsgUnjail. - * @memberof cosmos.slashing.v1beta1 - * @interface IMsgUnjail - * @property {string|null} [validator_addr] MsgUnjail validator_addr - */ - - /** - * Constructs a new MsgUnjail. - * @memberof cosmos.slashing.v1beta1 - * @classdesc Represents a MsgUnjail. - * @implements IMsgUnjail - * @constructor - * @param {cosmos.slashing.v1beta1.IMsgUnjail=} [properties] Properties to set - */ - function MsgUnjail(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgUnjail validator_addr. - * @member {string} validator_addr - * @memberof cosmos.slashing.v1beta1.MsgUnjail - * @instance - */ - MsgUnjail.prototype.validator_addr = ""; - - /** - * Encodes the specified MsgUnjail message. Does not implicitly {@link cosmos.slashing.v1beta1.MsgUnjail.verify|verify} messages. - * @function encode - * @memberof cosmos.slashing.v1beta1.MsgUnjail - * @static - * @param {cosmos.slashing.v1beta1.IMsgUnjail} message MsgUnjail message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgUnjail.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.validator_addr != null && Object.hasOwnProperty.call(message, "validator_addr")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.validator_addr); - return writer; - }; - - /** - * Encodes the specified MsgUnjail message, length delimited. Does not implicitly {@link cosmos.slashing.v1beta1.MsgUnjail.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.slashing.v1beta1.MsgUnjail - * @static - * @param {cosmos.slashing.v1beta1.IMsgUnjail} message MsgUnjail message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgUnjail.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgUnjail message from the specified reader or buffer. - * @function decode - * @memberof cosmos.slashing.v1beta1.MsgUnjail - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.slashing.v1beta1.MsgUnjail} MsgUnjail - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgUnjail.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.slashing.v1beta1.MsgUnjail(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.validator_addr = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgUnjail message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.slashing.v1beta1.MsgUnjail - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.slashing.v1beta1.MsgUnjail} MsgUnjail - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgUnjail.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgUnjail message. - * @function verify - * @memberof cosmos.slashing.v1beta1.MsgUnjail - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgUnjail.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.validator_addr != null && message.hasOwnProperty("validator_addr")) - if (!$util.isString(message.validator_addr)) - return "validator_addr: string expected"; - return null; - }; - - /** - * Creates a MsgUnjail message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.slashing.v1beta1.MsgUnjail - * @static - * @param {Object.} object Plain object - * @returns {cosmos.slashing.v1beta1.MsgUnjail} MsgUnjail - */ - MsgUnjail.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.slashing.v1beta1.MsgUnjail) - return object; - let message = new $root.cosmos.slashing.v1beta1.MsgUnjail(); - if (object.validator_addr != null) - message.validator_addr = String(object.validator_addr); - return message; - }; - - /** - * Creates a plain object from a MsgUnjail message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.slashing.v1beta1.MsgUnjail - * @static - * @param {cosmos.slashing.v1beta1.MsgUnjail} message MsgUnjail - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgUnjail.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.validator_addr = ""; - if (message.validator_addr != null && message.hasOwnProperty("validator_addr")) - object.validator_addr = message.validator_addr; - return object; - }; - - /** - * Converts this MsgUnjail to JSON. - * @function toJSON - * @memberof cosmos.slashing.v1beta1.MsgUnjail - * @instance - * @returns {Object.} JSON object - */ - MsgUnjail.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgUnjail; - })(); - - v1beta1.MsgUnjailResponse = (function() { - - /** - * Properties of a MsgUnjailResponse. - * @memberof cosmos.slashing.v1beta1 - * @interface IMsgUnjailResponse - */ - - /** - * Constructs a new MsgUnjailResponse. - * @memberof cosmos.slashing.v1beta1 - * @classdesc Represents a MsgUnjailResponse. - * @implements IMsgUnjailResponse - * @constructor - * @param {cosmos.slashing.v1beta1.IMsgUnjailResponse=} [properties] Properties to set - */ - function MsgUnjailResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgUnjailResponse message. Does not implicitly {@link cosmos.slashing.v1beta1.MsgUnjailResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.slashing.v1beta1.MsgUnjailResponse - * @static - * @param {cosmos.slashing.v1beta1.IMsgUnjailResponse} message MsgUnjailResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgUnjailResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgUnjailResponse message, length delimited. Does not implicitly {@link cosmos.slashing.v1beta1.MsgUnjailResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.slashing.v1beta1.MsgUnjailResponse - * @static - * @param {cosmos.slashing.v1beta1.IMsgUnjailResponse} message MsgUnjailResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgUnjailResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgUnjailResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.slashing.v1beta1.MsgUnjailResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.slashing.v1beta1.MsgUnjailResponse} MsgUnjailResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgUnjailResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.slashing.v1beta1.MsgUnjailResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgUnjailResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.slashing.v1beta1.MsgUnjailResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.slashing.v1beta1.MsgUnjailResponse} MsgUnjailResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgUnjailResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgUnjailResponse message. - * @function verify - * @memberof cosmos.slashing.v1beta1.MsgUnjailResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgUnjailResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgUnjailResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.slashing.v1beta1.MsgUnjailResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.slashing.v1beta1.MsgUnjailResponse} MsgUnjailResponse - */ - MsgUnjailResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.slashing.v1beta1.MsgUnjailResponse) - return object; - return new $root.cosmos.slashing.v1beta1.MsgUnjailResponse(); - }; - - /** - * Creates a plain object from a MsgUnjailResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.slashing.v1beta1.MsgUnjailResponse - * @static - * @param {cosmos.slashing.v1beta1.MsgUnjailResponse} message MsgUnjailResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgUnjailResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgUnjailResponse to JSON. - * @function toJSON - * @memberof cosmos.slashing.v1beta1.MsgUnjailResponse - * @instance - * @returns {Object.} JSON object - */ - MsgUnjailResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgUnjailResponse; - })(); - - v1beta1.ValidatorSigningInfo = (function() { - - /** - * Properties of a ValidatorSigningInfo. - * @memberof cosmos.slashing.v1beta1 - * @interface IValidatorSigningInfo - * @property {string|null} [address] ValidatorSigningInfo address - * @property {Long|null} [start_height] ValidatorSigningInfo start_height - * @property {Long|null} [index_offset] ValidatorSigningInfo index_offset - * @property {google.protobuf.ITimestamp|null} [jailed_until] ValidatorSigningInfo jailed_until - * @property {boolean|null} [tombstoned] ValidatorSigningInfo tombstoned - * @property {Long|null} [missed_blocks_counter] ValidatorSigningInfo missed_blocks_counter - */ - - /** - * Constructs a new ValidatorSigningInfo. - * @memberof cosmos.slashing.v1beta1 - * @classdesc Represents a ValidatorSigningInfo. - * @implements IValidatorSigningInfo - * @constructor - * @param {cosmos.slashing.v1beta1.IValidatorSigningInfo=} [properties] Properties to set - */ - function ValidatorSigningInfo(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ValidatorSigningInfo address. - * @member {string} address - * @memberof cosmos.slashing.v1beta1.ValidatorSigningInfo - * @instance - */ - ValidatorSigningInfo.prototype.address = ""; - - /** - * ValidatorSigningInfo start_height. - * @member {Long} start_height - * @memberof cosmos.slashing.v1beta1.ValidatorSigningInfo - * @instance - */ - ValidatorSigningInfo.prototype.start_height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * ValidatorSigningInfo index_offset. - * @member {Long} index_offset - * @memberof cosmos.slashing.v1beta1.ValidatorSigningInfo - * @instance - */ - ValidatorSigningInfo.prototype.index_offset = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * ValidatorSigningInfo jailed_until. - * @member {google.protobuf.ITimestamp|null|undefined} jailed_until - * @memberof cosmos.slashing.v1beta1.ValidatorSigningInfo - * @instance - */ - ValidatorSigningInfo.prototype.jailed_until = null; - - /** - * ValidatorSigningInfo tombstoned. - * @member {boolean} tombstoned - * @memberof cosmos.slashing.v1beta1.ValidatorSigningInfo - * @instance - */ - ValidatorSigningInfo.prototype.tombstoned = false; - - /** - * ValidatorSigningInfo missed_blocks_counter. - * @member {Long} missed_blocks_counter - * @memberof cosmos.slashing.v1beta1.ValidatorSigningInfo - * @instance - */ - ValidatorSigningInfo.prototype.missed_blocks_counter = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Encodes the specified ValidatorSigningInfo message. Does not implicitly {@link cosmos.slashing.v1beta1.ValidatorSigningInfo.verify|verify} messages. - * @function encode - * @memberof cosmos.slashing.v1beta1.ValidatorSigningInfo - * @static - * @param {cosmos.slashing.v1beta1.IValidatorSigningInfo} message ValidatorSigningInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorSigningInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.address != null && Object.hasOwnProperty.call(message, "address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.address); - if (message.start_height != null && Object.hasOwnProperty.call(message, "start_height")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.start_height); - if (message.index_offset != null && Object.hasOwnProperty.call(message, "index_offset")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.index_offset); - if (message.jailed_until != null && Object.hasOwnProperty.call(message, "jailed_until")) - $root.google.protobuf.Timestamp.encode(message.jailed_until, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.tombstoned != null && Object.hasOwnProperty.call(message, "tombstoned")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.tombstoned); - if (message.missed_blocks_counter != null && Object.hasOwnProperty.call(message, "missed_blocks_counter")) - writer.uint32(/* id 6, wireType 0 =*/48).int64(message.missed_blocks_counter); - return writer; - }; - - /** - * Encodes the specified ValidatorSigningInfo message, length delimited. Does not implicitly {@link cosmos.slashing.v1beta1.ValidatorSigningInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.slashing.v1beta1.ValidatorSigningInfo - * @static - * @param {cosmos.slashing.v1beta1.IValidatorSigningInfo} message ValidatorSigningInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorSigningInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ValidatorSigningInfo message from the specified reader or buffer. - * @function decode - * @memberof cosmos.slashing.v1beta1.ValidatorSigningInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.slashing.v1beta1.ValidatorSigningInfo} ValidatorSigningInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorSigningInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.slashing.v1beta1.ValidatorSigningInfo(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.address = reader.string(); - break; - case 2: - message.start_height = reader.int64(); - break; - case 3: - message.index_offset = reader.int64(); - break; - case 4: - message.jailed_until = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 5: - message.tombstoned = reader.bool(); - break; - case 6: - message.missed_blocks_counter = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ValidatorSigningInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.slashing.v1beta1.ValidatorSigningInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.slashing.v1beta1.ValidatorSigningInfo} ValidatorSigningInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorSigningInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ValidatorSigningInfo message. - * @function verify - * @memberof cosmos.slashing.v1beta1.ValidatorSigningInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ValidatorSigningInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.address != null && message.hasOwnProperty("address")) - if (!$util.isString(message.address)) - return "address: string expected"; - if (message.start_height != null && message.hasOwnProperty("start_height")) - if (!$util.isInteger(message.start_height) && !(message.start_height && $util.isInteger(message.start_height.low) && $util.isInteger(message.start_height.high))) - return "start_height: integer|Long expected"; - if (message.index_offset != null && message.hasOwnProperty("index_offset")) - if (!$util.isInteger(message.index_offset) && !(message.index_offset && $util.isInteger(message.index_offset.low) && $util.isInteger(message.index_offset.high))) - return "index_offset: integer|Long expected"; - if (message.jailed_until != null && message.hasOwnProperty("jailed_until")) { - let error = $root.google.protobuf.Timestamp.verify(message.jailed_until); - if (error) - return "jailed_until." + error; - } - if (message.tombstoned != null && message.hasOwnProperty("tombstoned")) - if (typeof message.tombstoned !== "boolean") - return "tombstoned: boolean expected"; - if (message.missed_blocks_counter != null && message.hasOwnProperty("missed_blocks_counter")) - if (!$util.isInteger(message.missed_blocks_counter) && !(message.missed_blocks_counter && $util.isInteger(message.missed_blocks_counter.low) && $util.isInteger(message.missed_blocks_counter.high))) - return "missed_blocks_counter: integer|Long expected"; - return null; - }; - - /** - * Creates a ValidatorSigningInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.slashing.v1beta1.ValidatorSigningInfo - * @static - * @param {Object.} object Plain object - * @returns {cosmos.slashing.v1beta1.ValidatorSigningInfo} ValidatorSigningInfo - */ - ValidatorSigningInfo.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.slashing.v1beta1.ValidatorSigningInfo) - return object; - let message = new $root.cosmos.slashing.v1beta1.ValidatorSigningInfo(); - if (object.address != null) - message.address = String(object.address); - if (object.start_height != null) - if ($util.Long) - (message.start_height = $util.Long.fromValue(object.start_height)).unsigned = false; - else if (typeof object.start_height === "string") - message.start_height = parseInt(object.start_height, 10); - else if (typeof object.start_height === "number") - message.start_height = object.start_height; - else if (typeof object.start_height === "object") - message.start_height = new $util.LongBits(object.start_height.low >>> 0, object.start_height.high >>> 0).toNumber(); - if (object.index_offset != null) - if ($util.Long) - (message.index_offset = $util.Long.fromValue(object.index_offset)).unsigned = false; - else if (typeof object.index_offset === "string") - message.index_offset = parseInt(object.index_offset, 10); - else if (typeof object.index_offset === "number") - message.index_offset = object.index_offset; - else if (typeof object.index_offset === "object") - message.index_offset = new $util.LongBits(object.index_offset.low >>> 0, object.index_offset.high >>> 0).toNumber(); - if (object.jailed_until != null) { - if (typeof object.jailed_until !== "object") - throw TypeError(".cosmos.slashing.v1beta1.ValidatorSigningInfo.jailed_until: object expected"); - message.jailed_until = $root.google.protobuf.Timestamp.fromObject(object.jailed_until); - } - if (object.tombstoned != null) - message.tombstoned = Boolean(object.tombstoned); - if (object.missed_blocks_counter != null) - if ($util.Long) - (message.missed_blocks_counter = $util.Long.fromValue(object.missed_blocks_counter)).unsigned = false; - else if (typeof object.missed_blocks_counter === "string") - message.missed_blocks_counter = parseInt(object.missed_blocks_counter, 10); - else if (typeof object.missed_blocks_counter === "number") - message.missed_blocks_counter = object.missed_blocks_counter; - else if (typeof object.missed_blocks_counter === "object") - message.missed_blocks_counter = new $util.LongBits(object.missed_blocks_counter.low >>> 0, object.missed_blocks_counter.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a ValidatorSigningInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.slashing.v1beta1.ValidatorSigningInfo - * @static - * @param {cosmos.slashing.v1beta1.ValidatorSigningInfo} message ValidatorSigningInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ValidatorSigningInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.address = ""; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.start_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.start_height = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.index_offset = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.index_offset = options.longs === String ? "0" : 0; - object.jailed_until = null; - object.tombstoned = false; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.missed_blocks_counter = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.missed_blocks_counter = options.longs === String ? "0" : 0; - } - if (message.address != null && message.hasOwnProperty("address")) - object.address = message.address; - if (message.start_height != null && message.hasOwnProperty("start_height")) - if (typeof message.start_height === "number") - object.start_height = options.longs === String ? String(message.start_height) : message.start_height; - else - object.start_height = options.longs === String ? $util.Long.prototype.toString.call(message.start_height) : options.longs === Number ? new $util.LongBits(message.start_height.low >>> 0, message.start_height.high >>> 0).toNumber() : message.start_height; - if (message.index_offset != null && message.hasOwnProperty("index_offset")) - if (typeof message.index_offset === "number") - object.index_offset = options.longs === String ? String(message.index_offset) : message.index_offset; - else - object.index_offset = options.longs === String ? $util.Long.prototype.toString.call(message.index_offset) : options.longs === Number ? new $util.LongBits(message.index_offset.low >>> 0, message.index_offset.high >>> 0).toNumber() : message.index_offset; - if (message.jailed_until != null && message.hasOwnProperty("jailed_until")) - object.jailed_until = $root.google.protobuf.Timestamp.toObject(message.jailed_until, options); - if (message.tombstoned != null && message.hasOwnProperty("tombstoned")) - object.tombstoned = message.tombstoned; - if (message.missed_blocks_counter != null && message.hasOwnProperty("missed_blocks_counter")) - if (typeof message.missed_blocks_counter === "number") - object.missed_blocks_counter = options.longs === String ? String(message.missed_blocks_counter) : message.missed_blocks_counter; - else - object.missed_blocks_counter = options.longs === String ? $util.Long.prototype.toString.call(message.missed_blocks_counter) : options.longs === Number ? new $util.LongBits(message.missed_blocks_counter.low >>> 0, message.missed_blocks_counter.high >>> 0).toNumber() : message.missed_blocks_counter; - return object; - }; - - /** - * Converts this ValidatorSigningInfo to JSON. - * @function toJSON - * @memberof cosmos.slashing.v1beta1.ValidatorSigningInfo - * @instance - * @returns {Object.} JSON object - */ - ValidatorSigningInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ValidatorSigningInfo; - })(); - - v1beta1.Params = (function() { - - /** - * Properties of a Params. - * @memberof cosmos.slashing.v1beta1 - * @interface IParams - * @property {Long|null} [signed_blocks_window] Params signed_blocks_window - * @property {Uint8Array|null} [min_signed_per_window] Params min_signed_per_window - * @property {google.protobuf.IDuration|null} [downtime_jail_duration] Params downtime_jail_duration - * @property {Uint8Array|null} [slash_fraction_double_sign] Params slash_fraction_double_sign - * @property {Uint8Array|null} [slash_fraction_downtime] Params slash_fraction_downtime - */ - - /** - * Constructs a new Params. - * @memberof cosmos.slashing.v1beta1 - * @classdesc Represents a Params. - * @implements IParams - * @constructor - * @param {cosmos.slashing.v1beta1.IParams=} [properties] Properties to set - */ - function Params(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Params signed_blocks_window. - * @member {Long} signed_blocks_window - * @memberof cosmos.slashing.v1beta1.Params - * @instance - */ - Params.prototype.signed_blocks_window = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Params min_signed_per_window. - * @member {Uint8Array} min_signed_per_window - * @memberof cosmos.slashing.v1beta1.Params - * @instance - */ - Params.prototype.min_signed_per_window = $util.newBuffer([]); - - /** - * Params downtime_jail_duration. - * @member {google.protobuf.IDuration|null|undefined} downtime_jail_duration - * @memberof cosmos.slashing.v1beta1.Params - * @instance - */ - Params.prototype.downtime_jail_duration = null; - - /** - * Params slash_fraction_double_sign. - * @member {Uint8Array} slash_fraction_double_sign - * @memberof cosmos.slashing.v1beta1.Params - * @instance - */ - Params.prototype.slash_fraction_double_sign = $util.newBuffer([]); - - /** - * Params slash_fraction_downtime. - * @member {Uint8Array} slash_fraction_downtime - * @memberof cosmos.slashing.v1beta1.Params - * @instance - */ - Params.prototype.slash_fraction_downtime = $util.newBuffer([]); - - /** - * Encodes the specified Params message. Does not implicitly {@link cosmos.slashing.v1beta1.Params.verify|verify} messages. - * @function encode - * @memberof cosmos.slashing.v1beta1.Params - * @static - * @param {cosmos.slashing.v1beta1.IParams} message Params message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Params.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.signed_blocks_window != null && Object.hasOwnProperty.call(message, "signed_blocks_window")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.signed_blocks_window); - if (message.min_signed_per_window != null && Object.hasOwnProperty.call(message, "min_signed_per_window")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.min_signed_per_window); - if (message.downtime_jail_duration != null && Object.hasOwnProperty.call(message, "downtime_jail_duration")) - $root.google.protobuf.Duration.encode(message.downtime_jail_duration, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.slash_fraction_double_sign != null && Object.hasOwnProperty.call(message, "slash_fraction_double_sign")) - writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.slash_fraction_double_sign); - if (message.slash_fraction_downtime != null && Object.hasOwnProperty.call(message, "slash_fraction_downtime")) - writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.slash_fraction_downtime); - return writer; - }; - - /** - * Encodes the specified Params message, length delimited. Does not implicitly {@link cosmos.slashing.v1beta1.Params.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.slashing.v1beta1.Params - * @static - * @param {cosmos.slashing.v1beta1.IParams} message Params message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Params.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Params message from the specified reader or buffer. - * @function decode - * @memberof cosmos.slashing.v1beta1.Params - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.slashing.v1beta1.Params} Params - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Params.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.slashing.v1beta1.Params(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.signed_blocks_window = reader.int64(); - break; - case 2: - message.min_signed_per_window = reader.bytes(); - break; - case 3: - message.downtime_jail_duration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - case 4: - message.slash_fraction_double_sign = reader.bytes(); - break; - case 5: - message.slash_fraction_downtime = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Params message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.slashing.v1beta1.Params - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.slashing.v1beta1.Params} Params - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Params.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Params message. - * @function verify - * @memberof cosmos.slashing.v1beta1.Params - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Params.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.signed_blocks_window != null && message.hasOwnProperty("signed_blocks_window")) - if (!$util.isInteger(message.signed_blocks_window) && !(message.signed_blocks_window && $util.isInteger(message.signed_blocks_window.low) && $util.isInteger(message.signed_blocks_window.high))) - return "signed_blocks_window: integer|Long expected"; - if (message.min_signed_per_window != null && message.hasOwnProperty("min_signed_per_window")) - if (!(message.min_signed_per_window && typeof message.min_signed_per_window.length === "number" || $util.isString(message.min_signed_per_window))) - return "min_signed_per_window: buffer expected"; - if (message.downtime_jail_duration != null && message.hasOwnProperty("downtime_jail_duration")) { - let error = $root.google.protobuf.Duration.verify(message.downtime_jail_duration); - if (error) - return "downtime_jail_duration." + error; - } - if (message.slash_fraction_double_sign != null && message.hasOwnProperty("slash_fraction_double_sign")) - if (!(message.slash_fraction_double_sign && typeof message.slash_fraction_double_sign.length === "number" || $util.isString(message.slash_fraction_double_sign))) - return "slash_fraction_double_sign: buffer expected"; - if (message.slash_fraction_downtime != null && message.hasOwnProperty("slash_fraction_downtime")) - if (!(message.slash_fraction_downtime && typeof message.slash_fraction_downtime.length === "number" || $util.isString(message.slash_fraction_downtime))) - return "slash_fraction_downtime: buffer expected"; - return null; - }; - - /** - * Creates a Params message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.slashing.v1beta1.Params - * @static - * @param {Object.} object Plain object - * @returns {cosmos.slashing.v1beta1.Params} Params - */ - Params.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.slashing.v1beta1.Params) - return object; - let message = new $root.cosmos.slashing.v1beta1.Params(); - if (object.signed_blocks_window != null) - if ($util.Long) - (message.signed_blocks_window = $util.Long.fromValue(object.signed_blocks_window)).unsigned = false; - else if (typeof object.signed_blocks_window === "string") - message.signed_blocks_window = parseInt(object.signed_blocks_window, 10); - else if (typeof object.signed_blocks_window === "number") - message.signed_blocks_window = object.signed_blocks_window; - else if (typeof object.signed_blocks_window === "object") - message.signed_blocks_window = new $util.LongBits(object.signed_blocks_window.low >>> 0, object.signed_blocks_window.high >>> 0).toNumber(); - if (object.min_signed_per_window != null) - if (typeof object.min_signed_per_window === "string") - $util.base64.decode(object.min_signed_per_window, message.min_signed_per_window = $util.newBuffer($util.base64.length(object.min_signed_per_window)), 0); - else if (object.min_signed_per_window.length) - message.min_signed_per_window = object.min_signed_per_window; - if (object.downtime_jail_duration != null) { - if (typeof object.downtime_jail_duration !== "object") - throw TypeError(".cosmos.slashing.v1beta1.Params.downtime_jail_duration: object expected"); - message.downtime_jail_duration = $root.google.protobuf.Duration.fromObject(object.downtime_jail_duration); - } - if (object.slash_fraction_double_sign != null) - if (typeof object.slash_fraction_double_sign === "string") - $util.base64.decode(object.slash_fraction_double_sign, message.slash_fraction_double_sign = $util.newBuffer($util.base64.length(object.slash_fraction_double_sign)), 0); - else if (object.slash_fraction_double_sign.length) - message.slash_fraction_double_sign = object.slash_fraction_double_sign; - if (object.slash_fraction_downtime != null) - if (typeof object.slash_fraction_downtime === "string") - $util.base64.decode(object.slash_fraction_downtime, message.slash_fraction_downtime = $util.newBuffer($util.base64.length(object.slash_fraction_downtime)), 0); - else if (object.slash_fraction_downtime.length) - message.slash_fraction_downtime = object.slash_fraction_downtime; - return message; - }; - - /** - * Creates a plain object from a Params message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.slashing.v1beta1.Params - * @static - * @param {cosmos.slashing.v1beta1.Params} message Params - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Params.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.signed_blocks_window = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.signed_blocks_window = options.longs === String ? "0" : 0; - if (options.bytes === String) - object.min_signed_per_window = ""; - else { - object.min_signed_per_window = []; - if (options.bytes !== Array) - object.min_signed_per_window = $util.newBuffer(object.min_signed_per_window); - } - object.downtime_jail_duration = null; - if (options.bytes === String) - object.slash_fraction_double_sign = ""; - else { - object.slash_fraction_double_sign = []; - if (options.bytes !== Array) - object.slash_fraction_double_sign = $util.newBuffer(object.slash_fraction_double_sign); - } - if (options.bytes === String) - object.slash_fraction_downtime = ""; - else { - object.slash_fraction_downtime = []; - if (options.bytes !== Array) - object.slash_fraction_downtime = $util.newBuffer(object.slash_fraction_downtime); - } - } - if (message.signed_blocks_window != null && message.hasOwnProperty("signed_blocks_window")) - if (typeof message.signed_blocks_window === "number") - object.signed_blocks_window = options.longs === String ? String(message.signed_blocks_window) : message.signed_blocks_window; - else - object.signed_blocks_window = options.longs === String ? $util.Long.prototype.toString.call(message.signed_blocks_window) : options.longs === Number ? new $util.LongBits(message.signed_blocks_window.low >>> 0, message.signed_blocks_window.high >>> 0).toNumber() : message.signed_blocks_window; - if (message.min_signed_per_window != null && message.hasOwnProperty("min_signed_per_window")) - object.min_signed_per_window = options.bytes === String ? $util.base64.encode(message.min_signed_per_window, 0, message.min_signed_per_window.length) : options.bytes === Array ? Array.prototype.slice.call(message.min_signed_per_window) : message.min_signed_per_window; - if (message.downtime_jail_duration != null && message.hasOwnProperty("downtime_jail_duration")) - object.downtime_jail_duration = $root.google.protobuf.Duration.toObject(message.downtime_jail_duration, options); - if (message.slash_fraction_double_sign != null && message.hasOwnProperty("slash_fraction_double_sign")) - object.slash_fraction_double_sign = options.bytes === String ? $util.base64.encode(message.slash_fraction_double_sign, 0, message.slash_fraction_double_sign.length) : options.bytes === Array ? Array.prototype.slice.call(message.slash_fraction_double_sign) : message.slash_fraction_double_sign; - if (message.slash_fraction_downtime != null && message.hasOwnProperty("slash_fraction_downtime")) - object.slash_fraction_downtime = options.bytes === String ? $util.base64.encode(message.slash_fraction_downtime, 0, message.slash_fraction_downtime.length) : options.bytes === Array ? Array.prototype.slice.call(message.slash_fraction_downtime) : message.slash_fraction_downtime; - return object; - }; - - /** - * Converts this Params to JSON. - * @function toJSON - * @memberof cosmos.slashing.v1beta1.Params - * @instance - * @returns {Object.} JSON object - */ - Params.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Params; - })(); - - v1beta1.Query = (function() { - - /** - * Constructs a new Query service. - * @memberof cosmos.slashing.v1beta1 - * @classdesc Represents a Query - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function Query(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Query.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Query; - - /** - * Callback as used by {@link cosmos.slashing.v1beta1.Query#params}. - * @memberof cosmos.slashing.v1beta1.Query - * @typedef ParamsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.slashing.v1beta1.QueryParamsResponse} [response] QueryParamsResponse - */ - - /** - * Calls Params. - * @function params - * @memberof cosmos.slashing.v1beta1.Query - * @instance - * @param {cosmos.slashing.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object - * @param {cosmos.slashing.v1beta1.Query.ParamsCallback} callback Node-style callback called with the error, if any, and QueryParamsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.params = function params(request, callback) { - return this.rpcCall(params, $root.cosmos.slashing.v1beta1.QueryParamsRequest, $root.cosmos.slashing.v1beta1.QueryParamsResponse, request, callback); - }, "name", { value: "Params" }); - - /** - * Calls Params. - * @function params - * @memberof cosmos.slashing.v1beta1.Query - * @instance - * @param {cosmos.slashing.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.slashing.v1beta1.Query#signingInfo}. - * @memberof cosmos.slashing.v1beta1.Query - * @typedef SigningInfoCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.slashing.v1beta1.QuerySigningInfoResponse} [response] QuerySigningInfoResponse - */ - - /** - * Calls SigningInfo. - * @function signingInfo - * @memberof cosmos.slashing.v1beta1.Query - * @instance - * @param {cosmos.slashing.v1beta1.IQuerySigningInfoRequest} request QuerySigningInfoRequest message or plain object - * @param {cosmos.slashing.v1beta1.Query.SigningInfoCallback} callback Node-style callback called with the error, if any, and QuerySigningInfoResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.signingInfo = function signingInfo(request, callback) { - return this.rpcCall(signingInfo, $root.cosmos.slashing.v1beta1.QuerySigningInfoRequest, $root.cosmos.slashing.v1beta1.QuerySigningInfoResponse, request, callback); - }, "name", { value: "SigningInfo" }); - - /** - * Calls SigningInfo. - * @function signingInfo - * @memberof cosmos.slashing.v1beta1.Query - * @instance - * @param {cosmos.slashing.v1beta1.IQuerySigningInfoRequest} request QuerySigningInfoRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.slashing.v1beta1.Query#signingInfos}. - * @memberof cosmos.slashing.v1beta1.Query - * @typedef SigningInfosCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.slashing.v1beta1.QuerySigningInfosResponse} [response] QuerySigningInfosResponse - */ - - /** - * Calls SigningInfos. - * @function signingInfos - * @memberof cosmos.slashing.v1beta1.Query - * @instance - * @param {cosmos.slashing.v1beta1.IQuerySigningInfosRequest} request QuerySigningInfosRequest message or plain object - * @param {cosmos.slashing.v1beta1.Query.SigningInfosCallback} callback Node-style callback called with the error, if any, and QuerySigningInfosResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.signingInfos = function signingInfos(request, callback) { - return this.rpcCall(signingInfos, $root.cosmos.slashing.v1beta1.QuerySigningInfosRequest, $root.cosmos.slashing.v1beta1.QuerySigningInfosResponse, request, callback); - }, "name", { value: "SigningInfos" }); - - /** - * Calls SigningInfos. - * @function signingInfos - * @memberof cosmos.slashing.v1beta1.Query - * @instance - * @param {cosmos.slashing.v1beta1.IQuerySigningInfosRequest} request QuerySigningInfosRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return Query; - })(); - - v1beta1.QueryParamsRequest = (function() { - - /** - * Properties of a QueryParamsRequest. - * @memberof cosmos.slashing.v1beta1 - * @interface IQueryParamsRequest - */ - - /** - * Constructs a new QueryParamsRequest. - * @memberof cosmos.slashing.v1beta1 - * @classdesc Represents a QueryParamsRequest. - * @implements IQueryParamsRequest - * @constructor - * @param {cosmos.slashing.v1beta1.IQueryParamsRequest=} [properties] Properties to set - */ - function QueryParamsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified QueryParamsRequest message. Does not implicitly {@link cosmos.slashing.v1beta1.QueryParamsRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.slashing.v1beta1.QueryParamsRequest - * @static - * @param {cosmos.slashing.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified QueryParamsRequest message, length delimited. Does not implicitly {@link cosmos.slashing.v1beta1.QueryParamsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.slashing.v1beta1.QueryParamsRequest - * @static - * @param {cosmos.slashing.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryParamsRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.slashing.v1beta1.QueryParamsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.slashing.v1beta1.QueryParamsRequest} QueryParamsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.slashing.v1beta1.QueryParamsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryParamsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.slashing.v1beta1.QueryParamsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.slashing.v1beta1.QueryParamsRequest} QueryParamsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryParamsRequest message. - * @function verify - * @memberof cosmos.slashing.v1beta1.QueryParamsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryParamsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a QueryParamsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.slashing.v1beta1.QueryParamsRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.slashing.v1beta1.QueryParamsRequest} QueryParamsRequest - */ - QueryParamsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.slashing.v1beta1.QueryParamsRequest) - return object; - return new $root.cosmos.slashing.v1beta1.QueryParamsRequest(); - }; - - /** - * Creates a plain object from a QueryParamsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.slashing.v1beta1.QueryParamsRequest - * @static - * @param {cosmos.slashing.v1beta1.QueryParamsRequest} message QueryParamsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryParamsRequest.toObject = function toObject() { - return {}; - }; - - /** - * Converts this QueryParamsRequest to JSON. - * @function toJSON - * @memberof cosmos.slashing.v1beta1.QueryParamsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryParamsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryParamsRequest; - })(); - - v1beta1.QueryParamsResponse = (function() { - - /** - * Properties of a QueryParamsResponse. - * @memberof cosmos.slashing.v1beta1 - * @interface IQueryParamsResponse - * @property {cosmos.slashing.v1beta1.IParams|null} [params] QueryParamsResponse params - */ - - /** - * Constructs a new QueryParamsResponse. - * @memberof cosmos.slashing.v1beta1 - * @classdesc Represents a QueryParamsResponse. - * @implements IQueryParamsResponse - * @constructor - * @param {cosmos.slashing.v1beta1.IQueryParamsResponse=} [properties] Properties to set - */ - function QueryParamsResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryParamsResponse params. - * @member {cosmos.slashing.v1beta1.IParams|null|undefined} params - * @memberof cosmos.slashing.v1beta1.QueryParamsResponse - * @instance - */ - QueryParamsResponse.prototype.params = null; - - /** - * Encodes the specified QueryParamsResponse message. Does not implicitly {@link cosmos.slashing.v1beta1.QueryParamsResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.slashing.v1beta1.QueryParamsResponse - * @static - * @param {cosmos.slashing.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.params != null && Object.hasOwnProperty.call(message, "params")) - $root.cosmos.slashing.v1beta1.Params.encode(message.params, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryParamsResponse message, length delimited. Does not implicitly {@link cosmos.slashing.v1beta1.QueryParamsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.slashing.v1beta1.QueryParamsResponse - * @static - * @param {cosmos.slashing.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryParamsResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.slashing.v1beta1.QueryParamsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.slashing.v1beta1.QueryParamsResponse} QueryParamsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.slashing.v1beta1.QueryParamsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.params = $root.cosmos.slashing.v1beta1.Params.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryParamsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.slashing.v1beta1.QueryParamsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.slashing.v1beta1.QueryParamsResponse} QueryParamsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryParamsResponse message. - * @function verify - * @memberof cosmos.slashing.v1beta1.QueryParamsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryParamsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.params != null && message.hasOwnProperty("params")) { - let error = $root.cosmos.slashing.v1beta1.Params.verify(message.params); - if (error) - return "params." + error; - } - return null; - }; - - /** - * Creates a QueryParamsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.slashing.v1beta1.QueryParamsResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.slashing.v1beta1.QueryParamsResponse} QueryParamsResponse - */ - QueryParamsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.slashing.v1beta1.QueryParamsResponse) - return object; - let message = new $root.cosmos.slashing.v1beta1.QueryParamsResponse(); - if (object.params != null) { - if (typeof object.params !== "object") - throw TypeError(".cosmos.slashing.v1beta1.QueryParamsResponse.params: object expected"); - message.params = $root.cosmos.slashing.v1beta1.Params.fromObject(object.params); - } - return message; - }; - - /** - * Creates a plain object from a QueryParamsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.slashing.v1beta1.QueryParamsResponse - * @static - * @param {cosmos.slashing.v1beta1.QueryParamsResponse} message QueryParamsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryParamsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.params = null; - if (message.params != null && message.hasOwnProperty("params")) - object.params = $root.cosmos.slashing.v1beta1.Params.toObject(message.params, options); - return object; - }; - - /** - * Converts this QueryParamsResponse to JSON. - * @function toJSON - * @memberof cosmos.slashing.v1beta1.QueryParamsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryParamsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryParamsResponse; - })(); - - v1beta1.QuerySigningInfoRequest = (function() { - - /** - * Properties of a QuerySigningInfoRequest. - * @memberof cosmos.slashing.v1beta1 - * @interface IQuerySigningInfoRequest - * @property {string|null} [cons_address] QuerySigningInfoRequest cons_address - */ - - /** - * Constructs a new QuerySigningInfoRequest. - * @memberof cosmos.slashing.v1beta1 - * @classdesc Represents a QuerySigningInfoRequest. - * @implements IQuerySigningInfoRequest - * @constructor - * @param {cosmos.slashing.v1beta1.IQuerySigningInfoRequest=} [properties] Properties to set - */ - function QuerySigningInfoRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QuerySigningInfoRequest cons_address. - * @member {string} cons_address - * @memberof cosmos.slashing.v1beta1.QuerySigningInfoRequest - * @instance - */ - QuerySigningInfoRequest.prototype.cons_address = ""; - - /** - * Encodes the specified QuerySigningInfoRequest message. Does not implicitly {@link cosmos.slashing.v1beta1.QuerySigningInfoRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.slashing.v1beta1.QuerySigningInfoRequest - * @static - * @param {cosmos.slashing.v1beta1.IQuerySigningInfoRequest} message QuerySigningInfoRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QuerySigningInfoRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.cons_address != null && Object.hasOwnProperty.call(message, "cons_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.cons_address); - return writer; - }; - - /** - * Encodes the specified QuerySigningInfoRequest message, length delimited. Does not implicitly {@link cosmos.slashing.v1beta1.QuerySigningInfoRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.slashing.v1beta1.QuerySigningInfoRequest - * @static - * @param {cosmos.slashing.v1beta1.IQuerySigningInfoRequest} message QuerySigningInfoRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QuerySigningInfoRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QuerySigningInfoRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.slashing.v1beta1.QuerySigningInfoRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.slashing.v1beta1.QuerySigningInfoRequest} QuerySigningInfoRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QuerySigningInfoRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.slashing.v1beta1.QuerySigningInfoRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.cons_address = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QuerySigningInfoRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.slashing.v1beta1.QuerySigningInfoRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.slashing.v1beta1.QuerySigningInfoRequest} QuerySigningInfoRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QuerySigningInfoRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QuerySigningInfoRequest message. - * @function verify - * @memberof cosmos.slashing.v1beta1.QuerySigningInfoRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QuerySigningInfoRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.cons_address != null && message.hasOwnProperty("cons_address")) - if (!$util.isString(message.cons_address)) - return "cons_address: string expected"; - return null; - }; - - /** - * Creates a QuerySigningInfoRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.slashing.v1beta1.QuerySigningInfoRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.slashing.v1beta1.QuerySigningInfoRequest} QuerySigningInfoRequest - */ - QuerySigningInfoRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.slashing.v1beta1.QuerySigningInfoRequest) - return object; - let message = new $root.cosmos.slashing.v1beta1.QuerySigningInfoRequest(); - if (object.cons_address != null) - message.cons_address = String(object.cons_address); - return message; - }; - - /** - * Creates a plain object from a QuerySigningInfoRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.slashing.v1beta1.QuerySigningInfoRequest - * @static - * @param {cosmos.slashing.v1beta1.QuerySigningInfoRequest} message QuerySigningInfoRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QuerySigningInfoRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.cons_address = ""; - if (message.cons_address != null && message.hasOwnProperty("cons_address")) - object.cons_address = message.cons_address; - return object; - }; - - /** - * Converts this QuerySigningInfoRequest to JSON. - * @function toJSON - * @memberof cosmos.slashing.v1beta1.QuerySigningInfoRequest - * @instance - * @returns {Object.} JSON object - */ - QuerySigningInfoRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QuerySigningInfoRequest; - })(); - - v1beta1.QuerySigningInfoResponse = (function() { - - /** - * Properties of a QuerySigningInfoResponse. - * @memberof cosmos.slashing.v1beta1 - * @interface IQuerySigningInfoResponse - * @property {cosmos.slashing.v1beta1.IValidatorSigningInfo|null} [val_signing_info] QuerySigningInfoResponse val_signing_info - */ - - /** - * Constructs a new QuerySigningInfoResponse. - * @memberof cosmos.slashing.v1beta1 - * @classdesc Represents a QuerySigningInfoResponse. - * @implements IQuerySigningInfoResponse - * @constructor - * @param {cosmos.slashing.v1beta1.IQuerySigningInfoResponse=} [properties] Properties to set - */ - function QuerySigningInfoResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QuerySigningInfoResponse val_signing_info. - * @member {cosmos.slashing.v1beta1.IValidatorSigningInfo|null|undefined} val_signing_info - * @memberof cosmos.slashing.v1beta1.QuerySigningInfoResponse - * @instance - */ - QuerySigningInfoResponse.prototype.val_signing_info = null; - - /** - * Encodes the specified QuerySigningInfoResponse message. Does not implicitly {@link cosmos.slashing.v1beta1.QuerySigningInfoResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.slashing.v1beta1.QuerySigningInfoResponse - * @static - * @param {cosmos.slashing.v1beta1.IQuerySigningInfoResponse} message QuerySigningInfoResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QuerySigningInfoResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.val_signing_info != null && Object.hasOwnProperty.call(message, "val_signing_info")) - $root.cosmos.slashing.v1beta1.ValidatorSigningInfo.encode(message.val_signing_info, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QuerySigningInfoResponse message, length delimited. Does not implicitly {@link cosmos.slashing.v1beta1.QuerySigningInfoResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.slashing.v1beta1.QuerySigningInfoResponse - * @static - * @param {cosmos.slashing.v1beta1.IQuerySigningInfoResponse} message QuerySigningInfoResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QuerySigningInfoResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QuerySigningInfoResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.slashing.v1beta1.QuerySigningInfoResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.slashing.v1beta1.QuerySigningInfoResponse} QuerySigningInfoResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QuerySigningInfoResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.slashing.v1beta1.QuerySigningInfoResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.val_signing_info = $root.cosmos.slashing.v1beta1.ValidatorSigningInfo.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QuerySigningInfoResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.slashing.v1beta1.QuerySigningInfoResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.slashing.v1beta1.QuerySigningInfoResponse} QuerySigningInfoResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QuerySigningInfoResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QuerySigningInfoResponse message. - * @function verify - * @memberof cosmos.slashing.v1beta1.QuerySigningInfoResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QuerySigningInfoResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.val_signing_info != null && message.hasOwnProperty("val_signing_info")) { - let error = $root.cosmos.slashing.v1beta1.ValidatorSigningInfo.verify(message.val_signing_info); - if (error) - return "val_signing_info." + error; - } - return null; - }; - - /** - * Creates a QuerySigningInfoResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.slashing.v1beta1.QuerySigningInfoResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.slashing.v1beta1.QuerySigningInfoResponse} QuerySigningInfoResponse - */ - QuerySigningInfoResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.slashing.v1beta1.QuerySigningInfoResponse) - return object; - let message = new $root.cosmos.slashing.v1beta1.QuerySigningInfoResponse(); - if (object.val_signing_info != null) { - if (typeof object.val_signing_info !== "object") - throw TypeError(".cosmos.slashing.v1beta1.QuerySigningInfoResponse.val_signing_info: object expected"); - message.val_signing_info = $root.cosmos.slashing.v1beta1.ValidatorSigningInfo.fromObject(object.val_signing_info); - } - return message; - }; - - /** - * Creates a plain object from a QuerySigningInfoResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.slashing.v1beta1.QuerySigningInfoResponse - * @static - * @param {cosmos.slashing.v1beta1.QuerySigningInfoResponse} message QuerySigningInfoResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QuerySigningInfoResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.val_signing_info = null; - if (message.val_signing_info != null && message.hasOwnProperty("val_signing_info")) - object.val_signing_info = $root.cosmos.slashing.v1beta1.ValidatorSigningInfo.toObject(message.val_signing_info, options); - return object; - }; - - /** - * Converts this QuerySigningInfoResponse to JSON. - * @function toJSON - * @memberof cosmos.slashing.v1beta1.QuerySigningInfoResponse - * @instance - * @returns {Object.} JSON object - */ - QuerySigningInfoResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QuerySigningInfoResponse; - })(); - - v1beta1.QuerySigningInfosRequest = (function() { - - /** - * Properties of a QuerySigningInfosRequest. - * @memberof cosmos.slashing.v1beta1 - * @interface IQuerySigningInfosRequest - * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QuerySigningInfosRequest pagination - */ - - /** - * Constructs a new QuerySigningInfosRequest. - * @memberof cosmos.slashing.v1beta1 - * @classdesc Represents a QuerySigningInfosRequest. - * @implements IQuerySigningInfosRequest - * @constructor - * @param {cosmos.slashing.v1beta1.IQuerySigningInfosRequest=} [properties] Properties to set - */ - function QuerySigningInfosRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QuerySigningInfosRequest pagination. - * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination - * @memberof cosmos.slashing.v1beta1.QuerySigningInfosRequest - * @instance - */ - QuerySigningInfosRequest.prototype.pagination = null; - - /** - * Encodes the specified QuerySigningInfosRequest message. Does not implicitly {@link cosmos.slashing.v1beta1.QuerySigningInfosRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.slashing.v1beta1.QuerySigningInfosRequest - * @static - * @param {cosmos.slashing.v1beta1.IQuerySigningInfosRequest} message QuerySigningInfosRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QuerySigningInfosRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QuerySigningInfosRequest message, length delimited. Does not implicitly {@link cosmos.slashing.v1beta1.QuerySigningInfosRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.slashing.v1beta1.QuerySigningInfosRequest - * @static - * @param {cosmos.slashing.v1beta1.IQuerySigningInfosRequest} message QuerySigningInfosRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QuerySigningInfosRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QuerySigningInfosRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.slashing.v1beta1.QuerySigningInfosRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.slashing.v1beta1.QuerySigningInfosRequest} QuerySigningInfosRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QuerySigningInfosRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.slashing.v1beta1.QuerySigningInfosRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QuerySigningInfosRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.slashing.v1beta1.QuerySigningInfosRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.slashing.v1beta1.QuerySigningInfosRequest} QuerySigningInfosRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QuerySigningInfosRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QuerySigningInfosRequest message. - * @function verify - * @memberof cosmos.slashing.v1beta1.QuerySigningInfosRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QuerySigningInfosRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QuerySigningInfosRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.slashing.v1beta1.QuerySigningInfosRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.slashing.v1beta1.QuerySigningInfosRequest} QuerySigningInfosRequest - */ - QuerySigningInfosRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.slashing.v1beta1.QuerySigningInfosRequest) - return object; - let message = new $root.cosmos.slashing.v1beta1.QuerySigningInfosRequest(); - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.slashing.v1beta1.QuerySigningInfosRequest.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QuerySigningInfosRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.slashing.v1beta1.QuerySigningInfosRequest - * @static - * @param {cosmos.slashing.v1beta1.QuerySigningInfosRequest} message QuerySigningInfosRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QuerySigningInfosRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.pagination = null; - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QuerySigningInfosRequest to JSON. - * @function toJSON - * @memberof cosmos.slashing.v1beta1.QuerySigningInfosRequest - * @instance - * @returns {Object.} JSON object - */ - QuerySigningInfosRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QuerySigningInfosRequest; - })(); - - v1beta1.QuerySigningInfosResponse = (function() { - - /** - * Properties of a QuerySigningInfosResponse. - * @memberof cosmos.slashing.v1beta1 - * @interface IQuerySigningInfosResponse - * @property {Array.|null} [info] QuerySigningInfosResponse info - * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QuerySigningInfosResponse pagination - */ - - /** - * Constructs a new QuerySigningInfosResponse. - * @memberof cosmos.slashing.v1beta1 - * @classdesc Represents a QuerySigningInfosResponse. - * @implements IQuerySigningInfosResponse - * @constructor - * @param {cosmos.slashing.v1beta1.IQuerySigningInfosResponse=} [properties] Properties to set - */ - function QuerySigningInfosResponse(properties) { - this.info = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QuerySigningInfosResponse info. - * @member {Array.} info - * @memberof cosmos.slashing.v1beta1.QuerySigningInfosResponse - * @instance - */ - QuerySigningInfosResponse.prototype.info = $util.emptyArray; - - /** - * QuerySigningInfosResponse pagination. - * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination - * @memberof cosmos.slashing.v1beta1.QuerySigningInfosResponse - * @instance - */ - QuerySigningInfosResponse.prototype.pagination = null; - - /** - * Encodes the specified QuerySigningInfosResponse message. Does not implicitly {@link cosmos.slashing.v1beta1.QuerySigningInfosResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.slashing.v1beta1.QuerySigningInfosResponse - * @static - * @param {cosmos.slashing.v1beta1.IQuerySigningInfosResponse} message QuerySigningInfosResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QuerySigningInfosResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.info != null && message.info.length) - for (let i = 0; i < message.info.length; ++i) - $root.cosmos.slashing.v1beta1.ValidatorSigningInfo.encode(message.info[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QuerySigningInfosResponse message, length delimited. Does not implicitly {@link cosmos.slashing.v1beta1.QuerySigningInfosResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.slashing.v1beta1.QuerySigningInfosResponse - * @static - * @param {cosmos.slashing.v1beta1.IQuerySigningInfosResponse} message QuerySigningInfosResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QuerySigningInfosResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QuerySigningInfosResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.slashing.v1beta1.QuerySigningInfosResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.slashing.v1beta1.QuerySigningInfosResponse} QuerySigningInfosResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QuerySigningInfosResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.slashing.v1beta1.QuerySigningInfosResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.info && message.info.length)) - message.info = []; - message.info.push($root.cosmos.slashing.v1beta1.ValidatorSigningInfo.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QuerySigningInfosResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.slashing.v1beta1.QuerySigningInfosResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.slashing.v1beta1.QuerySigningInfosResponse} QuerySigningInfosResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QuerySigningInfosResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QuerySigningInfosResponse message. - * @function verify - * @memberof cosmos.slashing.v1beta1.QuerySigningInfosResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QuerySigningInfosResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.info != null && message.hasOwnProperty("info")) { - if (!Array.isArray(message.info)) - return "info: array expected"; - for (let i = 0; i < message.info.length; ++i) { - let error = $root.cosmos.slashing.v1beta1.ValidatorSigningInfo.verify(message.info[i]); - if (error) - return "info." + error; - } - } - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QuerySigningInfosResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.slashing.v1beta1.QuerySigningInfosResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.slashing.v1beta1.QuerySigningInfosResponse} QuerySigningInfosResponse - */ - QuerySigningInfosResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.slashing.v1beta1.QuerySigningInfosResponse) - return object; - let message = new $root.cosmos.slashing.v1beta1.QuerySigningInfosResponse(); - if (object.info) { - if (!Array.isArray(object.info)) - throw TypeError(".cosmos.slashing.v1beta1.QuerySigningInfosResponse.info: array expected"); - message.info = []; - for (let i = 0; i < object.info.length; ++i) { - if (typeof object.info[i] !== "object") - throw TypeError(".cosmos.slashing.v1beta1.QuerySigningInfosResponse.info: object expected"); - message.info[i] = $root.cosmos.slashing.v1beta1.ValidatorSigningInfo.fromObject(object.info[i]); - } - } - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.slashing.v1beta1.QuerySigningInfosResponse.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QuerySigningInfosResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.slashing.v1beta1.QuerySigningInfosResponse - * @static - * @param {cosmos.slashing.v1beta1.QuerySigningInfosResponse} message QuerySigningInfosResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QuerySigningInfosResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.info = []; - if (options.defaults) - object.pagination = null; - if (message.info && message.info.length) { - object.info = []; - for (let j = 0; j < message.info.length; ++j) - object.info[j] = $root.cosmos.slashing.v1beta1.ValidatorSigningInfo.toObject(message.info[j], options); - } - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QuerySigningInfosResponse to JSON. - * @function toJSON - * @memberof cosmos.slashing.v1beta1.QuerySigningInfosResponse - * @instance - * @returns {Object.} JSON object - */ - QuerySigningInfosResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QuerySigningInfosResponse; - })(); - - v1beta1.GenesisState = (function() { - - /** - * Properties of a GenesisState. - * @memberof cosmos.slashing.v1beta1 - * @interface IGenesisState - * @property {cosmos.slashing.v1beta1.IParams|null} [params] GenesisState params - * @property {Array.|null} [signing_infos] GenesisState signing_infos - * @property {Array.|null} [missed_blocks] GenesisState missed_blocks - */ - - /** - * Constructs a new GenesisState. - * @memberof cosmos.slashing.v1beta1 - * @classdesc Represents a GenesisState. - * @implements IGenesisState - * @constructor - * @param {cosmos.slashing.v1beta1.IGenesisState=} [properties] Properties to set - */ - function GenesisState(properties) { - this.signing_infos = []; - this.missed_blocks = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GenesisState params. - * @member {cosmos.slashing.v1beta1.IParams|null|undefined} params - * @memberof cosmos.slashing.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.params = null; - - /** - * GenesisState signing_infos. - * @member {Array.} signing_infos - * @memberof cosmos.slashing.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.signing_infos = $util.emptyArray; - - /** - * GenesisState missed_blocks. - * @member {Array.} missed_blocks - * @memberof cosmos.slashing.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.missed_blocks = $util.emptyArray; - - /** - * Encodes the specified GenesisState message. Does not implicitly {@link cosmos.slashing.v1beta1.GenesisState.verify|verify} messages. - * @function encode - * @memberof cosmos.slashing.v1beta1.GenesisState - * @static - * @param {cosmos.slashing.v1beta1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.params != null && Object.hasOwnProperty.call(message, "params")) - $root.cosmos.slashing.v1beta1.Params.encode(message.params, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.signing_infos != null && message.signing_infos.length) - for (let i = 0; i < message.signing_infos.length; ++i) - $root.cosmos.slashing.v1beta1.SigningInfo.encode(message.signing_infos[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.missed_blocks != null && message.missed_blocks.length) - for (let i = 0; i < message.missed_blocks.length; ++i) - $root.cosmos.slashing.v1beta1.ValidatorMissedBlocks.encode(message.missed_blocks[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link cosmos.slashing.v1beta1.GenesisState.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.slashing.v1beta1.GenesisState - * @static - * @param {cosmos.slashing.v1beta1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer. - * @function decode - * @memberof cosmos.slashing.v1beta1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.slashing.v1beta1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.slashing.v1beta1.GenesisState(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.params = $root.cosmos.slashing.v1beta1.Params.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.signing_infos && message.signing_infos.length)) - message.signing_infos = []; - message.signing_infos.push($root.cosmos.slashing.v1beta1.SigningInfo.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.missed_blocks && message.missed_blocks.length)) - message.missed_blocks = []; - message.missed_blocks.push($root.cosmos.slashing.v1beta1.ValidatorMissedBlocks.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.slashing.v1beta1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.slashing.v1beta1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GenesisState message. - * @function verify - * @memberof cosmos.slashing.v1beta1.GenesisState - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GenesisState.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.params != null && message.hasOwnProperty("params")) { - let error = $root.cosmos.slashing.v1beta1.Params.verify(message.params); - if (error) - return "params." + error; - } - if (message.signing_infos != null && message.hasOwnProperty("signing_infos")) { - if (!Array.isArray(message.signing_infos)) - return "signing_infos: array expected"; - for (let i = 0; i < message.signing_infos.length; ++i) { - let error = $root.cosmos.slashing.v1beta1.SigningInfo.verify(message.signing_infos[i]); - if (error) - return "signing_infos." + error; - } - } - if (message.missed_blocks != null && message.hasOwnProperty("missed_blocks")) { - if (!Array.isArray(message.missed_blocks)) - return "missed_blocks: array expected"; - for (let i = 0; i < message.missed_blocks.length; ++i) { - let error = $root.cosmos.slashing.v1beta1.ValidatorMissedBlocks.verify(message.missed_blocks[i]); - if (error) - return "missed_blocks." + error; - } - } - return null; - }; - - /** - * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.slashing.v1beta1.GenesisState - * @static - * @param {Object.} object Plain object - * @returns {cosmos.slashing.v1beta1.GenesisState} GenesisState - */ - GenesisState.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.slashing.v1beta1.GenesisState) - return object; - let message = new $root.cosmos.slashing.v1beta1.GenesisState(); - if (object.params != null) { - if (typeof object.params !== "object") - throw TypeError(".cosmos.slashing.v1beta1.GenesisState.params: object expected"); - message.params = $root.cosmos.slashing.v1beta1.Params.fromObject(object.params); - } - if (object.signing_infos) { - if (!Array.isArray(object.signing_infos)) - throw TypeError(".cosmos.slashing.v1beta1.GenesisState.signing_infos: array expected"); - message.signing_infos = []; - for (let i = 0; i < object.signing_infos.length; ++i) { - if (typeof object.signing_infos[i] !== "object") - throw TypeError(".cosmos.slashing.v1beta1.GenesisState.signing_infos: object expected"); - message.signing_infos[i] = $root.cosmos.slashing.v1beta1.SigningInfo.fromObject(object.signing_infos[i]); - } - } - if (object.missed_blocks) { - if (!Array.isArray(object.missed_blocks)) - throw TypeError(".cosmos.slashing.v1beta1.GenesisState.missed_blocks: array expected"); - message.missed_blocks = []; - for (let i = 0; i < object.missed_blocks.length; ++i) { - if (typeof object.missed_blocks[i] !== "object") - throw TypeError(".cosmos.slashing.v1beta1.GenesisState.missed_blocks: object expected"); - message.missed_blocks[i] = $root.cosmos.slashing.v1beta1.ValidatorMissedBlocks.fromObject(object.missed_blocks[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a GenesisState message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.slashing.v1beta1.GenesisState - * @static - * @param {cosmos.slashing.v1beta1.GenesisState} message GenesisState - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GenesisState.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) { - object.signing_infos = []; - object.missed_blocks = []; - } - if (options.defaults) - object.params = null; - if (message.params != null && message.hasOwnProperty("params")) - object.params = $root.cosmos.slashing.v1beta1.Params.toObject(message.params, options); - if (message.signing_infos && message.signing_infos.length) { - object.signing_infos = []; - for (let j = 0; j < message.signing_infos.length; ++j) - object.signing_infos[j] = $root.cosmos.slashing.v1beta1.SigningInfo.toObject(message.signing_infos[j], options); - } - if (message.missed_blocks && message.missed_blocks.length) { - object.missed_blocks = []; - for (let j = 0; j < message.missed_blocks.length; ++j) - object.missed_blocks[j] = $root.cosmos.slashing.v1beta1.ValidatorMissedBlocks.toObject(message.missed_blocks[j], options); - } - return object; - }; - - /** - * Converts this GenesisState to JSON. - * @function toJSON - * @memberof cosmos.slashing.v1beta1.GenesisState - * @instance - * @returns {Object.} JSON object - */ - GenesisState.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GenesisState; - })(); - - v1beta1.SigningInfo = (function() { - - /** - * Properties of a SigningInfo. - * @memberof cosmos.slashing.v1beta1 - * @interface ISigningInfo - * @property {string|null} [address] SigningInfo address - * @property {cosmos.slashing.v1beta1.IValidatorSigningInfo|null} [validator_signing_info] SigningInfo validator_signing_info - */ - - /** - * Constructs a new SigningInfo. - * @memberof cosmos.slashing.v1beta1 - * @classdesc Represents a SigningInfo. - * @implements ISigningInfo - * @constructor - * @param {cosmos.slashing.v1beta1.ISigningInfo=} [properties] Properties to set - */ - function SigningInfo(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SigningInfo address. - * @member {string} address - * @memberof cosmos.slashing.v1beta1.SigningInfo - * @instance - */ - SigningInfo.prototype.address = ""; - - /** - * SigningInfo validator_signing_info. - * @member {cosmos.slashing.v1beta1.IValidatorSigningInfo|null|undefined} validator_signing_info - * @memberof cosmos.slashing.v1beta1.SigningInfo - * @instance - */ - SigningInfo.prototype.validator_signing_info = null; - - /** - * Encodes the specified SigningInfo message. Does not implicitly {@link cosmos.slashing.v1beta1.SigningInfo.verify|verify} messages. - * @function encode - * @memberof cosmos.slashing.v1beta1.SigningInfo - * @static - * @param {cosmos.slashing.v1beta1.ISigningInfo} message SigningInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SigningInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.address != null && Object.hasOwnProperty.call(message, "address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.address); - if (message.validator_signing_info != null && Object.hasOwnProperty.call(message, "validator_signing_info")) - $root.cosmos.slashing.v1beta1.ValidatorSigningInfo.encode(message.validator_signing_info, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SigningInfo message, length delimited. Does not implicitly {@link cosmos.slashing.v1beta1.SigningInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.slashing.v1beta1.SigningInfo - * @static - * @param {cosmos.slashing.v1beta1.ISigningInfo} message SigningInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SigningInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SigningInfo message from the specified reader or buffer. - * @function decode - * @memberof cosmos.slashing.v1beta1.SigningInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.slashing.v1beta1.SigningInfo} SigningInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SigningInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.slashing.v1beta1.SigningInfo(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.address = reader.string(); - break; - case 2: - message.validator_signing_info = $root.cosmos.slashing.v1beta1.ValidatorSigningInfo.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SigningInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.slashing.v1beta1.SigningInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.slashing.v1beta1.SigningInfo} SigningInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SigningInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SigningInfo message. - * @function verify - * @memberof cosmos.slashing.v1beta1.SigningInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SigningInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.address != null && message.hasOwnProperty("address")) - if (!$util.isString(message.address)) - return "address: string expected"; - if (message.validator_signing_info != null && message.hasOwnProperty("validator_signing_info")) { - let error = $root.cosmos.slashing.v1beta1.ValidatorSigningInfo.verify(message.validator_signing_info); - if (error) - return "validator_signing_info." + error; - } - return null; - }; - - /** - * Creates a SigningInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.slashing.v1beta1.SigningInfo - * @static - * @param {Object.} object Plain object - * @returns {cosmos.slashing.v1beta1.SigningInfo} SigningInfo - */ - SigningInfo.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.slashing.v1beta1.SigningInfo) - return object; - let message = new $root.cosmos.slashing.v1beta1.SigningInfo(); - if (object.address != null) - message.address = String(object.address); - if (object.validator_signing_info != null) { - if (typeof object.validator_signing_info !== "object") - throw TypeError(".cosmos.slashing.v1beta1.SigningInfo.validator_signing_info: object expected"); - message.validator_signing_info = $root.cosmos.slashing.v1beta1.ValidatorSigningInfo.fromObject(object.validator_signing_info); - } - return message; - }; - - /** - * Creates a plain object from a SigningInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.slashing.v1beta1.SigningInfo - * @static - * @param {cosmos.slashing.v1beta1.SigningInfo} message SigningInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SigningInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.address = ""; - object.validator_signing_info = null; - } - if (message.address != null && message.hasOwnProperty("address")) - object.address = message.address; - if (message.validator_signing_info != null && message.hasOwnProperty("validator_signing_info")) - object.validator_signing_info = $root.cosmos.slashing.v1beta1.ValidatorSigningInfo.toObject(message.validator_signing_info, options); - return object; - }; - - /** - * Converts this SigningInfo to JSON. - * @function toJSON - * @memberof cosmos.slashing.v1beta1.SigningInfo - * @instance - * @returns {Object.} JSON object - */ - SigningInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return SigningInfo; - })(); - - v1beta1.ValidatorMissedBlocks = (function() { - - /** - * Properties of a ValidatorMissedBlocks. - * @memberof cosmos.slashing.v1beta1 - * @interface IValidatorMissedBlocks - * @property {string|null} [address] ValidatorMissedBlocks address - * @property {Array.|null} [missed_blocks] ValidatorMissedBlocks missed_blocks - */ - - /** - * Constructs a new ValidatorMissedBlocks. - * @memberof cosmos.slashing.v1beta1 - * @classdesc Represents a ValidatorMissedBlocks. - * @implements IValidatorMissedBlocks - * @constructor - * @param {cosmos.slashing.v1beta1.IValidatorMissedBlocks=} [properties] Properties to set - */ - function ValidatorMissedBlocks(properties) { - this.missed_blocks = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ValidatorMissedBlocks address. - * @member {string} address - * @memberof cosmos.slashing.v1beta1.ValidatorMissedBlocks - * @instance - */ - ValidatorMissedBlocks.prototype.address = ""; - - /** - * ValidatorMissedBlocks missed_blocks. - * @member {Array.} missed_blocks - * @memberof cosmos.slashing.v1beta1.ValidatorMissedBlocks - * @instance - */ - ValidatorMissedBlocks.prototype.missed_blocks = $util.emptyArray; - - /** - * Encodes the specified ValidatorMissedBlocks message. Does not implicitly {@link cosmos.slashing.v1beta1.ValidatorMissedBlocks.verify|verify} messages. - * @function encode - * @memberof cosmos.slashing.v1beta1.ValidatorMissedBlocks - * @static - * @param {cosmos.slashing.v1beta1.IValidatorMissedBlocks} message ValidatorMissedBlocks message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorMissedBlocks.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.address != null && Object.hasOwnProperty.call(message, "address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.address); - if (message.missed_blocks != null && message.missed_blocks.length) - for (let i = 0; i < message.missed_blocks.length; ++i) - $root.cosmos.slashing.v1beta1.MissedBlock.encode(message.missed_blocks[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ValidatorMissedBlocks message, length delimited. Does not implicitly {@link cosmos.slashing.v1beta1.ValidatorMissedBlocks.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.slashing.v1beta1.ValidatorMissedBlocks - * @static - * @param {cosmos.slashing.v1beta1.IValidatorMissedBlocks} message ValidatorMissedBlocks message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorMissedBlocks.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ValidatorMissedBlocks message from the specified reader or buffer. - * @function decode - * @memberof cosmos.slashing.v1beta1.ValidatorMissedBlocks - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.slashing.v1beta1.ValidatorMissedBlocks} ValidatorMissedBlocks - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorMissedBlocks.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.slashing.v1beta1.ValidatorMissedBlocks(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.address = reader.string(); - break; - case 2: - if (!(message.missed_blocks && message.missed_blocks.length)) - message.missed_blocks = []; - message.missed_blocks.push($root.cosmos.slashing.v1beta1.MissedBlock.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ValidatorMissedBlocks message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.slashing.v1beta1.ValidatorMissedBlocks - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.slashing.v1beta1.ValidatorMissedBlocks} ValidatorMissedBlocks - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorMissedBlocks.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ValidatorMissedBlocks message. - * @function verify - * @memberof cosmos.slashing.v1beta1.ValidatorMissedBlocks - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ValidatorMissedBlocks.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.address != null && message.hasOwnProperty("address")) - if (!$util.isString(message.address)) - return "address: string expected"; - if (message.missed_blocks != null && message.hasOwnProperty("missed_blocks")) { - if (!Array.isArray(message.missed_blocks)) - return "missed_blocks: array expected"; - for (let i = 0; i < message.missed_blocks.length; ++i) { - let error = $root.cosmos.slashing.v1beta1.MissedBlock.verify(message.missed_blocks[i]); - if (error) - return "missed_blocks." + error; - } - } - return null; - }; - - /** - * Creates a ValidatorMissedBlocks message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.slashing.v1beta1.ValidatorMissedBlocks - * @static - * @param {Object.} object Plain object - * @returns {cosmos.slashing.v1beta1.ValidatorMissedBlocks} ValidatorMissedBlocks - */ - ValidatorMissedBlocks.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.slashing.v1beta1.ValidatorMissedBlocks) - return object; - let message = new $root.cosmos.slashing.v1beta1.ValidatorMissedBlocks(); - if (object.address != null) - message.address = String(object.address); - if (object.missed_blocks) { - if (!Array.isArray(object.missed_blocks)) - throw TypeError(".cosmos.slashing.v1beta1.ValidatorMissedBlocks.missed_blocks: array expected"); - message.missed_blocks = []; - for (let i = 0; i < object.missed_blocks.length; ++i) { - if (typeof object.missed_blocks[i] !== "object") - throw TypeError(".cosmos.slashing.v1beta1.ValidatorMissedBlocks.missed_blocks: object expected"); - message.missed_blocks[i] = $root.cosmos.slashing.v1beta1.MissedBlock.fromObject(object.missed_blocks[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a ValidatorMissedBlocks message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.slashing.v1beta1.ValidatorMissedBlocks - * @static - * @param {cosmos.slashing.v1beta1.ValidatorMissedBlocks} message ValidatorMissedBlocks - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ValidatorMissedBlocks.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.missed_blocks = []; - if (options.defaults) - object.address = ""; - if (message.address != null && message.hasOwnProperty("address")) - object.address = message.address; - if (message.missed_blocks && message.missed_blocks.length) { - object.missed_blocks = []; - for (let j = 0; j < message.missed_blocks.length; ++j) - object.missed_blocks[j] = $root.cosmos.slashing.v1beta1.MissedBlock.toObject(message.missed_blocks[j], options); - } - return object; - }; - - /** - * Converts this ValidatorMissedBlocks to JSON. - * @function toJSON - * @memberof cosmos.slashing.v1beta1.ValidatorMissedBlocks - * @instance - * @returns {Object.} JSON object - */ - ValidatorMissedBlocks.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ValidatorMissedBlocks; - })(); - - v1beta1.MissedBlock = (function() { - - /** - * Properties of a MissedBlock. - * @memberof cosmos.slashing.v1beta1 - * @interface IMissedBlock - * @property {Long|null} [index] MissedBlock index - * @property {boolean|null} [missed] MissedBlock missed - */ - - /** - * Constructs a new MissedBlock. - * @memberof cosmos.slashing.v1beta1 - * @classdesc Represents a MissedBlock. - * @implements IMissedBlock - * @constructor - * @param {cosmos.slashing.v1beta1.IMissedBlock=} [properties] Properties to set - */ - function MissedBlock(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MissedBlock index. - * @member {Long} index - * @memberof cosmos.slashing.v1beta1.MissedBlock - * @instance - */ - MissedBlock.prototype.index = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * MissedBlock missed. - * @member {boolean} missed - * @memberof cosmos.slashing.v1beta1.MissedBlock - * @instance - */ - MissedBlock.prototype.missed = false; - - /** - * Encodes the specified MissedBlock message. Does not implicitly {@link cosmos.slashing.v1beta1.MissedBlock.verify|verify} messages. - * @function encode - * @memberof cosmos.slashing.v1beta1.MissedBlock - * @static - * @param {cosmos.slashing.v1beta1.IMissedBlock} message MissedBlock message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MissedBlock.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.index != null && Object.hasOwnProperty.call(message, "index")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.index); - if (message.missed != null && Object.hasOwnProperty.call(message, "missed")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.missed); - return writer; - }; - - /** - * Encodes the specified MissedBlock message, length delimited. Does not implicitly {@link cosmos.slashing.v1beta1.MissedBlock.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.slashing.v1beta1.MissedBlock - * @static - * @param {cosmos.slashing.v1beta1.IMissedBlock} message MissedBlock message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MissedBlock.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MissedBlock message from the specified reader or buffer. - * @function decode - * @memberof cosmos.slashing.v1beta1.MissedBlock - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.slashing.v1beta1.MissedBlock} MissedBlock - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MissedBlock.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.slashing.v1beta1.MissedBlock(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.index = reader.int64(); - break; - case 2: - message.missed = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MissedBlock message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.slashing.v1beta1.MissedBlock - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.slashing.v1beta1.MissedBlock} MissedBlock - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MissedBlock.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MissedBlock message. - * @function verify - * @memberof cosmos.slashing.v1beta1.MissedBlock - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MissedBlock.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.index != null && message.hasOwnProperty("index")) - if (!$util.isInteger(message.index) && !(message.index && $util.isInteger(message.index.low) && $util.isInteger(message.index.high))) - return "index: integer|Long expected"; - if (message.missed != null && message.hasOwnProperty("missed")) - if (typeof message.missed !== "boolean") - return "missed: boolean expected"; - return null; - }; - - /** - * Creates a MissedBlock message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.slashing.v1beta1.MissedBlock - * @static - * @param {Object.} object Plain object - * @returns {cosmos.slashing.v1beta1.MissedBlock} MissedBlock - */ - MissedBlock.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.slashing.v1beta1.MissedBlock) - return object; - let message = new $root.cosmos.slashing.v1beta1.MissedBlock(); - if (object.index != null) - if ($util.Long) - (message.index = $util.Long.fromValue(object.index)).unsigned = false; - else if (typeof object.index === "string") - message.index = parseInt(object.index, 10); - else if (typeof object.index === "number") - message.index = object.index; - else if (typeof object.index === "object") - message.index = new $util.LongBits(object.index.low >>> 0, object.index.high >>> 0).toNumber(); - if (object.missed != null) - message.missed = Boolean(object.missed); - return message; - }; - - /** - * Creates a plain object from a MissedBlock message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.slashing.v1beta1.MissedBlock - * @static - * @param {cosmos.slashing.v1beta1.MissedBlock} message MissedBlock - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MissedBlock.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.index = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.index = options.longs === String ? "0" : 0; - object.missed = false; - } - if (message.index != null && message.hasOwnProperty("index")) - if (typeof message.index === "number") - object.index = options.longs === String ? String(message.index) : message.index; - else - object.index = options.longs === String ? $util.Long.prototype.toString.call(message.index) : options.longs === Number ? new $util.LongBits(message.index.low >>> 0, message.index.high >>> 0).toNumber() : message.index; - if (message.missed != null && message.hasOwnProperty("missed")) - object.missed = message.missed; - return object; - }; - - /** - * Converts this MissedBlock to JSON. - * @function toJSON - * @memberof cosmos.slashing.v1beta1.MissedBlock - * @instance - * @returns {Object.} JSON object - */ - MissedBlock.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MissedBlock; - })(); - - return v1beta1; - })(); - - return slashing; - })(); - - cosmos.staking = (function() { - - /** - * Namespace staking. - * @memberof cosmos - * @namespace - */ - const staking = {}; - - staking.v1beta1 = (function() { - - /** - * Namespace v1beta1. - * @memberof cosmos.staking - * @namespace - */ - const v1beta1 = {}; - - v1beta1.Msg = (function() { - - /** - * Constructs a new Msg service. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a Msg - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function Msg(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Msg.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Msg; - - /** - * Callback as used by {@link cosmos.staking.v1beta1.Msg#createValidator}. - * @memberof cosmos.staking.v1beta1.Msg - * @typedef CreateValidatorCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.staking.v1beta1.MsgCreateValidatorResponse} [response] MsgCreateValidatorResponse - */ - - /** - * Calls CreateValidator. - * @function createValidator - * @memberof cosmos.staking.v1beta1.Msg - * @instance - * @param {cosmos.staking.v1beta1.IMsgCreateValidator} request MsgCreateValidator message or plain object - * @param {cosmos.staking.v1beta1.Msg.CreateValidatorCallback} callback Node-style callback called with the error, if any, and MsgCreateValidatorResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.createValidator = function createValidator(request, callback) { - return this.rpcCall(createValidator, $root.cosmos.staking.v1beta1.MsgCreateValidator, $root.cosmos.staking.v1beta1.MsgCreateValidatorResponse, request, callback); - }, "name", { value: "CreateValidator" }); - - /** - * Calls CreateValidator. - * @function createValidator - * @memberof cosmos.staking.v1beta1.Msg - * @instance - * @param {cosmos.staking.v1beta1.IMsgCreateValidator} request MsgCreateValidator message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.staking.v1beta1.Msg#editValidator}. - * @memberof cosmos.staking.v1beta1.Msg - * @typedef EditValidatorCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.staking.v1beta1.MsgEditValidatorResponse} [response] MsgEditValidatorResponse - */ - - /** - * Calls EditValidator. - * @function editValidator - * @memberof cosmos.staking.v1beta1.Msg - * @instance - * @param {cosmos.staking.v1beta1.IMsgEditValidator} request MsgEditValidator message or plain object - * @param {cosmos.staking.v1beta1.Msg.EditValidatorCallback} callback Node-style callback called with the error, if any, and MsgEditValidatorResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.editValidator = function editValidator(request, callback) { - return this.rpcCall(editValidator, $root.cosmos.staking.v1beta1.MsgEditValidator, $root.cosmos.staking.v1beta1.MsgEditValidatorResponse, request, callback); - }, "name", { value: "EditValidator" }); - - /** - * Calls EditValidator. - * @function editValidator - * @memberof cosmos.staking.v1beta1.Msg - * @instance - * @param {cosmos.staking.v1beta1.IMsgEditValidator} request MsgEditValidator message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.staking.v1beta1.Msg#delegate}. - * @memberof cosmos.staking.v1beta1.Msg - * @typedef DelegateCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.staking.v1beta1.MsgDelegateResponse} [response] MsgDelegateResponse - */ - - /** - * Calls Delegate. - * @function delegate - * @memberof cosmos.staking.v1beta1.Msg - * @instance - * @param {cosmos.staking.v1beta1.IMsgDelegate} request MsgDelegate message or plain object - * @param {cosmos.staking.v1beta1.Msg.DelegateCallback} callback Node-style callback called with the error, if any, and MsgDelegateResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.delegate = function delegate(request, callback) { - return this.rpcCall(delegate, $root.cosmos.staking.v1beta1.MsgDelegate, $root.cosmos.staking.v1beta1.MsgDelegateResponse, request, callback); - }, "name", { value: "Delegate" }); - - /** - * Calls Delegate. - * @function delegate - * @memberof cosmos.staking.v1beta1.Msg - * @instance - * @param {cosmos.staking.v1beta1.IMsgDelegate} request MsgDelegate message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.staking.v1beta1.Msg#beginRedelegate}. - * @memberof cosmos.staking.v1beta1.Msg - * @typedef BeginRedelegateCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.staking.v1beta1.MsgBeginRedelegateResponse} [response] MsgBeginRedelegateResponse - */ - - /** - * Calls BeginRedelegate. - * @function beginRedelegate - * @memberof cosmos.staking.v1beta1.Msg - * @instance - * @param {cosmos.staking.v1beta1.IMsgBeginRedelegate} request MsgBeginRedelegate message or plain object - * @param {cosmos.staking.v1beta1.Msg.BeginRedelegateCallback} callback Node-style callback called with the error, if any, and MsgBeginRedelegateResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.beginRedelegate = function beginRedelegate(request, callback) { - return this.rpcCall(beginRedelegate, $root.cosmos.staking.v1beta1.MsgBeginRedelegate, $root.cosmos.staking.v1beta1.MsgBeginRedelegateResponse, request, callback); - }, "name", { value: "BeginRedelegate" }); - - /** - * Calls BeginRedelegate. - * @function beginRedelegate - * @memberof cosmos.staking.v1beta1.Msg - * @instance - * @param {cosmos.staking.v1beta1.IMsgBeginRedelegate} request MsgBeginRedelegate message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.staking.v1beta1.Msg#undelegate}. - * @memberof cosmos.staking.v1beta1.Msg - * @typedef UndelegateCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.staking.v1beta1.MsgUndelegateResponse} [response] MsgUndelegateResponse - */ - - /** - * Calls Undelegate. - * @function undelegate - * @memberof cosmos.staking.v1beta1.Msg - * @instance - * @param {cosmos.staking.v1beta1.IMsgUndelegate} request MsgUndelegate message or plain object - * @param {cosmos.staking.v1beta1.Msg.UndelegateCallback} callback Node-style callback called with the error, if any, and MsgUndelegateResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.undelegate = function undelegate(request, callback) { - return this.rpcCall(undelegate, $root.cosmos.staking.v1beta1.MsgUndelegate, $root.cosmos.staking.v1beta1.MsgUndelegateResponse, request, callback); - }, "name", { value: "Undelegate" }); - - /** - * Calls Undelegate. - * @function undelegate - * @memberof cosmos.staking.v1beta1.Msg - * @instance - * @param {cosmos.staking.v1beta1.IMsgUndelegate} request MsgUndelegate message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return Msg; - })(); - - v1beta1.MsgCreateValidator = (function() { - - /** - * Properties of a MsgCreateValidator. - * @memberof cosmos.staking.v1beta1 - * @interface IMsgCreateValidator - * @property {cosmos.staking.v1beta1.IDescription|null} [description] MsgCreateValidator description - * @property {cosmos.staking.v1beta1.ICommissionRates|null} [commission] MsgCreateValidator commission - * @property {string|null} [min_self_delegation] MsgCreateValidator min_self_delegation - * @property {string|null} [delegator_address] MsgCreateValidator delegator_address - * @property {string|null} [validator_address] MsgCreateValidator validator_address - * @property {google.protobuf.IAny|null} [pubkey] MsgCreateValidator pubkey - * @property {cosmos.base.v1beta1.ICoin|null} [value] MsgCreateValidator value - */ - - /** - * Constructs a new MsgCreateValidator. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a MsgCreateValidator. - * @implements IMsgCreateValidator - * @constructor - * @param {cosmos.staking.v1beta1.IMsgCreateValidator=} [properties] Properties to set - */ - function MsgCreateValidator(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgCreateValidator description. - * @member {cosmos.staking.v1beta1.IDescription|null|undefined} description - * @memberof cosmos.staking.v1beta1.MsgCreateValidator - * @instance - */ - MsgCreateValidator.prototype.description = null; - - /** - * MsgCreateValidator commission. - * @member {cosmos.staking.v1beta1.ICommissionRates|null|undefined} commission - * @memberof cosmos.staking.v1beta1.MsgCreateValidator - * @instance - */ - MsgCreateValidator.prototype.commission = null; - - /** - * MsgCreateValidator min_self_delegation. - * @member {string} min_self_delegation - * @memberof cosmos.staking.v1beta1.MsgCreateValidator - * @instance - */ - MsgCreateValidator.prototype.min_self_delegation = ""; - - /** - * MsgCreateValidator delegator_address. - * @member {string} delegator_address - * @memberof cosmos.staking.v1beta1.MsgCreateValidator - * @instance - */ - MsgCreateValidator.prototype.delegator_address = ""; - - /** - * MsgCreateValidator validator_address. - * @member {string} validator_address - * @memberof cosmos.staking.v1beta1.MsgCreateValidator - * @instance - */ - MsgCreateValidator.prototype.validator_address = ""; - - /** - * MsgCreateValidator pubkey. - * @member {google.protobuf.IAny|null|undefined} pubkey - * @memberof cosmos.staking.v1beta1.MsgCreateValidator - * @instance - */ - MsgCreateValidator.prototype.pubkey = null; - - /** - * MsgCreateValidator value. - * @member {cosmos.base.v1beta1.ICoin|null|undefined} value - * @memberof cosmos.staking.v1beta1.MsgCreateValidator - * @instance - */ - MsgCreateValidator.prototype.value = null; - - /** - * Encodes the specified MsgCreateValidator message. Does not implicitly {@link cosmos.staking.v1beta1.MsgCreateValidator.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.MsgCreateValidator - * @static - * @param {cosmos.staking.v1beta1.IMsgCreateValidator} message MsgCreateValidator message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgCreateValidator.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - $root.cosmos.staking.v1beta1.Description.encode(message.description, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.commission != null && Object.hasOwnProperty.call(message, "commission")) - $root.cosmos.staking.v1beta1.CommissionRates.encode(message.commission, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.min_self_delegation != null && Object.hasOwnProperty.call(message, "min_self_delegation")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.min_self_delegation); - if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.delegator_address); - if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.validator_address); - if (message.pubkey != null && Object.hasOwnProperty.call(message, "pubkey")) - $root.google.protobuf.Any.encode(message.pubkey, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - $root.cosmos.base.v1beta1.Coin.encode(message.value, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified MsgCreateValidator message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.MsgCreateValidator.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.MsgCreateValidator - * @static - * @param {cosmos.staking.v1beta1.IMsgCreateValidator} message MsgCreateValidator message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgCreateValidator.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgCreateValidator message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.MsgCreateValidator - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.MsgCreateValidator} MsgCreateValidator - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgCreateValidator.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.MsgCreateValidator(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.description = $root.cosmos.staking.v1beta1.Description.decode(reader, reader.uint32()); - break; - case 2: - message.commission = $root.cosmos.staking.v1beta1.CommissionRates.decode(reader, reader.uint32()); - break; - case 3: - message.min_self_delegation = reader.string(); - break; - case 4: - message.delegator_address = reader.string(); - break; - case 5: - message.validator_address = reader.string(); - break; - case 6: - message.pubkey = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - case 7: - message.value = $root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgCreateValidator message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.MsgCreateValidator - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.MsgCreateValidator} MsgCreateValidator - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgCreateValidator.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgCreateValidator message. - * @function verify - * @memberof cosmos.staking.v1beta1.MsgCreateValidator - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgCreateValidator.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.description != null && message.hasOwnProperty("description")) { - let error = $root.cosmos.staking.v1beta1.Description.verify(message.description); - if (error) - return "description." + error; - } - if (message.commission != null && message.hasOwnProperty("commission")) { - let error = $root.cosmos.staking.v1beta1.CommissionRates.verify(message.commission); - if (error) - return "commission." + error; - } - if (message.min_self_delegation != null && message.hasOwnProperty("min_self_delegation")) - if (!$util.isString(message.min_self_delegation)) - return "min_self_delegation: string expected"; - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - if (!$util.isString(message.delegator_address)) - return "delegator_address: string expected"; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - if (!$util.isString(message.validator_address)) - return "validator_address: string expected"; - if (message.pubkey != null && message.hasOwnProperty("pubkey")) { - let error = $root.google.protobuf.Any.verify(message.pubkey); - if (error) - return "pubkey." + error; - } - if (message.value != null && message.hasOwnProperty("value")) { - let error = $root.cosmos.base.v1beta1.Coin.verify(message.value); - if (error) - return "value." + error; - } - return null; - }; - - /** - * Creates a MsgCreateValidator message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.MsgCreateValidator - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.MsgCreateValidator} MsgCreateValidator - */ - MsgCreateValidator.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.MsgCreateValidator) - return object; - let message = new $root.cosmos.staking.v1beta1.MsgCreateValidator(); - if (object.description != null) { - if (typeof object.description !== "object") - throw TypeError(".cosmos.staking.v1beta1.MsgCreateValidator.description: object expected"); - message.description = $root.cosmos.staking.v1beta1.Description.fromObject(object.description); - } - if (object.commission != null) { - if (typeof object.commission !== "object") - throw TypeError(".cosmos.staking.v1beta1.MsgCreateValidator.commission: object expected"); - message.commission = $root.cosmos.staking.v1beta1.CommissionRates.fromObject(object.commission); - } - if (object.min_self_delegation != null) - message.min_self_delegation = String(object.min_self_delegation); - if (object.delegator_address != null) - message.delegator_address = String(object.delegator_address); - if (object.validator_address != null) - message.validator_address = String(object.validator_address); - if (object.pubkey != null) { - if (typeof object.pubkey !== "object") - throw TypeError(".cosmos.staking.v1beta1.MsgCreateValidator.pubkey: object expected"); - message.pubkey = $root.google.protobuf.Any.fromObject(object.pubkey); - } - if (object.value != null) { - if (typeof object.value !== "object") - throw TypeError(".cosmos.staking.v1beta1.MsgCreateValidator.value: object expected"); - message.value = $root.cosmos.base.v1beta1.Coin.fromObject(object.value); - } - return message; - }; - - /** - * Creates a plain object from a MsgCreateValidator message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.MsgCreateValidator - * @static - * @param {cosmos.staking.v1beta1.MsgCreateValidator} message MsgCreateValidator - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgCreateValidator.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.description = null; - object.commission = null; - object.min_self_delegation = ""; - object.delegator_address = ""; - object.validator_address = ""; - object.pubkey = null; - object.value = null; - } - if (message.description != null && message.hasOwnProperty("description")) - object.description = $root.cosmos.staking.v1beta1.Description.toObject(message.description, options); - if (message.commission != null && message.hasOwnProperty("commission")) - object.commission = $root.cosmos.staking.v1beta1.CommissionRates.toObject(message.commission, options); - if (message.min_self_delegation != null && message.hasOwnProperty("min_self_delegation")) - object.min_self_delegation = message.min_self_delegation; - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - object.delegator_address = message.delegator_address; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - object.validator_address = message.validator_address; - if (message.pubkey != null && message.hasOwnProperty("pubkey")) - object.pubkey = $root.google.protobuf.Any.toObject(message.pubkey, options); - if (message.value != null && message.hasOwnProperty("value")) - object.value = $root.cosmos.base.v1beta1.Coin.toObject(message.value, options); - return object; - }; - - /** - * Converts this MsgCreateValidator to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.MsgCreateValidator - * @instance - * @returns {Object.} JSON object - */ - MsgCreateValidator.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgCreateValidator; - })(); - - v1beta1.MsgCreateValidatorResponse = (function() { - - /** - * Properties of a MsgCreateValidatorResponse. - * @memberof cosmos.staking.v1beta1 - * @interface IMsgCreateValidatorResponse - */ - - /** - * Constructs a new MsgCreateValidatorResponse. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a MsgCreateValidatorResponse. - * @implements IMsgCreateValidatorResponse - * @constructor - * @param {cosmos.staking.v1beta1.IMsgCreateValidatorResponse=} [properties] Properties to set - */ - function MsgCreateValidatorResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgCreateValidatorResponse message. Does not implicitly {@link cosmos.staking.v1beta1.MsgCreateValidatorResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.MsgCreateValidatorResponse - * @static - * @param {cosmos.staking.v1beta1.IMsgCreateValidatorResponse} message MsgCreateValidatorResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgCreateValidatorResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgCreateValidatorResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.MsgCreateValidatorResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.MsgCreateValidatorResponse - * @static - * @param {cosmos.staking.v1beta1.IMsgCreateValidatorResponse} message MsgCreateValidatorResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgCreateValidatorResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgCreateValidatorResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.MsgCreateValidatorResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.MsgCreateValidatorResponse} MsgCreateValidatorResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgCreateValidatorResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.MsgCreateValidatorResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgCreateValidatorResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.MsgCreateValidatorResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.MsgCreateValidatorResponse} MsgCreateValidatorResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgCreateValidatorResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgCreateValidatorResponse message. - * @function verify - * @memberof cosmos.staking.v1beta1.MsgCreateValidatorResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgCreateValidatorResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgCreateValidatorResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.MsgCreateValidatorResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.MsgCreateValidatorResponse} MsgCreateValidatorResponse - */ - MsgCreateValidatorResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.MsgCreateValidatorResponse) - return object; - return new $root.cosmos.staking.v1beta1.MsgCreateValidatorResponse(); - }; - - /** - * Creates a plain object from a MsgCreateValidatorResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.MsgCreateValidatorResponse - * @static - * @param {cosmos.staking.v1beta1.MsgCreateValidatorResponse} message MsgCreateValidatorResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgCreateValidatorResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgCreateValidatorResponse to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.MsgCreateValidatorResponse - * @instance - * @returns {Object.} JSON object - */ - MsgCreateValidatorResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgCreateValidatorResponse; - })(); - - v1beta1.MsgEditValidator = (function() { - - /** - * Properties of a MsgEditValidator. - * @memberof cosmos.staking.v1beta1 - * @interface IMsgEditValidator - * @property {cosmos.staking.v1beta1.IDescription|null} [description] MsgEditValidator description - * @property {string|null} [validator_address] MsgEditValidator validator_address - * @property {string|null} [commission_rate] MsgEditValidator commission_rate - * @property {string|null} [min_self_delegation] MsgEditValidator min_self_delegation - */ - - /** - * Constructs a new MsgEditValidator. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a MsgEditValidator. - * @implements IMsgEditValidator - * @constructor - * @param {cosmos.staking.v1beta1.IMsgEditValidator=} [properties] Properties to set - */ - function MsgEditValidator(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgEditValidator description. - * @member {cosmos.staking.v1beta1.IDescription|null|undefined} description - * @memberof cosmos.staking.v1beta1.MsgEditValidator - * @instance - */ - MsgEditValidator.prototype.description = null; - - /** - * MsgEditValidator validator_address. - * @member {string} validator_address - * @memberof cosmos.staking.v1beta1.MsgEditValidator - * @instance - */ - MsgEditValidator.prototype.validator_address = ""; - - /** - * MsgEditValidator commission_rate. - * @member {string} commission_rate - * @memberof cosmos.staking.v1beta1.MsgEditValidator - * @instance - */ - MsgEditValidator.prototype.commission_rate = ""; - - /** - * MsgEditValidator min_self_delegation. - * @member {string} min_self_delegation - * @memberof cosmos.staking.v1beta1.MsgEditValidator - * @instance - */ - MsgEditValidator.prototype.min_self_delegation = ""; - - /** - * Encodes the specified MsgEditValidator message. Does not implicitly {@link cosmos.staking.v1beta1.MsgEditValidator.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.MsgEditValidator - * @static - * @param {cosmos.staking.v1beta1.IMsgEditValidator} message MsgEditValidator message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgEditValidator.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - $root.cosmos.staking.v1beta1.Description.encode(message.description, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.validator_address); - if (message.commission_rate != null && Object.hasOwnProperty.call(message, "commission_rate")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.commission_rate); - if (message.min_self_delegation != null && Object.hasOwnProperty.call(message, "min_self_delegation")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.min_self_delegation); - return writer; - }; - - /** - * Encodes the specified MsgEditValidator message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.MsgEditValidator.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.MsgEditValidator - * @static - * @param {cosmos.staking.v1beta1.IMsgEditValidator} message MsgEditValidator message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgEditValidator.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgEditValidator message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.MsgEditValidator - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.MsgEditValidator} MsgEditValidator - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgEditValidator.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.MsgEditValidator(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.description = $root.cosmos.staking.v1beta1.Description.decode(reader, reader.uint32()); - break; - case 2: - message.validator_address = reader.string(); - break; - case 3: - message.commission_rate = reader.string(); - break; - case 4: - message.min_self_delegation = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgEditValidator message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.MsgEditValidator - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.MsgEditValidator} MsgEditValidator - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgEditValidator.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgEditValidator message. - * @function verify - * @memberof cosmos.staking.v1beta1.MsgEditValidator - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgEditValidator.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.description != null && message.hasOwnProperty("description")) { - let error = $root.cosmos.staking.v1beta1.Description.verify(message.description); - if (error) - return "description." + error; - } - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - if (!$util.isString(message.validator_address)) - return "validator_address: string expected"; - if (message.commission_rate != null && message.hasOwnProperty("commission_rate")) - if (!$util.isString(message.commission_rate)) - return "commission_rate: string expected"; - if (message.min_self_delegation != null && message.hasOwnProperty("min_self_delegation")) - if (!$util.isString(message.min_self_delegation)) - return "min_self_delegation: string expected"; - return null; - }; - - /** - * Creates a MsgEditValidator message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.MsgEditValidator - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.MsgEditValidator} MsgEditValidator - */ - MsgEditValidator.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.MsgEditValidator) - return object; - let message = new $root.cosmos.staking.v1beta1.MsgEditValidator(); - if (object.description != null) { - if (typeof object.description !== "object") - throw TypeError(".cosmos.staking.v1beta1.MsgEditValidator.description: object expected"); - message.description = $root.cosmos.staking.v1beta1.Description.fromObject(object.description); - } - if (object.validator_address != null) - message.validator_address = String(object.validator_address); - if (object.commission_rate != null) - message.commission_rate = String(object.commission_rate); - if (object.min_self_delegation != null) - message.min_self_delegation = String(object.min_self_delegation); - return message; - }; - - /** - * Creates a plain object from a MsgEditValidator message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.MsgEditValidator - * @static - * @param {cosmos.staking.v1beta1.MsgEditValidator} message MsgEditValidator - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgEditValidator.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.description = null; - object.validator_address = ""; - object.commission_rate = ""; - object.min_self_delegation = ""; - } - if (message.description != null && message.hasOwnProperty("description")) - object.description = $root.cosmos.staking.v1beta1.Description.toObject(message.description, options); - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - object.validator_address = message.validator_address; - if (message.commission_rate != null && message.hasOwnProperty("commission_rate")) - object.commission_rate = message.commission_rate; - if (message.min_self_delegation != null && message.hasOwnProperty("min_self_delegation")) - object.min_self_delegation = message.min_self_delegation; - return object; - }; - - /** - * Converts this MsgEditValidator to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.MsgEditValidator - * @instance - * @returns {Object.} JSON object - */ - MsgEditValidator.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgEditValidator; - })(); - - v1beta1.MsgEditValidatorResponse = (function() { - - /** - * Properties of a MsgEditValidatorResponse. - * @memberof cosmos.staking.v1beta1 - * @interface IMsgEditValidatorResponse - */ - - /** - * Constructs a new MsgEditValidatorResponse. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a MsgEditValidatorResponse. - * @implements IMsgEditValidatorResponse - * @constructor - * @param {cosmos.staking.v1beta1.IMsgEditValidatorResponse=} [properties] Properties to set - */ - function MsgEditValidatorResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgEditValidatorResponse message. Does not implicitly {@link cosmos.staking.v1beta1.MsgEditValidatorResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.MsgEditValidatorResponse - * @static - * @param {cosmos.staking.v1beta1.IMsgEditValidatorResponse} message MsgEditValidatorResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgEditValidatorResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgEditValidatorResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.MsgEditValidatorResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.MsgEditValidatorResponse - * @static - * @param {cosmos.staking.v1beta1.IMsgEditValidatorResponse} message MsgEditValidatorResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgEditValidatorResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgEditValidatorResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.MsgEditValidatorResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.MsgEditValidatorResponse} MsgEditValidatorResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgEditValidatorResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.MsgEditValidatorResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgEditValidatorResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.MsgEditValidatorResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.MsgEditValidatorResponse} MsgEditValidatorResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgEditValidatorResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgEditValidatorResponse message. - * @function verify - * @memberof cosmos.staking.v1beta1.MsgEditValidatorResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgEditValidatorResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgEditValidatorResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.MsgEditValidatorResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.MsgEditValidatorResponse} MsgEditValidatorResponse - */ - MsgEditValidatorResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.MsgEditValidatorResponse) - return object; - return new $root.cosmos.staking.v1beta1.MsgEditValidatorResponse(); - }; - - /** - * Creates a plain object from a MsgEditValidatorResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.MsgEditValidatorResponse - * @static - * @param {cosmos.staking.v1beta1.MsgEditValidatorResponse} message MsgEditValidatorResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgEditValidatorResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgEditValidatorResponse to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.MsgEditValidatorResponse - * @instance - * @returns {Object.} JSON object - */ - MsgEditValidatorResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgEditValidatorResponse; - })(); - - v1beta1.MsgDelegate = (function() { - - /** - * Properties of a MsgDelegate. - * @memberof cosmos.staking.v1beta1 - * @interface IMsgDelegate - * @property {string|null} [delegator_address] MsgDelegate delegator_address - * @property {string|null} [validator_address] MsgDelegate validator_address - * @property {cosmos.base.v1beta1.ICoin|null} [amount] MsgDelegate amount - */ - - /** - * Constructs a new MsgDelegate. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a MsgDelegate. - * @implements IMsgDelegate - * @constructor - * @param {cosmos.staking.v1beta1.IMsgDelegate=} [properties] Properties to set - */ - function MsgDelegate(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgDelegate delegator_address. - * @member {string} delegator_address - * @memberof cosmos.staking.v1beta1.MsgDelegate - * @instance - */ - MsgDelegate.prototype.delegator_address = ""; - - /** - * MsgDelegate validator_address. - * @member {string} validator_address - * @memberof cosmos.staking.v1beta1.MsgDelegate - * @instance - */ - MsgDelegate.prototype.validator_address = ""; - - /** - * MsgDelegate amount. - * @member {cosmos.base.v1beta1.ICoin|null|undefined} amount - * @memberof cosmos.staking.v1beta1.MsgDelegate - * @instance - */ - MsgDelegate.prototype.amount = null; - - /** - * Encodes the specified MsgDelegate message. Does not implicitly {@link cosmos.staking.v1beta1.MsgDelegate.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.MsgDelegate - * @static - * @param {cosmos.staking.v1beta1.IMsgDelegate} message MsgDelegate message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgDelegate.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); - if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.validator_address); - if (message.amount != null && Object.hasOwnProperty.call(message, "amount")) - $root.cosmos.base.v1beta1.Coin.encode(message.amount, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified MsgDelegate message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.MsgDelegate.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.MsgDelegate - * @static - * @param {cosmos.staking.v1beta1.IMsgDelegate} message MsgDelegate message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgDelegate.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgDelegate message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.MsgDelegate - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.MsgDelegate} MsgDelegate - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgDelegate.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.MsgDelegate(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.delegator_address = reader.string(); - break; - case 2: - message.validator_address = reader.string(); - break; - case 3: - message.amount = $root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgDelegate message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.MsgDelegate - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.MsgDelegate} MsgDelegate - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgDelegate.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgDelegate message. - * @function verify - * @memberof cosmos.staking.v1beta1.MsgDelegate - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgDelegate.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - if (!$util.isString(message.delegator_address)) - return "delegator_address: string expected"; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - if (!$util.isString(message.validator_address)) - return "validator_address: string expected"; - if (message.amount != null && message.hasOwnProperty("amount")) { - let error = $root.cosmos.base.v1beta1.Coin.verify(message.amount); - if (error) - return "amount." + error; - } - return null; - }; - - /** - * Creates a MsgDelegate message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.MsgDelegate - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.MsgDelegate} MsgDelegate - */ - MsgDelegate.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.MsgDelegate) - return object; - let message = new $root.cosmos.staking.v1beta1.MsgDelegate(); - if (object.delegator_address != null) - message.delegator_address = String(object.delegator_address); - if (object.validator_address != null) - message.validator_address = String(object.validator_address); - if (object.amount != null) { - if (typeof object.amount !== "object") - throw TypeError(".cosmos.staking.v1beta1.MsgDelegate.amount: object expected"); - message.amount = $root.cosmos.base.v1beta1.Coin.fromObject(object.amount); - } - return message; - }; - - /** - * Creates a plain object from a MsgDelegate message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.MsgDelegate - * @static - * @param {cosmos.staking.v1beta1.MsgDelegate} message MsgDelegate - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgDelegate.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.delegator_address = ""; - object.validator_address = ""; - object.amount = null; - } - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - object.delegator_address = message.delegator_address; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - object.validator_address = message.validator_address; - if (message.amount != null && message.hasOwnProperty("amount")) - object.amount = $root.cosmos.base.v1beta1.Coin.toObject(message.amount, options); - return object; - }; - - /** - * Converts this MsgDelegate to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.MsgDelegate - * @instance - * @returns {Object.} JSON object - */ - MsgDelegate.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgDelegate; - })(); - - v1beta1.MsgDelegateResponse = (function() { - - /** - * Properties of a MsgDelegateResponse. - * @memberof cosmos.staking.v1beta1 - * @interface IMsgDelegateResponse - */ - - /** - * Constructs a new MsgDelegateResponse. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a MsgDelegateResponse. - * @implements IMsgDelegateResponse - * @constructor - * @param {cosmos.staking.v1beta1.IMsgDelegateResponse=} [properties] Properties to set - */ - function MsgDelegateResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgDelegateResponse message. Does not implicitly {@link cosmos.staking.v1beta1.MsgDelegateResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.MsgDelegateResponse - * @static - * @param {cosmos.staking.v1beta1.IMsgDelegateResponse} message MsgDelegateResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgDelegateResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgDelegateResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.MsgDelegateResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.MsgDelegateResponse - * @static - * @param {cosmos.staking.v1beta1.IMsgDelegateResponse} message MsgDelegateResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgDelegateResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgDelegateResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.MsgDelegateResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.MsgDelegateResponse} MsgDelegateResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgDelegateResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.MsgDelegateResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgDelegateResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.MsgDelegateResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.MsgDelegateResponse} MsgDelegateResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgDelegateResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgDelegateResponse message. - * @function verify - * @memberof cosmos.staking.v1beta1.MsgDelegateResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgDelegateResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgDelegateResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.MsgDelegateResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.MsgDelegateResponse} MsgDelegateResponse - */ - MsgDelegateResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.MsgDelegateResponse) - return object; - return new $root.cosmos.staking.v1beta1.MsgDelegateResponse(); - }; - - /** - * Creates a plain object from a MsgDelegateResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.MsgDelegateResponse - * @static - * @param {cosmos.staking.v1beta1.MsgDelegateResponse} message MsgDelegateResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgDelegateResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgDelegateResponse to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.MsgDelegateResponse - * @instance - * @returns {Object.} JSON object - */ - MsgDelegateResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgDelegateResponse; - })(); - - v1beta1.MsgBeginRedelegate = (function() { - - /** - * Properties of a MsgBeginRedelegate. - * @memberof cosmos.staking.v1beta1 - * @interface IMsgBeginRedelegate - * @property {string|null} [delegator_address] MsgBeginRedelegate delegator_address - * @property {string|null} [validator_src_address] MsgBeginRedelegate validator_src_address - * @property {string|null} [validator_dst_address] MsgBeginRedelegate validator_dst_address - * @property {cosmos.base.v1beta1.ICoin|null} [amount] MsgBeginRedelegate amount - */ - - /** - * Constructs a new MsgBeginRedelegate. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a MsgBeginRedelegate. - * @implements IMsgBeginRedelegate - * @constructor - * @param {cosmos.staking.v1beta1.IMsgBeginRedelegate=} [properties] Properties to set - */ - function MsgBeginRedelegate(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgBeginRedelegate delegator_address. - * @member {string} delegator_address - * @memberof cosmos.staking.v1beta1.MsgBeginRedelegate - * @instance - */ - MsgBeginRedelegate.prototype.delegator_address = ""; - - /** - * MsgBeginRedelegate validator_src_address. - * @member {string} validator_src_address - * @memberof cosmos.staking.v1beta1.MsgBeginRedelegate - * @instance - */ - MsgBeginRedelegate.prototype.validator_src_address = ""; - - /** - * MsgBeginRedelegate validator_dst_address. - * @member {string} validator_dst_address - * @memberof cosmos.staking.v1beta1.MsgBeginRedelegate - * @instance - */ - MsgBeginRedelegate.prototype.validator_dst_address = ""; - - /** - * MsgBeginRedelegate amount. - * @member {cosmos.base.v1beta1.ICoin|null|undefined} amount - * @memberof cosmos.staking.v1beta1.MsgBeginRedelegate - * @instance - */ - MsgBeginRedelegate.prototype.amount = null; - - /** - * Encodes the specified MsgBeginRedelegate message. Does not implicitly {@link cosmos.staking.v1beta1.MsgBeginRedelegate.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.MsgBeginRedelegate - * @static - * @param {cosmos.staking.v1beta1.IMsgBeginRedelegate} message MsgBeginRedelegate message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgBeginRedelegate.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); - if (message.validator_src_address != null && Object.hasOwnProperty.call(message, "validator_src_address")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.validator_src_address); - if (message.validator_dst_address != null && Object.hasOwnProperty.call(message, "validator_dst_address")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.validator_dst_address); - if (message.amount != null && Object.hasOwnProperty.call(message, "amount")) - $root.cosmos.base.v1beta1.Coin.encode(message.amount, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified MsgBeginRedelegate message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.MsgBeginRedelegate.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.MsgBeginRedelegate - * @static - * @param {cosmos.staking.v1beta1.IMsgBeginRedelegate} message MsgBeginRedelegate message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgBeginRedelegate.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgBeginRedelegate message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.MsgBeginRedelegate - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.MsgBeginRedelegate} MsgBeginRedelegate - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgBeginRedelegate.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.MsgBeginRedelegate(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.delegator_address = reader.string(); - break; - case 2: - message.validator_src_address = reader.string(); - break; - case 3: - message.validator_dst_address = reader.string(); - break; - case 4: - message.amount = $root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgBeginRedelegate message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.MsgBeginRedelegate - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.MsgBeginRedelegate} MsgBeginRedelegate - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgBeginRedelegate.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgBeginRedelegate message. - * @function verify - * @memberof cosmos.staking.v1beta1.MsgBeginRedelegate - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgBeginRedelegate.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - if (!$util.isString(message.delegator_address)) - return "delegator_address: string expected"; - if (message.validator_src_address != null && message.hasOwnProperty("validator_src_address")) - if (!$util.isString(message.validator_src_address)) - return "validator_src_address: string expected"; - if (message.validator_dst_address != null && message.hasOwnProperty("validator_dst_address")) - if (!$util.isString(message.validator_dst_address)) - return "validator_dst_address: string expected"; - if (message.amount != null && message.hasOwnProperty("amount")) { - let error = $root.cosmos.base.v1beta1.Coin.verify(message.amount); - if (error) - return "amount." + error; - } - return null; - }; - - /** - * Creates a MsgBeginRedelegate message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.MsgBeginRedelegate - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.MsgBeginRedelegate} MsgBeginRedelegate - */ - MsgBeginRedelegate.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.MsgBeginRedelegate) - return object; - let message = new $root.cosmos.staking.v1beta1.MsgBeginRedelegate(); - if (object.delegator_address != null) - message.delegator_address = String(object.delegator_address); - if (object.validator_src_address != null) - message.validator_src_address = String(object.validator_src_address); - if (object.validator_dst_address != null) - message.validator_dst_address = String(object.validator_dst_address); - if (object.amount != null) { - if (typeof object.amount !== "object") - throw TypeError(".cosmos.staking.v1beta1.MsgBeginRedelegate.amount: object expected"); - message.amount = $root.cosmos.base.v1beta1.Coin.fromObject(object.amount); - } - return message; - }; - - /** - * Creates a plain object from a MsgBeginRedelegate message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.MsgBeginRedelegate - * @static - * @param {cosmos.staking.v1beta1.MsgBeginRedelegate} message MsgBeginRedelegate - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgBeginRedelegate.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.delegator_address = ""; - object.validator_src_address = ""; - object.validator_dst_address = ""; - object.amount = null; - } - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - object.delegator_address = message.delegator_address; - if (message.validator_src_address != null && message.hasOwnProperty("validator_src_address")) - object.validator_src_address = message.validator_src_address; - if (message.validator_dst_address != null && message.hasOwnProperty("validator_dst_address")) - object.validator_dst_address = message.validator_dst_address; - if (message.amount != null && message.hasOwnProperty("amount")) - object.amount = $root.cosmos.base.v1beta1.Coin.toObject(message.amount, options); - return object; - }; - - /** - * Converts this MsgBeginRedelegate to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.MsgBeginRedelegate - * @instance - * @returns {Object.} JSON object - */ - MsgBeginRedelegate.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgBeginRedelegate; - })(); - - v1beta1.MsgBeginRedelegateResponse = (function() { - - /** - * Properties of a MsgBeginRedelegateResponse. - * @memberof cosmos.staking.v1beta1 - * @interface IMsgBeginRedelegateResponse - * @property {google.protobuf.ITimestamp|null} [completion_time] MsgBeginRedelegateResponse completion_time - */ - - /** - * Constructs a new MsgBeginRedelegateResponse. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a MsgBeginRedelegateResponse. - * @implements IMsgBeginRedelegateResponse - * @constructor - * @param {cosmos.staking.v1beta1.IMsgBeginRedelegateResponse=} [properties] Properties to set - */ - function MsgBeginRedelegateResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgBeginRedelegateResponse completion_time. - * @member {google.protobuf.ITimestamp|null|undefined} completion_time - * @memberof cosmos.staking.v1beta1.MsgBeginRedelegateResponse - * @instance - */ - MsgBeginRedelegateResponse.prototype.completion_time = null; - - /** - * Encodes the specified MsgBeginRedelegateResponse message. Does not implicitly {@link cosmos.staking.v1beta1.MsgBeginRedelegateResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.MsgBeginRedelegateResponse - * @static - * @param {cosmos.staking.v1beta1.IMsgBeginRedelegateResponse} message MsgBeginRedelegateResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgBeginRedelegateResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.completion_time != null && Object.hasOwnProperty.call(message, "completion_time")) - $root.google.protobuf.Timestamp.encode(message.completion_time, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified MsgBeginRedelegateResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.MsgBeginRedelegateResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.MsgBeginRedelegateResponse - * @static - * @param {cosmos.staking.v1beta1.IMsgBeginRedelegateResponse} message MsgBeginRedelegateResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgBeginRedelegateResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgBeginRedelegateResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.MsgBeginRedelegateResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.MsgBeginRedelegateResponse} MsgBeginRedelegateResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgBeginRedelegateResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.MsgBeginRedelegateResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.completion_time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgBeginRedelegateResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.MsgBeginRedelegateResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.MsgBeginRedelegateResponse} MsgBeginRedelegateResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgBeginRedelegateResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgBeginRedelegateResponse message. - * @function verify - * @memberof cosmos.staking.v1beta1.MsgBeginRedelegateResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgBeginRedelegateResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.completion_time != null && message.hasOwnProperty("completion_time")) { - let error = $root.google.protobuf.Timestamp.verify(message.completion_time); - if (error) - return "completion_time." + error; - } - return null; - }; - - /** - * Creates a MsgBeginRedelegateResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.MsgBeginRedelegateResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.MsgBeginRedelegateResponse} MsgBeginRedelegateResponse - */ - MsgBeginRedelegateResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.MsgBeginRedelegateResponse) - return object; - let message = new $root.cosmos.staking.v1beta1.MsgBeginRedelegateResponse(); - if (object.completion_time != null) { - if (typeof object.completion_time !== "object") - throw TypeError(".cosmos.staking.v1beta1.MsgBeginRedelegateResponse.completion_time: object expected"); - message.completion_time = $root.google.protobuf.Timestamp.fromObject(object.completion_time); - } - return message; - }; - - /** - * Creates a plain object from a MsgBeginRedelegateResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.MsgBeginRedelegateResponse - * @static - * @param {cosmos.staking.v1beta1.MsgBeginRedelegateResponse} message MsgBeginRedelegateResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgBeginRedelegateResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.completion_time = null; - if (message.completion_time != null && message.hasOwnProperty("completion_time")) - object.completion_time = $root.google.protobuf.Timestamp.toObject(message.completion_time, options); - return object; - }; - - /** - * Converts this MsgBeginRedelegateResponse to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.MsgBeginRedelegateResponse - * @instance - * @returns {Object.} JSON object - */ - MsgBeginRedelegateResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgBeginRedelegateResponse; - })(); - - v1beta1.MsgUndelegate = (function() { - - /** - * Properties of a MsgUndelegate. - * @memberof cosmos.staking.v1beta1 - * @interface IMsgUndelegate - * @property {string|null} [delegator_address] MsgUndelegate delegator_address - * @property {string|null} [validator_address] MsgUndelegate validator_address - * @property {cosmos.base.v1beta1.ICoin|null} [amount] MsgUndelegate amount - */ - - /** - * Constructs a new MsgUndelegate. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a MsgUndelegate. - * @implements IMsgUndelegate - * @constructor - * @param {cosmos.staking.v1beta1.IMsgUndelegate=} [properties] Properties to set - */ - function MsgUndelegate(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgUndelegate delegator_address. - * @member {string} delegator_address - * @memberof cosmos.staking.v1beta1.MsgUndelegate - * @instance - */ - MsgUndelegate.prototype.delegator_address = ""; - - /** - * MsgUndelegate validator_address. - * @member {string} validator_address - * @memberof cosmos.staking.v1beta1.MsgUndelegate - * @instance - */ - MsgUndelegate.prototype.validator_address = ""; - - /** - * MsgUndelegate amount. - * @member {cosmos.base.v1beta1.ICoin|null|undefined} amount - * @memberof cosmos.staking.v1beta1.MsgUndelegate - * @instance - */ - MsgUndelegate.prototype.amount = null; - - /** - * Encodes the specified MsgUndelegate message. Does not implicitly {@link cosmos.staking.v1beta1.MsgUndelegate.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.MsgUndelegate - * @static - * @param {cosmos.staking.v1beta1.IMsgUndelegate} message MsgUndelegate message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgUndelegate.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); - if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.validator_address); - if (message.amount != null && Object.hasOwnProperty.call(message, "amount")) - $root.cosmos.base.v1beta1.Coin.encode(message.amount, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified MsgUndelegate message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.MsgUndelegate.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.MsgUndelegate - * @static - * @param {cosmos.staking.v1beta1.IMsgUndelegate} message MsgUndelegate message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgUndelegate.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgUndelegate message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.MsgUndelegate - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.MsgUndelegate} MsgUndelegate - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgUndelegate.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.MsgUndelegate(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.delegator_address = reader.string(); - break; - case 2: - message.validator_address = reader.string(); - break; - case 3: - message.amount = $root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgUndelegate message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.MsgUndelegate - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.MsgUndelegate} MsgUndelegate - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgUndelegate.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgUndelegate message. - * @function verify - * @memberof cosmos.staking.v1beta1.MsgUndelegate - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgUndelegate.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - if (!$util.isString(message.delegator_address)) - return "delegator_address: string expected"; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - if (!$util.isString(message.validator_address)) - return "validator_address: string expected"; - if (message.amount != null && message.hasOwnProperty("amount")) { - let error = $root.cosmos.base.v1beta1.Coin.verify(message.amount); - if (error) - return "amount." + error; - } - return null; - }; - - /** - * Creates a MsgUndelegate message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.MsgUndelegate - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.MsgUndelegate} MsgUndelegate - */ - MsgUndelegate.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.MsgUndelegate) - return object; - let message = new $root.cosmos.staking.v1beta1.MsgUndelegate(); - if (object.delegator_address != null) - message.delegator_address = String(object.delegator_address); - if (object.validator_address != null) - message.validator_address = String(object.validator_address); - if (object.amount != null) { - if (typeof object.amount !== "object") - throw TypeError(".cosmos.staking.v1beta1.MsgUndelegate.amount: object expected"); - message.amount = $root.cosmos.base.v1beta1.Coin.fromObject(object.amount); - } - return message; - }; - - /** - * Creates a plain object from a MsgUndelegate message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.MsgUndelegate - * @static - * @param {cosmos.staking.v1beta1.MsgUndelegate} message MsgUndelegate - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgUndelegate.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.delegator_address = ""; - object.validator_address = ""; - object.amount = null; - } - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - object.delegator_address = message.delegator_address; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - object.validator_address = message.validator_address; - if (message.amount != null && message.hasOwnProperty("amount")) - object.amount = $root.cosmos.base.v1beta1.Coin.toObject(message.amount, options); - return object; - }; - - /** - * Converts this MsgUndelegate to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.MsgUndelegate - * @instance - * @returns {Object.} JSON object - */ - MsgUndelegate.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgUndelegate; - })(); - - v1beta1.MsgUndelegateResponse = (function() { - - /** - * Properties of a MsgUndelegateResponse. - * @memberof cosmos.staking.v1beta1 - * @interface IMsgUndelegateResponse - * @property {google.protobuf.ITimestamp|null} [completion_time] MsgUndelegateResponse completion_time - */ - - /** - * Constructs a new MsgUndelegateResponse. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a MsgUndelegateResponse. - * @implements IMsgUndelegateResponse - * @constructor - * @param {cosmos.staking.v1beta1.IMsgUndelegateResponse=} [properties] Properties to set - */ - function MsgUndelegateResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgUndelegateResponse completion_time. - * @member {google.protobuf.ITimestamp|null|undefined} completion_time - * @memberof cosmos.staking.v1beta1.MsgUndelegateResponse - * @instance - */ - MsgUndelegateResponse.prototype.completion_time = null; - - /** - * Encodes the specified MsgUndelegateResponse message. Does not implicitly {@link cosmos.staking.v1beta1.MsgUndelegateResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.MsgUndelegateResponse - * @static - * @param {cosmos.staking.v1beta1.IMsgUndelegateResponse} message MsgUndelegateResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgUndelegateResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.completion_time != null && Object.hasOwnProperty.call(message, "completion_time")) - $root.google.protobuf.Timestamp.encode(message.completion_time, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified MsgUndelegateResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.MsgUndelegateResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.MsgUndelegateResponse - * @static - * @param {cosmos.staking.v1beta1.IMsgUndelegateResponse} message MsgUndelegateResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgUndelegateResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgUndelegateResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.MsgUndelegateResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.MsgUndelegateResponse} MsgUndelegateResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgUndelegateResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.MsgUndelegateResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.completion_time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgUndelegateResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.MsgUndelegateResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.MsgUndelegateResponse} MsgUndelegateResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgUndelegateResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgUndelegateResponse message. - * @function verify - * @memberof cosmos.staking.v1beta1.MsgUndelegateResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgUndelegateResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.completion_time != null && message.hasOwnProperty("completion_time")) { - let error = $root.google.protobuf.Timestamp.verify(message.completion_time); - if (error) - return "completion_time." + error; - } - return null; - }; - - /** - * Creates a MsgUndelegateResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.MsgUndelegateResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.MsgUndelegateResponse} MsgUndelegateResponse - */ - MsgUndelegateResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.MsgUndelegateResponse) - return object; - let message = new $root.cosmos.staking.v1beta1.MsgUndelegateResponse(); - if (object.completion_time != null) { - if (typeof object.completion_time !== "object") - throw TypeError(".cosmos.staking.v1beta1.MsgUndelegateResponse.completion_time: object expected"); - message.completion_time = $root.google.protobuf.Timestamp.fromObject(object.completion_time); - } - return message; - }; - - /** - * Creates a plain object from a MsgUndelegateResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.MsgUndelegateResponse - * @static - * @param {cosmos.staking.v1beta1.MsgUndelegateResponse} message MsgUndelegateResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgUndelegateResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.completion_time = null; - if (message.completion_time != null && message.hasOwnProperty("completion_time")) - object.completion_time = $root.google.protobuf.Timestamp.toObject(message.completion_time, options); - return object; - }; - - /** - * Converts this MsgUndelegateResponse to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.MsgUndelegateResponse - * @instance - * @returns {Object.} JSON object - */ - MsgUndelegateResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgUndelegateResponse; - })(); - - v1beta1.Query = (function() { - - /** - * Constructs a new Query service. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a Query - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function Query(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Query.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Query; - - /** - * Callback as used by {@link cosmos.staking.v1beta1.Query#validators}. - * @memberof cosmos.staking.v1beta1.Query - * @typedef ValidatorsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.staking.v1beta1.QueryValidatorsResponse} [response] QueryValidatorsResponse - */ - - /** - * Calls Validators. - * @function validators - * @memberof cosmos.staking.v1beta1.Query - * @instance - * @param {cosmos.staking.v1beta1.IQueryValidatorsRequest} request QueryValidatorsRequest message or plain object - * @param {cosmos.staking.v1beta1.Query.ValidatorsCallback} callback Node-style callback called with the error, if any, and QueryValidatorsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.validators = function validators(request, callback) { - return this.rpcCall(validators, $root.cosmos.staking.v1beta1.QueryValidatorsRequest, $root.cosmos.staking.v1beta1.QueryValidatorsResponse, request, callback); - }, "name", { value: "Validators" }); - - /** - * Calls Validators. - * @function validators - * @memberof cosmos.staking.v1beta1.Query - * @instance - * @param {cosmos.staking.v1beta1.IQueryValidatorsRequest} request QueryValidatorsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.staking.v1beta1.Query#validator}. - * @memberof cosmos.staking.v1beta1.Query - * @typedef ValidatorCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.staking.v1beta1.QueryValidatorResponse} [response] QueryValidatorResponse - */ - - /** - * Calls Validator. - * @function validator - * @memberof cosmos.staking.v1beta1.Query - * @instance - * @param {cosmos.staking.v1beta1.IQueryValidatorRequest} request QueryValidatorRequest message or plain object - * @param {cosmos.staking.v1beta1.Query.ValidatorCallback} callback Node-style callback called with the error, if any, and QueryValidatorResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.validator = function validator(request, callback) { - return this.rpcCall(validator, $root.cosmos.staking.v1beta1.QueryValidatorRequest, $root.cosmos.staking.v1beta1.QueryValidatorResponse, request, callback); - }, "name", { value: "Validator" }); - - /** - * Calls Validator. - * @function validator - * @memberof cosmos.staking.v1beta1.Query - * @instance - * @param {cosmos.staking.v1beta1.IQueryValidatorRequest} request QueryValidatorRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.staking.v1beta1.Query#validatorDelegations}. - * @memberof cosmos.staking.v1beta1.Query - * @typedef ValidatorDelegationsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.staking.v1beta1.QueryValidatorDelegationsResponse} [response] QueryValidatorDelegationsResponse - */ - - /** - * Calls ValidatorDelegations. - * @function validatorDelegations - * @memberof cosmos.staking.v1beta1.Query - * @instance - * @param {cosmos.staking.v1beta1.IQueryValidatorDelegationsRequest} request QueryValidatorDelegationsRequest message or plain object - * @param {cosmos.staking.v1beta1.Query.ValidatorDelegationsCallback} callback Node-style callback called with the error, if any, and QueryValidatorDelegationsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.validatorDelegations = function validatorDelegations(request, callback) { - return this.rpcCall(validatorDelegations, $root.cosmos.staking.v1beta1.QueryValidatorDelegationsRequest, $root.cosmos.staking.v1beta1.QueryValidatorDelegationsResponse, request, callback); - }, "name", { value: "ValidatorDelegations" }); - - /** - * Calls ValidatorDelegations. - * @function validatorDelegations - * @memberof cosmos.staking.v1beta1.Query - * @instance - * @param {cosmos.staking.v1beta1.IQueryValidatorDelegationsRequest} request QueryValidatorDelegationsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.staking.v1beta1.Query#validatorUnbondingDelegations}. - * @memberof cosmos.staking.v1beta1.Query - * @typedef ValidatorUnbondingDelegationsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse} [response] QueryValidatorUnbondingDelegationsResponse - */ - - /** - * Calls ValidatorUnbondingDelegations. - * @function validatorUnbondingDelegations - * @memberof cosmos.staking.v1beta1.Query - * @instance - * @param {cosmos.staking.v1beta1.IQueryValidatorUnbondingDelegationsRequest} request QueryValidatorUnbondingDelegationsRequest message or plain object - * @param {cosmos.staking.v1beta1.Query.ValidatorUnbondingDelegationsCallback} callback Node-style callback called with the error, if any, and QueryValidatorUnbondingDelegationsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.validatorUnbondingDelegations = function validatorUnbondingDelegations(request, callback) { - return this.rpcCall(validatorUnbondingDelegations, $root.cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest, $root.cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse, request, callback); - }, "name", { value: "ValidatorUnbondingDelegations" }); - - /** - * Calls ValidatorUnbondingDelegations. - * @function validatorUnbondingDelegations - * @memberof cosmos.staking.v1beta1.Query - * @instance - * @param {cosmos.staking.v1beta1.IQueryValidatorUnbondingDelegationsRequest} request QueryValidatorUnbondingDelegationsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.staking.v1beta1.Query#delegation}. - * @memberof cosmos.staking.v1beta1.Query - * @typedef DelegationCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.staking.v1beta1.QueryDelegationResponse} [response] QueryDelegationResponse - */ - - /** - * Calls Delegation. - * @function delegation - * @memberof cosmos.staking.v1beta1.Query - * @instance - * @param {cosmos.staking.v1beta1.IQueryDelegationRequest} request QueryDelegationRequest message or plain object - * @param {cosmos.staking.v1beta1.Query.DelegationCallback} callback Node-style callback called with the error, if any, and QueryDelegationResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.delegation = function delegation(request, callback) { - return this.rpcCall(delegation, $root.cosmos.staking.v1beta1.QueryDelegationRequest, $root.cosmos.staking.v1beta1.QueryDelegationResponse, request, callback); - }, "name", { value: "Delegation" }); - - /** - * Calls Delegation. - * @function delegation - * @memberof cosmos.staking.v1beta1.Query - * @instance - * @param {cosmos.staking.v1beta1.IQueryDelegationRequest} request QueryDelegationRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.staking.v1beta1.Query#unbondingDelegation}. - * @memberof cosmos.staking.v1beta1.Query - * @typedef UnbondingDelegationCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.staking.v1beta1.QueryUnbondingDelegationResponse} [response] QueryUnbondingDelegationResponse - */ - - /** - * Calls UnbondingDelegation. - * @function unbondingDelegation - * @memberof cosmos.staking.v1beta1.Query - * @instance - * @param {cosmos.staking.v1beta1.IQueryUnbondingDelegationRequest} request QueryUnbondingDelegationRequest message or plain object - * @param {cosmos.staking.v1beta1.Query.UnbondingDelegationCallback} callback Node-style callback called with the error, if any, and QueryUnbondingDelegationResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.unbondingDelegation = function unbondingDelegation(request, callback) { - return this.rpcCall(unbondingDelegation, $root.cosmos.staking.v1beta1.QueryUnbondingDelegationRequest, $root.cosmos.staking.v1beta1.QueryUnbondingDelegationResponse, request, callback); - }, "name", { value: "UnbondingDelegation" }); - - /** - * Calls UnbondingDelegation. - * @function unbondingDelegation - * @memberof cosmos.staking.v1beta1.Query - * @instance - * @param {cosmos.staking.v1beta1.IQueryUnbondingDelegationRequest} request QueryUnbondingDelegationRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.staking.v1beta1.Query#delegatorDelegations}. - * @memberof cosmos.staking.v1beta1.Query - * @typedef DelegatorDelegationsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse} [response] QueryDelegatorDelegationsResponse - */ - - /** - * Calls DelegatorDelegations. - * @function delegatorDelegations - * @memberof cosmos.staking.v1beta1.Query - * @instance - * @param {cosmos.staking.v1beta1.IQueryDelegatorDelegationsRequest} request QueryDelegatorDelegationsRequest message or plain object - * @param {cosmos.staking.v1beta1.Query.DelegatorDelegationsCallback} callback Node-style callback called with the error, if any, and QueryDelegatorDelegationsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.delegatorDelegations = function delegatorDelegations(request, callback) { - return this.rpcCall(delegatorDelegations, $root.cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest, $root.cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse, request, callback); - }, "name", { value: "DelegatorDelegations" }); - - /** - * Calls DelegatorDelegations. - * @function delegatorDelegations - * @memberof cosmos.staking.v1beta1.Query - * @instance - * @param {cosmos.staking.v1beta1.IQueryDelegatorDelegationsRequest} request QueryDelegatorDelegationsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.staking.v1beta1.Query#delegatorUnbondingDelegations}. - * @memberof cosmos.staking.v1beta1.Query - * @typedef DelegatorUnbondingDelegationsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse} [response] QueryDelegatorUnbondingDelegationsResponse - */ - - /** - * Calls DelegatorUnbondingDelegations. - * @function delegatorUnbondingDelegations - * @memberof cosmos.staking.v1beta1.Query - * @instance - * @param {cosmos.staking.v1beta1.IQueryDelegatorUnbondingDelegationsRequest} request QueryDelegatorUnbondingDelegationsRequest message or plain object - * @param {cosmos.staking.v1beta1.Query.DelegatorUnbondingDelegationsCallback} callback Node-style callback called with the error, if any, and QueryDelegatorUnbondingDelegationsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.delegatorUnbondingDelegations = function delegatorUnbondingDelegations(request, callback) { - return this.rpcCall(delegatorUnbondingDelegations, $root.cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest, $root.cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse, request, callback); - }, "name", { value: "DelegatorUnbondingDelegations" }); - - /** - * Calls DelegatorUnbondingDelegations. - * @function delegatorUnbondingDelegations - * @memberof cosmos.staking.v1beta1.Query - * @instance - * @param {cosmos.staking.v1beta1.IQueryDelegatorUnbondingDelegationsRequest} request QueryDelegatorUnbondingDelegationsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.staking.v1beta1.Query#redelegations}. - * @memberof cosmos.staking.v1beta1.Query - * @typedef RedelegationsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.staking.v1beta1.QueryRedelegationsResponse} [response] QueryRedelegationsResponse - */ - - /** - * Calls Redelegations. - * @function redelegations - * @memberof cosmos.staking.v1beta1.Query - * @instance - * @param {cosmos.staking.v1beta1.IQueryRedelegationsRequest} request QueryRedelegationsRequest message or plain object - * @param {cosmos.staking.v1beta1.Query.RedelegationsCallback} callback Node-style callback called with the error, if any, and QueryRedelegationsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.redelegations = function redelegations(request, callback) { - return this.rpcCall(redelegations, $root.cosmos.staking.v1beta1.QueryRedelegationsRequest, $root.cosmos.staking.v1beta1.QueryRedelegationsResponse, request, callback); - }, "name", { value: "Redelegations" }); - - /** - * Calls Redelegations. - * @function redelegations - * @memberof cosmos.staking.v1beta1.Query - * @instance - * @param {cosmos.staking.v1beta1.IQueryRedelegationsRequest} request QueryRedelegationsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.staking.v1beta1.Query#delegatorValidators}. - * @memberof cosmos.staking.v1beta1.Query - * @typedef DelegatorValidatorsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse} [response] QueryDelegatorValidatorsResponse - */ - - /** - * Calls DelegatorValidators. - * @function delegatorValidators - * @memberof cosmos.staking.v1beta1.Query - * @instance - * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorsRequest} request QueryDelegatorValidatorsRequest message or plain object - * @param {cosmos.staking.v1beta1.Query.DelegatorValidatorsCallback} callback Node-style callback called with the error, if any, and QueryDelegatorValidatorsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.delegatorValidators = function delegatorValidators(request, callback) { - return this.rpcCall(delegatorValidators, $root.cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest, $root.cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse, request, callback); - }, "name", { value: "DelegatorValidators" }); - - /** - * Calls DelegatorValidators. - * @function delegatorValidators - * @memberof cosmos.staking.v1beta1.Query - * @instance - * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorsRequest} request QueryDelegatorValidatorsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.staking.v1beta1.Query#delegatorValidator}. - * @memberof cosmos.staking.v1beta1.Query - * @typedef DelegatorValidatorCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.staking.v1beta1.QueryDelegatorValidatorResponse} [response] QueryDelegatorValidatorResponse - */ - - /** - * Calls DelegatorValidator. - * @function delegatorValidator - * @memberof cosmos.staking.v1beta1.Query - * @instance - * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorRequest} request QueryDelegatorValidatorRequest message or plain object - * @param {cosmos.staking.v1beta1.Query.DelegatorValidatorCallback} callback Node-style callback called with the error, if any, and QueryDelegatorValidatorResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.delegatorValidator = function delegatorValidator(request, callback) { - return this.rpcCall(delegatorValidator, $root.cosmos.staking.v1beta1.QueryDelegatorValidatorRequest, $root.cosmos.staking.v1beta1.QueryDelegatorValidatorResponse, request, callback); - }, "name", { value: "DelegatorValidator" }); - - /** - * Calls DelegatorValidator. - * @function delegatorValidator - * @memberof cosmos.staking.v1beta1.Query - * @instance - * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorRequest} request QueryDelegatorValidatorRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.staking.v1beta1.Query#historicalInfo}. - * @memberof cosmos.staking.v1beta1.Query - * @typedef HistoricalInfoCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.staking.v1beta1.QueryHistoricalInfoResponse} [response] QueryHistoricalInfoResponse - */ - - /** - * Calls HistoricalInfo. - * @function historicalInfo - * @memberof cosmos.staking.v1beta1.Query - * @instance - * @param {cosmos.staking.v1beta1.IQueryHistoricalInfoRequest} request QueryHistoricalInfoRequest message or plain object - * @param {cosmos.staking.v1beta1.Query.HistoricalInfoCallback} callback Node-style callback called with the error, if any, and QueryHistoricalInfoResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.historicalInfo = function historicalInfo(request, callback) { - return this.rpcCall(historicalInfo, $root.cosmos.staking.v1beta1.QueryHistoricalInfoRequest, $root.cosmos.staking.v1beta1.QueryHistoricalInfoResponse, request, callback); - }, "name", { value: "HistoricalInfo" }); - - /** - * Calls HistoricalInfo. - * @function historicalInfo - * @memberof cosmos.staking.v1beta1.Query - * @instance - * @param {cosmos.staking.v1beta1.IQueryHistoricalInfoRequest} request QueryHistoricalInfoRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.staking.v1beta1.Query#pool}. - * @memberof cosmos.staking.v1beta1.Query - * @typedef PoolCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.staking.v1beta1.QueryPoolResponse} [response] QueryPoolResponse - */ - - /** - * Calls Pool. - * @function pool - * @memberof cosmos.staking.v1beta1.Query - * @instance - * @param {cosmos.staking.v1beta1.IQueryPoolRequest} request QueryPoolRequest message or plain object - * @param {cosmos.staking.v1beta1.Query.PoolCallback} callback Node-style callback called with the error, if any, and QueryPoolResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.pool = function pool(request, callback) { - return this.rpcCall(pool, $root.cosmos.staking.v1beta1.QueryPoolRequest, $root.cosmos.staking.v1beta1.QueryPoolResponse, request, callback); - }, "name", { value: "Pool" }); - - /** - * Calls Pool. - * @function pool - * @memberof cosmos.staking.v1beta1.Query - * @instance - * @param {cosmos.staking.v1beta1.IQueryPoolRequest} request QueryPoolRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.staking.v1beta1.Query#params}. - * @memberof cosmos.staking.v1beta1.Query - * @typedef ParamsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.staking.v1beta1.QueryParamsResponse} [response] QueryParamsResponse - */ - - /** - * Calls Params. - * @function params - * @memberof cosmos.staking.v1beta1.Query - * @instance - * @param {cosmos.staking.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object - * @param {cosmos.staking.v1beta1.Query.ParamsCallback} callback Node-style callback called with the error, if any, and QueryParamsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.params = function params(request, callback) { - return this.rpcCall(params, $root.cosmos.staking.v1beta1.QueryParamsRequest, $root.cosmos.staking.v1beta1.QueryParamsResponse, request, callback); - }, "name", { value: "Params" }); - - /** - * Calls Params. - * @function params - * @memberof cosmos.staking.v1beta1.Query - * @instance - * @param {cosmos.staking.v1beta1.IQueryParamsRequest} request QueryParamsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return Query; - })(); - - v1beta1.QueryValidatorsRequest = (function() { - - /** - * Properties of a QueryValidatorsRequest. - * @memberof cosmos.staking.v1beta1 - * @interface IQueryValidatorsRequest - * @property {string|null} [status] QueryValidatorsRequest status - * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryValidatorsRequest pagination - */ - - /** - * Constructs a new QueryValidatorsRequest. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a QueryValidatorsRequest. - * @implements IQueryValidatorsRequest - * @constructor - * @param {cosmos.staking.v1beta1.IQueryValidatorsRequest=} [properties] Properties to set - */ - function QueryValidatorsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryValidatorsRequest status. - * @member {string} status - * @memberof cosmos.staking.v1beta1.QueryValidatorsRequest - * @instance - */ - QueryValidatorsRequest.prototype.status = ""; - - /** - * QueryValidatorsRequest pagination. - * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination - * @memberof cosmos.staking.v1beta1.QueryValidatorsRequest - * @instance - */ - QueryValidatorsRequest.prototype.pagination = null; - - /** - * Encodes the specified QueryValidatorsRequest message. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorsRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.QueryValidatorsRequest - * @static - * @param {cosmos.staking.v1beta1.IQueryValidatorsRequest} message QueryValidatorsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryValidatorsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.status != null && Object.hasOwnProperty.call(message, "status")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.status); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryValidatorsRequest message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.QueryValidatorsRequest - * @static - * @param {cosmos.staking.v1beta1.IQueryValidatorsRequest} message QueryValidatorsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryValidatorsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryValidatorsRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.QueryValidatorsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.QueryValidatorsRequest} QueryValidatorsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryValidatorsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryValidatorsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.status = reader.string(); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryValidatorsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.QueryValidatorsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.QueryValidatorsRequest} QueryValidatorsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryValidatorsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryValidatorsRequest message. - * @function verify - * @memberof cosmos.staking.v1beta1.QueryValidatorsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryValidatorsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.status != null && message.hasOwnProperty("status")) - if (!$util.isString(message.status)) - return "status: string expected"; - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryValidatorsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.QueryValidatorsRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.QueryValidatorsRequest} QueryValidatorsRequest - */ - QueryValidatorsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.QueryValidatorsRequest) - return object; - let message = new $root.cosmos.staking.v1beta1.QueryValidatorsRequest(); - if (object.status != null) - message.status = String(object.status); - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.staking.v1beta1.QueryValidatorsRequest.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryValidatorsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.QueryValidatorsRequest - * @static - * @param {cosmos.staking.v1beta1.QueryValidatorsRequest} message QueryValidatorsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryValidatorsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.status = ""; - object.pagination = null; - } - if (message.status != null && message.hasOwnProperty("status")) - object.status = message.status; - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryValidatorsRequest to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.QueryValidatorsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryValidatorsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryValidatorsRequest; - })(); - - v1beta1.QueryValidatorsResponse = (function() { - - /** - * Properties of a QueryValidatorsResponse. - * @memberof cosmos.staking.v1beta1 - * @interface IQueryValidatorsResponse - * @property {Array.|null} [validators] QueryValidatorsResponse validators - * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryValidatorsResponse pagination - */ - - /** - * Constructs a new QueryValidatorsResponse. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a QueryValidatorsResponse. - * @implements IQueryValidatorsResponse - * @constructor - * @param {cosmos.staking.v1beta1.IQueryValidatorsResponse=} [properties] Properties to set - */ - function QueryValidatorsResponse(properties) { - this.validators = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryValidatorsResponse validators. - * @member {Array.} validators - * @memberof cosmos.staking.v1beta1.QueryValidatorsResponse - * @instance - */ - QueryValidatorsResponse.prototype.validators = $util.emptyArray; - - /** - * QueryValidatorsResponse pagination. - * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination - * @memberof cosmos.staking.v1beta1.QueryValidatorsResponse - * @instance - */ - QueryValidatorsResponse.prototype.pagination = null; - - /** - * Encodes the specified QueryValidatorsResponse message. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorsResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.QueryValidatorsResponse - * @static - * @param {cosmos.staking.v1beta1.IQueryValidatorsResponse} message QueryValidatorsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryValidatorsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.validators != null && message.validators.length) - for (let i = 0; i < message.validators.length; ++i) - $root.cosmos.staking.v1beta1.Validator.encode(message.validators[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryValidatorsResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.QueryValidatorsResponse - * @static - * @param {cosmos.staking.v1beta1.IQueryValidatorsResponse} message QueryValidatorsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryValidatorsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryValidatorsResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.QueryValidatorsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.QueryValidatorsResponse} QueryValidatorsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryValidatorsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryValidatorsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.validators && message.validators.length)) - message.validators = []; - message.validators.push($root.cosmos.staking.v1beta1.Validator.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryValidatorsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.QueryValidatorsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.QueryValidatorsResponse} QueryValidatorsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryValidatorsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryValidatorsResponse message. - * @function verify - * @memberof cosmos.staking.v1beta1.QueryValidatorsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryValidatorsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.validators != null && message.hasOwnProperty("validators")) { - if (!Array.isArray(message.validators)) - return "validators: array expected"; - for (let i = 0; i < message.validators.length; ++i) { - let error = $root.cosmos.staking.v1beta1.Validator.verify(message.validators[i]); - if (error) - return "validators." + error; - } - } - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryValidatorsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.QueryValidatorsResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.QueryValidatorsResponse} QueryValidatorsResponse - */ - QueryValidatorsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.QueryValidatorsResponse) - return object; - let message = new $root.cosmos.staking.v1beta1.QueryValidatorsResponse(); - if (object.validators) { - if (!Array.isArray(object.validators)) - throw TypeError(".cosmos.staking.v1beta1.QueryValidatorsResponse.validators: array expected"); - message.validators = []; - for (let i = 0; i < object.validators.length; ++i) { - if (typeof object.validators[i] !== "object") - throw TypeError(".cosmos.staking.v1beta1.QueryValidatorsResponse.validators: object expected"); - message.validators[i] = $root.cosmos.staking.v1beta1.Validator.fromObject(object.validators[i]); - } - } - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.staking.v1beta1.QueryValidatorsResponse.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryValidatorsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.QueryValidatorsResponse - * @static - * @param {cosmos.staking.v1beta1.QueryValidatorsResponse} message QueryValidatorsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryValidatorsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.validators = []; - if (options.defaults) - object.pagination = null; - if (message.validators && message.validators.length) { - object.validators = []; - for (let j = 0; j < message.validators.length; ++j) - object.validators[j] = $root.cosmos.staking.v1beta1.Validator.toObject(message.validators[j], options); - } - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryValidatorsResponse to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.QueryValidatorsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryValidatorsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryValidatorsResponse; - })(); - - v1beta1.QueryValidatorRequest = (function() { - - /** - * Properties of a QueryValidatorRequest. - * @memberof cosmos.staking.v1beta1 - * @interface IQueryValidatorRequest - * @property {string|null} [validator_addr] QueryValidatorRequest validator_addr - */ - - /** - * Constructs a new QueryValidatorRequest. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a QueryValidatorRequest. - * @implements IQueryValidatorRequest - * @constructor - * @param {cosmos.staking.v1beta1.IQueryValidatorRequest=} [properties] Properties to set - */ - function QueryValidatorRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryValidatorRequest validator_addr. - * @member {string} validator_addr - * @memberof cosmos.staking.v1beta1.QueryValidatorRequest - * @instance - */ - QueryValidatorRequest.prototype.validator_addr = ""; - - /** - * Encodes the specified QueryValidatorRequest message. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.QueryValidatorRequest - * @static - * @param {cosmos.staking.v1beta1.IQueryValidatorRequest} message QueryValidatorRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryValidatorRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.validator_addr != null && Object.hasOwnProperty.call(message, "validator_addr")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.validator_addr); - return writer; - }; - - /** - * Encodes the specified QueryValidatorRequest message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.QueryValidatorRequest - * @static - * @param {cosmos.staking.v1beta1.IQueryValidatorRequest} message QueryValidatorRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryValidatorRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryValidatorRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.QueryValidatorRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.QueryValidatorRequest} QueryValidatorRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryValidatorRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryValidatorRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.validator_addr = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryValidatorRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.QueryValidatorRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.QueryValidatorRequest} QueryValidatorRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryValidatorRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryValidatorRequest message. - * @function verify - * @memberof cosmos.staking.v1beta1.QueryValidatorRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryValidatorRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.validator_addr != null && message.hasOwnProperty("validator_addr")) - if (!$util.isString(message.validator_addr)) - return "validator_addr: string expected"; - return null; - }; - - /** - * Creates a QueryValidatorRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.QueryValidatorRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.QueryValidatorRequest} QueryValidatorRequest - */ - QueryValidatorRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.QueryValidatorRequest) - return object; - let message = new $root.cosmos.staking.v1beta1.QueryValidatorRequest(); - if (object.validator_addr != null) - message.validator_addr = String(object.validator_addr); - return message; - }; - - /** - * Creates a plain object from a QueryValidatorRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.QueryValidatorRequest - * @static - * @param {cosmos.staking.v1beta1.QueryValidatorRequest} message QueryValidatorRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryValidatorRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.validator_addr = ""; - if (message.validator_addr != null && message.hasOwnProperty("validator_addr")) - object.validator_addr = message.validator_addr; - return object; - }; - - /** - * Converts this QueryValidatorRequest to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.QueryValidatorRequest - * @instance - * @returns {Object.} JSON object - */ - QueryValidatorRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryValidatorRequest; - })(); - - v1beta1.QueryValidatorResponse = (function() { - - /** - * Properties of a QueryValidatorResponse. - * @memberof cosmos.staking.v1beta1 - * @interface IQueryValidatorResponse - * @property {cosmos.staking.v1beta1.IValidator|null} [validator] QueryValidatorResponse validator - */ - - /** - * Constructs a new QueryValidatorResponse. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a QueryValidatorResponse. - * @implements IQueryValidatorResponse - * @constructor - * @param {cosmos.staking.v1beta1.IQueryValidatorResponse=} [properties] Properties to set - */ - function QueryValidatorResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryValidatorResponse validator. - * @member {cosmos.staking.v1beta1.IValidator|null|undefined} validator - * @memberof cosmos.staking.v1beta1.QueryValidatorResponse - * @instance - */ - QueryValidatorResponse.prototype.validator = null; - - /** - * Encodes the specified QueryValidatorResponse message. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.QueryValidatorResponse - * @static - * @param {cosmos.staking.v1beta1.IQueryValidatorResponse} message QueryValidatorResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryValidatorResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.validator != null && Object.hasOwnProperty.call(message, "validator")) - $root.cosmos.staking.v1beta1.Validator.encode(message.validator, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryValidatorResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.QueryValidatorResponse - * @static - * @param {cosmos.staking.v1beta1.IQueryValidatorResponse} message QueryValidatorResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryValidatorResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryValidatorResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.QueryValidatorResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.QueryValidatorResponse} QueryValidatorResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryValidatorResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryValidatorResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.validator = $root.cosmos.staking.v1beta1.Validator.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryValidatorResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.QueryValidatorResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.QueryValidatorResponse} QueryValidatorResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryValidatorResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryValidatorResponse message. - * @function verify - * @memberof cosmos.staking.v1beta1.QueryValidatorResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryValidatorResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.validator != null && message.hasOwnProperty("validator")) { - let error = $root.cosmos.staking.v1beta1.Validator.verify(message.validator); - if (error) - return "validator." + error; - } - return null; - }; - - /** - * Creates a QueryValidatorResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.QueryValidatorResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.QueryValidatorResponse} QueryValidatorResponse - */ - QueryValidatorResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.QueryValidatorResponse) - return object; - let message = new $root.cosmos.staking.v1beta1.QueryValidatorResponse(); - if (object.validator != null) { - if (typeof object.validator !== "object") - throw TypeError(".cosmos.staking.v1beta1.QueryValidatorResponse.validator: object expected"); - message.validator = $root.cosmos.staking.v1beta1.Validator.fromObject(object.validator); - } - return message; - }; - - /** - * Creates a plain object from a QueryValidatorResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.QueryValidatorResponse - * @static - * @param {cosmos.staking.v1beta1.QueryValidatorResponse} message QueryValidatorResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryValidatorResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.validator = null; - if (message.validator != null && message.hasOwnProperty("validator")) - object.validator = $root.cosmos.staking.v1beta1.Validator.toObject(message.validator, options); - return object; - }; - - /** - * Converts this QueryValidatorResponse to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.QueryValidatorResponse - * @instance - * @returns {Object.} JSON object - */ - QueryValidatorResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryValidatorResponse; - })(); - - v1beta1.QueryValidatorDelegationsRequest = (function() { - - /** - * Properties of a QueryValidatorDelegationsRequest. - * @memberof cosmos.staking.v1beta1 - * @interface IQueryValidatorDelegationsRequest - * @property {string|null} [validator_addr] QueryValidatorDelegationsRequest validator_addr - * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryValidatorDelegationsRequest pagination - */ - - /** - * Constructs a new QueryValidatorDelegationsRequest. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a QueryValidatorDelegationsRequest. - * @implements IQueryValidatorDelegationsRequest - * @constructor - * @param {cosmos.staking.v1beta1.IQueryValidatorDelegationsRequest=} [properties] Properties to set - */ - function QueryValidatorDelegationsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryValidatorDelegationsRequest validator_addr. - * @member {string} validator_addr - * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsRequest - * @instance - */ - QueryValidatorDelegationsRequest.prototype.validator_addr = ""; - - /** - * QueryValidatorDelegationsRequest pagination. - * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination - * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsRequest - * @instance - */ - QueryValidatorDelegationsRequest.prototype.pagination = null; - - /** - * Encodes the specified QueryValidatorDelegationsRequest message. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorDelegationsRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsRequest - * @static - * @param {cosmos.staking.v1beta1.IQueryValidatorDelegationsRequest} message QueryValidatorDelegationsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryValidatorDelegationsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.validator_addr != null && Object.hasOwnProperty.call(message, "validator_addr")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.validator_addr); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryValidatorDelegationsRequest message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorDelegationsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsRequest - * @static - * @param {cosmos.staking.v1beta1.IQueryValidatorDelegationsRequest} message QueryValidatorDelegationsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryValidatorDelegationsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryValidatorDelegationsRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.QueryValidatorDelegationsRequest} QueryValidatorDelegationsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryValidatorDelegationsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryValidatorDelegationsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.validator_addr = reader.string(); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryValidatorDelegationsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.QueryValidatorDelegationsRequest} QueryValidatorDelegationsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryValidatorDelegationsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryValidatorDelegationsRequest message. - * @function verify - * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryValidatorDelegationsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.validator_addr != null && message.hasOwnProperty("validator_addr")) - if (!$util.isString(message.validator_addr)) - return "validator_addr: string expected"; - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryValidatorDelegationsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.QueryValidatorDelegationsRequest} QueryValidatorDelegationsRequest - */ - QueryValidatorDelegationsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.QueryValidatorDelegationsRequest) - return object; - let message = new $root.cosmos.staking.v1beta1.QueryValidatorDelegationsRequest(); - if (object.validator_addr != null) - message.validator_addr = String(object.validator_addr); - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.staking.v1beta1.QueryValidatorDelegationsRequest.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryValidatorDelegationsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsRequest - * @static - * @param {cosmos.staking.v1beta1.QueryValidatorDelegationsRequest} message QueryValidatorDelegationsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryValidatorDelegationsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.validator_addr = ""; - object.pagination = null; - } - if (message.validator_addr != null && message.hasOwnProperty("validator_addr")) - object.validator_addr = message.validator_addr; - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryValidatorDelegationsRequest to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryValidatorDelegationsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryValidatorDelegationsRequest; - })(); - - v1beta1.QueryValidatorDelegationsResponse = (function() { - - /** - * Properties of a QueryValidatorDelegationsResponse. - * @memberof cosmos.staking.v1beta1 - * @interface IQueryValidatorDelegationsResponse - * @property {Array.|null} [delegation_responses] QueryValidatorDelegationsResponse delegation_responses - * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryValidatorDelegationsResponse pagination - */ - - /** - * Constructs a new QueryValidatorDelegationsResponse. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a QueryValidatorDelegationsResponse. - * @implements IQueryValidatorDelegationsResponse - * @constructor - * @param {cosmos.staking.v1beta1.IQueryValidatorDelegationsResponse=} [properties] Properties to set - */ - function QueryValidatorDelegationsResponse(properties) { - this.delegation_responses = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryValidatorDelegationsResponse delegation_responses. - * @member {Array.} delegation_responses - * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsResponse - * @instance - */ - QueryValidatorDelegationsResponse.prototype.delegation_responses = $util.emptyArray; - - /** - * QueryValidatorDelegationsResponse pagination. - * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination - * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsResponse - * @instance - */ - QueryValidatorDelegationsResponse.prototype.pagination = null; - - /** - * Encodes the specified QueryValidatorDelegationsResponse message. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorDelegationsResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsResponse - * @static - * @param {cosmos.staking.v1beta1.IQueryValidatorDelegationsResponse} message QueryValidatorDelegationsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryValidatorDelegationsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.delegation_responses != null && message.delegation_responses.length) - for (let i = 0; i < message.delegation_responses.length; ++i) - $root.cosmos.staking.v1beta1.DelegationResponse.encode(message.delegation_responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryValidatorDelegationsResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorDelegationsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsResponse - * @static - * @param {cosmos.staking.v1beta1.IQueryValidatorDelegationsResponse} message QueryValidatorDelegationsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryValidatorDelegationsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryValidatorDelegationsResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.QueryValidatorDelegationsResponse} QueryValidatorDelegationsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryValidatorDelegationsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryValidatorDelegationsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.delegation_responses && message.delegation_responses.length)) - message.delegation_responses = []; - message.delegation_responses.push($root.cosmos.staking.v1beta1.DelegationResponse.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryValidatorDelegationsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.QueryValidatorDelegationsResponse} QueryValidatorDelegationsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryValidatorDelegationsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryValidatorDelegationsResponse message. - * @function verify - * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryValidatorDelegationsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.delegation_responses != null && message.hasOwnProperty("delegation_responses")) { - if (!Array.isArray(message.delegation_responses)) - return "delegation_responses: array expected"; - for (let i = 0; i < message.delegation_responses.length; ++i) { - let error = $root.cosmos.staking.v1beta1.DelegationResponse.verify(message.delegation_responses[i]); - if (error) - return "delegation_responses." + error; - } - } - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryValidatorDelegationsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.QueryValidatorDelegationsResponse} QueryValidatorDelegationsResponse - */ - QueryValidatorDelegationsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.QueryValidatorDelegationsResponse) - return object; - let message = new $root.cosmos.staking.v1beta1.QueryValidatorDelegationsResponse(); - if (object.delegation_responses) { - if (!Array.isArray(object.delegation_responses)) - throw TypeError(".cosmos.staking.v1beta1.QueryValidatorDelegationsResponse.delegation_responses: array expected"); - message.delegation_responses = []; - for (let i = 0; i < object.delegation_responses.length; ++i) { - if (typeof object.delegation_responses[i] !== "object") - throw TypeError(".cosmos.staking.v1beta1.QueryValidatorDelegationsResponse.delegation_responses: object expected"); - message.delegation_responses[i] = $root.cosmos.staking.v1beta1.DelegationResponse.fromObject(object.delegation_responses[i]); - } - } - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.staking.v1beta1.QueryValidatorDelegationsResponse.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryValidatorDelegationsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsResponse - * @static - * @param {cosmos.staking.v1beta1.QueryValidatorDelegationsResponse} message QueryValidatorDelegationsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryValidatorDelegationsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.delegation_responses = []; - if (options.defaults) - object.pagination = null; - if (message.delegation_responses && message.delegation_responses.length) { - object.delegation_responses = []; - for (let j = 0; j < message.delegation_responses.length; ++j) - object.delegation_responses[j] = $root.cosmos.staking.v1beta1.DelegationResponse.toObject(message.delegation_responses[j], options); - } - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryValidatorDelegationsResponse to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.QueryValidatorDelegationsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryValidatorDelegationsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryValidatorDelegationsResponse; - })(); - - v1beta1.QueryValidatorUnbondingDelegationsRequest = (function() { - - /** - * Properties of a QueryValidatorUnbondingDelegationsRequest. - * @memberof cosmos.staking.v1beta1 - * @interface IQueryValidatorUnbondingDelegationsRequest - * @property {string|null} [validator_addr] QueryValidatorUnbondingDelegationsRequest validator_addr - * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryValidatorUnbondingDelegationsRequest pagination - */ - - /** - * Constructs a new QueryValidatorUnbondingDelegationsRequest. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a QueryValidatorUnbondingDelegationsRequest. - * @implements IQueryValidatorUnbondingDelegationsRequest - * @constructor - * @param {cosmos.staking.v1beta1.IQueryValidatorUnbondingDelegationsRequest=} [properties] Properties to set - */ - function QueryValidatorUnbondingDelegationsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryValidatorUnbondingDelegationsRequest validator_addr. - * @member {string} validator_addr - * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest - * @instance - */ - QueryValidatorUnbondingDelegationsRequest.prototype.validator_addr = ""; - - /** - * QueryValidatorUnbondingDelegationsRequest pagination. - * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination - * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest - * @instance - */ - QueryValidatorUnbondingDelegationsRequest.prototype.pagination = null; - - /** - * Encodes the specified QueryValidatorUnbondingDelegationsRequest message. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest - * @static - * @param {cosmos.staking.v1beta1.IQueryValidatorUnbondingDelegationsRequest} message QueryValidatorUnbondingDelegationsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryValidatorUnbondingDelegationsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.validator_addr != null && Object.hasOwnProperty.call(message, "validator_addr")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.validator_addr); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryValidatorUnbondingDelegationsRequest message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest - * @static - * @param {cosmos.staking.v1beta1.IQueryValidatorUnbondingDelegationsRequest} message QueryValidatorUnbondingDelegationsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryValidatorUnbondingDelegationsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryValidatorUnbondingDelegationsRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest} QueryValidatorUnbondingDelegationsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryValidatorUnbondingDelegationsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.validator_addr = reader.string(); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryValidatorUnbondingDelegationsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest} QueryValidatorUnbondingDelegationsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryValidatorUnbondingDelegationsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryValidatorUnbondingDelegationsRequest message. - * @function verify - * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryValidatorUnbondingDelegationsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.validator_addr != null && message.hasOwnProperty("validator_addr")) - if (!$util.isString(message.validator_addr)) - return "validator_addr: string expected"; - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryValidatorUnbondingDelegationsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest} QueryValidatorUnbondingDelegationsRequest - */ - QueryValidatorUnbondingDelegationsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest) - return object; - let message = new $root.cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest(); - if (object.validator_addr != null) - message.validator_addr = String(object.validator_addr); - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryValidatorUnbondingDelegationsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest - * @static - * @param {cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest} message QueryValidatorUnbondingDelegationsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryValidatorUnbondingDelegationsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.validator_addr = ""; - object.pagination = null; - } - if (message.validator_addr != null && message.hasOwnProperty("validator_addr")) - object.validator_addr = message.validator_addr; - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryValidatorUnbondingDelegationsRequest to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryValidatorUnbondingDelegationsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryValidatorUnbondingDelegationsRequest; - })(); - - v1beta1.QueryValidatorUnbondingDelegationsResponse = (function() { - - /** - * Properties of a QueryValidatorUnbondingDelegationsResponse. - * @memberof cosmos.staking.v1beta1 - * @interface IQueryValidatorUnbondingDelegationsResponse - * @property {Array.|null} [unbonding_responses] QueryValidatorUnbondingDelegationsResponse unbonding_responses - * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryValidatorUnbondingDelegationsResponse pagination - */ - - /** - * Constructs a new QueryValidatorUnbondingDelegationsResponse. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a QueryValidatorUnbondingDelegationsResponse. - * @implements IQueryValidatorUnbondingDelegationsResponse - * @constructor - * @param {cosmos.staking.v1beta1.IQueryValidatorUnbondingDelegationsResponse=} [properties] Properties to set - */ - function QueryValidatorUnbondingDelegationsResponse(properties) { - this.unbonding_responses = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryValidatorUnbondingDelegationsResponse unbonding_responses. - * @member {Array.} unbonding_responses - * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse - * @instance - */ - QueryValidatorUnbondingDelegationsResponse.prototype.unbonding_responses = $util.emptyArray; - - /** - * QueryValidatorUnbondingDelegationsResponse pagination. - * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination - * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse - * @instance - */ - QueryValidatorUnbondingDelegationsResponse.prototype.pagination = null; - - /** - * Encodes the specified QueryValidatorUnbondingDelegationsResponse message. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse - * @static - * @param {cosmos.staking.v1beta1.IQueryValidatorUnbondingDelegationsResponse} message QueryValidatorUnbondingDelegationsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryValidatorUnbondingDelegationsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.unbonding_responses != null && message.unbonding_responses.length) - for (let i = 0; i < message.unbonding_responses.length; ++i) - $root.cosmos.staking.v1beta1.UnbondingDelegation.encode(message.unbonding_responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryValidatorUnbondingDelegationsResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse - * @static - * @param {cosmos.staking.v1beta1.IQueryValidatorUnbondingDelegationsResponse} message QueryValidatorUnbondingDelegationsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryValidatorUnbondingDelegationsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryValidatorUnbondingDelegationsResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse} QueryValidatorUnbondingDelegationsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryValidatorUnbondingDelegationsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.unbonding_responses && message.unbonding_responses.length)) - message.unbonding_responses = []; - message.unbonding_responses.push($root.cosmos.staking.v1beta1.UnbondingDelegation.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryValidatorUnbondingDelegationsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse} QueryValidatorUnbondingDelegationsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryValidatorUnbondingDelegationsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryValidatorUnbondingDelegationsResponse message. - * @function verify - * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryValidatorUnbondingDelegationsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.unbonding_responses != null && message.hasOwnProperty("unbonding_responses")) { - if (!Array.isArray(message.unbonding_responses)) - return "unbonding_responses: array expected"; - for (let i = 0; i < message.unbonding_responses.length; ++i) { - let error = $root.cosmos.staking.v1beta1.UnbondingDelegation.verify(message.unbonding_responses[i]); - if (error) - return "unbonding_responses." + error; - } - } - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryValidatorUnbondingDelegationsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse} QueryValidatorUnbondingDelegationsResponse - */ - QueryValidatorUnbondingDelegationsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse) - return object; - let message = new $root.cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse(); - if (object.unbonding_responses) { - if (!Array.isArray(object.unbonding_responses)) - throw TypeError(".cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse.unbonding_responses: array expected"); - message.unbonding_responses = []; - for (let i = 0; i < object.unbonding_responses.length; ++i) { - if (typeof object.unbonding_responses[i] !== "object") - throw TypeError(".cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse.unbonding_responses: object expected"); - message.unbonding_responses[i] = $root.cosmos.staking.v1beta1.UnbondingDelegation.fromObject(object.unbonding_responses[i]); - } - } - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryValidatorUnbondingDelegationsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse - * @static - * @param {cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse} message QueryValidatorUnbondingDelegationsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryValidatorUnbondingDelegationsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.unbonding_responses = []; - if (options.defaults) - object.pagination = null; - if (message.unbonding_responses && message.unbonding_responses.length) { - object.unbonding_responses = []; - for (let j = 0; j < message.unbonding_responses.length; ++j) - object.unbonding_responses[j] = $root.cosmos.staking.v1beta1.UnbondingDelegation.toObject(message.unbonding_responses[j], options); - } - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryValidatorUnbondingDelegationsResponse to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryValidatorUnbondingDelegationsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryValidatorUnbondingDelegationsResponse; - })(); - - v1beta1.QueryDelegationRequest = (function() { - - /** - * Properties of a QueryDelegationRequest. - * @memberof cosmos.staking.v1beta1 - * @interface IQueryDelegationRequest - * @property {string|null} [delegator_addr] QueryDelegationRequest delegator_addr - * @property {string|null} [validator_addr] QueryDelegationRequest validator_addr - */ - - /** - * Constructs a new QueryDelegationRequest. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a QueryDelegationRequest. - * @implements IQueryDelegationRequest - * @constructor - * @param {cosmos.staking.v1beta1.IQueryDelegationRequest=} [properties] Properties to set - */ - function QueryDelegationRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryDelegationRequest delegator_addr. - * @member {string} delegator_addr - * @memberof cosmos.staking.v1beta1.QueryDelegationRequest - * @instance - */ - QueryDelegationRequest.prototype.delegator_addr = ""; - - /** - * QueryDelegationRequest validator_addr. - * @member {string} validator_addr - * @memberof cosmos.staking.v1beta1.QueryDelegationRequest - * @instance - */ - QueryDelegationRequest.prototype.validator_addr = ""; - - /** - * Encodes the specified QueryDelegationRequest message. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegationRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.QueryDelegationRequest - * @static - * @param {cosmos.staking.v1beta1.IQueryDelegationRequest} message QueryDelegationRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegationRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.delegator_addr != null && Object.hasOwnProperty.call(message, "delegator_addr")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_addr); - if (message.validator_addr != null && Object.hasOwnProperty.call(message, "validator_addr")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.validator_addr); - return writer; - }; - - /** - * Encodes the specified QueryDelegationRequest message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegationRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.QueryDelegationRequest - * @static - * @param {cosmos.staking.v1beta1.IQueryDelegationRequest} message QueryDelegationRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegationRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryDelegationRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.QueryDelegationRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.QueryDelegationRequest} QueryDelegationRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegationRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryDelegationRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.delegator_addr = reader.string(); - break; - case 2: - message.validator_addr = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryDelegationRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.QueryDelegationRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.QueryDelegationRequest} QueryDelegationRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegationRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryDelegationRequest message. - * @function verify - * @memberof cosmos.staking.v1beta1.QueryDelegationRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryDelegationRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.delegator_addr != null && message.hasOwnProperty("delegator_addr")) - if (!$util.isString(message.delegator_addr)) - return "delegator_addr: string expected"; - if (message.validator_addr != null && message.hasOwnProperty("validator_addr")) - if (!$util.isString(message.validator_addr)) - return "validator_addr: string expected"; - return null; - }; - - /** - * Creates a QueryDelegationRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.QueryDelegationRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.QueryDelegationRequest} QueryDelegationRequest - */ - QueryDelegationRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.QueryDelegationRequest) - return object; - let message = new $root.cosmos.staking.v1beta1.QueryDelegationRequest(); - if (object.delegator_addr != null) - message.delegator_addr = String(object.delegator_addr); - if (object.validator_addr != null) - message.validator_addr = String(object.validator_addr); - return message; - }; - - /** - * Creates a plain object from a QueryDelegationRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.QueryDelegationRequest - * @static - * @param {cosmos.staking.v1beta1.QueryDelegationRequest} message QueryDelegationRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryDelegationRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.delegator_addr = ""; - object.validator_addr = ""; - } - if (message.delegator_addr != null && message.hasOwnProperty("delegator_addr")) - object.delegator_addr = message.delegator_addr; - if (message.validator_addr != null && message.hasOwnProperty("validator_addr")) - object.validator_addr = message.validator_addr; - return object; - }; - - /** - * Converts this QueryDelegationRequest to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.QueryDelegationRequest - * @instance - * @returns {Object.} JSON object - */ - QueryDelegationRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryDelegationRequest; - })(); - - v1beta1.QueryDelegationResponse = (function() { - - /** - * Properties of a QueryDelegationResponse. - * @memberof cosmos.staking.v1beta1 - * @interface IQueryDelegationResponse - * @property {cosmos.staking.v1beta1.IDelegationResponse|null} [delegation_response] QueryDelegationResponse delegation_response - */ - - /** - * Constructs a new QueryDelegationResponse. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a QueryDelegationResponse. - * @implements IQueryDelegationResponse - * @constructor - * @param {cosmos.staking.v1beta1.IQueryDelegationResponse=} [properties] Properties to set - */ - function QueryDelegationResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryDelegationResponse delegation_response. - * @member {cosmos.staking.v1beta1.IDelegationResponse|null|undefined} delegation_response - * @memberof cosmos.staking.v1beta1.QueryDelegationResponse - * @instance - */ - QueryDelegationResponse.prototype.delegation_response = null; - - /** - * Encodes the specified QueryDelegationResponse message. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegationResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.QueryDelegationResponse - * @static - * @param {cosmos.staking.v1beta1.IQueryDelegationResponse} message QueryDelegationResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegationResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.delegation_response != null && Object.hasOwnProperty.call(message, "delegation_response")) - $root.cosmos.staking.v1beta1.DelegationResponse.encode(message.delegation_response, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryDelegationResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegationResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.QueryDelegationResponse - * @static - * @param {cosmos.staking.v1beta1.IQueryDelegationResponse} message QueryDelegationResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegationResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryDelegationResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.QueryDelegationResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.QueryDelegationResponse} QueryDelegationResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegationResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryDelegationResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.delegation_response = $root.cosmos.staking.v1beta1.DelegationResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryDelegationResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.QueryDelegationResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.QueryDelegationResponse} QueryDelegationResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegationResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryDelegationResponse message. - * @function verify - * @memberof cosmos.staking.v1beta1.QueryDelegationResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryDelegationResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.delegation_response != null && message.hasOwnProperty("delegation_response")) { - let error = $root.cosmos.staking.v1beta1.DelegationResponse.verify(message.delegation_response); - if (error) - return "delegation_response." + error; - } - return null; - }; - - /** - * Creates a QueryDelegationResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.QueryDelegationResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.QueryDelegationResponse} QueryDelegationResponse - */ - QueryDelegationResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.QueryDelegationResponse) - return object; - let message = new $root.cosmos.staking.v1beta1.QueryDelegationResponse(); - if (object.delegation_response != null) { - if (typeof object.delegation_response !== "object") - throw TypeError(".cosmos.staking.v1beta1.QueryDelegationResponse.delegation_response: object expected"); - message.delegation_response = $root.cosmos.staking.v1beta1.DelegationResponse.fromObject(object.delegation_response); - } - return message; - }; - - /** - * Creates a plain object from a QueryDelegationResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.QueryDelegationResponse - * @static - * @param {cosmos.staking.v1beta1.QueryDelegationResponse} message QueryDelegationResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryDelegationResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.delegation_response = null; - if (message.delegation_response != null && message.hasOwnProperty("delegation_response")) - object.delegation_response = $root.cosmos.staking.v1beta1.DelegationResponse.toObject(message.delegation_response, options); - return object; - }; - - /** - * Converts this QueryDelegationResponse to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.QueryDelegationResponse - * @instance - * @returns {Object.} JSON object - */ - QueryDelegationResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryDelegationResponse; - })(); - - v1beta1.QueryUnbondingDelegationRequest = (function() { - - /** - * Properties of a QueryUnbondingDelegationRequest. - * @memberof cosmos.staking.v1beta1 - * @interface IQueryUnbondingDelegationRequest - * @property {string|null} [delegator_addr] QueryUnbondingDelegationRequest delegator_addr - * @property {string|null} [validator_addr] QueryUnbondingDelegationRequest validator_addr - */ - - /** - * Constructs a new QueryUnbondingDelegationRequest. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a QueryUnbondingDelegationRequest. - * @implements IQueryUnbondingDelegationRequest - * @constructor - * @param {cosmos.staking.v1beta1.IQueryUnbondingDelegationRequest=} [properties] Properties to set - */ - function QueryUnbondingDelegationRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryUnbondingDelegationRequest delegator_addr. - * @member {string} delegator_addr - * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationRequest - * @instance - */ - QueryUnbondingDelegationRequest.prototype.delegator_addr = ""; - - /** - * QueryUnbondingDelegationRequest validator_addr. - * @member {string} validator_addr - * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationRequest - * @instance - */ - QueryUnbondingDelegationRequest.prototype.validator_addr = ""; - - /** - * Encodes the specified QueryUnbondingDelegationRequest message. Does not implicitly {@link cosmos.staking.v1beta1.QueryUnbondingDelegationRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationRequest - * @static - * @param {cosmos.staking.v1beta1.IQueryUnbondingDelegationRequest} message QueryUnbondingDelegationRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryUnbondingDelegationRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.delegator_addr != null && Object.hasOwnProperty.call(message, "delegator_addr")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_addr); - if (message.validator_addr != null && Object.hasOwnProperty.call(message, "validator_addr")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.validator_addr); - return writer; - }; - - /** - * Encodes the specified QueryUnbondingDelegationRequest message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryUnbondingDelegationRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationRequest - * @static - * @param {cosmos.staking.v1beta1.IQueryUnbondingDelegationRequest} message QueryUnbondingDelegationRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryUnbondingDelegationRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryUnbondingDelegationRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.QueryUnbondingDelegationRequest} QueryUnbondingDelegationRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryUnbondingDelegationRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryUnbondingDelegationRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.delegator_addr = reader.string(); - break; - case 2: - message.validator_addr = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryUnbondingDelegationRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.QueryUnbondingDelegationRequest} QueryUnbondingDelegationRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryUnbondingDelegationRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryUnbondingDelegationRequest message. - * @function verify - * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryUnbondingDelegationRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.delegator_addr != null && message.hasOwnProperty("delegator_addr")) - if (!$util.isString(message.delegator_addr)) - return "delegator_addr: string expected"; - if (message.validator_addr != null && message.hasOwnProperty("validator_addr")) - if (!$util.isString(message.validator_addr)) - return "validator_addr: string expected"; - return null; - }; - - /** - * Creates a QueryUnbondingDelegationRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.QueryUnbondingDelegationRequest} QueryUnbondingDelegationRequest - */ - QueryUnbondingDelegationRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.QueryUnbondingDelegationRequest) - return object; - let message = new $root.cosmos.staking.v1beta1.QueryUnbondingDelegationRequest(); - if (object.delegator_addr != null) - message.delegator_addr = String(object.delegator_addr); - if (object.validator_addr != null) - message.validator_addr = String(object.validator_addr); - return message; - }; - - /** - * Creates a plain object from a QueryUnbondingDelegationRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationRequest - * @static - * @param {cosmos.staking.v1beta1.QueryUnbondingDelegationRequest} message QueryUnbondingDelegationRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryUnbondingDelegationRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.delegator_addr = ""; - object.validator_addr = ""; - } - if (message.delegator_addr != null && message.hasOwnProperty("delegator_addr")) - object.delegator_addr = message.delegator_addr; - if (message.validator_addr != null && message.hasOwnProperty("validator_addr")) - object.validator_addr = message.validator_addr; - return object; - }; - - /** - * Converts this QueryUnbondingDelegationRequest to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationRequest - * @instance - * @returns {Object.} JSON object - */ - QueryUnbondingDelegationRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryUnbondingDelegationRequest; - })(); - - v1beta1.QueryUnbondingDelegationResponse = (function() { - - /** - * Properties of a QueryUnbondingDelegationResponse. - * @memberof cosmos.staking.v1beta1 - * @interface IQueryUnbondingDelegationResponse - * @property {cosmos.staking.v1beta1.IUnbondingDelegation|null} [unbond] QueryUnbondingDelegationResponse unbond - */ - - /** - * Constructs a new QueryUnbondingDelegationResponse. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a QueryUnbondingDelegationResponse. - * @implements IQueryUnbondingDelegationResponse - * @constructor - * @param {cosmos.staking.v1beta1.IQueryUnbondingDelegationResponse=} [properties] Properties to set - */ - function QueryUnbondingDelegationResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryUnbondingDelegationResponse unbond. - * @member {cosmos.staking.v1beta1.IUnbondingDelegation|null|undefined} unbond - * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationResponse - * @instance - */ - QueryUnbondingDelegationResponse.prototype.unbond = null; - - /** - * Encodes the specified QueryUnbondingDelegationResponse message. Does not implicitly {@link cosmos.staking.v1beta1.QueryUnbondingDelegationResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationResponse - * @static - * @param {cosmos.staking.v1beta1.IQueryUnbondingDelegationResponse} message QueryUnbondingDelegationResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryUnbondingDelegationResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.unbond != null && Object.hasOwnProperty.call(message, "unbond")) - $root.cosmos.staking.v1beta1.UnbondingDelegation.encode(message.unbond, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryUnbondingDelegationResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryUnbondingDelegationResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationResponse - * @static - * @param {cosmos.staking.v1beta1.IQueryUnbondingDelegationResponse} message QueryUnbondingDelegationResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryUnbondingDelegationResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryUnbondingDelegationResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.QueryUnbondingDelegationResponse} QueryUnbondingDelegationResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryUnbondingDelegationResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryUnbondingDelegationResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.unbond = $root.cosmos.staking.v1beta1.UnbondingDelegation.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryUnbondingDelegationResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.QueryUnbondingDelegationResponse} QueryUnbondingDelegationResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryUnbondingDelegationResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryUnbondingDelegationResponse message. - * @function verify - * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryUnbondingDelegationResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.unbond != null && message.hasOwnProperty("unbond")) { - let error = $root.cosmos.staking.v1beta1.UnbondingDelegation.verify(message.unbond); - if (error) - return "unbond." + error; - } - return null; - }; - - /** - * Creates a QueryUnbondingDelegationResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.QueryUnbondingDelegationResponse} QueryUnbondingDelegationResponse - */ - QueryUnbondingDelegationResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.QueryUnbondingDelegationResponse) - return object; - let message = new $root.cosmos.staking.v1beta1.QueryUnbondingDelegationResponse(); - if (object.unbond != null) { - if (typeof object.unbond !== "object") - throw TypeError(".cosmos.staking.v1beta1.QueryUnbondingDelegationResponse.unbond: object expected"); - message.unbond = $root.cosmos.staking.v1beta1.UnbondingDelegation.fromObject(object.unbond); - } - return message; - }; - - /** - * Creates a plain object from a QueryUnbondingDelegationResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationResponse - * @static - * @param {cosmos.staking.v1beta1.QueryUnbondingDelegationResponse} message QueryUnbondingDelegationResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryUnbondingDelegationResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.unbond = null; - if (message.unbond != null && message.hasOwnProperty("unbond")) - object.unbond = $root.cosmos.staking.v1beta1.UnbondingDelegation.toObject(message.unbond, options); - return object; - }; - - /** - * Converts this QueryUnbondingDelegationResponse to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.QueryUnbondingDelegationResponse - * @instance - * @returns {Object.} JSON object - */ - QueryUnbondingDelegationResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryUnbondingDelegationResponse; - })(); - - v1beta1.QueryDelegatorDelegationsRequest = (function() { - - /** - * Properties of a QueryDelegatorDelegationsRequest. - * @memberof cosmos.staking.v1beta1 - * @interface IQueryDelegatorDelegationsRequest - * @property {string|null} [delegator_addr] QueryDelegatorDelegationsRequest delegator_addr - * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryDelegatorDelegationsRequest pagination - */ - - /** - * Constructs a new QueryDelegatorDelegationsRequest. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a QueryDelegatorDelegationsRequest. - * @implements IQueryDelegatorDelegationsRequest - * @constructor - * @param {cosmos.staking.v1beta1.IQueryDelegatorDelegationsRequest=} [properties] Properties to set - */ - function QueryDelegatorDelegationsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryDelegatorDelegationsRequest delegator_addr. - * @member {string} delegator_addr - * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest - * @instance - */ - QueryDelegatorDelegationsRequest.prototype.delegator_addr = ""; - - /** - * QueryDelegatorDelegationsRequest pagination. - * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination - * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest - * @instance - */ - QueryDelegatorDelegationsRequest.prototype.pagination = null; - - /** - * Encodes the specified QueryDelegatorDelegationsRequest message. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest - * @static - * @param {cosmos.staking.v1beta1.IQueryDelegatorDelegationsRequest} message QueryDelegatorDelegationsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegatorDelegationsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.delegator_addr != null && Object.hasOwnProperty.call(message, "delegator_addr")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_addr); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryDelegatorDelegationsRequest message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest - * @static - * @param {cosmos.staking.v1beta1.IQueryDelegatorDelegationsRequest} message QueryDelegatorDelegationsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegatorDelegationsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryDelegatorDelegationsRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest} QueryDelegatorDelegationsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegatorDelegationsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.delegator_addr = reader.string(); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryDelegatorDelegationsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest} QueryDelegatorDelegationsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegatorDelegationsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryDelegatorDelegationsRequest message. - * @function verify - * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryDelegatorDelegationsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.delegator_addr != null && message.hasOwnProperty("delegator_addr")) - if (!$util.isString(message.delegator_addr)) - return "delegator_addr: string expected"; - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryDelegatorDelegationsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest} QueryDelegatorDelegationsRequest - */ - QueryDelegatorDelegationsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest) - return object; - let message = new $root.cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest(); - if (object.delegator_addr != null) - message.delegator_addr = String(object.delegator_addr); - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryDelegatorDelegationsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest - * @static - * @param {cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest} message QueryDelegatorDelegationsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryDelegatorDelegationsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.delegator_addr = ""; - object.pagination = null; - } - if (message.delegator_addr != null && message.hasOwnProperty("delegator_addr")) - object.delegator_addr = message.delegator_addr; - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryDelegatorDelegationsRequest to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryDelegatorDelegationsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryDelegatorDelegationsRequest; - })(); - - v1beta1.QueryDelegatorDelegationsResponse = (function() { - - /** - * Properties of a QueryDelegatorDelegationsResponse. - * @memberof cosmos.staking.v1beta1 - * @interface IQueryDelegatorDelegationsResponse - * @property {Array.|null} [delegation_responses] QueryDelegatorDelegationsResponse delegation_responses - * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryDelegatorDelegationsResponse pagination - */ - - /** - * Constructs a new QueryDelegatorDelegationsResponse. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a QueryDelegatorDelegationsResponse. - * @implements IQueryDelegatorDelegationsResponse - * @constructor - * @param {cosmos.staking.v1beta1.IQueryDelegatorDelegationsResponse=} [properties] Properties to set - */ - function QueryDelegatorDelegationsResponse(properties) { - this.delegation_responses = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryDelegatorDelegationsResponse delegation_responses. - * @member {Array.} delegation_responses - * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse - * @instance - */ - QueryDelegatorDelegationsResponse.prototype.delegation_responses = $util.emptyArray; - - /** - * QueryDelegatorDelegationsResponse pagination. - * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination - * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse - * @instance - */ - QueryDelegatorDelegationsResponse.prototype.pagination = null; - - /** - * Encodes the specified QueryDelegatorDelegationsResponse message. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse - * @static - * @param {cosmos.staking.v1beta1.IQueryDelegatorDelegationsResponse} message QueryDelegatorDelegationsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegatorDelegationsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.delegation_responses != null && message.delegation_responses.length) - for (let i = 0; i < message.delegation_responses.length; ++i) - $root.cosmos.staking.v1beta1.DelegationResponse.encode(message.delegation_responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryDelegatorDelegationsResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse - * @static - * @param {cosmos.staking.v1beta1.IQueryDelegatorDelegationsResponse} message QueryDelegatorDelegationsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegatorDelegationsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryDelegatorDelegationsResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse} QueryDelegatorDelegationsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegatorDelegationsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.delegation_responses && message.delegation_responses.length)) - message.delegation_responses = []; - message.delegation_responses.push($root.cosmos.staking.v1beta1.DelegationResponse.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryDelegatorDelegationsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse} QueryDelegatorDelegationsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegatorDelegationsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryDelegatorDelegationsResponse message. - * @function verify - * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryDelegatorDelegationsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.delegation_responses != null && message.hasOwnProperty("delegation_responses")) { - if (!Array.isArray(message.delegation_responses)) - return "delegation_responses: array expected"; - for (let i = 0; i < message.delegation_responses.length; ++i) { - let error = $root.cosmos.staking.v1beta1.DelegationResponse.verify(message.delegation_responses[i]); - if (error) - return "delegation_responses." + error; - } - } - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryDelegatorDelegationsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse} QueryDelegatorDelegationsResponse - */ - QueryDelegatorDelegationsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse) - return object; - let message = new $root.cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse(); - if (object.delegation_responses) { - if (!Array.isArray(object.delegation_responses)) - throw TypeError(".cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse.delegation_responses: array expected"); - message.delegation_responses = []; - for (let i = 0; i < object.delegation_responses.length; ++i) { - if (typeof object.delegation_responses[i] !== "object") - throw TypeError(".cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse.delegation_responses: object expected"); - message.delegation_responses[i] = $root.cosmos.staking.v1beta1.DelegationResponse.fromObject(object.delegation_responses[i]); - } - } - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryDelegatorDelegationsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse - * @static - * @param {cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse} message QueryDelegatorDelegationsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryDelegatorDelegationsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.delegation_responses = []; - if (options.defaults) - object.pagination = null; - if (message.delegation_responses && message.delegation_responses.length) { - object.delegation_responses = []; - for (let j = 0; j < message.delegation_responses.length; ++j) - object.delegation_responses[j] = $root.cosmos.staking.v1beta1.DelegationResponse.toObject(message.delegation_responses[j], options); - } - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryDelegatorDelegationsResponse to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryDelegatorDelegationsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryDelegatorDelegationsResponse; - })(); - - v1beta1.QueryDelegatorUnbondingDelegationsRequest = (function() { - - /** - * Properties of a QueryDelegatorUnbondingDelegationsRequest. - * @memberof cosmos.staking.v1beta1 - * @interface IQueryDelegatorUnbondingDelegationsRequest - * @property {string|null} [delegator_addr] QueryDelegatorUnbondingDelegationsRequest delegator_addr - * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryDelegatorUnbondingDelegationsRequest pagination - */ - - /** - * Constructs a new QueryDelegatorUnbondingDelegationsRequest. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a QueryDelegatorUnbondingDelegationsRequest. - * @implements IQueryDelegatorUnbondingDelegationsRequest - * @constructor - * @param {cosmos.staking.v1beta1.IQueryDelegatorUnbondingDelegationsRequest=} [properties] Properties to set - */ - function QueryDelegatorUnbondingDelegationsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryDelegatorUnbondingDelegationsRequest delegator_addr. - * @member {string} delegator_addr - * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest - * @instance - */ - QueryDelegatorUnbondingDelegationsRequest.prototype.delegator_addr = ""; - - /** - * QueryDelegatorUnbondingDelegationsRequest pagination. - * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination - * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest - * @instance - */ - QueryDelegatorUnbondingDelegationsRequest.prototype.pagination = null; - - /** - * Encodes the specified QueryDelegatorUnbondingDelegationsRequest message. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest - * @static - * @param {cosmos.staking.v1beta1.IQueryDelegatorUnbondingDelegationsRequest} message QueryDelegatorUnbondingDelegationsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegatorUnbondingDelegationsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.delegator_addr != null && Object.hasOwnProperty.call(message, "delegator_addr")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_addr); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryDelegatorUnbondingDelegationsRequest message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest - * @static - * @param {cosmos.staking.v1beta1.IQueryDelegatorUnbondingDelegationsRequest} message QueryDelegatorUnbondingDelegationsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegatorUnbondingDelegationsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryDelegatorUnbondingDelegationsRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest} QueryDelegatorUnbondingDelegationsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegatorUnbondingDelegationsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.delegator_addr = reader.string(); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryDelegatorUnbondingDelegationsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest} QueryDelegatorUnbondingDelegationsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegatorUnbondingDelegationsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryDelegatorUnbondingDelegationsRequest message. - * @function verify - * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryDelegatorUnbondingDelegationsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.delegator_addr != null && message.hasOwnProperty("delegator_addr")) - if (!$util.isString(message.delegator_addr)) - return "delegator_addr: string expected"; - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryDelegatorUnbondingDelegationsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest} QueryDelegatorUnbondingDelegationsRequest - */ - QueryDelegatorUnbondingDelegationsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest) - return object; - let message = new $root.cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest(); - if (object.delegator_addr != null) - message.delegator_addr = String(object.delegator_addr); - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryDelegatorUnbondingDelegationsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest - * @static - * @param {cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest} message QueryDelegatorUnbondingDelegationsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryDelegatorUnbondingDelegationsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.delegator_addr = ""; - object.pagination = null; - } - if (message.delegator_addr != null && message.hasOwnProperty("delegator_addr")) - object.delegator_addr = message.delegator_addr; - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryDelegatorUnbondingDelegationsRequest to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryDelegatorUnbondingDelegationsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryDelegatorUnbondingDelegationsRequest; - })(); - - v1beta1.QueryDelegatorUnbondingDelegationsResponse = (function() { - - /** - * Properties of a QueryDelegatorUnbondingDelegationsResponse. - * @memberof cosmos.staking.v1beta1 - * @interface IQueryDelegatorUnbondingDelegationsResponse - * @property {Array.|null} [unbonding_responses] QueryDelegatorUnbondingDelegationsResponse unbonding_responses - * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryDelegatorUnbondingDelegationsResponse pagination - */ - - /** - * Constructs a new QueryDelegatorUnbondingDelegationsResponse. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a QueryDelegatorUnbondingDelegationsResponse. - * @implements IQueryDelegatorUnbondingDelegationsResponse - * @constructor - * @param {cosmos.staking.v1beta1.IQueryDelegatorUnbondingDelegationsResponse=} [properties] Properties to set - */ - function QueryDelegatorUnbondingDelegationsResponse(properties) { - this.unbonding_responses = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryDelegatorUnbondingDelegationsResponse unbonding_responses. - * @member {Array.} unbonding_responses - * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse - * @instance - */ - QueryDelegatorUnbondingDelegationsResponse.prototype.unbonding_responses = $util.emptyArray; - - /** - * QueryDelegatorUnbondingDelegationsResponse pagination. - * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination - * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse - * @instance - */ - QueryDelegatorUnbondingDelegationsResponse.prototype.pagination = null; - - /** - * Encodes the specified QueryDelegatorUnbondingDelegationsResponse message. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse - * @static - * @param {cosmos.staking.v1beta1.IQueryDelegatorUnbondingDelegationsResponse} message QueryDelegatorUnbondingDelegationsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegatorUnbondingDelegationsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.unbonding_responses != null && message.unbonding_responses.length) - for (let i = 0; i < message.unbonding_responses.length; ++i) - $root.cosmos.staking.v1beta1.UnbondingDelegation.encode(message.unbonding_responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryDelegatorUnbondingDelegationsResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse - * @static - * @param {cosmos.staking.v1beta1.IQueryDelegatorUnbondingDelegationsResponse} message QueryDelegatorUnbondingDelegationsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegatorUnbondingDelegationsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryDelegatorUnbondingDelegationsResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse} QueryDelegatorUnbondingDelegationsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegatorUnbondingDelegationsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.unbonding_responses && message.unbonding_responses.length)) - message.unbonding_responses = []; - message.unbonding_responses.push($root.cosmos.staking.v1beta1.UnbondingDelegation.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryDelegatorUnbondingDelegationsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse} QueryDelegatorUnbondingDelegationsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegatorUnbondingDelegationsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryDelegatorUnbondingDelegationsResponse message. - * @function verify - * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryDelegatorUnbondingDelegationsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.unbonding_responses != null && message.hasOwnProperty("unbonding_responses")) { - if (!Array.isArray(message.unbonding_responses)) - return "unbonding_responses: array expected"; - for (let i = 0; i < message.unbonding_responses.length; ++i) { - let error = $root.cosmos.staking.v1beta1.UnbondingDelegation.verify(message.unbonding_responses[i]); - if (error) - return "unbonding_responses." + error; - } - } - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryDelegatorUnbondingDelegationsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse} QueryDelegatorUnbondingDelegationsResponse - */ - QueryDelegatorUnbondingDelegationsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse) - return object; - let message = new $root.cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse(); - if (object.unbonding_responses) { - if (!Array.isArray(object.unbonding_responses)) - throw TypeError(".cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse.unbonding_responses: array expected"); - message.unbonding_responses = []; - for (let i = 0; i < object.unbonding_responses.length; ++i) { - if (typeof object.unbonding_responses[i] !== "object") - throw TypeError(".cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse.unbonding_responses: object expected"); - message.unbonding_responses[i] = $root.cosmos.staking.v1beta1.UnbondingDelegation.fromObject(object.unbonding_responses[i]); - } - } - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryDelegatorUnbondingDelegationsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse - * @static - * @param {cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse} message QueryDelegatorUnbondingDelegationsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryDelegatorUnbondingDelegationsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.unbonding_responses = []; - if (options.defaults) - object.pagination = null; - if (message.unbonding_responses && message.unbonding_responses.length) { - object.unbonding_responses = []; - for (let j = 0; j < message.unbonding_responses.length; ++j) - object.unbonding_responses[j] = $root.cosmos.staking.v1beta1.UnbondingDelegation.toObject(message.unbonding_responses[j], options); - } - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryDelegatorUnbondingDelegationsResponse to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryDelegatorUnbondingDelegationsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryDelegatorUnbondingDelegationsResponse; - })(); - - v1beta1.QueryRedelegationsRequest = (function() { - - /** - * Properties of a QueryRedelegationsRequest. - * @memberof cosmos.staking.v1beta1 - * @interface IQueryRedelegationsRequest - * @property {string|null} [delegator_addr] QueryRedelegationsRequest delegator_addr - * @property {string|null} [src_validator_addr] QueryRedelegationsRequest src_validator_addr - * @property {string|null} [dst_validator_addr] QueryRedelegationsRequest dst_validator_addr - * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryRedelegationsRequest pagination - */ - - /** - * Constructs a new QueryRedelegationsRequest. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a QueryRedelegationsRequest. - * @implements IQueryRedelegationsRequest - * @constructor - * @param {cosmos.staking.v1beta1.IQueryRedelegationsRequest=} [properties] Properties to set - */ - function QueryRedelegationsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryRedelegationsRequest delegator_addr. - * @member {string} delegator_addr - * @memberof cosmos.staking.v1beta1.QueryRedelegationsRequest - * @instance - */ - QueryRedelegationsRequest.prototype.delegator_addr = ""; - - /** - * QueryRedelegationsRequest src_validator_addr. - * @member {string} src_validator_addr - * @memberof cosmos.staking.v1beta1.QueryRedelegationsRequest - * @instance - */ - QueryRedelegationsRequest.prototype.src_validator_addr = ""; - - /** - * QueryRedelegationsRequest dst_validator_addr. - * @member {string} dst_validator_addr - * @memberof cosmos.staking.v1beta1.QueryRedelegationsRequest - * @instance - */ - QueryRedelegationsRequest.prototype.dst_validator_addr = ""; - - /** - * QueryRedelegationsRequest pagination. - * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination - * @memberof cosmos.staking.v1beta1.QueryRedelegationsRequest - * @instance - */ - QueryRedelegationsRequest.prototype.pagination = null; - - /** - * Encodes the specified QueryRedelegationsRequest message. Does not implicitly {@link cosmos.staking.v1beta1.QueryRedelegationsRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.QueryRedelegationsRequest - * @static - * @param {cosmos.staking.v1beta1.IQueryRedelegationsRequest} message QueryRedelegationsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryRedelegationsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.delegator_addr != null && Object.hasOwnProperty.call(message, "delegator_addr")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_addr); - if (message.src_validator_addr != null && Object.hasOwnProperty.call(message, "src_validator_addr")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.src_validator_addr); - if (message.dst_validator_addr != null && Object.hasOwnProperty.call(message, "dst_validator_addr")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.dst_validator_addr); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryRedelegationsRequest message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryRedelegationsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.QueryRedelegationsRequest - * @static - * @param {cosmos.staking.v1beta1.IQueryRedelegationsRequest} message QueryRedelegationsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryRedelegationsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryRedelegationsRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.QueryRedelegationsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.QueryRedelegationsRequest} QueryRedelegationsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryRedelegationsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryRedelegationsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.delegator_addr = reader.string(); - break; - case 2: - message.src_validator_addr = reader.string(); - break; - case 3: - message.dst_validator_addr = reader.string(); - break; - case 4: - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryRedelegationsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.QueryRedelegationsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.QueryRedelegationsRequest} QueryRedelegationsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryRedelegationsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryRedelegationsRequest message. - * @function verify - * @memberof cosmos.staking.v1beta1.QueryRedelegationsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryRedelegationsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.delegator_addr != null && message.hasOwnProperty("delegator_addr")) - if (!$util.isString(message.delegator_addr)) - return "delegator_addr: string expected"; - if (message.src_validator_addr != null && message.hasOwnProperty("src_validator_addr")) - if (!$util.isString(message.src_validator_addr)) - return "src_validator_addr: string expected"; - if (message.dst_validator_addr != null && message.hasOwnProperty("dst_validator_addr")) - if (!$util.isString(message.dst_validator_addr)) - return "dst_validator_addr: string expected"; - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryRedelegationsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.QueryRedelegationsRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.QueryRedelegationsRequest} QueryRedelegationsRequest - */ - QueryRedelegationsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.QueryRedelegationsRequest) - return object; - let message = new $root.cosmos.staking.v1beta1.QueryRedelegationsRequest(); - if (object.delegator_addr != null) - message.delegator_addr = String(object.delegator_addr); - if (object.src_validator_addr != null) - message.src_validator_addr = String(object.src_validator_addr); - if (object.dst_validator_addr != null) - message.dst_validator_addr = String(object.dst_validator_addr); - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.staking.v1beta1.QueryRedelegationsRequest.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryRedelegationsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.QueryRedelegationsRequest - * @static - * @param {cosmos.staking.v1beta1.QueryRedelegationsRequest} message QueryRedelegationsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryRedelegationsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.delegator_addr = ""; - object.src_validator_addr = ""; - object.dst_validator_addr = ""; - object.pagination = null; - } - if (message.delegator_addr != null && message.hasOwnProperty("delegator_addr")) - object.delegator_addr = message.delegator_addr; - if (message.src_validator_addr != null && message.hasOwnProperty("src_validator_addr")) - object.src_validator_addr = message.src_validator_addr; - if (message.dst_validator_addr != null && message.hasOwnProperty("dst_validator_addr")) - object.dst_validator_addr = message.dst_validator_addr; - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryRedelegationsRequest to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.QueryRedelegationsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryRedelegationsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryRedelegationsRequest; - })(); - - v1beta1.QueryRedelegationsResponse = (function() { - - /** - * Properties of a QueryRedelegationsResponse. - * @memberof cosmos.staking.v1beta1 - * @interface IQueryRedelegationsResponse - * @property {Array.|null} [redelegation_responses] QueryRedelegationsResponse redelegation_responses - * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryRedelegationsResponse pagination - */ - - /** - * Constructs a new QueryRedelegationsResponse. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a QueryRedelegationsResponse. - * @implements IQueryRedelegationsResponse - * @constructor - * @param {cosmos.staking.v1beta1.IQueryRedelegationsResponse=} [properties] Properties to set - */ - function QueryRedelegationsResponse(properties) { - this.redelegation_responses = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryRedelegationsResponse redelegation_responses. - * @member {Array.} redelegation_responses - * @memberof cosmos.staking.v1beta1.QueryRedelegationsResponse - * @instance - */ - QueryRedelegationsResponse.prototype.redelegation_responses = $util.emptyArray; - - /** - * QueryRedelegationsResponse pagination. - * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination - * @memberof cosmos.staking.v1beta1.QueryRedelegationsResponse - * @instance - */ - QueryRedelegationsResponse.prototype.pagination = null; - - /** - * Encodes the specified QueryRedelegationsResponse message. Does not implicitly {@link cosmos.staking.v1beta1.QueryRedelegationsResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.QueryRedelegationsResponse - * @static - * @param {cosmos.staking.v1beta1.IQueryRedelegationsResponse} message QueryRedelegationsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryRedelegationsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.redelegation_responses != null && message.redelegation_responses.length) - for (let i = 0; i < message.redelegation_responses.length; ++i) - $root.cosmos.staking.v1beta1.RedelegationResponse.encode(message.redelegation_responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryRedelegationsResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryRedelegationsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.QueryRedelegationsResponse - * @static - * @param {cosmos.staking.v1beta1.IQueryRedelegationsResponse} message QueryRedelegationsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryRedelegationsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryRedelegationsResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.QueryRedelegationsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.QueryRedelegationsResponse} QueryRedelegationsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryRedelegationsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryRedelegationsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.redelegation_responses && message.redelegation_responses.length)) - message.redelegation_responses = []; - message.redelegation_responses.push($root.cosmos.staking.v1beta1.RedelegationResponse.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryRedelegationsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.QueryRedelegationsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.QueryRedelegationsResponse} QueryRedelegationsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryRedelegationsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryRedelegationsResponse message. - * @function verify - * @memberof cosmos.staking.v1beta1.QueryRedelegationsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryRedelegationsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.redelegation_responses != null && message.hasOwnProperty("redelegation_responses")) { - if (!Array.isArray(message.redelegation_responses)) - return "redelegation_responses: array expected"; - for (let i = 0; i < message.redelegation_responses.length; ++i) { - let error = $root.cosmos.staking.v1beta1.RedelegationResponse.verify(message.redelegation_responses[i]); - if (error) - return "redelegation_responses." + error; - } - } - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryRedelegationsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.QueryRedelegationsResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.QueryRedelegationsResponse} QueryRedelegationsResponse - */ - QueryRedelegationsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.QueryRedelegationsResponse) - return object; - let message = new $root.cosmos.staking.v1beta1.QueryRedelegationsResponse(); - if (object.redelegation_responses) { - if (!Array.isArray(object.redelegation_responses)) - throw TypeError(".cosmos.staking.v1beta1.QueryRedelegationsResponse.redelegation_responses: array expected"); - message.redelegation_responses = []; - for (let i = 0; i < object.redelegation_responses.length; ++i) { - if (typeof object.redelegation_responses[i] !== "object") - throw TypeError(".cosmos.staking.v1beta1.QueryRedelegationsResponse.redelegation_responses: object expected"); - message.redelegation_responses[i] = $root.cosmos.staking.v1beta1.RedelegationResponse.fromObject(object.redelegation_responses[i]); - } - } - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.staking.v1beta1.QueryRedelegationsResponse.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryRedelegationsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.QueryRedelegationsResponse - * @static - * @param {cosmos.staking.v1beta1.QueryRedelegationsResponse} message QueryRedelegationsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryRedelegationsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.redelegation_responses = []; - if (options.defaults) - object.pagination = null; - if (message.redelegation_responses && message.redelegation_responses.length) { - object.redelegation_responses = []; - for (let j = 0; j < message.redelegation_responses.length; ++j) - object.redelegation_responses[j] = $root.cosmos.staking.v1beta1.RedelegationResponse.toObject(message.redelegation_responses[j], options); - } - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryRedelegationsResponse to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.QueryRedelegationsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryRedelegationsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryRedelegationsResponse; - })(); - - v1beta1.QueryDelegatorValidatorsRequest = (function() { - - /** - * Properties of a QueryDelegatorValidatorsRequest. - * @memberof cosmos.staking.v1beta1 - * @interface IQueryDelegatorValidatorsRequest - * @property {string|null} [delegator_addr] QueryDelegatorValidatorsRequest delegator_addr - * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryDelegatorValidatorsRequest pagination - */ - - /** - * Constructs a new QueryDelegatorValidatorsRequest. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a QueryDelegatorValidatorsRequest. - * @implements IQueryDelegatorValidatorsRequest - * @constructor - * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorsRequest=} [properties] Properties to set - */ - function QueryDelegatorValidatorsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryDelegatorValidatorsRequest delegator_addr. - * @member {string} delegator_addr - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest - * @instance - */ - QueryDelegatorValidatorsRequest.prototype.delegator_addr = ""; - - /** - * QueryDelegatorValidatorsRequest pagination. - * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest - * @instance - */ - QueryDelegatorValidatorsRequest.prototype.pagination = null; - - /** - * Encodes the specified QueryDelegatorValidatorsRequest message. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest - * @static - * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorsRequest} message QueryDelegatorValidatorsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegatorValidatorsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.delegator_addr != null && Object.hasOwnProperty.call(message, "delegator_addr")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_addr); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryDelegatorValidatorsRequest message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest - * @static - * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorsRequest} message QueryDelegatorValidatorsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegatorValidatorsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryDelegatorValidatorsRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest} QueryDelegatorValidatorsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegatorValidatorsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.delegator_addr = reader.string(); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryDelegatorValidatorsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest} QueryDelegatorValidatorsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegatorValidatorsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryDelegatorValidatorsRequest message. - * @function verify - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryDelegatorValidatorsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.delegator_addr != null && message.hasOwnProperty("delegator_addr")) - if (!$util.isString(message.delegator_addr)) - return "delegator_addr: string expected"; - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryDelegatorValidatorsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest} QueryDelegatorValidatorsRequest - */ - QueryDelegatorValidatorsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest) - return object; - let message = new $root.cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest(); - if (object.delegator_addr != null) - message.delegator_addr = String(object.delegator_addr); - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryDelegatorValidatorsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest - * @static - * @param {cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest} message QueryDelegatorValidatorsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryDelegatorValidatorsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.delegator_addr = ""; - object.pagination = null; - } - if (message.delegator_addr != null && message.hasOwnProperty("delegator_addr")) - object.delegator_addr = message.delegator_addr; - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryDelegatorValidatorsRequest to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryDelegatorValidatorsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryDelegatorValidatorsRequest; - })(); - - v1beta1.QueryDelegatorValidatorsResponse = (function() { - - /** - * Properties of a QueryDelegatorValidatorsResponse. - * @memberof cosmos.staking.v1beta1 - * @interface IQueryDelegatorValidatorsResponse - * @property {Array.|null} [validators] QueryDelegatorValidatorsResponse validators - * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryDelegatorValidatorsResponse pagination - */ - - /** - * Constructs a new QueryDelegatorValidatorsResponse. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a QueryDelegatorValidatorsResponse. - * @implements IQueryDelegatorValidatorsResponse - * @constructor - * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorsResponse=} [properties] Properties to set - */ - function QueryDelegatorValidatorsResponse(properties) { - this.validators = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryDelegatorValidatorsResponse validators. - * @member {Array.} validators - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse - * @instance - */ - QueryDelegatorValidatorsResponse.prototype.validators = $util.emptyArray; - - /** - * QueryDelegatorValidatorsResponse pagination. - * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse - * @instance - */ - QueryDelegatorValidatorsResponse.prototype.pagination = null; - - /** - * Encodes the specified QueryDelegatorValidatorsResponse message. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse - * @static - * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorsResponse} message QueryDelegatorValidatorsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegatorValidatorsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.validators != null && message.validators.length) - for (let i = 0; i < message.validators.length; ++i) - $root.cosmos.staking.v1beta1.Validator.encode(message.validators[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryDelegatorValidatorsResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse - * @static - * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorsResponse} message QueryDelegatorValidatorsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegatorValidatorsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryDelegatorValidatorsResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse} QueryDelegatorValidatorsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegatorValidatorsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.validators && message.validators.length)) - message.validators = []; - message.validators.push($root.cosmos.staking.v1beta1.Validator.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryDelegatorValidatorsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse} QueryDelegatorValidatorsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegatorValidatorsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryDelegatorValidatorsResponse message. - * @function verify - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryDelegatorValidatorsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.validators != null && message.hasOwnProperty("validators")) { - if (!Array.isArray(message.validators)) - return "validators: array expected"; - for (let i = 0; i < message.validators.length; ++i) { - let error = $root.cosmos.staking.v1beta1.Validator.verify(message.validators[i]); - if (error) - return "validators." + error; - } - } - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryDelegatorValidatorsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse} QueryDelegatorValidatorsResponse - */ - QueryDelegatorValidatorsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse) - return object; - let message = new $root.cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse(); - if (object.validators) { - if (!Array.isArray(object.validators)) - throw TypeError(".cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse.validators: array expected"); - message.validators = []; - for (let i = 0; i < object.validators.length; ++i) { - if (typeof object.validators[i] !== "object") - throw TypeError(".cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse.validators: object expected"); - message.validators[i] = $root.cosmos.staking.v1beta1.Validator.fromObject(object.validators[i]); - } - } - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryDelegatorValidatorsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse - * @static - * @param {cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse} message QueryDelegatorValidatorsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryDelegatorValidatorsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.validators = []; - if (options.defaults) - object.pagination = null; - if (message.validators && message.validators.length) { - object.validators = []; - for (let j = 0; j < message.validators.length; ++j) - object.validators[j] = $root.cosmos.staking.v1beta1.Validator.toObject(message.validators[j], options); - } - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryDelegatorValidatorsResponse to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryDelegatorValidatorsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryDelegatorValidatorsResponse; - })(); - - v1beta1.QueryDelegatorValidatorRequest = (function() { - - /** - * Properties of a QueryDelegatorValidatorRequest. - * @memberof cosmos.staking.v1beta1 - * @interface IQueryDelegatorValidatorRequest - * @property {string|null} [delegator_addr] QueryDelegatorValidatorRequest delegator_addr - * @property {string|null} [validator_addr] QueryDelegatorValidatorRequest validator_addr - */ - - /** - * Constructs a new QueryDelegatorValidatorRequest. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a QueryDelegatorValidatorRequest. - * @implements IQueryDelegatorValidatorRequest - * @constructor - * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorRequest=} [properties] Properties to set - */ - function QueryDelegatorValidatorRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryDelegatorValidatorRequest delegator_addr. - * @member {string} delegator_addr - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorRequest - * @instance - */ - QueryDelegatorValidatorRequest.prototype.delegator_addr = ""; - - /** - * QueryDelegatorValidatorRequest validator_addr. - * @member {string} validator_addr - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorRequest - * @instance - */ - QueryDelegatorValidatorRequest.prototype.validator_addr = ""; - - /** - * Encodes the specified QueryDelegatorValidatorRequest message. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorValidatorRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorRequest - * @static - * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorRequest} message QueryDelegatorValidatorRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegatorValidatorRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.delegator_addr != null && Object.hasOwnProperty.call(message, "delegator_addr")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_addr); - if (message.validator_addr != null && Object.hasOwnProperty.call(message, "validator_addr")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.validator_addr); - return writer; - }; - - /** - * Encodes the specified QueryDelegatorValidatorRequest message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorValidatorRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorRequest - * @static - * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorRequest} message QueryDelegatorValidatorRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegatorValidatorRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryDelegatorValidatorRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.QueryDelegatorValidatorRequest} QueryDelegatorValidatorRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegatorValidatorRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryDelegatorValidatorRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.delegator_addr = reader.string(); - break; - case 2: - message.validator_addr = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryDelegatorValidatorRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.QueryDelegatorValidatorRequest} QueryDelegatorValidatorRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegatorValidatorRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryDelegatorValidatorRequest message. - * @function verify - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryDelegatorValidatorRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.delegator_addr != null && message.hasOwnProperty("delegator_addr")) - if (!$util.isString(message.delegator_addr)) - return "delegator_addr: string expected"; - if (message.validator_addr != null && message.hasOwnProperty("validator_addr")) - if (!$util.isString(message.validator_addr)) - return "validator_addr: string expected"; - return null; - }; - - /** - * Creates a QueryDelegatorValidatorRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.QueryDelegatorValidatorRequest} QueryDelegatorValidatorRequest - */ - QueryDelegatorValidatorRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.QueryDelegatorValidatorRequest) - return object; - let message = new $root.cosmos.staking.v1beta1.QueryDelegatorValidatorRequest(); - if (object.delegator_addr != null) - message.delegator_addr = String(object.delegator_addr); - if (object.validator_addr != null) - message.validator_addr = String(object.validator_addr); - return message; - }; - - /** - * Creates a plain object from a QueryDelegatorValidatorRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorRequest - * @static - * @param {cosmos.staking.v1beta1.QueryDelegatorValidatorRequest} message QueryDelegatorValidatorRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryDelegatorValidatorRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.delegator_addr = ""; - object.validator_addr = ""; - } - if (message.delegator_addr != null && message.hasOwnProperty("delegator_addr")) - object.delegator_addr = message.delegator_addr; - if (message.validator_addr != null && message.hasOwnProperty("validator_addr")) - object.validator_addr = message.validator_addr; - return object; - }; - - /** - * Converts this QueryDelegatorValidatorRequest to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorRequest - * @instance - * @returns {Object.} JSON object - */ - QueryDelegatorValidatorRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryDelegatorValidatorRequest; - })(); - - v1beta1.QueryDelegatorValidatorResponse = (function() { - - /** - * Properties of a QueryDelegatorValidatorResponse. - * @memberof cosmos.staking.v1beta1 - * @interface IQueryDelegatorValidatorResponse - * @property {cosmos.staking.v1beta1.IValidator|null} [validator] QueryDelegatorValidatorResponse validator - */ - - /** - * Constructs a new QueryDelegatorValidatorResponse. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a QueryDelegatorValidatorResponse. - * @implements IQueryDelegatorValidatorResponse - * @constructor - * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorResponse=} [properties] Properties to set - */ - function QueryDelegatorValidatorResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryDelegatorValidatorResponse validator. - * @member {cosmos.staking.v1beta1.IValidator|null|undefined} validator - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorResponse - * @instance - */ - QueryDelegatorValidatorResponse.prototype.validator = null; - - /** - * Encodes the specified QueryDelegatorValidatorResponse message. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorValidatorResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorResponse - * @static - * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorResponse} message QueryDelegatorValidatorResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegatorValidatorResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.validator != null && Object.hasOwnProperty.call(message, "validator")) - $root.cosmos.staking.v1beta1.Validator.encode(message.validator, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryDelegatorValidatorResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryDelegatorValidatorResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorResponse - * @static - * @param {cosmos.staking.v1beta1.IQueryDelegatorValidatorResponse} message QueryDelegatorValidatorResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDelegatorValidatorResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryDelegatorValidatorResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.QueryDelegatorValidatorResponse} QueryDelegatorValidatorResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegatorValidatorResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryDelegatorValidatorResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.validator = $root.cosmos.staking.v1beta1.Validator.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryDelegatorValidatorResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.QueryDelegatorValidatorResponse} QueryDelegatorValidatorResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDelegatorValidatorResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryDelegatorValidatorResponse message. - * @function verify - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryDelegatorValidatorResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.validator != null && message.hasOwnProperty("validator")) { - let error = $root.cosmos.staking.v1beta1.Validator.verify(message.validator); - if (error) - return "validator." + error; - } - return null; - }; - - /** - * Creates a QueryDelegatorValidatorResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.QueryDelegatorValidatorResponse} QueryDelegatorValidatorResponse - */ - QueryDelegatorValidatorResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.QueryDelegatorValidatorResponse) - return object; - let message = new $root.cosmos.staking.v1beta1.QueryDelegatorValidatorResponse(); - if (object.validator != null) { - if (typeof object.validator !== "object") - throw TypeError(".cosmos.staking.v1beta1.QueryDelegatorValidatorResponse.validator: object expected"); - message.validator = $root.cosmos.staking.v1beta1.Validator.fromObject(object.validator); - } - return message; - }; - - /** - * Creates a plain object from a QueryDelegatorValidatorResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorResponse - * @static - * @param {cosmos.staking.v1beta1.QueryDelegatorValidatorResponse} message QueryDelegatorValidatorResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryDelegatorValidatorResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.validator = null; - if (message.validator != null && message.hasOwnProperty("validator")) - object.validator = $root.cosmos.staking.v1beta1.Validator.toObject(message.validator, options); - return object; - }; - - /** - * Converts this QueryDelegatorValidatorResponse to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.QueryDelegatorValidatorResponse - * @instance - * @returns {Object.} JSON object - */ - QueryDelegatorValidatorResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryDelegatorValidatorResponse; - })(); - - v1beta1.QueryHistoricalInfoRequest = (function() { - - /** - * Properties of a QueryHistoricalInfoRequest. - * @memberof cosmos.staking.v1beta1 - * @interface IQueryHistoricalInfoRequest - * @property {Long|null} [height] QueryHistoricalInfoRequest height - */ - - /** - * Constructs a new QueryHistoricalInfoRequest. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a QueryHistoricalInfoRequest. - * @implements IQueryHistoricalInfoRequest - * @constructor - * @param {cosmos.staking.v1beta1.IQueryHistoricalInfoRequest=} [properties] Properties to set - */ - function QueryHistoricalInfoRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryHistoricalInfoRequest height. - * @member {Long} height - * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoRequest - * @instance - */ - QueryHistoricalInfoRequest.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Encodes the specified QueryHistoricalInfoRequest message. Does not implicitly {@link cosmos.staking.v1beta1.QueryHistoricalInfoRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoRequest - * @static - * @param {cosmos.staking.v1beta1.IQueryHistoricalInfoRequest} message QueryHistoricalInfoRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryHistoricalInfoRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.height); - return writer; - }; - - /** - * Encodes the specified QueryHistoricalInfoRequest message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryHistoricalInfoRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoRequest - * @static - * @param {cosmos.staking.v1beta1.IQueryHistoricalInfoRequest} message QueryHistoricalInfoRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryHistoricalInfoRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryHistoricalInfoRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.QueryHistoricalInfoRequest} QueryHistoricalInfoRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryHistoricalInfoRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryHistoricalInfoRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.height = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryHistoricalInfoRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.QueryHistoricalInfoRequest} QueryHistoricalInfoRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryHistoricalInfoRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryHistoricalInfoRequest message. - * @function verify - * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryHistoricalInfoRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) - return "height: integer|Long expected"; - return null; - }; - - /** - * Creates a QueryHistoricalInfoRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.QueryHistoricalInfoRequest} QueryHistoricalInfoRequest - */ - QueryHistoricalInfoRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.QueryHistoricalInfoRequest) - return object; - let message = new $root.cosmos.staking.v1beta1.QueryHistoricalInfoRequest(); - if (object.height != null) - if ($util.Long) - (message.height = $util.Long.fromValue(object.height)).unsigned = false; - else if (typeof object.height === "string") - message.height = parseInt(object.height, 10); - else if (typeof object.height === "number") - message.height = object.height; - else if (typeof object.height === "object") - message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a QueryHistoricalInfoRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoRequest - * @static - * @param {cosmos.staking.v1beta1.QueryHistoricalInfoRequest} message QueryHistoricalInfoRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryHistoricalInfoRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.height = options.longs === String ? "0" : 0; - if (message.height != null && message.hasOwnProperty("height")) - if (typeof message.height === "number") - object.height = options.longs === String ? String(message.height) : message.height; - else - object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; - return object; - }; - - /** - * Converts this QueryHistoricalInfoRequest to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoRequest - * @instance - * @returns {Object.} JSON object - */ - QueryHistoricalInfoRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryHistoricalInfoRequest; - })(); - - v1beta1.QueryHistoricalInfoResponse = (function() { - - /** - * Properties of a QueryHistoricalInfoResponse. - * @memberof cosmos.staking.v1beta1 - * @interface IQueryHistoricalInfoResponse - * @property {cosmos.staking.v1beta1.IHistoricalInfo|null} [hist] QueryHistoricalInfoResponse hist - */ - - /** - * Constructs a new QueryHistoricalInfoResponse. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a QueryHistoricalInfoResponse. - * @implements IQueryHistoricalInfoResponse - * @constructor - * @param {cosmos.staking.v1beta1.IQueryHistoricalInfoResponse=} [properties] Properties to set - */ - function QueryHistoricalInfoResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryHistoricalInfoResponse hist. - * @member {cosmos.staking.v1beta1.IHistoricalInfo|null|undefined} hist - * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoResponse - * @instance - */ - QueryHistoricalInfoResponse.prototype.hist = null; - - /** - * Encodes the specified QueryHistoricalInfoResponse message. Does not implicitly {@link cosmos.staking.v1beta1.QueryHistoricalInfoResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoResponse - * @static - * @param {cosmos.staking.v1beta1.IQueryHistoricalInfoResponse} message QueryHistoricalInfoResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryHistoricalInfoResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.hist != null && Object.hasOwnProperty.call(message, "hist")) - $root.cosmos.staking.v1beta1.HistoricalInfo.encode(message.hist, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryHistoricalInfoResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryHistoricalInfoResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoResponse - * @static - * @param {cosmos.staking.v1beta1.IQueryHistoricalInfoResponse} message QueryHistoricalInfoResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryHistoricalInfoResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryHistoricalInfoResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.QueryHistoricalInfoResponse} QueryHistoricalInfoResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryHistoricalInfoResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryHistoricalInfoResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.hist = $root.cosmos.staking.v1beta1.HistoricalInfo.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryHistoricalInfoResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.QueryHistoricalInfoResponse} QueryHistoricalInfoResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryHistoricalInfoResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryHistoricalInfoResponse message. - * @function verify - * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryHistoricalInfoResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.hist != null && message.hasOwnProperty("hist")) { - let error = $root.cosmos.staking.v1beta1.HistoricalInfo.verify(message.hist); - if (error) - return "hist." + error; - } - return null; - }; - - /** - * Creates a QueryHistoricalInfoResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.QueryHistoricalInfoResponse} QueryHistoricalInfoResponse - */ - QueryHistoricalInfoResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.QueryHistoricalInfoResponse) - return object; - let message = new $root.cosmos.staking.v1beta1.QueryHistoricalInfoResponse(); - if (object.hist != null) { - if (typeof object.hist !== "object") - throw TypeError(".cosmos.staking.v1beta1.QueryHistoricalInfoResponse.hist: object expected"); - message.hist = $root.cosmos.staking.v1beta1.HistoricalInfo.fromObject(object.hist); - } - return message; - }; - - /** - * Creates a plain object from a QueryHistoricalInfoResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoResponse - * @static - * @param {cosmos.staking.v1beta1.QueryHistoricalInfoResponse} message QueryHistoricalInfoResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryHistoricalInfoResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.hist = null; - if (message.hist != null && message.hasOwnProperty("hist")) - object.hist = $root.cosmos.staking.v1beta1.HistoricalInfo.toObject(message.hist, options); - return object; - }; - - /** - * Converts this QueryHistoricalInfoResponse to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.QueryHistoricalInfoResponse - * @instance - * @returns {Object.} JSON object - */ - QueryHistoricalInfoResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryHistoricalInfoResponse; - })(); - - v1beta1.QueryPoolRequest = (function() { - - /** - * Properties of a QueryPoolRequest. - * @memberof cosmos.staking.v1beta1 - * @interface IQueryPoolRequest - */ - - /** - * Constructs a new QueryPoolRequest. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a QueryPoolRequest. - * @implements IQueryPoolRequest - * @constructor - * @param {cosmos.staking.v1beta1.IQueryPoolRequest=} [properties] Properties to set - */ - function QueryPoolRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified QueryPoolRequest message. Does not implicitly {@link cosmos.staking.v1beta1.QueryPoolRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.QueryPoolRequest - * @static - * @param {cosmos.staking.v1beta1.IQueryPoolRequest} message QueryPoolRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryPoolRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified QueryPoolRequest message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryPoolRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.QueryPoolRequest - * @static - * @param {cosmos.staking.v1beta1.IQueryPoolRequest} message QueryPoolRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryPoolRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryPoolRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.QueryPoolRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.QueryPoolRequest} QueryPoolRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryPoolRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryPoolRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryPoolRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.QueryPoolRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.QueryPoolRequest} QueryPoolRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryPoolRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryPoolRequest message. - * @function verify - * @memberof cosmos.staking.v1beta1.QueryPoolRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryPoolRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a QueryPoolRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.QueryPoolRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.QueryPoolRequest} QueryPoolRequest - */ - QueryPoolRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.QueryPoolRequest) - return object; - return new $root.cosmos.staking.v1beta1.QueryPoolRequest(); - }; - - /** - * Creates a plain object from a QueryPoolRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.QueryPoolRequest - * @static - * @param {cosmos.staking.v1beta1.QueryPoolRequest} message QueryPoolRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryPoolRequest.toObject = function toObject() { - return {}; - }; - - /** - * Converts this QueryPoolRequest to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.QueryPoolRequest - * @instance - * @returns {Object.} JSON object - */ - QueryPoolRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryPoolRequest; - })(); - - v1beta1.QueryPoolResponse = (function() { - - /** - * Properties of a QueryPoolResponse. - * @memberof cosmos.staking.v1beta1 - * @interface IQueryPoolResponse - * @property {cosmos.staking.v1beta1.IPool|null} [pool] QueryPoolResponse pool - */ - - /** - * Constructs a new QueryPoolResponse. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a QueryPoolResponse. - * @implements IQueryPoolResponse - * @constructor - * @param {cosmos.staking.v1beta1.IQueryPoolResponse=} [properties] Properties to set - */ - function QueryPoolResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryPoolResponse pool. - * @member {cosmos.staking.v1beta1.IPool|null|undefined} pool - * @memberof cosmos.staking.v1beta1.QueryPoolResponse - * @instance - */ - QueryPoolResponse.prototype.pool = null; - - /** - * Encodes the specified QueryPoolResponse message. Does not implicitly {@link cosmos.staking.v1beta1.QueryPoolResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.QueryPoolResponse - * @static - * @param {cosmos.staking.v1beta1.IQueryPoolResponse} message QueryPoolResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryPoolResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.pool != null && Object.hasOwnProperty.call(message, "pool")) - $root.cosmos.staking.v1beta1.Pool.encode(message.pool, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryPoolResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryPoolResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.QueryPoolResponse - * @static - * @param {cosmos.staking.v1beta1.IQueryPoolResponse} message QueryPoolResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryPoolResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryPoolResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.QueryPoolResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.QueryPoolResponse} QueryPoolResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryPoolResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryPoolResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.pool = $root.cosmos.staking.v1beta1.Pool.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryPoolResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.QueryPoolResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.QueryPoolResponse} QueryPoolResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryPoolResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryPoolResponse message. - * @function verify - * @memberof cosmos.staking.v1beta1.QueryPoolResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryPoolResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.pool != null && message.hasOwnProperty("pool")) { - let error = $root.cosmos.staking.v1beta1.Pool.verify(message.pool); - if (error) - return "pool." + error; - } - return null; - }; - - /** - * Creates a QueryPoolResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.QueryPoolResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.QueryPoolResponse} QueryPoolResponse - */ - QueryPoolResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.QueryPoolResponse) - return object; - let message = new $root.cosmos.staking.v1beta1.QueryPoolResponse(); - if (object.pool != null) { - if (typeof object.pool !== "object") - throw TypeError(".cosmos.staking.v1beta1.QueryPoolResponse.pool: object expected"); - message.pool = $root.cosmos.staking.v1beta1.Pool.fromObject(object.pool); - } - return message; - }; - - /** - * Creates a plain object from a QueryPoolResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.QueryPoolResponse - * @static - * @param {cosmos.staking.v1beta1.QueryPoolResponse} message QueryPoolResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryPoolResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.pool = null; - if (message.pool != null && message.hasOwnProperty("pool")) - object.pool = $root.cosmos.staking.v1beta1.Pool.toObject(message.pool, options); - return object; - }; - - /** - * Converts this QueryPoolResponse to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.QueryPoolResponse - * @instance - * @returns {Object.} JSON object - */ - QueryPoolResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryPoolResponse; - })(); - - v1beta1.QueryParamsRequest = (function() { - - /** - * Properties of a QueryParamsRequest. - * @memberof cosmos.staking.v1beta1 - * @interface IQueryParamsRequest - */ - - /** - * Constructs a new QueryParamsRequest. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a QueryParamsRequest. - * @implements IQueryParamsRequest - * @constructor - * @param {cosmos.staking.v1beta1.IQueryParamsRequest=} [properties] Properties to set - */ - function QueryParamsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified QueryParamsRequest message. Does not implicitly {@link cosmos.staking.v1beta1.QueryParamsRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.QueryParamsRequest - * @static - * @param {cosmos.staking.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified QueryParamsRequest message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryParamsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.QueryParamsRequest - * @static - * @param {cosmos.staking.v1beta1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryParamsRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.QueryParamsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.QueryParamsRequest} QueryParamsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryParamsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryParamsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.QueryParamsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.QueryParamsRequest} QueryParamsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryParamsRequest message. - * @function verify - * @memberof cosmos.staking.v1beta1.QueryParamsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryParamsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a QueryParamsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.QueryParamsRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.QueryParamsRequest} QueryParamsRequest - */ - QueryParamsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.QueryParamsRequest) - return object; - return new $root.cosmos.staking.v1beta1.QueryParamsRequest(); - }; - - /** - * Creates a plain object from a QueryParamsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.QueryParamsRequest - * @static - * @param {cosmos.staking.v1beta1.QueryParamsRequest} message QueryParamsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryParamsRequest.toObject = function toObject() { - return {}; - }; - - /** - * Converts this QueryParamsRequest to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.QueryParamsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryParamsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryParamsRequest; - })(); - - v1beta1.QueryParamsResponse = (function() { - - /** - * Properties of a QueryParamsResponse. - * @memberof cosmos.staking.v1beta1 - * @interface IQueryParamsResponse - * @property {cosmos.staking.v1beta1.IParams|null} [params] QueryParamsResponse params - */ - - /** - * Constructs a new QueryParamsResponse. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a QueryParamsResponse. - * @implements IQueryParamsResponse - * @constructor - * @param {cosmos.staking.v1beta1.IQueryParamsResponse=} [properties] Properties to set - */ - function QueryParamsResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryParamsResponse params. - * @member {cosmos.staking.v1beta1.IParams|null|undefined} params - * @memberof cosmos.staking.v1beta1.QueryParamsResponse - * @instance - */ - QueryParamsResponse.prototype.params = null; - - /** - * Encodes the specified QueryParamsResponse message. Does not implicitly {@link cosmos.staking.v1beta1.QueryParamsResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.QueryParamsResponse - * @static - * @param {cosmos.staking.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.params != null && Object.hasOwnProperty.call(message, "params")) - $root.cosmos.staking.v1beta1.Params.encode(message.params, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryParamsResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.QueryParamsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.QueryParamsResponse - * @static - * @param {cosmos.staking.v1beta1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryParamsResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.QueryParamsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.QueryParamsResponse} QueryParamsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.QueryParamsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.params = $root.cosmos.staking.v1beta1.Params.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryParamsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.QueryParamsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.QueryParamsResponse} QueryParamsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryParamsResponse message. - * @function verify - * @memberof cosmos.staking.v1beta1.QueryParamsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryParamsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.params != null && message.hasOwnProperty("params")) { - let error = $root.cosmos.staking.v1beta1.Params.verify(message.params); - if (error) - return "params." + error; - } - return null; - }; - - /** - * Creates a QueryParamsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.QueryParamsResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.QueryParamsResponse} QueryParamsResponse - */ - QueryParamsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.QueryParamsResponse) - return object; - let message = new $root.cosmos.staking.v1beta1.QueryParamsResponse(); - if (object.params != null) { - if (typeof object.params !== "object") - throw TypeError(".cosmos.staking.v1beta1.QueryParamsResponse.params: object expected"); - message.params = $root.cosmos.staking.v1beta1.Params.fromObject(object.params); - } - return message; - }; - - /** - * Creates a plain object from a QueryParamsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.QueryParamsResponse - * @static - * @param {cosmos.staking.v1beta1.QueryParamsResponse} message QueryParamsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryParamsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.params = null; - if (message.params != null && message.hasOwnProperty("params")) - object.params = $root.cosmos.staking.v1beta1.Params.toObject(message.params, options); - return object; - }; - - /** - * Converts this QueryParamsResponse to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.QueryParamsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryParamsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryParamsResponse; - })(); - - v1beta1.GenesisState = (function() { - - /** - * Properties of a GenesisState. - * @memberof cosmos.staking.v1beta1 - * @interface IGenesisState - * @property {cosmos.staking.v1beta1.IParams|null} [params] GenesisState params - * @property {Uint8Array|null} [last_total_power] GenesisState last_total_power - * @property {Array.|null} [last_validator_powers] GenesisState last_validator_powers - * @property {Array.|null} [validators] GenesisState validators - * @property {Array.|null} [delegations] GenesisState delegations - * @property {Array.|null} [unbonding_delegations] GenesisState unbonding_delegations - * @property {Array.|null} [redelegations] GenesisState redelegations - * @property {boolean|null} [exported] GenesisState exported - */ - - /** - * Constructs a new GenesisState. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a GenesisState. - * @implements IGenesisState - * @constructor - * @param {cosmos.staking.v1beta1.IGenesisState=} [properties] Properties to set - */ - function GenesisState(properties) { - this.last_validator_powers = []; - this.validators = []; - this.delegations = []; - this.unbonding_delegations = []; - this.redelegations = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GenesisState params. - * @member {cosmos.staking.v1beta1.IParams|null|undefined} params - * @memberof cosmos.staking.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.params = null; - - /** - * GenesisState last_total_power. - * @member {Uint8Array} last_total_power - * @memberof cosmos.staking.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.last_total_power = $util.newBuffer([]); - - /** - * GenesisState last_validator_powers. - * @member {Array.} last_validator_powers - * @memberof cosmos.staking.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.last_validator_powers = $util.emptyArray; - - /** - * GenesisState validators. - * @member {Array.} validators - * @memberof cosmos.staking.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.validators = $util.emptyArray; - - /** - * GenesisState delegations. - * @member {Array.} delegations - * @memberof cosmos.staking.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.delegations = $util.emptyArray; - - /** - * GenesisState unbonding_delegations. - * @member {Array.} unbonding_delegations - * @memberof cosmos.staking.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.unbonding_delegations = $util.emptyArray; - - /** - * GenesisState redelegations. - * @member {Array.} redelegations - * @memberof cosmos.staking.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.redelegations = $util.emptyArray; - - /** - * GenesisState exported. - * @member {boolean} exported - * @memberof cosmos.staking.v1beta1.GenesisState - * @instance - */ - GenesisState.prototype.exported = false; - - /** - * Encodes the specified GenesisState message. Does not implicitly {@link cosmos.staking.v1beta1.GenesisState.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.GenesisState - * @static - * @param {cosmos.staking.v1beta1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.params != null && Object.hasOwnProperty.call(message, "params")) - $root.cosmos.staking.v1beta1.Params.encode(message.params, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.last_total_power != null && Object.hasOwnProperty.call(message, "last_total_power")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.last_total_power); - if (message.last_validator_powers != null && message.last_validator_powers.length) - for (let i = 0; i < message.last_validator_powers.length; ++i) - $root.cosmos.staking.v1beta1.LastValidatorPower.encode(message.last_validator_powers[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.validators != null && message.validators.length) - for (let i = 0; i < message.validators.length; ++i) - $root.cosmos.staking.v1beta1.Validator.encode(message.validators[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.delegations != null && message.delegations.length) - for (let i = 0; i < message.delegations.length; ++i) - $root.cosmos.staking.v1beta1.Delegation.encode(message.delegations[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.unbonding_delegations != null && message.unbonding_delegations.length) - for (let i = 0; i < message.unbonding_delegations.length; ++i) - $root.cosmos.staking.v1beta1.UnbondingDelegation.encode(message.unbonding_delegations[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.redelegations != null && message.redelegations.length) - for (let i = 0; i < message.redelegations.length; ++i) - $root.cosmos.staking.v1beta1.Redelegation.encode(message.redelegations[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.exported != null && Object.hasOwnProperty.call(message, "exported")) - writer.uint32(/* id 8, wireType 0 =*/64).bool(message.exported); - return writer; - }; - - /** - * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.GenesisState.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.GenesisState - * @static - * @param {cosmos.staking.v1beta1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.GenesisState(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.params = $root.cosmos.staking.v1beta1.Params.decode(reader, reader.uint32()); - break; - case 2: - message.last_total_power = reader.bytes(); - break; - case 3: - if (!(message.last_validator_powers && message.last_validator_powers.length)) - message.last_validator_powers = []; - message.last_validator_powers.push($root.cosmos.staking.v1beta1.LastValidatorPower.decode(reader, reader.uint32())); - break; - case 4: - if (!(message.validators && message.validators.length)) - message.validators = []; - message.validators.push($root.cosmos.staking.v1beta1.Validator.decode(reader, reader.uint32())); - break; - case 5: - if (!(message.delegations && message.delegations.length)) - message.delegations = []; - message.delegations.push($root.cosmos.staking.v1beta1.Delegation.decode(reader, reader.uint32())); - break; - case 6: - if (!(message.unbonding_delegations && message.unbonding_delegations.length)) - message.unbonding_delegations = []; - message.unbonding_delegations.push($root.cosmos.staking.v1beta1.UnbondingDelegation.decode(reader, reader.uint32())); - break; - case 7: - if (!(message.redelegations && message.redelegations.length)) - message.redelegations = []; - message.redelegations.push($root.cosmos.staking.v1beta1.Redelegation.decode(reader, reader.uint32())); - break; - case 8: - message.exported = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GenesisState message. - * @function verify - * @memberof cosmos.staking.v1beta1.GenesisState - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GenesisState.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.params != null && message.hasOwnProperty("params")) { - let error = $root.cosmos.staking.v1beta1.Params.verify(message.params); - if (error) - return "params." + error; - } - if (message.last_total_power != null && message.hasOwnProperty("last_total_power")) - if (!(message.last_total_power && typeof message.last_total_power.length === "number" || $util.isString(message.last_total_power))) - return "last_total_power: buffer expected"; - if (message.last_validator_powers != null && message.hasOwnProperty("last_validator_powers")) { - if (!Array.isArray(message.last_validator_powers)) - return "last_validator_powers: array expected"; - for (let i = 0; i < message.last_validator_powers.length; ++i) { - let error = $root.cosmos.staking.v1beta1.LastValidatorPower.verify(message.last_validator_powers[i]); - if (error) - return "last_validator_powers." + error; - } - } - if (message.validators != null && message.hasOwnProperty("validators")) { - if (!Array.isArray(message.validators)) - return "validators: array expected"; - for (let i = 0; i < message.validators.length; ++i) { - let error = $root.cosmos.staking.v1beta1.Validator.verify(message.validators[i]); - if (error) - return "validators." + error; - } - } - if (message.delegations != null && message.hasOwnProperty("delegations")) { - if (!Array.isArray(message.delegations)) - return "delegations: array expected"; - for (let i = 0; i < message.delegations.length; ++i) { - let error = $root.cosmos.staking.v1beta1.Delegation.verify(message.delegations[i]); - if (error) - return "delegations." + error; - } - } - if (message.unbonding_delegations != null && message.hasOwnProperty("unbonding_delegations")) { - if (!Array.isArray(message.unbonding_delegations)) - return "unbonding_delegations: array expected"; - for (let i = 0; i < message.unbonding_delegations.length; ++i) { - let error = $root.cosmos.staking.v1beta1.UnbondingDelegation.verify(message.unbonding_delegations[i]); - if (error) - return "unbonding_delegations." + error; - } - } - if (message.redelegations != null && message.hasOwnProperty("redelegations")) { - if (!Array.isArray(message.redelegations)) - return "redelegations: array expected"; - for (let i = 0; i < message.redelegations.length; ++i) { - let error = $root.cosmos.staking.v1beta1.Redelegation.verify(message.redelegations[i]); - if (error) - return "redelegations." + error; - } - } - if (message.exported != null && message.hasOwnProperty("exported")) - if (typeof message.exported !== "boolean") - return "exported: boolean expected"; - return null; - }; - - /** - * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.GenesisState - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.GenesisState} GenesisState - */ - GenesisState.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.GenesisState) - return object; - let message = new $root.cosmos.staking.v1beta1.GenesisState(); - if (object.params != null) { - if (typeof object.params !== "object") - throw TypeError(".cosmos.staking.v1beta1.GenesisState.params: object expected"); - message.params = $root.cosmos.staking.v1beta1.Params.fromObject(object.params); - } - if (object.last_total_power != null) - if (typeof object.last_total_power === "string") - $util.base64.decode(object.last_total_power, message.last_total_power = $util.newBuffer($util.base64.length(object.last_total_power)), 0); - else if (object.last_total_power.length) - message.last_total_power = object.last_total_power; - if (object.last_validator_powers) { - if (!Array.isArray(object.last_validator_powers)) - throw TypeError(".cosmos.staking.v1beta1.GenesisState.last_validator_powers: array expected"); - message.last_validator_powers = []; - for (let i = 0; i < object.last_validator_powers.length; ++i) { - if (typeof object.last_validator_powers[i] !== "object") - throw TypeError(".cosmos.staking.v1beta1.GenesisState.last_validator_powers: object expected"); - message.last_validator_powers[i] = $root.cosmos.staking.v1beta1.LastValidatorPower.fromObject(object.last_validator_powers[i]); - } - } - if (object.validators) { - if (!Array.isArray(object.validators)) - throw TypeError(".cosmos.staking.v1beta1.GenesisState.validators: array expected"); - message.validators = []; - for (let i = 0; i < object.validators.length; ++i) { - if (typeof object.validators[i] !== "object") - throw TypeError(".cosmos.staking.v1beta1.GenesisState.validators: object expected"); - message.validators[i] = $root.cosmos.staking.v1beta1.Validator.fromObject(object.validators[i]); - } - } - if (object.delegations) { - if (!Array.isArray(object.delegations)) - throw TypeError(".cosmos.staking.v1beta1.GenesisState.delegations: array expected"); - message.delegations = []; - for (let i = 0; i < object.delegations.length; ++i) { - if (typeof object.delegations[i] !== "object") - throw TypeError(".cosmos.staking.v1beta1.GenesisState.delegations: object expected"); - message.delegations[i] = $root.cosmos.staking.v1beta1.Delegation.fromObject(object.delegations[i]); - } - } - if (object.unbonding_delegations) { - if (!Array.isArray(object.unbonding_delegations)) - throw TypeError(".cosmos.staking.v1beta1.GenesisState.unbonding_delegations: array expected"); - message.unbonding_delegations = []; - for (let i = 0; i < object.unbonding_delegations.length; ++i) { - if (typeof object.unbonding_delegations[i] !== "object") - throw TypeError(".cosmos.staking.v1beta1.GenesisState.unbonding_delegations: object expected"); - message.unbonding_delegations[i] = $root.cosmos.staking.v1beta1.UnbondingDelegation.fromObject(object.unbonding_delegations[i]); - } - } - if (object.redelegations) { - if (!Array.isArray(object.redelegations)) - throw TypeError(".cosmos.staking.v1beta1.GenesisState.redelegations: array expected"); - message.redelegations = []; - for (let i = 0; i < object.redelegations.length; ++i) { - if (typeof object.redelegations[i] !== "object") - throw TypeError(".cosmos.staking.v1beta1.GenesisState.redelegations: object expected"); - message.redelegations[i] = $root.cosmos.staking.v1beta1.Redelegation.fromObject(object.redelegations[i]); - } - } - if (object.exported != null) - message.exported = Boolean(object.exported); - return message; - }; - - /** - * Creates a plain object from a GenesisState message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.GenesisState - * @static - * @param {cosmos.staking.v1beta1.GenesisState} message GenesisState - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GenesisState.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) { - object.last_validator_powers = []; - object.validators = []; - object.delegations = []; - object.unbonding_delegations = []; - object.redelegations = []; - } - if (options.defaults) { - object.params = null; - if (options.bytes === String) - object.last_total_power = ""; - else { - object.last_total_power = []; - if (options.bytes !== Array) - object.last_total_power = $util.newBuffer(object.last_total_power); - } - object.exported = false; - } - if (message.params != null && message.hasOwnProperty("params")) - object.params = $root.cosmos.staking.v1beta1.Params.toObject(message.params, options); - if (message.last_total_power != null && message.hasOwnProperty("last_total_power")) - object.last_total_power = options.bytes === String ? $util.base64.encode(message.last_total_power, 0, message.last_total_power.length) : options.bytes === Array ? Array.prototype.slice.call(message.last_total_power) : message.last_total_power; - if (message.last_validator_powers && message.last_validator_powers.length) { - object.last_validator_powers = []; - for (let j = 0; j < message.last_validator_powers.length; ++j) - object.last_validator_powers[j] = $root.cosmos.staking.v1beta1.LastValidatorPower.toObject(message.last_validator_powers[j], options); - } - if (message.validators && message.validators.length) { - object.validators = []; - for (let j = 0; j < message.validators.length; ++j) - object.validators[j] = $root.cosmos.staking.v1beta1.Validator.toObject(message.validators[j], options); - } - if (message.delegations && message.delegations.length) { - object.delegations = []; - for (let j = 0; j < message.delegations.length; ++j) - object.delegations[j] = $root.cosmos.staking.v1beta1.Delegation.toObject(message.delegations[j], options); - } - if (message.unbonding_delegations && message.unbonding_delegations.length) { - object.unbonding_delegations = []; - for (let j = 0; j < message.unbonding_delegations.length; ++j) - object.unbonding_delegations[j] = $root.cosmos.staking.v1beta1.UnbondingDelegation.toObject(message.unbonding_delegations[j], options); - } - if (message.redelegations && message.redelegations.length) { - object.redelegations = []; - for (let j = 0; j < message.redelegations.length; ++j) - object.redelegations[j] = $root.cosmos.staking.v1beta1.Redelegation.toObject(message.redelegations[j], options); - } - if (message.exported != null && message.hasOwnProperty("exported")) - object.exported = message.exported; - return object; - }; - - /** - * Converts this GenesisState to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.GenesisState - * @instance - * @returns {Object.} JSON object - */ - GenesisState.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GenesisState; - })(); - - v1beta1.LastValidatorPower = (function() { - - /** - * Properties of a LastValidatorPower. - * @memberof cosmos.staking.v1beta1 - * @interface ILastValidatorPower - * @property {string|null} [address] LastValidatorPower address - * @property {Long|null} [power] LastValidatorPower power - */ - - /** - * Constructs a new LastValidatorPower. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a LastValidatorPower. - * @implements ILastValidatorPower - * @constructor - * @param {cosmos.staking.v1beta1.ILastValidatorPower=} [properties] Properties to set - */ - function LastValidatorPower(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * LastValidatorPower address. - * @member {string} address - * @memberof cosmos.staking.v1beta1.LastValidatorPower - * @instance - */ - LastValidatorPower.prototype.address = ""; - - /** - * LastValidatorPower power. - * @member {Long} power - * @memberof cosmos.staking.v1beta1.LastValidatorPower - * @instance - */ - LastValidatorPower.prototype.power = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Encodes the specified LastValidatorPower message. Does not implicitly {@link cosmos.staking.v1beta1.LastValidatorPower.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.LastValidatorPower - * @static - * @param {cosmos.staking.v1beta1.ILastValidatorPower} message LastValidatorPower message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LastValidatorPower.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.address != null && Object.hasOwnProperty.call(message, "address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.address); - if (message.power != null && Object.hasOwnProperty.call(message, "power")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.power); - return writer; - }; - - /** - * Encodes the specified LastValidatorPower message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.LastValidatorPower.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.LastValidatorPower - * @static - * @param {cosmos.staking.v1beta1.ILastValidatorPower} message LastValidatorPower message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LastValidatorPower.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a LastValidatorPower message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.LastValidatorPower - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.LastValidatorPower} LastValidatorPower - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LastValidatorPower.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.LastValidatorPower(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.address = reader.string(); - break; - case 2: - message.power = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a LastValidatorPower message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.LastValidatorPower - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.LastValidatorPower} LastValidatorPower - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LastValidatorPower.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a LastValidatorPower message. - * @function verify - * @memberof cosmos.staking.v1beta1.LastValidatorPower - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - LastValidatorPower.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.address != null && message.hasOwnProperty("address")) - if (!$util.isString(message.address)) - return "address: string expected"; - if (message.power != null && message.hasOwnProperty("power")) - if (!$util.isInteger(message.power) && !(message.power && $util.isInteger(message.power.low) && $util.isInteger(message.power.high))) - return "power: integer|Long expected"; - return null; - }; - - /** - * Creates a LastValidatorPower message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.LastValidatorPower - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.LastValidatorPower} LastValidatorPower - */ - LastValidatorPower.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.LastValidatorPower) - return object; - let message = new $root.cosmos.staking.v1beta1.LastValidatorPower(); - if (object.address != null) - message.address = String(object.address); - if (object.power != null) - if ($util.Long) - (message.power = $util.Long.fromValue(object.power)).unsigned = false; - else if (typeof object.power === "string") - message.power = parseInt(object.power, 10); - else if (typeof object.power === "number") - message.power = object.power; - else if (typeof object.power === "object") - message.power = new $util.LongBits(object.power.low >>> 0, object.power.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a LastValidatorPower message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.LastValidatorPower - * @static - * @param {cosmos.staking.v1beta1.LastValidatorPower} message LastValidatorPower - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - LastValidatorPower.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.address = ""; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.power = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.power = options.longs === String ? "0" : 0; - } - if (message.address != null && message.hasOwnProperty("address")) - object.address = message.address; - if (message.power != null && message.hasOwnProperty("power")) - if (typeof message.power === "number") - object.power = options.longs === String ? String(message.power) : message.power; - else - object.power = options.longs === String ? $util.Long.prototype.toString.call(message.power) : options.longs === Number ? new $util.LongBits(message.power.low >>> 0, message.power.high >>> 0).toNumber() : message.power; - return object; - }; - - /** - * Converts this LastValidatorPower to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.LastValidatorPower - * @instance - * @returns {Object.} JSON object - */ - LastValidatorPower.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return LastValidatorPower; - })(); - - v1beta1.HistoricalInfo = (function() { - - /** - * Properties of a HistoricalInfo. - * @memberof cosmos.staking.v1beta1 - * @interface IHistoricalInfo - * @property {tendermint.types.IHeader|null} [header] HistoricalInfo header - * @property {Array.|null} [valset] HistoricalInfo valset - */ - - /** - * Constructs a new HistoricalInfo. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a HistoricalInfo. - * @implements IHistoricalInfo - * @constructor - * @param {cosmos.staking.v1beta1.IHistoricalInfo=} [properties] Properties to set - */ - function HistoricalInfo(properties) { - this.valset = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * HistoricalInfo header. - * @member {tendermint.types.IHeader|null|undefined} header - * @memberof cosmos.staking.v1beta1.HistoricalInfo - * @instance - */ - HistoricalInfo.prototype.header = null; - - /** - * HistoricalInfo valset. - * @member {Array.} valset - * @memberof cosmos.staking.v1beta1.HistoricalInfo - * @instance - */ - HistoricalInfo.prototype.valset = $util.emptyArray; - - /** - * Encodes the specified HistoricalInfo message. Does not implicitly {@link cosmos.staking.v1beta1.HistoricalInfo.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.HistoricalInfo - * @static - * @param {cosmos.staking.v1beta1.IHistoricalInfo} message HistoricalInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - HistoricalInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.header != null && Object.hasOwnProperty.call(message, "header")) - $root.tendermint.types.Header.encode(message.header, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.valset != null && message.valset.length) - for (let i = 0; i < message.valset.length; ++i) - $root.cosmos.staking.v1beta1.Validator.encode(message.valset[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified HistoricalInfo message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.HistoricalInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.HistoricalInfo - * @static - * @param {cosmos.staking.v1beta1.IHistoricalInfo} message HistoricalInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - HistoricalInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a HistoricalInfo message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.HistoricalInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.HistoricalInfo} HistoricalInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - HistoricalInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.HistoricalInfo(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.header = $root.tendermint.types.Header.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.valset && message.valset.length)) - message.valset = []; - message.valset.push($root.cosmos.staking.v1beta1.Validator.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a HistoricalInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.HistoricalInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.HistoricalInfo} HistoricalInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - HistoricalInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a HistoricalInfo message. - * @function verify - * @memberof cosmos.staking.v1beta1.HistoricalInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - HistoricalInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.header != null && message.hasOwnProperty("header")) { - let error = $root.tendermint.types.Header.verify(message.header); - if (error) - return "header." + error; - } - if (message.valset != null && message.hasOwnProperty("valset")) { - if (!Array.isArray(message.valset)) - return "valset: array expected"; - for (let i = 0; i < message.valset.length; ++i) { - let error = $root.cosmos.staking.v1beta1.Validator.verify(message.valset[i]); - if (error) - return "valset." + error; - } - } - return null; - }; - - /** - * Creates a HistoricalInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.HistoricalInfo - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.HistoricalInfo} HistoricalInfo - */ - HistoricalInfo.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.HistoricalInfo) - return object; - let message = new $root.cosmos.staking.v1beta1.HistoricalInfo(); - if (object.header != null) { - if (typeof object.header !== "object") - throw TypeError(".cosmos.staking.v1beta1.HistoricalInfo.header: object expected"); - message.header = $root.tendermint.types.Header.fromObject(object.header); - } - if (object.valset) { - if (!Array.isArray(object.valset)) - throw TypeError(".cosmos.staking.v1beta1.HistoricalInfo.valset: array expected"); - message.valset = []; - for (let i = 0; i < object.valset.length; ++i) { - if (typeof object.valset[i] !== "object") - throw TypeError(".cosmos.staking.v1beta1.HistoricalInfo.valset: object expected"); - message.valset[i] = $root.cosmos.staking.v1beta1.Validator.fromObject(object.valset[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a HistoricalInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.HistoricalInfo - * @static - * @param {cosmos.staking.v1beta1.HistoricalInfo} message HistoricalInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - HistoricalInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.valset = []; - if (options.defaults) - object.header = null; - if (message.header != null && message.hasOwnProperty("header")) - object.header = $root.tendermint.types.Header.toObject(message.header, options); - if (message.valset && message.valset.length) { - object.valset = []; - for (let j = 0; j < message.valset.length; ++j) - object.valset[j] = $root.cosmos.staking.v1beta1.Validator.toObject(message.valset[j], options); - } - return object; - }; - - /** - * Converts this HistoricalInfo to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.HistoricalInfo - * @instance - * @returns {Object.} JSON object - */ - HistoricalInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return HistoricalInfo; - })(); - - v1beta1.CommissionRates = (function() { - - /** - * Properties of a CommissionRates. - * @memberof cosmos.staking.v1beta1 - * @interface ICommissionRates - * @property {string|null} [rate] CommissionRates rate - * @property {string|null} [max_rate] CommissionRates max_rate - * @property {string|null} [max_change_rate] CommissionRates max_change_rate - */ - - /** - * Constructs a new CommissionRates. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a CommissionRates. - * @implements ICommissionRates - * @constructor - * @param {cosmos.staking.v1beta1.ICommissionRates=} [properties] Properties to set - */ - function CommissionRates(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * CommissionRates rate. - * @member {string} rate - * @memberof cosmos.staking.v1beta1.CommissionRates - * @instance - */ - CommissionRates.prototype.rate = ""; - - /** - * CommissionRates max_rate. - * @member {string} max_rate - * @memberof cosmos.staking.v1beta1.CommissionRates - * @instance - */ - CommissionRates.prototype.max_rate = ""; - - /** - * CommissionRates max_change_rate. - * @member {string} max_change_rate - * @memberof cosmos.staking.v1beta1.CommissionRates - * @instance - */ - CommissionRates.prototype.max_change_rate = ""; - - /** - * Encodes the specified CommissionRates message. Does not implicitly {@link cosmos.staking.v1beta1.CommissionRates.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.CommissionRates - * @static - * @param {cosmos.staking.v1beta1.ICommissionRates} message CommissionRates message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CommissionRates.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.rate != null && Object.hasOwnProperty.call(message, "rate")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.rate); - if (message.max_rate != null && Object.hasOwnProperty.call(message, "max_rate")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.max_rate); - if (message.max_change_rate != null && Object.hasOwnProperty.call(message, "max_change_rate")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.max_change_rate); - return writer; - }; - - /** - * Encodes the specified CommissionRates message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.CommissionRates.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.CommissionRates - * @static - * @param {cosmos.staking.v1beta1.ICommissionRates} message CommissionRates message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CommissionRates.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CommissionRates message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.CommissionRates - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.CommissionRates} CommissionRates - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CommissionRates.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.CommissionRates(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.rate = reader.string(); - break; - case 2: - message.max_rate = reader.string(); - break; - case 3: - message.max_change_rate = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CommissionRates message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.CommissionRates - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.CommissionRates} CommissionRates - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CommissionRates.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CommissionRates message. - * @function verify - * @memberof cosmos.staking.v1beta1.CommissionRates - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CommissionRates.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.rate != null && message.hasOwnProperty("rate")) - if (!$util.isString(message.rate)) - return "rate: string expected"; - if (message.max_rate != null && message.hasOwnProperty("max_rate")) - if (!$util.isString(message.max_rate)) - return "max_rate: string expected"; - if (message.max_change_rate != null && message.hasOwnProperty("max_change_rate")) - if (!$util.isString(message.max_change_rate)) - return "max_change_rate: string expected"; - return null; - }; - - /** - * Creates a CommissionRates message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.CommissionRates - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.CommissionRates} CommissionRates - */ - CommissionRates.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.CommissionRates) - return object; - let message = new $root.cosmos.staking.v1beta1.CommissionRates(); - if (object.rate != null) - message.rate = String(object.rate); - if (object.max_rate != null) - message.max_rate = String(object.max_rate); - if (object.max_change_rate != null) - message.max_change_rate = String(object.max_change_rate); - return message; - }; - - /** - * Creates a plain object from a CommissionRates message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.CommissionRates - * @static - * @param {cosmos.staking.v1beta1.CommissionRates} message CommissionRates - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CommissionRates.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.rate = ""; - object.max_rate = ""; - object.max_change_rate = ""; - } - if (message.rate != null && message.hasOwnProperty("rate")) - object.rate = message.rate; - if (message.max_rate != null && message.hasOwnProperty("max_rate")) - object.max_rate = message.max_rate; - if (message.max_change_rate != null && message.hasOwnProperty("max_change_rate")) - object.max_change_rate = message.max_change_rate; - return object; - }; - - /** - * Converts this CommissionRates to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.CommissionRates - * @instance - * @returns {Object.} JSON object - */ - CommissionRates.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return CommissionRates; - })(); - - v1beta1.Commission = (function() { - - /** - * Properties of a Commission. - * @memberof cosmos.staking.v1beta1 - * @interface ICommission - * @property {cosmos.staking.v1beta1.ICommissionRates|null} [commission_rates] Commission commission_rates - * @property {google.protobuf.ITimestamp|null} [update_time] Commission update_time - */ - - /** - * Constructs a new Commission. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a Commission. - * @implements ICommission - * @constructor - * @param {cosmos.staking.v1beta1.ICommission=} [properties] Properties to set - */ - function Commission(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Commission commission_rates. - * @member {cosmos.staking.v1beta1.ICommissionRates|null|undefined} commission_rates - * @memberof cosmos.staking.v1beta1.Commission - * @instance - */ - Commission.prototype.commission_rates = null; - - /** - * Commission update_time. - * @member {google.protobuf.ITimestamp|null|undefined} update_time - * @memberof cosmos.staking.v1beta1.Commission - * @instance - */ - Commission.prototype.update_time = null; - - /** - * Encodes the specified Commission message. Does not implicitly {@link cosmos.staking.v1beta1.Commission.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.Commission - * @static - * @param {cosmos.staking.v1beta1.ICommission} message Commission message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Commission.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.commission_rates != null && Object.hasOwnProperty.call(message, "commission_rates")) - $root.cosmos.staking.v1beta1.CommissionRates.encode(message.commission_rates, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.update_time != null && Object.hasOwnProperty.call(message, "update_time")) - $root.google.protobuf.Timestamp.encode(message.update_time, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Commission message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.Commission.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.Commission - * @static - * @param {cosmos.staking.v1beta1.ICommission} message Commission message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Commission.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Commission message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.Commission - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.Commission} Commission - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Commission.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.Commission(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.commission_rates = $root.cosmos.staking.v1beta1.CommissionRates.decode(reader, reader.uint32()); - break; - case 2: - message.update_time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Commission message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.Commission - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.Commission} Commission - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Commission.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Commission message. - * @function verify - * @memberof cosmos.staking.v1beta1.Commission - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Commission.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.commission_rates != null && message.hasOwnProperty("commission_rates")) { - let error = $root.cosmos.staking.v1beta1.CommissionRates.verify(message.commission_rates); - if (error) - return "commission_rates." + error; - } - if (message.update_time != null && message.hasOwnProperty("update_time")) { - let error = $root.google.protobuf.Timestamp.verify(message.update_time); - if (error) - return "update_time." + error; - } - return null; - }; - - /** - * Creates a Commission message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.Commission - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.Commission} Commission - */ - Commission.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.Commission) - return object; - let message = new $root.cosmos.staking.v1beta1.Commission(); - if (object.commission_rates != null) { - if (typeof object.commission_rates !== "object") - throw TypeError(".cosmos.staking.v1beta1.Commission.commission_rates: object expected"); - message.commission_rates = $root.cosmos.staking.v1beta1.CommissionRates.fromObject(object.commission_rates); - } - if (object.update_time != null) { - if (typeof object.update_time !== "object") - throw TypeError(".cosmos.staking.v1beta1.Commission.update_time: object expected"); - message.update_time = $root.google.protobuf.Timestamp.fromObject(object.update_time); - } - return message; - }; - - /** - * Creates a plain object from a Commission message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.Commission - * @static - * @param {cosmos.staking.v1beta1.Commission} message Commission - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Commission.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.commission_rates = null; - object.update_time = null; - } - if (message.commission_rates != null && message.hasOwnProperty("commission_rates")) - object.commission_rates = $root.cosmos.staking.v1beta1.CommissionRates.toObject(message.commission_rates, options); - if (message.update_time != null && message.hasOwnProperty("update_time")) - object.update_time = $root.google.protobuf.Timestamp.toObject(message.update_time, options); - return object; - }; - - /** - * Converts this Commission to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.Commission - * @instance - * @returns {Object.} JSON object - */ - Commission.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Commission; - })(); - - v1beta1.Description = (function() { - - /** - * Properties of a Description. - * @memberof cosmos.staking.v1beta1 - * @interface IDescription - * @property {string|null} [moniker] Description moniker - * @property {string|null} [identity] Description identity - * @property {string|null} [website] Description website - * @property {string|null} [security_contact] Description security_contact - * @property {string|null} [details] Description details - */ - - /** - * Constructs a new Description. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a Description. - * @implements IDescription - * @constructor - * @param {cosmos.staking.v1beta1.IDescription=} [properties] Properties to set - */ - function Description(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Description moniker. - * @member {string} moniker - * @memberof cosmos.staking.v1beta1.Description - * @instance - */ - Description.prototype.moniker = ""; - - /** - * Description identity. - * @member {string} identity - * @memberof cosmos.staking.v1beta1.Description - * @instance - */ - Description.prototype.identity = ""; - - /** - * Description website. - * @member {string} website - * @memberof cosmos.staking.v1beta1.Description - * @instance - */ - Description.prototype.website = ""; - - /** - * Description security_contact. - * @member {string} security_contact - * @memberof cosmos.staking.v1beta1.Description - * @instance - */ - Description.prototype.security_contact = ""; - - /** - * Description details. - * @member {string} details - * @memberof cosmos.staking.v1beta1.Description - * @instance - */ - Description.prototype.details = ""; - - /** - * Encodes the specified Description message. Does not implicitly {@link cosmos.staking.v1beta1.Description.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.Description - * @static - * @param {cosmos.staking.v1beta1.IDescription} message Description message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Description.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.moniker != null && Object.hasOwnProperty.call(message, "moniker")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.moniker); - if (message.identity != null && Object.hasOwnProperty.call(message, "identity")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.identity); - if (message.website != null && Object.hasOwnProperty.call(message, "website")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.website); - if (message.security_contact != null && Object.hasOwnProperty.call(message, "security_contact")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.security_contact); - if (message.details != null && Object.hasOwnProperty.call(message, "details")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.details); - return writer; - }; - - /** - * Encodes the specified Description message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.Description.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.Description - * @static - * @param {cosmos.staking.v1beta1.IDescription} message Description message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Description.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Description message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.Description - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.Description} Description - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Description.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.Description(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.moniker = reader.string(); - break; - case 2: - message.identity = reader.string(); - break; - case 3: - message.website = reader.string(); - break; - case 4: - message.security_contact = reader.string(); - break; - case 5: - message.details = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Description message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.Description - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.Description} Description - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Description.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Description message. - * @function verify - * @memberof cosmos.staking.v1beta1.Description - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Description.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.moniker != null && message.hasOwnProperty("moniker")) - if (!$util.isString(message.moniker)) - return "moniker: string expected"; - if (message.identity != null && message.hasOwnProperty("identity")) - if (!$util.isString(message.identity)) - return "identity: string expected"; - if (message.website != null && message.hasOwnProperty("website")) - if (!$util.isString(message.website)) - return "website: string expected"; - if (message.security_contact != null && message.hasOwnProperty("security_contact")) - if (!$util.isString(message.security_contact)) - return "security_contact: string expected"; - if (message.details != null && message.hasOwnProperty("details")) - if (!$util.isString(message.details)) - return "details: string expected"; - return null; - }; - - /** - * Creates a Description message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.Description - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.Description} Description - */ - Description.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.Description) - return object; - let message = new $root.cosmos.staking.v1beta1.Description(); - if (object.moniker != null) - message.moniker = String(object.moniker); - if (object.identity != null) - message.identity = String(object.identity); - if (object.website != null) - message.website = String(object.website); - if (object.security_contact != null) - message.security_contact = String(object.security_contact); - if (object.details != null) - message.details = String(object.details); - return message; - }; - - /** - * Creates a plain object from a Description message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.Description - * @static - * @param {cosmos.staking.v1beta1.Description} message Description - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Description.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.moniker = ""; - object.identity = ""; - object.website = ""; - object.security_contact = ""; - object.details = ""; - } - if (message.moniker != null && message.hasOwnProperty("moniker")) - object.moniker = message.moniker; - if (message.identity != null && message.hasOwnProperty("identity")) - object.identity = message.identity; - if (message.website != null && message.hasOwnProperty("website")) - object.website = message.website; - if (message.security_contact != null && message.hasOwnProperty("security_contact")) - object.security_contact = message.security_contact; - if (message.details != null && message.hasOwnProperty("details")) - object.details = message.details; - return object; - }; - - /** - * Converts this Description to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.Description - * @instance - * @returns {Object.} JSON object - */ - Description.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Description; - })(); - - v1beta1.Validator = (function() { - - /** - * Properties of a Validator. - * @memberof cosmos.staking.v1beta1 - * @interface IValidator - * @property {string|null} [operator_address] Validator operator_address - * @property {google.protobuf.IAny|null} [consensus_pubkey] Validator consensus_pubkey - * @property {boolean|null} [jailed] Validator jailed - * @property {cosmos.staking.v1beta1.BondStatus|null} [status] Validator status - * @property {string|null} [tokens] Validator tokens - * @property {string|null} [delegator_shares] Validator delegator_shares - * @property {cosmos.staking.v1beta1.IDescription|null} [description] Validator description - * @property {Long|null} [unbonding_height] Validator unbonding_height - * @property {google.protobuf.ITimestamp|null} [unbonding_time] Validator unbonding_time - * @property {cosmos.staking.v1beta1.ICommission|null} [commission] Validator commission - * @property {string|null} [min_self_delegation] Validator min_self_delegation - */ - - /** - * Constructs a new Validator. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a Validator. - * @implements IValidator - * @constructor - * @param {cosmos.staking.v1beta1.IValidator=} [properties] Properties to set - */ - function Validator(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Validator operator_address. - * @member {string} operator_address - * @memberof cosmos.staking.v1beta1.Validator - * @instance - */ - Validator.prototype.operator_address = ""; - - /** - * Validator consensus_pubkey. - * @member {google.protobuf.IAny|null|undefined} consensus_pubkey - * @memberof cosmos.staking.v1beta1.Validator - * @instance - */ - Validator.prototype.consensus_pubkey = null; - - /** - * Validator jailed. - * @member {boolean} jailed - * @memberof cosmos.staking.v1beta1.Validator - * @instance - */ - Validator.prototype.jailed = false; - - /** - * Validator status. - * @member {cosmos.staking.v1beta1.BondStatus} status - * @memberof cosmos.staking.v1beta1.Validator - * @instance - */ - Validator.prototype.status = 0; - - /** - * Validator tokens. - * @member {string} tokens - * @memberof cosmos.staking.v1beta1.Validator - * @instance - */ - Validator.prototype.tokens = ""; - - /** - * Validator delegator_shares. - * @member {string} delegator_shares - * @memberof cosmos.staking.v1beta1.Validator - * @instance - */ - Validator.prototype.delegator_shares = ""; - - /** - * Validator description. - * @member {cosmos.staking.v1beta1.IDescription|null|undefined} description - * @memberof cosmos.staking.v1beta1.Validator - * @instance - */ - Validator.prototype.description = null; - - /** - * Validator unbonding_height. - * @member {Long} unbonding_height - * @memberof cosmos.staking.v1beta1.Validator - * @instance - */ - Validator.prototype.unbonding_height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Validator unbonding_time. - * @member {google.protobuf.ITimestamp|null|undefined} unbonding_time - * @memberof cosmos.staking.v1beta1.Validator - * @instance - */ - Validator.prototype.unbonding_time = null; - - /** - * Validator commission. - * @member {cosmos.staking.v1beta1.ICommission|null|undefined} commission - * @memberof cosmos.staking.v1beta1.Validator - * @instance - */ - Validator.prototype.commission = null; - - /** - * Validator min_self_delegation. - * @member {string} min_self_delegation - * @memberof cosmos.staking.v1beta1.Validator - * @instance - */ - Validator.prototype.min_self_delegation = ""; - - /** - * Encodes the specified Validator message. Does not implicitly {@link cosmos.staking.v1beta1.Validator.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.Validator - * @static - * @param {cosmos.staking.v1beta1.IValidator} message Validator message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Validator.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.operator_address != null && Object.hasOwnProperty.call(message, "operator_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.operator_address); - if (message.consensus_pubkey != null && Object.hasOwnProperty.call(message, "consensus_pubkey")) - $root.google.protobuf.Any.encode(message.consensus_pubkey, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.jailed != null && Object.hasOwnProperty.call(message, "jailed")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.jailed); - if (message.status != null && Object.hasOwnProperty.call(message, "status")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.status); - if (message.tokens != null && Object.hasOwnProperty.call(message, "tokens")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.tokens); - if (message.delegator_shares != null && Object.hasOwnProperty.call(message, "delegator_shares")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.delegator_shares); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - $root.cosmos.staking.v1beta1.Description.encode(message.description, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.unbonding_height != null && Object.hasOwnProperty.call(message, "unbonding_height")) - writer.uint32(/* id 8, wireType 0 =*/64).int64(message.unbonding_height); - if (message.unbonding_time != null && Object.hasOwnProperty.call(message, "unbonding_time")) - $root.google.protobuf.Timestamp.encode(message.unbonding_time, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.commission != null && Object.hasOwnProperty.call(message, "commission")) - $root.cosmos.staking.v1beta1.Commission.encode(message.commission, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); - if (message.min_self_delegation != null && Object.hasOwnProperty.call(message, "min_self_delegation")) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.min_self_delegation); - return writer; - }; - - /** - * Encodes the specified Validator message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.Validator.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.Validator - * @static - * @param {cosmos.staking.v1beta1.IValidator} message Validator message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Validator.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Validator message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.Validator - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.Validator} Validator - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Validator.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.Validator(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.operator_address = reader.string(); - break; - case 2: - message.consensus_pubkey = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - case 3: - message.jailed = reader.bool(); - break; - case 4: - message.status = reader.int32(); - break; - case 5: - message.tokens = reader.string(); - break; - case 6: - message.delegator_shares = reader.string(); - break; - case 7: - message.description = $root.cosmos.staking.v1beta1.Description.decode(reader, reader.uint32()); - break; - case 8: - message.unbonding_height = reader.int64(); - break; - case 9: - message.unbonding_time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 10: - message.commission = $root.cosmos.staking.v1beta1.Commission.decode(reader, reader.uint32()); - break; - case 11: - message.min_self_delegation = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Validator message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.Validator - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.Validator} Validator - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Validator.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Validator message. - * @function verify - * @memberof cosmos.staking.v1beta1.Validator - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Validator.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.operator_address != null && message.hasOwnProperty("operator_address")) - if (!$util.isString(message.operator_address)) - return "operator_address: string expected"; - if (message.consensus_pubkey != null && message.hasOwnProperty("consensus_pubkey")) { - let error = $root.google.protobuf.Any.verify(message.consensus_pubkey); - if (error) - return "consensus_pubkey." + error; - } - if (message.jailed != null && message.hasOwnProperty("jailed")) - if (typeof message.jailed !== "boolean") - return "jailed: boolean expected"; - if (message.status != null && message.hasOwnProperty("status")) - switch (message.status) { - default: - return "status: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.tokens != null && message.hasOwnProperty("tokens")) - if (!$util.isString(message.tokens)) - return "tokens: string expected"; - if (message.delegator_shares != null && message.hasOwnProperty("delegator_shares")) - if (!$util.isString(message.delegator_shares)) - return "delegator_shares: string expected"; - if (message.description != null && message.hasOwnProperty("description")) { - let error = $root.cosmos.staking.v1beta1.Description.verify(message.description); - if (error) - return "description." + error; - } - if (message.unbonding_height != null && message.hasOwnProperty("unbonding_height")) - if (!$util.isInteger(message.unbonding_height) && !(message.unbonding_height && $util.isInteger(message.unbonding_height.low) && $util.isInteger(message.unbonding_height.high))) - return "unbonding_height: integer|Long expected"; - if (message.unbonding_time != null && message.hasOwnProperty("unbonding_time")) { - let error = $root.google.protobuf.Timestamp.verify(message.unbonding_time); - if (error) - return "unbonding_time." + error; - } - if (message.commission != null && message.hasOwnProperty("commission")) { - let error = $root.cosmos.staking.v1beta1.Commission.verify(message.commission); - if (error) - return "commission." + error; - } - if (message.min_self_delegation != null && message.hasOwnProperty("min_self_delegation")) - if (!$util.isString(message.min_self_delegation)) - return "min_self_delegation: string expected"; - return null; - }; - - /** - * Creates a Validator message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.Validator - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.Validator} Validator - */ - Validator.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.Validator) - return object; - let message = new $root.cosmos.staking.v1beta1.Validator(); - if (object.operator_address != null) - message.operator_address = String(object.operator_address); - if (object.consensus_pubkey != null) { - if (typeof object.consensus_pubkey !== "object") - throw TypeError(".cosmos.staking.v1beta1.Validator.consensus_pubkey: object expected"); - message.consensus_pubkey = $root.google.protobuf.Any.fromObject(object.consensus_pubkey); - } - if (object.jailed != null) - message.jailed = Boolean(object.jailed); - switch (object.status) { - case "BOND_STATUS_UNSPECIFIED": - case 0: - message.status = 0; - break; - case "BOND_STATUS_UNBONDED": - case 1: - message.status = 1; - break; - case "BOND_STATUS_UNBONDING": - case 2: - message.status = 2; - break; - case "BOND_STATUS_BONDED": - case 3: - message.status = 3; - break; - } - if (object.tokens != null) - message.tokens = String(object.tokens); - if (object.delegator_shares != null) - message.delegator_shares = String(object.delegator_shares); - if (object.description != null) { - if (typeof object.description !== "object") - throw TypeError(".cosmos.staking.v1beta1.Validator.description: object expected"); - message.description = $root.cosmos.staking.v1beta1.Description.fromObject(object.description); - } - if (object.unbonding_height != null) - if ($util.Long) - (message.unbonding_height = $util.Long.fromValue(object.unbonding_height)).unsigned = false; - else if (typeof object.unbonding_height === "string") - message.unbonding_height = parseInt(object.unbonding_height, 10); - else if (typeof object.unbonding_height === "number") - message.unbonding_height = object.unbonding_height; - else if (typeof object.unbonding_height === "object") - message.unbonding_height = new $util.LongBits(object.unbonding_height.low >>> 0, object.unbonding_height.high >>> 0).toNumber(); - if (object.unbonding_time != null) { - if (typeof object.unbonding_time !== "object") - throw TypeError(".cosmos.staking.v1beta1.Validator.unbonding_time: object expected"); - message.unbonding_time = $root.google.protobuf.Timestamp.fromObject(object.unbonding_time); - } - if (object.commission != null) { - if (typeof object.commission !== "object") - throw TypeError(".cosmos.staking.v1beta1.Validator.commission: object expected"); - message.commission = $root.cosmos.staking.v1beta1.Commission.fromObject(object.commission); - } - if (object.min_self_delegation != null) - message.min_self_delegation = String(object.min_self_delegation); - return message; - }; - - /** - * Creates a plain object from a Validator message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.Validator - * @static - * @param {cosmos.staking.v1beta1.Validator} message Validator - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Validator.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.operator_address = ""; - object.consensus_pubkey = null; - object.jailed = false; - object.status = options.enums === String ? "BOND_STATUS_UNSPECIFIED" : 0; - object.tokens = ""; - object.delegator_shares = ""; - object.description = null; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.unbonding_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.unbonding_height = options.longs === String ? "0" : 0; - object.unbonding_time = null; - object.commission = null; - object.min_self_delegation = ""; - } - if (message.operator_address != null && message.hasOwnProperty("operator_address")) - object.operator_address = message.operator_address; - if (message.consensus_pubkey != null && message.hasOwnProperty("consensus_pubkey")) - object.consensus_pubkey = $root.google.protobuf.Any.toObject(message.consensus_pubkey, options); - if (message.jailed != null && message.hasOwnProperty("jailed")) - object.jailed = message.jailed; - if (message.status != null && message.hasOwnProperty("status")) - object.status = options.enums === String ? $root.cosmos.staking.v1beta1.BondStatus[message.status] : message.status; - if (message.tokens != null && message.hasOwnProperty("tokens")) - object.tokens = message.tokens; - if (message.delegator_shares != null && message.hasOwnProperty("delegator_shares")) - object.delegator_shares = message.delegator_shares; - if (message.description != null && message.hasOwnProperty("description")) - object.description = $root.cosmos.staking.v1beta1.Description.toObject(message.description, options); - if (message.unbonding_height != null && message.hasOwnProperty("unbonding_height")) - if (typeof message.unbonding_height === "number") - object.unbonding_height = options.longs === String ? String(message.unbonding_height) : message.unbonding_height; - else - object.unbonding_height = options.longs === String ? $util.Long.prototype.toString.call(message.unbonding_height) : options.longs === Number ? new $util.LongBits(message.unbonding_height.low >>> 0, message.unbonding_height.high >>> 0).toNumber() : message.unbonding_height; - if (message.unbonding_time != null && message.hasOwnProperty("unbonding_time")) - object.unbonding_time = $root.google.protobuf.Timestamp.toObject(message.unbonding_time, options); - if (message.commission != null && message.hasOwnProperty("commission")) - object.commission = $root.cosmos.staking.v1beta1.Commission.toObject(message.commission, options); - if (message.min_self_delegation != null && message.hasOwnProperty("min_self_delegation")) - object.min_self_delegation = message.min_self_delegation; - return object; - }; - - /** - * Converts this Validator to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.Validator - * @instance - * @returns {Object.} JSON object - */ - Validator.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Validator; - })(); - - /** - * BondStatus enum. - * @name cosmos.staking.v1beta1.BondStatus - * @enum {number} - * @property {number} BOND_STATUS_UNSPECIFIED=0 BOND_STATUS_UNSPECIFIED value - * @property {number} BOND_STATUS_UNBONDED=1 BOND_STATUS_UNBONDED value - * @property {number} BOND_STATUS_UNBONDING=2 BOND_STATUS_UNBONDING value - * @property {number} BOND_STATUS_BONDED=3 BOND_STATUS_BONDED value - */ - v1beta1.BondStatus = (function() { - const valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "BOND_STATUS_UNSPECIFIED"] = 0; - values[valuesById[1] = "BOND_STATUS_UNBONDED"] = 1; - values[valuesById[2] = "BOND_STATUS_UNBONDING"] = 2; - values[valuesById[3] = "BOND_STATUS_BONDED"] = 3; - return values; - })(); - - v1beta1.ValAddresses = (function() { - - /** - * Properties of a ValAddresses. - * @memberof cosmos.staking.v1beta1 - * @interface IValAddresses - * @property {Array.|null} [addresses] ValAddresses addresses - */ - - /** - * Constructs a new ValAddresses. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a ValAddresses. - * @implements IValAddresses - * @constructor - * @param {cosmos.staking.v1beta1.IValAddresses=} [properties] Properties to set - */ - function ValAddresses(properties) { - this.addresses = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ValAddresses addresses. - * @member {Array.} addresses - * @memberof cosmos.staking.v1beta1.ValAddresses - * @instance - */ - ValAddresses.prototype.addresses = $util.emptyArray; - - /** - * Encodes the specified ValAddresses message. Does not implicitly {@link cosmos.staking.v1beta1.ValAddresses.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.ValAddresses - * @static - * @param {cosmos.staking.v1beta1.IValAddresses} message ValAddresses message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValAddresses.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.addresses != null && message.addresses.length) - for (let i = 0; i < message.addresses.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.addresses[i]); - return writer; - }; - - /** - * Encodes the specified ValAddresses message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.ValAddresses.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.ValAddresses - * @static - * @param {cosmos.staking.v1beta1.IValAddresses} message ValAddresses message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValAddresses.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ValAddresses message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.ValAddresses - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.ValAddresses} ValAddresses - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValAddresses.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.ValAddresses(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.addresses && message.addresses.length)) - message.addresses = []; - message.addresses.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ValAddresses message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.ValAddresses - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.ValAddresses} ValAddresses - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValAddresses.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ValAddresses message. - * @function verify - * @memberof cosmos.staking.v1beta1.ValAddresses - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ValAddresses.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.addresses != null && message.hasOwnProperty("addresses")) { - if (!Array.isArray(message.addresses)) - return "addresses: array expected"; - for (let i = 0; i < message.addresses.length; ++i) - if (!$util.isString(message.addresses[i])) - return "addresses: string[] expected"; - } - return null; - }; - - /** - * Creates a ValAddresses message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.ValAddresses - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.ValAddresses} ValAddresses - */ - ValAddresses.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.ValAddresses) - return object; - let message = new $root.cosmos.staking.v1beta1.ValAddresses(); - if (object.addresses) { - if (!Array.isArray(object.addresses)) - throw TypeError(".cosmos.staking.v1beta1.ValAddresses.addresses: array expected"); - message.addresses = []; - for (let i = 0; i < object.addresses.length; ++i) - message.addresses[i] = String(object.addresses[i]); - } - return message; - }; - - /** - * Creates a plain object from a ValAddresses message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.ValAddresses - * @static - * @param {cosmos.staking.v1beta1.ValAddresses} message ValAddresses - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ValAddresses.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.addresses = []; - if (message.addresses && message.addresses.length) { - object.addresses = []; - for (let j = 0; j < message.addresses.length; ++j) - object.addresses[j] = message.addresses[j]; - } - return object; - }; - - /** - * Converts this ValAddresses to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.ValAddresses - * @instance - * @returns {Object.} JSON object - */ - ValAddresses.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ValAddresses; - })(); - - v1beta1.DVPair = (function() { - - /** - * Properties of a DVPair. - * @memberof cosmos.staking.v1beta1 - * @interface IDVPair - * @property {string|null} [delegator_address] DVPair delegator_address - * @property {string|null} [validator_address] DVPair validator_address - */ - - /** - * Constructs a new DVPair. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a DVPair. - * @implements IDVPair - * @constructor - * @param {cosmos.staking.v1beta1.IDVPair=} [properties] Properties to set - */ - function DVPair(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DVPair delegator_address. - * @member {string} delegator_address - * @memberof cosmos.staking.v1beta1.DVPair - * @instance - */ - DVPair.prototype.delegator_address = ""; - - /** - * DVPair validator_address. - * @member {string} validator_address - * @memberof cosmos.staking.v1beta1.DVPair - * @instance - */ - DVPair.prototype.validator_address = ""; - - /** - * Encodes the specified DVPair message. Does not implicitly {@link cosmos.staking.v1beta1.DVPair.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.DVPair - * @static - * @param {cosmos.staking.v1beta1.IDVPair} message DVPair message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DVPair.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); - if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.validator_address); - return writer; - }; - - /** - * Encodes the specified DVPair message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.DVPair.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.DVPair - * @static - * @param {cosmos.staking.v1beta1.IDVPair} message DVPair message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DVPair.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DVPair message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.DVPair - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.DVPair} DVPair - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DVPair.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.DVPair(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.delegator_address = reader.string(); - break; - case 2: - message.validator_address = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DVPair message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.DVPair - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.DVPair} DVPair - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DVPair.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DVPair message. - * @function verify - * @memberof cosmos.staking.v1beta1.DVPair - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DVPair.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - if (!$util.isString(message.delegator_address)) - return "delegator_address: string expected"; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - if (!$util.isString(message.validator_address)) - return "validator_address: string expected"; - return null; - }; - - /** - * Creates a DVPair message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.DVPair - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.DVPair} DVPair - */ - DVPair.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.DVPair) - return object; - let message = new $root.cosmos.staking.v1beta1.DVPair(); - if (object.delegator_address != null) - message.delegator_address = String(object.delegator_address); - if (object.validator_address != null) - message.validator_address = String(object.validator_address); - return message; - }; - - /** - * Creates a plain object from a DVPair message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.DVPair - * @static - * @param {cosmos.staking.v1beta1.DVPair} message DVPair - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DVPair.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.delegator_address = ""; - object.validator_address = ""; - } - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - object.delegator_address = message.delegator_address; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - object.validator_address = message.validator_address; - return object; - }; - - /** - * Converts this DVPair to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.DVPair - * @instance - * @returns {Object.} JSON object - */ - DVPair.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return DVPair; - })(); - - v1beta1.DVPairs = (function() { - - /** - * Properties of a DVPairs. - * @memberof cosmos.staking.v1beta1 - * @interface IDVPairs - * @property {Array.|null} [pairs] DVPairs pairs - */ - - /** - * Constructs a new DVPairs. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a DVPairs. - * @implements IDVPairs - * @constructor - * @param {cosmos.staking.v1beta1.IDVPairs=} [properties] Properties to set - */ - function DVPairs(properties) { - this.pairs = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DVPairs pairs. - * @member {Array.} pairs - * @memberof cosmos.staking.v1beta1.DVPairs - * @instance - */ - DVPairs.prototype.pairs = $util.emptyArray; - - /** - * Encodes the specified DVPairs message. Does not implicitly {@link cosmos.staking.v1beta1.DVPairs.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.DVPairs - * @static - * @param {cosmos.staking.v1beta1.IDVPairs} message DVPairs message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DVPairs.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.pairs != null && message.pairs.length) - for (let i = 0; i < message.pairs.length; ++i) - $root.cosmos.staking.v1beta1.DVPair.encode(message.pairs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified DVPairs message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.DVPairs.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.DVPairs - * @static - * @param {cosmos.staking.v1beta1.IDVPairs} message DVPairs message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DVPairs.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DVPairs message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.DVPairs - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.DVPairs} DVPairs - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DVPairs.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.DVPairs(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.pairs && message.pairs.length)) - message.pairs = []; - message.pairs.push($root.cosmos.staking.v1beta1.DVPair.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DVPairs message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.DVPairs - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.DVPairs} DVPairs - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DVPairs.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DVPairs message. - * @function verify - * @memberof cosmos.staking.v1beta1.DVPairs - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DVPairs.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.pairs != null && message.hasOwnProperty("pairs")) { - if (!Array.isArray(message.pairs)) - return "pairs: array expected"; - for (let i = 0; i < message.pairs.length; ++i) { - let error = $root.cosmos.staking.v1beta1.DVPair.verify(message.pairs[i]); - if (error) - return "pairs." + error; - } - } - return null; - }; - - /** - * Creates a DVPairs message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.DVPairs - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.DVPairs} DVPairs - */ - DVPairs.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.DVPairs) - return object; - let message = new $root.cosmos.staking.v1beta1.DVPairs(); - if (object.pairs) { - if (!Array.isArray(object.pairs)) - throw TypeError(".cosmos.staking.v1beta1.DVPairs.pairs: array expected"); - message.pairs = []; - for (let i = 0; i < object.pairs.length; ++i) { - if (typeof object.pairs[i] !== "object") - throw TypeError(".cosmos.staking.v1beta1.DVPairs.pairs: object expected"); - message.pairs[i] = $root.cosmos.staking.v1beta1.DVPair.fromObject(object.pairs[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a DVPairs message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.DVPairs - * @static - * @param {cosmos.staking.v1beta1.DVPairs} message DVPairs - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DVPairs.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.pairs = []; - if (message.pairs && message.pairs.length) { - object.pairs = []; - for (let j = 0; j < message.pairs.length; ++j) - object.pairs[j] = $root.cosmos.staking.v1beta1.DVPair.toObject(message.pairs[j], options); - } - return object; - }; - - /** - * Converts this DVPairs to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.DVPairs - * @instance - * @returns {Object.} JSON object - */ - DVPairs.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return DVPairs; - })(); - - v1beta1.DVVTriplet = (function() { - - /** - * Properties of a DVVTriplet. - * @memberof cosmos.staking.v1beta1 - * @interface IDVVTriplet - * @property {string|null} [delegator_address] DVVTriplet delegator_address - * @property {string|null} [validator_src_address] DVVTriplet validator_src_address - * @property {string|null} [validator_dst_address] DVVTriplet validator_dst_address - */ - - /** - * Constructs a new DVVTriplet. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a DVVTriplet. - * @implements IDVVTriplet - * @constructor - * @param {cosmos.staking.v1beta1.IDVVTriplet=} [properties] Properties to set - */ - function DVVTriplet(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DVVTriplet delegator_address. - * @member {string} delegator_address - * @memberof cosmos.staking.v1beta1.DVVTriplet - * @instance - */ - DVVTriplet.prototype.delegator_address = ""; - - /** - * DVVTriplet validator_src_address. - * @member {string} validator_src_address - * @memberof cosmos.staking.v1beta1.DVVTriplet - * @instance - */ - DVVTriplet.prototype.validator_src_address = ""; - - /** - * DVVTriplet validator_dst_address. - * @member {string} validator_dst_address - * @memberof cosmos.staking.v1beta1.DVVTriplet - * @instance - */ - DVVTriplet.prototype.validator_dst_address = ""; - - /** - * Encodes the specified DVVTriplet message. Does not implicitly {@link cosmos.staking.v1beta1.DVVTriplet.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.DVVTriplet - * @static - * @param {cosmos.staking.v1beta1.IDVVTriplet} message DVVTriplet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DVVTriplet.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); - if (message.validator_src_address != null && Object.hasOwnProperty.call(message, "validator_src_address")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.validator_src_address); - if (message.validator_dst_address != null && Object.hasOwnProperty.call(message, "validator_dst_address")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.validator_dst_address); - return writer; - }; - - /** - * Encodes the specified DVVTriplet message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.DVVTriplet.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.DVVTriplet - * @static - * @param {cosmos.staking.v1beta1.IDVVTriplet} message DVVTriplet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DVVTriplet.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DVVTriplet message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.DVVTriplet - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.DVVTriplet} DVVTriplet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DVVTriplet.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.DVVTriplet(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.delegator_address = reader.string(); - break; - case 2: - message.validator_src_address = reader.string(); - break; - case 3: - message.validator_dst_address = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DVVTriplet message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.DVVTriplet - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.DVVTriplet} DVVTriplet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DVVTriplet.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DVVTriplet message. - * @function verify - * @memberof cosmos.staking.v1beta1.DVVTriplet - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DVVTriplet.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - if (!$util.isString(message.delegator_address)) - return "delegator_address: string expected"; - if (message.validator_src_address != null && message.hasOwnProperty("validator_src_address")) - if (!$util.isString(message.validator_src_address)) - return "validator_src_address: string expected"; - if (message.validator_dst_address != null && message.hasOwnProperty("validator_dst_address")) - if (!$util.isString(message.validator_dst_address)) - return "validator_dst_address: string expected"; - return null; - }; - - /** - * Creates a DVVTriplet message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.DVVTriplet - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.DVVTriplet} DVVTriplet - */ - DVVTriplet.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.DVVTriplet) - return object; - let message = new $root.cosmos.staking.v1beta1.DVVTriplet(); - if (object.delegator_address != null) - message.delegator_address = String(object.delegator_address); - if (object.validator_src_address != null) - message.validator_src_address = String(object.validator_src_address); - if (object.validator_dst_address != null) - message.validator_dst_address = String(object.validator_dst_address); - return message; - }; - - /** - * Creates a plain object from a DVVTriplet message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.DVVTriplet - * @static - * @param {cosmos.staking.v1beta1.DVVTriplet} message DVVTriplet - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DVVTriplet.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.delegator_address = ""; - object.validator_src_address = ""; - object.validator_dst_address = ""; - } - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - object.delegator_address = message.delegator_address; - if (message.validator_src_address != null && message.hasOwnProperty("validator_src_address")) - object.validator_src_address = message.validator_src_address; - if (message.validator_dst_address != null && message.hasOwnProperty("validator_dst_address")) - object.validator_dst_address = message.validator_dst_address; - return object; - }; - - /** - * Converts this DVVTriplet to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.DVVTriplet - * @instance - * @returns {Object.} JSON object - */ - DVVTriplet.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return DVVTriplet; - })(); - - v1beta1.DVVTriplets = (function() { - - /** - * Properties of a DVVTriplets. - * @memberof cosmos.staking.v1beta1 - * @interface IDVVTriplets - * @property {Array.|null} [triplets] DVVTriplets triplets - */ - - /** - * Constructs a new DVVTriplets. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a DVVTriplets. - * @implements IDVVTriplets - * @constructor - * @param {cosmos.staking.v1beta1.IDVVTriplets=} [properties] Properties to set - */ - function DVVTriplets(properties) { - this.triplets = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DVVTriplets triplets. - * @member {Array.} triplets - * @memberof cosmos.staking.v1beta1.DVVTriplets - * @instance - */ - DVVTriplets.prototype.triplets = $util.emptyArray; - - /** - * Encodes the specified DVVTriplets message. Does not implicitly {@link cosmos.staking.v1beta1.DVVTriplets.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.DVVTriplets - * @static - * @param {cosmos.staking.v1beta1.IDVVTriplets} message DVVTriplets message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DVVTriplets.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.triplets != null && message.triplets.length) - for (let i = 0; i < message.triplets.length; ++i) - $root.cosmos.staking.v1beta1.DVVTriplet.encode(message.triplets[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified DVVTriplets message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.DVVTriplets.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.DVVTriplets - * @static - * @param {cosmos.staking.v1beta1.IDVVTriplets} message DVVTriplets message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DVVTriplets.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DVVTriplets message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.DVVTriplets - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.DVVTriplets} DVVTriplets - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DVVTriplets.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.DVVTriplets(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.triplets && message.triplets.length)) - message.triplets = []; - message.triplets.push($root.cosmos.staking.v1beta1.DVVTriplet.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DVVTriplets message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.DVVTriplets - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.DVVTriplets} DVVTriplets - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DVVTriplets.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DVVTriplets message. - * @function verify - * @memberof cosmos.staking.v1beta1.DVVTriplets - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DVVTriplets.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.triplets != null && message.hasOwnProperty("triplets")) { - if (!Array.isArray(message.triplets)) - return "triplets: array expected"; - for (let i = 0; i < message.triplets.length; ++i) { - let error = $root.cosmos.staking.v1beta1.DVVTriplet.verify(message.triplets[i]); - if (error) - return "triplets." + error; - } - } - return null; - }; - - /** - * Creates a DVVTriplets message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.DVVTriplets - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.DVVTriplets} DVVTriplets - */ - DVVTriplets.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.DVVTriplets) - return object; - let message = new $root.cosmos.staking.v1beta1.DVVTriplets(); - if (object.triplets) { - if (!Array.isArray(object.triplets)) - throw TypeError(".cosmos.staking.v1beta1.DVVTriplets.triplets: array expected"); - message.triplets = []; - for (let i = 0; i < object.triplets.length; ++i) { - if (typeof object.triplets[i] !== "object") - throw TypeError(".cosmos.staking.v1beta1.DVVTriplets.triplets: object expected"); - message.triplets[i] = $root.cosmos.staking.v1beta1.DVVTriplet.fromObject(object.triplets[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a DVVTriplets message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.DVVTriplets - * @static - * @param {cosmos.staking.v1beta1.DVVTriplets} message DVVTriplets - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DVVTriplets.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.triplets = []; - if (message.triplets && message.triplets.length) { - object.triplets = []; - for (let j = 0; j < message.triplets.length; ++j) - object.triplets[j] = $root.cosmos.staking.v1beta1.DVVTriplet.toObject(message.triplets[j], options); - } - return object; - }; - - /** - * Converts this DVVTriplets to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.DVVTriplets - * @instance - * @returns {Object.} JSON object - */ - DVVTriplets.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return DVVTriplets; - })(); - - v1beta1.Delegation = (function() { - - /** - * Properties of a Delegation. - * @memberof cosmos.staking.v1beta1 - * @interface IDelegation - * @property {string|null} [delegator_address] Delegation delegator_address - * @property {string|null} [validator_address] Delegation validator_address - * @property {string|null} [shares] Delegation shares - */ - - /** - * Constructs a new Delegation. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a Delegation. - * @implements IDelegation - * @constructor - * @param {cosmos.staking.v1beta1.IDelegation=} [properties] Properties to set - */ - function Delegation(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Delegation delegator_address. - * @member {string} delegator_address - * @memberof cosmos.staking.v1beta1.Delegation - * @instance - */ - Delegation.prototype.delegator_address = ""; - - /** - * Delegation validator_address. - * @member {string} validator_address - * @memberof cosmos.staking.v1beta1.Delegation - * @instance - */ - Delegation.prototype.validator_address = ""; - - /** - * Delegation shares. - * @member {string} shares - * @memberof cosmos.staking.v1beta1.Delegation - * @instance - */ - Delegation.prototype.shares = ""; - - /** - * Encodes the specified Delegation message. Does not implicitly {@link cosmos.staking.v1beta1.Delegation.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.Delegation - * @static - * @param {cosmos.staking.v1beta1.IDelegation} message Delegation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Delegation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); - if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.validator_address); - if (message.shares != null && Object.hasOwnProperty.call(message, "shares")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.shares); - return writer; - }; - - /** - * Encodes the specified Delegation message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.Delegation.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.Delegation - * @static - * @param {cosmos.staking.v1beta1.IDelegation} message Delegation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Delegation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Delegation message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.Delegation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.Delegation} Delegation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Delegation.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.Delegation(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.delegator_address = reader.string(); - break; - case 2: - message.validator_address = reader.string(); - break; - case 3: - message.shares = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Delegation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.Delegation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.Delegation} Delegation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Delegation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Delegation message. - * @function verify - * @memberof cosmos.staking.v1beta1.Delegation - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Delegation.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - if (!$util.isString(message.delegator_address)) - return "delegator_address: string expected"; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - if (!$util.isString(message.validator_address)) - return "validator_address: string expected"; - if (message.shares != null && message.hasOwnProperty("shares")) - if (!$util.isString(message.shares)) - return "shares: string expected"; - return null; - }; - - /** - * Creates a Delegation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.Delegation - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.Delegation} Delegation - */ - Delegation.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.Delegation) - return object; - let message = new $root.cosmos.staking.v1beta1.Delegation(); - if (object.delegator_address != null) - message.delegator_address = String(object.delegator_address); - if (object.validator_address != null) - message.validator_address = String(object.validator_address); - if (object.shares != null) - message.shares = String(object.shares); - return message; - }; - - /** - * Creates a plain object from a Delegation message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.Delegation - * @static - * @param {cosmos.staking.v1beta1.Delegation} message Delegation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Delegation.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.delegator_address = ""; - object.validator_address = ""; - object.shares = ""; - } - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - object.delegator_address = message.delegator_address; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - object.validator_address = message.validator_address; - if (message.shares != null && message.hasOwnProperty("shares")) - object.shares = message.shares; - return object; - }; - - /** - * Converts this Delegation to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.Delegation - * @instance - * @returns {Object.} JSON object - */ - Delegation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Delegation; - })(); - - v1beta1.UnbondingDelegation = (function() { - - /** - * Properties of an UnbondingDelegation. - * @memberof cosmos.staking.v1beta1 - * @interface IUnbondingDelegation - * @property {string|null} [delegator_address] UnbondingDelegation delegator_address - * @property {string|null} [validator_address] UnbondingDelegation validator_address - * @property {Array.|null} [entries] UnbondingDelegation entries - */ - - /** - * Constructs a new UnbondingDelegation. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents an UnbondingDelegation. - * @implements IUnbondingDelegation - * @constructor - * @param {cosmos.staking.v1beta1.IUnbondingDelegation=} [properties] Properties to set - */ - function UnbondingDelegation(properties) { - this.entries = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * UnbondingDelegation delegator_address. - * @member {string} delegator_address - * @memberof cosmos.staking.v1beta1.UnbondingDelegation - * @instance - */ - UnbondingDelegation.prototype.delegator_address = ""; - - /** - * UnbondingDelegation validator_address. - * @member {string} validator_address - * @memberof cosmos.staking.v1beta1.UnbondingDelegation - * @instance - */ - UnbondingDelegation.prototype.validator_address = ""; - - /** - * UnbondingDelegation entries. - * @member {Array.} entries - * @memberof cosmos.staking.v1beta1.UnbondingDelegation - * @instance - */ - UnbondingDelegation.prototype.entries = $util.emptyArray; - - /** - * Encodes the specified UnbondingDelegation message. Does not implicitly {@link cosmos.staking.v1beta1.UnbondingDelegation.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.UnbondingDelegation - * @static - * @param {cosmos.staking.v1beta1.IUnbondingDelegation} message UnbondingDelegation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UnbondingDelegation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); - if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.validator_address); - if (message.entries != null && message.entries.length) - for (let i = 0; i < message.entries.length; ++i) - $root.cosmos.staking.v1beta1.UnbondingDelegationEntry.encode(message.entries[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified UnbondingDelegation message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.UnbondingDelegation.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.UnbondingDelegation - * @static - * @param {cosmos.staking.v1beta1.IUnbondingDelegation} message UnbondingDelegation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UnbondingDelegation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an UnbondingDelegation message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.UnbondingDelegation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.UnbondingDelegation} UnbondingDelegation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UnbondingDelegation.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.UnbondingDelegation(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.delegator_address = reader.string(); - break; - case 2: - message.validator_address = reader.string(); - break; - case 3: - if (!(message.entries && message.entries.length)) - message.entries = []; - message.entries.push($root.cosmos.staking.v1beta1.UnbondingDelegationEntry.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an UnbondingDelegation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.UnbondingDelegation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.UnbondingDelegation} UnbondingDelegation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UnbondingDelegation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an UnbondingDelegation message. - * @function verify - * @memberof cosmos.staking.v1beta1.UnbondingDelegation - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - UnbondingDelegation.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - if (!$util.isString(message.delegator_address)) - return "delegator_address: string expected"; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - if (!$util.isString(message.validator_address)) - return "validator_address: string expected"; - if (message.entries != null && message.hasOwnProperty("entries")) { - if (!Array.isArray(message.entries)) - return "entries: array expected"; - for (let i = 0; i < message.entries.length; ++i) { - let error = $root.cosmos.staking.v1beta1.UnbondingDelegationEntry.verify(message.entries[i]); - if (error) - return "entries." + error; - } - } - return null; - }; - - /** - * Creates an UnbondingDelegation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.UnbondingDelegation - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.UnbondingDelegation} UnbondingDelegation - */ - UnbondingDelegation.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.UnbondingDelegation) - return object; - let message = new $root.cosmos.staking.v1beta1.UnbondingDelegation(); - if (object.delegator_address != null) - message.delegator_address = String(object.delegator_address); - if (object.validator_address != null) - message.validator_address = String(object.validator_address); - if (object.entries) { - if (!Array.isArray(object.entries)) - throw TypeError(".cosmos.staking.v1beta1.UnbondingDelegation.entries: array expected"); - message.entries = []; - for (let i = 0; i < object.entries.length; ++i) { - if (typeof object.entries[i] !== "object") - throw TypeError(".cosmos.staking.v1beta1.UnbondingDelegation.entries: object expected"); - message.entries[i] = $root.cosmos.staking.v1beta1.UnbondingDelegationEntry.fromObject(object.entries[i]); - } - } - return message; - }; - - /** - * Creates a plain object from an UnbondingDelegation message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.UnbondingDelegation - * @static - * @param {cosmos.staking.v1beta1.UnbondingDelegation} message UnbondingDelegation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UnbondingDelegation.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.entries = []; - if (options.defaults) { - object.delegator_address = ""; - object.validator_address = ""; - } - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - object.delegator_address = message.delegator_address; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - object.validator_address = message.validator_address; - if (message.entries && message.entries.length) { - object.entries = []; - for (let j = 0; j < message.entries.length; ++j) - object.entries[j] = $root.cosmos.staking.v1beta1.UnbondingDelegationEntry.toObject(message.entries[j], options); - } - return object; - }; - - /** - * Converts this UnbondingDelegation to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.UnbondingDelegation - * @instance - * @returns {Object.} JSON object - */ - UnbondingDelegation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return UnbondingDelegation; - })(); - - v1beta1.UnbondingDelegationEntry = (function() { - - /** - * Properties of an UnbondingDelegationEntry. - * @memberof cosmos.staking.v1beta1 - * @interface IUnbondingDelegationEntry - * @property {Long|null} [creation_height] UnbondingDelegationEntry creation_height - * @property {google.protobuf.ITimestamp|null} [completion_time] UnbondingDelegationEntry completion_time - * @property {string|null} [initial_balance] UnbondingDelegationEntry initial_balance - * @property {string|null} [balance] UnbondingDelegationEntry balance - */ - - /** - * Constructs a new UnbondingDelegationEntry. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents an UnbondingDelegationEntry. - * @implements IUnbondingDelegationEntry - * @constructor - * @param {cosmos.staking.v1beta1.IUnbondingDelegationEntry=} [properties] Properties to set - */ - function UnbondingDelegationEntry(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * UnbondingDelegationEntry creation_height. - * @member {Long} creation_height - * @memberof cosmos.staking.v1beta1.UnbondingDelegationEntry - * @instance - */ - UnbondingDelegationEntry.prototype.creation_height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * UnbondingDelegationEntry completion_time. - * @member {google.protobuf.ITimestamp|null|undefined} completion_time - * @memberof cosmos.staking.v1beta1.UnbondingDelegationEntry - * @instance - */ - UnbondingDelegationEntry.prototype.completion_time = null; - - /** - * UnbondingDelegationEntry initial_balance. - * @member {string} initial_balance - * @memberof cosmos.staking.v1beta1.UnbondingDelegationEntry - * @instance - */ - UnbondingDelegationEntry.prototype.initial_balance = ""; - - /** - * UnbondingDelegationEntry balance. - * @member {string} balance - * @memberof cosmos.staking.v1beta1.UnbondingDelegationEntry - * @instance - */ - UnbondingDelegationEntry.prototype.balance = ""; - - /** - * Encodes the specified UnbondingDelegationEntry message. Does not implicitly {@link cosmos.staking.v1beta1.UnbondingDelegationEntry.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.UnbondingDelegationEntry - * @static - * @param {cosmos.staking.v1beta1.IUnbondingDelegationEntry} message UnbondingDelegationEntry message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UnbondingDelegationEntry.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.creation_height != null && Object.hasOwnProperty.call(message, "creation_height")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.creation_height); - if (message.completion_time != null && Object.hasOwnProperty.call(message, "completion_time")) - $root.google.protobuf.Timestamp.encode(message.completion_time, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.initial_balance != null && Object.hasOwnProperty.call(message, "initial_balance")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.initial_balance); - if (message.balance != null && Object.hasOwnProperty.call(message, "balance")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.balance); - return writer; - }; - - /** - * Encodes the specified UnbondingDelegationEntry message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.UnbondingDelegationEntry.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.UnbondingDelegationEntry - * @static - * @param {cosmos.staking.v1beta1.IUnbondingDelegationEntry} message UnbondingDelegationEntry message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UnbondingDelegationEntry.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an UnbondingDelegationEntry message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.UnbondingDelegationEntry - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.UnbondingDelegationEntry} UnbondingDelegationEntry - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UnbondingDelegationEntry.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.UnbondingDelegationEntry(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.creation_height = reader.int64(); - break; - case 2: - message.completion_time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 3: - message.initial_balance = reader.string(); - break; - case 4: - message.balance = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an UnbondingDelegationEntry message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.UnbondingDelegationEntry - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.UnbondingDelegationEntry} UnbondingDelegationEntry - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UnbondingDelegationEntry.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an UnbondingDelegationEntry message. - * @function verify - * @memberof cosmos.staking.v1beta1.UnbondingDelegationEntry - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - UnbondingDelegationEntry.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.creation_height != null && message.hasOwnProperty("creation_height")) - if (!$util.isInteger(message.creation_height) && !(message.creation_height && $util.isInteger(message.creation_height.low) && $util.isInteger(message.creation_height.high))) - return "creation_height: integer|Long expected"; - if (message.completion_time != null && message.hasOwnProperty("completion_time")) { - let error = $root.google.protobuf.Timestamp.verify(message.completion_time); - if (error) - return "completion_time." + error; - } - if (message.initial_balance != null && message.hasOwnProperty("initial_balance")) - if (!$util.isString(message.initial_balance)) - return "initial_balance: string expected"; - if (message.balance != null && message.hasOwnProperty("balance")) - if (!$util.isString(message.balance)) - return "balance: string expected"; - return null; - }; - - /** - * Creates an UnbondingDelegationEntry message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.UnbondingDelegationEntry - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.UnbondingDelegationEntry} UnbondingDelegationEntry - */ - UnbondingDelegationEntry.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.UnbondingDelegationEntry) - return object; - let message = new $root.cosmos.staking.v1beta1.UnbondingDelegationEntry(); - if (object.creation_height != null) - if ($util.Long) - (message.creation_height = $util.Long.fromValue(object.creation_height)).unsigned = false; - else if (typeof object.creation_height === "string") - message.creation_height = parseInt(object.creation_height, 10); - else if (typeof object.creation_height === "number") - message.creation_height = object.creation_height; - else if (typeof object.creation_height === "object") - message.creation_height = new $util.LongBits(object.creation_height.low >>> 0, object.creation_height.high >>> 0).toNumber(); - if (object.completion_time != null) { - if (typeof object.completion_time !== "object") - throw TypeError(".cosmos.staking.v1beta1.UnbondingDelegationEntry.completion_time: object expected"); - message.completion_time = $root.google.protobuf.Timestamp.fromObject(object.completion_time); - } - if (object.initial_balance != null) - message.initial_balance = String(object.initial_balance); - if (object.balance != null) - message.balance = String(object.balance); - return message; - }; - - /** - * Creates a plain object from an UnbondingDelegationEntry message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.UnbondingDelegationEntry - * @static - * @param {cosmos.staking.v1beta1.UnbondingDelegationEntry} message UnbondingDelegationEntry - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UnbondingDelegationEntry.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.creation_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.creation_height = options.longs === String ? "0" : 0; - object.completion_time = null; - object.initial_balance = ""; - object.balance = ""; - } - if (message.creation_height != null && message.hasOwnProperty("creation_height")) - if (typeof message.creation_height === "number") - object.creation_height = options.longs === String ? String(message.creation_height) : message.creation_height; - else - object.creation_height = options.longs === String ? $util.Long.prototype.toString.call(message.creation_height) : options.longs === Number ? new $util.LongBits(message.creation_height.low >>> 0, message.creation_height.high >>> 0).toNumber() : message.creation_height; - if (message.completion_time != null && message.hasOwnProperty("completion_time")) - object.completion_time = $root.google.protobuf.Timestamp.toObject(message.completion_time, options); - if (message.initial_balance != null && message.hasOwnProperty("initial_balance")) - object.initial_balance = message.initial_balance; - if (message.balance != null && message.hasOwnProperty("balance")) - object.balance = message.balance; - return object; - }; - - /** - * Converts this UnbondingDelegationEntry to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.UnbondingDelegationEntry - * @instance - * @returns {Object.} JSON object - */ - UnbondingDelegationEntry.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return UnbondingDelegationEntry; - })(); - - v1beta1.RedelegationEntry = (function() { - - /** - * Properties of a RedelegationEntry. - * @memberof cosmos.staking.v1beta1 - * @interface IRedelegationEntry - * @property {Long|null} [creation_height] RedelegationEntry creation_height - * @property {google.protobuf.ITimestamp|null} [completion_time] RedelegationEntry completion_time - * @property {string|null} [initial_balance] RedelegationEntry initial_balance - * @property {string|null} [shares_dst] RedelegationEntry shares_dst - */ - - /** - * Constructs a new RedelegationEntry. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a RedelegationEntry. - * @implements IRedelegationEntry - * @constructor - * @param {cosmos.staking.v1beta1.IRedelegationEntry=} [properties] Properties to set - */ - function RedelegationEntry(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * RedelegationEntry creation_height. - * @member {Long} creation_height - * @memberof cosmos.staking.v1beta1.RedelegationEntry - * @instance - */ - RedelegationEntry.prototype.creation_height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * RedelegationEntry completion_time. - * @member {google.protobuf.ITimestamp|null|undefined} completion_time - * @memberof cosmos.staking.v1beta1.RedelegationEntry - * @instance - */ - RedelegationEntry.prototype.completion_time = null; - - /** - * RedelegationEntry initial_balance. - * @member {string} initial_balance - * @memberof cosmos.staking.v1beta1.RedelegationEntry - * @instance - */ - RedelegationEntry.prototype.initial_balance = ""; - - /** - * RedelegationEntry shares_dst. - * @member {string} shares_dst - * @memberof cosmos.staking.v1beta1.RedelegationEntry - * @instance - */ - RedelegationEntry.prototype.shares_dst = ""; - - /** - * Encodes the specified RedelegationEntry message. Does not implicitly {@link cosmos.staking.v1beta1.RedelegationEntry.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.RedelegationEntry - * @static - * @param {cosmos.staking.v1beta1.IRedelegationEntry} message RedelegationEntry message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RedelegationEntry.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.creation_height != null && Object.hasOwnProperty.call(message, "creation_height")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.creation_height); - if (message.completion_time != null && Object.hasOwnProperty.call(message, "completion_time")) - $root.google.protobuf.Timestamp.encode(message.completion_time, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.initial_balance != null && Object.hasOwnProperty.call(message, "initial_balance")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.initial_balance); - if (message.shares_dst != null && Object.hasOwnProperty.call(message, "shares_dst")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.shares_dst); - return writer; - }; - - /** - * Encodes the specified RedelegationEntry message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.RedelegationEntry.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.RedelegationEntry - * @static - * @param {cosmos.staking.v1beta1.IRedelegationEntry} message RedelegationEntry message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RedelegationEntry.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RedelegationEntry message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.RedelegationEntry - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.RedelegationEntry} RedelegationEntry - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RedelegationEntry.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.RedelegationEntry(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.creation_height = reader.int64(); - break; - case 2: - message.completion_time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 3: - message.initial_balance = reader.string(); - break; - case 4: - message.shares_dst = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RedelegationEntry message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.RedelegationEntry - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.RedelegationEntry} RedelegationEntry - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RedelegationEntry.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RedelegationEntry message. - * @function verify - * @memberof cosmos.staking.v1beta1.RedelegationEntry - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RedelegationEntry.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.creation_height != null && message.hasOwnProperty("creation_height")) - if (!$util.isInteger(message.creation_height) && !(message.creation_height && $util.isInteger(message.creation_height.low) && $util.isInteger(message.creation_height.high))) - return "creation_height: integer|Long expected"; - if (message.completion_time != null && message.hasOwnProperty("completion_time")) { - let error = $root.google.protobuf.Timestamp.verify(message.completion_time); - if (error) - return "completion_time." + error; - } - if (message.initial_balance != null && message.hasOwnProperty("initial_balance")) - if (!$util.isString(message.initial_balance)) - return "initial_balance: string expected"; - if (message.shares_dst != null && message.hasOwnProperty("shares_dst")) - if (!$util.isString(message.shares_dst)) - return "shares_dst: string expected"; - return null; - }; - - /** - * Creates a RedelegationEntry message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.RedelegationEntry - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.RedelegationEntry} RedelegationEntry - */ - RedelegationEntry.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.RedelegationEntry) - return object; - let message = new $root.cosmos.staking.v1beta1.RedelegationEntry(); - if (object.creation_height != null) - if ($util.Long) - (message.creation_height = $util.Long.fromValue(object.creation_height)).unsigned = false; - else if (typeof object.creation_height === "string") - message.creation_height = parseInt(object.creation_height, 10); - else if (typeof object.creation_height === "number") - message.creation_height = object.creation_height; - else if (typeof object.creation_height === "object") - message.creation_height = new $util.LongBits(object.creation_height.low >>> 0, object.creation_height.high >>> 0).toNumber(); - if (object.completion_time != null) { - if (typeof object.completion_time !== "object") - throw TypeError(".cosmos.staking.v1beta1.RedelegationEntry.completion_time: object expected"); - message.completion_time = $root.google.protobuf.Timestamp.fromObject(object.completion_time); - } - if (object.initial_balance != null) - message.initial_balance = String(object.initial_balance); - if (object.shares_dst != null) - message.shares_dst = String(object.shares_dst); - return message; - }; - - /** - * Creates a plain object from a RedelegationEntry message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.RedelegationEntry - * @static - * @param {cosmos.staking.v1beta1.RedelegationEntry} message RedelegationEntry - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RedelegationEntry.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.creation_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.creation_height = options.longs === String ? "0" : 0; - object.completion_time = null; - object.initial_balance = ""; - object.shares_dst = ""; - } - if (message.creation_height != null && message.hasOwnProperty("creation_height")) - if (typeof message.creation_height === "number") - object.creation_height = options.longs === String ? String(message.creation_height) : message.creation_height; - else - object.creation_height = options.longs === String ? $util.Long.prototype.toString.call(message.creation_height) : options.longs === Number ? new $util.LongBits(message.creation_height.low >>> 0, message.creation_height.high >>> 0).toNumber() : message.creation_height; - if (message.completion_time != null && message.hasOwnProperty("completion_time")) - object.completion_time = $root.google.protobuf.Timestamp.toObject(message.completion_time, options); - if (message.initial_balance != null && message.hasOwnProperty("initial_balance")) - object.initial_balance = message.initial_balance; - if (message.shares_dst != null && message.hasOwnProperty("shares_dst")) - object.shares_dst = message.shares_dst; - return object; - }; - - /** - * Converts this RedelegationEntry to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.RedelegationEntry - * @instance - * @returns {Object.} JSON object - */ - RedelegationEntry.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return RedelegationEntry; - })(); - - v1beta1.Redelegation = (function() { - - /** - * Properties of a Redelegation. - * @memberof cosmos.staking.v1beta1 - * @interface IRedelegation - * @property {string|null} [delegator_address] Redelegation delegator_address - * @property {string|null} [validator_src_address] Redelegation validator_src_address - * @property {string|null} [validator_dst_address] Redelegation validator_dst_address - * @property {Array.|null} [entries] Redelegation entries - */ - - /** - * Constructs a new Redelegation. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a Redelegation. - * @implements IRedelegation - * @constructor - * @param {cosmos.staking.v1beta1.IRedelegation=} [properties] Properties to set - */ - function Redelegation(properties) { - this.entries = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Redelegation delegator_address. - * @member {string} delegator_address - * @memberof cosmos.staking.v1beta1.Redelegation - * @instance - */ - Redelegation.prototype.delegator_address = ""; - - /** - * Redelegation validator_src_address. - * @member {string} validator_src_address - * @memberof cosmos.staking.v1beta1.Redelegation - * @instance - */ - Redelegation.prototype.validator_src_address = ""; - - /** - * Redelegation validator_dst_address. - * @member {string} validator_dst_address - * @memberof cosmos.staking.v1beta1.Redelegation - * @instance - */ - Redelegation.prototype.validator_dst_address = ""; - - /** - * Redelegation entries. - * @member {Array.} entries - * @memberof cosmos.staking.v1beta1.Redelegation - * @instance - */ - Redelegation.prototype.entries = $util.emptyArray; - - /** - * Encodes the specified Redelegation message. Does not implicitly {@link cosmos.staking.v1beta1.Redelegation.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.Redelegation - * @static - * @param {cosmos.staking.v1beta1.IRedelegation} message Redelegation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Redelegation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.delegator_address != null && Object.hasOwnProperty.call(message, "delegator_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.delegator_address); - if (message.validator_src_address != null && Object.hasOwnProperty.call(message, "validator_src_address")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.validator_src_address); - if (message.validator_dst_address != null && Object.hasOwnProperty.call(message, "validator_dst_address")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.validator_dst_address); - if (message.entries != null && message.entries.length) - for (let i = 0; i < message.entries.length; ++i) - $root.cosmos.staking.v1beta1.RedelegationEntry.encode(message.entries[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Redelegation message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.Redelegation.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.Redelegation - * @static - * @param {cosmos.staking.v1beta1.IRedelegation} message Redelegation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Redelegation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Redelegation message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.Redelegation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.Redelegation} Redelegation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Redelegation.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.Redelegation(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.delegator_address = reader.string(); - break; - case 2: - message.validator_src_address = reader.string(); - break; - case 3: - message.validator_dst_address = reader.string(); - break; - case 4: - if (!(message.entries && message.entries.length)) - message.entries = []; - message.entries.push($root.cosmos.staking.v1beta1.RedelegationEntry.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Redelegation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.Redelegation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.Redelegation} Redelegation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Redelegation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Redelegation message. - * @function verify - * @memberof cosmos.staking.v1beta1.Redelegation - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Redelegation.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - if (!$util.isString(message.delegator_address)) - return "delegator_address: string expected"; - if (message.validator_src_address != null && message.hasOwnProperty("validator_src_address")) - if (!$util.isString(message.validator_src_address)) - return "validator_src_address: string expected"; - if (message.validator_dst_address != null && message.hasOwnProperty("validator_dst_address")) - if (!$util.isString(message.validator_dst_address)) - return "validator_dst_address: string expected"; - if (message.entries != null && message.hasOwnProperty("entries")) { - if (!Array.isArray(message.entries)) - return "entries: array expected"; - for (let i = 0; i < message.entries.length; ++i) { - let error = $root.cosmos.staking.v1beta1.RedelegationEntry.verify(message.entries[i]); - if (error) - return "entries." + error; - } - } - return null; - }; - - /** - * Creates a Redelegation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.Redelegation - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.Redelegation} Redelegation - */ - Redelegation.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.Redelegation) - return object; - let message = new $root.cosmos.staking.v1beta1.Redelegation(); - if (object.delegator_address != null) - message.delegator_address = String(object.delegator_address); - if (object.validator_src_address != null) - message.validator_src_address = String(object.validator_src_address); - if (object.validator_dst_address != null) - message.validator_dst_address = String(object.validator_dst_address); - if (object.entries) { - if (!Array.isArray(object.entries)) - throw TypeError(".cosmos.staking.v1beta1.Redelegation.entries: array expected"); - message.entries = []; - for (let i = 0; i < object.entries.length; ++i) { - if (typeof object.entries[i] !== "object") - throw TypeError(".cosmos.staking.v1beta1.Redelegation.entries: object expected"); - message.entries[i] = $root.cosmos.staking.v1beta1.RedelegationEntry.fromObject(object.entries[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a Redelegation message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.Redelegation - * @static - * @param {cosmos.staking.v1beta1.Redelegation} message Redelegation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Redelegation.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.entries = []; - if (options.defaults) { - object.delegator_address = ""; - object.validator_src_address = ""; - object.validator_dst_address = ""; - } - if (message.delegator_address != null && message.hasOwnProperty("delegator_address")) - object.delegator_address = message.delegator_address; - if (message.validator_src_address != null && message.hasOwnProperty("validator_src_address")) - object.validator_src_address = message.validator_src_address; - if (message.validator_dst_address != null && message.hasOwnProperty("validator_dst_address")) - object.validator_dst_address = message.validator_dst_address; - if (message.entries && message.entries.length) { - object.entries = []; - for (let j = 0; j < message.entries.length; ++j) - object.entries[j] = $root.cosmos.staking.v1beta1.RedelegationEntry.toObject(message.entries[j], options); - } - return object; - }; - - /** - * Converts this Redelegation to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.Redelegation - * @instance - * @returns {Object.} JSON object - */ - Redelegation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Redelegation; - })(); - - v1beta1.Params = (function() { - - /** - * Properties of a Params. - * @memberof cosmos.staking.v1beta1 - * @interface IParams - * @property {google.protobuf.IDuration|null} [unbonding_time] Params unbonding_time - * @property {number|null} [max_validators] Params max_validators - * @property {number|null} [max_entries] Params max_entries - * @property {number|null} [historical_entries] Params historical_entries - * @property {string|null} [bond_denom] Params bond_denom - */ - - /** - * Constructs a new Params. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a Params. - * @implements IParams - * @constructor - * @param {cosmos.staking.v1beta1.IParams=} [properties] Properties to set - */ - function Params(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Params unbonding_time. - * @member {google.protobuf.IDuration|null|undefined} unbonding_time - * @memberof cosmos.staking.v1beta1.Params - * @instance - */ - Params.prototype.unbonding_time = null; - - /** - * Params max_validators. - * @member {number} max_validators - * @memberof cosmos.staking.v1beta1.Params - * @instance - */ - Params.prototype.max_validators = 0; - - /** - * Params max_entries. - * @member {number} max_entries - * @memberof cosmos.staking.v1beta1.Params - * @instance - */ - Params.prototype.max_entries = 0; - - /** - * Params historical_entries. - * @member {number} historical_entries - * @memberof cosmos.staking.v1beta1.Params - * @instance - */ - Params.prototype.historical_entries = 0; - - /** - * Params bond_denom. - * @member {string} bond_denom - * @memberof cosmos.staking.v1beta1.Params - * @instance - */ - Params.prototype.bond_denom = ""; - - /** - * Encodes the specified Params message. Does not implicitly {@link cosmos.staking.v1beta1.Params.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.Params - * @static - * @param {cosmos.staking.v1beta1.IParams} message Params message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Params.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.unbonding_time != null && Object.hasOwnProperty.call(message, "unbonding_time")) - $root.google.protobuf.Duration.encode(message.unbonding_time, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.max_validators != null && Object.hasOwnProperty.call(message, "max_validators")) - writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.max_validators); - if (message.max_entries != null && Object.hasOwnProperty.call(message, "max_entries")) - writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.max_entries); - if (message.historical_entries != null && Object.hasOwnProperty.call(message, "historical_entries")) - writer.uint32(/* id 4, wireType 0 =*/32).uint32(message.historical_entries); - if (message.bond_denom != null && Object.hasOwnProperty.call(message, "bond_denom")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.bond_denom); - return writer; - }; - - /** - * Encodes the specified Params message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.Params.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.Params - * @static - * @param {cosmos.staking.v1beta1.IParams} message Params message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Params.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Params message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.Params - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.Params} Params - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Params.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.Params(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.unbonding_time = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - case 2: - message.max_validators = reader.uint32(); - break; - case 3: - message.max_entries = reader.uint32(); - break; - case 4: - message.historical_entries = reader.uint32(); - break; - case 5: - message.bond_denom = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Params message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.Params - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.Params} Params - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Params.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Params message. - * @function verify - * @memberof cosmos.staking.v1beta1.Params - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Params.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.unbonding_time != null && message.hasOwnProperty("unbonding_time")) { - let error = $root.google.protobuf.Duration.verify(message.unbonding_time); - if (error) - return "unbonding_time." + error; - } - if (message.max_validators != null && message.hasOwnProperty("max_validators")) - if (!$util.isInteger(message.max_validators)) - return "max_validators: integer expected"; - if (message.max_entries != null && message.hasOwnProperty("max_entries")) - if (!$util.isInteger(message.max_entries)) - return "max_entries: integer expected"; - if (message.historical_entries != null && message.hasOwnProperty("historical_entries")) - if (!$util.isInteger(message.historical_entries)) - return "historical_entries: integer expected"; - if (message.bond_denom != null && message.hasOwnProperty("bond_denom")) - if (!$util.isString(message.bond_denom)) - return "bond_denom: string expected"; - return null; - }; - - /** - * Creates a Params message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.Params - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.Params} Params - */ - Params.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.Params) - return object; - let message = new $root.cosmos.staking.v1beta1.Params(); - if (object.unbonding_time != null) { - if (typeof object.unbonding_time !== "object") - throw TypeError(".cosmos.staking.v1beta1.Params.unbonding_time: object expected"); - message.unbonding_time = $root.google.protobuf.Duration.fromObject(object.unbonding_time); - } - if (object.max_validators != null) - message.max_validators = object.max_validators >>> 0; - if (object.max_entries != null) - message.max_entries = object.max_entries >>> 0; - if (object.historical_entries != null) - message.historical_entries = object.historical_entries >>> 0; - if (object.bond_denom != null) - message.bond_denom = String(object.bond_denom); - return message; - }; - - /** - * Creates a plain object from a Params message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.Params - * @static - * @param {cosmos.staking.v1beta1.Params} message Params - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Params.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.unbonding_time = null; - object.max_validators = 0; - object.max_entries = 0; - object.historical_entries = 0; - object.bond_denom = ""; - } - if (message.unbonding_time != null && message.hasOwnProperty("unbonding_time")) - object.unbonding_time = $root.google.protobuf.Duration.toObject(message.unbonding_time, options); - if (message.max_validators != null && message.hasOwnProperty("max_validators")) - object.max_validators = message.max_validators; - if (message.max_entries != null && message.hasOwnProperty("max_entries")) - object.max_entries = message.max_entries; - if (message.historical_entries != null && message.hasOwnProperty("historical_entries")) - object.historical_entries = message.historical_entries; - if (message.bond_denom != null && message.hasOwnProperty("bond_denom")) - object.bond_denom = message.bond_denom; - return object; - }; - - /** - * Converts this Params to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.Params - * @instance - * @returns {Object.} JSON object - */ - Params.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Params; - })(); - - v1beta1.DelegationResponse = (function() { - - /** - * Properties of a DelegationResponse. - * @memberof cosmos.staking.v1beta1 - * @interface IDelegationResponse - * @property {cosmos.staking.v1beta1.IDelegation|null} [delegation] DelegationResponse delegation - * @property {cosmos.base.v1beta1.ICoin|null} [balance] DelegationResponse balance - */ - - /** - * Constructs a new DelegationResponse. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a DelegationResponse. - * @implements IDelegationResponse - * @constructor - * @param {cosmos.staking.v1beta1.IDelegationResponse=} [properties] Properties to set - */ - function DelegationResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DelegationResponse delegation. - * @member {cosmos.staking.v1beta1.IDelegation|null|undefined} delegation - * @memberof cosmos.staking.v1beta1.DelegationResponse - * @instance - */ - DelegationResponse.prototype.delegation = null; - - /** - * DelegationResponse balance. - * @member {cosmos.base.v1beta1.ICoin|null|undefined} balance - * @memberof cosmos.staking.v1beta1.DelegationResponse - * @instance - */ - DelegationResponse.prototype.balance = null; - - /** - * Encodes the specified DelegationResponse message. Does not implicitly {@link cosmos.staking.v1beta1.DelegationResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.DelegationResponse - * @static - * @param {cosmos.staking.v1beta1.IDelegationResponse} message DelegationResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DelegationResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.delegation != null && Object.hasOwnProperty.call(message, "delegation")) - $root.cosmos.staking.v1beta1.Delegation.encode(message.delegation, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.balance != null && Object.hasOwnProperty.call(message, "balance")) - $root.cosmos.base.v1beta1.Coin.encode(message.balance, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified DelegationResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.DelegationResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.DelegationResponse - * @static - * @param {cosmos.staking.v1beta1.IDelegationResponse} message DelegationResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DelegationResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DelegationResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.DelegationResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.DelegationResponse} DelegationResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DelegationResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.DelegationResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.delegation = $root.cosmos.staking.v1beta1.Delegation.decode(reader, reader.uint32()); - break; - case 2: - message.balance = $root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DelegationResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.DelegationResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.DelegationResponse} DelegationResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DelegationResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DelegationResponse message. - * @function verify - * @memberof cosmos.staking.v1beta1.DelegationResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DelegationResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.delegation != null && message.hasOwnProperty("delegation")) { - let error = $root.cosmos.staking.v1beta1.Delegation.verify(message.delegation); - if (error) - return "delegation." + error; - } - if (message.balance != null && message.hasOwnProperty("balance")) { - let error = $root.cosmos.base.v1beta1.Coin.verify(message.balance); - if (error) - return "balance." + error; - } - return null; - }; - - /** - * Creates a DelegationResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.DelegationResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.DelegationResponse} DelegationResponse - */ - DelegationResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.DelegationResponse) - return object; - let message = new $root.cosmos.staking.v1beta1.DelegationResponse(); - if (object.delegation != null) { - if (typeof object.delegation !== "object") - throw TypeError(".cosmos.staking.v1beta1.DelegationResponse.delegation: object expected"); - message.delegation = $root.cosmos.staking.v1beta1.Delegation.fromObject(object.delegation); - } - if (object.balance != null) { - if (typeof object.balance !== "object") - throw TypeError(".cosmos.staking.v1beta1.DelegationResponse.balance: object expected"); - message.balance = $root.cosmos.base.v1beta1.Coin.fromObject(object.balance); - } - return message; - }; - - /** - * Creates a plain object from a DelegationResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.DelegationResponse - * @static - * @param {cosmos.staking.v1beta1.DelegationResponse} message DelegationResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DelegationResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.delegation = null; - object.balance = null; - } - if (message.delegation != null && message.hasOwnProperty("delegation")) - object.delegation = $root.cosmos.staking.v1beta1.Delegation.toObject(message.delegation, options); - if (message.balance != null && message.hasOwnProperty("balance")) - object.balance = $root.cosmos.base.v1beta1.Coin.toObject(message.balance, options); - return object; - }; - - /** - * Converts this DelegationResponse to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.DelegationResponse - * @instance - * @returns {Object.} JSON object - */ - DelegationResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return DelegationResponse; - })(); - - v1beta1.RedelegationEntryResponse = (function() { - - /** - * Properties of a RedelegationEntryResponse. - * @memberof cosmos.staking.v1beta1 - * @interface IRedelegationEntryResponse - * @property {cosmos.staking.v1beta1.IRedelegationEntry|null} [redelegation_entry] RedelegationEntryResponse redelegation_entry - * @property {string|null} [balance] RedelegationEntryResponse balance - */ - - /** - * Constructs a new RedelegationEntryResponse. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a RedelegationEntryResponse. - * @implements IRedelegationEntryResponse - * @constructor - * @param {cosmos.staking.v1beta1.IRedelegationEntryResponse=} [properties] Properties to set - */ - function RedelegationEntryResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * RedelegationEntryResponse redelegation_entry. - * @member {cosmos.staking.v1beta1.IRedelegationEntry|null|undefined} redelegation_entry - * @memberof cosmos.staking.v1beta1.RedelegationEntryResponse - * @instance - */ - RedelegationEntryResponse.prototype.redelegation_entry = null; - - /** - * RedelegationEntryResponse balance. - * @member {string} balance - * @memberof cosmos.staking.v1beta1.RedelegationEntryResponse - * @instance - */ - RedelegationEntryResponse.prototype.balance = ""; - - /** - * Encodes the specified RedelegationEntryResponse message. Does not implicitly {@link cosmos.staking.v1beta1.RedelegationEntryResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.RedelegationEntryResponse - * @static - * @param {cosmos.staking.v1beta1.IRedelegationEntryResponse} message RedelegationEntryResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RedelegationEntryResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.redelegation_entry != null && Object.hasOwnProperty.call(message, "redelegation_entry")) - $root.cosmos.staking.v1beta1.RedelegationEntry.encode(message.redelegation_entry, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.balance != null && Object.hasOwnProperty.call(message, "balance")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.balance); - return writer; - }; - - /** - * Encodes the specified RedelegationEntryResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.RedelegationEntryResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.RedelegationEntryResponse - * @static - * @param {cosmos.staking.v1beta1.IRedelegationEntryResponse} message RedelegationEntryResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RedelegationEntryResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RedelegationEntryResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.RedelegationEntryResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.RedelegationEntryResponse} RedelegationEntryResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RedelegationEntryResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.RedelegationEntryResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.redelegation_entry = $root.cosmos.staking.v1beta1.RedelegationEntry.decode(reader, reader.uint32()); - break; - case 4: - message.balance = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RedelegationEntryResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.RedelegationEntryResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.RedelegationEntryResponse} RedelegationEntryResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RedelegationEntryResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RedelegationEntryResponse message. - * @function verify - * @memberof cosmos.staking.v1beta1.RedelegationEntryResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RedelegationEntryResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.redelegation_entry != null && message.hasOwnProperty("redelegation_entry")) { - let error = $root.cosmos.staking.v1beta1.RedelegationEntry.verify(message.redelegation_entry); - if (error) - return "redelegation_entry." + error; - } - if (message.balance != null && message.hasOwnProperty("balance")) - if (!$util.isString(message.balance)) - return "balance: string expected"; - return null; - }; - - /** - * Creates a RedelegationEntryResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.RedelegationEntryResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.RedelegationEntryResponse} RedelegationEntryResponse - */ - RedelegationEntryResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.RedelegationEntryResponse) - return object; - let message = new $root.cosmos.staking.v1beta1.RedelegationEntryResponse(); - if (object.redelegation_entry != null) { - if (typeof object.redelegation_entry !== "object") - throw TypeError(".cosmos.staking.v1beta1.RedelegationEntryResponse.redelegation_entry: object expected"); - message.redelegation_entry = $root.cosmos.staking.v1beta1.RedelegationEntry.fromObject(object.redelegation_entry); - } - if (object.balance != null) - message.balance = String(object.balance); - return message; - }; - - /** - * Creates a plain object from a RedelegationEntryResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.RedelegationEntryResponse - * @static - * @param {cosmos.staking.v1beta1.RedelegationEntryResponse} message RedelegationEntryResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RedelegationEntryResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.redelegation_entry = null; - object.balance = ""; - } - if (message.redelegation_entry != null && message.hasOwnProperty("redelegation_entry")) - object.redelegation_entry = $root.cosmos.staking.v1beta1.RedelegationEntry.toObject(message.redelegation_entry, options); - if (message.balance != null && message.hasOwnProperty("balance")) - object.balance = message.balance; - return object; - }; - - /** - * Converts this RedelegationEntryResponse to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.RedelegationEntryResponse - * @instance - * @returns {Object.} JSON object - */ - RedelegationEntryResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return RedelegationEntryResponse; - })(); - - v1beta1.RedelegationResponse = (function() { - - /** - * Properties of a RedelegationResponse. - * @memberof cosmos.staking.v1beta1 - * @interface IRedelegationResponse - * @property {cosmos.staking.v1beta1.IRedelegation|null} [redelegation] RedelegationResponse redelegation - * @property {Array.|null} [entries] RedelegationResponse entries - */ - - /** - * Constructs a new RedelegationResponse. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a RedelegationResponse. - * @implements IRedelegationResponse - * @constructor - * @param {cosmos.staking.v1beta1.IRedelegationResponse=} [properties] Properties to set - */ - function RedelegationResponse(properties) { - this.entries = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * RedelegationResponse redelegation. - * @member {cosmos.staking.v1beta1.IRedelegation|null|undefined} redelegation - * @memberof cosmos.staking.v1beta1.RedelegationResponse - * @instance - */ - RedelegationResponse.prototype.redelegation = null; - - /** - * RedelegationResponse entries. - * @member {Array.} entries - * @memberof cosmos.staking.v1beta1.RedelegationResponse - * @instance - */ - RedelegationResponse.prototype.entries = $util.emptyArray; - - /** - * Encodes the specified RedelegationResponse message. Does not implicitly {@link cosmos.staking.v1beta1.RedelegationResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.RedelegationResponse - * @static - * @param {cosmos.staking.v1beta1.IRedelegationResponse} message RedelegationResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RedelegationResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.redelegation != null && Object.hasOwnProperty.call(message, "redelegation")) - $root.cosmos.staking.v1beta1.Redelegation.encode(message.redelegation, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.entries != null && message.entries.length) - for (let i = 0; i < message.entries.length; ++i) - $root.cosmos.staking.v1beta1.RedelegationEntryResponse.encode(message.entries[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified RedelegationResponse message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.RedelegationResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.RedelegationResponse - * @static - * @param {cosmos.staking.v1beta1.IRedelegationResponse} message RedelegationResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RedelegationResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RedelegationResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.RedelegationResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.RedelegationResponse} RedelegationResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RedelegationResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.RedelegationResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.redelegation = $root.cosmos.staking.v1beta1.Redelegation.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.entries && message.entries.length)) - message.entries = []; - message.entries.push($root.cosmos.staking.v1beta1.RedelegationEntryResponse.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RedelegationResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.RedelegationResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.RedelegationResponse} RedelegationResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RedelegationResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RedelegationResponse message. - * @function verify - * @memberof cosmos.staking.v1beta1.RedelegationResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RedelegationResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.redelegation != null && message.hasOwnProperty("redelegation")) { - let error = $root.cosmos.staking.v1beta1.Redelegation.verify(message.redelegation); - if (error) - return "redelegation." + error; - } - if (message.entries != null && message.hasOwnProperty("entries")) { - if (!Array.isArray(message.entries)) - return "entries: array expected"; - for (let i = 0; i < message.entries.length; ++i) { - let error = $root.cosmos.staking.v1beta1.RedelegationEntryResponse.verify(message.entries[i]); - if (error) - return "entries." + error; - } - } - return null; - }; - - /** - * Creates a RedelegationResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.RedelegationResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.RedelegationResponse} RedelegationResponse - */ - RedelegationResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.RedelegationResponse) - return object; - let message = new $root.cosmos.staking.v1beta1.RedelegationResponse(); - if (object.redelegation != null) { - if (typeof object.redelegation !== "object") - throw TypeError(".cosmos.staking.v1beta1.RedelegationResponse.redelegation: object expected"); - message.redelegation = $root.cosmos.staking.v1beta1.Redelegation.fromObject(object.redelegation); - } - if (object.entries) { - if (!Array.isArray(object.entries)) - throw TypeError(".cosmos.staking.v1beta1.RedelegationResponse.entries: array expected"); - message.entries = []; - for (let i = 0; i < object.entries.length; ++i) { - if (typeof object.entries[i] !== "object") - throw TypeError(".cosmos.staking.v1beta1.RedelegationResponse.entries: object expected"); - message.entries[i] = $root.cosmos.staking.v1beta1.RedelegationEntryResponse.fromObject(object.entries[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a RedelegationResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.RedelegationResponse - * @static - * @param {cosmos.staking.v1beta1.RedelegationResponse} message RedelegationResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RedelegationResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.entries = []; - if (options.defaults) - object.redelegation = null; - if (message.redelegation != null && message.hasOwnProperty("redelegation")) - object.redelegation = $root.cosmos.staking.v1beta1.Redelegation.toObject(message.redelegation, options); - if (message.entries && message.entries.length) { - object.entries = []; - for (let j = 0; j < message.entries.length; ++j) - object.entries[j] = $root.cosmos.staking.v1beta1.RedelegationEntryResponse.toObject(message.entries[j], options); - } - return object; - }; - - /** - * Converts this RedelegationResponse to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.RedelegationResponse - * @instance - * @returns {Object.} JSON object - */ - RedelegationResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return RedelegationResponse; - })(); - - v1beta1.Pool = (function() { - - /** - * Properties of a Pool. - * @memberof cosmos.staking.v1beta1 - * @interface IPool - * @property {string|null} [not_bonded_tokens] Pool not_bonded_tokens - * @property {string|null} [bonded_tokens] Pool bonded_tokens - */ - - /** - * Constructs a new Pool. - * @memberof cosmos.staking.v1beta1 - * @classdesc Represents a Pool. - * @implements IPool - * @constructor - * @param {cosmos.staking.v1beta1.IPool=} [properties] Properties to set - */ - function Pool(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Pool not_bonded_tokens. - * @member {string} not_bonded_tokens - * @memberof cosmos.staking.v1beta1.Pool - * @instance - */ - Pool.prototype.not_bonded_tokens = ""; - - /** - * Pool bonded_tokens. - * @member {string} bonded_tokens - * @memberof cosmos.staking.v1beta1.Pool - * @instance - */ - Pool.prototype.bonded_tokens = ""; - - /** - * Encodes the specified Pool message. Does not implicitly {@link cosmos.staking.v1beta1.Pool.verify|verify} messages. - * @function encode - * @memberof cosmos.staking.v1beta1.Pool - * @static - * @param {cosmos.staking.v1beta1.IPool} message Pool message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Pool.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.not_bonded_tokens != null && Object.hasOwnProperty.call(message, "not_bonded_tokens")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.not_bonded_tokens); - if (message.bonded_tokens != null && Object.hasOwnProperty.call(message, "bonded_tokens")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.bonded_tokens); - return writer; - }; - - /** - * Encodes the specified Pool message, length delimited. Does not implicitly {@link cosmos.staking.v1beta1.Pool.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.staking.v1beta1.Pool - * @static - * @param {cosmos.staking.v1beta1.IPool} message Pool message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Pool.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Pool message from the specified reader or buffer. - * @function decode - * @memberof cosmos.staking.v1beta1.Pool - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.staking.v1beta1.Pool} Pool - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Pool.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.staking.v1beta1.Pool(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.not_bonded_tokens = reader.string(); - break; - case 2: - message.bonded_tokens = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Pool message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.staking.v1beta1.Pool - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.staking.v1beta1.Pool} Pool - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Pool.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Pool message. - * @function verify - * @memberof cosmos.staking.v1beta1.Pool - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Pool.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.not_bonded_tokens != null && message.hasOwnProperty("not_bonded_tokens")) - if (!$util.isString(message.not_bonded_tokens)) - return "not_bonded_tokens: string expected"; - if (message.bonded_tokens != null && message.hasOwnProperty("bonded_tokens")) - if (!$util.isString(message.bonded_tokens)) - return "bonded_tokens: string expected"; - return null; - }; - - /** - * Creates a Pool message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.staking.v1beta1.Pool - * @static - * @param {Object.} object Plain object - * @returns {cosmos.staking.v1beta1.Pool} Pool - */ - Pool.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.staking.v1beta1.Pool) - return object; - let message = new $root.cosmos.staking.v1beta1.Pool(); - if (object.not_bonded_tokens != null) - message.not_bonded_tokens = String(object.not_bonded_tokens); - if (object.bonded_tokens != null) - message.bonded_tokens = String(object.bonded_tokens); - return message; - }; - - /** - * Creates a plain object from a Pool message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.staking.v1beta1.Pool - * @static - * @param {cosmos.staking.v1beta1.Pool} message Pool - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Pool.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.not_bonded_tokens = ""; - object.bonded_tokens = ""; - } - if (message.not_bonded_tokens != null && message.hasOwnProperty("not_bonded_tokens")) - object.not_bonded_tokens = message.not_bonded_tokens; - if (message.bonded_tokens != null && message.hasOwnProperty("bonded_tokens")) - object.bonded_tokens = message.bonded_tokens; - return object; - }; - - /** - * Converts this Pool to JSON. - * @function toJSON - * @memberof cosmos.staking.v1beta1.Pool - * @instance - * @returns {Object.} JSON object - */ - Pool.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Pool; - })(); - - return v1beta1; - })(); - - return staking; - })(); - - cosmos.tx = (function() { - - /** - * Namespace tx. - * @memberof cosmos - * @namespace - */ - const tx = {}; - - tx.signing = (function() { - - /** - * Namespace signing. - * @memberof cosmos.tx - * @namespace - */ - const signing = {}; - - signing.v1beta1 = (function() { - - /** - * Namespace v1beta1. - * @memberof cosmos.tx.signing - * @namespace - */ - const v1beta1 = {}; - - /** - * SignMode enum. - * @name cosmos.tx.signing.v1beta1.SignMode - * @enum {number} - * @property {number} SIGN_MODE_UNSPECIFIED=0 SIGN_MODE_UNSPECIFIED value - * @property {number} SIGN_MODE_DIRECT=1 SIGN_MODE_DIRECT value - * @property {number} SIGN_MODE_TEXTUAL=2 SIGN_MODE_TEXTUAL value - * @property {number} SIGN_MODE_LEGACY_AMINO_JSON=127 SIGN_MODE_LEGACY_AMINO_JSON value - */ - v1beta1.SignMode = (function() { - const valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SIGN_MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "SIGN_MODE_DIRECT"] = 1; - values[valuesById[2] = "SIGN_MODE_TEXTUAL"] = 2; - values[valuesById[127] = "SIGN_MODE_LEGACY_AMINO_JSON"] = 127; - return values; - })(); - - v1beta1.SignatureDescriptors = (function() { - - /** - * Properties of a SignatureDescriptors. - * @memberof cosmos.tx.signing.v1beta1 - * @interface ISignatureDescriptors - * @property {Array.|null} [signatures] SignatureDescriptors signatures - */ - - /** - * Constructs a new SignatureDescriptors. - * @memberof cosmos.tx.signing.v1beta1 - * @classdesc Represents a SignatureDescriptors. - * @implements ISignatureDescriptors - * @constructor - * @param {cosmos.tx.signing.v1beta1.ISignatureDescriptors=} [properties] Properties to set - */ - function SignatureDescriptors(properties) { - this.signatures = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SignatureDescriptors signatures. - * @member {Array.} signatures - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptors - * @instance - */ - SignatureDescriptors.prototype.signatures = $util.emptyArray; - - /** - * Encodes the specified SignatureDescriptors message. Does not implicitly {@link cosmos.tx.signing.v1beta1.SignatureDescriptors.verify|verify} messages. - * @function encode - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptors - * @static - * @param {cosmos.tx.signing.v1beta1.ISignatureDescriptors} message SignatureDescriptors message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SignatureDescriptors.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.signatures != null && message.signatures.length) - for (let i = 0; i < message.signatures.length; ++i) - $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.encode(message.signatures[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SignatureDescriptors message, length delimited. Does not implicitly {@link cosmos.tx.signing.v1beta1.SignatureDescriptors.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptors - * @static - * @param {cosmos.tx.signing.v1beta1.ISignatureDescriptors} message SignatureDescriptors message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SignatureDescriptors.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SignatureDescriptors message from the specified reader or buffer. - * @function decode - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptors - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.tx.signing.v1beta1.SignatureDescriptors} SignatureDescriptors - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SignatureDescriptors.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.signing.v1beta1.SignatureDescriptors(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.signatures && message.signatures.length)) - message.signatures = []; - message.signatures.push($root.cosmos.tx.signing.v1beta1.SignatureDescriptor.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SignatureDescriptors message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptors - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.tx.signing.v1beta1.SignatureDescriptors} SignatureDescriptors - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SignatureDescriptors.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SignatureDescriptors message. - * @function verify - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptors - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SignatureDescriptors.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.signatures != null && message.hasOwnProperty("signatures")) { - if (!Array.isArray(message.signatures)) - return "signatures: array expected"; - for (let i = 0; i < message.signatures.length; ++i) { - let error = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.verify(message.signatures[i]); - if (error) - return "signatures." + error; - } - } - return null; - }; - - /** - * Creates a SignatureDescriptors message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptors - * @static - * @param {Object.} object Plain object - * @returns {cosmos.tx.signing.v1beta1.SignatureDescriptors} SignatureDescriptors - */ - SignatureDescriptors.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.tx.signing.v1beta1.SignatureDescriptors) - return object; - let message = new $root.cosmos.tx.signing.v1beta1.SignatureDescriptors(); - if (object.signatures) { - if (!Array.isArray(object.signatures)) - throw TypeError(".cosmos.tx.signing.v1beta1.SignatureDescriptors.signatures: array expected"); - message.signatures = []; - for (let i = 0; i < object.signatures.length; ++i) { - if (typeof object.signatures[i] !== "object") - throw TypeError(".cosmos.tx.signing.v1beta1.SignatureDescriptors.signatures: object expected"); - message.signatures[i] = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.fromObject(object.signatures[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a SignatureDescriptors message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptors - * @static - * @param {cosmos.tx.signing.v1beta1.SignatureDescriptors} message SignatureDescriptors - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SignatureDescriptors.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.signatures = []; - if (message.signatures && message.signatures.length) { - object.signatures = []; - for (let j = 0; j < message.signatures.length; ++j) - object.signatures[j] = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.toObject(message.signatures[j], options); - } - return object; - }; - - /** - * Converts this SignatureDescriptors to JSON. - * @function toJSON - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptors - * @instance - * @returns {Object.} JSON object - */ - SignatureDescriptors.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return SignatureDescriptors; - })(); - - v1beta1.SignatureDescriptor = (function() { - - /** - * Properties of a SignatureDescriptor. - * @memberof cosmos.tx.signing.v1beta1 - * @interface ISignatureDescriptor - * @property {google.protobuf.IAny|null} [public_key] SignatureDescriptor public_key - * @property {cosmos.tx.signing.v1beta1.SignatureDescriptor.IData|null} [data] SignatureDescriptor data - * @property {Long|null} [sequence] SignatureDescriptor sequence - */ - - /** - * Constructs a new SignatureDescriptor. - * @memberof cosmos.tx.signing.v1beta1 - * @classdesc Represents a SignatureDescriptor. - * @implements ISignatureDescriptor - * @constructor - * @param {cosmos.tx.signing.v1beta1.ISignatureDescriptor=} [properties] Properties to set - */ - function SignatureDescriptor(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SignatureDescriptor public_key. - * @member {google.protobuf.IAny|null|undefined} public_key - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor - * @instance - */ - SignatureDescriptor.prototype.public_key = null; - - /** - * SignatureDescriptor data. - * @member {cosmos.tx.signing.v1beta1.SignatureDescriptor.IData|null|undefined} data - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor - * @instance - */ - SignatureDescriptor.prototype.data = null; - - /** - * SignatureDescriptor sequence. - * @member {Long} sequence - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor - * @instance - */ - SignatureDescriptor.prototype.sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified SignatureDescriptor message. Does not implicitly {@link cosmos.tx.signing.v1beta1.SignatureDescriptor.verify|verify} messages. - * @function encode - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor - * @static - * @param {cosmos.tx.signing.v1beta1.ISignatureDescriptor} message SignatureDescriptor message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SignatureDescriptor.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.public_key != null && Object.hasOwnProperty.call(message, "public_key")) - $root.google.protobuf.Any.encode(message.public_key, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.data != null && Object.hasOwnProperty.call(message, "data")) - $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.encode(message.data, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.sequence != null && Object.hasOwnProperty.call(message, "sequence")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.sequence); - return writer; - }; - - /** - * Encodes the specified SignatureDescriptor message, length delimited. Does not implicitly {@link cosmos.tx.signing.v1beta1.SignatureDescriptor.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor - * @static - * @param {cosmos.tx.signing.v1beta1.ISignatureDescriptor} message SignatureDescriptor message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SignatureDescriptor.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SignatureDescriptor message from the specified reader or buffer. - * @function decode - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.tx.signing.v1beta1.SignatureDescriptor} SignatureDescriptor - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SignatureDescriptor.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.signing.v1beta1.SignatureDescriptor(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.public_key = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - case 2: - message.data = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.decode(reader, reader.uint32()); - break; - case 3: - message.sequence = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SignatureDescriptor message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.tx.signing.v1beta1.SignatureDescriptor} SignatureDescriptor - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SignatureDescriptor.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SignatureDescriptor message. - * @function verify - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SignatureDescriptor.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.public_key != null && message.hasOwnProperty("public_key")) { - let error = $root.google.protobuf.Any.verify(message.public_key); - if (error) - return "public_key." + error; - } - if (message.data != null && message.hasOwnProperty("data")) { - let error = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.verify(message.data); - if (error) - return "data." + error; - } - if (message.sequence != null && message.hasOwnProperty("sequence")) - if (!$util.isInteger(message.sequence) && !(message.sequence && $util.isInteger(message.sequence.low) && $util.isInteger(message.sequence.high))) - return "sequence: integer|Long expected"; - return null; - }; - - /** - * Creates a SignatureDescriptor message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor - * @static - * @param {Object.} object Plain object - * @returns {cosmos.tx.signing.v1beta1.SignatureDescriptor} SignatureDescriptor - */ - SignatureDescriptor.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.tx.signing.v1beta1.SignatureDescriptor) - return object; - let message = new $root.cosmos.tx.signing.v1beta1.SignatureDescriptor(); - if (object.public_key != null) { - if (typeof object.public_key !== "object") - throw TypeError(".cosmos.tx.signing.v1beta1.SignatureDescriptor.public_key: object expected"); - message.public_key = $root.google.protobuf.Any.fromObject(object.public_key); - } - if (object.data != null) { - if (typeof object.data !== "object") - throw TypeError(".cosmos.tx.signing.v1beta1.SignatureDescriptor.data: object expected"); - message.data = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.fromObject(object.data); - } - if (object.sequence != null) - if ($util.Long) - (message.sequence = $util.Long.fromValue(object.sequence)).unsigned = true; - else if (typeof object.sequence === "string") - message.sequence = parseInt(object.sequence, 10); - else if (typeof object.sequence === "number") - message.sequence = object.sequence; - else if (typeof object.sequence === "object") - message.sequence = new $util.LongBits(object.sequence.low >>> 0, object.sequence.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a SignatureDescriptor message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor - * @static - * @param {cosmos.tx.signing.v1beta1.SignatureDescriptor} message SignatureDescriptor - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SignatureDescriptor.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.public_key = null; - object.data = null; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.sequence = options.longs === String ? "0" : 0; - } - if (message.public_key != null && message.hasOwnProperty("public_key")) - object.public_key = $root.google.protobuf.Any.toObject(message.public_key, options); - if (message.data != null && message.hasOwnProperty("data")) - object.data = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.toObject(message.data, options); - if (message.sequence != null && message.hasOwnProperty("sequence")) - if (typeof message.sequence === "number") - object.sequence = options.longs === String ? String(message.sequence) : message.sequence; - else - object.sequence = options.longs === String ? $util.Long.prototype.toString.call(message.sequence) : options.longs === Number ? new $util.LongBits(message.sequence.low >>> 0, message.sequence.high >>> 0).toNumber(true) : message.sequence; - return object; - }; - - /** - * Converts this SignatureDescriptor to JSON. - * @function toJSON - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor - * @instance - * @returns {Object.} JSON object - */ - SignatureDescriptor.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - SignatureDescriptor.Data = (function() { - - /** - * Properties of a Data. - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor - * @interface IData - * @property {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.ISingle|null} [single] Data single - * @property {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.IMulti|null} [multi] Data multi - */ - - /** - * Constructs a new Data. - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor - * @classdesc Represents a Data. - * @implements IData - * @constructor - * @param {cosmos.tx.signing.v1beta1.SignatureDescriptor.IData=} [properties] Properties to set - */ - function Data(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Data single. - * @member {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.ISingle|null|undefined} single - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data - * @instance - */ - Data.prototype.single = null; - - /** - * Data multi. - * @member {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.IMulti|null|undefined} multi - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data - * @instance - */ - Data.prototype.multi = null; - - // OneOf field names bound to virtual getters and setters - let $oneOfFields; - - /** - * Data sum. - * @member {"single"|"multi"|undefined} sum - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data - * @instance - */ - Object.defineProperty(Data.prototype, "sum", { - get: $util.oneOfGetter($oneOfFields = ["single", "multi"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Encodes the specified Data message. Does not implicitly {@link cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.verify|verify} messages. - * @function encode - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data - * @static - * @param {cosmos.tx.signing.v1beta1.SignatureDescriptor.IData} message Data message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Data.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.single != null && Object.hasOwnProperty.call(message, "single")) - $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single.encode(message.single, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.multi != null && Object.hasOwnProperty.call(message, "multi")) - $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi.encode(message.multi, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Data message, length delimited. Does not implicitly {@link cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data - * @static - * @param {cosmos.tx.signing.v1beta1.SignatureDescriptor.IData} message Data message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Data.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Data message from the specified reader or buffer. - * @function decode - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data} Data - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Data.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.single = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single.decode(reader, reader.uint32()); - break; - case 2: - message.multi = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Data message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data} Data - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Data.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Data message. - * @function verify - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Data.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - let properties = {}; - if (message.single != null && message.hasOwnProperty("single")) { - properties.sum = 1; - { - let error = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single.verify(message.single); - if (error) - return "single." + error; - } - } - if (message.multi != null && message.hasOwnProperty("multi")) { - if (properties.sum === 1) - return "sum: multiple values"; - properties.sum = 1; - { - let error = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi.verify(message.multi); - if (error) - return "multi." + error; - } - } - return null; - }; - - /** - * Creates a Data message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data - * @static - * @param {Object.} object Plain object - * @returns {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data} Data - */ - Data.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data) - return object; - let message = new $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data(); - if (object.single != null) { - if (typeof object.single !== "object") - throw TypeError(".cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.single: object expected"); - message.single = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single.fromObject(object.single); - } - if (object.multi != null) { - if (typeof object.multi !== "object") - throw TypeError(".cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.multi: object expected"); - message.multi = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi.fromObject(object.multi); - } - return message; - }; - - /** - * Creates a plain object from a Data message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data - * @static - * @param {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data} message Data - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Data.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (message.single != null && message.hasOwnProperty("single")) { - object.single = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single.toObject(message.single, options); - if (options.oneofs) - object.sum = "single"; - } - if (message.multi != null && message.hasOwnProperty("multi")) { - object.multi = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi.toObject(message.multi, options); - if (options.oneofs) - object.sum = "multi"; - } - return object; - }; - - /** - * Converts this Data to JSON. - * @function toJSON - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data - * @instance - * @returns {Object.} JSON object - */ - Data.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - Data.Single = (function() { - - /** - * Properties of a Single. - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data - * @interface ISingle - * @property {cosmos.tx.signing.v1beta1.SignMode|null} [mode] Single mode - * @property {Uint8Array|null} [signature] Single signature - */ - - /** - * Constructs a new Single. - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data - * @classdesc Represents a Single. - * @implements ISingle - * @constructor - * @param {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.ISingle=} [properties] Properties to set - */ - function Single(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Single mode. - * @member {cosmos.tx.signing.v1beta1.SignMode} mode - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single - * @instance - */ - Single.prototype.mode = 0; - - /** - * Single signature. - * @member {Uint8Array} signature - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single - * @instance - */ - Single.prototype.signature = $util.newBuffer([]); - - /** - * Encodes the specified Single message. Does not implicitly {@link cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single.verify|verify} messages. - * @function encode - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single - * @static - * @param {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.ISingle} message Single message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Single.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mode); - if (message.signature != null && Object.hasOwnProperty.call(message, "signature")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.signature); - return writer; - }; - - /** - * Encodes the specified Single message, length delimited. Does not implicitly {@link cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single - * @static - * @param {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.ISingle} message Single message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Single.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Single message from the specified reader or buffer. - * @function decode - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single} Single - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Single.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.mode = reader.int32(); - break; - case 2: - message.signature = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Single message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single} Single - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Single.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Single message. - * @function verify - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Single.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.mode != null && message.hasOwnProperty("mode")) - switch (message.mode) { - default: - return "mode: enum value expected"; - case 0: - case 1: - case 2: - case 127: - break; - } - if (message.signature != null && message.hasOwnProperty("signature")) - if (!(message.signature && typeof message.signature.length === "number" || $util.isString(message.signature))) - return "signature: buffer expected"; - return null; - }; - - /** - * Creates a Single message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single - * @static - * @param {Object.} object Plain object - * @returns {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single} Single - */ - Single.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single) - return object; - let message = new $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single(); - switch (object.mode) { - case "SIGN_MODE_UNSPECIFIED": - case 0: - message.mode = 0; - break; - case "SIGN_MODE_DIRECT": - case 1: - message.mode = 1; - break; - case "SIGN_MODE_TEXTUAL": - case 2: - message.mode = 2; - break; - case "SIGN_MODE_LEGACY_AMINO_JSON": - case 127: - message.mode = 127; - break; - } - if (object.signature != null) - if (typeof object.signature === "string") - $util.base64.decode(object.signature, message.signature = $util.newBuffer($util.base64.length(object.signature)), 0); - else if (object.signature.length) - message.signature = object.signature; - return message; - }; - - /** - * Creates a plain object from a Single message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single - * @static - * @param {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single} message Single - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Single.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.mode = options.enums === String ? "SIGN_MODE_UNSPECIFIED" : 0; - if (options.bytes === String) - object.signature = ""; - else { - object.signature = []; - if (options.bytes !== Array) - object.signature = $util.newBuffer(object.signature); - } - } - if (message.mode != null && message.hasOwnProperty("mode")) - object.mode = options.enums === String ? $root.cosmos.tx.signing.v1beta1.SignMode[message.mode] : message.mode; - if (message.signature != null && message.hasOwnProperty("signature")) - object.signature = options.bytes === String ? $util.base64.encode(message.signature, 0, message.signature.length) : options.bytes === Array ? Array.prototype.slice.call(message.signature) : message.signature; - return object; - }; - - /** - * Converts this Single to JSON. - * @function toJSON - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single - * @instance - * @returns {Object.} JSON object - */ - Single.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Single; - })(); - - Data.Multi = (function() { - - /** - * Properties of a Multi. - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data - * @interface IMulti - * @property {cosmos.crypto.multisig.v1beta1.ICompactBitArray|null} [bitarray] Multi bitarray - * @property {Array.|null} [signatures] Multi signatures - */ - - /** - * Constructs a new Multi. - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data - * @classdesc Represents a Multi. - * @implements IMulti - * @constructor - * @param {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.IMulti=} [properties] Properties to set - */ - function Multi(properties) { - this.signatures = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Multi bitarray. - * @member {cosmos.crypto.multisig.v1beta1.ICompactBitArray|null|undefined} bitarray - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi - * @instance - */ - Multi.prototype.bitarray = null; - - /** - * Multi signatures. - * @member {Array.} signatures - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi - * @instance - */ - Multi.prototype.signatures = $util.emptyArray; - - /** - * Encodes the specified Multi message. Does not implicitly {@link cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi.verify|verify} messages. - * @function encode - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi - * @static - * @param {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.IMulti} message Multi message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Multi.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.bitarray != null && Object.hasOwnProperty.call(message, "bitarray")) - $root.cosmos.crypto.multisig.v1beta1.CompactBitArray.encode(message.bitarray, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.signatures != null && message.signatures.length) - for (let i = 0; i < message.signatures.length; ++i) - $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.encode(message.signatures[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Multi message, length delimited. Does not implicitly {@link cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi - * @static - * @param {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.IMulti} message Multi message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Multi.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Multi message from the specified reader or buffer. - * @function decode - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi} Multi - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Multi.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.bitarray = $root.cosmos.crypto.multisig.v1beta1.CompactBitArray.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.signatures && message.signatures.length)) - message.signatures = []; - message.signatures.push($root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Multi message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi} Multi - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Multi.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Multi message. - * @function verify - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Multi.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.bitarray != null && message.hasOwnProperty("bitarray")) { - let error = $root.cosmos.crypto.multisig.v1beta1.CompactBitArray.verify(message.bitarray); - if (error) - return "bitarray." + error; - } - if (message.signatures != null && message.hasOwnProperty("signatures")) { - if (!Array.isArray(message.signatures)) - return "signatures: array expected"; - for (let i = 0; i < message.signatures.length; ++i) { - let error = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.verify(message.signatures[i]); - if (error) - return "signatures." + error; - } - } - return null; - }; - - /** - * Creates a Multi message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi - * @static - * @param {Object.} object Plain object - * @returns {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi} Multi - */ - Multi.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi) - return object; - let message = new $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi(); - if (object.bitarray != null) { - if (typeof object.bitarray !== "object") - throw TypeError(".cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi.bitarray: object expected"); - message.bitarray = $root.cosmos.crypto.multisig.v1beta1.CompactBitArray.fromObject(object.bitarray); - } - if (object.signatures) { - if (!Array.isArray(object.signatures)) - throw TypeError(".cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi.signatures: array expected"); - message.signatures = []; - for (let i = 0; i < object.signatures.length; ++i) { - if (typeof object.signatures[i] !== "object") - throw TypeError(".cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi.signatures: object expected"); - message.signatures[i] = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.fromObject(object.signatures[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a Multi message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi - * @static - * @param {cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi} message Multi - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Multi.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.signatures = []; - if (options.defaults) - object.bitarray = null; - if (message.bitarray != null && message.hasOwnProperty("bitarray")) - object.bitarray = $root.cosmos.crypto.multisig.v1beta1.CompactBitArray.toObject(message.bitarray, options); - if (message.signatures && message.signatures.length) { - object.signatures = []; - for (let j = 0; j < message.signatures.length; ++j) - object.signatures[j] = $root.cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.toObject(message.signatures[j], options); - } - return object; - }; - - /** - * Converts this Multi to JSON. - * @function toJSON - * @memberof cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi - * @instance - * @returns {Object.} JSON object - */ - Multi.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Multi; - })(); - - return Data; - })(); - - return SignatureDescriptor; - })(); - - return v1beta1; - })(); - - return signing; - })(); - - tx.v1beta1 = (function() { - - /** - * Namespace v1beta1. - * @memberof cosmos.tx - * @namespace - */ - const v1beta1 = {}; - - v1beta1.Tx = (function() { - - /** - * Properties of a Tx. - * @memberof cosmos.tx.v1beta1 - * @interface ITx - * @property {cosmos.tx.v1beta1.ITxBody|null} [body] Tx body - * @property {cosmos.tx.v1beta1.IAuthInfo|null} [auth_info] Tx auth_info - * @property {Array.|null} [signatures] Tx signatures - */ - - /** - * Constructs a new Tx. - * @memberof cosmos.tx.v1beta1 - * @classdesc Represents a Tx. - * @implements ITx - * @constructor - * @param {cosmos.tx.v1beta1.ITx=} [properties] Properties to set - */ - function Tx(properties) { - this.signatures = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Tx body. - * @member {cosmos.tx.v1beta1.ITxBody|null|undefined} body - * @memberof cosmos.tx.v1beta1.Tx - * @instance - */ - Tx.prototype.body = null; - - /** - * Tx auth_info. - * @member {cosmos.tx.v1beta1.IAuthInfo|null|undefined} auth_info - * @memberof cosmos.tx.v1beta1.Tx - * @instance - */ - Tx.prototype.auth_info = null; - - /** - * Tx signatures. - * @member {Array.} signatures - * @memberof cosmos.tx.v1beta1.Tx - * @instance - */ - Tx.prototype.signatures = $util.emptyArray; - - /** - * Encodes the specified Tx message. Does not implicitly {@link cosmos.tx.v1beta1.Tx.verify|verify} messages. - * @function encode - * @memberof cosmos.tx.v1beta1.Tx - * @static - * @param {cosmos.tx.v1beta1.ITx} message Tx message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Tx.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.cosmos.tx.v1beta1.TxBody.encode(message.body, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.auth_info != null && Object.hasOwnProperty.call(message, "auth_info")) - $root.cosmos.tx.v1beta1.AuthInfo.encode(message.auth_info, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.signatures != null && message.signatures.length) - for (let i = 0; i < message.signatures.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.signatures[i]); - return writer; - }; - - /** - * Encodes the specified Tx message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.Tx.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.tx.v1beta1.Tx - * @static - * @param {cosmos.tx.v1beta1.ITx} message Tx message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Tx.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Tx message from the specified reader or buffer. - * @function decode - * @memberof cosmos.tx.v1beta1.Tx - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.tx.v1beta1.Tx} Tx - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Tx.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.Tx(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.body = $root.cosmos.tx.v1beta1.TxBody.decode(reader, reader.uint32()); - break; - case 2: - message.auth_info = $root.cosmos.tx.v1beta1.AuthInfo.decode(reader, reader.uint32()); - break; - case 3: - if (!(message.signatures && message.signatures.length)) - message.signatures = []; - message.signatures.push(reader.bytes()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Tx message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.tx.v1beta1.Tx - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.tx.v1beta1.Tx} Tx - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Tx.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Tx message. - * @function verify - * @memberof cosmos.tx.v1beta1.Tx - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Tx.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.body != null && message.hasOwnProperty("body")) { - let error = $root.cosmos.tx.v1beta1.TxBody.verify(message.body); - if (error) - return "body." + error; - } - if (message.auth_info != null && message.hasOwnProperty("auth_info")) { - let error = $root.cosmos.tx.v1beta1.AuthInfo.verify(message.auth_info); - if (error) - return "auth_info." + error; - } - if (message.signatures != null && message.hasOwnProperty("signatures")) { - if (!Array.isArray(message.signatures)) - return "signatures: array expected"; - for (let i = 0; i < message.signatures.length; ++i) - if (!(message.signatures[i] && typeof message.signatures[i].length === "number" || $util.isString(message.signatures[i]))) - return "signatures: buffer[] expected"; - } - return null; - }; - - /** - * Creates a Tx message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.tx.v1beta1.Tx - * @static - * @param {Object.} object Plain object - * @returns {cosmos.tx.v1beta1.Tx} Tx - */ - Tx.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.tx.v1beta1.Tx) - return object; - let message = new $root.cosmos.tx.v1beta1.Tx(); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".cosmos.tx.v1beta1.Tx.body: object expected"); - message.body = $root.cosmos.tx.v1beta1.TxBody.fromObject(object.body); - } - if (object.auth_info != null) { - if (typeof object.auth_info !== "object") - throw TypeError(".cosmos.tx.v1beta1.Tx.auth_info: object expected"); - message.auth_info = $root.cosmos.tx.v1beta1.AuthInfo.fromObject(object.auth_info); - } - if (object.signatures) { - if (!Array.isArray(object.signatures)) - throw TypeError(".cosmos.tx.v1beta1.Tx.signatures: array expected"); - message.signatures = []; - for (let i = 0; i < object.signatures.length; ++i) - if (typeof object.signatures[i] === "string") - $util.base64.decode(object.signatures[i], message.signatures[i] = $util.newBuffer($util.base64.length(object.signatures[i])), 0); - else if (object.signatures[i].length) - message.signatures[i] = object.signatures[i]; - } - return message; - }; - - /** - * Creates a plain object from a Tx message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.tx.v1beta1.Tx - * @static - * @param {cosmos.tx.v1beta1.Tx} message Tx - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Tx.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.signatures = []; - if (options.defaults) { - object.body = null; - object.auth_info = null; - } - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.cosmos.tx.v1beta1.TxBody.toObject(message.body, options); - if (message.auth_info != null && message.hasOwnProperty("auth_info")) - object.auth_info = $root.cosmos.tx.v1beta1.AuthInfo.toObject(message.auth_info, options); - if (message.signatures && message.signatures.length) { - object.signatures = []; - for (let j = 0; j < message.signatures.length; ++j) - object.signatures[j] = options.bytes === String ? $util.base64.encode(message.signatures[j], 0, message.signatures[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.signatures[j]) : message.signatures[j]; - } - return object; - }; - - /** - * Converts this Tx to JSON. - * @function toJSON - * @memberof cosmos.tx.v1beta1.Tx - * @instance - * @returns {Object.} JSON object - */ - Tx.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Tx; - })(); - - v1beta1.TxRaw = (function() { - - /** - * Properties of a TxRaw. - * @memberof cosmos.tx.v1beta1 - * @interface ITxRaw - * @property {Uint8Array|null} [body_bytes] TxRaw body_bytes - * @property {Uint8Array|null} [auth_info_bytes] TxRaw auth_info_bytes - * @property {Array.|null} [signatures] TxRaw signatures - */ - - /** - * Constructs a new TxRaw. - * @memberof cosmos.tx.v1beta1 - * @classdesc Represents a TxRaw. - * @implements ITxRaw - * @constructor - * @param {cosmos.tx.v1beta1.ITxRaw=} [properties] Properties to set - */ - function TxRaw(properties) { - this.signatures = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * TxRaw body_bytes. - * @member {Uint8Array} body_bytes - * @memberof cosmos.tx.v1beta1.TxRaw - * @instance - */ - TxRaw.prototype.body_bytes = $util.newBuffer([]); - - /** - * TxRaw auth_info_bytes. - * @member {Uint8Array} auth_info_bytes - * @memberof cosmos.tx.v1beta1.TxRaw - * @instance - */ - TxRaw.prototype.auth_info_bytes = $util.newBuffer([]); - - /** - * TxRaw signatures. - * @member {Array.} signatures - * @memberof cosmos.tx.v1beta1.TxRaw - * @instance - */ - TxRaw.prototype.signatures = $util.emptyArray; - - /** - * Encodes the specified TxRaw message. Does not implicitly {@link cosmos.tx.v1beta1.TxRaw.verify|verify} messages. - * @function encode - * @memberof cosmos.tx.v1beta1.TxRaw - * @static - * @param {cosmos.tx.v1beta1.ITxRaw} message TxRaw message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TxRaw.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.body_bytes != null && Object.hasOwnProperty.call(message, "body_bytes")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.body_bytes); - if (message.auth_info_bytes != null && Object.hasOwnProperty.call(message, "auth_info_bytes")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.auth_info_bytes); - if (message.signatures != null && message.signatures.length) - for (let i = 0; i < message.signatures.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.signatures[i]); - return writer; - }; - - /** - * Encodes the specified TxRaw message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.TxRaw.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.tx.v1beta1.TxRaw - * @static - * @param {cosmos.tx.v1beta1.ITxRaw} message TxRaw message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TxRaw.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TxRaw message from the specified reader or buffer. - * @function decode - * @memberof cosmos.tx.v1beta1.TxRaw - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.tx.v1beta1.TxRaw} TxRaw - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TxRaw.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.TxRaw(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.body_bytes = reader.bytes(); - break; - case 2: - message.auth_info_bytes = reader.bytes(); - break; - case 3: - if (!(message.signatures && message.signatures.length)) - message.signatures = []; - message.signatures.push(reader.bytes()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a TxRaw message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.tx.v1beta1.TxRaw - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.tx.v1beta1.TxRaw} TxRaw - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TxRaw.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TxRaw message. - * @function verify - * @memberof cosmos.tx.v1beta1.TxRaw - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TxRaw.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.body_bytes != null && message.hasOwnProperty("body_bytes")) - if (!(message.body_bytes && typeof message.body_bytes.length === "number" || $util.isString(message.body_bytes))) - return "body_bytes: buffer expected"; - if (message.auth_info_bytes != null && message.hasOwnProperty("auth_info_bytes")) - if (!(message.auth_info_bytes && typeof message.auth_info_bytes.length === "number" || $util.isString(message.auth_info_bytes))) - return "auth_info_bytes: buffer expected"; - if (message.signatures != null && message.hasOwnProperty("signatures")) { - if (!Array.isArray(message.signatures)) - return "signatures: array expected"; - for (let i = 0; i < message.signatures.length; ++i) - if (!(message.signatures[i] && typeof message.signatures[i].length === "number" || $util.isString(message.signatures[i]))) - return "signatures: buffer[] expected"; - } - return null; - }; - - /** - * Creates a TxRaw message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.tx.v1beta1.TxRaw - * @static - * @param {Object.} object Plain object - * @returns {cosmos.tx.v1beta1.TxRaw} TxRaw - */ - TxRaw.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.tx.v1beta1.TxRaw) - return object; - let message = new $root.cosmos.tx.v1beta1.TxRaw(); - if (object.body_bytes != null) - if (typeof object.body_bytes === "string") - $util.base64.decode(object.body_bytes, message.body_bytes = $util.newBuffer($util.base64.length(object.body_bytes)), 0); - else if (object.body_bytes.length) - message.body_bytes = object.body_bytes; - if (object.auth_info_bytes != null) - if (typeof object.auth_info_bytes === "string") - $util.base64.decode(object.auth_info_bytes, message.auth_info_bytes = $util.newBuffer($util.base64.length(object.auth_info_bytes)), 0); - else if (object.auth_info_bytes.length) - message.auth_info_bytes = object.auth_info_bytes; - if (object.signatures) { - if (!Array.isArray(object.signatures)) - throw TypeError(".cosmos.tx.v1beta1.TxRaw.signatures: array expected"); - message.signatures = []; - for (let i = 0; i < object.signatures.length; ++i) - if (typeof object.signatures[i] === "string") - $util.base64.decode(object.signatures[i], message.signatures[i] = $util.newBuffer($util.base64.length(object.signatures[i])), 0); - else if (object.signatures[i].length) - message.signatures[i] = object.signatures[i]; - } - return message; - }; - - /** - * Creates a plain object from a TxRaw message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.tx.v1beta1.TxRaw - * @static - * @param {cosmos.tx.v1beta1.TxRaw} message TxRaw - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TxRaw.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.signatures = []; - if (options.defaults) { - if (options.bytes === String) - object.body_bytes = ""; - else { - object.body_bytes = []; - if (options.bytes !== Array) - object.body_bytes = $util.newBuffer(object.body_bytes); - } - if (options.bytes === String) - object.auth_info_bytes = ""; - else { - object.auth_info_bytes = []; - if (options.bytes !== Array) - object.auth_info_bytes = $util.newBuffer(object.auth_info_bytes); - } - } - if (message.body_bytes != null && message.hasOwnProperty("body_bytes")) - object.body_bytes = options.bytes === String ? $util.base64.encode(message.body_bytes, 0, message.body_bytes.length) : options.bytes === Array ? Array.prototype.slice.call(message.body_bytes) : message.body_bytes; - if (message.auth_info_bytes != null && message.hasOwnProperty("auth_info_bytes")) - object.auth_info_bytes = options.bytes === String ? $util.base64.encode(message.auth_info_bytes, 0, message.auth_info_bytes.length) : options.bytes === Array ? Array.prototype.slice.call(message.auth_info_bytes) : message.auth_info_bytes; - if (message.signatures && message.signatures.length) { - object.signatures = []; - for (let j = 0; j < message.signatures.length; ++j) - object.signatures[j] = options.bytes === String ? $util.base64.encode(message.signatures[j], 0, message.signatures[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.signatures[j]) : message.signatures[j]; - } - return object; - }; - - /** - * Converts this TxRaw to JSON. - * @function toJSON - * @memberof cosmos.tx.v1beta1.TxRaw - * @instance - * @returns {Object.} JSON object - */ - TxRaw.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return TxRaw; - })(); - - v1beta1.SignDoc = (function() { - - /** - * Properties of a SignDoc. - * @memberof cosmos.tx.v1beta1 - * @interface ISignDoc - * @property {Uint8Array|null} [body_bytes] SignDoc body_bytes - * @property {Uint8Array|null} [auth_info_bytes] SignDoc auth_info_bytes - * @property {string|null} [chain_id] SignDoc chain_id - * @property {Long|null} [account_number] SignDoc account_number - */ - - /** - * Constructs a new SignDoc. - * @memberof cosmos.tx.v1beta1 - * @classdesc Represents a SignDoc. - * @implements ISignDoc - * @constructor - * @param {cosmos.tx.v1beta1.ISignDoc=} [properties] Properties to set - */ - function SignDoc(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SignDoc body_bytes. - * @member {Uint8Array} body_bytes - * @memberof cosmos.tx.v1beta1.SignDoc - * @instance - */ - SignDoc.prototype.body_bytes = $util.newBuffer([]); - - /** - * SignDoc auth_info_bytes. - * @member {Uint8Array} auth_info_bytes - * @memberof cosmos.tx.v1beta1.SignDoc - * @instance - */ - SignDoc.prototype.auth_info_bytes = $util.newBuffer([]); - - /** - * SignDoc chain_id. - * @member {string} chain_id - * @memberof cosmos.tx.v1beta1.SignDoc - * @instance - */ - SignDoc.prototype.chain_id = ""; - - /** - * SignDoc account_number. - * @member {Long} account_number - * @memberof cosmos.tx.v1beta1.SignDoc - * @instance - */ - SignDoc.prototype.account_number = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified SignDoc message. Does not implicitly {@link cosmos.tx.v1beta1.SignDoc.verify|verify} messages. - * @function encode - * @memberof cosmos.tx.v1beta1.SignDoc - * @static - * @param {cosmos.tx.v1beta1.ISignDoc} message SignDoc message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SignDoc.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.body_bytes != null && Object.hasOwnProperty.call(message, "body_bytes")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.body_bytes); - if (message.auth_info_bytes != null && Object.hasOwnProperty.call(message, "auth_info_bytes")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.auth_info_bytes); - if (message.chain_id != null && Object.hasOwnProperty.call(message, "chain_id")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.chain_id); - if (message.account_number != null && Object.hasOwnProperty.call(message, "account_number")) - writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.account_number); - return writer; - }; - - /** - * Encodes the specified SignDoc message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.SignDoc.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.tx.v1beta1.SignDoc - * @static - * @param {cosmos.tx.v1beta1.ISignDoc} message SignDoc message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SignDoc.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SignDoc message from the specified reader or buffer. - * @function decode - * @memberof cosmos.tx.v1beta1.SignDoc - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.tx.v1beta1.SignDoc} SignDoc - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SignDoc.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.SignDoc(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.body_bytes = reader.bytes(); - break; - case 2: - message.auth_info_bytes = reader.bytes(); - break; - case 3: - message.chain_id = reader.string(); - break; - case 4: - message.account_number = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SignDoc message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.tx.v1beta1.SignDoc - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.tx.v1beta1.SignDoc} SignDoc - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SignDoc.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SignDoc message. - * @function verify - * @memberof cosmos.tx.v1beta1.SignDoc - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SignDoc.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.body_bytes != null && message.hasOwnProperty("body_bytes")) - if (!(message.body_bytes && typeof message.body_bytes.length === "number" || $util.isString(message.body_bytes))) - return "body_bytes: buffer expected"; - if (message.auth_info_bytes != null && message.hasOwnProperty("auth_info_bytes")) - if (!(message.auth_info_bytes && typeof message.auth_info_bytes.length === "number" || $util.isString(message.auth_info_bytes))) - return "auth_info_bytes: buffer expected"; - if (message.chain_id != null && message.hasOwnProperty("chain_id")) - if (!$util.isString(message.chain_id)) - return "chain_id: string expected"; - if (message.account_number != null && message.hasOwnProperty("account_number")) - if (!$util.isInteger(message.account_number) && !(message.account_number && $util.isInteger(message.account_number.low) && $util.isInteger(message.account_number.high))) - return "account_number: integer|Long expected"; - return null; - }; - - /** - * Creates a SignDoc message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.tx.v1beta1.SignDoc - * @static - * @param {Object.} object Plain object - * @returns {cosmos.tx.v1beta1.SignDoc} SignDoc - */ - SignDoc.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.tx.v1beta1.SignDoc) - return object; - let message = new $root.cosmos.tx.v1beta1.SignDoc(); - if (object.body_bytes != null) - if (typeof object.body_bytes === "string") - $util.base64.decode(object.body_bytes, message.body_bytes = $util.newBuffer($util.base64.length(object.body_bytes)), 0); - else if (object.body_bytes.length) - message.body_bytes = object.body_bytes; - if (object.auth_info_bytes != null) - if (typeof object.auth_info_bytes === "string") - $util.base64.decode(object.auth_info_bytes, message.auth_info_bytes = $util.newBuffer($util.base64.length(object.auth_info_bytes)), 0); - else if (object.auth_info_bytes.length) - message.auth_info_bytes = object.auth_info_bytes; - if (object.chain_id != null) - message.chain_id = String(object.chain_id); - if (object.account_number != null) - if ($util.Long) - (message.account_number = $util.Long.fromValue(object.account_number)).unsigned = true; - else if (typeof object.account_number === "string") - message.account_number = parseInt(object.account_number, 10); - else if (typeof object.account_number === "number") - message.account_number = object.account_number; - else if (typeof object.account_number === "object") - message.account_number = new $util.LongBits(object.account_number.low >>> 0, object.account_number.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a SignDoc message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.tx.v1beta1.SignDoc - * @static - * @param {cosmos.tx.v1beta1.SignDoc} message SignDoc - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SignDoc.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if (options.bytes === String) - object.body_bytes = ""; - else { - object.body_bytes = []; - if (options.bytes !== Array) - object.body_bytes = $util.newBuffer(object.body_bytes); - } - if (options.bytes === String) - object.auth_info_bytes = ""; - else { - object.auth_info_bytes = []; - if (options.bytes !== Array) - object.auth_info_bytes = $util.newBuffer(object.auth_info_bytes); - } - object.chain_id = ""; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.account_number = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.account_number = options.longs === String ? "0" : 0; - } - if (message.body_bytes != null && message.hasOwnProperty("body_bytes")) - object.body_bytes = options.bytes === String ? $util.base64.encode(message.body_bytes, 0, message.body_bytes.length) : options.bytes === Array ? Array.prototype.slice.call(message.body_bytes) : message.body_bytes; - if (message.auth_info_bytes != null && message.hasOwnProperty("auth_info_bytes")) - object.auth_info_bytes = options.bytes === String ? $util.base64.encode(message.auth_info_bytes, 0, message.auth_info_bytes.length) : options.bytes === Array ? Array.prototype.slice.call(message.auth_info_bytes) : message.auth_info_bytes; - if (message.chain_id != null && message.hasOwnProperty("chain_id")) - object.chain_id = message.chain_id; - if (message.account_number != null && message.hasOwnProperty("account_number")) - if (typeof message.account_number === "number") - object.account_number = options.longs === String ? String(message.account_number) : message.account_number; - else - object.account_number = options.longs === String ? $util.Long.prototype.toString.call(message.account_number) : options.longs === Number ? new $util.LongBits(message.account_number.low >>> 0, message.account_number.high >>> 0).toNumber(true) : message.account_number; - return object; - }; - - /** - * Converts this SignDoc to JSON. - * @function toJSON - * @memberof cosmos.tx.v1beta1.SignDoc - * @instance - * @returns {Object.} JSON object - */ - SignDoc.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return SignDoc; - })(); - - v1beta1.TxBody = (function() { - - /** - * Properties of a TxBody. - * @memberof cosmos.tx.v1beta1 - * @interface ITxBody - * @property {Array.|null} [messages] TxBody messages - * @property {string|null} [memo] TxBody memo - * @property {Long|null} [timeout_height] TxBody timeout_height - * @property {Array.|null} [extension_options] TxBody extension_options - * @property {Array.|null} [non_critical_extension_options] TxBody non_critical_extension_options - */ - - /** - * Constructs a new TxBody. - * @memberof cosmos.tx.v1beta1 - * @classdesc Represents a TxBody. - * @implements ITxBody - * @constructor - * @param {cosmos.tx.v1beta1.ITxBody=} [properties] Properties to set - */ - function TxBody(properties) { - this.messages = []; - this.extension_options = []; - this.non_critical_extension_options = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * TxBody messages. - * @member {Array.} messages - * @memberof cosmos.tx.v1beta1.TxBody - * @instance - */ - TxBody.prototype.messages = $util.emptyArray; - - /** - * TxBody memo. - * @member {string} memo - * @memberof cosmos.tx.v1beta1.TxBody - * @instance - */ - TxBody.prototype.memo = ""; - - /** - * TxBody timeout_height. - * @member {Long} timeout_height - * @memberof cosmos.tx.v1beta1.TxBody - * @instance - */ - TxBody.prototype.timeout_height = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * TxBody extension_options. - * @member {Array.} extension_options - * @memberof cosmos.tx.v1beta1.TxBody - * @instance - */ - TxBody.prototype.extension_options = $util.emptyArray; - - /** - * TxBody non_critical_extension_options. - * @member {Array.} non_critical_extension_options - * @memberof cosmos.tx.v1beta1.TxBody - * @instance - */ - TxBody.prototype.non_critical_extension_options = $util.emptyArray; - - /** - * Encodes the specified TxBody message. Does not implicitly {@link cosmos.tx.v1beta1.TxBody.verify|verify} messages. - * @function encode - * @memberof cosmos.tx.v1beta1.TxBody - * @static - * @param {cosmos.tx.v1beta1.ITxBody} message TxBody message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TxBody.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.messages != null && message.messages.length) - for (let i = 0; i < message.messages.length; ++i) - $root.google.protobuf.Any.encode(message.messages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.memo != null && Object.hasOwnProperty.call(message, "memo")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.memo); - if (message.timeout_height != null && Object.hasOwnProperty.call(message, "timeout_height")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.timeout_height); - if (message.extension_options != null && message.extension_options.length) - for (let i = 0; i < message.extension_options.length; ++i) - $root.google.protobuf.Any.encode(message.extension_options[i], writer.uint32(/* id 1023, wireType 2 =*/8186).fork()).ldelim(); - if (message.non_critical_extension_options != null && message.non_critical_extension_options.length) - for (let i = 0; i < message.non_critical_extension_options.length; ++i) - $root.google.protobuf.Any.encode(message.non_critical_extension_options[i], writer.uint32(/* id 2047, wireType 2 =*/16378).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified TxBody message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.TxBody.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.tx.v1beta1.TxBody - * @static - * @param {cosmos.tx.v1beta1.ITxBody} message TxBody message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TxBody.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TxBody message from the specified reader or buffer. - * @function decode - * @memberof cosmos.tx.v1beta1.TxBody - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.tx.v1beta1.TxBody} TxBody - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TxBody.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.TxBody(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.messages && message.messages.length)) - message.messages = []; - message.messages.push($root.google.protobuf.Any.decode(reader, reader.uint32())); - break; - case 2: - message.memo = reader.string(); - break; - case 3: - message.timeout_height = reader.uint64(); - break; - case 1023: - if (!(message.extension_options && message.extension_options.length)) - message.extension_options = []; - message.extension_options.push($root.google.protobuf.Any.decode(reader, reader.uint32())); - break; - case 2047: - if (!(message.non_critical_extension_options && message.non_critical_extension_options.length)) - message.non_critical_extension_options = []; - message.non_critical_extension_options.push($root.google.protobuf.Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a TxBody message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.tx.v1beta1.TxBody - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.tx.v1beta1.TxBody} TxBody - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TxBody.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TxBody message. - * @function verify - * @memberof cosmos.tx.v1beta1.TxBody - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TxBody.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.messages != null && message.hasOwnProperty("messages")) { - if (!Array.isArray(message.messages)) - return "messages: array expected"; - for (let i = 0; i < message.messages.length; ++i) { - let error = $root.google.protobuf.Any.verify(message.messages[i]); - if (error) - return "messages." + error; - } - } - if (message.memo != null && message.hasOwnProperty("memo")) - if (!$util.isString(message.memo)) - return "memo: string expected"; - if (message.timeout_height != null && message.hasOwnProperty("timeout_height")) - if (!$util.isInteger(message.timeout_height) && !(message.timeout_height && $util.isInteger(message.timeout_height.low) && $util.isInteger(message.timeout_height.high))) - return "timeout_height: integer|Long expected"; - if (message.extension_options != null && message.hasOwnProperty("extension_options")) { - if (!Array.isArray(message.extension_options)) - return "extension_options: array expected"; - for (let i = 0; i < message.extension_options.length; ++i) { - let error = $root.google.protobuf.Any.verify(message.extension_options[i]); - if (error) - return "extension_options." + error; - } - } - if (message.non_critical_extension_options != null && message.hasOwnProperty("non_critical_extension_options")) { - if (!Array.isArray(message.non_critical_extension_options)) - return "non_critical_extension_options: array expected"; - for (let i = 0; i < message.non_critical_extension_options.length; ++i) { - let error = $root.google.protobuf.Any.verify(message.non_critical_extension_options[i]); - if (error) - return "non_critical_extension_options." + error; - } - } - return null; - }; - - /** - * Creates a TxBody message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.tx.v1beta1.TxBody - * @static - * @param {Object.} object Plain object - * @returns {cosmos.tx.v1beta1.TxBody} TxBody - */ - TxBody.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.tx.v1beta1.TxBody) - return object; - let message = new $root.cosmos.tx.v1beta1.TxBody(); - if (object.messages) { - if (!Array.isArray(object.messages)) - throw TypeError(".cosmos.tx.v1beta1.TxBody.messages: array expected"); - message.messages = []; - for (let i = 0; i < object.messages.length; ++i) { - if (typeof object.messages[i] !== "object") - throw TypeError(".cosmos.tx.v1beta1.TxBody.messages: object expected"); - message.messages[i] = $root.google.protobuf.Any.fromObject(object.messages[i]); - } - } - if (object.memo != null) - message.memo = String(object.memo); - if (object.timeout_height != null) - if ($util.Long) - (message.timeout_height = $util.Long.fromValue(object.timeout_height)).unsigned = true; - else if (typeof object.timeout_height === "string") - message.timeout_height = parseInt(object.timeout_height, 10); - else if (typeof object.timeout_height === "number") - message.timeout_height = object.timeout_height; - else if (typeof object.timeout_height === "object") - message.timeout_height = new $util.LongBits(object.timeout_height.low >>> 0, object.timeout_height.high >>> 0).toNumber(true); - if (object.extension_options) { - if (!Array.isArray(object.extension_options)) - throw TypeError(".cosmos.tx.v1beta1.TxBody.extension_options: array expected"); - message.extension_options = []; - for (let i = 0; i < object.extension_options.length; ++i) { - if (typeof object.extension_options[i] !== "object") - throw TypeError(".cosmos.tx.v1beta1.TxBody.extension_options: object expected"); - message.extension_options[i] = $root.google.protobuf.Any.fromObject(object.extension_options[i]); - } - } - if (object.non_critical_extension_options) { - if (!Array.isArray(object.non_critical_extension_options)) - throw TypeError(".cosmos.tx.v1beta1.TxBody.non_critical_extension_options: array expected"); - message.non_critical_extension_options = []; - for (let i = 0; i < object.non_critical_extension_options.length; ++i) { - if (typeof object.non_critical_extension_options[i] !== "object") - throw TypeError(".cosmos.tx.v1beta1.TxBody.non_critical_extension_options: object expected"); - message.non_critical_extension_options[i] = $root.google.protobuf.Any.fromObject(object.non_critical_extension_options[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a TxBody message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.tx.v1beta1.TxBody - * @static - * @param {cosmos.tx.v1beta1.TxBody} message TxBody - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TxBody.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) { - object.messages = []; - object.extension_options = []; - object.non_critical_extension_options = []; - } - if (options.defaults) { - object.memo = ""; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.timeout_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.timeout_height = options.longs === String ? "0" : 0; - } - if (message.messages && message.messages.length) { - object.messages = []; - for (let j = 0; j < message.messages.length; ++j) - object.messages[j] = $root.google.protobuf.Any.toObject(message.messages[j], options); - } - if (message.memo != null && message.hasOwnProperty("memo")) - object.memo = message.memo; - if (message.timeout_height != null && message.hasOwnProperty("timeout_height")) - if (typeof message.timeout_height === "number") - object.timeout_height = options.longs === String ? String(message.timeout_height) : message.timeout_height; - else - object.timeout_height = options.longs === String ? $util.Long.prototype.toString.call(message.timeout_height) : options.longs === Number ? new $util.LongBits(message.timeout_height.low >>> 0, message.timeout_height.high >>> 0).toNumber(true) : message.timeout_height; - if (message.extension_options && message.extension_options.length) { - object.extension_options = []; - for (let j = 0; j < message.extension_options.length; ++j) - object.extension_options[j] = $root.google.protobuf.Any.toObject(message.extension_options[j], options); - } - if (message.non_critical_extension_options && message.non_critical_extension_options.length) { - object.non_critical_extension_options = []; - for (let j = 0; j < message.non_critical_extension_options.length; ++j) - object.non_critical_extension_options[j] = $root.google.protobuf.Any.toObject(message.non_critical_extension_options[j], options); - } - return object; - }; - - /** - * Converts this TxBody to JSON. - * @function toJSON - * @memberof cosmos.tx.v1beta1.TxBody - * @instance - * @returns {Object.} JSON object - */ - TxBody.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return TxBody; - })(); - - v1beta1.AuthInfo = (function() { - - /** - * Properties of an AuthInfo. - * @memberof cosmos.tx.v1beta1 - * @interface IAuthInfo - * @property {Array.|null} [signer_infos] AuthInfo signer_infos - * @property {cosmos.tx.v1beta1.IFee|null} [fee] AuthInfo fee - */ - - /** - * Constructs a new AuthInfo. - * @memberof cosmos.tx.v1beta1 - * @classdesc Represents an AuthInfo. - * @implements IAuthInfo - * @constructor - * @param {cosmos.tx.v1beta1.IAuthInfo=} [properties] Properties to set - */ - function AuthInfo(properties) { - this.signer_infos = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * AuthInfo signer_infos. - * @member {Array.} signer_infos - * @memberof cosmos.tx.v1beta1.AuthInfo - * @instance - */ - AuthInfo.prototype.signer_infos = $util.emptyArray; - - /** - * AuthInfo fee. - * @member {cosmos.tx.v1beta1.IFee|null|undefined} fee - * @memberof cosmos.tx.v1beta1.AuthInfo - * @instance - */ - AuthInfo.prototype.fee = null; - - /** - * Encodes the specified AuthInfo message. Does not implicitly {@link cosmos.tx.v1beta1.AuthInfo.verify|verify} messages. - * @function encode - * @memberof cosmos.tx.v1beta1.AuthInfo - * @static - * @param {cosmos.tx.v1beta1.IAuthInfo} message AuthInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AuthInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.signer_infos != null && message.signer_infos.length) - for (let i = 0; i < message.signer_infos.length; ++i) - $root.cosmos.tx.v1beta1.SignerInfo.encode(message.signer_infos[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.fee != null && Object.hasOwnProperty.call(message, "fee")) - $root.cosmos.tx.v1beta1.Fee.encode(message.fee, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified AuthInfo message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.AuthInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.tx.v1beta1.AuthInfo - * @static - * @param {cosmos.tx.v1beta1.IAuthInfo} message AuthInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AuthInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AuthInfo message from the specified reader or buffer. - * @function decode - * @memberof cosmos.tx.v1beta1.AuthInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.tx.v1beta1.AuthInfo} AuthInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AuthInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.AuthInfo(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.signer_infos && message.signer_infos.length)) - message.signer_infos = []; - message.signer_infos.push($root.cosmos.tx.v1beta1.SignerInfo.decode(reader, reader.uint32())); - break; - case 2: - message.fee = $root.cosmos.tx.v1beta1.Fee.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AuthInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.tx.v1beta1.AuthInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.tx.v1beta1.AuthInfo} AuthInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AuthInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AuthInfo message. - * @function verify - * @memberof cosmos.tx.v1beta1.AuthInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - AuthInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.signer_infos != null && message.hasOwnProperty("signer_infos")) { - if (!Array.isArray(message.signer_infos)) - return "signer_infos: array expected"; - for (let i = 0; i < message.signer_infos.length; ++i) { - let error = $root.cosmos.tx.v1beta1.SignerInfo.verify(message.signer_infos[i]); - if (error) - return "signer_infos." + error; - } - } - if (message.fee != null && message.hasOwnProperty("fee")) { - let error = $root.cosmos.tx.v1beta1.Fee.verify(message.fee); - if (error) - return "fee." + error; - } - return null; - }; - - /** - * Creates an AuthInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.tx.v1beta1.AuthInfo - * @static - * @param {Object.} object Plain object - * @returns {cosmos.tx.v1beta1.AuthInfo} AuthInfo - */ - AuthInfo.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.tx.v1beta1.AuthInfo) - return object; - let message = new $root.cosmos.tx.v1beta1.AuthInfo(); - if (object.signer_infos) { - if (!Array.isArray(object.signer_infos)) - throw TypeError(".cosmos.tx.v1beta1.AuthInfo.signer_infos: array expected"); - message.signer_infos = []; - for (let i = 0; i < object.signer_infos.length; ++i) { - if (typeof object.signer_infos[i] !== "object") - throw TypeError(".cosmos.tx.v1beta1.AuthInfo.signer_infos: object expected"); - message.signer_infos[i] = $root.cosmos.tx.v1beta1.SignerInfo.fromObject(object.signer_infos[i]); - } - } - if (object.fee != null) { - if (typeof object.fee !== "object") - throw TypeError(".cosmos.tx.v1beta1.AuthInfo.fee: object expected"); - message.fee = $root.cosmos.tx.v1beta1.Fee.fromObject(object.fee); - } - return message; - }; - - /** - * Creates a plain object from an AuthInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.tx.v1beta1.AuthInfo - * @static - * @param {cosmos.tx.v1beta1.AuthInfo} message AuthInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AuthInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.signer_infos = []; - if (options.defaults) - object.fee = null; - if (message.signer_infos && message.signer_infos.length) { - object.signer_infos = []; - for (let j = 0; j < message.signer_infos.length; ++j) - object.signer_infos[j] = $root.cosmos.tx.v1beta1.SignerInfo.toObject(message.signer_infos[j], options); - } - if (message.fee != null && message.hasOwnProperty("fee")) - object.fee = $root.cosmos.tx.v1beta1.Fee.toObject(message.fee, options); - return object; - }; - - /** - * Converts this AuthInfo to JSON. - * @function toJSON - * @memberof cosmos.tx.v1beta1.AuthInfo - * @instance - * @returns {Object.} JSON object - */ - AuthInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return AuthInfo; - })(); - - v1beta1.SignerInfo = (function() { - - /** - * Properties of a SignerInfo. - * @memberof cosmos.tx.v1beta1 - * @interface ISignerInfo - * @property {google.protobuf.IAny|null} [public_key] SignerInfo public_key - * @property {cosmos.tx.v1beta1.IModeInfo|null} [mode_info] SignerInfo mode_info - * @property {Long|null} [sequence] SignerInfo sequence - */ - - /** - * Constructs a new SignerInfo. - * @memberof cosmos.tx.v1beta1 - * @classdesc Represents a SignerInfo. - * @implements ISignerInfo - * @constructor - * @param {cosmos.tx.v1beta1.ISignerInfo=} [properties] Properties to set - */ - function SignerInfo(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SignerInfo public_key. - * @member {google.protobuf.IAny|null|undefined} public_key - * @memberof cosmos.tx.v1beta1.SignerInfo - * @instance - */ - SignerInfo.prototype.public_key = null; - - /** - * SignerInfo mode_info. - * @member {cosmos.tx.v1beta1.IModeInfo|null|undefined} mode_info - * @memberof cosmos.tx.v1beta1.SignerInfo - * @instance - */ - SignerInfo.prototype.mode_info = null; - - /** - * SignerInfo sequence. - * @member {Long} sequence - * @memberof cosmos.tx.v1beta1.SignerInfo - * @instance - */ - SignerInfo.prototype.sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified SignerInfo message. Does not implicitly {@link cosmos.tx.v1beta1.SignerInfo.verify|verify} messages. - * @function encode - * @memberof cosmos.tx.v1beta1.SignerInfo - * @static - * @param {cosmos.tx.v1beta1.ISignerInfo} message SignerInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SignerInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.public_key != null && Object.hasOwnProperty.call(message, "public_key")) - $root.google.protobuf.Any.encode(message.public_key, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.mode_info != null && Object.hasOwnProperty.call(message, "mode_info")) - $root.cosmos.tx.v1beta1.ModeInfo.encode(message.mode_info, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.sequence != null && Object.hasOwnProperty.call(message, "sequence")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.sequence); - return writer; - }; - - /** - * Encodes the specified SignerInfo message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.SignerInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.tx.v1beta1.SignerInfo - * @static - * @param {cosmos.tx.v1beta1.ISignerInfo} message SignerInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SignerInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SignerInfo message from the specified reader or buffer. - * @function decode - * @memberof cosmos.tx.v1beta1.SignerInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.tx.v1beta1.SignerInfo} SignerInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SignerInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.SignerInfo(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.public_key = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - case 2: - message.mode_info = $root.cosmos.tx.v1beta1.ModeInfo.decode(reader, reader.uint32()); - break; - case 3: - message.sequence = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SignerInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.tx.v1beta1.SignerInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.tx.v1beta1.SignerInfo} SignerInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SignerInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SignerInfo message. - * @function verify - * @memberof cosmos.tx.v1beta1.SignerInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SignerInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.public_key != null && message.hasOwnProperty("public_key")) { - let error = $root.google.protobuf.Any.verify(message.public_key); - if (error) - return "public_key." + error; - } - if (message.mode_info != null && message.hasOwnProperty("mode_info")) { - let error = $root.cosmos.tx.v1beta1.ModeInfo.verify(message.mode_info); - if (error) - return "mode_info." + error; - } - if (message.sequence != null && message.hasOwnProperty("sequence")) - if (!$util.isInteger(message.sequence) && !(message.sequence && $util.isInteger(message.sequence.low) && $util.isInteger(message.sequence.high))) - return "sequence: integer|Long expected"; - return null; - }; - - /** - * Creates a SignerInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.tx.v1beta1.SignerInfo - * @static - * @param {Object.} object Plain object - * @returns {cosmos.tx.v1beta1.SignerInfo} SignerInfo - */ - SignerInfo.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.tx.v1beta1.SignerInfo) - return object; - let message = new $root.cosmos.tx.v1beta1.SignerInfo(); - if (object.public_key != null) { - if (typeof object.public_key !== "object") - throw TypeError(".cosmos.tx.v1beta1.SignerInfo.public_key: object expected"); - message.public_key = $root.google.protobuf.Any.fromObject(object.public_key); - } - if (object.mode_info != null) { - if (typeof object.mode_info !== "object") - throw TypeError(".cosmos.tx.v1beta1.SignerInfo.mode_info: object expected"); - message.mode_info = $root.cosmos.tx.v1beta1.ModeInfo.fromObject(object.mode_info); - } - if (object.sequence != null) - if ($util.Long) - (message.sequence = $util.Long.fromValue(object.sequence)).unsigned = true; - else if (typeof object.sequence === "string") - message.sequence = parseInt(object.sequence, 10); - else if (typeof object.sequence === "number") - message.sequence = object.sequence; - else if (typeof object.sequence === "object") - message.sequence = new $util.LongBits(object.sequence.low >>> 0, object.sequence.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a SignerInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.tx.v1beta1.SignerInfo - * @static - * @param {cosmos.tx.v1beta1.SignerInfo} message SignerInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SignerInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.public_key = null; - object.mode_info = null; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.sequence = options.longs === String ? "0" : 0; - } - if (message.public_key != null && message.hasOwnProperty("public_key")) - object.public_key = $root.google.protobuf.Any.toObject(message.public_key, options); - if (message.mode_info != null && message.hasOwnProperty("mode_info")) - object.mode_info = $root.cosmos.tx.v1beta1.ModeInfo.toObject(message.mode_info, options); - if (message.sequence != null && message.hasOwnProperty("sequence")) - if (typeof message.sequence === "number") - object.sequence = options.longs === String ? String(message.sequence) : message.sequence; - else - object.sequence = options.longs === String ? $util.Long.prototype.toString.call(message.sequence) : options.longs === Number ? new $util.LongBits(message.sequence.low >>> 0, message.sequence.high >>> 0).toNumber(true) : message.sequence; - return object; - }; - - /** - * Converts this SignerInfo to JSON. - * @function toJSON - * @memberof cosmos.tx.v1beta1.SignerInfo - * @instance - * @returns {Object.} JSON object - */ - SignerInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return SignerInfo; - })(); - - v1beta1.ModeInfo = (function() { - - /** - * Properties of a ModeInfo. - * @memberof cosmos.tx.v1beta1 - * @interface IModeInfo - * @property {cosmos.tx.v1beta1.ModeInfo.ISingle|null} [single] ModeInfo single - * @property {cosmos.tx.v1beta1.ModeInfo.IMulti|null} [multi] ModeInfo multi - */ - - /** - * Constructs a new ModeInfo. - * @memberof cosmos.tx.v1beta1 - * @classdesc Represents a ModeInfo. - * @implements IModeInfo - * @constructor - * @param {cosmos.tx.v1beta1.IModeInfo=} [properties] Properties to set - */ - function ModeInfo(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ModeInfo single. - * @member {cosmos.tx.v1beta1.ModeInfo.ISingle|null|undefined} single - * @memberof cosmos.tx.v1beta1.ModeInfo - * @instance - */ - ModeInfo.prototype.single = null; - - /** - * ModeInfo multi. - * @member {cosmos.tx.v1beta1.ModeInfo.IMulti|null|undefined} multi - * @memberof cosmos.tx.v1beta1.ModeInfo - * @instance - */ - ModeInfo.prototype.multi = null; - - // OneOf field names bound to virtual getters and setters - let $oneOfFields; - - /** - * ModeInfo sum. - * @member {"single"|"multi"|undefined} sum - * @memberof cosmos.tx.v1beta1.ModeInfo - * @instance - */ - Object.defineProperty(ModeInfo.prototype, "sum", { - get: $util.oneOfGetter($oneOfFields = ["single", "multi"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Encodes the specified ModeInfo message. Does not implicitly {@link cosmos.tx.v1beta1.ModeInfo.verify|verify} messages. - * @function encode - * @memberof cosmos.tx.v1beta1.ModeInfo - * @static - * @param {cosmos.tx.v1beta1.IModeInfo} message ModeInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ModeInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.single != null && Object.hasOwnProperty.call(message, "single")) - $root.cosmos.tx.v1beta1.ModeInfo.Single.encode(message.single, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.multi != null && Object.hasOwnProperty.call(message, "multi")) - $root.cosmos.tx.v1beta1.ModeInfo.Multi.encode(message.multi, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ModeInfo message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.ModeInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.tx.v1beta1.ModeInfo - * @static - * @param {cosmos.tx.v1beta1.IModeInfo} message ModeInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ModeInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ModeInfo message from the specified reader or buffer. - * @function decode - * @memberof cosmos.tx.v1beta1.ModeInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.tx.v1beta1.ModeInfo} ModeInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ModeInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.ModeInfo(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.single = $root.cosmos.tx.v1beta1.ModeInfo.Single.decode(reader, reader.uint32()); - break; - case 2: - message.multi = $root.cosmos.tx.v1beta1.ModeInfo.Multi.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ModeInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.tx.v1beta1.ModeInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.tx.v1beta1.ModeInfo} ModeInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ModeInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ModeInfo message. - * @function verify - * @memberof cosmos.tx.v1beta1.ModeInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ModeInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - let properties = {}; - if (message.single != null && message.hasOwnProperty("single")) { - properties.sum = 1; - { - let error = $root.cosmos.tx.v1beta1.ModeInfo.Single.verify(message.single); - if (error) - return "single." + error; - } - } - if (message.multi != null && message.hasOwnProperty("multi")) { - if (properties.sum === 1) - return "sum: multiple values"; - properties.sum = 1; - { - let error = $root.cosmos.tx.v1beta1.ModeInfo.Multi.verify(message.multi); - if (error) - return "multi." + error; - } - } - return null; - }; - - /** - * Creates a ModeInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.tx.v1beta1.ModeInfo - * @static - * @param {Object.} object Plain object - * @returns {cosmos.tx.v1beta1.ModeInfo} ModeInfo - */ - ModeInfo.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.tx.v1beta1.ModeInfo) - return object; - let message = new $root.cosmos.tx.v1beta1.ModeInfo(); - if (object.single != null) { - if (typeof object.single !== "object") - throw TypeError(".cosmos.tx.v1beta1.ModeInfo.single: object expected"); - message.single = $root.cosmos.tx.v1beta1.ModeInfo.Single.fromObject(object.single); - } - if (object.multi != null) { - if (typeof object.multi !== "object") - throw TypeError(".cosmos.tx.v1beta1.ModeInfo.multi: object expected"); - message.multi = $root.cosmos.tx.v1beta1.ModeInfo.Multi.fromObject(object.multi); - } - return message; - }; - - /** - * Creates a plain object from a ModeInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.tx.v1beta1.ModeInfo - * @static - * @param {cosmos.tx.v1beta1.ModeInfo} message ModeInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ModeInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (message.single != null && message.hasOwnProperty("single")) { - object.single = $root.cosmos.tx.v1beta1.ModeInfo.Single.toObject(message.single, options); - if (options.oneofs) - object.sum = "single"; - } - if (message.multi != null && message.hasOwnProperty("multi")) { - object.multi = $root.cosmos.tx.v1beta1.ModeInfo.Multi.toObject(message.multi, options); - if (options.oneofs) - object.sum = "multi"; - } - return object; - }; - - /** - * Converts this ModeInfo to JSON. - * @function toJSON - * @memberof cosmos.tx.v1beta1.ModeInfo - * @instance - * @returns {Object.} JSON object - */ - ModeInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - ModeInfo.Single = (function() { - - /** - * Properties of a Single. - * @memberof cosmos.tx.v1beta1.ModeInfo - * @interface ISingle - * @property {cosmos.tx.signing.v1beta1.SignMode|null} [mode] Single mode - */ - - /** - * Constructs a new Single. - * @memberof cosmos.tx.v1beta1.ModeInfo - * @classdesc Represents a Single. - * @implements ISingle - * @constructor - * @param {cosmos.tx.v1beta1.ModeInfo.ISingle=} [properties] Properties to set - */ - function Single(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Single mode. - * @member {cosmos.tx.signing.v1beta1.SignMode} mode - * @memberof cosmos.tx.v1beta1.ModeInfo.Single - * @instance - */ - Single.prototype.mode = 0; - - /** - * Encodes the specified Single message. Does not implicitly {@link cosmos.tx.v1beta1.ModeInfo.Single.verify|verify} messages. - * @function encode - * @memberof cosmos.tx.v1beta1.ModeInfo.Single - * @static - * @param {cosmos.tx.v1beta1.ModeInfo.ISingle} message Single message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Single.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mode); - return writer; - }; - - /** - * Encodes the specified Single message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.ModeInfo.Single.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.tx.v1beta1.ModeInfo.Single - * @static - * @param {cosmos.tx.v1beta1.ModeInfo.ISingle} message Single message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Single.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Single message from the specified reader or buffer. - * @function decode - * @memberof cosmos.tx.v1beta1.ModeInfo.Single - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.tx.v1beta1.ModeInfo.Single} Single - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Single.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.ModeInfo.Single(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.mode = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Single message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.tx.v1beta1.ModeInfo.Single - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.tx.v1beta1.ModeInfo.Single} Single - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Single.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Single message. - * @function verify - * @memberof cosmos.tx.v1beta1.ModeInfo.Single - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Single.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.mode != null && message.hasOwnProperty("mode")) - switch (message.mode) { - default: - return "mode: enum value expected"; - case 0: - case 1: - case 2: - case 127: - break; - } - return null; - }; - - /** - * Creates a Single message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.tx.v1beta1.ModeInfo.Single - * @static - * @param {Object.} object Plain object - * @returns {cosmos.tx.v1beta1.ModeInfo.Single} Single - */ - Single.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.tx.v1beta1.ModeInfo.Single) - return object; - let message = new $root.cosmos.tx.v1beta1.ModeInfo.Single(); - switch (object.mode) { - case "SIGN_MODE_UNSPECIFIED": - case 0: - message.mode = 0; - break; - case "SIGN_MODE_DIRECT": - case 1: - message.mode = 1; - break; - case "SIGN_MODE_TEXTUAL": - case 2: - message.mode = 2; - break; - case "SIGN_MODE_LEGACY_AMINO_JSON": - case 127: - message.mode = 127; - break; - } - return message; - }; - - /** - * Creates a plain object from a Single message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.tx.v1beta1.ModeInfo.Single - * @static - * @param {cosmos.tx.v1beta1.ModeInfo.Single} message Single - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Single.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.mode = options.enums === String ? "SIGN_MODE_UNSPECIFIED" : 0; - if (message.mode != null && message.hasOwnProperty("mode")) - object.mode = options.enums === String ? $root.cosmos.tx.signing.v1beta1.SignMode[message.mode] : message.mode; - return object; - }; - - /** - * Converts this Single to JSON. - * @function toJSON - * @memberof cosmos.tx.v1beta1.ModeInfo.Single - * @instance - * @returns {Object.} JSON object - */ - Single.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Single; - })(); - - ModeInfo.Multi = (function() { - - /** - * Properties of a Multi. - * @memberof cosmos.tx.v1beta1.ModeInfo - * @interface IMulti - * @property {cosmos.crypto.multisig.v1beta1.ICompactBitArray|null} [bitarray] Multi bitarray - * @property {Array.|null} [mode_infos] Multi mode_infos - */ - - /** - * Constructs a new Multi. - * @memberof cosmos.tx.v1beta1.ModeInfo - * @classdesc Represents a Multi. - * @implements IMulti - * @constructor - * @param {cosmos.tx.v1beta1.ModeInfo.IMulti=} [properties] Properties to set - */ - function Multi(properties) { - this.mode_infos = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Multi bitarray. - * @member {cosmos.crypto.multisig.v1beta1.ICompactBitArray|null|undefined} bitarray - * @memberof cosmos.tx.v1beta1.ModeInfo.Multi - * @instance - */ - Multi.prototype.bitarray = null; - - /** - * Multi mode_infos. - * @member {Array.} mode_infos - * @memberof cosmos.tx.v1beta1.ModeInfo.Multi - * @instance - */ - Multi.prototype.mode_infos = $util.emptyArray; - - /** - * Encodes the specified Multi message. Does not implicitly {@link cosmos.tx.v1beta1.ModeInfo.Multi.verify|verify} messages. - * @function encode - * @memberof cosmos.tx.v1beta1.ModeInfo.Multi - * @static - * @param {cosmos.tx.v1beta1.ModeInfo.IMulti} message Multi message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Multi.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.bitarray != null && Object.hasOwnProperty.call(message, "bitarray")) - $root.cosmos.crypto.multisig.v1beta1.CompactBitArray.encode(message.bitarray, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.mode_infos != null && message.mode_infos.length) - for (let i = 0; i < message.mode_infos.length; ++i) - $root.cosmos.tx.v1beta1.ModeInfo.encode(message.mode_infos[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Multi message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.ModeInfo.Multi.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.tx.v1beta1.ModeInfo.Multi - * @static - * @param {cosmos.tx.v1beta1.ModeInfo.IMulti} message Multi message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Multi.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Multi message from the specified reader or buffer. - * @function decode - * @memberof cosmos.tx.v1beta1.ModeInfo.Multi - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.tx.v1beta1.ModeInfo.Multi} Multi - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Multi.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.ModeInfo.Multi(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.bitarray = $root.cosmos.crypto.multisig.v1beta1.CompactBitArray.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.mode_infos && message.mode_infos.length)) - message.mode_infos = []; - message.mode_infos.push($root.cosmos.tx.v1beta1.ModeInfo.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Multi message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.tx.v1beta1.ModeInfo.Multi - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.tx.v1beta1.ModeInfo.Multi} Multi - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Multi.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Multi message. - * @function verify - * @memberof cosmos.tx.v1beta1.ModeInfo.Multi - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Multi.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.bitarray != null && message.hasOwnProperty("bitarray")) { - let error = $root.cosmos.crypto.multisig.v1beta1.CompactBitArray.verify(message.bitarray); - if (error) - return "bitarray." + error; - } - if (message.mode_infos != null && message.hasOwnProperty("mode_infos")) { - if (!Array.isArray(message.mode_infos)) - return "mode_infos: array expected"; - for (let i = 0; i < message.mode_infos.length; ++i) { - let error = $root.cosmos.tx.v1beta1.ModeInfo.verify(message.mode_infos[i]); - if (error) - return "mode_infos." + error; - } - } - return null; - }; - - /** - * Creates a Multi message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.tx.v1beta1.ModeInfo.Multi - * @static - * @param {Object.} object Plain object - * @returns {cosmos.tx.v1beta1.ModeInfo.Multi} Multi - */ - Multi.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.tx.v1beta1.ModeInfo.Multi) - return object; - let message = new $root.cosmos.tx.v1beta1.ModeInfo.Multi(); - if (object.bitarray != null) { - if (typeof object.bitarray !== "object") - throw TypeError(".cosmos.tx.v1beta1.ModeInfo.Multi.bitarray: object expected"); - message.bitarray = $root.cosmos.crypto.multisig.v1beta1.CompactBitArray.fromObject(object.bitarray); - } - if (object.mode_infos) { - if (!Array.isArray(object.mode_infos)) - throw TypeError(".cosmos.tx.v1beta1.ModeInfo.Multi.mode_infos: array expected"); - message.mode_infos = []; - for (let i = 0; i < object.mode_infos.length; ++i) { - if (typeof object.mode_infos[i] !== "object") - throw TypeError(".cosmos.tx.v1beta1.ModeInfo.Multi.mode_infos: object expected"); - message.mode_infos[i] = $root.cosmos.tx.v1beta1.ModeInfo.fromObject(object.mode_infos[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a Multi message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.tx.v1beta1.ModeInfo.Multi - * @static - * @param {cosmos.tx.v1beta1.ModeInfo.Multi} message Multi - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Multi.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.mode_infos = []; - if (options.defaults) - object.bitarray = null; - if (message.bitarray != null && message.hasOwnProperty("bitarray")) - object.bitarray = $root.cosmos.crypto.multisig.v1beta1.CompactBitArray.toObject(message.bitarray, options); - if (message.mode_infos && message.mode_infos.length) { - object.mode_infos = []; - for (let j = 0; j < message.mode_infos.length; ++j) - object.mode_infos[j] = $root.cosmos.tx.v1beta1.ModeInfo.toObject(message.mode_infos[j], options); - } - return object; - }; - - /** - * Converts this Multi to JSON. - * @function toJSON - * @memberof cosmos.tx.v1beta1.ModeInfo.Multi - * @instance - * @returns {Object.} JSON object - */ - Multi.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Multi; - })(); - - return ModeInfo; - })(); - - v1beta1.Fee = (function() { - - /** - * Properties of a Fee. - * @memberof cosmos.tx.v1beta1 - * @interface IFee - * @property {Array.|null} [amount] Fee amount - * @property {Long|null} [gas_limit] Fee gas_limit - * @property {string|null} [payer] Fee payer - * @property {string|null} [granter] Fee granter - */ - - /** - * Constructs a new Fee. - * @memberof cosmos.tx.v1beta1 - * @classdesc Represents a Fee. - * @implements IFee - * @constructor - * @param {cosmos.tx.v1beta1.IFee=} [properties] Properties to set - */ - function Fee(properties) { - this.amount = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Fee amount. - * @member {Array.} amount - * @memberof cosmos.tx.v1beta1.Fee - * @instance - */ - Fee.prototype.amount = $util.emptyArray; - - /** - * Fee gas_limit. - * @member {Long} gas_limit - * @memberof cosmos.tx.v1beta1.Fee - * @instance - */ - Fee.prototype.gas_limit = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Fee payer. - * @member {string} payer - * @memberof cosmos.tx.v1beta1.Fee - * @instance - */ - Fee.prototype.payer = ""; - - /** - * Fee granter. - * @member {string} granter - * @memberof cosmos.tx.v1beta1.Fee - * @instance - */ - Fee.prototype.granter = ""; - - /** - * Encodes the specified Fee message. Does not implicitly {@link cosmos.tx.v1beta1.Fee.verify|verify} messages. - * @function encode - * @memberof cosmos.tx.v1beta1.Fee - * @static - * @param {cosmos.tx.v1beta1.IFee} message Fee message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Fee.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.amount != null && message.amount.length) - for (let i = 0; i < message.amount.length; ++i) - $root.cosmos.base.v1beta1.Coin.encode(message.amount[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.gas_limit != null && Object.hasOwnProperty.call(message, "gas_limit")) - writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.gas_limit); - if (message.payer != null && Object.hasOwnProperty.call(message, "payer")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.payer); - if (message.granter != null && Object.hasOwnProperty.call(message, "granter")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.granter); - return writer; - }; - - /** - * Encodes the specified Fee message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.Fee.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.tx.v1beta1.Fee - * @static - * @param {cosmos.tx.v1beta1.IFee} message Fee message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Fee.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Fee message from the specified reader or buffer. - * @function decode - * @memberof cosmos.tx.v1beta1.Fee - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.tx.v1beta1.Fee} Fee - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Fee.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.Fee(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.amount && message.amount.length)) - message.amount = []; - message.amount.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); - break; - case 2: - message.gas_limit = 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; - }; - - /** - * Decodes a Fee message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.tx.v1beta1.Fee - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.tx.v1beta1.Fee} Fee - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Fee.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Fee message. - * @function verify - * @memberof cosmos.tx.v1beta1.Fee - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Fee.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.amount != null && message.hasOwnProperty("amount")) { - if (!Array.isArray(message.amount)) - return "amount: array expected"; - for (let i = 0; i < message.amount.length; ++i) { - let error = $root.cosmos.base.v1beta1.Coin.verify(message.amount[i]); - if (error) - return "amount." + error; - } - } - if (message.gas_limit != null && message.hasOwnProperty("gas_limit")) - if (!$util.isInteger(message.gas_limit) && !(message.gas_limit && $util.isInteger(message.gas_limit.low) && $util.isInteger(message.gas_limit.high))) - return "gas_limit: integer|Long expected"; - if (message.payer != null && message.hasOwnProperty("payer")) - if (!$util.isString(message.payer)) - return "payer: string expected"; - if (message.granter != null && message.hasOwnProperty("granter")) - if (!$util.isString(message.granter)) - return "granter: string expected"; - return null; - }; - - /** - * Creates a Fee message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.tx.v1beta1.Fee - * @static - * @param {Object.} object Plain object - * @returns {cosmos.tx.v1beta1.Fee} Fee - */ - Fee.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.tx.v1beta1.Fee) - return object; - let message = new $root.cosmos.tx.v1beta1.Fee(); - if (object.amount) { - if (!Array.isArray(object.amount)) - throw TypeError(".cosmos.tx.v1beta1.Fee.amount: array expected"); - message.amount = []; - for (let i = 0; i < object.amount.length; ++i) { - if (typeof object.amount[i] !== "object") - throw TypeError(".cosmos.tx.v1beta1.Fee.amount: object expected"); - message.amount[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.amount[i]); - } - } - if (object.gas_limit != null) - if ($util.Long) - (message.gas_limit = $util.Long.fromValue(object.gas_limit)).unsigned = true; - else if (typeof object.gas_limit === "string") - message.gas_limit = parseInt(object.gas_limit, 10); - else if (typeof object.gas_limit === "number") - message.gas_limit = object.gas_limit; - else if (typeof object.gas_limit === "object") - message.gas_limit = new $util.LongBits(object.gas_limit.low >>> 0, object.gas_limit.high >>> 0).toNumber(true); - if (object.payer != null) - message.payer = String(object.payer); - if (object.granter != null) - message.granter = String(object.granter); - return message; - }; - - /** - * Creates a plain object from a Fee message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.tx.v1beta1.Fee - * @static - * @param {cosmos.tx.v1beta1.Fee} message Fee - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Fee.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.amount = []; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.gas_limit = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.gas_limit = options.longs === String ? "0" : 0; - object.payer = ""; - object.granter = ""; - } - if (message.amount && message.amount.length) { - object.amount = []; - for (let j = 0; j < message.amount.length; ++j) - object.amount[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.amount[j], options); - } - if (message.gas_limit != null && message.hasOwnProperty("gas_limit")) - if (typeof message.gas_limit === "number") - object.gas_limit = options.longs === String ? String(message.gas_limit) : message.gas_limit; - else - object.gas_limit = options.longs === String ? $util.Long.prototype.toString.call(message.gas_limit) : options.longs === Number ? new $util.LongBits(message.gas_limit.low >>> 0, message.gas_limit.high >>> 0).toNumber(true) : message.gas_limit; - if (message.payer != null && message.hasOwnProperty("payer")) - object.payer = message.payer; - if (message.granter != null && message.hasOwnProperty("granter")) - object.granter = message.granter; - return object; - }; - - /** - * Converts this Fee to JSON. - * @function toJSON - * @memberof cosmos.tx.v1beta1.Fee - * @instance - * @returns {Object.} JSON object - */ - Fee.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Fee; - })(); - - v1beta1.Service = (function() { - - /** - * Constructs a new Service service. - * @memberof cosmos.tx.v1beta1 - * @classdesc Represents a Service - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function Service(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Service.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Service; - - /** - * Callback as used by {@link cosmos.tx.v1beta1.Service#simulate}. - * @memberof cosmos.tx.v1beta1.Service - * @typedef SimulateCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.tx.v1beta1.SimulateResponse} [response] SimulateResponse - */ - - /** - * Calls Simulate. - * @function simulate - * @memberof cosmos.tx.v1beta1.Service - * @instance - * @param {cosmos.tx.v1beta1.ISimulateRequest} request SimulateRequest message or plain object - * @param {cosmos.tx.v1beta1.Service.SimulateCallback} callback Node-style callback called with the error, if any, and SimulateResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Service.prototype.simulate = function simulate(request, callback) { - return this.rpcCall(simulate, $root.cosmos.tx.v1beta1.SimulateRequest, $root.cosmos.tx.v1beta1.SimulateResponse, request, callback); - }, "name", { value: "Simulate" }); - - /** - * Calls Simulate. - * @function simulate - * @memberof cosmos.tx.v1beta1.Service - * @instance - * @param {cosmos.tx.v1beta1.ISimulateRequest} request SimulateRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.tx.v1beta1.Service#getTx}. - * @memberof cosmos.tx.v1beta1.Service - * @typedef GetTxCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.tx.v1beta1.GetTxResponse} [response] GetTxResponse - */ - - /** - * Calls GetTx. - * @function getTx - * @memberof cosmos.tx.v1beta1.Service - * @instance - * @param {cosmos.tx.v1beta1.IGetTxRequest} request GetTxRequest message or plain object - * @param {cosmos.tx.v1beta1.Service.GetTxCallback} callback Node-style callback called with the error, if any, and GetTxResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Service.prototype.getTx = function getTx(request, callback) { - return this.rpcCall(getTx, $root.cosmos.tx.v1beta1.GetTxRequest, $root.cosmos.tx.v1beta1.GetTxResponse, request, callback); - }, "name", { value: "GetTx" }); - - /** - * Calls GetTx. - * @function getTx - * @memberof cosmos.tx.v1beta1.Service - * @instance - * @param {cosmos.tx.v1beta1.IGetTxRequest} request GetTxRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.tx.v1beta1.Service#broadcastTx}. - * @memberof cosmos.tx.v1beta1.Service - * @typedef BroadcastTxCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.tx.v1beta1.BroadcastTxResponse} [response] BroadcastTxResponse - */ - - /** - * Calls BroadcastTx. - * @function broadcastTx - * @memberof cosmos.tx.v1beta1.Service - * @instance - * @param {cosmos.tx.v1beta1.IBroadcastTxRequest} request BroadcastTxRequest message or plain object - * @param {cosmos.tx.v1beta1.Service.BroadcastTxCallback} callback Node-style callback called with the error, if any, and BroadcastTxResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Service.prototype.broadcastTx = function broadcastTx(request, callback) { - return this.rpcCall(broadcastTx, $root.cosmos.tx.v1beta1.BroadcastTxRequest, $root.cosmos.tx.v1beta1.BroadcastTxResponse, request, callback); - }, "name", { value: "BroadcastTx" }); - - /** - * Calls BroadcastTx. - * @function broadcastTx - * @memberof cosmos.tx.v1beta1.Service - * @instance - * @param {cosmos.tx.v1beta1.IBroadcastTxRequest} request BroadcastTxRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.tx.v1beta1.Service#getTxsEvent}. - * @memberof cosmos.tx.v1beta1.Service - * @typedef GetTxsEventCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.tx.v1beta1.GetTxsEventResponse} [response] GetTxsEventResponse - */ - - /** - * Calls GetTxsEvent. - * @function getTxsEvent - * @memberof cosmos.tx.v1beta1.Service - * @instance - * @param {cosmos.tx.v1beta1.IGetTxsEventRequest} request GetTxsEventRequest message or plain object - * @param {cosmos.tx.v1beta1.Service.GetTxsEventCallback} callback Node-style callback called with the error, if any, and GetTxsEventResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Service.prototype.getTxsEvent = function getTxsEvent(request, callback) { - return this.rpcCall(getTxsEvent, $root.cosmos.tx.v1beta1.GetTxsEventRequest, $root.cosmos.tx.v1beta1.GetTxsEventResponse, request, callback); - }, "name", { value: "GetTxsEvent" }); - - /** - * Calls GetTxsEvent. - * @function getTxsEvent - * @memberof cosmos.tx.v1beta1.Service - * @instance - * @param {cosmos.tx.v1beta1.IGetTxsEventRequest} request GetTxsEventRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return Service; - })(); - - v1beta1.GetTxsEventRequest = (function() { - - /** - * Properties of a GetTxsEventRequest. - * @memberof cosmos.tx.v1beta1 - * @interface IGetTxsEventRequest - * @property {Array.|null} [events] GetTxsEventRequest events - * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] GetTxsEventRequest pagination - */ - - /** - * Constructs a new GetTxsEventRequest. - * @memberof cosmos.tx.v1beta1 - * @classdesc Represents a GetTxsEventRequest. - * @implements IGetTxsEventRequest - * @constructor - * @param {cosmos.tx.v1beta1.IGetTxsEventRequest=} [properties] Properties to set - */ - function GetTxsEventRequest(properties) { - this.events = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GetTxsEventRequest events. - * @member {Array.} events - * @memberof cosmos.tx.v1beta1.GetTxsEventRequest - * @instance - */ - GetTxsEventRequest.prototype.events = $util.emptyArray; - - /** - * GetTxsEventRequest pagination. - * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination - * @memberof cosmos.tx.v1beta1.GetTxsEventRequest - * @instance - */ - GetTxsEventRequest.prototype.pagination = null; - - /** - * Encodes the specified GetTxsEventRequest message. Does not implicitly {@link cosmos.tx.v1beta1.GetTxsEventRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.tx.v1beta1.GetTxsEventRequest - * @static - * @param {cosmos.tx.v1beta1.IGetTxsEventRequest} message GetTxsEventRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetTxsEventRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.events != null && message.events.length) - for (let i = 0; i < message.events.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.events[i]); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GetTxsEventRequest message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.GetTxsEventRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.tx.v1beta1.GetTxsEventRequest - * @static - * @param {cosmos.tx.v1beta1.IGetTxsEventRequest} message GetTxsEventRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetTxsEventRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetTxsEventRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.tx.v1beta1.GetTxsEventRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.tx.v1beta1.GetTxsEventRequest} GetTxsEventRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetTxsEventRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.GetTxsEventRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.events && message.events.length)) - message.events = []; - message.events.push(reader.string()); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetTxsEventRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.tx.v1beta1.GetTxsEventRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.tx.v1beta1.GetTxsEventRequest} GetTxsEventRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetTxsEventRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetTxsEventRequest message. - * @function verify - * @memberof cosmos.tx.v1beta1.GetTxsEventRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetTxsEventRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.events != null && message.hasOwnProperty("events")) { - if (!Array.isArray(message.events)) - return "events: array expected"; - for (let i = 0; i < message.events.length; ++i) - if (!$util.isString(message.events[i])) - return "events: string[] expected"; - } - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a GetTxsEventRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.tx.v1beta1.GetTxsEventRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.tx.v1beta1.GetTxsEventRequest} GetTxsEventRequest - */ - GetTxsEventRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.tx.v1beta1.GetTxsEventRequest) - return object; - let message = new $root.cosmos.tx.v1beta1.GetTxsEventRequest(); - if (object.events) { - if (!Array.isArray(object.events)) - throw TypeError(".cosmos.tx.v1beta1.GetTxsEventRequest.events: array expected"); - message.events = []; - for (let i = 0; i < object.events.length; ++i) - message.events[i] = String(object.events[i]); - } - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.tx.v1beta1.GetTxsEventRequest.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a GetTxsEventRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.tx.v1beta1.GetTxsEventRequest - * @static - * @param {cosmos.tx.v1beta1.GetTxsEventRequest} message GetTxsEventRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetTxsEventRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.events = []; - if (options.defaults) - object.pagination = null; - if (message.events && message.events.length) { - object.events = []; - for (let j = 0; j < message.events.length; ++j) - object.events[j] = message.events[j]; - } - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this GetTxsEventRequest to JSON. - * @function toJSON - * @memberof cosmos.tx.v1beta1.GetTxsEventRequest - * @instance - * @returns {Object.} JSON object - */ - GetTxsEventRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GetTxsEventRequest; - })(); - - v1beta1.GetTxsEventResponse = (function() { - - /** - * Properties of a GetTxsEventResponse. - * @memberof cosmos.tx.v1beta1 - * @interface IGetTxsEventResponse - * @property {Array.|null} [txs] GetTxsEventResponse txs - * @property {Array.|null} [tx_responses] GetTxsEventResponse tx_responses - * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] GetTxsEventResponse pagination - */ - - /** - * Constructs a new GetTxsEventResponse. - * @memberof cosmos.tx.v1beta1 - * @classdesc Represents a GetTxsEventResponse. - * @implements IGetTxsEventResponse - * @constructor - * @param {cosmos.tx.v1beta1.IGetTxsEventResponse=} [properties] Properties to set - */ - function GetTxsEventResponse(properties) { - this.txs = []; - this.tx_responses = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GetTxsEventResponse txs. - * @member {Array.} txs - * @memberof cosmos.tx.v1beta1.GetTxsEventResponse - * @instance - */ - GetTxsEventResponse.prototype.txs = $util.emptyArray; - - /** - * GetTxsEventResponse tx_responses. - * @member {Array.} tx_responses - * @memberof cosmos.tx.v1beta1.GetTxsEventResponse - * @instance - */ - GetTxsEventResponse.prototype.tx_responses = $util.emptyArray; - - /** - * GetTxsEventResponse pagination. - * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination - * @memberof cosmos.tx.v1beta1.GetTxsEventResponse - * @instance - */ - GetTxsEventResponse.prototype.pagination = null; - - /** - * Encodes the specified GetTxsEventResponse message. Does not implicitly {@link cosmos.tx.v1beta1.GetTxsEventResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.tx.v1beta1.GetTxsEventResponse - * @static - * @param {cosmos.tx.v1beta1.IGetTxsEventResponse} message GetTxsEventResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetTxsEventResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.txs != null && message.txs.length) - for (let i = 0; i < message.txs.length; ++i) - $root.cosmos.tx.v1beta1.Tx.encode(message.txs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.tx_responses != null && message.tx_responses.length) - for (let i = 0; i < message.tx_responses.length; ++i) - $root.cosmos.base.abci.v1beta1.TxResponse.encode(message.tx_responses[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GetTxsEventResponse message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.GetTxsEventResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.tx.v1beta1.GetTxsEventResponse - * @static - * @param {cosmos.tx.v1beta1.IGetTxsEventResponse} message GetTxsEventResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetTxsEventResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetTxsEventResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.tx.v1beta1.GetTxsEventResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.tx.v1beta1.GetTxsEventResponse} GetTxsEventResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetTxsEventResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.GetTxsEventResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.txs && message.txs.length)) - message.txs = []; - message.txs.push($root.cosmos.tx.v1beta1.Tx.decode(reader, reader.uint32())); - break; - case 2: - if (!(message.tx_responses && message.tx_responses.length)) - message.tx_responses = []; - message.tx_responses.push($root.cosmos.base.abci.v1beta1.TxResponse.decode(reader, reader.uint32())); - break; - case 3: - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetTxsEventResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.tx.v1beta1.GetTxsEventResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.tx.v1beta1.GetTxsEventResponse} GetTxsEventResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetTxsEventResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetTxsEventResponse message. - * @function verify - * @memberof cosmos.tx.v1beta1.GetTxsEventResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetTxsEventResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.txs != null && message.hasOwnProperty("txs")) { - if (!Array.isArray(message.txs)) - return "txs: array expected"; - for (let i = 0; i < message.txs.length; ++i) { - let error = $root.cosmos.tx.v1beta1.Tx.verify(message.txs[i]); - if (error) - return "txs." + error; - } - } - if (message.tx_responses != null && message.hasOwnProperty("tx_responses")) { - if (!Array.isArray(message.tx_responses)) - return "tx_responses: array expected"; - for (let i = 0; i < message.tx_responses.length; ++i) { - let error = $root.cosmos.base.abci.v1beta1.TxResponse.verify(message.tx_responses[i]); - if (error) - return "tx_responses." + error; - } - } - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a GetTxsEventResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.tx.v1beta1.GetTxsEventResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.tx.v1beta1.GetTxsEventResponse} GetTxsEventResponse - */ - GetTxsEventResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.tx.v1beta1.GetTxsEventResponse) - return object; - let message = new $root.cosmos.tx.v1beta1.GetTxsEventResponse(); - if (object.txs) { - if (!Array.isArray(object.txs)) - throw TypeError(".cosmos.tx.v1beta1.GetTxsEventResponse.txs: array expected"); - message.txs = []; - for (let i = 0; i < object.txs.length; ++i) { - if (typeof object.txs[i] !== "object") - throw TypeError(".cosmos.tx.v1beta1.GetTxsEventResponse.txs: object expected"); - message.txs[i] = $root.cosmos.tx.v1beta1.Tx.fromObject(object.txs[i]); - } - } - if (object.tx_responses) { - if (!Array.isArray(object.tx_responses)) - throw TypeError(".cosmos.tx.v1beta1.GetTxsEventResponse.tx_responses: array expected"); - message.tx_responses = []; - for (let i = 0; i < object.tx_responses.length; ++i) { - if (typeof object.tx_responses[i] !== "object") - throw TypeError(".cosmos.tx.v1beta1.GetTxsEventResponse.tx_responses: object expected"); - message.tx_responses[i] = $root.cosmos.base.abci.v1beta1.TxResponse.fromObject(object.tx_responses[i]); - } - } - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".cosmos.tx.v1beta1.GetTxsEventResponse.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a GetTxsEventResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.tx.v1beta1.GetTxsEventResponse - * @static - * @param {cosmos.tx.v1beta1.GetTxsEventResponse} message GetTxsEventResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetTxsEventResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) { - object.txs = []; - object.tx_responses = []; - } - if (options.defaults) - object.pagination = null; - if (message.txs && message.txs.length) { - object.txs = []; - for (let j = 0; j < message.txs.length; ++j) - object.txs[j] = $root.cosmos.tx.v1beta1.Tx.toObject(message.txs[j], options); - } - if (message.tx_responses && message.tx_responses.length) { - object.tx_responses = []; - for (let j = 0; j < message.tx_responses.length; ++j) - object.tx_responses[j] = $root.cosmos.base.abci.v1beta1.TxResponse.toObject(message.tx_responses[j], options); - } - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this GetTxsEventResponse to JSON. - * @function toJSON - * @memberof cosmos.tx.v1beta1.GetTxsEventResponse - * @instance - * @returns {Object.} JSON object - */ - GetTxsEventResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GetTxsEventResponse; - })(); - - v1beta1.BroadcastTxRequest = (function() { - - /** - * Properties of a BroadcastTxRequest. - * @memberof cosmos.tx.v1beta1 - * @interface IBroadcastTxRequest - * @property {Uint8Array|null} [tx_bytes] BroadcastTxRequest tx_bytes - * @property {cosmos.tx.v1beta1.BroadcastMode|null} [mode] BroadcastTxRequest mode - */ - - /** - * Constructs a new BroadcastTxRequest. - * @memberof cosmos.tx.v1beta1 - * @classdesc Represents a BroadcastTxRequest. - * @implements IBroadcastTxRequest - * @constructor - * @param {cosmos.tx.v1beta1.IBroadcastTxRequest=} [properties] Properties to set - */ - function BroadcastTxRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * BroadcastTxRequest tx_bytes. - * @member {Uint8Array} tx_bytes - * @memberof cosmos.tx.v1beta1.BroadcastTxRequest - * @instance - */ - BroadcastTxRequest.prototype.tx_bytes = $util.newBuffer([]); - - /** - * BroadcastTxRequest mode. - * @member {cosmos.tx.v1beta1.BroadcastMode} mode - * @memberof cosmos.tx.v1beta1.BroadcastTxRequest - * @instance - */ - BroadcastTxRequest.prototype.mode = 0; - - /** - * Encodes the specified BroadcastTxRequest message. Does not implicitly {@link cosmos.tx.v1beta1.BroadcastTxRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.tx.v1beta1.BroadcastTxRequest - * @static - * @param {cosmos.tx.v1beta1.IBroadcastTxRequest} message BroadcastTxRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BroadcastTxRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.tx_bytes != null && Object.hasOwnProperty.call(message, "tx_bytes")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.tx_bytes); - if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.mode); - return writer; - }; - - /** - * Encodes the specified BroadcastTxRequest message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.BroadcastTxRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.tx.v1beta1.BroadcastTxRequest - * @static - * @param {cosmos.tx.v1beta1.IBroadcastTxRequest} message BroadcastTxRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BroadcastTxRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BroadcastTxRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.tx.v1beta1.BroadcastTxRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.tx.v1beta1.BroadcastTxRequest} BroadcastTxRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BroadcastTxRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.BroadcastTxRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.tx_bytes = reader.bytes(); - break; - case 2: - message.mode = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BroadcastTxRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.tx.v1beta1.BroadcastTxRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.tx.v1beta1.BroadcastTxRequest} BroadcastTxRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BroadcastTxRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BroadcastTxRequest message. - * @function verify - * @memberof cosmos.tx.v1beta1.BroadcastTxRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BroadcastTxRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.tx_bytes != null && message.hasOwnProperty("tx_bytes")) - if (!(message.tx_bytes && typeof message.tx_bytes.length === "number" || $util.isString(message.tx_bytes))) - return "tx_bytes: buffer expected"; - if (message.mode != null && message.hasOwnProperty("mode")) - switch (message.mode) { - default: - return "mode: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - return null; - }; - - /** - * Creates a BroadcastTxRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.tx.v1beta1.BroadcastTxRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.tx.v1beta1.BroadcastTxRequest} BroadcastTxRequest - */ - BroadcastTxRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.tx.v1beta1.BroadcastTxRequest) - return object; - let message = new $root.cosmos.tx.v1beta1.BroadcastTxRequest(); - if (object.tx_bytes != null) - if (typeof object.tx_bytes === "string") - $util.base64.decode(object.tx_bytes, message.tx_bytes = $util.newBuffer($util.base64.length(object.tx_bytes)), 0); - else if (object.tx_bytes.length) - message.tx_bytes = object.tx_bytes; - switch (object.mode) { - case "BROADCAST_MODE_UNSPECIFIED": - case 0: - message.mode = 0; - break; - case "BROADCAST_MODE_BLOCK": - case 1: - message.mode = 1; - break; - case "BROADCAST_MODE_SYNC": - case 2: - message.mode = 2; - break; - case "BROADCAST_MODE_ASYNC": - case 3: - message.mode = 3; - break; - } - return message; - }; - - /** - * Creates a plain object from a BroadcastTxRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.tx.v1beta1.BroadcastTxRequest - * @static - * @param {cosmos.tx.v1beta1.BroadcastTxRequest} message BroadcastTxRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BroadcastTxRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if (options.bytes === String) - object.tx_bytes = ""; - else { - object.tx_bytes = []; - if (options.bytes !== Array) - object.tx_bytes = $util.newBuffer(object.tx_bytes); - } - object.mode = options.enums === String ? "BROADCAST_MODE_UNSPECIFIED" : 0; - } - if (message.tx_bytes != null && message.hasOwnProperty("tx_bytes")) - object.tx_bytes = options.bytes === String ? $util.base64.encode(message.tx_bytes, 0, message.tx_bytes.length) : options.bytes === Array ? Array.prototype.slice.call(message.tx_bytes) : message.tx_bytes; - if (message.mode != null && message.hasOwnProperty("mode")) - object.mode = options.enums === String ? $root.cosmos.tx.v1beta1.BroadcastMode[message.mode] : message.mode; - return object; - }; - - /** - * Converts this BroadcastTxRequest to JSON. - * @function toJSON - * @memberof cosmos.tx.v1beta1.BroadcastTxRequest - * @instance - * @returns {Object.} JSON object - */ - BroadcastTxRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return BroadcastTxRequest; - })(); - - /** - * BroadcastMode enum. - * @name cosmos.tx.v1beta1.BroadcastMode - * @enum {number} - * @property {number} BROADCAST_MODE_UNSPECIFIED=0 BROADCAST_MODE_UNSPECIFIED value - * @property {number} BROADCAST_MODE_BLOCK=1 BROADCAST_MODE_BLOCK value - * @property {number} BROADCAST_MODE_SYNC=2 BROADCAST_MODE_SYNC value - * @property {number} BROADCAST_MODE_ASYNC=3 BROADCAST_MODE_ASYNC value - */ - v1beta1.BroadcastMode = (function() { - const valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "BROADCAST_MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "BROADCAST_MODE_BLOCK"] = 1; - values[valuesById[2] = "BROADCAST_MODE_SYNC"] = 2; - values[valuesById[3] = "BROADCAST_MODE_ASYNC"] = 3; - return values; - })(); - - v1beta1.BroadcastTxResponse = (function() { - - /** - * Properties of a BroadcastTxResponse. - * @memberof cosmos.tx.v1beta1 - * @interface IBroadcastTxResponse - * @property {cosmos.base.abci.v1beta1.ITxResponse|null} [tx_response] BroadcastTxResponse tx_response - */ - - /** - * Constructs a new BroadcastTxResponse. - * @memberof cosmos.tx.v1beta1 - * @classdesc Represents a BroadcastTxResponse. - * @implements IBroadcastTxResponse - * @constructor - * @param {cosmos.tx.v1beta1.IBroadcastTxResponse=} [properties] Properties to set - */ - function BroadcastTxResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * BroadcastTxResponse tx_response. - * @member {cosmos.base.abci.v1beta1.ITxResponse|null|undefined} tx_response - * @memberof cosmos.tx.v1beta1.BroadcastTxResponse - * @instance - */ - BroadcastTxResponse.prototype.tx_response = null; - - /** - * Encodes the specified BroadcastTxResponse message. Does not implicitly {@link cosmos.tx.v1beta1.BroadcastTxResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.tx.v1beta1.BroadcastTxResponse - * @static - * @param {cosmos.tx.v1beta1.IBroadcastTxResponse} message BroadcastTxResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BroadcastTxResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.tx_response != null && Object.hasOwnProperty.call(message, "tx_response")) - $root.cosmos.base.abci.v1beta1.TxResponse.encode(message.tx_response, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified BroadcastTxResponse message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.BroadcastTxResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.tx.v1beta1.BroadcastTxResponse - * @static - * @param {cosmos.tx.v1beta1.IBroadcastTxResponse} message BroadcastTxResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BroadcastTxResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BroadcastTxResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.tx.v1beta1.BroadcastTxResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.tx.v1beta1.BroadcastTxResponse} BroadcastTxResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BroadcastTxResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.BroadcastTxResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.tx_response = $root.cosmos.base.abci.v1beta1.TxResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BroadcastTxResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.tx.v1beta1.BroadcastTxResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.tx.v1beta1.BroadcastTxResponse} BroadcastTxResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BroadcastTxResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BroadcastTxResponse message. - * @function verify - * @memberof cosmos.tx.v1beta1.BroadcastTxResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BroadcastTxResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.tx_response != null && message.hasOwnProperty("tx_response")) { - let error = $root.cosmos.base.abci.v1beta1.TxResponse.verify(message.tx_response); - if (error) - return "tx_response." + error; - } - return null; - }; - - /** - * Creates a BroadcastTxResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.tx.v1beta1.BroadcastTxResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.tx.v1beta1.BroadcastTxResponse} BroadcastTxResponse - */ - BroadcastTxResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.tx.v1beta1.BroadcastTxResponse) - return object; - let message = new $root.cosmos.tx.v1beta1.BroadcastTxResponse(); - if (object.tx_response != null) { - if (typeof object.tx_response !== "object") - throw TypeError(".cosmos.tx.v1beta1.BroadcastTxResponse.tx_response: object expected"); - message.tx_response = $root.cosmos.base.abci.v1beta1.TxResponse.fromObject(object.tx_response); - } - return message; - }; - - /** - * Creates a plain object from a BroadcastTxResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.tx.v1beta1.BroadcastTxResponse - * @static - * @param {cosmos.tx.v1beta1.BroadcastTxResponse} message BroadcastTxResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BroadcastTxResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.tx_response = null; - if (message.tx_response != null && message.hasOwnProperty("tx_response")) - object.tx_response = $root.cosmos.base.abci.v1beta1.TxResponse.toObject(message.tx_response, options); - return object; - }; - - /** - * Converts this BroadcastTxResponse to JSON. - * @function toJSON - * @memberof cosmos.tx.v1beta1.BroadcastTxResponse - * @instance - * @returns {Object.} JSON object - */ - BroadcastTxResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return BroadcastTxResponse; - })(); - - v1beta1.SimulateRequest = (function() { - - /** - * Properties of a SimulateRequest. - * @memberof cosmos.tx.v1beta1 - * @interface ISimulateRequest - * @property {cosmos.tx.v1beta1.ITx|null} [tx] SimulateRequest tx - */ - - /** - * Constructs a new SimulateRequest. - * @memberof cosmos.tx.v1beta1 - * @classdesc Represents a SimulateRequest. - * @implements ISimulateRequest - * @constructor - * @param {cosmos.tx.v1beta1.ISimulateRequest=} [properties] Properties to set - */ - function SimulateRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SimulateRequest tx. - * @member {cosmos.tx.v1beta1.ITx|null|undefined} tx - * @memberof cosmos.tx.v1beta1.SimulateRequest - * @instance - */ - SimulateRequest.prototype.tx = null; - - /** - * Encodes the specified SimulateRequest message. Does not implicitly {@link cosmos.tx.v1beta1.SimulateRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.tx.v1beta1.SimulateRequest - * @static - * @param {cosmos.tx.v1beta1.ISimulateRequest} message SimulateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SimulateRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.tx != null && Object.hasOwnProperty.call(message, "tx")) - $root.cosmos.tx.v1beta1.Tx.encode(message.tx, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SimulateRequest message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.SimulateRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.tx.v1beta1.SimulateRequest - * @static - * @param {cosmos.tx.v1beta1.ISimulateRequest} message SimulateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SimulateRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SimulateRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.tx.v1beta1.SimulateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.tx.v1beta1.SimulateRequest} SimulateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SimulateRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.SimulateRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.tx = $root.cosmos.tx.v1beta1.Tx.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SimulateRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.tx.v1beta1.SimulateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.tx.v1beta1.SimulateRequest} SimulateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SimulateRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SimulateRequest message. - * @function verify - * @memberof cosmos.tx.v1beta1.SimulateRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SimulateRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.tx != null && message.hasOwnProperty("tx")) { - let error = $root.cosmos.tx.v1beta1.Tx.verify(message.tx); - if (error) - return "tx." + error; - } - return null; - }; - - /** - * Creates a SimulateRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.tx.v1beta1.SimulateRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.tx.v1beta1.SimulateRequest} SimulateRequest - */ - SimulateRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.tx.v1beta1.SimulateRequest) - return object; - let message = new $root.cosmos.tx.v1beta1.SimulateRequest(); - if (object.tx != null) { - if (typeof object.tx !== "object") - throw TypeError(".cosmos.tx.v1beta1.SimulateRequest.tx: object expected"); - message.tx = $root.cosmos.tx.v1beta1.Tx.fromObject(object.tx); - } - return message; - }; - - /** - * Creates a plain object from a SimulateRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.tx.v1beta1.SimulateRequest - * @static - * @param {cosmos.tx.v1beta1.SimulateRequest} message SimulateRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SimulateRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.tx = null; - if (message.tx != null && message.hasOwnProperty("tx")) - object.tx = $root.cosmos.tx.v1beta1.Tx.toObject(message.tx, options); - return object; - }; - - /** - * Converts this SimulateRequest to JSON. - * @function toJSON - * @memberof cosmos.tx.v1beta1.SimulateRequest - * @instance - * @returns {Object.} JSON object - */ - SimulateRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return SimulateRequest; - })(); - - v1beta1.SimulateResponse = (function() { - - /** - * Properties of a SimulateResponse. - * @memberof cosmos.tx.v1beta1 - * @interface ISimulateResponse - * @property {cosmos.base.abci.v1beta1.IGasInfo|null} [gas_info] SimulateResponse gas_info - * @property {cosmos.base.abci.v1beta1.IResult|null} [result] SimulateResponse result - */ - - /** - * Constructs a new SimulateResponse. - * @memberof cosmos.tx.v1beta1 - * @classdesc Represents a SimulateResponse. - * @implements ISimulateResponse - * @constructor - * @param {cosmos.tx.v1beta1.ISimulateResponse=} [properties] Properties to set - */ - function SimulateResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SimulateResponse gas_info. - * @member {cosmos.base.abci.v1beta1.IGasInfo|null|undefined} gas_info - * @memberof cosmos.tx.v1beta1.SimulateResponse - * @instance - */ - SimulateResponse.prototype.gas_info = null; - - /** - * SimulateResponse result. - * @member {cosmos.base.abci.v1beta1.IResult|null|undefined} result - * @memberof cosmos.tx.v1beta1.SimulateResponse - * @instance - */ - SimulateResponse.prototype.result = null; - - /** - * Encodes the specified SimulateResponse message. Does not implicitly {@link cosmos.tx.v1beta1.SimulateResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.tx.v1beta1.SimulateResponse - * @static - * @param {cosmos.tx.v1beta1.ISimulateResponse} message SimulateResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SimulateResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.gas_info != null && Object.hasOwnProperty.call(message, "gas_info")) - $root.cosmos.base.abci.v1beta1.GasInfo.encode(message.gas_info, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.result != null && Object.hasOwnProperty.call(message, "result")) - $root.cosmos.base.abci.v1beta1.Result.encode(message.result, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SimulateResponse message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.SimulateResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.tx.v1beta1.SimulateResponse - * @static - * @param {cosmos.tx.v1beta1.ISimulateResponse} message SimulateResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SimulateResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SimulateResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.tx.v1beta1.SimulateResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.tx.v1beta1.SimulateResponse} SimulateResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SimulateResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.SimulateResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.gas_info = $root.cosmos.base.abci.v1beta1.GasInfo.decode(reader, reader.uint32()); - break; - case 2: - message.result = $root.cosmos.base.abci.v1beta1.Result.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SimulateResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.tx.v1beta1.SimulateResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.tx.v1beta1.SimulateResponse} SimulateResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SimulateResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SimulateResponse message. - * @function verify - * @memberof cosmos.tx.v1beta1.SimulateResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SimulateResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.gas_info != null && message.hasOwnProperty("gas_info")) { - let error = $root.cosmos.base.abci.v1beta1.GasInfo.verify(message.gas_info); - if (error) - return "gas_info." + error; - } - if (message.result != null && message.hasOwnProperty("result")) { - let error = $root.cosmos.base.abci.v1beta1.Result.verify(message.result); - if (error) - return "result." + error; - } - return null; - }; - - /** - * Creates a SimulateResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.tx.v1beta1.SimulateResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.tx.v1beta1.SimulateResponse} SimulateResponse - */ - SimulateResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.tx.v1beta1.SimulateResponse) - return object; - let message = new $root.cosmos.tx.v1beta1.SimulateResponse(); - if (object.gas_info != null) { - if (typeof object.gas_info !== "object") - throw TypeError(".cosmos.tx.v1beta1.SimulateResponse.gas_info: object expected"); - message.gas_info = $root.cosmos.base.abci.v1beta1.GasInfo.fromObject(object.gas_info); - } - if (object.result != null) { - if (typeof object.result !== "object") - throw TypeError(".cosmos.tx.v1beta1.SimulateResponse.result: object expected"); - message.result = $root.cosmos.base.abci.v1beta1.Result.fromObject(object.result); - } - return message; - }; - - /** - * Creates a plain object from a SimulateResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.tx.v1beta1.SimulateResponse - * @static - * @param {cosmos.tx.v1beta1.SimulateResponse} message SimulateResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SimulateResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.gas_info = null; - object.result = null; - } - if (message.gas_info != null && message.hasOwnProperty("gas_info")) - object.gas_info = $root.cosmos.base.abci.v1beta1.GasInfo.toObject(message.gas_info, options); - if (message.result != null && message.hasOwnProperty("result")) - object.result = $root.cosmos.base.abci.v1beta1.Result.toObject(message.result, options); - return object; - }; - - /** - * Converts this SimulateResponse to JSON. - * @function toJSON - * @memberof cosmos.tx.v1beta1.SimulateResponse - * @instance - * @returns {Object.} JSON object - */ - SimulateResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return SimulateResponse; - })(); - - v1beta1.GetTxRequest = (function() { - - /** - * Properties of a GetTxRequest. - * @memberof cosmos.tx.v1beta1 - * @interface IGetTxRequest - * @property {string|null} [hash] GetTxRequest hash - */ - - /** - * Constructs a new GetTxRequest. - * @memberof cosmos.tx.v1beta1 - * @classdesc Represents a GetTxRequest. - * @implements IGetTxRequest - * @constructor - * @param {cosmos.tx.v1beta1.IGetTxRequest=} [properties] Properties to set - */ - function GetTxRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GetTxRequest hash. - * @member {string} hash - * @memberof cosmos.tx.v1beta1.GetTxRequest - * @instance - */ - GetTxRequest.prototype.hash = ""; - - /** - * Encodes the specified GetTxRequest message. Does not implicitly {@link cosmos.tx.v1beta1.GetTxRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.tx.v1beta1.GetTxRequest - * @static - * @param {cosmos.tx.v1beta1.IGetTxRequest} message GetTxRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetTxRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.hash != null && Object.hasOwnProperty.call(message, "hash")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.hash); - return writer; - }; - - /** - * Encodes the specified GetTxRequest message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.GetTxRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.tx.v1beta1.GetTxRequest - * @static - * @param {cosmos.tx.v1beta1.IGetTxRequest} message GetTxRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetTxRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetTxRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.tx.v1beta1.GetTxRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.tx.v1beta1.GetTxRequest} GetTxRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetTxRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.GetTxRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.hash = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetTxRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.tx.v1beta1.GetTxRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.tx.v1beta1.GetTxRequest} GetTxRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetTxRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetTxRequest message. - * @function verify - * @memberof cosmos.tx.v1beta1.GetTxRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetTxRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.hash != null && message.hasOwnProperty("hash")) - if (!$util.isString(message.hash)) - return "hash: string expected"; - return null; - }; - - /** - * Creates a GetTxRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.tx.v1beta1.GetTxRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.tx.v1beta1.GetTxRequest} GetTxRequest - */ - GetTxRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.tx.v1beta1.GetTxRequest) - return object; - let message = new $root.cosmos.tx.v1beta1.GetTxRequest(); - if (object.hash != null) - message.hash = String(object.hash); - return message; - }; - - /** - * Creates a plain object from a GetTxRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.tx.v1beta1.GetTxRequest - * @static - * @param {cosmos.tx.v1beta1.GetTxRequest} message GetTxRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetTxRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.hash = ""; - if (message.hash != null && message.hasOwnProperty("hash")) - object.hash = message.hash; - return object; - }; - - /** - * Converts this GetTxRequest to JSON. - * @function toJSON - * @memberof cosmos.tx.v1beta1.GetTxRequest - * @instance - * @returns {Object.} JSON object - */ - GetTxRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GetTxRequest; - })(); - - v1beta1.GetTxResponse = (function() { - - /** - * Properties of a GetTxResponse. - * @memberof cosmos.tx.v1beta1 - * @interface IGetTxResponse - * @property {cosmos.tx.v1beta1.ITx|null} [tx] GetTxResponse tx - * @property {cosmos.base.abci.v1beta1.ITxResponse|null} [tx_response] GetTxResponse tx_response - */ - - /** - * Constructs a new GetTxResponse. - * @memberof cosmos.tx.v1beta1 - * @classdesc Represents a GetTxResponse. - * @implements IGetTxResponse - * @constructor - * @param {cosmos.tx.v1beta1.IGetTxResponse=} [properties] Properties to set - */ - function GetTxResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GetTxResponse tx. - * @member {cosmos.tx.v1beta1.ITx|null|undefined} tx - * @memberof cosmos.tx.v1beta1.GetTxResponse - * @instance - */ - GetTxResponse.prototype.tx = null; - - /** - * GetTxResponse tx_response. - * @member {cosmos.base.abci.v1beta1.ITxResponse|null|undefined} tx_response - * @memberof cosmos.tx.v1beta1.GetTxResponse - * @instance - */ - GetTxResponse.prototype.tx_response = null; - - /** - * Encodes the specified GetTxResponse message. Does not implicitly {@link cosmos.tx.v1beta1.GetTxResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.tx.v1beta1.GetTxResponse - * @static - * @param {cosmos.tx.v1beta1.IGetTxResponse} message GetTxResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetTxResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.tx != null && Object.hasOwnProperty.call(message, "tx")) - $root.cosmos.tx.v1beta1.Tx.encode(message.tx, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.tx_response != null && Object.hasOwnProperty.call(message, "tx_response")) - $root.cosmos.base.abci.v1beta1.TxResponse.encode(message.tx_response, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GetTxResponse message, length delimited. Does not implicitly {@link cosmos.tx.v1beta1.GetTxResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.tx.v1beta1.GetTxResponse - * @static - * @param {cosmos.tx.v1beta1.IGetTxResponse} message GetTxResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetTxResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetTxResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.tx.v1beta1.GetTxResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.tx.v1beta1.GetTxResponse} GetTxResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetTxResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.tx.v1beta1.GetTxResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.tx = $root.cosmos.tx.v1beta1.Tx.decode(reader, reader.uint32()); - break; - case 2: - message.tx_response = $root.cosmos.base.abci.v1beta1.TxResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetTxResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.tx.v1beta1.GetTxResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.tx.v1beta1.GetTxResponse} GetTxResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetTxResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetTxResponse message. - * @function verify - * @memberof cosmos.tx.v1beta1.GetTxResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetTxResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.tx != null && message.hasOwnProperty("tx")) { - let error = $root.cosmos.tx.v1beta1.Tx.verify(message.tx); - if (error) - return "tx." + error; - } - if (message.tx_response != null && message.hasOwnProperty("tx_response")) { - let error = $root.cosmos.base.abci.v1beta1.TxResponse.verify(message.tx_response); - if (error) - return "tx_response." + error; - } - return null; - }; - - /** - * Creates a GetTxResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.tx.v1beta1.GetTxResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.tx.v1beta1.GetTxResponse} GetTxResponse - */ - GetTxResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.tx.v1beta1.GetTxResponse) - return object; - let message = new $root.cosmos.tx.v1beta1.GetTxResponse(); - if (object.tx != null) { - if (typeof object.tx !== "object") - throw TypeError(".cosmos.tx.v1beta1.GetTxResponse.tx: object expected"); - message.tx = $root.cosmos.tx.v1beta1.Tx.fromObject(object.tx); - } - if (object.tx_response != null) { - if (typeof object.tx_response !== "object") - throw TypeError(".cosmos.tx.v1beta1.GetTxResponse.tx_response: object expected"); - message.tx_response = $root.cosmos.base.abci.v1beta1.TxResponse.fromObject(object.tx_response); - } - return message; - }; - - /** - * Creates a plain object from a GetTxResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.tx.v1beta1.GetTxResponse - * @static - * @param {cosmos.tx.v1beta1.GetTxResponse} message GetTxResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetTxResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.tx = null; - object.tx_response = null; - } - if (message.tx != null && message.hasOwnProperty("tx")) - object.tx = $root.cosmos.tx.v1beta1.Tx.toObject(message.tx, options); - if (message.tx_response != null && message.hasOwnProperty("tx_response")) - object.tx_response = $root.cosmos.base.abci.v1beta1.TxResponse.toObject(message.tx_response, options); - return object; - }; - - /** - * Converts this GetTxResponse to JSON. - * @function toJSON - * @memberof cosmos.tx.v1beta1.GetTxResponse - * @instance - * @returns {Object.} JSON object - */ - GetTxResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GetTxResponse; - })(); - - return v1beta1; - })(); - - return tx; - })(); - - cosmos.upgrade = (function() { - - /** - * Namespace upgrade. - * @memberof cosmos - * @namespace - */ - const upgrade = {}; - - upgrade.v1beta1 = (function() { - - /** - * Namespace v1beta1. - * @memberof cosmos.upgrade - * @namespace - */ - const v1beta1 = {}; - - v1beta1.Plan = (function() { - - /** - * Properties of a Plan. - * @memberof cosmos.upgrade.v1beta1 - * @interface IPlan - * @property {string|null} [name] Plan name - * @property {google.protobuf.ITimestamp|null} [time] Plan time - * @property {Long|null} [height] Plan height - * @property {string|null} [info] Plan info - * @property {google.protobuf.IAny|null} [upgraded_client_state] Plan upgraded_client_state - */ - - /** - * Constructs a new Plan. - * @memberof cosmos.upgrade.v1beta1 - * @classdesc Represents a Plan. - * @implements IPlan - * @constructor - * @param {cosmos.upgrade.v1beta1.IPlan=} [properties] Properties to set - */ - function Plan(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Plan name. - * @member {string} name - * @memberof cosmos.upgrade.v1beta1.Plan - * @instance - */ - Plan.prototype.name = ""; - - /** - * Plan time. - * @member {google.protobuf.ITimestamp|null|undefined} time - * @memberof cosmos.upgrade.v1beta1.Plan - * @instance - */ - Plan.prototype.time = null; - - /** - * Plan height. - * @member {Long} height - * @memberof cosmos.upgrade.v1beta1.Plan - * @instance - */ - Plan.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Plan info. - * @member {string} info - * @memberof cosmos.upgrade.v1beta1.Plan - * @instance - */ - Plan.prototype.info = ""; - - /** - * Plan upgraded_client_state. - * @member {google.protobuf.IAny|null|undefined} upgraded_client_state - * @memberof cosmos.upgrade.v1beta1.Plan - * @instance - */ - Plan.prototype.upgraded_client_state = null; - - /** - * Encodes the specified Plan message. Does not implicitly {@link cosmos.upgrade.v1beta1.Plan.verify|verify} messages. - * @function encode - * @memberof cosmos.upgrade.v1beta1.Plan - * @static - * @param {cosmos.upgrade.v1beta1.IPlan} message Plan message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Plan.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.time != null && Object.hasOwnProperty.call(message, "time")) - $root.google.protobuf.Timestamp.encode(message.time, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.height); - if (message.info != null && Object.hasOwnProperty.call(message, "info")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.info); - if (message.upgraded_client_state != null && Object.hasOwnProperty.call(message, "upgraded_client_state")) - $root.google.protobuf.Any.encode(message.upgraded_client_state, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Plan message, length delimited. Does not implicitly {@link cosmos.upgrade.v1beta1.Plan.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.upgrade.v1beta1.Plan - * @static - * @param {cosmos.upgrade.v1beta1.IPlan} message Plan message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Plan.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Plan message from the specified reader or buffer. - * @function decode - * @memberof cosmos.upgrade.v1beta1.Plan - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.upgrade.v1beta1.Plan} Plan - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Plan.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.upgrade.v1beta1.Plan(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 3: - message.height = reader.int64(); - break; - case 4: - message.info = reader.string(); - break; - case 5: - message.upgraded_client_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Plan message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.upgrade.v1beta1.Plan - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.upgrade.v1beta1.Plan} Plan - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Plan.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Plan message. - * @function verify - * @memberof cosmos.upgrade.v1beta1.Plan - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Plan.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.time != null && message.hasOwnProperty("time")) { - let error = $root.google.protobuf.Timestamp.verify(message.time); - if (error) - return "time." + error; - } - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) - return "height: integer|Long expected"; - if (message.info != null && message.hasOwnProperty("info")) - if (!$util.isString(message.info)) - return "info: string expected"; - if (message.upgraded_client_state != null && message.hasOwnProperty("upgraded_client_state")) { - let error = $root.google.protobuf.Any.verify(message.upgraded_client_state); - if (error) - return "upgraded_client_state." + error; - } - return null; - }; - - /** - * Creates a Plan message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.upgrade.v1beta1.Plan - * @static - * @param {Object.} object Plain object - * @returns {cosmos.upgrade.v1beta1.Plan} Plan - */ - Plan.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.upgrade.v1beta1.Plan) - return object; - let message = new $root.cosmos.upgrade.v1beta1.Plan(); - if (object.name != null) - message.name = String(object.name); - if (object.time != null) { - if (typeof object.time !== "object") - throw TypeError(".cosmos.upgrade.v1beta1.Plan.time: object expected"); - message.time = $root.google.protobuf.Timestamp.fromObject(object.time); - } - if (object.height != null) - if ($util.Long) - (message.height = $util.Long.fromValue(object.height)).unsigned = false; - else if (typeof object.height === "string") - message.height = parseInt(object.height, 10); - else if (typeof object.height === "number") - message.height = object.height; - else if (typeof object.height === "object") - message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); - if (object.info != null) - message.info = String(object.info); - if (object.upgraded_client_state != null) { - if (typeof object.upgraded_client_state !== "object") - throw TypeError(".cosmos.upgrade.v1beta1.Plan.upgraded_client_state: object expected"); - message.upgraded_client_state = $root.google.protobuf.Any.fromObject(object.upgraded_client_state); - } - return message; - }; - - /** - * Creates a plain object from a Plan message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.upgrade.v1beta1.Plan - * @static - * @param {cosmos.upgrade.v1beta1.Plan} message Plan - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Plan.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.name = ""; - object.time = null; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.height = options.longs === String ? "0" : 0; - object.info = ""; - object.upgraded_client_state = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.time != null && message.hasOwnProperty("time")) - object.time = $root.google.protobuf.Timestamp.toObject(message.time, options); - if (message.height != null && message.hasOwnProperty("height")) - if (typeof message.height === "number") - object.height = options.longs === String ? String(message.height) : message.height; - else - object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; - if (message.info != null && message.hasOwnProperty("info")) - object.info = message.info; - if (message.upgraded_client_state != null && message.hasOwnProperty("upgraded_client_state")) - object.upgraded_client_state = $root.google.protobuf.Any.toObject(message.upgraded_client_state, options); - return object; - }; - - /** - * Converts this Plan to JSON. - * @function toJSON - * @memberof cosmos.upgrade.v1beta1.Plan - * @instance - * @returns {Object.} JSON object - */ - Plan.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Plan; - })(); - - v1beta1.SoftwareUpgradeProposal = (function() { - - /** - * Properties of a SoftwareUpgradeProposal. - * @memberof cosmos.upgrade.v1beta1 - * @interface ISoftwareUpgradeProposal - * @property {string|null} [title] SoftwareUpgradeProposal title - * @property {string|null} [description] SoftwareUpgradeProposal description - * @property {cosmos.upgrade.v1beta1.IPlan|null} [plan] SoftwareUpgradeProposal plan - */ - - /** - * Constructs a new SoftwareUpgradeProposal. - * @memberof cosmos.upgrade.v1beta1 - * @classdesc Represents a SoftwareUpgradeProposal. - * @implements ISoftwareUpgradeProposal - * @constructor - * @param {cosmos.upgrade.v1beta1.ISoftwareUpgradeProposal=} [properties] Properties to set - */ - function SoftwareUpgradeProposal(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SoftwareUpgradeProposal title. - * @member {string} title - * @memberof cosmos.upgrade.v1beta1.SoftwareUpgradeProposal - * @instance - */ - SoftwareUpgradeProposal.prototype.title = ""; - - /** - * SoftwareUpgradeProposal description. - * @member {string} description - * @memberof cosmos.upgrade.v1beta1.SoftwareUpgradeProposal - * @instance - */ - SoftwareUpgradeProposal.prototype.description = ""; - - /** - * SoftwareUpgradeProposal plan. - * @member {cosmos.upgrade.v1beta1.IPlan|null|undefined} plan - * @memberof cosmos.upgrade.v1beta1.SoftwareUpgradeProposal - * @instance - */ - SoftwareUpgradeProposal.prototype.plan = null; - - /** - * Encodes the specified SoftwareUpgradeProposal message. Does not implicitly {@link cosmos.upgrade.v1beta1.SoftwareUpgradeProposal.verify|verify} messages. - * @function encode - * @memberof cosmos.upgrade.v1beta1.SoftwareUpgradeProposal - * @static - * @param {cosmos.upgrade.v1beta1.ISoftwareUpgradeProposal} message SoftwareUpgradeProposal message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SoftwareUpgradeProposal.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.title != null && Object.hasOwnProperty.call(message, "title")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); - if (message.plan != null && Object.hasOwnProperty.call(message, "plan")) - $root.cosmos.upgrade.v1beta1.Plan.encode(message.plan, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SoftwareUpgradeProposal message, length delimited. Does not implicitly {@link cosmos.upgrade.v1beta1.SoftwareUpgradeProposal.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.upgrade.v1beta1.SoftwareUpgradeProposal - * @static - * @param {cosmos.upgrade.v1beta1.ISoftwareUpgradeProposal} message SoftwareUpgradeProposal message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SoftwareUpgradeProposal.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SoftwareUpgradeProposal message from the specified reader or buffer. - * @function decode - * @memberof cosmos.upgrade.v1beta1.SoftwareUpgradeProposal - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.upgrade.v1beta1.SoftwareUpgradeProposal} SoftwareUpgradeProposal - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SoftwareUpgradeProposal.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.upgrade.v1beta1.SoftwareUpgradeProposal(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.title = reader.string(); - break; - case 2: - message.description = reader.string(); - break; - case 3: - message.plan = $root.cosmos.upgrade.v1beta1.Plan.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SoftwareUpgradeProposal message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.upgrade.v1beta1.SoftwareUpgradeProposal - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.upgrade.v1beta1.SoftwareUpgradeProposal} SoftwareUpgradeProposal - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SoftwareUpgradeProposal.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SoftwareUpgradeProposal message. - * @function verify - * @memberof cosmos.upgrade.v1beta1.SoftwareUpgradeProposal - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SoftwareUpgradeProposal.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.title != null && message.hasOwnProperty("title")) - if (!$util.isString(message.title)) - return "title: string expected"; - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - if (message.plan != null && message.hasOwnProperty("plan")) { - let error = $root.cosmos.upgrade.v1beta1.Plan.verify(message.plan); - if (error) - return "plan." + error; - } - return null; - }; - - /** - * Creates a SoftwareUpgradeProposal message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.upgrade.v1beta1.SoftwareUpgradeProposal - * @static - * @param {Object.} object Plain object - * @returns {cosmos.upgrade.v1beta1.SoftwareUpgradeProposal} SoftwareUpgradeProposal - */ - SoftwareUpgradeProposal.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.upgrade.v1beta1.SoftwareUpgradeProposal) - return object; - let message = new $root.cosmos.upgrade.v1beta1.SoftwareUpgradeProposal(); - if (object.title != null) - message.title = String(object.title); - if (object.description != null) - message.description = String(object.description); - if (object.plan != null) { - if (typeof object.plan !== "object") - throw TypeError(".cosmos.upgrade.v1beta1.SoftwareUpgradeProposal.plan: object expected"); - message.plan = $root.cosmos.upgrade.v1beta1.Plan.fromObject(object.plan); - } - return message; - }; - - /** - * Creates a plain object from a SoftwareUpgradeProposal message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.upgrade.v1beta1.SoftwareUpgradeProposal - * @static - * @param {cosmos.upgrade.v1beta1.SoftwareUpgradeProposal} message SoftwareUpgradeProposal - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SoftwareUpgradeProposal.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.title = ""; - object.description = ""; - object.plan = null; - } - if (message.title != null && message.hasOwnProperty("title")) - object.title = message.title; - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - if (message.plan != null && message.hasOwnProperty("plan")) - object.plan = $root.cosmos.upgrade.v1beta1.Plan.toObject(message.plan, options); - return object; - }; - - /** - * Converts this SoftwareUpgradeProposal to JSON. - * @function toJSON - * @memberof cosmos.upgrade.v1beta1.SoftwareUpgradeProposal - * @instance - * @returns {Object.} JSON object - */ - SoftwareUpgradeProposal.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return SoftwareUpgradeProposal; - })(); - - v1beta1.CancelSoftwareUpgradeProposal = (function() { - - /** - * Properties of a CancelSoftwareUpgradeProposal. - * @memberof cosmos.upgrade.v1beta1 - * @interface ICancelSoftwareUpgradeProposal - * @property {string|null} [title] CancelSoftwareUpgradeProposal title - * @property {string|null} [description] CancelSoftwareUpgradeProposal description - */ - - /** - * Constructs a new CancelSoftwareUpgradeProposal. - * @memberof cosmos.upgrade.v1beta1 - * @classdesc Represents a CancelSoftwareUpgradeProposal. - * @implements ICancelSoftwareUpgradeProposal - * @constructor - * @param {cosmos.upgrade.v1beta1.ICancelSoftwareUpgradeProposal=} [properties] Properties to set - */ - function CancelSoftwareUpgradeProposal(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * CancelSoftwareUpgradeProposal title. - * @member {string} title - * @memberof cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal - * @instance - */ - CancelSoftwareUpgradeProposal.prototype.title = ""; - - /** - * CancelSoftwareUpgradeProposal description. - * @member {string} description - * @memberof cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal - * @instance - */ - CancelSoftwareUpgradeProposal.prototype.description = ""; - - /** - * Encodes the specified CancelSoftwareUpgradeProposal message. Does not implicitly {@link cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal.verify|verify} messages. - * @function encode - * @memberof cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal - * @static - * @param {cosmos.upgrade.v1beta1.ICancelSoftwareUpgradeProposal} message CancelSoftwareUpgradeProposal message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CancelSoftwareUpgradeProposal.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.title != null && Object.hasOwnProperty.call(message, "title")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); - return writer; - }; - - /** - * Encodes the specified CancelSoftwareUpgradeProposal message, length delimited. Does not implicitly {@link cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal - * @static - * @param {cosmos.upgrade.v1beta1.ICancelSoftwareUpgradeProposal} message CancelSoftwareUpgradeProposal message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CancelSoftwareUpgradeProposal.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CancelSoftwareUpgradeProposal message from the specified reader or buffer. - * @function decode - * @memberof cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal} CancelSoftwareUpgradeProposal - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CancelSoftwareUpgradeProposal.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal(); - while (reader.pos < end) { - let 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; - }; - - /** - * Decodes a CancelSoftwareUpgradeProposal message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal} CancelSoftwareUpgradeProposal - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CancelSoftwareUpgradeProposal.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CancelSoftwareUpgradeProposal message. - * @function verify - * @memberof cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CancelSoftwareUpgradeProposal.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.title != null && message.hasOwnProperty("title")) - if (!$util.isString(message.title)) - return "title: string expected"; - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - return null; - }; - - /** - * Creates a CancelSoftwareUpgradeProposal message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal - * @static - * @param {Object.} object Plain object - * @returns {cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal} CancelSoftwareUpgradeProposal - */ - CancelSoftwareUpgradeProposal.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal) - return object; - let message = new $root.cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal(); - if (object.title != null) - message.title = String(object.title); - if (object.description != null) - message.description = String(object.description); - return message; - }; - - /** - * Creates a plain object from a CancelSoftwareUpgradeProposal message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal - * @static - * @param {cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal} message CancelSoftwareUpgradeProposal - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CancelSoftwareUpgradeProposal.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.title = ""; - object.description = ""; - } - if (message.title != null && message.hasOwnProperty("title")) - object.title = message.title; - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - return object; - }; - - /** - * Converts this CancelSoftwareUpgradeProposal to JSON. - * @function toJSON - * @memberof cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal - * @instance - * @returns {Object.} JSON object - */ - CancelSoftwareUpgradeProposal.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return CancelSoftwareUpgradeProposal; - })(); - - v1beta1.Query = (function() { - - /** - * Constructs a new Query service. - * @memberof cosmos.upgrade.v1beta1 - * @classdesc Represents a Query - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function Query(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Query.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Query; - - /** - * Callback as used by {@link cosmos.upgrade.v1beta1.Query#currentPlan}. - * @memberof cosmos.upgrade.v1beta1.Query - * @typedef CurrentPlanCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.upgrade.v1beta1.QueryCurrentPlanResponse} [response] QueryCurrentPlanResponse - */ - - /** - * Calls CurrentPlan. - * @function currentPlan - * @memberof cosmos.upgrade.v1beta1.Query - * @instance - * @param {cosmos.upgrade.v1beta1.IQueryCurrentPlanRequest} request QueryCurrentPlanRequest message or plain object - * @param {cosmos.upgrade.v1beta1.Query.CurrentPlanCallback} callback Node-style callback called with the error, if any, and QueryCurrentPlanResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.currentPlan = function currentPlan(request, callback) { - return this.rpcCall(currentPlan, $root.cosmos.upgrade.v1beta1.QueryCurrentPlanRequest, $root.cosmos.upgrade.v1beta1.QueryCurrentPlanResponse, request, callback); - }, "name", { value: "CurrentPlan" }); - - /** - * Calls CurrentPlan. - * @function currentPlan - * @memberof cosmos.upgrade.v1beta1.Query - * @instance - * @param {cosmos.upgrade.v1beta1.IQueryCurrentPlanRequest} request QueryCurrentPlanRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.upgrade.v1beta1.Query#appliedPlan}. - * @memberof cosmos.upgrade.v1beta1.Query - * @typedef AppliedPlanCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.upgrade.v1beta1.QueryAppliedPlanResponse} [response] QueryAppliedPlanResponse - */ - - /** - * Calls AppliedPlan. - * @function appliedPlan - * @memberof cosmos.upgrade.v1beta1.Query - * @instance - * @param {cosmos.upgrade.v1beta1.IQueryAppliedPlanRequest} request QueryAppliedPlanRequest message or plain object - * @param {cosmos.upgrade.v1beta1.Query.AppliedPlanCallback} callback Node-style callback called with the error, if any, and QueryAppliedPlanResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.appliedPlan = function appliedPlan(request, callback) { - return this.rpcCall(appliedPlan, $root.cosmos.upgrade.v1beta1.QueryAppliedPlanRequest, $root.cosmos.upgrade.v1beta1.QueryAppliedPlanResponse, request, callback); - }, "name", { value: "AppliedPlan" }); - - /** - * Calls AppliedPlan. - * @function appliedPlan - * @memberof cosmos.upgrade.v1beta1.Query - * @instance - * @param {cosmos.upgrade.v1beta1.IQueryAppliedPlanRequest} request QueryAppliedPlanRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link cosmos.upgrade.v1beta1.Query#upgradedConsensusState}. - * @memberof cosmos.upgrade.v1beta1.Query - * @typedef UpgradedConsensusStateCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse} [response] QueryUpgradedConsensusStateResponse - */ - - /** - * Calls UpgradedConsensusState. - * @function upgradedConsensusState - * @memberof cosmos.upgrade.v1beta1.Query - * @instance - * @param {cosmos.upgrade.v1beta1.IQueryUpgradedConsensusStateRequest} request QueryUpgradedConsensusStateRequest message or plain object - * @param {cosmos.upgrade.v1beta1.Query.UpgradedConsensusStateCallback} callback Node-style callback called with the error, if any, and QueryUpgradedConsensusStateResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.upgradedConsensusState = function upgradedConsensusState(request, callback) { - return this.rpcCall(upgradedConsensusState, $root.cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest, $root.cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse, request, callback); - }, "name", { value: "UpgradedConsensusState" }); - - /** - * Calls UpgradedConsensusState. - * @function upgradedConsensusState - * @memberof cosmos.upgrade.v1beta1.Query - * @instance - * @param {cosmos.upgrade.v1beta1.IQueryUpgradedConsensusStateRequest} request QueryUpgradedConsensusStateRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return Query; - })(); - - v1beta1.QueryCurrentPlanRequest = (function() { - - /** - * Properties of a QueryCurrentPlanRequest. - * @memberof cosmos.upgrade.v1beta1 - * @interface IQueryCurrentPlanRequest - */ - - /** - * Constructs a new QueryCurrentPlanRequest. - * @memberof cosmos.upgrade.v1beta1 - * @classdesc Represents a QueryCurrentPlanRequest. - * @implements IQueryCurrentPlanRequest - * @constructor - * @param {cosmos.upgrade.v1beta1.IQueryCurrentPlanRequest=} [properties] Properties to set - */ - function QueryCurrentPlanRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified QueryCurrentPlanRequest message. Does not implicitly {@link cosmos.upgrade.v1beta1.QueryCurrentPlanRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanRequest - * @static - * @param {cosmos.upgrade.v1beta1.IQueryCurrentPlanRequest} message QueryCurrentPlanRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryCurrentPlanRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified QueryCurrentPlanRequest message, length delimited. Does not implicitly {@link cosmos.upgrade.v1beta1.QueryCurrentPlanRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanRequest - * @static - * @param {cosmos.upgrade.v1beta1.IQueryCurrentPlanRequest} message QueryCurrentPlanRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryCurrentPlanRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryCurrentPlanRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.upgrade.v1beta1.QueryCurrentPlanRequest} QueryCurrentPlanRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryCurrentPlanRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.upgrade.v1beta1.QueryCurrentPlanRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryCurrentPlanRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.upgrade.v1beta1.QueryCurrentPlanRequest} QueryCurrentPlanRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryCurrentPlanRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryCurrentPlanRequest message. - * @function verify - * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryCurrentPlanRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a QueryCurrentPlanRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.upgrade.v1beta1.QueryCurrentPlanRequest} QueryCurrentPlanRequest - */ - QueryCurrentPlanRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.upgrade.v1beta1.QueryCurrentPlanRequest) - return object; - return new $root.cosmos.upgrade.v1beta1.QueryCurrentPlanRequest(); - }; - - /** - * Creates a plain object from a QueryCurrentPlanRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanRequest - * @static - * @param {cosmos.upgrade.v1beta1.QueryCurrentPlanRequest} message QueryCurrentPlanRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryCurrentPlanRequest.toObject = function toObject() { - return {}; - }; - - /** - * Converts this QueryCurrentPlanRequest to JSON. - * @function toJSON - * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanRequest - * @instance - * @returns {Object.} JSON object - */ - QueryCurrentPlanRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryCurrentPlanRequest; - })(); - - v1beta1.QueryCurrentPlanResponse = (function() { - - /** - * Properties of a QueryCurrentPlanResponse. - * @memberof cosmos.upgrade.v1beta1 - * @interface IQueryCurrentPlanResponse - * @property {cosmos.upgrade.v1beta1.IPlan|null} [plan] QueryCurrentPlanResponse plan - */ - - /** - * Constructs a new QueryCurrentPlanResponse. - * @memberof cosmos.upgrade.v1beta1 - * @classdesc Represents a QueryCurrentPlanResponse. - * @implements IQueryCurrentPlanResponse - * @constructor - * @param {cosmos.upgrade.v1beta1.IQueryCurrentPlanResponse=} [properties] Properties to set - */ - function QueryCurrentPlanResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryCurrentPlanResponse plan. - * @member {cosmos.upgrade.v1beta1.IPlan|null|undefined} plan - * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanResponse - * @instance - */ - QueryCurrentPlanResponse.prototype.plan = null; - - /** - * Encodes the specified QueryCurrentPlanResponse message. Does not implicitly {@link cosmos.upgrade.v1beta1.QueryCurrentPlanResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanResponse - * @static - * @param {cosmos.upgrade.v1beta1.IQueryCurrentPlanResponse} message QueryCurrentPlanResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryCurrentPlanResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.plan != null && Object.hasOwnProperty.call(message, "plan")) - $root.cosmos.upgrade.v1beta1.Plan.encode(message.plan, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryCurrentPlanResponse message, length delimited. Does not implicitly {@link cosmos.upgrade.v1beta1.QueryCurrentPlanResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanResponse - * @static - * @param {cosmos.upgrade.v1beta1.IQueryCurrentPlanResponse} message QueryCurrentPlanResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryCurrentPlanResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryCurrentPlanResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.upgrade.v1beta1.QueryCurrentPlanResponse} QueryCurrentPlanResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryCurrentPlanResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.upgrade.v1beta1.QueryCurrentPlanResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.plan = $root.cosmos.upgrade.v1beta1.Plan.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryCurrentPlanResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.upgrade.v1beta1.QueryCurrentPlanResponse} QueryCurrentPlanResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryCurrentPlanResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryCurrentPlanResponse message. - * @function verify - * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryCurrentPlanResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.plan != null && message.hasOwnProperty("plan")) { - let error = $root.cosmos.upgrade.v1beta1.Plan.verify(message.plan); - if (error) - return "plan." + error; - } - return null; - }; - - /** - * Creates a QueryCurrentPlanResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.upgrade.v1beta1.QueryCurrentPlanResponse} QueryCurrentPlanResponse - */ - QueryCurrentPlanResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.upgrade.v1beta1.QueryCurrentPlanResponse) - return object; - let message = new $root.cosmos.upgrade.v1beta1.QueryCurrentPlanResponse(); - if (object.plan != null) { - if (typeof object.plan !== "object") - throw TypeError(".cosmos.upgrade.v1beta1.QueryCurrentPlanResponse.plan: object expected"); - message.plan = $root.cosmos.upgrade.v1beta1.Plan.fromObject(object.plan); - } - return message; - }; - - /** - * Creates a plain object from a QueryCurrentPlanResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanResponse - * @static - * @param {cosmos.upgrade.v1beta1.QueryCurrentPlanResponse} message QueryCurrentPlanResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryCurrentPlanResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.plan = null; - if (message.plan != null && message.hasOwnProperty("plan")) - object.plan = $root.cosmos.upgrade.v1beta1.Plan.toObject(message.plan, options); - return object; - }; - - /** - * Converts this QueryCurrentPlanResponse to JSON. - * @function toJSON - * @memberof cosmos.upgrade.v1beta1.QueryCurrentPlanResponse - * @instance - * @returns {Object.} JSON object - */ - QueryCurrentPlanResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryCurrentPlanResponse; - })(); - - v1beta1.QueryAppliedPlanRequest = (function() { - - /** - * Properties of a QueryAppliedPlanRequest. - * @memberof cosmos.upgrade.v1beta1 - * @interface IQueryAppliedPlanRequest - * @property {string|null} [name] QueryAppliedPlanRequest name - */ - - /** - * Constructs a new QueryAppliedPlanRequest. - * @memberof cosmos.upgrade.v1beta1 - * @classdesc Represents a QueryAppliedPlanRequest. - * @implements IQueryAppliedPlanRequest - * @constructor - * @param {cosmos.upgrade.v1beta1.IQueryAppliedPlanRequest=} [properties] Properties to set - */ - function QueryAppliedPlanRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryAppliedPlanRequest name. - * @member {string} name - * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanRequest - * @instance - */ - QueryAppliedPlanRequest.prototype.name = ""; - - /** - * Encodes the specified QueryAppliedPlanRequest message. Does not implicitly {@link cosmos.upgrade.v1beta1.QueryAppliedPlanRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanRequest - * @static - * @param {cosmos.upgrade.v1beta1.IQueryAppliedPlanRequest} message QueryAppliedPlanRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryAppliedPlanRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified QueryAppliedPlanRequest message, length delimited. Does not implicitly {@link cosmos.upgrade.v1beta1.QueryAppliedPlanRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanRequest - * @static - * @param {cosmos.upgrade.v1beta1.IQueryAppliedPlanRequest} message QueryAppliedPlanRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryAppliedPlanRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryAppliedPlanRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.upgrade.v1beta1.QueryAppliedPlanRequest} QueryAppliedPlanRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryAppliedPlanRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.upgrade.v1beta1.QueryAppliedPlanRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryAppliedPlanRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.upgrade.v1beta1.QueryAppliedPlanRequest} QueryAppliedPlanRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryAppliedPlanRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryAppliedPlanRequest message. - * @function verify - * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryAppliedPlanRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a QueryAppliedPlanRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.upgrade.v1beta1.QueryAppliedPlanRequest} QueryAppliedPlanRequest - */ - QueryAppliedPlanRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.upgrade.v1beta1.QueryAppliedPlanRequest) - return object; - let message = new $root.cosmos.upgrade.v1beta1.QueryAppliedPlanRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a QueryAppliedPlanRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanRequest - * @static - * @param {cosmos.upgrade.v1beta1.QueryAppliedPlanRequest} message QueryAppliedPlanRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryAppliedPlanRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this QueryAppliedPlanRequest to JSON. - * @function toJSON - * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanRequest - * @instance - * @returns {Object.} JSON object - */ - QueryAppliedPlanRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryAppliedPlanRequest; - })(); - - v1beta1.QueryAppliedPlanResponse = (function() { - - /** - * Properties of a QueryAppliedPlanResponse. - * @memberof cosmos.upgrade.v1beta1 - * @interface IQueryAppliedPlanResponse - * @property {Long|null} [height] QueryAppliedPlanResponse height - */ - - /** - * Constructs a new QueryAppliedPlanResponse. - * @memberof cosmos.upgrade.v1beta1 - * @classdesc Represents a QueryAppliedPlanResponse. - * @implements IQueryAppliedPlanResponse - * @constructor - * @param {cosmos.upgrade.v1beta1.IQueryAppliedPlanResponse=} [properties] Properties to set - */ - function QueryAppliedPlanResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryAppliedPlanResponse height. - * @member {Long} height - * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanResponse - * @instance - */ - QueryAppliedPlanResponse.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Encodes the specified QueryAppliedPlanResponse message. Does not implicitly {@link cosmos.upgrade.v1beta1.QueryAppliedPlanResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanResponse - * @static - * @param {cosmos.upgrade.v1beta1.IQueryAppliedPlanResponse} message QueryAppliedPlanResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryAppliedPlanResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.height); - return writer; - }; - - /** - * Encodes the specified QueryAppliedPlanResponse message, length delimited. Does not implicitly {@link cosmos.upgrade.v1beta1.QueryAppliedPlanResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanResponse - * @static - * @param {cosmos.upgrade.v1beta1.IQueryAppliedPlanResponse} message QueryAppliedPlanResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryAppliedPlanResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryAppliedPlanResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.upgrade.v1beta1.QueryAppliedPlanResponse} QueryAppliedPlanResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryAppliedPlanResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.upgrade.v1beta1.QueryAppliedPlanResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.height = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryAppliedPlanResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.upgrade.v1beta1.QueryAppliedPlanResponse} QueryAppliedPlanResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryAppliedPlanResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryAppliedPlanResponse message. - * @function verify - * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryAppliedPlanResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) - return "height: integer|Long expected"; - return null; - }; - - /** - * Creates a QueryAppliedPlanResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.upgrade.v1beta1.QueryAppliedPlanResponse} QueryAppliedPlanResponse - */ - QueryAppliedPlanResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.upgrade.v1beta1.QueryAppliedPlanResponse) - return object; - let message = new $root.cosmos.upgrade.v1beta1.QueryAppliedPlanResponse(); - if (object.height != null) - if ($util.Long) - (message.height = $util.Long.fromValue(object.height)).unsigned = false; - else if (typeof object.height === "string") - message.height = parseInt(object.height, 10); - else if (typeof object.height === "number") - message.height = object.height; - else if (typeof object.height === "object") - message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a QueryAppliedPlanResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanResponse - * @static - * @param {cosmos.upgrade.v1beta1.QueryAppliedPlanResponse} message QueryAppliedPlanResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryAppliedPlanResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.height = options.longs === String ? "0" : 0; - if (message.height != null && message.hasOwnProperty("height")) - if (typeof message.height === "number") - object.height = options.longs === String ? String(message.height) : message.height; - else - object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; - return object; - }; - - /** - * Converts this QueryAppliedPlanResponse to JSON. - * @function toJSON - * @memberof cosmos.upgrade.v1beta1.QueryAppliedPlanResponse - * @instance - * @returns {Object.} JSON object - */ - QueryAppliedPlanResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryAppliedPlanResponse; - })(); - - v1beta1.QueryUpgradedConsensusStateRequest = (function() { - - /** - * Properties of a QueryUpgradedConsensusStateRequest. - * @memberof cosmos.upgrade.v1beta1 - * @interface IQueryUpgradedConsensusStateRequest - * @property {Long|null} [last_height] QueryUpgradedConsensusStateRequest last_height - */ - - /** - * Constructs a new QueryUpgradedConsensusStateRequest. - * @memberof cosmos.upgrade.v1beta1 - * @classdesc Represents a QueryUpgradedConsensusStateRequest. - * @implements IQueryUpgradedConsensusStateRequest - * @constructor - * @param {cosmos.upgrade.v1beta1.IQueryUpgradedConsensusStateRequest=} [properties] Properties to set - */ - function QueryUpgradedConsensusStateRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryUpgradedConsensusStateRequest last_height. - * @member {Long} last_height - * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest - * @instance - */ - QueryUpgradedConsensusStateRequest.prototype.last_height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Encodes the specified QueryUpgradedConsensusStateRequest message. Does not implicitly {@link cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest.verify|verify} messages. - * @function encode - * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest - * @static - * @param {cosmos.upgrade.v1beta1.IQueryUpgradedConsensusStateRequest} message QueryUpgradedConsensusStateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryUpgradedConsensusStateRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.last_height != null && Object.hasOwnProperty.call(message, "last_height")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.last_height); - return writer; - }; - - /** - * Encodes the specified QueryUpgradedConsensusStateRequest message, length delimited. Does not implicitly {@link cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest - * @static - * @param {cosmos.upgrade.v1beta1.IQueryUpgradedConsensusStateRequest} message QueryUpgradedConsensusStateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryUpgradedConsensusStateRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryUpgradedConsensusStateRequest message from the specified reader or buffer. - * @function decode - * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest} QueryUpgradedConsensusStateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryUpgradedConsensusStateRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.last_height = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryUpgradedConsensusStateRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest} QueryUpgradedConsensusStateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryUpgradedConsensusStateRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryUpgradedConsensusStateRequest message. - * @function verify - * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryUpgradedConsensusStateRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.last_height != null && message.hasOwnProperty("last_height")) - if (!$util.isInteger(message.last_height) && !(message.last_height && $util.isInteger(message.last_height.low) && $util.isInteger(message.last_height.high))) - return "last_height: integer|Long expected"; - return null; - }; - - /** - * Creates a QueryUpgradedConsensusStateRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest - * @static - * @param {Object.} object Plain object - * @returns {cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest} QueryUpgradedConsensusStateRequest - */ - QueryUpgradedConsensusStateRequest.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest) - return object; - let message = new $root.cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest(); - if (object.last_height != null) - if ($util.Long) - (message.last_height = $util.Long.fromValue(object.last_height)).unsigned = false; - else if (typeof object.last_height === "string") - message.last_height = parseInt(object.last_height, 10); - else if (typeof object.last_height === "number") - message.last_height = object.last_height; - else if (typeof object.last_height === "object") - message.last_height = new $util.LongBits(object.last_height.low >>> 0, object.last_height.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a QueryUpgradedConsensusStateRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest - * @static - * @param {cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest} message QueryUpgradedConsensusStateRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryUpgradedConsensusStateRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.last_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.last_height = options.longs === String ? "0" : 0; - if (message.last_height != null && message.hasOwnProperty("last_height")) - if (typeof message.last_height === "number") - object.last_height = options.longs === String ? String(message.last_height) : message.last_height; - else - object.last_height = options.longs === String ? $util.Long.prototype.toString.call(message.last_height) : options.longs === Number ? new $util.LongBits(message.last_height.low >>> 0, message.last_height.high >>> 0).toNumber() : message.last_height; - return object; - }; - - /** - * Converts this QueryUpgradedConsensusStateRequest to JSON. - * @function toJSON - * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest - * @instance - * @returns {Object.} JSON object - */ - QueryUpgradedConsensusStateRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryUpgradedConsensusStateRequest; - })(); - - v1beta1.QueryUpgradedConsensusStateResponse = (function() { - - /** - * Properties of a QueryUpgradedConsensusStateResponse. - * @memberof cosmos.upgrade.v1beta1 - * @interface IQueryUpgradedConsensusStateResponse - * @property {google.protobuf.IAny|null} [upgraded_consensus_state] QueryUpgradedConsensusStateResponse upgraded_consensus_state - */ - - /** - * Constructs a new QueryUpgradedConsensusStateResponse. - * @memberof cosmos.upgrade.v1beta1 - * @classdesc Represents a QueryUpgradedConsensusStateResponse. - * @implements IQueryUpgradedConsensusStateResponse - * @constructor - * @param {cosmos.upgrade.v1beta1.IQueryUpgradedConsensusStateResponse=} [properties] Properties to set - */ - function QueryUpgradedConsensusStateResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryUpgradedConsensusStateResponse upgraded_consensus_state. - * @member {google.protobuf.IAny|null|undefined} upgraded_consensus_state - * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse - * @instance - */ - QueryUpgradedConsensusStateResponse.prototype.upgraded_consensus_state = null; - - /** - * Encodes the specified QueryUpgradedConsensusStateResponse message. Does not implicitly {@link cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse - * @static - * @param {cosmos.upgrade.v1beta1.IQueryUpgradedConsensusStateResponse} message QueryUpgradedConsensusStateResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryUpgradedConsensusStateResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.upgraded_consensus_state != null && Object.hasOwnProperty.call(message, "upgraded_consensus_state")) - $root.google.protobuf.Any.encode(message.upgraded_consensus_state, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryUpgradedConsensusStateResponse message, length delimited. Does not implicitly {@link cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse - * @static - * @param {cosmos.upgrade.v1beta1.IQueryUpgradedConsensusStateResponse} message QueryUpgradedConsensusStateResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryUpgradedConsensusStateResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryUpgradedConsensusStateResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse} QueryUpgradedConsensusStateResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryUpgradedConsensusStateResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.upgraded_consensus_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryUpgradedConsensusStateResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse} QueryUpgradedConsensusStateResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryUpgradedConsensusStateResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryUpgradedConsensusStateResponse message. - * @function verify - * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryUpgradedConsensusStateResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.upgraded_consensus_state != null && message.hasOwnProperty("upgraded_consensus_state")) { - let error = $root.google.protobuf.Any.verify(message.upgraded_consensus_state); - if (error) - return "upgraded_consensus_state." + error; - } - return null; - }; - - /** - * Creates a QueryUpgradedConsensusStateResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse} QueryUpgradedConsensusStateResponse - */ - QueryUpgradedConsensusStateResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse) - return object; - let message = new $root.cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse(); - if (object.upgraded_consensus_state != null) { - if (typeof object.upgraded_consensus_state !== "object") - throw TypeError(".cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse.upgraded_consensus_state: object expected"); - message.upgraded_consensus_state = $root.google.protobuf.Any.fromObject(object.upgraded_consensus_state); - } - return message; - }; - - /** - * Creates a plain object from a QueryUpgradedConsensusStateResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse - * @static - * @param {cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse} message QueryUpgradedConsensusStateResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryUpgradedConsensusStateResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.upgraded_consensus_state = null; - if (message.upgraded_consensus_state != null && message.hasOwnProperty("upgraded_consensus_state")) - object.upgraded_consensus_state = $root.google.protobuf.Any.toObject(message.upgraded_consensus_state, options); - return object; - }; - - /** - * Converts this QueryUpgradedConsensusStateResponse to JSON. - * @function toJSON - * @memberof cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse - * @instance - * @returns {Object.} JSON object - */ - QueryUpgradedConsensusStateResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryUpgradedConsensusStateResponse; - })(); - - return v1beta1; - })(); - - return upgrade; - })(); - - cosmos.vesting = (function() { - - /** - * Namespace vesting. - * @memberof cosmos - * @namespace - */ - const vesting = {}; - - vesting.v1beta1 = (function() { - - /** - * Namespace v1beta1. - * @memberof cosmos.vesting - * @namespace - */ - const v1beta1 = {}; - - v1beta1.Msg = (function() { - - /** - * Constructs a new Msg service. - * @memberof cosmos.vesting.v1beta1 - * @classdesc Represents a Msg - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function Msg(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Msg.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Msg; - - /** - * Callback as used by {@link cosmos.vesting.v1beta1.Msg#createVestingAccount}. - * @memberof cosmos.vesting.v1beta1.Msg - * @typedef CreateVestingAccountCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse} [response] MsgCreateVestingAccountResponse - */ - - /** - * Calls CreateVestingAccount. - * @function createVestingAccount - * @memberof cosmos.vesting.v1beta1.Msg - * @instance - * @param {cosmos.vesting.v1beta1.IMsgCreateVestingAccount} request MsgCreateVestingAccount message or plain object - * @param {cosmos.vesting.v1beta1.Msg.CreateVestingAccountCallback} callback Node-style callback called with the error, if any, and MsgCreateVestingAccountResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.createVestingAccount = function createVestingAccount(request, callback) { - return this.rpcCall(createVestingAccount, $root.cosmos.vesting.v1beta1.MsgCreateVestingAccount, $root.cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse, request, callback); - }, "name", { value: "CreateVestingAccount" }); - - /** - * Calls CreateVestingAccount. - * @function createVestingAccount - * @memberof cosmos.vesting.v1beta1.Msg - * @instance - * @param {cosmos.vesting.v1beta1.IMsgCreateVestingAccount} request MsgCreateVestingAccount message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return Msg; - })(); - - v1beta1.MsgCreateVestingAccount = (function() { - - /** - * Properties of a MsgCreateVestingAccount. - * @memberof cosmos.vesting.v1beta1 - * @interface IMsgCreateVestingAccount - * @property {string|null} [from_address] MsgCreateVestingAccount from_address - * @property {string|null} [to_address] MsgCreateVestingAccount to_address - * @property {Array.|null} [amount] MsgCreateVestingAccount amount - * @property {Long|null} [end_time] MsgCreateVestingAccount end_time - * @property {boolean|null} [delayed] MsgCreateVestingAccount delayed - */ - - /** - * Constructs a new MsgCreateVestingAccount. - * @memberof cosmos.vesting.v1beta1 - * @classdesc Represents a MsgCreateVestingAccount. - * @implements IMsgCreateVestingAccount - * @constructor - * @param {cosmos.vesting.v1beta1.IMsgCreateVestingAccount=} [properties] Properties to set - */ - function MsgCreateVestingAccount(properties) { - this.amount = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgCreateVestingAccount from_address. - * @member {string} from_address - * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccount - * @instance - */ - MsgCreateVestingAccount.prototype.from_address = ""; - - /** - * MsgCreateVestingAccount to_address. - * @member {string} to_address - * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccount - * @instance - */ - MsgCreateVestingAccount.prototype.to_address = ""; - - /** - * MsgCreateVestingAccount amount. - * @member {Array.} amount - * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccount - * @instance - */ - MsgCreateVestingAccount.prototype.amount = $util.emptyArray; - - /** - * MsgCreateVestingAccount end_time. - * @member {Long} end_time - * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccount - * @instance - */ - MsgCreateVestingAccount.prototype.end_time = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * MsgCreateVestingAccount delayed. - * @member {boolean} delayed - * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccount - * @instance - */ - MsgCreateVestingAccount.prototype.delayed = false; - - /** - * Encodes the specified MsgCreateVestingAccount message. Does not implicitly {@link cosmos.vesting.v1beta1.MsgCreateVestingAccount.verify|verify} messages. - * @function encode - * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccount - * @static - * @param {cosmos.vesting.v1beta1.IMsgCreateVestingAccount} message MsgCreateVestingAccount message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgCreateVestingAccount.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.from_address != null && Object.hasOwnProperty.call(message, "from_address")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.from_address); - if (message.to_address != null && Object.hasOwnProperty.call(message, "to_address")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.to_address); - if (message.amount != null && message.amount.length) - for (let i = 0; i < message.amount.length; ++i) - $root.cosmos.base.v1beta1.Coin.encode(message.amount[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.end_time != null && Object.hasOwnProperty.call(message, "end_time")) - writer.uint32(/* id 4, wireType 0 =*/32).int64(message.end_time); - if (message.delayed != null && Object.hasOwnProperty.call(message, "delayed")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.delayed); - return writer; - }; - - /** - * Encodes the specified MsgCreateVestingAccount message, length delimited. Does not implicitly {@link cosmos.vesting.v1beta1.MsgCreateVestingAccount.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccount - * @static - * @param {cosmos.vesting.v1beta1.IMsgCreateVestingAccount} message MsgCreateVestingAccount message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgCreateVestingAccount.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgCreateVestingAccount message from the specified reader or buffer. - * @function decode - * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccount - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.vesting.v1beta1.MsgCreateVestingAccount} MsgCreateVestingAccount - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgCreateVestingAccount.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.vesting.v1beta1.MsgCreateVestingAccount(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.from_address = reader.string(); - break; - case 2: - message.to_address = reader.string(); - break; - case 3: - if (!(message.amount && message.amount.length)) - message.amount = []; - message.amount.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); - break; - case 4: - message.end_time = reader.int64(); - break; - case 5: - message.delayed = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgCreateVestingAccount message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccount - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.vesting.v1beta1.MsgCreateVestingAccount} MsgCreateVestingAccount - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgCreateVestingAccount.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgCreateVestingAccount message. - * @function verify - * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccount - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgCreateVestingAccount.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.from_address != null && message.hasOwnProperty("from_address")) - if (!$util.isString(message.from_address)) - return "from_address: string expected"; - if (message.to_address != null && message.hasOwnProperty("to_address")) - if (!$util.isString(message.to_address)) - return "to_address: string expected"; - if (message.amount != null && message.hasOwnProperty("amount")) { - if (!Array.isArray(message.amount)) - return "amount: array expected"; - for (let i = 0; i < message.amount.length; ++i) { - let error = $root.cosmos.base.v1beta1.Coin.verify(message.amount[i]); - if (error) - return "amount." + error; - } - } - if (message.end_time != null && message.hasOwnProperty("end_time")) - if (!$util.isInteger(message.end_time) && !(message.end_time && $util.isInteger(message.end_time.low) && $util.isInteger(message.end_time.high))) - return "end_time: integer|Long expected"; - if (message.delayed != null && message.hasOwnProperty("delayed")) - if (typeof message.delayed !== "boolean") - return "delayed: boolean expected"; - return null; - }; - - /** - * Creates a MsgCreateVestingAccount message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccount - * @static - * @param {Object.} object Plain object - * @returns {cosmos.vesting.v1beta1.MsgCreateVestingAccount} MsgCreateVestingAccount - */ - MsgCreateVestingAccount.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.vesting.v1beta1.MsgCreateVestingAccount) - return object; - let message = new $root.cosmos.vesting.v1beta1.MsgCreateVestingAccount(); - if (object.from_address != null) - message.from_address = String(object.from_address); - if (object.to_address != null) - message.to_address = String(object.to_address); - if (object.amount) { - if (!Array.isArray(object.amount)) - throw TypeError(".cosmos.vesting.v1beta1.MsgCreateVestingAccount.amount: array expected"); - message.amount = []; - for (let i = 0; i < object.amount.length; ++i) { - if (typeof object.amount[i] !== "object") - throw TypeError(".cosmos.vesting.v1beta1.MsgCreateVestingAccount.amount: object expected"); - message.amount[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.amount[i]); - } - } - if (object.end_time != null) - if ($util.Long) - (message.end_time = $util.Long.fromValue(object.end_time)).unsigned = false; - else if (typeof object.end_time === "string") - message.end_time = parseInt(object.end_time, 10); - else if (typeof object.end_time === "number") - message.end_time = object.end_time; - else if (typeof object.end_time === "object") - message.end_time = new $util.LongBits(object.end_time.low >>> 0, object.end_time.high >>> 0).toNumber(); - if (object.delayed != null) - message.delayed = Boolean(object.delayed); - return message; - }; - - /** - * Creates a plain object from a MsgCreateVestingAccount message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccount - * @static - * @param {cosmos.vesting.v1beta1.MsgCreateVestingAccount} message MsgCreateVestingAccount - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgCreateVestingAccount.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.amount = []; - if (options.defaults) { - object.from_address = ""; - object.to_address = ""; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.end_time = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.end_time = options.longs === String ? "0" : 0; - object.delayed = false; - } - if (message.from_address != null && message.hasOwnProperty("from_address")) - object.from_address = message.from_address; - if (message.to_address != null && message.hasOwnProperty("to_address")) - object.to_address = message.to_address; - if (message.amount && message.amount.length) { - object.amount = []; - for (let j = 0; j < message.amount.length; ++j) - object.amount[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.amount[j], options); - } - if (message.end_time != null && message.hasOwnProperty("end_time")) - if (typeof message.end_time === "number") - object.end_time = options.longs === String ? String(message.end_time) : message.end_time; - else - object.end_time = options.longs === String ? $util.Long.prototype.toString.call(message.end_time) : options.longs === Number ? new $util.LongBits(message.end_time.low >>> 0, message.end_time.high >>> 0).toNumber() : message.end_time; - if (message.delayed != null && message.hasOwnProperty("delayed")) - object.delayed = message.delayed; - return object; - }; - - /** - * Converts this MsgCreateVestingAccount to JSON. - * @function toJSON - * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccount - * @instance - * @returns {Object.} JSON object - */ - MsgCreateVestingAccount.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgCreateVestingAccount; - })(); - - v1beta1.MsgCreateVestingAccountResponse = (function() { - - /** - * Properties of a MsgCreateVestingAccountResponse. - * @memberof cosmos.vesting.v1beta1 - * @interface IMsgCreateVestingAccountResponse - */ - - /** - * Constructs a new MsgCreateVestingAccountResponse. - * @memberof cosmos.vesting.v1beta1 - * @classdesc Represents a MsgCreateVestingAccountResponse. - * @implements IMsgCreateVestingAccountResponse - * @constructor - * @param {cosmos.vesting.v1beta1.IMsgCreateVestingAccountResponse=} [properties] Properties to set - */ - function MsgCreateVestingAccountResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgCreateVestingAccountResponse message. Does not implicitly {@link cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse.verify|verify} messages. - * @function encode - * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse - * @static - * @param {cosmos.vesting.v1beta1.IMsgCreateVestingAccountResponse} message MsgCreateVestingAccountResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgCreateVestingAccountResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgCreateVestingAccountResponse message, length delimited. Does not implicitly {@link cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse - * @static - * @param {cosmos.vesting.v1beta1.IMsgCreateVestingAccountResponse} message MsgCreateVestingAccountResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgCreateVestingAccountResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgCreateVestingAccountResponse message from the specified reader or buffer. - * @function decode - * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse} MsgCreateVestingAccountResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgCreateVestingAccountResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgCreateVestingAccountResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse} MsgCreateVestingAccountResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgCreateVestingAccountResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgCreateVestingAccountResponse message. - * @function verify - * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgCreateVestingAccountResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgCreateVestingAccountResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse - * @static - * @param {Object.} object Plain object - * @returns {cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse} MsgCreateVestingAccountResponse - */ - MsgCreateVestingAccountResponse.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse) - return object; - return new $root.cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse(); - }; - - /** - * Creates a plain object from a MsgCreateVestingAccountResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse - * @static - * @param {cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse} message MsgCreateVestingAccountResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgCreateVestingAccountResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgCreateVestingAccountResponse to JSON. - * @function toJSON - * @memberof cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse - * @instance - * @returns {Object.} JSON object - */ - MsgCreateVestingAccountResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgCreateVestingAccountResponse; - })(); - - v1beta1.BaseVestingAccount = (function() { - - /** - * Properties of a BaseVestingAccount. - * @memberof cosmos.vesting.v1beta1 - * @interface IBaseVestingAccount - * @property {cosmos.auth.v1beta1.IBaseAccount|null} [base_account] BaseVestingAccount base_account - * @property {Array.|null} [original_vesting] BaseVestingAccount original_vesting - * @property {Array.|null} [delegated_free] BaseVestingAccount delegated_free - * @property {Array.|null} [delegated_vesting] BaseVestingAccount delegated_vesting - * @property {Long|null} [end_time] BaseVestingAccount end_time - */ - - /** - * Constructs a new BaseVestingAccount. - * @memberof cosmos.vesting.v1beta1 - * @classdesc Represents a BaseVestingAccount. - * @implements IBaseVestingAccount - * @constructor - * @param {cosmos.vesting.v1beta1.IBaseVestingAccount=} [properties] Properties to set - */ - function BaseVestingAccount(properties) { - this.original_vesting = []; - this.delegated_free = []; - this.delegated_vesting = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * BaseVestingAccount base_account. - * @member {cosmos.auth.v1beta1.IBaseAccount|null|undefined} base_account - * @memberof cosmos.vesting.v1beta1.BaseVestingAccount - * @instance - */ - BaseVestingAccount.prototype.base_account = null; - - /** - * BaseVestingAccount original_vesting. - * @member {Array.} original_vesting - * @memberof cosmos.vesting.v1beta1.BaseVestingAccount - * @instance - */ - BaseVestingAccount.prototype.original_vesting = $util.emptyArray; - - /** - * BaseVestingAccount delegated_free. - * @member {Array.} delegated_free - * @memberof cosmos.vesting.v1beta1.BaseVestingAccount - * @instance - */ - BaseVestingAccount.prototype.delegated_free = $util.emptyArray; - - /** - * BaseVestingAccount delegated_vesting. - * @member {Array.} delegated_vesting - * @memberof cosmos.vesting.v1beta1.BaseVestingAccount - * @instance - */ - BaseVestingAccount.prototype.delegated_vesting = $util.emptyArray; - - /** - * BaseVestingAccount end_time. - * @member {Long} end_time - * @memberof cosmos.vesting.v1beta1.BaseVestingAccount - * @instance - */ - BaseVestingAccount.prototype.end_time = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Encodes the specified BaseVestingAccount message. Does not implicitly {@link cosmos.vesting.v1beta1.BaseVestingAccount.verify|verify} messages. - * @function encode - * @memberof cosmos.vesting.v1beta1.BaseVestingAccount - * @static - * @param {cosmos.vesting.v1beta1.IBaseVestingAccount} message BaseVestingAccount message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BaseVestingAccount.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.base_account != null && Object.hasOwnProperty.call(message, "base_account")) - $root.cosmos.auth.v1beta1.BaseAccount.encode(message.base_account, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.original_vesting != null && message.original_vesting.length) - for (let i = 0; i < message.original_vesting.length; ++i) - $root.cosmos.base.v1beta1.Coin.encode(message.original_vesting[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.delegated_free != null && message.delegated_free.length) - for (let i = 0; i < message.delegated_free.length; ++i) - $root.cosmos.base.v1beta1.Coin.encode(message.delegated_free[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.delegated_vesting != null && message.delegated_vesting.length) - for (let i = 0; i < message.delegated_vesting.length; ++i) - $root.cosmos.base.v1beta1.Coin.encode(message.delegated_vesting[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.end_time != null && Object.hasOwnProperty.call(message, "end_time")) - writer.uint32(/* id 5, wireType 0 =*/40).int64(message.end_time); - return writer; - }; - - /** - * Encodes the specified BaseVestingAccount message, length delimited. Does not implicitly {@link cosmos.vesting.v1beta1.BaseVestingAccount.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.vesting.v1beta1.BaseVestingAccount - * @static - * @param {cosmos.vesting.v1beta1.IBaseVestingAccount} message BaseVestingAccount message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BaseVestingAccount.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BaseVestingAccount message from the specified reader or buffer. - * @function decode - * @memberof cosmos.vesting.v1beta1.BaseVestingAccount - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.vesting.v1beta1.BaseVestingAccount} BaseVestingAccount - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BaseVestingAccount.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.vesting.v1beta1.BaseVestingAccount(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.base_account = $root.cosmos.auth.v1beta1.BaseAccount.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.original_vesting && message.original_vesting.length)) - message.original_vesting = []; - message.original_vesting.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.delegated_free && message.delegated_free.length)) - message.delegated_free = []; - message.delegated_free.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); - break; - case 4: - if (!(message.delegated_vesting && message.delegated_vesting.length)) - message.delegated_vesting = []; - message.delegated_vesting.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); - break; - case 5: - message.end_time = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BaseVestingAccount message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.vesting.v1beta1.BaseVestingAccount - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.vesting.v1beta1.BaseVestingAccount} BaseVestingAccount - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BaseVestingAccount.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BaseVestingAccount message. - * @function verify - * @memberof cosmos.vesting.v1beta1.BaseVestingAccount - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BaseVestingAccount.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.base_account != null && message.hasOwnProperty("base_account")) { - let error = $root.cosmos.auth.v1beta1.BaseAccount.verify(message.base_account); - if (error) - return "base_account." + error; - } - if (message.original_vesting != null && message.hasOwnProperty("original_vesting")) { - if (!Array.isArray(message.original_vesting)) - return "original_vesting: array expected"; - for (let i = 0; i < message.original_vesting.length; ++i) { - let error = $root.cosmos.base.v1beta1.Coin.verify(message.original_vesting[i]); - if (error) - return "original_vesting." + error; - } - } - if (message.delegated_free != null && message.hasOwnProperty("delegated_free")) { - if (!Array.isArray(message.delegated_free)) - return "delegated_free: array expected"; - for (let i = 0; i < message.delegated_free.length; ++i) { - let error = $root.cosmos.base.v1beta1.Coin.verify(message.delegated_free[i]); - if (error) - return "delegated_free." + error; - } - } - if (message.delegated_vesting != null && message.hasOwnProperty("delegated_vesting")) { - if (!Array.isArray(message.delegated_vesting)) - return "delegated_vesting: array expected"; - for (let i = 0; i < message.delegated_vesting.length; ++i) { - let error = $root.cosmos.base.v1beta1.Coin.verify(message.delegated_vesting[i]); - if (error) - return "delegated_vesting." + error; - } - } - if (message.end_time != null && message.hasOwnProperty("end_time")) - if (!$util.isInteger(message.end_time) && !(message.end_time && $util.isInteger(message.end_time.low) && $util.isInteger(message.end_time.high))) - return "end_time: integer|Long expected"; - return null; - }; - - /** - * Creates a BaseVestingAccount message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.vesting.v1beta1.BaseVestingAccount - * @static - * @param {Object.} object Plain object - * @returns {cosmos.vesting.v1beta1.BaseVestingAccount} BaseVestingAccount - */ - BaseVestingAccount.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.vesting.v1beta1.BaseVestingAccount) - return object; - let message = new $root.cosmos.vesting.v1beta1.BaseVestingAccount(); - if (object.base_account != null) { - if (typeof object.base_account !== "object") - throw TypeError(".cosmos.vesting.v1beta1.BaseVestingAccount.base_account: object expected"); - message.base_account = $root.cosmos.auth.v1beta1.BaseAccount.fromObject(object.base_account); - } - if (object.original_vesting) { - if (!Array.isArray(object.original_vesting)) - throw TypeError(".cosmos.vesting.v1beta1.BaseVestingAccount.original_vesting: array expected"); - message.original_vesting = []; - for (let i = 0; i < object.original_vesting.length; ++i) { - if (typeof object.original_vesting[i] !== "object") - throw TypeError(".cosmos.vesting.v1beta1.BaseVestingAccount.original_vesting: object expected"); - message.original_vesting[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.original_vesting[i]); - } - } - if (object.delegated_free) { - if (!Array.isArray(object.delegated_free)) - throw TypeError(".cosmos.vesting.v1beta1.BaseVestingAccount.delegated_free: array expected"); - message.delegated_free = []; - for (let i = 0; i < object.delegated_free.length; ++i) { - if (typeof object.delegated_free[i] !== "object") - throw TypeError(".cosmos.vesting.v1beta1.BaseVestingAccount.delegated_free: object expected"); - message.delegated_free[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.delegated_free[i]); - } - } - if (object.delegated_vesting) { - if (!Array.isArray(object.delegated_vesting)) - throw TypeError(".cosmos.vesting.v1beta1.BaseVestingAccount.delegated_vesting: array expected"); - message.delegated_vesting = []; - for (let i = 0; i < object.delegated_vesting.length; ++i) { - if (typeof object.delegated_vesting[i] !== "object") - throw TypeError(".cosmos.vesting.v1beta1.BaseVestingAccount.delegated_vesting: object expected"); - message.delegated_vesting[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.delegated_vesting[i]); - } - } - if (object.end_time != null) - if ($util.Long) - (message.end_time = $util.Long.fromValue(object.end_time)).unsigned = false; - else if (typeof object.end_time === "string") - message.end_time = parseInt(object.end_time, 10); - else if (typeof object.end_time === "number") - message.end_time = object.end_time; - else if (typeof object.end_time === "object") - message.end_time = new $util.LongBits(object.end_time.low >>> 0, object.end_time.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a BaseVestingAccount message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.vesting.v1beta1.BaseVestingAccount - * @static - * @param {cosmos.vesting.v1beta1.BaseVestingAccount} message BaseVestingAccount - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BaseVestingAccount.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) { - object.original_vesting = []; - object.delegated_free = []; - object.delegated_vesting = []; - } - if (options.defaults) { - object.base_account = null; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.end_time = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.end_time = options.longs === String ? "0" : 0; - } - if (message.base_account != null && message.hasOwnProperty("base_account")) - object.base_account = $root.cosmos.auth.v1beta1.BaseAccount.toObject(message.base_account, options); - if (message.original_vesting && message.original_vesting.length) { - object.original_vesting = []; - for (let j = 0; j < message.original_vesting.length; ++j) - object.original_vesting[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.original_vesting[j], options); - } - if (message.delegated_free && message.delegated_free.length) { - object.delegated_free = []; - for (let j = 0; j < message.delegated_free.length; ++j) - object.delegated_free[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.delegated_free[j], options); - } - if (message.delegated_vesting && message.delegated_vesting.length) { - object.delegated_vesting = []; - for (let j = 0; j < message.delegated_vesting.length; ++j) - object.delegated_vesting[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.delegated_vesting[j], options); - } - if (message.end_time != null && message.hasOwnProperty("end_time")) - if (typeof message.end_time === "number") - object.end_time = options.longs === String ? String(message.end_time) : message.end_time; - else - object.end_time = options.longs === String ? $util.Long.prototype.toString.call(message.end_time) : options.longs === Number ? new $util.LongBits(message.end_time.low >>> 0, message.end_time.high >>> 0).toNumber() : message.end_time; - return object; - }; - - /** - * Converts this BaseVestingAccount to JSON. - * @function toJSON - * @memberof cosmos.vesting.v1beta1.BaseVestingAccount - * @instance - * @returns {Object.} JSON object - */ - BaseVestingAccount.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return BaseVestingAccount; - })(); - - v1beta1.ContinuousVestingAccount = (function() { - - /** - * Properties of a ContinuousVestingAccount. - * @memberof cosmos.vesting.v1beta1 - * @interface IContinuousVestingAccount - * @property {cosmos.vesting.v1beta1.IBaseVestingAccount|null} [base_vesting_account] ContinuousVestingAccount base_vesting_account - * @property {Long|null} [start_time] ContinuousVestingAccount start_time - */ - - /** - * Constructs a new ContinuousVestingAccount. - * @memberof cosmos.vesting.v1beta1 - * @classdesc Represents a ContinuousVestingAccount. - * @implements IContinuousVestingAccount - * @constructor - * @param {cosmos.vesting.v1beta1.IContinuousVestingAccount=} [properties] Properties to set - */ - function ContinuousVestingAccount(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ContinuousVestingAccount base_vesting_account. - * @member {cosmos.vesting.v1beta1.IBaseVestingAccount|null|undefined} base_vesting_account - * @memberof cosmos.vesting.v1beta1.ContinuousVestingAccount - * @instance - */ - ContinuousVestingAccount.prototype.base_vesting_account = null; - - /** - * ContinuousVestingAccount start_time. - * @member {Long} start_time - * @memberof cosmos.vesting.v1beta1.ContinuousVestingAccount - * @instance - */ - ContinuousVestingAccount.prototype.start_time = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Encodes the specified ContinuousVestingAccount message. Does not implicitly {@link cosmos.vesting.v1beta1.ContinuousVestingAccount.verify|verify} messages. - * @function encode - * @memberof cosmos.vesting.v1beta1.ContinuousVestingAccount - * @static - * @param {cosmos.vesting.v1beta1.IContinuousVestingAccount} message ContinuousVestingAccount message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ContinuousVestingAccount.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.base_vesting_account != null && Object.hasOwnProperty.call(message, "base_vesting_account")) - $root.cosmos.vesting.v1beta1.BaseVestingAccount.encode(message.base_vesting_account, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.start_time != null && Object.hasOwnProperty.call(message, "start_time")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.start_time); - return writer; - }; - - /** - * Encodes the specified ContinuousVestingAccount message, length delimited. Does not implicitly {@link cosmos.vesting.v1beta1.ContinuousVestingAccount.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.vesting.v1beta1.ContinuousVestingAccount - * @static - * @param {cosmos.vesting.v1beta1.IContinuousVestingAccount} message ContinuousVestingAccount message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ContinuousVestingAccount.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ContinuousVestingAccount message from the specified reader or buffer. - * @function decode - * @memberof cosmos.vesting.v1beta1.ContinuousVestingAccount - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.vesting.v1beta1.ContinuousVestingAccount} ContinuousVestingAccount - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ContinuousVestingAccount.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.vesting.v1beta1.ContinuousVestingAccount(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.base_vesting_account = $root.cosmos.vesting.v1beta1.BaseVestingAccount.decode(reader, reader.uint32()); - break; - case 2: - message.start_time = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ContinuousVestingAccount message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.vesting.v1beta1.ContinuousVestingAccount - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.vesting.v1beta1.ContinuousVestingAccount} ContinuousVestingAccount - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ContinuousVestingAccount.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ContinuousVestingAccount message. - * @function verify - * @memberof cosmos.vesting.v1beta1.ContinuousVestingAccount - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ContinuousVestingAccount.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.base_vesting_account != null && message.hasOwnProperty("base_vesting_account")) { - let error = $root.cosmos.vesting.v1beta1.BaseVestingAccount.verify(message.base_vesting_account); - if (error) - return "base_vesting_account." + error; - } - if (message.start_time != null && message.hasOwnProperty("start_time")) - if (!$util.isInteger(message.start_time) && !(message.start_time && $util.isInteger(message.start_time.low) && $util.isInteger(message.start_time.high))) - return "start_time: integer|Long expected"; - return null; - }; - - /** - * Creates a ContinuousVestingAccount message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.vesting.v1beta1.ContinuousVestingAccount - * @static - * @param {Object.} object Plain object - * @returns {cosmos.vesting.v1beta1.ContinuousVestingAccount} ContinuousVestingAccount - */ - ContinuousVestingAccount.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.vesting.v1beta1.ContinuousVestingAccount) - return object; - let message = new $root.cosmos.vesting.v1beta1.ContinuousVestingAccount(); - if (object.base_vesting_account != null) { - if (typeof object.base_vesting_account !== "object") - throw TypeError(".cosmos.vesting.v1beta1.ContinuousVestingAccount.base_vesting_account: object expected"); - message.base_vesting_account = $root.cosmos.vesting.v1beta1.BaseVestingAccount.fromObject(object.base_vesting_account); - } - if (object.start_time != null) - if ($util.Long) - (message.start_time = $util.Long.fromValue(object.start_time)).unsigned = false; - else if (typeof object.start_time === "string") - message.start_time = parseInt(object.start_time, 10); - else if (typeof object.start_time === "number") - message.start_time = object.start_time; - else if (typeof object.start_time === "object") - message.start_time = new $util.LongBits(object.start_time.low >>> 0, object.start_time.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a ContinuousVestingAccount message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.vesting.v1beta1.ContinuousVestingAccount - * @static - * @param {cosmos.vesting.v1beta1.ContinuousVestingAccount} message ContinuousVestingAccount - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ContinuousVestingAccount.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.base_vesting_account = null; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.start_time = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.start_time = options.longs === String ? "0" : 0; - } - if (message.base_vesting_account != null && message.hasOwnProperty("base_vesting_account")) - object.base_vesting_account = $root.cosmos.vesting.v1beta1.BaseVestingAccount.toObject(message.base_vesting_account, options); - if (message.start_time != null && message.hasOwnProperty("start_time")) - if (typeof message.start_time === "number") - object.start_time = options.longs === String ? String(message.start_time) : message.start_time; - else - object.start_time = options.longs === String ? $util.Long.prototype.toString.call(message.start_time) : options.longs === Number ? new $util.LongBits(message.start_time.low >>> 0, message.start_time.high >>> 0).toNumber() : message.start_time; - return object; - }; - - /** - * Converts this ContinuousVestingAccount to JSON. - * @function toJSON - * @memberof cosmos.vesting.v1beta1.ContinuousVestingAccount - * @instance - * @returns {Object.} JSON object - */ - ContinuousVestingAccount.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ContinuousVestingAccount; - })(); - - v1beta1.DelayedVestingAccount = (function() { - - /** - * Properties of a DelayedVestingAccount. - * @memberof cosmos.vesting.v1beta1 - * @interface IDelayedVestingAccount - * @property {cosmos.vesting.v1beta1.IBaseVestingAccount|null} [base_vesting_account] DelayedVestingAccount base_vesting_account - */ - - /** - * Constructs a new DelayedVestingAccount. - * @memberof cosmos.vesting.v1beta1 - * @classdesc Represents a DelayedVestingAccount. - * @implements IDelayedVestingAccount - * @constructor - * @param {cosmos.vesting.v1beta1.IDelayedVestingAccount=} [properties] Properties to set - */ - function DelayedVestingAccount(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DelayedVestingAccount base_vesting_account. - * @member {cosmos.vesting.v1beta1.IBaseVestingAccount|null|undefined} base_vesting_account - * @memberof cosmos.vesting.v1beta1.DelayedVestingAccount - * @instance - */ - DelayedVestingAccount.prototype.base_vesting_account = null; - - /** - * Encodes the specified DelayedVestingAccount message. Does not implicitly {@link cosmos.vesting.v1beta1.DelayedVestingAccount.verify|verify} messages. - * @function encode - * @memberof cosmos.vesting.v1beta1.DelayedVestingAccount - * @static - * @param {cosmos.vesting.v1beta1.IDelayedVestingAccount} message DelayedVestingAccount message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DelayedVestingAccount.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.base_vesting_account != null && Object.hasOwnProperty.call(message, "base_vesting_account")) - $root.cosmos.vesting.v1beta1.BaseVestingAccount.encode(message.base_vesting_account, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified DelayedVestingAccount message, length delimited. Does not implicitly {@link cosmos.vesting.v1beta1.DelayedVestingAccount.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.vesting.v1beta1.DelayedVestingAccount - * @static - * @param {cosmos.vesting.v1beta1.IDelayedVestingAccount} message DelayedVestingAccount message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DelayedVestingAccount.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DelayedVestingAccount message from the specified reader or buffer. - * @function decode - * @memberof cosmos.vesting.v1beta1.DelayedVestingAccount - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.vesting.v1beta1.DelayedVestingAccount} DelayedVestingAccount - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DelayedVestingAccount.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.vesting.v1beta1.DelayedVestingAccount(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.base_vesting_account = $root.cosmos.vesting.v1beta1.BaseVestingAccount.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DelayedVestingAccount message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.vesting.v1beta1.DelayedVestingAccount - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.vesting.v1beta1.DelayedVestingAccount} DelayedVestingAccount - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DelayedVestingAccount.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DelayedVestingAccount message. - * @function verify - * @memberof cosmos.vesting.v1beta1.DelayedVestingAccount - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DelayedVestingAccount.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.base_vesting_account != null && message.hasOwnProperty("base_vesting_account")) { - let error = $root.cosmos.vesting.v1beta1.BaseVestingAccount.verify(message.base_vesting_account); - if (error) - return "base_vesting_account." + error; - } - return null; - }; - - /** - * Creates a DelayedVestingAccount message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.vesting.v1beta1.DelayedVestingAccount - * @static - * @param {Object.} object Plain object - * @returns {cosmos.vesting.v1beta1.DelayedVestingAccount} DelayedVestingAccount - */ - DelayedVestingAccount.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.vesting.v1beta1.DelayedVestingAccount) - return object; - let message = new $root.cosmos.vesting.v1beta1.DelayedVestingAccount(); - if (object.base_vesting_account != null) { - if (typeof object.base_vesting_account !== "object") - throw TypeError(".cosmos.vesting.v1beta1.DelayedVestingAccount.base_vesting_account: object expected"); - message.base_vesting_account = $root.cosmos.vesting.v1beta1.BaseVestingAccount.fromObject(object.base_vesting_account); - } - return message; - }; - - /** - * Creates a plain object from a DelayedVestingAccount message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.vesting.v1beta1.DelayedVestingAccount - * @static - * @param {cosmos.vesting.v1beta1.DelayedVestingAccount} message DelayedVestingAccount - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DelayedVestingAccount.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.base_vesting_account = null; - if (message.base_vesting_account != null && message.hasOwnProperty("base_vesting_account")) - object.base_vesting_account = $root.cosmos.vesting.v1beta1.BaseVestingAccount.toObject(message.base_vesting_account, options); - return object; - }; - - /** - * Converts this DelayedVestingAccount to JSON. - * @function toJSON - * @memberof cosmos.vesting.v1beta1.DelayedVestingAccount - * @instance - * @returns {Object.} JSON object - */ - DelayedVestingAccount.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return DelayedVestingAccount; - })(); - - v1beta1.Period = (function() { - - /** - * Properties of a Period. - * @memberof cosmos.vesting.v1beta1 - * @interface IPeriod - * @property {Long|null} [length] Period length - * @property {Array.|null} [amount] Period amount - */ - - /** - * Constructs a new Period. - * @memberof cosmos.vesting.v1beta1 - * @classdesc Represents a Period. - * @implements IPeriod - * @constructor - * @param {cosmos.vesting.v1beta1.IPeriod=} [properties] Properties to set - */ - function Period(properties) { - this.amount = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Period length. - * @member {Long} length - * @memberof cosmos.vesting.v1beta1.Period - * @instance - */ - Period.prototype.length = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Period amount. - * @member {Array.} amount - * @memberof cosmos.vesting.v1beta1.Period - * @instance - */ - Period.prototype.amount = $util.emptyArray; - - /** - * Encodes the specified Period message. Does not implicitly {@link cosmos.vesting.v1beta1.Period.verify|verify} messages. - * @function encode - * @memberof cosmos.vesting.v1beta1.Period - * @static - * @param {cosmos.vesting.v1beta1.IPeriod} message Period message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Period.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.length != null && Object.hasOwnProperty.call(message, "length")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.length); - if (message.amount != null && message.amount.length) - for (let i = 0; i < message.amount.length; ++i) - $root.cosmos.base.v1beta1.Coin.encode(message.amount[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Period message, length delimited. Does not implicitly {@link cosmos.vesting.v1beta1.Period.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.vesting.v1beta1.Period - * @static - * @param {cosmos.vesting.v1beta1.IPeriod} message Period message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Period.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Period message from the specified reader or buffer. - * @function decode - * @memberof cosmos.vesting.v1beta1.Period - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.vesting.v1beta1.Period} Period - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Period.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.vesting.v1beta1.Period(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.length = reader.int64(); - break; - case 2: - if (!(message.amount && message.amount.length)) - message.amount = []; - message.amount.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Period message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.vesting.v1beta1.Period - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.vesting.v1beta1.Period} Period - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Period.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Period message. - * @function verify - * @memberof cosmos.vesting.v1beta1.Period - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Period.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.length != null && message.hasOwnProperty("length")) - if (!$util.isInteger(message.length) && !(message.length && $util.isInteger(message.length.low) && $util.isInteger(message.length.high))) - return "length: integer|Long expected"; - if (message.amount != null && message.hasOwnProperty("amount")) { - if (!Array.isArray(message.amount)) - return "amount: array expected"; - for (let i = 0; i < message.amount.length; ++i) { - let error = $root.cosmos.base.v1beta1.Coin.verify(message.amount[i]); - if (error) - return "amount." + error; - } - } - return null; - }; - - /** - * Creates a Period message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.vesting.v1beta1.Period - * @static - * @param {Object.} object Plain object - * @returns {cosmos.vesting.v1beta1.Period} Period - */ - Period.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.vesting.v1beta1.Period) - return object; - let message = new $root.cosmos.vesting.v1beta1.Period(); - if (object.length != null) - if ($util.Long) - (message.length = $util.Long.fromValue(object.length)).unsigned = false; - else if (typeof object.length === "string") - message.length = parseInt(object.length, 10); - else if (typeof object.length === "number") - message.length = object.length; - else if (typeof object.length === "object") - message.length = new $util.LongBits(object.length.low >>> 0, object.length.high >>> 0).toNumber(); - if (object.amount) { - if (!Array.isArray(object.amount)) - throw TypeError(".cosmos.vesting.v1beta1.Period.amount: array expected"); - message.amount = []; - for (let i = 0; i < object.amount.length; ++i) { - if (typeof object.amount[i] !== "object") - throw TypeError(".cosmos.vesting.v1beta1.Period.amount: object expected"); - message.amount[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.amount[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a Period message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.vesting.v1beta1.Period - * @static - * @param {cosmos.vesting.v1beta1.Period} message Period - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Period.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.amount = []; - if (options.defaults) - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.length = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.length = options.longs === String ? "0" : 0; - if (message.length != null && message.hasOwnProperty("length")) - if (typeof message.length === "number") - object.length = options.longs === String ? String(message.length) : message.length; - else - object.length = options.longs === String ? $util.Long.prototype.toString.call(message.length) : options.longs === Number ? new $util.LongBits(message.length.low >>> 0, message.length.high >>> 0).toNumber() : message.length; - if (message.amount && message.amount.length) { - object.amount = []; - for (let j = 0; j < message.amount.length; ++j) - object.amount[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.amount[j], options); - } - return object; - }; - - /** - * Converts this Period to JSON. - * @function toJSON - * @memberof cosmos.vesting.v1beta1.Period - * @instance - * @returns {Object.} JSON object - */ - Period.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Period; - })(); - - v1beta1.PeriodicVestingAccount = (function() { - - /** - * Properties of a PeriodicVestingAccount. - * @memberof cosmos.vesting.v1beta1 - * @interface IPeriodicVestingAccount - * @property {cosmos.vesting.v1beta1.IBaseVestingAccount|null} [base_vesting_account] PeriodicVestingAccount base_vesting_account - * @property {Long|null} [start_time] PeriodicVestingAccount start_time - * @property {Array.|null} [vesting_periods] PeriodicVestingAccount vesting_periods - */ - - /** - * Constructs a new PeriodicVestingAccount. - * @memberof cosmos.vesting.v1beta1 - * @classdesc Represents a PeriodicVestingAccount. - * @implements IPeriodicVestingAccount - * @constructor - * @param {cosmos.vesting.v1beta1.IPeriodicVestingAccount=} [properties] Properties to set - */ - function PeriodicVestingAccount(properties) { - this.vesting_periods = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PeriodicVestingAccount base_vesting_account. - * @member {cosmos.vesting.v1beta1.IBaseVestingAccount|null|undefined} base_vesting_account - * @memberof cosmos.vesting.v1beta1.PeriodicVestingAccount - * @instance - */ - PeriodicVestingAccount.prototype.base_vesting_account = null; - - /** - * PeriodicVestingAccount start_time. - * @member {Long} start_time - * @memberof cosmos.vesting.v1beta1.PeriodicVestingAccount - * @instance - */ - PeriodicVestingAccount.prototype.start_time = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * PeriodicVestingAccount vesting_periods. - * @member {Array.} vesting_periods - * @memberof cosmos.vesting.v1beta1.PeriodicVestingAccount - * @instance - */ - PeriodicVestingAccount.prototype.vesting_periods = $util.emptyArray; - - /** - * Encodes the specified PeriodicVestingAccount message. Does not implicitly {@link cosmos.vesting.v1beta1.PeriodicVestingAccount.verify|verify} messages. - * @function encode - * @memberof cosmos.vesting.v1beta1.PeriodicVestingAccount - * @static - * @param {cosmos.vesting.v1beta1.IPeriodicVestingAccount} message PeriodicVestingAccount message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PeriodicVestingAccount.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.base_vesting_account != null && Object.hasOwnProperty.call(message, "base_vesting_account")) - $root.cosmos.vesting.v1beta1.BaseVestingAccount.encode(message.base_vesting_account, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.start_time != null && Object.hasOwnProperty.call(message, "start_time")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.start_time); - if (message.vesting_periods != null && message.vesting_periods.length) - for (let i = 0; i < message.vesting_periods.length; ++i) - $root.cosmos.vesting.v1beta1.Period.encode(message.vesting_periods[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified PeriodicVestingAccount message, length delimited. Does not implicitly {@link cosmos.vesting.v1beta1.PeriodicVestingAccount.verify|verify} messages. - * @function encodeDelimited - * @memberof cosmos.vesting.v1beta1.PeriodicVestingAccount - * @static - * @param {cosmos.vesting.v1beta1.IPeriodicVestingAccount} message PeriodicVestingAccount message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PeriodicVestingAccount.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PeriodicVestingAccount message from the specified reader or buffer. - * @function decode - * @memberof cosmos.vesting.v1beta1.PeriodicVestingAccount - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {cosmos.vesting.v1beta1.PeriodicVestingAccount} PeriodicVestingAccount - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PeriodicVestingAccount.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cosmos.vesting.v1beta1.PeriodicVestingAccount(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.base_vesting_account = $root.cosmos.vesting.v1beta1.BaseVestingAccount.decode(reader, reader.uint32()); - break; - case 2: - message.start_time = reader.int64(); - break; - case 3: - if (!(message.vesting_periods && message.vesting_periods.length)) - message.vesting_periods = []; - message.vesting_periods.push($root.cosmos.vesting.v1beta1.Period.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PeriodicVestingAccount message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof cosmos.vesting.v1beta1.PeriodicVestingAccount - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {cosmos.vesting.v1beta1.PeriodicVestingAccount} PeriodicVestingAccount - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PeriodicVestingAccount.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PeriodicVestingAccount message. - * @function verify - * @memberof cosmos.vesting.v1beta1.PeriodicVestingAccount - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PeriodicVestingAccount.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.base_vesting_account != null && message.hasOwnProperty("base_vesting_account")) { - let error = $root.cosmos.vesting.v1beta1.BaseVestingAccount.verify(message.base_vesting_account); - if (error) - return "base_vesting_account." + error; - } - if (message.start_time != null && message.hasOwnProperty("start_time")) - if (!$util.isInteger(message.start_time) && !(message.start_time && $util.isInteger(message.start_time.low) && $util.isInteger(message.start_time.high))) - return "start_time: integer|Long expected"; - if (message.vesting_periods != null && message.hasOwnProperty("vesting_periods")) { - if (!Array.isArray(message.vesting_periods)) - return "vesting_periods: array expected"; - for (let i = 0; i < message.vesting_periods.length; ++i) { - let error = $root.cosmos.vesting.v1beta1.Period.verify(message.vesting_periods[i]); - if (error) - return "vesting_periods." + error; - } - } - return null; - }; - - /** - * Creates a PeriodicVestingAccount message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof cosmos.vesting.v1beta1.PeriodicVestingAccount - * @static - * @param {Object.} object Plain object - * @returns {cosmos.vesting.v1beta1.PeriodicVestingAccount} PeriodicVestingAccount - */ - PeriodicVestingAccount.fromObject = function fromObject(object) { - if (object instanceof $root.cosmos.vesting.v1beta1.PeriodicVestingAccount) - return object; - let message = new $root.cosmos.vesting.v1beta1.PeriodicVestingAccount(); - if (object.base_vesting_account != null) { - if (typeof object.base_vesting_account !== "object") - throw TypeError(".cosmos.vesting.v1beta1.PeriodicVestingAccount.base_vesting_account: object expected"); - message.base_vesting_account = $root.cosmos.vesting.v1beta1.BaseVestingAccount.fromObject(object.base_vesting_account); - } - if (object.start_time != null) - if ($util.Long) - (message.start_time = $util.Long.fromValue(object.start_time)).unsigned = false; - else if (typeof object.start_time === "string") - message.start_time = parseInt(object.start_time, 10); - else if (typeof object.start_time === "number") - message.start_time = object.start_time; - else if (typeof object.start_time === "object") - message.start_time = new $util.LongBits(object.start_time.low >>> 0, object.start_time.high >>> 0).toNumber(); - if (object.vesting_periods) { - if (!Array.isArray(object.vesting_periods)) - throw TypeError(".cosmos.vesting.v1beta1.PeriodicVestingAccount.vesting_periods: array expected"); - message.vesting_periods = []; - for (let i = 0; i < object.vesting_periods.length; ++i) { - if (typeof object.vesting_periods[i] !== "object") - throw TypeError(".cosmos.vesting.v1beta1.PeriodicVestingAccount.vesting_periods: object expected"); - message.vesting_periods[i] = $root.cosmos.vesting.v1beta1.Period.fromObject(object.vesting_periods[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a PeriodicVestingAccount message. Also converts values to other types if specified. - * @function toObject - * @memberof cosmos.vesting.v1beta1.PeriodicVestingAccount - * @static - * @param {cosmos.vesting.v1beta1.PeriodicVestingAccount} message PeriodicVestingAccount - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PeriodicVestingAccount.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.vesting_periods = []; - if (options.defaults) { - object.base_vesting_account = null; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.start_time = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.start_time = options.longs === String ? "0" : 0; - } - if (message.base_vesting_account != null && message.hasOwnProperty("base_vesting_account")) - object.base_vesting_account = $root.cosmos.vesting.v1beta1.BaseVestingAccount.toObject(message.base_vesting_account, options); - if (message.start_time != null && message.hasOwnProperty("start_time")) - if (typeof message.start_time === "number") - object.start_time = options.longs === String ? String(message.start_time) : message.start_time; - else - object.start_time = options.longs === String ? $util.Long.prototype.toString.call(message.start_time) : options.longs === Number ? new $util.LongBits(message.start_time.low >>> 0, message.start_time.high >>> 0).toNumber() : message.start_time; - if (message.vesting_periods && message.vesting_periods.length) { - object.vesting_periods = []; - for (let j = 0; j < message.vesting_periods.length; ++j) - object.vesting_periods[j] = $root.cosmos.vesting.v1beta1.Period.toObject(message.vesting_periods[j], options); - } - return object; - }; - - /** - * Converts this PeriodicVestingAccount to JSON. - * @function toJSON - * @memberof cosmos.vesting.v1beta1.PeriodicVestingAccount - * @instance - * @returns {Object.} JSON object - */ - PeriodicVestingAccount.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return PeriodicVestingAccount; - })(); - - return v1beta1; - })(); - - return vesting; - })(); - - return cosmos; -})(); - -export const google = $root.google = (() => { - - /** - * Namespace google. - * @exports google - * @namespace - */ - const google = {}; - - google.protobuf = (function() { - - /** - * Namespace protobuf. - * @memberof google - * @namespace - */ - const protobuf = {}; - - protobuf.Any = (function() { - - /** - * Properties of an Any. - * @memberof google.protobuf - * @interface IAny - * @property {string|null} [type_url] Any type_url - * @property {Uint8Array|null} [value] Any value - */ - - /** - * Constructs a new Any. - * @memberof google.protobuf - * @classdesc Represents an Any. - * @implements IAny - * @constructor - * @param {google.protobuf.IAny=} [properties] Properties to set - */ - function Any(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Any type_url. - * @member {string} type_url - * @memberof google.protobuf.Any - * @instance - */ - Any.prototype.type_url = ""; - - /** - * Any value. - * @member {Uint8Array} value - * @memberof google.protobuf.Any - * @instance - */ - Any.prototype.value = $util.newBuffer([]); - - /** - * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. - * @function encode - * @memberof google.protobuf.Any - * @static - * @param {google.protobuf.IAny} message Any message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Any.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.type_url != null && Object.hasOwnProperty.call(message, "type_url")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.type_url); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value); - return writer; - }; - - /** - * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.Any - * @static - * @param {google.protobuf.IAny} message Any message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Any.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Any message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.Any - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.Any} Any - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Any.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Any(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.type_url = reader.string(); - break; - case 2: - message.value = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Any message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.Any - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Any} Any - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Any.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Any message. - * @function verify - * @memberof google.protobuf.Any - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Any.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.type_url != null && message.hasOwnProperty("type_url")) - if (!$util.isString(message.type_url)) - return "type_url: string expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) - return "value: buffer expected"; - return null; - }; - - /** - * Creates an Any message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.Any - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.Any} Any - */ - Any.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Any) - return object; - let message = new $root.google.protobuf.Any(); - if (object.type_url != null) - message.type_url = String(object.type_url); - if (object.value != null) - if (typeof object.value === "string") - $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); - else if (object.value.length) - message.value = object.value; - return message; - }; - - /** - * Creates a plain object from an Any message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.Any - * @static - * @param {google.protobuf.Any} message Any - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Any.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.type_url = ""; - if (options.bytes === String) - object.value = ""; - else { - object.value = []; - if (options.bytes !== Array) - object.value = $util.newBuffer(object.value); - } - } - if (message.type_url != null && message.hasOwnProperty("type_url")) - object.type_url = message.type_url; - if (message.value != null && message.hasOwnProperty("value")) - object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; - return object; - }; - - /** - * Converts this Any to JSON. - * @function toJSON - * @memberof google.protobuf.Any - * @instance - * @returns {Object.} JSON object - */ - Any.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Any; - })(); - - protobuf.FileDescriptorSet = (function() { - - /** - * Properties of a FileDescriptorSet. - * @memberof google.protobuf - * @interface IFileDescriptorSet - * @property {Array.|null} [file] FileDescriptorSet file - */ - - /** - * Constructs a new FileDescriptorSet. - * @memberof google.protobuf - * @classdesc Represents a FileDescriptorSet. - * @implements IFileDescriptorSet - * @constructor - * @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set - */ - function FileDescriptorSet(properties) { - this.file = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * FileDescriptorSet file. - * @member {Array.} file - * @memberof google.protobuf.FileDescriptorSet - * @instance - */ - FileDescriptorSet.prototype.file = $util.emptyArray; - - /** - * Encodes the specified FileDescriptorSet message. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. - * @function encode - * @memberof google.protobuf.FileDescriptorSet - * @static - * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FileDescriptorSet.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.file != null && message.file.length) - for (let i = 0; i < message.file.length; ++i) - $root.google.protobuf.FileDescriptorProto.encode(message.file[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified FileDescriptorSet message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.FileDescriptorSet - * @static - * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FileDescriptorSet.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FileDescriptorSet message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.FileDescriptorSet - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FileDescriptorSet.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorSet(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.file && message.file.length)) - message.file = []; - message.file.push($root.google.protobuf.FileDescriptorProto.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FileDescriptorSet message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.FileDescriptorSet - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FileDescriptorSet.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FileDescriptorSet message. - * @function verify - * @memberof google.protobuf.FileDescriptorSet - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FileDescriptorSet.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.file != null && message.hasOwnProperty("file")) { - if (!Array.isArray(message.file)) - return "file: array expected"; - for (let i = 0; i < message.file.length; ++i) { - let error = $root.google.protobuf.FileDescriptorProto.verify(message.file[i]); - if (error) - return "file." + error; - } - } - return null; - }; - - /** - * Creates a FileDescriptorSet message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.FileDescriptorSet - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet - */ - FileDescriptorSet.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FileDescriptorSet) - return object; - let message = new $root.google.protobuf.FileDescriptorSet(); - if (object.file) { - if (!Array.isArray(object.file)) - throw TypeError(".google.protobuf.FileDescriptorSet.file: array expected"); - message.file = []; - for (let i = 0; i < object.file.length; ++i) { - if (typeof object.file[i] !== "object") - throw TypeError(".google.protobuf.FileDescriptorSet.file: object expected"); - message.file[i] = $root.google.protobuf.FileDescriptorProto.fromObject(object.file[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a FileDescriptorSet message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.FileDescriptorSet - * @static - * @param {google.protobuf.FileDescriptorSet} message FileDescriptorSet - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FileDescriptorSet.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.file = []; - if (message.file && message.file.length) { - object.file = []; - for (let j = 0; j < message.file.length; ++j) - object.file[j] = $root.google.protobuf.FileDescriptorProto.toObject(message.file[j], options); - } - return object; - }; - - /** - * Converts this FileDescriptorSet to JSON. - * @function toJSON - * @memberof google.protobuf.FileDescriptorSet - * @instance - * @returns {Object.} JSON object - */ - FileDescriptorSet.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return FileDescriptorSet; - })(); - - protobuf.FileDescriptorProto = (function() { - - /** - * Properties of a FileDescriptorProto. - * @memberof google.protobuf - * @interface IFileDescriptorProto - * @property {string|null} [name] FileDescriptorProto name - * @property {string|null} ["package"] FileDescriptorProto package - * @property {Array.|null} [dependency] FileDescriptorProto dependency - * @property {Array.|null} [public_dependency] FileDescriptorProto public_dependency - * @property {Array.|null} [weak_dependency] FileDescriptorProto weak_dependency - * @property {Array.|null} [message_type] FileDescriptorProto message_type - * @property {Array.|null} [enum_type] FileDescriptorProto enum_type - * @property {Array.|null} [service] FileDescriptorProto service - * @property {Array.|null} [extension] FileDescriptorProto extension - * @property {google.protobuf.IFileOptions|null} [options] FileDescriptorProto options - * @property {google.protobuf.ISourceCodeInfo|null} [source_code_info] FileDescriptorProto source_code_info - * @property {string|null} [syntax] FileDescriptorProto syntax - */ - - /** - * Constructs a new FileDescriptorProto. - * @memberof google.protobuf - * @classdesc Represents a FileDescriptorProto. - * @implements IFileDescriptorProto - * @constructor - * @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set - */ - function FileDescriptorProto(properties) { - this.dependency = []; - this.public_dependency = []; - this.weak_dependency = []; - this.message_type = []; - this.enum_type = []; - this.service = []; - this.extension = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * FileDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.name = ""; - - /** - * FileDescriptorProto package. - * @member {string} package - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype["package"] = ""; - - /** - * FileDescriptorProto dependency. - * @member {Array.} dependency - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.dependency = $util.emptyArray; - - /** - * FileDescriptorProto public_dependency. - * @member {Array.} public_dependency - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.public_dependency = $util.emptyArray; - - /** - * FileDescriptorProto weak_dependency. - * @member {Array.} weak_dependency - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.weak_dependency = $util.emptyArray; - - /** - * FileDescriptorProto message_type. - * @member {Array.} message_type - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.message_type = $util.emptyArray; - - /** - * FileDescriptorProto enum_type. - * @member {Array.} enum_type - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.enum_type = $util.emptyArray; - - /** - * FileDescriptorProto service. - * @member {Array.} service - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.service = $util.emptyArray; - - /** - * FileDescriptorProto extension. - * @member {Array.} extension - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.extension = $util.emptyArray; - - /** - * FileDescriptorProto options. - * @member {google.protobuf.IFileOptions|null|undefined} options - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.options = null; - - /** - * FileDescriptorProto source_code_info. - * @member {google.protobuf.ISourceCodeInfo|null|undefined} source_code_info - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.source_code_info = null; - - /** - * FileDescriptorProto syntax. - * @member {string} syntax - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.syntax = ""; - - /** - * Encodes the specified FileDescriptorProto message. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. - * @function encode - * @memberof google.protobuf.FileDescriptorProto - * @static - * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FileDescriptorProto.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message["package"] != null && Object.hasOwnProperty.call(message, "package")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message["package"]); - if (message.dependency != null && message.dependency.length) - for (let i = 0; i < message.dependency.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.dependency[i]); - if (message.message_type != null && message.message_type.length) - for (let i = 0; i < message.message_type.length; ++i) - $root.google.protobuf.DescriptorProto.encode(message.message_type[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.enum_type != null && message.enum_type.length) - for (let i = 0; i < message.enum_type.length; ++i) - $root.google.protobuf.EnumDescriptorProto.encode(message.enum_type[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.service != null && message.service.length) - for (let i = 0; i < message.service.length; ++i) - $root.google.protobuf.ServiceDescriptorProto.encode(message.service[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.extension != null && message.extension.length) - for (let i = 0; i < message.extension.length; ++i) - $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.FileOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.source_code_info != null && Object.hasOwnProperty.call(message, "source_code_info")) - $root.google.protobuf.SourceCodeInfo.encode(message.source_code_info, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.public_dependency != null && message.public_dependency.length) - for (let i = 0; i < message.public_dependency.length; ++i) - writer.uint32(/* id 10, wireType 0 =*/80).int32(message.public_dependency[i]); - if (message.weak_dependency != null && message.weak_dependency.length) - for (let i = 0; i < message.weak_dependency.length; ++i) - writer.uint32(/* id 11, wireType 0 =*/88).int32(message.weak_dependency[i]); - if (message.syntax != null && Object.hasOwnProperty.call(message, "syntax")) - writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); - return writer; - }; - - /** - * Encodes the specified FileDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.FileDescriptorProto - * @static - * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FileDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FileDescriptorProto message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.FileDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FileDescriptorProto.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorProto(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message["package"] = reader.string(); - break; - case 3: - if (!(message.dependency && message.dependency.length)) - message.dependency = []; - message.dependency.push(reader.string()); - break; - case 10: - if (!(message.public_dependency && message.public_dependency.length)) - message.public_dependency = []; - if ((tag & 7) === 2) { - let end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.public_dependency.push(reader.int32()); - } else - message.public_dependency.push(reader.int32()); - break; - case 11: - if (!(message.weak_dependency && message.weak_dependency.length)) - message.weak_dependency = []; - if ((tag & 7) === 2) { - let end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.weak_dependency.push(reader.int32()); - } else - message.weak_dependency.push(reader.int32()); - break; - case 4: - if (!(message.message_type && message.message_type.length)) - message.message_type = []; - message.message_type.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); - break; - case 5: - if (!(message.enum_type && message.enum_type.length)) - message.enum_type = []; - message.enum_type.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); - break; - case 6: - if (!(message.service && message.service.length)) - message.service = []; - message.service.push($root.google.protobuf.ServiceDescriptorProto.decode(reader, reader.uint32())); - break; - case 7: - if (!(message.extension && message.extension.length)) - message.extension = []; - message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); - break; - case 8: - message.options = $root.google.protobuf.FileOptions.decode(reader, reader.uint32()); - break; - case 9: - message.source_code_info = $root.google.protobuf.SourceCodeInfo.decode(reader, reader.uint32()); - break; - case 12: - message.syntax = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FileDescriptorProto message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.FileDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FileDescriptorProto.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FileDescriptorProto message. - * @function verify - * @memberof google.protobuf.FileDescriptorProto - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FileDescriptorProto.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message["package"] != null && message.hasOwnProperty("package")) - if (!$util.isString(message["package"])) - return "package: string expected"; - if (message.dependency != null && message.hasOwnProperty("dependency")) { - if (!Array.isArray(message.dependency)) - return "dependency: array expected"; - for (let i = 0; i < message.dependency.length; ++i) - if (!$util.isString(message.dependency[i])) - return "dependency: string[] expected"; - } - if (message.public_dependency != null && message.hasOwnProperty("public_dependency")) { - if (!Array.isArray(message.public_dependency)) - return "public_dependency: array expected"; - for (let i = 0; i < message.public_dependency.length; ++i) - if (!$util.isInteger(message.public_dependency[i])) - return "public_dependency: integer[] expected"; - } - if (message.weak_dependency != null && message.hasOwnProperty("weak_dependency")) { - if (!Array.isArray(message.weak_dependency)) - return "weak_dependency: array expected"; - for (let i = 0; i < message.weak_dependency.length; ++i) - if (!$util.isInteger(message.weak_dependency[i])) - return "weak_dependency: integer[] expected"; - } - if (message.message_type != null && message.hasOwnProperty("message_type")) { - if (!Array.isArray(message.message_type)) - return "message_type: array expected"; - for (let i = 0; i < message.message_type.length; ++i) { - let error = $root.google.protobuf.DescriptorProto.verify(message.message_type[i]); - if (error) - return "message_type." + error; - } - } - if (message.enum_type != null && message.hasOwnProperty("enum_type")) { - if (!Array.isArray(message.enum_type)) - return "enum_type: array expected"; - for (let i = 0; i < message.enum_type.length; ++i) { - let error = $root.google.protobuf.EnumDescriptorProto.verify(message.enum_type[i]); - if (error) - return "enum_type." + error; - } - } - if (message.service != null && message.hasOwnProperty("service")) { - if (!Array.isArray(message.service)) - return "service: array expected"; - for (let i = 0; i < message.service.length; ++i) { - let error = $root.google.protobuf.ServiceDescriptorProto.verify(message.service[i]); - if (error) - return "service." + error; - } - } - if (message.extension != null && message.hasOwnProperty("extension")) { - if (!Array.isArray(message.extension)) - return "extension: array expected"; - for (let i = 0; i < message.extension.length; ++i) { - let error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); - if (error) - return "extension." + error; - } - } - if (message.options != null && message.hasOwnProperty("options")) { - let error = $root.google.protobuf.FileOptions.verify(message.options); - if (error) - return "options." + error; - } - if (message.source_code_info != null && message.hasOwnProperty("source_code_info")) { - let error = $root.google.protobuf.SourceCodeInfo.verify(message.source_code_info); - if (error) - return "source_code_info." + error; - } - if (message.syntax != null && message.hasOwnProperty("syntax")) - if (!$util.isString(message.syntax)) - return "syntax: string expected"; - return null; - }; - - /** - * Creates a FileDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.FileDescriptorProto - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto - */ - FileDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FileDescriptorProto) - return object; - let message = new $root.google.protobuf.FileDescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object["package"] != null) - message["package"] = String(object["package"]); - if (object.dependency) { - if (!Array.isArray(object.dependency)) - throw TypeError(".google.protobuf.FileDescriptorProto.dependency: array expected"); - message.dependency = []; - for (let i = 0; i < object.dependency.length; ++i) - message.dependency[i] = String(object.dependency[i]); - } - if (object.public_dependency) { - if (!Array.isArray(object.public_dependency)) - throw TypeError(".google.protobuf.FileDescriptorProto.public_dependency: array expected"); - message.public_dependency = []; - for (let i = 0; i < object.public_dependency.length; ++i) - message.public_dependency[i] = object.public_dependency[i] | 0; - } - if (object.weak_dependency) { - if (!Array.isArray(object.weak_dependency)) - throw TypeError(".google.protobuf.FileDescriptorProto.weak_dependency: array expected"); - message.weak_dependency = []; - for (let i = 0; i < object.weak_dependency.length; ++i) - message.weak_dependency[i] = object.weak_dependency[i] | 0; - } - if (object.message_type) { - if (!Array.isArray(object.message_type)) - throw TypeError(".google.protobuf.FileDescriptorProto.message_type: array expected"); - message.message_type = []; - for (let i = 0; i < object.message_type.length; ++i) { - if (typeof object.message_type[i] !== "object") - throw TypeError(".google.protobuf.FileDescriptorProto.message_type: object expected"); - message.message_type[i] = $root.google.protobuf.DescriptorProto.fromObject(object.message_type[i]); - } - } - if (object.enum_type) { - if (!Array.isArray(object.enum_type)) - throw TypeError(".google.protobuf.FileDescriptorProto.enum_type: array expected"); - message.enum_type = []; - for (let i = 0; i < object.enum_type.length; ++i) { - if (typeof object.enum_type[i] !== "object") - throw TypeError(".google.protobuf.FileDescriptorProto.enum_type: object expected"); - message.enum_type[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enum_type[i]); - } - } - if (object.service) { - if (!Array.isArray(object.service)) - throw TypeError(".google.protobuf.FileDescriptorProto.service: array expected"); - message.service = []; - for (let i = 0; i < object.service.length; ++i) { - if (typeof object.service[i] !== "object") - throw TypeError(".google.protobuf.FileDescriptorProto.service: object expected"); - message.service[i] = $root.google.protobuf.ServiceDescriptorProto.fromObject(object.service[i]); - } - } - if (object.extension) { - if (!Array.isArray(object.extension)) - throw TypeError(".google.protobuf.FileDescriptorProto.extension: array expected"); - message.extension = []; - for (let i = 0; i < object.extension.length; ++i) { - if (typeof object.extension[i] !== "object") - throw TypeError(".google.protobuf.FileDescriptorProto.extension: object expected"); - message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); - } - } - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.FileDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.FileOptions.fromObject(object.options); - } - if (object.source_code_info != null) { - if (typeof object.source_code_info !== "object") - throw TypeError(".google.protobuf.FileDescriptorProto.source_code_info: object expected"); - message.source_code_info = $root.google.protobuf.SourceCodeInfo.fromObject(object.source_code_info); - } - if (object.syntax != null) - message.syntax = String(object.syntax); - return message; - }; - - /** - * Creates a plain object from a FileDescriptorProto message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.FileDescriptorProto - * @static - * @param {google.protobuf.FileDescriptorProto} message FileDescriptorProto - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FileDescriptorProto.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) { - object.dependency = []; - object.message_type = []; - object.enum_type = []; - object.service = []; - object.extension = []; - object.public_dependency = []; - object.weak_dependency = []; - } - if (options.defaults) { - object.name = ""; - object["package"] = ""; - object.options = null; - object.source_code_info = null; - object.syntax = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message["package"] != null && message.hasOwnProperty("package")) - object["package"] = message["package"]; - if (message.dependency && message.dependency.length) { - object.dependency = []; - for (let j = 0; j < message.dependency.length; ++j) - object.dependency[j] = message.dependency[j]; - } - if (message.message_type && message.message_type.length) { - object.message_type = []; - for (let j = 0; j < message.message_type.length; ++j) - object.message_type[j] = $root.google.protobuf.DescriptorProto.toObject(message.message_type[j], options); - } - if (message.enum_type && message.enum_type.length) { - object.enum_type = []; - for (let j = 0; j < message.enum_type.length; ++j) - object.enum_type[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enum_type[j], options); - } - if (message.service && message.service.length) { - object.service = []; - for (let j = 0; j < message.service.length; ++j) - object.service[j] = $root.google.protobuf.ServiceDescriptorProto.toObject(message.service[j], options); - } - if (message.extension && message.extension.length) { - object.extension = []; - for (let j = 0; j < message.extension.length; ++j) - object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); - } - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.FileOptions.toObject(message.options, options); - if (message.source_code_info != null && message.hasOwnProperty("source_code_info")) - object.source_code_info = $root.google.protobuf.SourceCodeInfo.toObject(message.source_code_info, options); - if (message.public_dependency && message.public_dependency.length) { - object.public_dependency = []; - for (let j = 0; j < message.public_dependency.length; ++j) - object.public_dependency[j] = message.public_dependency[j]; - } - if (message.weak_dependency && message.weak_dependency.length) { - object.weak_dependency = []; - for (let j = 0; j < message.weak_dependency.length; ++j) - object.weak_dependency[j] = message.weak_dependency[j]; - } - if (message.syntax != null && message.hasOwnProperty("syntax")) - object.syntax = message.syntax; - return object; - }; - - /** - * Converts this FileDescriptorProto to JSON. - * @function toJSON - * @memberof google.protobuf.FileDescriptorProto - * @instance - * @returns {Object.} JSON object - */ - FileDescriptorProto.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return FileDescriptorProto; - })(); - - protobuf.DescriptorProto = (function() { - - /** - * Properties of a DescriptorProto. - * @memberof google.protobuf - * @interface IDescriptorProto - * @property {string|null} [name] DescriptorProto name - * @property {Array.|null} [field] DescriptorProto field - * @property {Array.|null} [extension] DescriptorProto extension - * @property {Array.|null} [nested_type] DescriptorProto nested_type - * @property {Array.|null} [enum_type] DescriptorProto enum_type - * @property {Array.|null} [extension_range] DescriptorProto extension_range - * @property {Array.|null} [oneof_decl] DescriptorProto oneof_decl - * @property {google.protobuf.IMessageOptions|null} [options] DescriptorProto options - * @property {Array.|null} [reserved_range] DescriptorProto reserved_range - * @property {Array.|null} [reserved_name] DescriptorProto reserved_name - */ - - /** - * Constructs a new DescriptorProto. - * @memberof google.protobuf - * @classdesc Represents a DescriptorProto. - * @implements IDescriptorProto - * @constructor - * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set - */ - function DescriptorProto(properties) { - this.field = []; - this.extension = []; - this.nested_type = []; - this.enum_type = []; - this.extension_range = []; - this.oneof_decl = []; - this.reserved_range = []; - this.reserved_name = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DescriptorProto name. - * @member {string} name - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.name = ""; - - /** - * DescriptorProto field. - * @member {Array.} field - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.field = $util.emptyArray; - - /** - * DescriptorProto extension. - * @member {Array.} extension - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.extension = $util.emptyArray; - - /** - * DescriptorProto nested_type. - * @member {Array.} nested_type - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.nested_type = $util.emptyArray; - - /** - * DescriptorProto enum_type. - * @member {Array.} enum_type - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.enum_type = $util.emptyArray; - - /** - * DescriptorProto extension_range. - * @member {Array.} extension_range - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.extension_range = $util.emptyArray; - - /** - * DescriptorProto oneof_decl. - * @member {Array.} oneof_decl - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.oneof_decl = $util.emptyArray; - - /** - * DescriptorProto options. - * @member {google.protobuf.IMessageOptions|null|undefined} options - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.options = null; - - /** - * DescriptorProto reserved_range. - * @member {Array.} reserved_range - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.reserved_range = $util.emptyArray; - - /** - * DescriptorProto reserved_name. - * @member {Array.} reserved_name - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.reserved_name = $util.emptyArray; - - /** - * Encodes the specified DescriptorProto message. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. - * @function encode - * @memberof google.protobuf.DescriptorProto - * @static - * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DescriptorProto.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.field != null && message.field.length) - for (let i = 0; i < message.field.length; ++i) - $root.google.protobuf.FieldDescriptorProto.encode(message.field[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.nested_type != null && message.nested_type.length) - for (let i = 0; i < message.nested_type.length; ++i) - $root.google.protobuf.DescriptorProto.encode(message.nested_type[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.enum_type != null && message.enum_type.length) - for (let i = 0; i < message.enum_type.length; ++i) - $root.google.protobuf.EnumDescriptorProto.encode(message.enum_type[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.extension_range != null && message.extension_range.length) - for (let i = 0; i < message.extension_range.length; ++i) - $root.google.protobuf.DescriptorProto.ExtensionRange.encode(message.extension_range[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.extension != null && message.extension.length) - for (let i = 0; i < message.extension.length; ++i) - $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.MessageOptions.encode(message.options, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.oneof_decl != null && message.oneof_decl.length) - for (let i = 0; i < message.oneof_decl.length; ++i) - $root.google.protobuf.OneofDescriptorProto.encode(message.oneof_decl[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.reserved_range != null && message.reserved_range.length) - for (let i = 0; i < message.reserved_range.length; ++i) - $root.google.protobuf.DescriptorProto.ReservedRange.encode(message.reserved_range[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.reserved_name != null && message.reserved_name.length) - for (let i = 0; i < message.reserved_name.length; ++i) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.reserved_name[i]); - return writer; - }; - - /** - * Encodes the specified DescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.DescriptorProto - * @static - * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DescriptorProto message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.DescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.DescriptorProto} DescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DescriptorProto.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - if (!(message.field && message.field.length)) - message.field = []; - message.field.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); - break; - case 6: - if (!(message.extension && message.extension.length)) - message.extension = []; - message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.nested_type && message.nested_type.length)) - message.nested_type = []; - message.nested_type.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); - break; - case 4: - if (!(message.enum_type && message.enum_type.length)) - message.enum_type = []; - message.enum_type.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); - break; - case 5: - if (!(message.extension_range && message.extension_range.length)) - message.extension_range = []; - message.extension_range.push($root.google.protobuf.DescriptorProto.ExtensionRange.decode(reader, reader.uint32())); - break; - case 8: - if (!(message.oneof_decl && message.oneof_decl.length)) - message.oneof_decl = []; - message.oneof_decl.push($root.google.protobuf.OneofDescriptorProto.decode(reader, reader.uint32())); - break; - case 7: - message.options = $root.google.protobuf.MessageOptions.decode(reader, reader.uint32()); - break; - case 9: - if (!(message.reserved_range && message.reserved_range.length)) - message.reserved_range = []; - message.reserved_range.push($root.google.protobuf.DescriptorProto.ReservedRange.decode(reader, reader.uint32())); - break; - case 10: - if (!(message.reserved_name && message.reserved_name.length)) - message.reserved_name = []; - message.reserved_name.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DescriptorProto message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.DescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.DescriptorProto} DescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DescriptorProto.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DescriptorProto message. - * @function verify - * @memberof google.protobuf.DescriptorProto - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DescriptorProto.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.field != null && message.hasOwnProperty("field")) { - if (!Array.isArray(message.field)) - return "field: array expected"; - for (let i = 0; i < message.field.length; ++i) { - let error = $root.google.protobuf.FieldDescriptorProto.verify(message.field[i]); - if (error) - return "field." + error; - } - } - if (message.extension != null && message.hasOwnProperty("extension")) { - if (!Array.isArray(message.extension)) - return "extension: array expected"; - for (let i = 0; i < message.extension.length; ++i) { - let error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); - if (error) - return "extension." + error; - } - } - if (message.nested_type != null && message.hasOwnProperty("nested_type")) { - if (!Array.isArray(message.nested_type)) - return "nested_type: array expected"; - for (let i = 0; i < message.nested_type.length; ++i) { - let error = $root.google.protobuf.DescriptorProto.verify(message.nested_type[i]); - if (error) - return "nested_type." + error; - } - } - if (message.enum_type != null && message.hasOwnProperty("enum_type")) { - if (!Array.isArray(message.enum_type)) - return "enum_type: array expected"; - for (let i = 0; i < message.enum_type.length; ++i) { - let error = $root.google.protobuf.EnumDescriptorProto.verify(message.enum_type[i]); - if (error) - return "enum_type." + error; - } - } - if (message.extension_range != null && message.hasOwnProperty("extension_range")) { - if (!Array.isArray(message.extension_range)) - return "extension_range: array expected"; - for (let i = 0; i < message.extension_range.length; ++i) { - let error = $root.google.protobuf.DescriptorProto.ExtensionRange.verify(message.extension_range[i]); - if (error) - return "extension_range." + error; - } - } - if (message.oneof_decl != null && message.hasOwnProperty("oneof_decl")) { - if (!Array.isArray(message.oneof_decl)) - return "oneof_decl: array expected"; - for (let i = 0; i < message.oneof_decl.length; ++i) { - let error = $root.google.protobuf.OneofDescriptorProto.verify(message.oneof_decl[i]); - if (error) - return "oneof_decl." + error; - } - } - if (message.options != null && message.hasOwnProperty("options")) { - let error = $root.google.protobuf.MessageOptions.verify(message.options); - if (error) - return "options." + error; - } - if (message.reserved_range != null && message.hasOwnProperty("reserved_range")) { - if (!Array.isArray(message.reserved_range)) - return "reserved_range: array expected"; - for (let i = 0; i < message.reserved_range.length; ++i) { - let error = $root.google.protobuf.DescriptorProto.ReservedRange.verify(message.reserved_range[i]); - if (error) - return "reserved_range." + error; - } - } - if (message.reserved_name != null && message.hasOwnProperty("reserved_name")) { - if (!Array.isArray(message.reserved_name)) - return "reserved_name: array expected"; - for (let i = 0; i < message.reserved_name.length; ++i) - if (!$util.isString(message.reserved_name[i])) - return "reserved_name: string[] expected"; - } - return null; - }; - - /** - * Creates a DescriptorProto message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.DescriptorProto - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.DescriptorProto} DescriptorProto - */ - DescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.DescriptorProto) - return object; - let message = new $root.google.protobuf.DescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object.field) { - if (!Array.isArray(object.field)) - throw TypeError(".google.protobuf.DescriptorProto.field: array expected"); - message.field = []; - for (let i = 0; i < object.field.length; ++i) { - if (typeof object.field[i] !== "object") - throw TypeError(".google.protobuf.DescriptorProto.field: object expected"); - message.field[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.field[i]); - } - } - if (object.extension) { - if (!Array.isArray(object.extension)) - throw TypeError(".google.protobuf.DescriptorProto.extension: array expected"); - message.extension = []; - for (let i = 0; i < object.extension.length; ++i) { - if (typeof object.extension[i] !== "object") - throw TypeError(".google.protobuf.DescriptorProto.extension: object expected"); - message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); - } - } - if (object.nested_type) { - if (!Array.isArray(object.nested_type)) - throw TypeError(".google.protobuf.DescriptorProto.nested_type: array expected"); - message.nested_type = []; - for (let i = 0; i < object.nested_type.length; ++i) { - if (typeof object.nested_type[i] !== "object") - throw TypeError(".google.protobuf.DescriptorProto.nested_type: object expected"); - message.nested_type[i] = $root.google.protobuf.DescriptorProto.fromObject(object.nested_type[i]); - } - } - if (object.enum_type) { - if (!Array.isArray(object.enum_type)) - throw TypeError(".google.protobuf.DescriptorProto.enum_type: array expected"); - message.enum_type = []; - for (let i = 0; i < object.enum_type.length; ++i) { - if (typeof object.enum_type[i] !== "object") - throw TypeError(".google.protobuf.DescriptorProto.enum_type: object expected"); - message.enum_type[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enum_type[i]); - } - } - if (object.extension_range) { - if (!Array.isArray(object.extension_range)) - throw TypeError(".google.protobuf.DescriptorProto.extension_range: array expected"); - message.extension_range = []; - for (let i = 0; i < object.extension_range.length; ++i) { - if (typeof object.extension_range[i] !== "object") - throw TypeError(".google.protobuf.DescriptorProto.extension_range: object expected"); - message.extension_range[i] = $root.google.protobuf.DescriptorProto.ExtensionRange.fromObject(object.extension_range[i]); - } - } - if (object.oneof_decl) { - if (!Array.isArray(object.oneof_decl)) - throw TypeError(".google.protobuf.DescriptorProto.oneof_decl: array expected"); - message.oneof_decl = []; - for (let i = 0; i < object.oneof_decl.length; ++i) { - if (typeof object.oneof_decl[i] !== "object") - throw TypeError(".google.protobuf.DescriptorProto.oneof_decl: object expected"); - message.oneof_decl[i] = $root.google.protobuf.OneofDescriptorProto.fromObject(object.oneof_decl[i]); - } - } - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.DescriptorProto.options: object expected"); - message.options = $root.google.protobuf.MessageOptions.fromObject(object.options); - } - if (object.reserved_range) { - if (!Array.isArray(object.reserved_range)) - throw TypeError(".google.protobuf.DescriptorProto.reserved_range: array expected"); - message.reserved_range = []; - for (let i = 0; i < object.reserved_range.length; ++i) { - if (typeof object.reserved_range[i] !== "object") - throw TypeError(".google.protobuf.DescriptorProto.reserved_range: object expected"); - message.reserved_range[i] = $root.google.protobuf.DescriptorProto.ReservedRange.fromObject(object.reserved_range[i]); - } - } - if (object.reserved_name) { - if (!Array.isArray(object.reserved_name)) - throw TypeError(".google.protobuf.DescriptorProto.reserved_name: array expected"); - message.reserved_name = []; - for (let i = 0; i < object.reserved_name.length; ++i) - message.reserved_name[i] = String(object.reserved_name[i]); - } - return message; - }; - - /** - * Creates a plain object from a DescriptorProto message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.DescriptorProto - * @static - * @param {google.protobuf.DescriptorProto} message DescriptorProto - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DescriptorProto.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) { - object.field = []; - object.nested_type = []; - object.enum_type = []; - object.extension_range = []; - object.extension = []; - object.oneof_decl = []; - object.reserved_range = []; - object.reserved_name = []; - } - if (options.defaults) { - object.name = ""; - object.options = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.field && message.field.length) { - object.field = []; - for (let j = 0; j < message.field.length; ++j) - object.field[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.field[j], options); - } - if (message.nested_type && message.nested_type.length) { - object.nested_type = []; - for (let j = 0; j < message.nested_type.length; ++j) - object.nested_type[j] = $root.google.protobuf.DescriptorProto.toObject(message.nested_type[j], options); - } - if (message.enum_type && message.enum_type.length) { - object.enum_type = []; - for (let j = 0; j < message.enum_type.length; ++j) - object.enum_type[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enum_type[j], options); - } - if (message.extension_range && message.extension_range.length) { - object.extension_range = []; - for (let j = 0; j < message.extension_range.length; ++j) - object.extension_range[j] = $root.google.protobuf.DescriptorProto.ExtensionRange.toObject(message.extension_range[j], options); - } - if (message.extension && message.extension.length) { - object.extension = []; - for (let j = 0; j < message.extension.length; ++j) - object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); - } - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.MessageOptions.toObject(message.options, options); - if (message.oneof_decl && message.oneof_decl.length) { - object.oneof_decl = []; - for (let j = 0; j < message.oneof_decl.length; ++j) - object.oneof_decl[j] = $root.google.protobuf.OneofDescriptorProto.toObject(message.oneof_decl[j], options); - } - if (message.reserved_range && message.reserved_range.length) { - object.reserved_range = []; - for (let j = 0; j < message.reserved_range.length; ++j) - object.reserved_range[j] = $root.google.protobuf.DescriptorProto.ReservedRange.toObject(message.reserved_range[j], options); - } - if (message.reserved_name && message.reserved_name.length) { - object.reserved_name = []; - for (let j = 0; j < message.reserved_name.length; ++j) - object.reserved_name[j] = message.reserved_name[j]; - } - return object; - }; - - /** - * Converts this DescriptorProto to JSON. - * @function toJSON - * @memberof google.protobuf.DescriptorProto - * @instance - * @returns {Object.} JSON object - */ - DescriptorProto.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - DescriptorProto.ExtensionRange = (function() { - - /** - * Properties of an ExtensionRange. - * @memberof google.protobuf.DescriptorProto - * @interface IExtensionRange - * @property {number|null} [start] ExtensionRange start - * @property {number|null} [end] ExtensionRange end - */ - - /** - * Constructs a new ExtensionRange. - * @memberof google.protobuf.DescriptorProto - * @classdesc Represents an ExtensionRange. - * @implements IExtensionRange - * @constructor - * @param {google.protobuf.DescriptorProto.IExtensionRange=} [properties] Properties to set - */ - function ExtensionRange(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ExtensionRange start. - * @member {number} start - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @instance - */ - ExtensionRange.prototype.start = 0; - - /** - * ExtensionRange end. - * @member {number} end - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @instance - */ - ExtensionRange.prototype.end = 0; - - /** - * Encodes the specified ExtensionRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. - * @function encode - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExtensionRange.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.start != null && Object.hasOwnProperty.call(message, "start")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); - if (message.end != null && Object.hasOwnProperty.call(message, "end")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); - return writer; - }; - - /** - * Encodes the specified ExtensionRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExtensionRange.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ExtensionRange message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExtensionRange.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); - while (reader.pos < end) { - let 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; - }; - - /** - * Decodes an ExtensionRange message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExtensionRange.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ExtensionRange message. - * @function verify - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ExtensionRange.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.start != null && message.hasOwnProperty("start")) - if (!$util.isInteger(message.start)) - return "start: integer expected"; - if (message.end != null && message.hasOwnProperty("end")) - if (!$util.isInteger(message.end)) - return "end: integer expected"; - return null; - }; - - /** - * Creates an ExtensionRange message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange - */ - ExtensionRange.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.DescriptorProto.ExtensionRange) - return object; - let message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); - if (object.start != null) - message.start = object.start | 0; - if (object.end != null) - message.end = object.end | 0; - return message; - }; - - /** - * Creates a plain object from an ExtensionRange message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {google.protobuf.DescriptorProto.ExtensionRange} message ExtensionRange - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ExtensionRange.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.start = 0; - object.end = 0; - } - if (message.start != null && message.hasOwnProperty("start")) - object.start = message.start; - if (message.end != null && message.hasOwnProperty("end")) - object.end = message.end; - return object; - }; - - /** - * Converts this ExtensionRange to JSON. - * @function toJSON - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @instance - * @returns {Object.} JSON object - */ - ExtensionRange.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ExtensionRange; - })(); - - DescriptorProto.ReservedRange = (function() { - - /** - * Properties of a ReservedRange. - * @memberof google.protobuf.DescriptorProto - * @interface IReservedRange - * @property {number|null} [start] ReservedRange start - * @property {number|null} [end] ReservedRange end - */ - - /** - * Constructs a new ReservedRange. - * @memberof google.protobuf.DescriptorProto - * @classdesc Represents a ReservedRange. - * @implements IReservedRange - * @constructor - * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set - */ - function ReservedRange(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ReservedRange start. - * @member {number} start - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @instance - */ - ReservedRange.prototype.start = 0; - - /** - * ReservedRange end. - * @member {number} end - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @instance - */ - ReservedRange.prototype.end = 0; - - /** - * Encodes the specified ReservedRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. - * @function encode - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReservedRange.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.start != null && Object.hasOwnProperty.call(message, "start")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); - if (message.end != null && Object.hasOwnProperty.call(message, "end")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); - return writer; - }; - - /** - * Encodes the specified ReservedRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReservedRange.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ReservedRange message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReservedRange.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ReservedRange(); - while (reader.pos < end) { - let 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; - }; - - /** - * Decodes a ReservedRange message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReservedRange.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ReservedRange message. - * @function verify - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ReservedRange.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.start != null && message.hasOwnProperty("start")) - if (!$util.isInteger(message.start)) - return "start: integer expected"; - if (message.end != null && message.hasOwnProperty("end")) - if (!$util.isInteger(message.end)) - return "end: integer expected"; - return null; - }; - - /** - * Creates a ReservedRange message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange - */ - ReservedRange.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.DescriptorProto.ReservedRange) - return object; - let message = new $root.google.protobuf.DescriptorProto.ReservedRange(); - if (object.start != null) - message.start = object.start | 0; - if (object.end != null) - message.end = object.end | 0; - return message; - }; - - /** - * Creates a plain object from a ReservedRange message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {google.protobuf.DescriptorProto.ReservedRange} message ReservedRange - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ReservedRange.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.start = 0; - object.end = 0; - } - if (message.start != null && message.hasOwnProperty("start")) - object.start = message.start; - if (message.end != null && message.hasOwnProperty("end")) - object.end = message.end; - return object; - }; - - /** - * Converts this ReservedRange to JSON. - * @function toJSON - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @instance - * @returns {Object.} JSON object - */ - ReservedRange.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ReservedRange; - })(); - - return DescriptorProto; - })(); - - protobuf.FieldDescriptorProto = (function() { - - /** - * Properties of a FieldDescriptorProto. - * @memberof google.protobuf - * @interface IFieldDescriptorProto - * @property {string|null} [name] FieldDescriptorProto name - * @property {number|null} [number] FieldDescriptorProto number - * @property {google.protobuf.FieldDescriptorProto.Label|null} [label] FieldDescriptorProto label - * @property {google.protobuf.FieldDescriptorProto.Type|null} [type] FieldDescriptorProto type - * @property {string|null} [type_name] FieldDescriptorProto type_name - * @property {string|null} [extendee] FieldDescriptorProto extendee - * @property {string|null} [default_value] FieldDescriptorProto default_value - * @property {number|null} [oneof_index] FieldDescriptorProto oneof_index - * @property {string|null} [json_name] FieldDescriptorProto json_name - * @property {google.protobuf.IFieldOptions|null} [options] FieldDescriptorProto options - */ - - /** - * Constructs a new FieldDescriptorProto. - * @memberof google.protobuf - * @classdesc Represents a FieldDescriptorProto. - * @implements IFieldDescriptorProto - * @constructor - * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set - */ - function FieldDescriptorProto(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * FieldDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.name = ""; - - /** - * FieldDescriptorProto number. - * @member {number} number - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.number = 0; - - /** - * FieldDescriptorProto label. - * @member {google.protobuf.FieldDescriptorProto.Label} label - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.label = 1; - - /** - * FieldDescriptorProto type. - * @member {google.protobuf.FieldDescriptorProto.Type} type - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.type = 1; - - /** - * FieldDescriptorProto type_name. - * @member {string} type_name - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.type_name = ""; - - /** - * FieldDescriptorProto extendee. - * @member {string} extendee - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.extendee = ""; - - /** - * FieldDescriptorProto default_value. - * @member {string} default_value - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.default_value = ""; - - /** - * FieldDescriptorProto oneof_index. - * @member {number} oneof_index - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.oneof_index = 0; - - /** - * FieldDescriptorProto json_name. - * @member {string} json_name - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.json_name = ""; - - /** - * FieldDescriptorProto options. - * @member {google.protobuf.IFieldOptions|null|undefined} options - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.options = null; - - /** - * Encodes the specified FieldDescriptorProto message. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. - * @function encode - * @memberof google.protobuf.FieldDescriptorProto - * @static - * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FieldDescriptorProto.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.extendee != null && Object.hasOwnProperty.call(message, "extendee")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.extendee); - if (message.number != null && Object.hasOwnProperty.call(message, "number")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.number); - if (message.label != null && Object.hasOwnProperty.call(message, "label")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.label); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.type); - if (message.type_name != null && Object.hasOwnProperty.call(message, "type_name")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.type_name); - if (message.default_value != null && Object.hasOwnProperty.call(message, "default_value")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.default_value); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.FieldOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.oneof_index != null && Object.hasOwnProperty.call(message, "oneof_index")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.oneof_index); - if (message.json_name != null && Object.hasOwnProperty.call(message, "json_name")) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.json_name); - return writer; - }; - - /** - * Encodes the specified FieldDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.FieldDescriptorProto - * @static - * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FieldDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FieldDescriptorProto message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.FieldDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FieldDescriptorProto.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldDescriptorProto(); - while (reader.pos < end) { - let 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(); - break; - case 5: - message.type = reader.int32(); - break; - case 6: - message.type_name = reader.string(); - break; - case 2: - message.extendee = reader.string(); - break; - case 7: - message.default_value = reader.string(); - break; - case 9: - message.oneof_index = reader.int32(); - break; - case 10: - message.json_name = reader.string(); - break; - case 8: - message.options = $root.google.protobuf.FieldOptions.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FieldDescriptorProto message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.FieldDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FieldDescriptorProto.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FieldDescriptorProto message. - * @function verify - * @memberof google.protobuf.FieldDescriptorProto - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FieldDescriptorProto.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.number != null && message.hasOwnProperty("number")) - if (!$util.isInteger(message.number)) - return "number: integer expected"; - if (message.label != null && message.hasOwnProperty("label")) - switch (message.label) { - default: - return "label: enum value expected"; - case 1: - case 2: - case 3: - break; - } - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - break; - } - if (message.type_name != null && message.hasOwnProperty("type_name")) - if (!$util.isString(message.type_name)) - return "type_name: string expected"; - if (message.extendee != null && message.hasOwnProperty("extendee")) - if (!$util.isString(message.extendee)) - return "extendee: string expected"; - if (message.default_value != null && message.hasOwnProperty("default_value")) - if (!$util.isString(message.default_value)) - return "default_value: string expected"; - if (message.oneof_index != null && message.hasOwnProperty("oneof_index")) - if (!$util.isInteger(message.oneof_index)) - return "oneof_index: integer expected"; - if (message.json_name != null && message.hasOwnProperty("json_name")) - if (!$util.isString(message.json_name)) - return "json_name: string expected"; - if (message.options != null && message.hasOwnProperty("options")) { - let error = $root.google.protobuf.FieldOptions.verify(message.options); - if (error) - return "options." + error; - } - return null; - }; - - /** - * Creates a FieldDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.FieldDescriptorProto - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto - */ - FieldDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FieldDescriptorProto) - return object; - let message = new $root.google.protobuf.FieldDescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object.number != null) - message.number = object.number | 0; - switch (object.label) { - case "LABEL_OPTIONAL": - case 1: - message.label = 1; - break; - case "LABEL_REQUIRED": - case 2: - message.label = 2; - break; - case "LABEL_REPEATED": - case 3: - message.label = 3; - break; - } - switch (object.type) { - case "TYPE_DOUBLE": - case 1: - message.type = 1; - break; - case "TYPE_FLOAT": - case 2: - message.type = 2; - break; - case "TYPE_INT64": - case 3: - message.type = 3; - break; - case "TYPE_UINT64": - case 4: - message.type = 4; - break; - case "TYPE_INT32": - case 5: - message.type = 5; - break; - case "TYPE_FIXED64": - case 6: - message.type = 6; - break; - case "TYPE_FIXED32": - case 7: - message.type = 7; - break; - case "TYPE_BOOL": - case 8: - message.type = 8; - break; - case "TYPE_STRING": - case 9: - message.type = 9; - break; - case "TYPE_GROUP": - case 10: - message.type = 10; - break; - case "TYPE_MESSAGE": - case 11: - message.type = 11; - break; - case "TYPE_BYTES": - case 12: - message.type = 12; - break; - case "TYPE_UINT32": - case 13: - message.type = 13; - break; - case "TYPE_ENUM": - case 14: - message.type = 14; - break; - case "TYPE_SFIXED32": - case 15: - message.type = 15; - break; - case "TYPE_SFIXED64": - case 16: - message.type = 16; - break; - case "TYPE_SINT32": - case 17: - message.type = 17; - break; - case "TYPE_SINT64": - case 18: - message.type = 18; - break; - } - if (object.type_name != null) - message.type_name = String(object.type_name); - if (object.extendee != null) - message.extendee = String(object.extendee); - if (object.default_value != null) - message.default_value = String(object.default_value); - if (object.oneof_index != null) - message.oneof_index = object.oneof_index | 0; - if (object.json_name != null) - message.json_name = String(object.json_name); - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.FieldDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.FieldOptions.fromObject(object.options); - } - return message; - }; - - /** - * Creates a plain object from a FieldDescriptorProto message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.FieldDescriptorProto - * @static - * @param {google.protobuf.FieldDescriptorProto} message FieldDescriptorProto - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FieldDescriptorProto.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.name = ""; - object.extendee = ""; - object.number = 0; - object.label = options.enums === String ? "LABEL_OPTIONAL" : 1; - object.type = options.enums === String ? "TYPE_DOUBLE" : 1; - object.type_name = ""; - object.default_value = ""; - object.options = null; - object.oneof_index = 0; - object.json_name = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.extendee != null && message.hasOwnProperty("extendee")) - object.extendee = message.extendee; - if (message.number != null && message.hasOwnProperty("number")) - object.number = message.number; - if (message.label != null && message.hasOwnProperty("label")) - object.label = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Label[message.label] : message.label; - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Type[message.type] : message.type; - if (message.type_name != null && message.hasOwnProperty("type_name")) - object.type_name = message.type_name; - if (message.default_value != null && message.hasOwnProperty("default_value")) - object.default_value = message.default_value; - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.FieldOptions.toObject(message.options, options); - if (message.oneof_index != null && message.hasOwnProperty("oneof_index")) - object.oneof_index = message.oneof_index; - if (message.json_name != null && message.hasOwnProperty("json_name")) - object.json_name = message.json_name; - return object; - }; - - /** - * Converts this FieldDescriptorProto to JSON. - * @function toJSON - * @memberof google.protobuf.FieldDescriptorProto - * @instance - * @returns {Object.} JSON object - */ - FieldDescriptorProto.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Type enum. - * @name google.protobuf.FieldDescriptorProto.Type - * @enum {number} - * @property {number} TYPE_DOUBLE=1 TYPE_DOUBLE value - * @property {number} TYPE_FLOAT=2 TYPE_FLOAT value - * @property {number} TYPE_INT64=3 TYPE_INT64 value - * @property {number} TYPE_UINT64=4 TYPE_UINT64 value - * @property {number} TYPE_INT32=5 TYPE_INT32 value - * @property {number} TYPE_FIXED64=6 TYPE_FIXED64 value - * @property {number} TYPE_FIXED32=7 TYPE_FIXED32 value - * @property {number} TYPE_BOOL=8 TYPE_BOOL value - * @property {number} TYPE_STRING=9 TYPE_STRING value - * @property {number} TYPE_GROUP=10 TYPE_GROUP value - * @property {number} TYPE_MESSAGE=11 TYPE_MESSAGE value - * @property {number} TYPE_BYTES=12 TYPE_BYTES value - * @property {number} TYPE_UINT32=13 TYPE_UINT32 value - * @property {number} TYPE_ENUM=14 TYPE_ENUM value - * @property {number} TYPE_SFIXED32=15 TYPE_SFIXED32 value - * @property {number} TYPE_SFIXED64=16 TYPE_SFIXED64 value - * @property {number} TYPE_SINT32=17 TYPE_SINT32 value - * @property {number} TYPE_SINT64=18 TYPE_SINT64 value - */ - FieldDescriptorProto.Type = (function() { - const valuesById = {}, values = Object.create(valuesById); - values[valuesById[1] = "TYPE_DOUBLE"] = 1; - values[valuesById[2] = "TYPE_FLOAT"] = 2; - values[valuesById[3] = "TYPE_INT64"] = 3; - values[valuesById[4] = "TYPE_UINT64"] = 4; - values[valuesById[5] = "TYPE_INT32"] = 5; - values[valuesById[6] = "TYPE_FIXED64"] = 6; - values[valuesById[7] = "TYPE_FIXED32"] = 7; - values[valuesById[8] = "TYPE_BOOL"] = 8; - values[valuesById[9] = "TYPE_STRING"] = 9; - values[valuesById[10] = "TYPE_GROUP"] = 10; - values[valuesById[11] = "TYPE_MESSAGE"] = 11; - values[valuesById[12] = "TYPE_BYTES"] = 12; - values[valuesById[13] = "TYPE_UINT32"] = 13; - values[valuesById[14] = "TYPE_ENUM"] = 14; - values[valuesById[15] = "TYPE_SFIXED32"] = 15; - values[valuesById[16] = "TYPE_SFIXED64"] = 16; - values[valuesById[17] = "TYPE_SINT32"] = 17; - values[valuesById[18] = "TYPE_SINT64"] = 18; - return values; - })(); - - /** - * Label enum. - * @name google.protobuf.FieldDescriptorProto.Label - * @enum {number} - * @property {number} LABEL_OPTIONAL=1 LABEL_OPTIONAL value - * @property {number} LABEL_REQUIRED=2 LABEL_REQUIRED value - * @property {number} LABEL_REPEATED=3 LABEL_REPEATED value - */ - FieldDescriptorProto.Label = (function() { - const valuesById = {}, values = Object.create(valuesById); - values[valuesById[1] = "LABEL_OPTIONAL"] = 1; - values[valuesById[2] = "LABEL_REQUIRED"] = 2; - values[valuesById[3] = "LABEL_REPEATED"] = 3; - return values; - })(); - - return FieldDescriptorProto; - })(); - - protobuf.OneofDescriptorProto = (function() { - - /** - * Properties of an OneofDescriptorProto. - * @memberof google.protobuf - * @interface IOneofDescriptorProto - * @property {string|null} [name] OneofDescriptorProto name - * @property {google.protobuf.IOneofOptions|null} [options] OneofDescriptorProto options - */ - - /** - * Constructs a new OneofDescriptorProto. - * @memberof google.protobuf - * @classdesc Represents an OneofDescriptorProto. - * @implements IOneofDescriptorProto - * @constructor - * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set - */ - function OneofDescriptorProto(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * OneofDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.OneofDescriptorProto - * @instance - */ - OneofDescriptorProto.prototype.name = ""; - - /** - * OneofDescriptorProto options. - * @member {google.protobuf.IOneofOptions|null|undefined} options - * @memberof google.protobuf.OneofDescriptorProto - * @instance - */ - OneofDescriptorProto.prototype.options = null; - - /** - * Encodes the specified OneofDescriptorProto message. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. - * @function encode - * @memberof google.protobuf.OneofDescriptorProto - * @static - * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OneofDescriptorProto.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.OneofOptions.encode(message.options, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified OneofDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.OneofDescriptorProto - * @static - * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OneofDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an OneofDescriptorProto message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.OneofDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OneofDescriptorProto.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofDescriptorProto(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.options = $root.google.protobuf.OneofOptions.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an OneofDescriptorProto message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.OneofDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OneofDescriptorProto.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an OneofDescriptorProto message. - * @function verify - * @memberof google.protobuf.OneofDescriptorProto - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - OneofDescriptorProto.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.options != null && message.hasOwnProperty("options")) { - let error = $root.google.protobuf.OneofOptions.verify(message.options); - if (error) - return "options." + error; - } - return null; - }; - - /** - * Creates an OneofDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.OneofDescriptorProto - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto - */ - OneofDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.OneofDescriptorProto) - return object; - let message = new $root.google.protobuf.OneofDescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.OneofDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.OneofOptions.fromObject(object.options); - } - return message; - }; - - /** - * Creates a plain object from an OneofDescriptorProto message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.OneofDescriptorProto - * @static - * @param {google.protobuf.OneofDescriptorProto} message OneofDescriptorProto - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - OneofDescriptorProto.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.name = ""; - object.options = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.OneofOptions.toObject(message.options, options); - return object; - }; - - /** - * Converts this OneofDescriptorProto to JSON. - * @function toJSON - * @memberof google.protobuf.OneofDescriptorProto - * @instance - * @returns {Object.} JSON object - */ - OneofDescriptorProto.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return OneofDescriptorProto; - })(); - - protobuf.EnumDescriptorProto = (function() { - - /** - * Properties of an EnumDescriptorProto. - * @memberof google.protobuf - * @interface IEnumDescriptorProto - * @property {string|null} [name] EnumDescriptorProto name - * @property {Array.|null} [value] EnumDescriptorProto value - * @property {google.protobuf.IEnumOptions|null} [options] EnumDescriptorProto options - */ - - /** - * Constructs a new EnumDescriptorProto. - * @memberof google.protobuf - * @classdesc Represents an EnumDescriptorProto. - * @implements IEnumDescriptorProto - * @constructor - * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set - */ - function EnumDescriptorProto(properties) { - this.value = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * EnumDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.EnumDescriptorProto - * @instance - */ - EnumDescriptorProto.prototype.name = ""; - - /** - * EnumDescriptorProto value. - * @member {Array.} value - * @memberof google.protobuf.EnumDescriptorProto - * @instance - */ - EnumDescriptorProto.prototype.value = $util.emptyArray; - - /** - * EnumDescriptorProto options. - * @member {google.protobuf.IEnumOptions|null|undefined} options - * @memberof google.protobuf.EnumDescriptorProto - * @instance - */ - EnumDescriptorProto.prototype.options = null; - - /** - * Encodes the specified EnumDescriptorProto message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. - * @function encode - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumDescriptorProto.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.value != null && message.value.length) - for (let i = 0; i < message.value.length; ++i) - $root.google.protobuf.EnumValueDescriptorProto.encode(message.value[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.EnumOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified EnumDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an EnumDescriptorProto message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumDescriptorProto.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - if (!(message.value && message.value.length)) - message.value = []; - message.value.push($root.google.protobuf.EnumValueDescriptorProto.decode(reader, reader.uint32())); - break; - case 3: - message.options = $root.google.protobuf.EnumOptions.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an EnumDescriptorProto message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumDescriptorProto.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an EnumDescriptorProto message. - * @function verify - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - EnumDescriptorProto.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.value != null && message.hasOwnProperty("value")) { - if (!Array.isArray(message.value)) - return "value: array expected"; - for (let i = 0; i < message.value.length; ++i) { - let error = $root.google.protobuf.EnumValueDescriptorProto.verify(message.value[i]); - if (error) - return "value." + error; - } - } - if (message.options != null && message.hasOwnProperty("options")) { - let error = $root.google.protobuf.EnumOptions.verify(message.options); - if (error) - return "options." + error; - } - return null; - }; - - /** - * Creates an EnumDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto - */ - EnumDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.EnumDescriptorProto) - return object; - let message = new $root.google.protobuf.EnumDescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object.value) { - if (!Array.isArray(object.value)) - throw TypeError(".google.protobuf.EnumDescriptorProto.value: array expected"); - message.value = []; - for (let i = 0; i < object.value.length; ++i) { - if (typeof object.value[i] !== "object") - throw TypeError(".google.protobuf.EnumDescriptorProto.value: object expected"); - message.value[i] = $root.google.protobuf.EnumValueDescriptorProto.fromObject(object.value[i]); - } - } - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.EnumDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.EnumOptions.fromObject(object.options); - } - return message; - }; - - /** - * Creates a plain object from an EnumDescriptorProto message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {google.protobuf.EnumDescriptorProto} message EnumDescriptorProto - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - EnumDescriptorProto.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.value = []; - if (options.defaults) { - object.name = ""; - object.options = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.value && message.value.length) { - object.value = []; - for (let j = 0; j < message.value.length; ++j) - object.value[j] = $root.google.protobuf.EnumValueDescriptorProto.toObject(message.value[j], options); - } - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.EnumOptions.toObject(message.options, options); - return object; - }; - - /** - * Converts this EnumDescriptorProto to JSON. - * @function toJSON - * @memberof google.protobuf.EnumDescriptorProto - * @instance - * @returns {Object.} JSON object - */ - EnumDescriptorProto.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return EnumDescriptorProto; - })(); - - protobuf.EnumValueDescriptorProto = (function() { - - /** - * Properties of an EnumValueDescriptorProto. - * @memberof google.protobuf - * @interface IEnumValueDescriptorProto - * @property {string|null} [name] EnumValueDescriptorProto name - * @property {number|null} [number] EnumValueDescriptorProto number - * @property {google.protobuf.IEnumValueOptions|null} [options] EnumValueDescriptorProto options - */ - - /** - * Constructs a new EnumValueDescriptorProto. - * @memberof google.protobuf - * @classdesc Represents an EnumValueDescriptorProto. - * @implements IEnumValueDescriptorProto - * @constructor - * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set - */ - function EnumValueDescriptorProto(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * EnumValueDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.EnumValueDescriptorProto - * @instance - */ - EnumValueDescriptorProto.prototype.name = ""; - - /** - * EnumValueDescriptorProto number. - * @member {number} number - * @memberof google.protobuf.EnumValueDescriptorProto - * @instance - */ - EnumValueDescriptorProto.prototype.number = 0; - - /** - * EnumValueDescriptorProto options. - * @member {google.protobuf.IEnumValueOptions|null|undefined} options - * @memberof google.protobuf.EnumValueDescriptorProto - * @instance - */ - EnumValueDescriptorProto.prototype.options = null; - - /** - * Encodes the specified EnumValueDescriptorProto message. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. - * @function encode - * @memberof google.protobuf.EnumValueDescriptorProto - * @static - * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumValueDescriptorProto.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.number != null && Object.hasOwnProperty.call(message, "number")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.number); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.EnumValueOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified EnumValueDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.EnumValueDescriptorProto - * @static - * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumValueDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an EnumValueDescriptorProto message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.EnumValueDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumValueDescriptorProto.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueDescriptorProto(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.number = reader.int32(); - break; - case 3: - message.options = $root.google.protobuf.EnumValueOptions.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an EnumValueDescriptorProto message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.EnumValueDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumValueDescriptorProto.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an EnumValueDescriptorProto message. - * @function verify - * @memberof google.protobuf.EnumValueDescriptorProto - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - EnumValueDescriptorProto.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.number != null && message.hasOwnProperty("number")) - if (!$util.isInteger(message.number)) - return "number: integer expected"; - if (message.options != null && message.hasOwnProperty("options")) { - let error = $root.google.protobuf.EnumValueOptions.verify(message.options); - if (error) - return "options." + error; - } - return null; - }; - - /** - * Creates an EnumValueDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.EnumValueDescriptorProto - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto - */ - EnumValueDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.EnumValueDescriptorProto) - return object; - let message = new $root.google.protobuf.EnumValueDescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object.number != null) - message.number = object.number | 0; - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.EnumValueDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.EnumValueOptions.fromObject(object.options); - } - return message; - }; - - /** - * Creates a plain object from an EnumValueDescriptorProto message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.EnumValueDescriptorProto - * @static - * @param {google.protobuf.EnumValueDescriptorProto} message EnumValueDescriptorProto - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - EnumValueDescriptorProto.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.name = ""; - object.number = 0; - object.options = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.number != null && message.hasOwnProperty("number")) - object.number = message.number; - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.EnumValueOptions.toObject(message.options, options); - return object; - }; - - /** - * Converts this EnumValueDescriptorProto to JSON. - * @function toJSON - * @memberof google.protobuf.EnumValueDescriptorProto - * @instance - * @returns {Object.} JSON object - */ - EnumValueDescriptorProto.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return EnumValueDescriptorProto; - })(); - - protobuf.ServiceDescriptorProto = (function() { - - /** - * Properties of a ServiceDescriptorProto. - * @memberof google.protobuf - * @interface IServiceDescriptorProto - * @property {string|null} [name] ServiceDescriptorProto name - * @property {Array.|null} [method] ServiceDescriptorProto method - * @property {google.protobuf.IServiceOptions|null} [options] ServiceDescriptorProto options - */ - - /** - * Constructs a new ServiceDescriptorProto. - * @memberof google.protobuf - * @classdesc Represents a ServiceDescriptorProto. - * @implements IServiceDescriptorProto - * @constructor - * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set - */ - function ServiceDescriptorProto(properties) { - this.method = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ServiceDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.ServiceDescriptorProto - * @instance - */ - ServiceDescriptorProto.prototype.name = ""; - - /** - * ServiceDescriptorProto method. - * @member {Array.} method - * @memberof google.protobuf.ServiceDescriptorProto - * @instance - */ - ServiceDescriptorProto.prototype.method = $util.emptyArray; - - /** - * ServiceDescriptorProto options. - * @member {google.protobuf.IServiceOptions|null|undefined} options - * @memberof google.protobuf.ServiceDescriptorProto - * @instance - */ - ServiceDescriptorProto.prototype.options = null; - - /** - * Encodes the specified ServiceDescriptorProto message. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. - * @function encode - * @memberof google.protobuf.ServiceDescriptorProto - * @static - * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ServiceDescriptorProto.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.method != null && message.method.length) - for (let i = 0; i < message.method.length; ++i) - $root.google.protobuf.MethodDescriptorProto.encode(message.method[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.ServiceOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ServiceDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.ServiceDescriptorProto - * @static - * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ServiceDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ServiceDescriptorProto message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.ServiceDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ServiceDescriptorProto.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceDescriptorProto(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - if (!(message.method && message.method.length)) - message.method = []; - message.method.push($root.google.protobuf.MethodDescriptorProto.decode(reader, reader.uint32())); - break; - case 3: - message.options = $root.google.protobuf.ServiceOptions.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ServiceDescriptorProto message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.ServiceDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ServiceDescriptorProto.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ServiceDescriptorProto message. - * @function verify - * @memberof google.protobuf.ServiceDescriptorProto - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ServiceDescriptorProto.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.method != null && message.hasOwnProperty("method")) { - if (!Array.isArray(message.method)) - return "method: array expected"; - for (let i = 0; i < message.method.length; ++i) { - let error = $root.google.protobuf.MethodDescriptorProto.verify(message.method[i]); - if (error) - return "method." + error; - } - } - if (message.options != null && message.hasOwnProperty("options")) { - let error = $root.google.protobuf.ServiceOptions.verify(message.options); - if (error) - return "options." + error; - } - return null; - }; - - /** - * Creates a ServiceDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.ServiceDescriptorProto - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto - */ - ServiceDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.ServiceDescriptorProto) - return object; - let message = new $root.google.protobuf.ServiceDescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object.method) { - if (!Array.isArray(object.method)) - throw TypeError(".google.protobuf.ServiceDescriptorProto.method: array expected"); - message.method = []; - for (let i = 0; i < object.method.length; ++i) { - if (typeof object.method[i] !== "object") - throw TypeError(".google.protobuf.ServiceDescriptorProto.method: object expected"); - message.method[i] = $root.google.protobuf.MethodDescriptorProto.fromObject(object.method[i]); - } - } - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.ServiceDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.ServiceOptions.fromObject(object.options); - } - return message; - }; - - /** - * Creates a plain object from a ServiceDescriptorProto message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.ServiceDescriptorProto - * @static - * @param {google.protobuf.ServiceDescriptorProto} message ServiceDescriptorProto - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ServiceDescriptorProto.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.method = []; - if (options.defaults) { - object.name = ""; - object.options = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.method && message.method.length) { - object.method = []; - for (let j = 0; j < message.method.length; ++j) - object.method[j] = $root.google.protobuf.MethodDescriptorProto.toObject(message.method[j], options); - } - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.ServiceOptions.toObject(message.options, options); - return object; - }; - - /** - * Converts this ServiceDescriptorProto to JSON. - * @function toJSON - * @memberof google.protobuf.ServiceDescriptorProto - * @instance - * @returns {Object.} JSON object - */ - ServiceDescriptorProto.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ServiceDescriptorProto; - })(); - - protobuf.MethodDescriptorProto = (function() { - - /** - * Properties of a MethodDescriptorProto. - * @memberof google.protobuf - * @interface IMethodDescriptorProto - * @property {string|null} [name] MethodDescriptorProto name - * @property {string|null} [input_type] MethodDescriptorProto input_type - * @property {string|null} [output_type] MethodDescriptorProto output_type - * @property {google.protobuf.IMethodOptions|null} [options] MethodDescriptorProto options - * @property {boolean|null} [client_streaming] MethodDescriptorProto client_streaming - * @property {boolean|null} [server_streaming] MethodDescriptorProto server_streaming - */ - - /** - * Constructs a new MethodDescriptorProto. - * @memberof google.protobuf - * @classdesc Represents a MethodDescriptorProto. - * @implements IMethodDescriptorProto - * @constructor - * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set - */ - function MethodDescriptorProto(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MethodDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.MethodDescriptorProto - * @instance - */ - MethodDescriptorProto.prototype.name = ""; - - /** - * MethodDescriptorProto input_type. - * @member {string} input_type - * @memberof google.protobuf.MethodDescriptorProto - * @instance - */ - MethodDescriptorProto.prototype.input_type = ""; - - /** - * MethodDescriptorProto output_type. - * @member {string} output_type - * @memberof google.protobuf.MethodDescriptorProto - * @instance - */ - MethodDescriptorProto.prototype.output_type = ""; - - /** - * MethodDescriptorProto options. - * @member {google.protobuf.IMethodOptions|null|undefined} options - * @memberof google.protobuf.MethodDescriptorProto - * @instance - */ - MethodDescriptorProto.prototype.options = null; - - /** - * MethodDescriptorProto client_streaming. - * @member {boolean} client_streaming - * @memberof google.protobuf.MethodDescriptorProto - * @instance - */ - MethodDescriptorProto.prototype.client_streaming = false; - - /** - * MethodDescriptorProto server_streaming. - * @member {boolean} server_streaming - * @memberof google.protobuf.MethodDescriptorProto - * @instance - */ - MethodDescriptorProto.prototype.server_streaming = false; - - /** - * Encodes the specified MethodDescriptorProto message. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. - * @function encode - * @memberof google.protobuf.MethodDescriptorProto - * @static - * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MethodDescriptorProto.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.input_type != null && Object.hasOwnProperty.call(message, "input_type")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.input_type); - if (message.output_type != null && Object.hasOwnProperty.call(message, "output_type")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.output_type); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.MethodOptions.encode(message.options, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.client_streaming != null && Object.hasOwnProperty.call(message, "client_streaming")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.client_streaming); - if (message.server_streaming != null && Object.hasOwnProperty.call(message, "server_streaming")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.server_streaming); - return writer; - }; - - /** - * Encodes the specified MethodDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.MethodDescriptorProto - * @static - * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MethodDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MethodDescriptorProto message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.MethodDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MethodDescriptorProto.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodDescriptorProto(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.input_type = reader.string(); - break; - case 3: - message.output_type = reader.string(); - break; - case 4: - message.options = $root.google.protobuf.MethodOptions.decode(reader, reader.uint32()); - break; - case 5: - message.client_streaming = reader.bool(); - break; - case 6: - message.server_streaming = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MethodDescriptorProto message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.MethodDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MethodDescriptorProto.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MethodDescriptorProto message. - * @function verify - * @memberof google.protobuf.MethodDescriptorProto - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MethodDescriptorProto.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.input_type != null && message.hasOwnProperty("input_type")) - if (!$util.isString(message.input_type)) - return "input_type: string expected"; - if (message.output_type != null && message.hasOwnProperty("output_type")) - if (!$util.isString(message.output_type)) - return "output_type: string expected"; - if (message.options != null && message.hasOwnProperty("options")) { - let error = $root.google.protobuf.MethodOptions.verify(message.options); - if (error) - return "options." + error; - } - if (message.client_streaming != null && message.hasOwnProperty("client_streaming")) - if (typeof message.client_streaming !== "boolean") - return "client_streaming: boolean expected"; - if (message.server_streaming != null && message.hasOwnProperty("server_streaming")) - if (typeof message.server_streaming !== "boolean") - return "server_streaming: boolean expected"; - return null; - }; - - /** - * Creates a MethodDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.MethodDescriptorProto - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto - */ - MethodDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.MethodDescriptorProto) - return object; - let message = new $root.google.protobuf.MethodDescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object.input_type != null) - message.input_type = String(object.input_type); - if (object.output_type != null) - message.output_type = String(object.output_type); - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.MethodDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.MethodOptions.fromObject(object.options); - } - if (object.client_streaming != null) - message.client_streaming = Boolean(object.client_streaming); - if (object.server_streaming != null) - message.server_streaming = Boolean(object.server_streaming); - return message; - }; - - /** - * Creates a plain object from a MethodDescriptorProto message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.MethodDescriptorProto - * @static - * @param {google.protobuf.MethodDescriptorProto} message MethodDescriptorProto - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MethodDescriptorProto.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.name = ""; - object.input_type = ""; - object.output_type = ""; - object.options = null; - object.client_streaming = false; - object.server_streaming = false; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.input_type != null && message.hasOwnProperty("input_type")) - object.input_type = message.input_type; - if (message.output_type != null && message.hasOwnProperty("output_type")) - object.output_type = message.output_type; - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.MethodOptions.toObject(message.options, options); - if (message.client_streaming != null && message.hasOwnProperty("client_streaming")) - object.client_streaming = message.client_streaming; - if (message.server_streaming != null && message.hasOwnProperty("server_streaming")) - object.server_streaming = message.server_streaming; - return object; - }; - - /** - * Converts this MethodDescriptorProto to JSON. - * @function toJSON - * @memberof google.protobuf.MethodDescriptorProto - * @instance - * @returns {Object.} JSON object - */ - MethodDescriptorProto.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MethodDescriptorProto; - })(); - - protobuf.FileOptions = (function() { - - /** - * Properties of a FileOptions. - * @memberof google.protobuf - * @interface IFileOptions - * @property {string|null} [java_package] FileOptions java_package - * @property {string|null} [java_outer_classname] FileOptions java_outer_classname - * @property {boolean|null} [java_multiple_files] FileOptions java_multiple_files - * @property {boolean|null} [java_generate_equals_and_hash] FileOptions java_generate_equals_and_hash - * @property {boolean|null} [java_string_check_utf8] FileOptions java_string_check_utf8 - * @property {google.protobuf.FileOptions.OptimizeMode|null} [optimize_for] FileOptions optimize_for - * @property {string|null} [go_package] FileOptions go_package - * @property {boolean|null} [cc_generic_services] FileOptions cc_generic_services - * @property {boolean|null} [java_generic_services] FileOptions java_generic_services - * @property {boolean|null} [py_generic_services] FileOptions py_generic_services - * @property {boolean|null} [deprecated] FileOptions deprecated - * @property {boolean|null} [cc_enable_arenas] FileOptions cc_enable_arenas - * @property {string|null} [objc_class_prefix] FileOptions objc_class_prefix - * @property {string|null} [csharp_namespace] FileOptions csharp_namespace - * @property {Array.|null} [uninterpreted_option] FileOptions uninterpreted_option - * @property {boolean|null} [".gogoproto.goproto_getters_all"] FileOptions .gogoproto.goproto_getters_all - * @property {boolean|null} [".gogoproto.goproto_enum_prefix_all"] FileOptions .gogoproto.goproto_enum_prefix_all - * @property {boolean|null} [".gogoproto.goproto_stringer_all"] FileOptions .gogoproto.goproto_stringer_all - * @property {boolean|null} [".gogoproto.verbose_equal_all"] FileOptions .gogoproto.verbose_equal_all - * @property {boolean|null} [".gogoproto.face_all"] FileOptions .gogoproto.face_all - * @property {boolean|null} [".gogoproto.gostring_all"] FileOptions .gogoproto.gostring_all - * @property {boolean|null} [".gogoproto.populate_all"] FileOptions .gogoproto.populate_all - * @property {boolean|null} [".gogoproto.stringer_all"] FileOptions .gogoproto.stringer_all - * @property {boolean|null} [".gogoproto.onlyone_all"] FileOptions .gogoproto.onlyone_all - * @property {boolean|null} [".gogoproto.equal_all"] FileOptions .gogoproto.equal_all - * @property {boolean|null} [".gogoproto.description_all"] FileOptions .gogoproto.description_all - * @property {boolean|null} [".gogoproto.testgen_all"] FileOptions .gogoproto.testgen_all - * @property {boolean|null} [".gogoproto.benchgen_all"] FileOptions .gogoproto.benchgen_all - * @property {boolean|null} [".gogoproto.marshaler_all"] FileOptions .gogoproto.marshaler_all - * @property {boolean|null} [".gogoproto.unmarshaler_all"] FileOptions .gogoproto.unmarshaler_all - * @property {boolean|null} [".gogoproto.stable_marshaler_all"] FileOptions .gogoproto.stable_marshaler_all - * @property {boolean|null} [".gogoproto.sizer_all"] FileOptions .gogoproto.sizer_all - * @property {boolean|null} [".gogoproto.goproto_enum_stringer_all"] FileOptions .gogoproto.goproto_enum_stringer_all - * @property {boolean|null} [".gogoproto.enum_stringer_all"] FileOptions .gogoproto.enum_stringer_all - * @property {boolean|null} [".gogoproto.unsafe_marshaler_all"] FileOptions .gogoproto.unsafe_marshaler_all - * @property {boolean|null} [".gogoproto.unsafe_unmarshaler_all"] FileOptions .gogoproto.unsafe_unmarshaler_all - * @property {boolean|null} [".gogoproto.goproto_extensions_map_all"] FileOptions .gogoproto.goproto_extensions_map_all - * @property {boolean|null} [".gogoproto.goproto_unrecognized_all"] FileOptions .gogoproto.goproto_unrecognized_all - * @property {boolean|null} [".gogoproto.gogoproto_import"] FileOptions .gogoproto.gogoproto_import - * @property {boolean|null} [".gogoproto.protosizer_all"] FileOptions .gogoproto.protosizer_all - * @property {boolean|null} [".gogoproto.compare_all"] FileOptions .gogoproto.compare_all - * @property {boolean|null} [".gogoproto.typedecl_all"] FileOptions .gogoproto.typedecl_all - * @property {boolean|null} [".gogoproto.enumdecl_all"] FileOptions .gogoproto.enumdecl_all - * @property {boolean|null} [".gogoproto.goproto_registration"] FileOptions .gogoproto.goproto_registration - * @property {boolean|null} [".gogoproto.messagename_all"] FileOptions .gogoproto.messagename_all - * @property {boolean|null} [".gogoproto.goproto_sizecache_all"] FileOptions .gogoproto.goproto_sizecache_all - * @property {boolean|null} [".gogoproto.goproto_unkeyed_all"] FileOptions .gogoproto.goproto_unkeyed_all - */ - - /** - * Constructs a new FileOptions. - * @memberof google.protobuf - * @classdesc Represents a FileOptions. - * @implements IFileOptions - * @constructor - * @param {google.protobuf.IFileOptions=} [properties] Properties to set - */ - function FileOptions(properties) { - this.uninterpreted_option = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * FileOptions java_package. - * @member {string} java_package - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.java_package = ""; - - /** - * FileOptions java_outer_classname. - * @member {string} java_outer_classname - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.java_outer_classname = ""; - - /** - * FileOptions java_multiple_files. - * @member {boolean} java_multiple_files - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.java_multiple_files = false; - - /** - * FileOptions java_generate_equals_and_hash. - * @member {boolean} java_generate_equals_and_hash - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.java_generate_equals_and_hash = false; - - /** - * FileOptions java_string_check_utf8. - * @member {boolean} java_string_check_utf8 - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.java_string_check_utf8 = false; - - /** - * FileOptions optimize_for. - * @member {google.protobuf.FileOptions.OptimizeMode} optimize_for - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.optimize_for = 1; - - /** - * FileOptions go_package. - * @member {string} go_package - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.go_package = ""; - - /** - * FileOptions cc_generic_services. - * @member {boolean} cc_generic_services - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.cc_generic_services = false; - - /** - * FileOptions java_generic_services. - * @member {boolean} java_generic_services - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.java_generic_services = false; - - /** - * FileOptions py_generic_services. - * @member {boolean} py_generic_services - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.py_generic_services = false; - - /** - * FileOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.deprecated = false; - - /** - * FileOptions cc_enable_arenas. - * @member {boolean} cc_enable_arenas - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.cc_enable_arenas = false; - - /** - * FileOptions objc_class_prefix. - * @member {string} objc_class_prefix - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.objc_class_prefix = ""; - - /** - * FileOptions csharp_namespace. - * @member {string} csharp_namespace - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.csharp_namespace = ""; - - /** - * FileOptions uninterpreted_option. - * @member {Array.} uninterpreted_option - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.uninterpreted_option = $util.emptyArray; - - /** - * FileOptions .gogoproto.goproto_getters_all. - * @member {boolean} .gogoproto.goproto_getters_all - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.goproto_getters_all"] = false; - - /** - * FileOptions .gogoproto.goproto_enum_prefix_all. - * @member {boolean} .gogoproto.goproto_enum_prefix_all - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.goproto_enum_prefix_all"] = false; - - /** - * FileOptions .gogoproto.goproto_stringer_all. - * @member {boolean} .gogoproto.goproto_stringer_all - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.goproto_stringer_all"] = false; - - /** - * FileOptions .gogoproto.verbose_equal_all. - * @member {boolean} .gogoproto.verbose_equal_all - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.verbose_equal_all"] = false; - - /** - * FileOptions .gogoproto.face_all. - * @member {boolean} .gogoproto.face_all - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.face_all"] = false; - - /** - * FileOptions .gogoproto.gostring_all. - * @member {boolean} .gogoproto.gostring_all - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.gostring_all"] = false; - - /** - * FileOptions .gogoproto.populate_all. - * @member {boolean} .gogoproto.populate_all - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.populate_all"] = false; - - /** - * FileOptions .gogoproto.stringer_all. - * @member {boolean} .gogoproto.stringer_all - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.stringer_all"] = false; - - /** - * FileOptions .gogoproto.onlyone_all. - * @member {boolean} .gogoproto.onlyone_all - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.onlyone_all"] = false; - - /** - * FileOptions .gogoproto.equal_all. - * @member {boolean} .gogoproto.equal_all - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.equal_all"] = false; - - /** - * FileOptions .gogoproto.description_all. - * @member {boolean} .gogoproto.description_all - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.description_all"] = false; - - /** - * FileOptions .gogoproto.testgen_all. - * @member {boolean} .gogoproto.testgen_all - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.testgen_all"] = false; - - /** - * FileOptions .gogoproto.benchgen_all. - * @member {boolean} .gogoproto.benchgen_all - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.benchgen_all"] = false; - - /** - * FileOptions .gogoproto.marshaler_all. - * @member {boolean} .gogoproto.marshaler_all - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.marshaler_all"] = false; - - /** - * FileOptions .gogoproto.unmarshaler_all. - * @member {boolean} .gogoproto.unmarshaler_all - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.unmarshaler_all"] = false; - - /** - * FileOptions .gogoproto.stable_marshaler_all. - * @member {boolean} .gogoproto.stable_marshaler_all - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.stable_marshaler_all"] = false; - - /** - * FileOptions .gogoproto.sizer_all. - * @member {boolean} .gogoproto.sizer_all - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.sizer_all"] = false; - - /** - * FileOptions .gogoproto.goproto_enum_stringer_all. - * @member {boolean} .gogoproto.goproto_enum_stringer_all - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.goproto_enum_stringer_all"] = false; - - /** - * FileOptions .gogoproto.enum_stringer_all. - * @member {boolean} .gogoproto.enum_stringer_all - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.enum_stringer_all"] = false; - - /** - * FileOptions .gogoproto.unsafe_marshaler_all. - * @member {boolean} .gogoproto.unsafe_marshaler_all - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.unsafe_marshaler_all"] = false; - - /** - * FileOptions .gogoproto.unsafe_unmarshaler_all. - * @member {boolean} .gogoproto.unsafe_unmarshaler_all - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.unsafe_unmarshaler_all"] = false; - - /** - * FileOptions .gogoproto.goproto_extensions_map_all. - * @member {boolean} .gogoproto.goproto_extensions_map_all - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.goproto_extensions_map_all"] = false; - - /** - * FileOptions .gogoproto.goproto_unrecognized_all. - * @member {boolean} .gogoproto.goproto_unrecognized_all - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.goproto_unrecognized_all"] = false; - - /** - * FileOptions .gogoproto.gogoproto_import. - * @member {boolean} .gogoproto.gogoproto_import - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.gogoproto_import"] = false; - - /** - * FileOptions .gogoproto.protosizer_all. - * @member {boolean} .gogoproto.protosizer_all - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.protosizer_all"] = false; - - /** - * FileOptions .gogoproto.compare_all. - * @member {boolean} .gogoproto.compare_all - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.compare_all"] = false; - - /** - * FileOptions .gogoproto.typedecl_all. - * @member {boolean} .gogoproto.typedecl_all - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.typedecl_all"] = false; - - /** - * FileOptions .gogoproto.enumdecl_all. - * @member {boolean} .gogoproto.enumdecl_all - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.enumdecl_all"] = false; - - /** - * FileOptions .gogoproto.goproto_registration. - * @member {boolean} .gogoproto.goproto_registration - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.goproto_registration"] = false; - - /** - * FileOptions .gogoproto.messagename_all. - * @member {boolean} .gogoproto.messagename_all - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.messagename_all"] = false; - - /** - * FileOptions .gogoproto.goproto_sizecache_all. - * @member {boolean} .gogoproto.goproto_sizecache_all - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.goproto_sizecache_all"] = false; - - /** - * FileOptions .gogoproto.goproto_unkeyed_all. - * @member {boolean} .gogoproto.goproto_unkeyed_all - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".gogoproto.goproto_unkeyed_all"] = false; - - /** - * Encodes the specified FileOptions message. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.FileOptions - * @static - * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FileOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.java_package != null && Object.hasOwnProperty.call(message, "java_package")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.java_package); - if (message.java_outer_classname != null && Object.hasOwnProperty.call(message, "java_outer_classname")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.java_outer_classname); - if (message.optimize_for != null && Object.hasOwnProperty.call(message, "optimize_for")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.optimize_for); - if (message.java_multiple_files != null && Object.hasOwnProperty.call(message, "java_multiple_files")) - writer.uint32(/* id 10, wireType 0 =*/80).bool(message.java_multiple_files); - if (message.go_package != null && Object.hasOwnProperty.call(message, "go_package")) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.go_package); - if (message.cc_generic_services != null && Object.hasOwnProperty.call(message, "cc_generic_services")) - writer.uint32(/* id 16, wireType 0 =*/128).bool(message.cc_generic_services); - if (message.java_generic_services != null && Object.hasOwnProperty.call(message, "java_generic_services")) - writer.uint32(/* id 17, wireType 0 =*/136).bool(message.java_generic_services); - if (message.py_generic_services != null && Object.hasOwnProperty.call(message, "py_generic_services")) - writer.uint32(/* id 18, wireType 0 =*/144).bool(message.py_generic_services); - if (message.java_generate_equals_and_hash != null && Object.hasOwnProperty.call(message, "java_generate_equals_and_hash")) - writer.uint32(/* id 20, wireType 0 =*/160).bool(message.java_generate_equals_and_hash); - if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) - writer.uint32(/* id 23, wireType 0 =*/184).bool(message.deprecated); - if (message.java_string_check_utf8 != null && Object.hasOwnProperty.call(message, "java_string_check_utf8")) - writer.uint32(/* id 27, wireType 0 =*/216).bool(message.java_string_check_utf8); - if (message.cc_enable_arenas != null && Object.hasOwnProperty.call(message, "cc_enable_arenas")) - writer.uint32(/* id 31, wireType 0 =*/248).bool(message.cc_enable_arenas); - if (message.objc_class_prefix != null && Object.hasOwnProperty.call(message, "objc_class_prefix")) - writer.uint32(/* id 36, wireType 2 =*/290).string(message.objc_class_prefix); - if (message.csharp_namespace != null && Object.hasOwnProperty.call(message, "csharp_namespace")) - writer.uint32(/* id 37, wireType 2 =*/298).string(message.csharp_namespace); - if (message.uninterpreted_option != null && message.uninterpreted_option.length) - for (let i = 0; i < message.uninterpreted_option.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpreted_option[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - if (message[".gogoproto.goproto_getters_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_getters_all")) - writer.uint32(/* id 63001, wireType 0 =*/504008).bool(message[".gogoproto.goproto_getters_all"]); - if (message[".gogoproto.goproto_enum_prefix_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_enum_prefix_all")) - writer.uint32(/* id 63002, wireType 0 =*/504016).bool(message[".gogoproto.goproto_enum_prefix_all"]); - if (message[".gogoproto.goproto_stringer_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_stringer_all")) - writer.uint32(/* id 63003, wireType 0 =*/504024).bool(message[".gogoproto.goproto_stringer_all"]); - if (message[".gogoproto.verbose_equal_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.verbose_equal_all")) - writer.uint32(/* id 63004, wireType 0 =*/504032).bool(message[".gogoproto.verbose_equal_all"]); - if (message[".gogoproto.face_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.face_all")) - writer.uint32(/* id 63005, wireType 0 =*/504040).bool(message[".gogoproto.face_all"]); - if (message[".gogoproto.gostring_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.gostring_all")) - writer.uint32(/* id 63006, wireType 0 =*/504048).bool(message[".gogoproto.gostring_all"]); - if (message[".gogoproto.populate_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.populate_all")) - writer.uint32(/* id 63007, wireType 0 =*/504056).bool(message[".gogoproto.populate_all"]); - if (message[".gogoproto.stringer_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.stringer_all")) - writer.uint32(/* id 63008, wireType 0 =*/504064).bool(message[".gogoproto.stringer_all"]); - if (message[".gogoproto.onlyone_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.onlyone_all")) - writer.uint32(/* id 63009, wireType 0 =*/504072).bool(message[".gogoproto.onlyone_all"]); - if (message[".gogoproto.equal_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.equal_all")) - writer.uint32(/* id 63013, wireType 0 =*/504104).bool(message[".gogoproto.equal_all"]); - if (message[".gogoproto.description_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.description_all")) - writer.uint32(/* id 63014, wireType 0 =*/504112).bool(message[".gogoproto.description_all"]); - if (message[".gogoproto.testgen_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.testgen_all")) - writer.uint32(/* id 63015, wireType 0 =*/504120).bool(message[".gogoproto.testgen_all"]); - if (message[".gogoproto.benchgen_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.benchgen_all")) - writer.uint32(/* id 63016, wireType 0 =*/504128).bool(message[".gogoproto.benchgen_all"]); - if (message[".gogoproto.marshaler_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.marshaler_all")) - writer.uint32(/* id 63017, wireType 0 =*/504136).bool(message[".gogoproto.marshaler_all"]); - if (message[".gogoproto.unmarshaler_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.unmarshaler_all")) - writer.uint32(/* id 63018, wireType 0 =*/504144).bool(message[".gogoproto.unmarshaler_all"]); - if (message[".gogoproto.stable_marshaler_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.stable_marshaler_all")) - writer.uint32(/* id 63019, wireType 0 =*/504152).bool(message[".gogoproto.stable_marshaler_all"]); - if (message[".gogoproto.sizer_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.sizer_all")) - writer.uint32(/* id 63020, wireType 0 =*/504160).bool(message[".gogoproto.sizer_all"]); - if (message[".gogoproto.goproto_enum_stringer_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_enum_stringer_all")) - writer.uint32(/* id 63021, wireType 0 =*/504168).bool(message[".gogoproto.goproto_enum_stringer_all"]); - if (message[".gogoproto.enum_stringer_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.enum_stringer_all")) - writer.uint32(/* id 63022, wireType 0 =*/504176).bool(message[".gogoproto.enum_stringer_all"]); - if (message[".gogoproto.unsafe_marshaler_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.unsafe_marshaler_all")) - writer.uint32(/* id 63023, wireType 0 =*/504184).bool(message[".gogoproto.unsafe_marshaler_all"]); - if (message[".gogoproto.unsafe_unmarshaler_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.unsafe_unmarshaler_all")) - writer.uint32(/* id 63024, wireType 0 =*/504192).bool(message[".gogoproto.unsafe_unmarshaler_all"]); - if (message[".gogoproto.goproto_extensions_map_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_extensions_map_all")) - writer.uint32(/* id 63025, wireType 0 =*/504200).bool(message[".gogoproto.goproto_extensions_map_all"]); - if (message[".gogoproto.goproto_unrecognized_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_unrecognized_all")) - writer.uint32(/* id 63026, wireType 0 =*/504208).bool(message[".gogoproto.goproto_unrecognized_all"]); - if (message[".gogoproto.gogoproto_import"] != null && Object.hasOwnProperty.call(message, ".gogoproto.gogoproto_import")) - writer.uint32(/* id 63027, wireType 0 =*/504216).bool(message[".gogoproto.gogoproto_import"]); - if (message[".gogoproto.protosizer_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.protosizer_all")) - writer.uint32(/* id 63028, wireType 0 =*/504224).bool(message[".gogoproto.protosizer_all"]); - if (message[".gogoproto.compare_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.compare_all")) - writer.uint32(/* id 63029, wireType 0 =*/504232).bool(message[".gogoproto.compare_all"]); - if (message[".gogoproto.typedecl_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.typedecl_all")) - writer.uint32(/* id 63030, wireType 0 =*/504240).bool(message[".gogoproto.typedecl_all"]); - if (message[".gogoproto.enumdecl_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.enumdecl_all")) - writer.uint32(/* id 63031, wireType 0 =*/504248).bool(message[".gogoproto.enumdecl_all"]); - if (message[".gogoproto.goproto_registration"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_registration")) - writer.uint32(/* id 63032, wireType 0 =*/504256).bool(message[".gogoproto.goproto_registration"]); - if (message[".gogoproto.messagename_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.messagename_all")) - writer.uint32(/* id 63033, wireType 0 =*/504264).bool(message[".gogoproto.messagename_all"]); - if (message[".gogoproto.goproto_sizecache_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_sizecache_all")) - writer.uint32(/* id 63034, wireType 0 =*/504272).bool(message[".gogoproto.goproto_sizecache_all"]); - if (message[".gogoproto.goproto_unkeyed_all"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_unkeyed_all")) - writer.uint32(/* id 63035, wireType 0 =*/504280).bool(message[".gogoproto.goproto_unkeyed_all"]); - return writer; - }; - - /** - * Encodes the specified FileOptions message, length delimited. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.FileOptions - * @static - * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FileOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FileOptions message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.FileOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FileOptions} FileOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FileOptions.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileOptions(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.java_package = reader.string(); - break; - case 8: - message.java_outer_classname = reader.string(); - break; - case 10: - message.java_multiple_files = reader.bool(); - break; - case 20: - message.java_generate_equals_and_hash = reader.bool(); - break; - case 27: - message.java_string_check_utf8 = reader.bool(); - break; - case 9: - message.optimize_for = reader.int32(); - break; - case 11: - message.go_package = reader.string(); - break; - case 16: - message.cc_generic_services = reader.bool(); - break; - case 17: - message.java_generic_services = reader.bool(); - break; - case 18: - message.py_generic_services = reader.bool(); - break; - case 23: - message.deprecated = reader.bool(); - break; - case 31: - message.cc_enable_arenas = reader.bool(); - break; - case 36: - message.objc_class_prefix = reader.string(); - break; - case 37: - message.csharp_namespace = reader.string(); - break; - case 999: - if (!(message.uninterpreted_option && message.uninterpreted_option.length)) - message.uninterpreted_option = []; - message.uninterpreted_option.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - case 63001: - message[".gogoproto.goproto_getters_all"] = reader.bool(); - break; - case 63002: - message[".gogoproto.goproto_enum_prefix_all"] = reader.bool(); - break; - case 63003: - message[".gogoproto.goproto_stringer_all"] = reader.bool(); - break; - case 63004: - message[".gogoproto.verbose_equal_all"] = reader.bool(); - break; - case 63005: - message[".gogoproto.face_all"] = reader.bool(); - break; - case 63006: - message[".gogoproto.gostring_all"] = reader.bool(); - break; - case 63007: - message[".gogoproto.populate_all"] = reader.bool(); - break; - case 63008: - message[".gogoproto.stringer_all"] = reader.bool(); - break; - case 63009: - message[".gogoproto.onlyone_all"] = reader.bool(); - break; - case 63013: - message[".gogoproto.equal_all"] = reader.bool(); - break; - case 63014: - message[".gogoproto.description_all"] = reader.bool(); - break; - case 63015: - message[".gogoproto.testgen_all"] = reader.bool(); - break; - case 63016: - message[".gogoproto.benchgen_all"] = reader.bool(); - break; - case 63017: - message[".gogoproto.marshaler_all"] = reader.bool(); - break; - case 63018: - message[".gogoproto.unmarshaler_all"] = reader.bool(); - break; - case 63019: - message[".gogoproto.stable_marshaler_all"] = reader.bool(); - break; - case 63020: - message[".gogoproto.sizer_all"] = reader.bool(); - break; - case 63021: - message[".gogoproto.goproto_enum_stringer_all"] = reader.bool(); - break; - case 63022: - message[".gogoproto.enum_stringer_all"] = reader.bool(); - break; - case 63023: - message[".gogoproto.unsafe_marshaler_all"] = reader.bool(); - break; - case 63024: - message[".gogoproto.unsafe_unmarshaler_all"] = reader.bool(); - break; - case 63025: - message[".gogoproto.goproto_extensions_map_all"] = reader.bool(); - break; - case 63026: - message[".gogoproto.goproto_unrecognized_all"] = reader.bool(); - break; - case 63027: - message[".gogoproto.gogoproto_import"] = reader.bool(); - break; - case 63028: - message[".gogoproto.protosizer_all"] = reader.bool(); - break; - case 63029: - message[".gogoproto.compare_all"] = reader.bool(); - break; - case 63030: - message[".gogoproto.typedecl_all"] = reader.bool(); - break; - case 63031: - message[".gogoproto.enumdecl_all"] = reader.bool(); - break; - case 63032: - message[".gogoproto.goproto_registration"] = reader.bool(); - break; - case 63033: - message[".gogoproto.messagename_all"] = reader.bool(); - break; - case 63034: - message[".gogoproto.goproto_sizecache_all"] = reader.bool(); - break; - case 63035: - message[".gogoproto.goproto_unkeyed_all"] = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FileOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.FileOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FileOptions} FileOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FileOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FileOptions message. - * @function verify - * @memberof google.protobuf.FileOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FileOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.java_package != null && message.hasOwnProperty("java_package")) - if (!$util.isString(message.java_package)) - return "java_package: string expected"; - if (message.java_outer_classname != null && message.hasOwnProperty("java_outer_classname")) - if (!$util.isString(message.java_outer_classname)) - return "java_outer_classname: string expected"; - if (message.java_multiple_files != null && message.hasOwnProperty("java_multiple_files")) - if (typeof message.java_multiple_files !== "boolean") - return "java_multiple_files: boolean expected"; - if (message.java_generate_equals_and_hash != null && message.hasOwnProperty("java_generate_equals_and_hash")) - if (typeof message.java_generate_equals_and_hash !== "boolean") - return "java_generate_equals_and_hash: boolean expected"; - if (message.java_string_check_utf8 != null && message.hasOwnProperty("java_string_check_utf8")) - if (typeof message.java_string_check_utf8 !== "boolean") - return "java_string_check_utf8: boolean expected"; - if (message.optimize_for != null && message.hasOwnProperty("optimize_for")) - switch (message.optimize_for) { - default: - return "optimize_for: enum value expected"; - case 1: - case 2: - case 3: - break; - } - if (message.go_package != null && message.hasOwnProperty("go_package")) - if (!$util.isString(message.go_package)) - return "go_package: string expected"; - if (message.cc_generic_services != null && message.hasOwnProperty("cc_generic_services")) - if (typeof message.cc_generic_services !== "boolean") - return "cc_generic_services: boolean expected"; - if (message.java_generic_services != null && message.hasOwnProperty("java_generic_services")) - if (typeof message.java_generic_services !== "boolean") - return "java_generic_services: boolean expected"; - if (message.py_generic_services != null && message.hasOwnProperty("py_generic_services")) - if (typeof message.py_generic_services !== "boolean") - return "py_generic_services: boolean expected"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - if (typeof message.deprecated !== "boolean") - return "deprecated: boolean expected"; - if (message.cc_enable_arenas != null && message.hasOwnProperty("cc_enable_arenas")) - if (typeof message.cc_enable_arenas !== "boolean") - return "cc_enable_arenas: boolean expected"; - if (message.objc_class_prefix != null && message.hasOwnProperty("objc_class_prefix")) - if (!$util.isString(message.objc_class_prefix)) - return "objc_class_prefix: string expected"; - if (message.csharp_namespace != null && message.hasOwnProperty("csharp_namespace")) - if (!$util.isString(message.csharp_namespace)) - return "csharp_namespace: string expected"; - if (message.uninterpreted_option != null && message.hasOwnProperty("uninterpreted_option")) { - if (!Array.isArray(message.uninterpreted_option)) - return "uninterpreted_option: array expected"; - for (let i = 0; i < message.uninterpreted_option.length; ++i) { - let error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpreted_option[i]); - if (error) - return "uninterpreted_option." + error; - } - } - if (message[".gogoproto.goproto_getters_all"] != null && message.hasOwnProperty(".gogoproto.goproto_getters_all")) - if (typeof message[".gogoproto.goproto_getters_all"] !== "boolean") - return ".gogoproto.goproto_getters_all: boolean expected"; - if (message[".gogoproto.goproto_enum_prefix_all"] != null && message.hasOwnProperty(".gogoproto.goproto_enum_prefix_all")) - if (typeof message[".gogoproto.goproto_enum_prefix_all"] !== "boolean") - return ".gogoproto.goproto_enum_prefix_all: boolean expected"; - if (message[".gogoproto.goproto_stringer_all"] != null && message.hasOwnProperty(".gogoproto.goproto_stringer_all")) - if (typeof message[".gogoproto.goproto_stringer_all"] !== "boolean") - return ".gogoproto.goproto_stringer_all: boolean expected"; - if (message[".gogoproto.verbose_equal_all"] != null && message.hasOwnProperty(".gogoproto.verbose_equal_all")) - if (typeof message[".gogoproto.verbose_equal_all"] !== "boolean") - return ".gogoproto.verbose_equal_all: boolean expected"; - if (message[".gogoproto.face_all"] != null && message.hasOwnProperty(".gogoproto.face_all")) - if (typeof message[".gogoproto.face_all"] !== "boolean") - return ".gogoproto.face_all: boolean expected"; - if (message[".gogoproto.gostring_all"] != null && message.hasOwnProperty(".gogoproto.gostring_all")) - if (typeof message[".gogoproto.gostring_all"] !== "boolean") - return ".gogoproto.gostring_all: boolean expected"; - if (message[".gogoproto.populate_all"] != null && message.hasOwnProperty(".gogoproto.populate_all")) - if (typeof message[".gogoproto.populate_all"] !== "boolean") - return ".gogoproto.populate_all: boolean expected"; - if (message[".gogoproto.stringer_all"] != null && message.hasOwnProperty(".gogoproto.stringer_all")) - if (typeof message[".gogoproto.stringer_all"] !== "boolean") - return ".gogoproto.stringer_all: boolean expected"; - if (message[".gogoproto.onlyone_all"] != null && message.hasOwnProperty(".gogoproto.onlyone_all")) - if (typeof message[".gogoproto.onlyone_all"] !== "boolean") - return ".gogoproto.onlyone_all: boolean expected"; - if (message[".gogoproto.equal_all"] != null && message.hasOwnProperty(".gogoproto.equal_all")) - if (typeof message[".gogoproto.equal_all"] !== "boolean") - return ".gogoproto.equal_all: boolean expected"; - if (message[".gogoproto.description_all"] != null && message.hasOwnProperty(".gogoproto.description_all")) - if (typeof message[".gogoproto.description_all"] !== "boolean") - return ".gogoproto.description_all: boolean expected"; - if (message[".gogoproto.testgen_all"] != null && message.hasOwnProperty(".gogoproto.testgen_all")) - if (typeof message[".gogoproto.testgen_all"] !== "boolean") - return ".gogoproto.testgen_all: boolean expected"; - if (message[".gogoproto.benchgen_all"] != null && message.hasOwnProperty(".gogoproto.benchgen_all")) - if (typeof message[".gogoproto.benchgen_all"] !== "boolean") - return ".gogoproto.benchgen_all: boolean expected"; - if (message[".gogoproto.marshaler_all"] != null && message.hasOwnProperty(".gogoproto.marshaler_all")) - if (typeof message[".gogoproto.marshaler_all"] !== "boolean") - return ".gogoproto.marshaler_all: boolean expected"; - if (message[".gogoproto.unmarshaler_all"] != null && message.hasOwnProperty(".gogoproto.unmarshaler_all")) - if (typeof message[".gogoproto.unmarshaler_all"] !== "boolean") - return ".gogoproto.unmarshaler_all: boolean expected"; - if (message[".gogoproto.stable_marshaler_all"] != null && message.hasOwnProperty(".gogoproto.stable_marshaler_all")) - if (typeof message[".gogoproto.stable_marshaler_all"] !== "boolean") - return ".gogoproto.stable_marshaler_all: boolean expected"; - if (message[".gogoproto.sizer_all"] != null && message.hasOwnProperty(".gogoproto.sizer_all")) - if (typeof message[".gogoproto.sizer_all"] !== "boolean") - return ".gogoproto.sizer_all: boolean expected"; - if (message[".gogoproto.goproto_enum_stringer_all"] != null && message.hasOwnProperty(".gogoproto.goproto_enum_stringer_all")) - if (typeof message[".gogoproto.goproto_enum_stringer_all"] !== "boolean") - return ".gogoproto.goproto_enum_stringer_all: boolean expected"; - if (message[".gogoproto.enum_stringer_all"] != null && message.hasOwnProperty(".gogoproto.enum_stringer_all")) - if (typeof message[".gogoproto.enum_stringer_all"] !== "boolean") - return ".gogoproto.enum_stringer_all: boolean expected"; - if (message[".gogoproto.unsafe_marshaler_all"] != null && message.hasOwnProperty(".gogoproto.unsafe_marshaler_all")) - if (typeof message[".gogoproto.unsafe_marshaler_all"] !== "boolean") - return ".gogoproto.unsafe_marshaler_all: boolean expected"; - if (message[".gogoproto.unsafe_unmarshaler_all"] != null && message.hasOwnProperty(".gogoproto.unsafe_unmarshaler_all")) - if (typeof message[".gogoproto.unsafe_unmarshaler_all"] !== "boolean") - return ".gogoproto.unsafe_unmarshaler_all: boolean expected"; - if (message[".gogoproto.goproto_extensions_map_all"] != null && message.hasOwnProperty(".gogoproto.goproto_extensions_map_all")) - if (typeof message[".gogoproto.goproto_extensions_map_all"] !== "boolean") - return ".gogoproto.goproto_extensions_map_all: boolean expected"; - if (message[".gogoproto.goproto_unrecognized_all"] != null && message.hasOwnProperty(".gogoproto.goproto_unrecognized_all")) - if (typeof message[".gogoproto.goproto_unrecognized_all"] !== "boolean") - return ".gogoproto.goproto_unrecognized_all: boolean expected"; - if (message[".gogoproto.gogoproto_import"] != null && message.hasOwnProperty(".gogoproto.gogoproto_import")) - if (typeof message[".gogoproto.gogoproto_import"] !== "boolean") - return ".gogoproto.gogoproto_import: boolean expected"; - if (message[".gogoproto.protosizer_all"] != null && message.hasOwnProperty(".gogoproto.protosizer_all")) - if (typeof message[".gogoproto.protosizer_all"] !== "boolean") - return ".gogoproto.protosizer_all: boolean expected"; - if (message[".gogoproto.compare_all"] != null && message.hasOwnProperty(".gogoproto.compare_all")) - if (typeof message[".gogoproto.compare_all"] !== "boolean") - return ".gogoproto.compare_all: boolean expected"; - if (message[".gogoproto.typedecl_all"] != null && message.hasOwnProperty(".gogoproto.typedecl_all")) - if (typeof message[".gogoproto.typedecl_all"] !== "boolean") - return ".gogoproto.typedecl_all: boolean expected"; - if (message[".gogoproto.enumdecl_all"] != null && message.hasOwnProperty(".gogoproto.enumdecl_all")) - if (typeof message[".gogoproto.enumdecl_all"] !== "boolean") - return ".gogoproto.enumdecl_all: boolean expected"; - if (message[".gogoproto.goproto_registration"] != null && message.hasOwnProperty(".gogoproto.goproto_registration")) - if (typeof message[".gogoproto.goproto_registration"] !== "boolean") - return ".gogoproto.goproto_registration: boolean expected"; - if (message[".gogoproto.messagename_all"] != null && message.hasOwnProperty(".gogoproto.messagename_all")) - if (typeof message[".gogoproto.messagename_all"] !== "boolean") - return ".gogoproto.messagename_all: boolean expected"; - if (message[".gogoproto.goproto_sizecache_all"] != null && message.hasOwnProperty(".gogoproto.goproto_sizecache_all")) - if (typeof message[".gogoproto.goproto_sizecache_all"] !== "boolean") - return ".gogoproto.goproto_sizecache_all: boolean expected"; - if (message[".gogoproto.goproto_unkeyed_all"] != null && message.hasOwnProperty(".gogoproto.goproto_unkeyed_all")) - if (typeof message[".gogoproto.goproto_unkeyed_all"] !== "boolean") - return ".gogoproto.goproto_unkeyed_all: boolean expected"; - return null; - }; - - /** - * Creates a FileOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.FileOptions - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.FileOptions} FileOptions - */ - FileOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FileOptions) - return object; - let message = new $root.google.protobuf.FileOptions(); - if (object.java_package != null) - message.java_package = String(object.java_package); - if (object.java_outer_classname != null) - message.java_outer_classname = String(object.java_outer_classname); - if (object.java_multiple_files != null) - message.java_multiple_files = Boolean(object.java_multiple_files); - if (object.java_generate_equals_and_hash != null) - message.java_generate_equals_and_hash = Boolean(object.java_generate_equals_and_hash); - if (object.java_string_check_utf8 != null) - message.java_string_check_utf8 = Boolean(object.java_string_check_utf8); - switch (object.optimize_for) { - case "SPEED": - case 1: - message.optimize_for = 1; - break; - case "CODE_SIZE": - case 2: - message.optimize_for = 2; - break; - case "LITE_RUNTIME": - case 3: - message.optimize_for = 3; - break; - } - if (object.go_package != null) - message.go_package = String(object.go_package); - if (object.cc_generic_services != null) - message.cc_generic_services = Boolean(object.cc_generic_services); - if (object.java_generic_services != null) - message.java_generic_services = Boolean(object.java_generic_services); - if (object.py_generic_services != null) - message.py_generic_services = Boolean(object.py_generic_services); - if (object.deprecated != null) - message.deprecated = Boolean(object.deprecated); - if (object.cc_enable_arenas != null) - message.cc_enable_arenas = Boolean(object.cc_enable_arenas); - if (object.objc_class_prefix != null) - message.objc_class_prefix = String(object.objc_class_prefix); - if (object.csharp_namespace != null) - message.csharp_namespace = String(object.csharp_namespace); - if (object.uninterpreted_option) { - if (!Array.isArray(object.uninterpreted_option)) - throw TypeError(".google.protobuf.FileOptions.uninterpreted_option: array expected"); - message.uninterpreted_option = []; - for (let i = 0; i < object.uninterpreted_option.length; ++i) { - if (typeof object.uninterpreted_option[i] !== "object") - throw TypeError(".google.protobuf.FileOptions.uninterpreted_option: object expected"); - message.uninterpreted_option[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpreted_option[i]); - } - } - if (object[".gogoproto.goproto_getters_all"] != null) - message[".gogoproto.goproto_getters_all"] = Boolean(object[".gogoproto.goproto_getters_all"]); - if (object[".gogoproto.goproto_enum_prefix_all"] != null) - message[".gogoproto.goproto_enum_prefix_all"] = Boolean(object[".gogoproto.goproto_enum_prefix_all"]); - if (object[".gogoproto.goproto_stringer_all"] != null) - message[".gogoproto.goproto_stringer_all"] = Boolean(object[".gogoproto.goproto_stringer_all"]); - if (object[".gogoproto.verbose_equal_all"] != null) - message[".gogoproto.verbose_equal_all"] = Boolean(object[".gogoproto.verbose_equal_all"]); - if (object[".gogoproto.face_all"] != null) - message[".gogoproto.face_all"] = Boolean(object[".gogoproto.face_all"]); - if (object[".gogoproto.gostring_all"] != null) - message[".gogoproto.gostring_all"] = Boolean(object[".gogoproto.gostring_all"]); - if (object[".gogoproto.populate_all"] != null) - message[".gogoproto.populate_all"] = Boolean(object[".gogoproto.populate_all"]); - if (object[".gogoproto.stringer_all"] != null) - message[".gogoproto.stringer_all"] = Boolean(object[".gogoproto.stringer_all"]); - if (object[".gogoproto.onlyone_all"] != null) - message[".gogoproto.onlyone_all"] = Boolean(object[".gogoproto.onlyone_all"]); - if (object[".gogoproto.equal_all"] != null) - message[".gogoproto.equal_all"] = Boolean(object[".gogoproto.equal_all"]); - if (object[".gogoproto.description_all"] != null) - message[".gogoproto.description_all"] = Boolean(object[".gogoproto.description_all"]); - if (object[".gogoproto.testgen_all"] != null) - message[".gogoproto.testgen_all"] = Boolean(object[".gogoproto.testgen_all"]); - if (object[".gogoproto.benchgen_all"] != null) - message[".gogoproto.benchgen_all"] = Boolean(object[".gogoproto.benchgen_all"]); - if (object[".gogoproto.marshaler_all"] != null) - message[".gogoproto.marshaler_all"] = Boolean(object[".gogoproto.marshaler_all"]); - if (object[".gogoproto.unmarshaler_all"] != null) - message[".gogoproto.unmarshaler_all"] = Boolean(object[".gogoproto.unmarshaler_all"]); - if (object[".gogoproto.stable_marshaler_all"] != null) - message[".gogoproto.stable_marshaler_all"] = Boolean(object[".gogoproto.stable_marshaler_all"]); - if (object[".gogoproto.sizer_all"] != null) - message[".gogoproto.sizer_all"] = Boolean(object[".gogoproto.sizer_all"]); - if (object[".gogoproto.goproto_enum_stringer_all"] != null) - message[".gogoproto.goproto_enum_stringer_all"] = Boolean(object[".gogoproto.goproto_enum_stringer_all"]); - if (object[".gogoproto.enum_stringer_all"] != null) - message[".gogoproto.enum_stringer_all"] = Boolean(object[".gogoproto.enum_stringer_all"]); - if (object[".gogoproto.unsafe_marshaler_all"] != null) - message[".gogoproto.unsafe_marshaler_all"] = Boolean(object[".gogoproto.unsafe_marshaler_all"]); - if (object[".gogoproto.unsafe_unmarshaler_all"] != null) - message[".gogoproto.unsafe_unmarshaler_all"] = Boolean(object[".gogoproto.unsafe_unmarshaler_all"]); - if (object[".gogoproto.goproto_extensions_map_all"] != null) - message[".gogoproto.goproto_extensions_map_all"] = Boolean(object[".gogoproto.goproto_extensions_map_all"]); - if (object[".gogoproto.goproto_unrecognized_all"] != null) - message[".gogoproto.goproto_unrecognized_all"] = Boolean(object[".gogoproto.goproto_unrecognized_all"]); - if (object[".gogoproto.gogoproto_import"] != null) - message[".gogoproto.gogoproto_import"] = Boolean(object[".gogoproto.gogoproto_import"]); - if (object[".gogoproto.protosizer_all"] != null) - message[".gogoproto.protosizer_all"] = Boolean(object[".gogoproto.protosizer_all"]); - if (object[".gogoproto.compare_all"] != null) - message[".gogoproto.compare_all"] = Boolean(object[".gogoproto.compare_all"]); - if (object[".gogoproto.typedecl_all"] != null) - message[".gogoproto.typedecl_all"] = Boolean(object[".gogoproto.typedecl_all"]); - if (object[".gogoproto.enumdecl_all"] != null) - message[".gogoproto.enumdecl_all"] = Boolean(object[".gogoproto.enumdecl_all"]); - if (object[".gogoproto.goproto_registration"] != null) - message[".gogoproto.goproto_registration"] = Boolean(object[".gogoproto.goproto_registration"]); - if (object[".gogoproto.messagename_all"] != null) - message[".gogoproto.messagename_all"] = Boolean(object[".gogoproto.messagename_all"]); - if (object[".gogoproto.goproto_sizecache_all"] != null) - message[".gogoproto.goproto_sizecache_all"] = Boolean(object[".gogoproto.goproto_sizecache_all"]); - if (object[".gogoproto.goproto_unkeyed_all"] != null) - message[".gogoproto.goproto_unkeyed_all"] = Boolean(object[".gogoproto.goproto_unkeyed_all"]); - return message; - }; - - /** - * Creates a plain object from a FileOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.FileOptions - * @static - * @param {google.protobuf.FileOptions} message FileOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FileOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.uninterpreted_option = []; - if (options.defaults) { - object.java_package = ""; - object.java_outer_classname = ""; - object.optimize_for = options.enums === String ? "SPEED" : 1; - object.java_multiple_files = false; - object.go_package = ""; - object.cc_generic_services = false; - object.java_generic_services = false; - object.py_generic_services = false; - object.java_generate_equals_and_hash = false; - object.deprecated = false; - object.java_string_check_utf8 = false; - object.cc_enable_arenas = false; - object.objc_class_prefix = ""; - object.csharp_namespace = ""; - object[".gogoproto.goproto_getters_all"] = false; - object[".gogoproto.goproto_enum_prefix_all"] = false; - object[".gogoproto.goproto_stringer_all"] = false; - object[".gogoproto.verbose_equal_all"] = false; - object[".gogoproto.face_all"] = false; - object[".gogoproto.gostring_all"] = false; - object[".gogoproto.populate_all"] = false; - object[".gogoproto.stringer_all"] = false; - object[".gogoproto.onlyone_all"] = false; - object[".gogoproto.equal_all"] = false; - object[".gogoproto.description_all"] = false; - object[".gogoproto.testgen_all"] = false; - object[".gogoproto.benchgen_all"] = false; - object[".gogoproto.marshaler_all"] = false; - object[".gogoproto.unmarshaler_all"] = false; - object[".gogoproto.stable_marshaler_all"] = false; - object[".gogoproto.sizer_all"] = false; - object[".gogoproto.goproto_enum_stringer_all"] = false; - object[".gogoproto.enum_stringer_all"] = false; - object[".gogoproto.unsafe_marshaler_all"] = false; - object[".gogoproto.unsafe_unmarshaler_all"] = false; - object[".gogoproto.goproto_extensions_map_all"] = false; - object[".gogoproto.goproto_unrecognized_all"] = false; - object[".gogoproto.gogoproto_import"] = false; - object[".gogoproto.protosizer_all"] = false; - object[".gogoproto.compare_all"] = false; - object[".gogoproto.typedecl_all"] = false; - object[".gogoproto.enumdecl_all"] = false; - object[".gogoproto.goproto_registration"] = false; - object[".gogoproto.messagename_all"] = false; - object[".gogoproto.goproto_sizecache_all"] = false; - object[".gogoproto.goproto_unkeyed_all"] = false; - } - if (message.java_package != null && message.hasOwnProperty("java_package")) - object.java_package = message.java_package; - if (message.java_outer_classname != null && message.hasOwnProperty("java_outer_classname")) - object.java_outer_classname = message.java_outer_classname; - if (message.optimize_for != null && message.hasOwnProperty("optimize_for")) - object.optimize_for = options.enums === String ? $root.google.protobuf.FileOptions.OptimizeMode[message.optimize_for] : message.optimize_for; - if (message.java_multiple_files != null && message.hasOwnProperty("java_multiple_files")) - object.java_multiple_files = message.java_multiple_files; - if (message.go_package != null && message.hasOwnProperty("go_package")) - object.go_package = message.go_package; - if (message.cc_generic_services != null && message.hasOwnProperty("cc_generic_services")) - object.cc_generic_services = message.cc_generic_services; - if (message.java_generic_services != null && message.hasOwnProperty("java_generic_services")) - object.java_generic_services = message.java_generic_services; - if (message.py_generic_services != null && message.hasOwnProperty("py_generic_services")) - object.py_generic_services = message.py_generic_services; - if (message.java_generate_equals_and_hash != null && message.hasOwnProperty("java_generate_equals_and_hash")) - object.java_generate_equals_and_hash = message.java_generate_equals_and_hash; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - object.deprecated = message.deprecated; - if (message.java_string_check_utf8 != null && message.hasOwnProperty("java_string_check_utf8")) - object.java_string_check_utf8 = message.java_string_check_utf8; - if (message.cc_enable_arenas != null && message.hasOwnProperty("cc_enable_arenas")) - object.cc_enable_arenas = message.cc_enable_arenas; - if (message.objc_class_prefix != null && message.hasOwnProperty("objc_class_prefix")) - object.objc_class_prefix = message.objc_class_prefix; - if (message.csharp_namespace != null && message.hasOwnProperty("csharp_namespace")) - object.csharp_namespace = message.csharp_namespace; - if (message.uninterpreted_option && message.uninterpreted_option.length) { - object.uninterpreted_option = []; - for (let j = 0; j < message.uninterpreted_option.length; ++j) - object.uninterpreted_option[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpreted_option[j], options); - } - if (message[".gogoproto.goproto_getters_all"] != null && message.hasOwnProperty(".gogoproto.goproto_getters_all")) - object[".gogoproto.goproto_getters_all"] = message[".gogoproto.goproto_getters_all"]; - if (message[".gogoproto.goproto_enum_prefix_all"] != null && message.hasOwnProperty(".gogoproto.goproto_enum_prefix_all")) - object[".gogoproto.goproto_enum_prefix_all"] = message[".gogoproto.goproto_enum_prefix_all"]; - if (message[".gogoproto.goproto_stringer_all"] != null && message.hasOwnProperty(".gogoproto.goproto_stringer_all")) - object[".gogoproto.goproto_stringer_all"] = message[".gogoproto.goproto_stringer_all"]; - if (message[".gogoproto.verbose_equal_all"] != null && message.hasOwnProperty(".gogoproto.verbose_equal_all")) - object[".gogoproto.verbose_equal_all"] = message[".gogoproto.verbose_equal_all"]; - if (message[".gogoproto.face_all"] != null && message.hasOwnProperty(".gogoproto.face_all")) - object[".gogoproto.face_all"] = message[".gogoproto.face_all"]; - if (message[".gogoproto.gostring_all"] != null && message.hasOwnProperty(".gogoproto.gostring_all")) - object[".gogoproto.gostring_all"] = message[".gogoproto.gostring_all"]; - if (message[".gogoproto.populate_all"] != null && message.hasOwnProperty(".gogoproto.populate_all")) - object[".gogoproto.populate_all"] = message[".gogoproto.populate_all"]; - if (message[".gogoproto.stringer_all"] != null && message.hasOwnProperty(".gogoproto.stringer_all")) - object[".gogoproto.stringer_all"] = message[".gogoproto.stringer_all"]; - if (message[".gogoproto.onlyone_all"] != null && message.hasOwnProperty(".gogoproto.onlyone_all")) - object[".gogoproto.onlyone_all"] = message[".gogoproto.onlyone_all"]; - if (message[".gogoproto.equal_all"] != null && message.hasOwnProperty(".gogoproto.equal_all")) - object[".gogoproto.equal_all"] = message[".gogoproto.equal_all"]; - if (message[".gogoproto.description_all"] != null && message.hasOwnProperty(".gogoproto.description_all")) - object[".gogoproto.description_all"] = message[".gogoproto.description_all"]; - if (message[".gogoproto.testgen_all"] != null && message.hasOwnProperty(".gogoproto.testgen_all")) - object[".gogoproto.testgen_all"] = message[".gogoproto.testgen_all"]; - if (message[".gogoproto.benchgen_all"] != null && message.hasOwnProperty(".gogoproto.benchgen_all")) - object[".gogoproto.benchgen_all"] = message[".gogoproto.benchgen_all"]; - if (message[".gogoproto.marshaler_all"] != null && message.hasOwnProperty(".gogoproto.marshaler_all")) - object[".gogoproto.marshaler_all"] = message[".gogoproto.marshaler_all"]; - if (message[".gogoproto.unmarshaler_all"] != null && message.hasOwnProperty(".gogoproto.unmarshaler_all")) - object[".gogoproto.unmarshaler_all"] = message[".gogoproto.unmarshaler_all"]; - if (message[".gogoproto.stable_marshaler_all"] != null && message.hasOwnProperty(".gogoproto.stable_marshaler_all")) - object[".gogoproto.stable_marshaler_all"] = message[".gogoproto.stable_marshaler_all"]; - if (message[".gogoproto.sizer_all"] != null && message.hasOwnProperty(".gogoproto.sizer_all")) - object[".gogoproto.sizer_all"] = message[".gogoproto.sizer_all"]; - if (message[".gogoproto.goproto_enum_stringer_all"] != null && message.hasOwnProperty(".gogoproto.goproto_enum_stringer_all")) - object[".gogoproto.goproto_enum_stringer_all"] = message[".gogoproto.goproto_enum_stringer_all"]; - if (message[".gogoproto.enum_stringer_all"] != null && message.hasOwnProperty(".gogoproto.enum_stringer_all")) - object[".gogoproto.enum_stringer_all"] = message[".gogoproto.enum_stringer_all"]; - if (message[".gogoproto.unsafe_marshaler_all"] != null && message.hasOwnProperty(".gogoproto.unsafe_marshaler_all")) - object[".gogoproto.unsafe_marshaler_all"] = message[".gogoproto.unsafe_marshaler_all"]; - if (message[".gogoproto.unsafe_unmarshaler_all"] != null && message.hasOwnProperty(".gogoproto.unsafe_unmarshaler_all")) - object[".gogoproto.unsafe_unmarshaler_all"] = message[".gogoproto.unsafe_unmarshaler_all"]; - if (message[".gogoproto.goproto_extensions_map_all"] != null && message.hasOwnProperty(".gogoproto.goproto_extensions_map_all")) - object[".gogoproto.goproto_extensions_map_all"] = message[".gogoproto.goproto_extensions_map_all"]; - if (message[".gogoproto.goproto_unrecognized_all"] != null && message.hasOwnProperty(".gogoproto.goproto_unrecognized_all")) - object[".gogoproto.goproto_unrecognized_all"] = message[".gogoproto.goproto_unrecognized_all"]; - if (message[".gogoproto.gogoproto_import"] != null && message.hasOwnProperty(".gogoproto.gogoproto_import")) - object[".gogoproto.gogoproto_import"] = message[".gogoproto.gogoproto_import"]; - if (message[".gogoproto.protosizer_all"] != null && message.hasOwnProperty(".gogoproto.protosizer_all")) - object[".gogoproto.protosizer_all"] = message[".gogoproto.protosizer_all"]; - if (message[".gogoproto.compare_all"] != null && message.hasOwnProperty(".gogoproto.compare_all")) - object[".gogoproto.compare_all"] = message[".gogoproto.compare_all"]; - if (message[".gogoproto.typedecl_all"] != null && message.hasOwnProperty(".gogoproto.typedecl_all")) - object[".gogoproto.typedecl_all"] = message[".gogoproto.typedecl_all"]; - if (message[".gogoproto.enumdecl_all"] != null && message.hasOwnProperty(".gogoproto.enumdecl_all")) - object[".gogoproto.enumdecl_all"] = message[".gogoproto.enumdecl_all"]; - if (message[".gogoproto.goproto_registration"] != null && message.hasOwnProperty(".gogoproto.goproto_registration")) - object[".gogoproto.goproto_registration"] = message[".gogoproto.goproto_registration"]; - if (message[".gogoproto.messagename_all"] != null && message.hasOwnProperty(".gogoproto.messagename_all")) - object[".gogoproto.messagename_all"] = message[".gogoproto.messagename_all"]; - if (message[".gogoproto.goproto_sizecache_all"] != null && message.hasOwnProperty(".gogoproto.goproto_sizecache_all")) - object[".gogoproto.goproto_sizecache_all"] = message[".gogoproto.goproto_sizecache_all"]; - if (message[".gogoproto.goproto_unkeyed_all"] != null && message.hasOwnProperty(".gogoproto.goproto_unkeyed_all")) - object[".gogoproto.goproto_unkeyed_all"] = message[".gogoproto.goproto_unkeyed_all"]; - return object; - }; - - /** - * Converts this FileOptions to JSON. - * @function toJSON - * @memberof google.protobuf.FileOptions - * @instance - * @returns {Object.} JSON object - */ - FileOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * OptimizeMode enum. - * @name google.protobuf.FileOptions.OptimizeMode - * @enum {number} - * @property {number} SPEED=1 SPEED value - * @property {number} CODE_SIZE=2 CODE_SIZE value - * @property {number} LITE_RUNTIME=3 LITE_RUNTIME value - */ - FileOptions.OptimizeMode = (function() { - const valuesById = {}, values = Object.create(valuesById); - values[valuesById[1] = "SPEED"] = 1; - values[valuesById[2] = "CODE_SIZE"] = 2; - values[valuesById[3] = "LITE_RUNTIME"] = 3; - return values; - })(); - - return FileOptions; - })(); - - protobuf.MessageOptions = (function() { - - /** - * Properties of a MessageOptions. - * @memberof google.protobuf - * @interface IMessageOptions - * @property {boolean|null} [message_set_wire_format] MessageOptions message_set_wire_format - * @property {boolean|null} [no_standard_descriptor_accessor] MessageOptions no_standard_descriptor_accessor - * @property {boolean|null} [deprecated] MessageOptions deprecated - * @property {boolean|null} [map_entry] MessageOptions map_entry - * @property {Array.|null} [uninterpreted_option] MessageOptions uninterpreted_option - * @property {string|null} [".cosmos_proto.interface_type"] MessageOptions .cosmos_proto.interface_type - * @property {string|null} [".cosmos_proto.implements_interface"] MessageOptions .cosmos_proto.implements_interface - * @property {boolean|null} [".gogoproto.goproto_getters"] MessageOptions .gogoproto.goproto_getters - * @property {boolean|null} [".gogoproto.goproto_stringer"] MessageOptions .gogoproto.goproto_stringer - * @property {boolean|null} [".gogoproto.verbose_equal"] MessageOptions .gogoproto.verbose_equal - * @property {boolean|null} [".gogoproto.face"] MessageOptions .gogoproto.face - * @property {boolean|null} [".gogoproto.gostring"] MessageOptions .gogoproto.gostring - * @property {boolean|null} [".gogoproto.populate"] MessageOptions .gogoproto.populate - * @property {boolean|null} [".gogoproto.stringer"] MessageOptions .gogoproto.stringer - * @property {boolean|null} [".gogoproto.onlyone"] MessageOptions .gogoproto.onlyone - * @property {boolean|null} [".gogoproto.equal"] MessageOptions .gogoproto.equal - * @property {boolean|null} [".gogoproto.description"] MessageOptions .gogoproto.description - * @property {boolean|null} [".gogoproto.testgen"] MessageOptions .gogoproto.testgen - * @property {boolean|null} [".gogoproto.benchgen"] MessageOptions .gogoproto.benchgen - * @property {boolean|null} [".gogoproto.marshaler"] MessageOptions .gogoproto.marshaler - * @property {boolean|null} [".gogoproto.unmarshaler"] MessageOptions .gogoproto.unmarshaler - * @property {boolean|null} [".gogoproto.stable_marshaler"] MessageOptions .gogoproto.stable_marshaler - * @property {boolean|null} [".gogoproto.sizer"] MessageOptions .gogoproto.sizer - * @property {boolean|null} [".gogoproto.unsafe_marshaler"] MessageOptions .gogoproto.unsafe_marshaler - * @property {boolean|null} [".gogoproto.unsafe_unmarshaler"] MessageOptions .gogoproto.unsafe_unmarshaler - * @property {boolean|null} [".gogoproto.goproto_extensions_map"] MessageOptions .gogoproto.goproto_extensions_map - * @property {boolean|null} [".gogoproto.goproto_unrecognized"] MessageOptions .gogoproto.goproto_unrecognized - * @property {boolean|null} [".gogoproto.protosizer"] MessageOptions .gogoproto.protosizer - * @property {boolean|null} [".gogoproto.compare"] MessageOptions .gogoproto.compare - * @property {boolean|null} [".gogoproto.typedecl"] MessageOptions .gogoproto.typedecl - * @property {boolean|null} [".gogoproto.messagename"] MessageOptions .gogoproto.messagename - * @property {boolean|null} [".gogoproto.goproto_sizecache"] MessageOptions .gogoproto.goproto_sizecache - * @property {boolean|null} [".gogoproto.goproto_unkeyed"] MessageOptions .gogoproto.goproto_unkeyed - */ - - /** - * Constructs a new MessageOptions. - * @memberof google.protobuf - * @classdesc Represents a MessageOptions. - * @implements IMessageOptions - * @constructor - * @param {google.protobuf.IMessageOptions=} [properties] Properties to set - */ - function MessageOptions(properties) { - this.uninterpreted_option = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MessageOptions message_set_wire_format. - * @member {boolean} message_set_wire_format - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype.message_set_wire_format = false; - - /** - * MessageOptions no_standard_descriptor_accessor. - * @member {boolean} no_standard_descriptor_accessor - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype.no_standard_descriptor_accessor = false; - - /** - * MessageOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype.deprecated = false; - - /** - * MessageOptions map_entry. - * @member {boolean} map_entry - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype.map_entry = false; - - /** - * MessageOptions uninterpreted_option. - * @member {Array.} uninterpreted_option - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype.uninterpreted_option = $util.emptyArray; - - /** - * MessageOptions .cosmos_proto.interface_type. - * @member {string} .cosmos_proto.interface_type - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype[".cosmos_proto.interface_type"] = ""; - - /** - * MessageOptions .cosmos_proto.implements_interface. - * @member {string} .cosmos_proto.implements_interface - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype[".cosmos_proto.implements_interface"] = ""; - - /** - * MessageOptions .gogoproto.goproto_getters. - * @member {boolean} .gogoproto.goproto_getters - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype[".gogoproto.goproto_getters"] = false; - - /** - * MessageOptions .gogoproto.goproto_stringer. - * @member {boolean} .gogoproto.goproto_stringer - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype[".gogoproto.goproto_stringer"] = false; - - /** - * MessageOptions .gogoproto.verbose_equal. - * @member {boolean} .gogoproto.verbose_equal - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype[".gogoproto.verbose_equal"] = false; - - /** - * MessageOptions .gogoproto.face. - * @member {boolean} .gogoproto.face - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype[".gogoproto.face"] = false; - - /** - * MessageOptions .gogoproto.gostring. - * @member {boolean} .gogoproto.gostring - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype[".gogoproto.gostring"] = false; - - /** - * MessageOptions .gogoproto.populate. - * @member {boolean} .gogoproto.populate - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype[".gogoproto.populate"] = false; - - /** - * MessageOptions .gogoproto.stringer. - * @member {boolean} .gogoproto.stringer - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype[".gogoproto.stringer"] = false; - - /** - * MessageOptions .gogoproto.onlyone. - * @member {boolean} .gogoproto.onlyone - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype[".gogoproto.onlyone"] = false; - - /** - * MessageOptions .gogoproto.equal. - * @member {boolean} .gogoproto.equal - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype[".gogoproto.equal"] = false; - - /** - * MessageOptions .gogoproto.description. - * @member {boolean} .gogoproto.description - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype[".gogoproto.description"] = false; - - /** - * MessageOptions .gogoproto.testgen. - * @member {boolean} .gogoproto.testgen - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype[".gogoproto.testgen"] = false; - - /** - * MessageOptions .gogoproto.benchgen. - * @member {boolean} .gogoproto.benchgen - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype[".gogoproto.benchgen"] = false; - - /** - * MessageOptions .gogoproto.marshaler. - * @member {boolean} .gogoproto.marshaler - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype[".gogoproto.marshaler"] = false; - - /** - * MessageOptions .gogoproto.unmarshaler. - * @member {boolean} .gogoproto.unmarshaler - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype[".gogoproto.unmarshaler"] = false; - - /** - * MessageOptions .gogoproto.stable_marshaler. - * @member {boolean} .gogoproto.stable_marshaler - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype[".gogoproto.stable_marshaler"] = false; - - /** - * MessageOptions .gogoproto.sizer. - * @member {boolean} .gogoproto.sizer - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype[".gogoproto.sizer"] = false; - - /** - * MessageOptions .gogoproto.unsafe_marshaler. - * @member {boolean} .gogoproto.unsafe_marshaler - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype[".gogoproto.unsafe_marshaler"] = false; - - /** - * MessageOptions .gogoproto.unsafe_unmarshaler. - * @member {boolean} .gogoproto.unsafe_unmarshaler - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype[".gogoproto.unsafe_unmarshaler"] = false; - - /** - * MessageOptions .gogoproto.goproto_extensions_map. - * @member {boolean} .gogoproto.goproto_extensions_map - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype[".gogoproto.goproto_extensions_map"] = false; - - /** - * MessageOptions .gogoproto.goproto_unrecognized. - * @member {boolean} .gogoproto.goproto_unrecognized - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype[".gogoproto.goproto_unrecognized"] = false; - - /** - * MessageOptions .gogoproto.protosizer. - * @member {boolean} .gogoproto.protosizer - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype[".gogoproto.protosizer"] = false; - - /** - * MessageOptions .gogoproto.compare. - * @member {boolean} .gogoproto.compare - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype[".gogoproto.compare"] = false; - - /** - * MessageOptions .gogoproto.typedecl. - * @member {boolean} .gogoproto.typedecl - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype[".gogoproto.typedecl"] = false; - - /** - * MessageOptions .gogoproto.messagename. - * @member {boolean} .gogoproto.messagename - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype[".gogoproto.messagename"] = false; - - /** - * MessageOptions .gogoproto.goproto_sizecache. - * @member {boolean} .gogoproto.goproto_sizecache - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype[".gogoproto.goproto_sizecache"] = false; - - /** - * MessageOptions .gogoproto.goproto_unkeyed. - * @member {boolean} .gogoproto.goproto_unkeyed - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype[".gogoproto.goproto_unkeyed"] = false; - - /** - * Encodes the specified MessageOptions message. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.MessageOptions - * @static - * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MessageOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.message_set_wire_format != null && Object.hasOwnProperty.call(message, "message_set_wire_format")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.message_set_wire_format); - if (message.no_standard_descriptor_accessor != null && Object.hasOwnProperty.call(message, "no_standard_descriptor_accessor")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.no_standard_descriptor_accessor); - if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); - if (message.map_entry != null && Object.hasOwnProperty.call(message, "map_entry")) - writer.uint32(/* id 7, wireType 0 =*/56).bool(message.map_entry); - if (message.uninterpreted_option != null && message.uninterpreted_option.length) - for (let i = 0; i < message.uninterpreted_option.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpreted_option[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - if (message[".gogoproto.goproto_getters"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_getters")) - writer.uint32(/* id 64001, wireType 0 =*/512008).bool(message[".gogoproto.goproto_getters"]); - if (message[".gogoproto.goproto_stringer"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_stringer")) - writer.uint32(/* id 64003, wireType 0 =*/512024).bool(message[".gogoproto.goproto_stringer"]); - if (message[".gogoproto.verbose_equal"] != null && Object.hasOwnProperty.call(message, ".gogoproto.verbose_equal")) - writer.uint32(/* id 64004, wireType 0 =*/512032).bool(message[".gogoproto.verbose_equal"]); - if (message[".gogoproto.face"] != null && Object.hasOwnProperty.call(message, ".gogoproto.face")) - writer.uint32(/* id 64005, wireType 0 =*/512040).bool(message[".gogoproto.face"]); - if (message[".gogoproto.gostring"] != null && Object.hasOwnProperty.call(message, ".gogoproto.gostring")) - writer.uint32(/* id 64006, wireType 0 =*/512048).bool(message[".gogoproto.gostring"]); - if (message[".gogoproto.populate"] != null && Object.hasOwnProperty.call(message, ".gogoproto.populate")) - writer.uint32(/* id 64007, wireType 0 =*/512056).bool(message[".gogoproto.populate"]); - if (message[".gogoproto.onlyone"] != null && Object.hasOwnProperty.call(message, ".gogoproto.onlyone")) - writer.uint32(/* id 64009, wireType 0 =*/512072).bool(message[".gogoproto.onlyone"]); - if (message[".gogoproto.equal"] != null && Object.hasOwnProperty.call(message, ".gogoproto.equal")) - writer.uint32(/* id 64013, wireType 0 =*/512104).bool(message[".gogoproto.equal"]); - if (message[".gogoproto.description"] != null && Object.hasOwnProperty.call(message, ".gogoproto.description")) - writer.uint32(/* id 64014, wireType 0 =*/512112).bool(message[".gogoproto.description"]); - if (message[".gogoproto.testgen"] != null && Object.hasOwnProperty.call(message, ".gogoproto.testgen")) - writer.uint32(/* id 64015, wireType 0 =*/512120).bool(message[".gogoproto.testgen"]); - if (message[".gogoproto.benchgen"] != null && Object.hasOwnProperty.call(message, ".gogoproto.benchgen")) - writer.uint32(/* id 64016, wireType 0 =*/512128).bool(message[".gogoproto.benchgen"]); - if (message[".gogoproto.marshaler"] != null && Object.hasOwnProperty.call(message, ".gogoproto.marshaler")) - writer.uint32(/* id 64017, wireType 0 =*/512136).bool(message[".gogoproto.marshaler"]); - if (message[".gogoproto.unmarshaler"] != null && Object.hasOwnProperty.call(message, ".gogoproto.unmarshaler")) - writer.uint32(/* id 64018, wireType 0 =*/512144).bool(message[".gogoproto.unmarshaler"]); - if (message[".gogoproto.stable_marshaler"] != null && Object.hasOwnProperty.call(message, ".gogoproto.stable_marshaler")) - writer.uint32(/* id 64019, wireType 0 =*/512152).bool(message[".gogoproto.stable_marshaler"]); - if (message[".gogoproto.sizer"] != null && Object.hasOwnProperty.call(message, ".gogoproto.sizer")) - writer.uint32(/* id 64020, wireType 0 =*/512160).bool(message[".gogoproto.sizer"]); - if (message[".gogoproto.unsafe_marshaler"] != null && Object.hasOwnProperty.call(message, ".gogoproto.unsafe_marshaler")) - writer.uint32(/* id 64023, wireType 0 =*/512184).bool(message[".gogoproto.unsafe_marshaler"]); - if (message[".gogoproto.unsafe_unmarshaler"] != null && Object.hasOwnProperty.call(message, ".gogoproto.unsafe_unmarshaler")) - writer.uint32(/* id 64024, wireType 0 =*/512192).bool(message[".gogoproto.unsafe_unmarshaler"]); - if (message[".gogoproto.goproto_extensions_map"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_extensions_map")) - writer.uint32(/* id 64025, wireType 0 =*/512200).bool(message[".gogoproto.goproto_extensions_map"]); - if (message[".gogoproto.goproto_unrecognized"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_unrecognized")) - writer.uint32(/* id 64026, wireType 0 =*/512208).bool(message[".gogoproto.goproto_unrecognized"]); - if (message[".gogoproto.protosizer"] != null && Object.hasOwnProperty.call(message, ".gogoproto.protosizer")) - writer.uint32(/* id 64028, wireType 0 =*/512224).bool(message[".gogoproto.protosizer"]); - if (message[".gogoproto.compare"] != null && Object.hasOwnProperty.call(message, ".gogoproto.compare")) - writer.uint32(/* id 64029, wireType 0 =*/512232).bool(message[".gogoproto.compare"]); - if (message[".gogoproto.typedecl"] != null && Object.hasOwnProperty.call(message, ".gogoproto.typedecl")) - writer.uint32(/* id 64030, wireType 0 =*/512240).bool(message[".gogoproto.typedecl"]); - if (message[".gogoproto.messagename"] != null && Object.hasOwnProperty.call(message, ".gogoproto.messagename")) - writer.uint32(/* id 64033, wireType 0 =*/512264).bool(message[".gogoproto.messagename"]); - if (message[".gogoproto.goproto_sizecache"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_sizecache")) - writer.uint32(/* id 64034, wireType 0 =*/512272).bool(message[".gogoproto.goproto_sizecache"]); - if (message[".gogoproto.goproto_unkeyed"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_unkeyed")) - writer.uint32(/* id 64035, wireType 0 =*/512280).bool(message[".gogoproto.goproto_unkeyed"]); - if (message[".gogoproto.stringer"] != null && Object.hasOwnProperty.call(message, ".gogoproto.stringer")) - writer.uint32(/* id 67008, wireType 0 =*/536064).bool(message[".gogoproto.stringer"]); - if (message[".cosmos_proto.interface_type"] != null && Object.hasOwnProperty.call(message, ".cosmos_proto.interface_type")) - writer.uint32(/* id 93001, wireType 2 =*/744010).string(message[".cosmos_proto.interface_type"]); - if (message[".cosmos_proto.implements_interface"] != null && Object.hasOwnProperty.call(message, ".cosmos_proto.implements_interface")) - writer.uint32(/* id 93002, wireType 2 =*/744018).string(message[".cosmos_proto.implements_interface"]); - return writer; - }; - - /** - * Encodes the specified MessageOptions message, length delimited. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.MessageOptions - * @static - * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MessageOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MessageOptions message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.MessageOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.MessageOptions} MessageOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MessageOptions.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MessageOptions(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.message_set_wire_format = reader.bool(); - break; - case 2: - message.no_standard_descriptor_accessor = reader.bool(); - break; - case 3: - message.deprecated = reader.bool(); - break; - case 7: - message.map_entry = reader.bool(); - break; - case 999: - if (!(message.uninterpreted_option && message.uninterpreted_option.length)) - message.uninterpreted_option = []; - message.uninterpreted_option.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - case 93001: - message[".cosmos_proto.interface_type"] = reader.string(); - break; - case 93002: - message[".cosmos_proto.implements_interface"] = reader.string(); - break; - case 64001: - message[".gogoproto.goproto_getters"] = reader.bool(); - break; - case 64003: - message[".gogoproto.goproto_stringer"] = reader.bool(); - break; - case 64004: - message[".gogoproto.verbose_equal"] = reader.bool(); - break; - case 64005: - message[".gogoproto.face"] = reader.bool(); - break; - case 64006: - message[".gogoproto.gostring"] = reader.bool(); - break; - case 64007: - message[".gogoproto.populate"] = reader.bool(); - break; - case 67008: - message[".gogoproto.stringer"] = reader.bool(); - break; - case 64009: - message[".gogoproto.onlyone"] = reader.bool(); - break; - case 64013: - message[".gogoproto.equal"] = reader.bool(); - break; - case 64014: - message[".gogoproto.description"] = reader.bool(); - break; - case 64015: - message[".gogoproto.testgen"] = reader.bool(); - break; - case 64016: - message[".gogoproto.benchgen"] = reader.bool(); - break; - case 64017: - message[".gogoproto.marshaler"] = reader.bool(); - break; - case 64018: - message[".gogoproto.unmarshaler"] = reader.bool(); - break; - case 64019: - message[".gogoproto.stable_marshaler"] = reader.bool(); - break; - case 64020: - message[".gogoproto.sizer"] = reader.bool(); - break; - case 64023: - message[".gogoproto.unsafe_marshaler"] = reader.bool(); - break; - case 64024: - message[".gogoproto.unsafe_unmarshaler"] = reader.bool(); - break; - case 64025: - message[".gogoproto.goproto_extensions_map"] = reader.bool(); - break; - case 64026: - message[".gogoproto.goproto_unrecognized"] = reader.bool(); - break; - case 64028: - message[".gogoproto.protosizer"] = reader.bool(); - break; - case 64029: - message[".gogoproto.compare"] = reader.bool(); - break; - case 64030: - message[".gogoproto.typedecl"] = reader.bool(); - break; - case 64033: - message[".gogoproto.messagename"] = reader.bool(); - break; - case 64034: - message[".gogoproto.goproto_sizecache"] = reader.bool(); - break; - case 64035: - message[".gogoproto.goproto_unkeyed"] = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MessageOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.MessageOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.MessageOptions} MessageOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MessageOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MessageOptions message. - * @function verify - * @memberof google.protobuf.MessageOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MessageOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.message_set_wire_format != null && message.hasOwnProperty("message_set_wire_format")) - if (typeof message.message_set_wire_format !== "boolean") - return "message_set_wire_format: boolean expected"; - if (message.no_standard_descriptor_accessor != null && message.hasOwnProperty("no_standard_descriptor_accessor")) - if (typeof message.no_standard_descriptor_accessor !== "boolean") - return "no_standard_descriptor_accessor: boolean expected"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - if (typeof message.deprecated !== "boolean") - return "deprecated: boolean expected"; - if (message.map_entry != null && message.hasOwnProperty("map_entry")) - if (typeof message.map_entry !== "boolean") - return "map_entry: boolean expected"; - if (message.uninterpreted_option != null && message.hasOwnProperty("uninterpreted_option")) { - if (!Array.isArray(message.uninterpreted_option)) - return "uninterpreted_option: array expected"; - for (let i = 0; i < message.uninterpreted_option.length; ++i) { - let error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpreted_option[i]); - if (error) - return "uninterpreted_option." + error; - } - } - if (message[".cosmos_proto.interface_type"] != null && message.hasOwnProperty(".cosmos_proto.interface_type")) - if (!$util.isString(message[".cosmos_proto.interface_type"])) - return ".cosmos_proto.interface_type: string expected"; - if (message[".cosmos_proto.implements_interface"] != null && message.hasOwnProperty(".cosmos_proto.implements_interface")) - if (!$util.isString(message[".cosmos_proto.implements_interface"])) - return ".cosmos_proto.implements_interface: string expected"; - if (message[".gogoproto.goproto_getters"] != null && message.hasOwnProperty(".gogoproto.goproto_getters")) - if (typeof message[".gogoproto.goproto_getters"] !== "boolean") - return ".gogoproto.goproto_getters: boolean expected"; - if (message[".gogoproto.goproto_stringer"] != null && message.hasOwnProperty(".gogoproto.goproto_stringer")) - if (typeof message[".gogoproto.goproto_stringer"] !== "boolean") - return ".gogoproto.goproto_stringer: boolean expected"; - if (message[".gogoproto.verbose_equal"] != null && message.hasOwnProperty(".gogoproto.verbose_equal")) - if (typeof message[".gogoproto.verbose_equal"] !== "boolean") - return ".gogoproto.verbose_equal: boolean expected"; - if (message[".gogoproto.face"] != null && message.hasOwnProperty(".gogoproto.face")) - if (typeof message[".gogoproto.face"] !== "boolean") - return ".gogoproto.face: boolean expected"; - if (message[".gogoproto.gostring"] != null && message.hasOwnProperty(".gogoproto.gostring")) - if (typeof message[".gogoproto.gostring"] !== "boolean") - return ".gogoproto.gostring: boolean expected"; - if (message[".gogoproto.populate"] != null && message.hasOwnProperty(".gogoproto.populate")) - if (typeof message[".gogoproto.populate"] !== "boolean") - return ".gogoproto.populate: boolean expected"; - if (message[".gogoproto.stringer"] != null && message.hasOwnProperty(".gogoproto.stringer")) - if (typeof message[".gogoproto.stringer"] !== "boolean") - return ".gogoproto.stringer: boolean expected"; - if (message[".gogoproto.onlyone"] != null && message.hasOwnProperty(".gogoproto.onlyone")) - if (typeof message[".gogoproto.onlyone"] !== "boolean") - return ".gogoproto.onlyone: boolean expected"; - if (message[".gogoproto.equal"] != null && message.hasOwnProperty(".gogoproto.equal")) - if (typeof message[".gogoproto.equal"] !== "boolean") - return ".gogoproto.equal: boolean expected"; - if (message[".gogoproto.description"] != null && message.hasOwnProperty(".gogoproto.description")) - if (typeof message[".gogoproto.description"] !== "boolean") - return ".gogoproto.description: boolean expected"; - if (message[".gogoproto.testgen"] != null && message.hasOwnProperty(".gogoproto.testgen")) - if (typeof message[".gogoproto.testgen"] !== "boolean") - return ".gogoproto.testgen: boolean expected"; - if (message[".gogoproto.benchgen"] != null && message.hasOwnProperty(".gogoproto.benchgen")) - if (typeof message[".gogoproto.benchgen"] !== "boolean") - return ".gogoproto.benchgen: boolean expected"; - if (message[".gogoproto.marshaler"] != null && message.hasOwnProperty(".gogoproto.marshaler")) - if (typeof message[".gogoproto.marshaler"] !== "boolean") - return ".gogoproto.marshaler: boolean expected"; - if (message[".gogoproto.unmarshaler"] != null && message.hasOwnProperty(".gogoproto.unmarshaler")) - if (typeof message[".gogoproto.unmarshaler"] !== "boolean") - return ".gogoproto.unmarshaler: boolean expected"; - if (message[".gogoproto.stable_marshaler"] != null && message.hasOwnProperty(".gogoproto.stable_marshaler")) - if (typeof message[".gogoproto.stable_marshaler"] !== "boolean") - return ".gogoproto.stable_marshaler: boolean expected"; - if (message[".gogoproto.sizer"] != null && message.hasOwnProperty(".gogoproto.sizer")) - if (typeof message[".gogoproto.sizer"] !== "boolean") - return ".gogoproto.sizer: boolean expected"; - if (message[".gogoproto.unsafe_marshaler"] != null && message.hasOwnProperty(".gogoproto.unsafe_marshaler")) - if (typeof message[".gogoproto.unsafe_marshaler"] !== "boolean") - return ".gogoproto.unsafe_marshaler: boolean expected"; - if (message[".gogoproto.unsafe_unmarshaler"] != null && message.hasOwnProperty(".gogoproto.unsafe_unmarshaler")) - if (typeof message[".gogoproto.unsafe_unmarshaler"] !== "boolean") - return ".gogoproto.unsafe_unmarshaler: boolean expected"; - if (message[".gogoproto.goproto_extensions_map"] != null && message.hasOwnProperty(".gogoproto.goproto_extensions_map")) - if (typeof message[".gogoproto.goproto_extensions_map"] !== "boolean") - return ".gogoproto.goproto_extensions_map: boolean expected"; - if (message[".gogoproto.goproto_unrecognized"] != null && message.hasOwnProperty(".gogoproto.goproto_unrecognized")) - if (typeof message[".gogoproto.goproto_unrecognized"] !== "boolean") - return ".gogoproto.goproto_unrecognized: boolean expected"; - if (message[".gogoproto.protosizer"] != null && message.hasOwnProperty(".gogoproto.protosizer")) - if (typeof message[".gogoproto.protosizer"] !== "boolean") - return ".gogoproto.protosizer: boolean expected"; - if (message[".gogoproto.compare"] != null && message.hasOwnProperty(".gogoproto.compare")) - if (typeof message[".gogoproto.compare"] !== "boolean") - return ".gogoproto.compare: boolean expected"; - if (message[".gogoproto.typedecl"] != null && message.hasOwnProperty(".gogoproto.typedecl")) - if (typeof message[".gogoproto.typedecl"] !== "boolean") - return ".gogoproto.typedecl: boolean expected"; - if (message[".gogoproto.messagename"] != null && message.hasOwnProperty(".gogoproto.messagename")) - if (typeof message[".gogoproto.messagename"] !== "boolean") - return ".gogoproto.messagename: boolean expected"; - if (message[".gogoproto.goproto_sizecache"] != null && message.hasOwnProperty(".gogoproto.goproto_sizecache")) - if (typeof message[".gogoproto.goproto_sizecache"] !== "boolean") - return ".gogoproto.goproto_sizecache: boolean expected"; - if (message[".gogoproto.goproto_unkeyed"] != null && message.hasOwnProperty(".gogoproto.goproto_unkeyed")) - if (typeof message[".gogoproto.goproto_unkeyed"] !== "boolean") - return ".gogoproto.goproto_unkeyed: boolean expected"; - return null; - }; - - /** - * Creates a MessageOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.MessageOptions - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.MessageOptions} MessageOptions - */ - MessageOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.MessageOptions) - return object; - let message = new $root.google.protobuf.MessageOptions(); - if (object.message_set_wire_format != null) - message.message_set_wire_format = Boolean(object.message_set_wire_format); - if (object.no_standard_descriptor_accessor != null) - message.no_standard_descriptor_accessor = Boolean(object.no_standard_descriptor_accessor); - if (object.deprecated != null) - message.deprecated = Boolean(object.deprecated); - if (object.map_entry != null) - message.map_entry = Boolean(object.map_entry); - if (object.uninterpreted_option) { - if (!Array.isArray(object.uninterpreted_option)) - throw TypeError(".google.protobuf.MessageOptions.uninterpreted_option: array expected"); - message.uninterpreted_option = []; - for (let i = 0; i < object.uninterpreted_option.length; ++i) { - if (typeof object.uninterpreted_option[i] !== "object") - throw TypeError(".google.protobuf.MessageOptions.uninterpreted_option: object expected"); - message.uninterpreted_option[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpreted_option[i]); - } - } - if (object[".cosmos_proto.interface_type"] != null) - message[".cosmos_proto.interface_type"] = String(object[".cosmos_proto.interface_type"]); - if (object[".cosmos_proto.implements_interface"] != null) - message[".cosmos_proto.implements_interface"] = String(object[".cosmos_proto.implements_interface"]); - if (object[".gogoproto.goproto_getters"] != null) - message[".gogoproto.goproto_getters"] = Boolean(object[".gogoproto.goproto_getters"]); - if (object[".gogoproto.goproto_stringer"] != null) - message[".gogoproto.goproto_stringer"] = Boolean(object[".gogoproto.goproto_stringer"]); - if (object[".gogoproto.verbose_equal"] != null) - message[".gogoproto.verbose_equal"] = Boolean(object[".gogoproto.verbose_equal"]); - if (object[".gogoproto.face"] != null) - message[".gogoproto.face"] = Boolean(object[".gogoproto.face"]); - if (object[".gogoproto.gostring"] != null) - message[".gogoproto.gostring"] = Boolean(object[".gogoproto.gostring"]); - if (object[".gogoproto.populate"] != null) - message[".gogoproto.populate"] = Boolean(object[".gogoproto.populate"]); - if (object[".gogoproto.stringer"] != null) - message[".gogoproto.stringer"] = Boolean(object[".gogoproto.stringer"]); - if (object[".gogoproto.onlyone"] != null) - message[".gogoproto.onlyone"] = Boolean(object[".gogoproto.onlyone"]); - if (object[".gogoproto.equal"] != null) - message[".gogoproto.equal"] = Boolean(object[".gogoproto.equal"]); - if (object[".gogoproto.description"] != null) - message[".gogoproto.description"] = Boolean(object[".gogoproto.description"]); - if (object[".gogoproto.testgen"] != null) - message[".gogoproto.testgen"] = Boolean(object[".gogoproto.testgen"]); - if (object[".gogoproto.benchgen"] != null) - message[".gogoproto.benchgen"] = Boolean(object[".gogoproto.benchgen"]); - if (object[".gogoproto.marshaler"] != null) - message[".gogoproto.marshaler"] = Boolean(object[".gogoproto.marshaler"]); - if (object[".gogoproto.unmarshaler"] != null) - message[".gogoproto.unmarshaler"] = Boolean(object[".gogoproto.unmarshaler"]); - if (object[".gogoproto.stable_marshaler"] != null) - message[".gogoproto.stable_marshaler"] = Boolean(object[".gogoproto.stable_marshaler"]); - if (object[".gogoproto.sizer"] != null) - message[".gogoproto.sizer"] = Boolean(object[".gogoproto.sizer"]); - if (object[".gogoproto.unsafe_marshaler"] != null) - message[".gogoproto.unsafe_marshaler"] = Boolean(object[".gogoproto.unsafe_marshaler"]); - if (object[".gogoproto.unsafe_unmarshaler"] != null) - message[".gogoproto.unsafe_unmarshaler"] = Boolean(object[".gogoproto.unsafe_unmarshaler"]); - if (object[".gogoproto.goproto_extensions_map"] != null) - message[".gogoproto.goproto_extensions_map"] = Boolean(object[".gogoproto.goproto_extensions_map"]); - if (object[".gogoproto.goproto_unrecognized"] != null) - message[".gogoproto.goproto_unrecognized"] = Boolean(object[".gogoproto.goproto_unrecognized"]); - if (object[".gogoproto.protosizer"] != null) - message[".gogoproto.protosizer"] = Boolean(object[".gogoproto.protosizer"]); - if (object[".gogoproto.compare"] != null) - message[".gogoproto.compare"] = Boolean(object[".gogoproto.compare"]); - if (object[".gogoproto.typedecl"] != null) - message[".gogoproto.typedecl"] = Boolean(object[".gogoproto.typedecl"]); - if (object[".gogoproto.messagename"] != null) - message[".gogoproto.messagename"] = Boolean(object[".gogoproto.messagename"]); - if (object[".gogoproto.goproto_sizecache"] != null) - message[".gogoproto.goproto_sizecache"] = Boolean(object[".gogoproto.goproto_sizecache"]); - if (object[".gogoproto.goproto_unkeyed"] != null) - message[".gogoproto.goproto_unkeyed"] = Boolean(object[".gogoproto.goproto_unkeyed"]); - return message; - }; - - /** - * Creates a plain object from a MessageOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.MessageOptions - * @static - * @param {google.protobuf.MessageOptions} message MessageOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MessageOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.uninterpreted_option = []; - if (options.defaults) { - object.message_set_wire_format = false; - object.no_standard_descriptor_accessor = false; - object.deprecated = false; - object.map_entry = false; - object[".gogoproto.goproto_getters"] = false; - object[".gogoproto.goproto_stringer"] = false; - object[".gogoproto.verbose_equal"] = false; - object[".gogoproto.face"] = false; - object[".gogoproto.gostring"] = false; - object[".gogoproto.populate"] = false; - object[".gogoproto.onlyone"] = false; - object[".gogoproto.equal"] = false; - object[".gogoproto.description"] = false; - object[".gogoproto.testgen"] = false; - object[".gogoproto.benchgen"] = false; - object[".gogoproto.marshaler"] = false; - object[".gogoproto.unmarshaler"] = false; - object[".gogoproto.stable_marshaler"] = false; - object[".gogoproto.sizer"] = false; - object[".gogoproto.unsafe_marshaler"] = false; - object[".gogoproto.unsafe_unmarshaler"] = false; - object[".gogoproto.goproto_extensions_map"] = false; - object[".gogoproto.goproto_unrecognized"] = false; - object[".gogoproto.protosizer"] = false; - object[".gogoproto.compare"] = false; - object[".gogoproto.typedecl"] = false; - object[".gogoproto.messagename"] = false; - object[".gogoproto.goproto_sizecache"] = false; - object[".gogoproto.goproto_unkeyed"] = false; - object[".gogoproto.stringer"] = false; - object[".cosmos_proto.interface_type"] = ""; - object[".cosmos_proto.implements_interface"] = ""; - } - if (message.message_set_wire_format != null && message.hasOwnProperty("message_set_wire_format")) - object.message_set_wire_format = message.message_set_wire_format; - if (message.no_standard_descriptor_accessor != null && message.hasOwnProperty("no_standard_descriptor_accessor")) - object.no_standard_descriptor_accessor = message.no_standard_descriptor_accessor; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - object.deprecated = message.deprecated; - if (message.map_entry != null && message.hasOwnProperty("map_entry")) - object.map_entry = message.map_entry; - if (message.uninterpreted_option && message.uninterpreted_option.length) { - object.uninterpreted_option = []; - for (let j = 0; j < message.uninterpreted_option.length; ++j) - object.uninterpreted_option[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpreted_option[j], options); - } - if (message[".gogoproto.goproto_getters"] != null && message.hasOwnProperty(".gogoproto.goproto_getters")) - object[".gogoproto.goproto_getters"] = message[".gogoproto.goproto_getters"]; - if (message[".gogoproto.goproto_stringer"] != null && message.hasOwnProperty(".gogoproto.goproto_stringer")) - object[".gogoproto.goproto_stringer"] = message[".gogoproto.goproto_stringer"]; - if (message[".gogoproto.verbose_equal"] != null && message.hasOwnProperty(".gogoproto.verbose_equal")) - object[".gogoproto.verbose_equal"] = message[".gogoproto.verbose_equal"]; - if (message[".gogoproto.face"] != null && message.hasOwnProperty(".gogoproto.face")) - object[".gogoproto.face"] = message[".gogoproto.face"]; - if (message[".gogoproto.gostring"] != null && message.hasOwnProperty(".gogoproto.gostring")) - object[".gogoproto.gostring"] = message[".gogoproto.gostring"]; - if (message[".gogoproto.populate"] != null && message.hasOwnProperty(".gogoproto.populate")) - object[".gogoproto.populate"] = message[".gogoproto.populate"]; - if (message[".gogoproto.onlyone"] != null && message.hasOwnProperty(".gogoproto.onlyone")) - object[".gogoproto.onlyone"] = message[".gogoproto.onlyone"]; - if (message[".gogoproto.equal"] != null && message.hasOwnProperty(".gogoproto.equal")) - object[".gogoproto.equal"] = message[".gogoproto.equal"]; - if (message[".gogoproto.description"] != null && message.hasOwnProperty(".gogoproto.description")) - object[".gogoproto.description"] = message[".gogoproto.description"]; - if (message[".gogoproto.testgen"] != null && message.hasOwnProperty(".gogoproto.testgen")) - object[".gogoproto.testgen"] = message[".gogoproto.testgen"]; - if (message[".gogoproto.benchgen"] != null && message.hasOwnProperty(".gogoproto.benchgen")) - object[".gogoproto.benchgen"] = message[".gogoproto.benchgen"]; - if (message[".gogoproto.marshaler"] != null && message.hasOwnProperty(".gogoproto.marshaler")) - object[".gogoproto.marshaler"] = message[".gogoproto.marshaler"]; - if (message[".gogoproto.unmarshaler"] != null && message.hasOwnProperty(".gogoproto.unmarshaler")) - object[".gogoproto.unmarshaler"] = message[".gogoproto.unmarshaler"]; - if (message[".gogoproto.stable_marshaler"] != null && message.hasOwnProperty(".gogoproto.stable_marshaler")) - object[".gogoproto.stable_marshaler"] = message[".gogoproto.stable_marshaler"]; - if (message[".gogoproto.sizer"] != null && message.hasOwnProperty(".gogoproto.sizer")) - object[".gogoproto.sizer"] = message[".gogoproto.sizer"]; - if (message[".gogoproto.unsafe_marshaler"] != null && message.hasOwnProperty(".gogoproto.unsafe_marshaler")) - object[".gogoproto.unsafe_marshaler"] = message[".gogoproto.unsafe_marshaler"]; - if (message[".gogoproto.unsafe_unmarshaler"] != null && message.hasOwnProperty(".gogoproto.unsafe_unmarshaler")) - object[".gogoproto.unsafe_unmarshaler"] = message[".gogoproto.unsafe_unmarshaler"]; - if (message[".gogoproto.goproto_extensions_map"] != null && message.hasOwnProperty(".gogoproto.goproto_extensions_map")) - object[".gogoproto.goproto_extensions_map"] = message[".gogoproto.goproto_extensions_map"]; - if (message[".gogoproto.goproto_unrecognized"] != null && message.hasOwnProperty(".gogoproto.goproto_unrecognized")) - object[".gogoproto.goproto_unrecognized"] = message[".gogoproto.goproto_unrecognized"]; - if (message[".gogoproto.protosizer"] != null && message.hasOwnProperty(".gogoproto.protosizer")) - object[".gogoproto.protosizer"] = message[".gogoproto.protosizer"]; - if (message[".gogoproto.compare"] != null && message.hasOwnProperty(".gogoproto.compare")) - object[".gogoproto.compare"] = message[".gogoproto.compare"]; - if (message[".gogoproto.typedecl"] != null && message.hasOwnProperty(".gogoproto.typedecl")) - object[".gogoproto.typedecl"] = message[".gogoproto.typedecl"]; - if (message[".gogoproto.messagename"] != null && message.hasOwnProperty(".gogoproto.messagename")) - object[".gogoproto.messagename"] = message[".gogoproto.messagename"]; - if (message[".gogoproto.goproto_sizecache"] != null && message.hasOwnProperty(".gogoproto.goproto_sizecache")) - object[".gogoproto.goproto_sizecache"] = message[".gogoproto.goproto_sizecache"]; - if (message[".gogoproto.goproto_unkeyed"] != null && message.hasOwnProperty(".gogoproto.goproto_unkeyed")) - object[".gogoproto.goproto_unkeyed"] = message[".gogoproto.goproto_unkeyed"]; - if (message[".gogoproto.stringer"] != null && message.hasOwnProperty(".gogoproto.stringer")) - object[".gogoproto.stringer"] = message[".gogoproto.stringer"]; - if (message[".cosmos_proto.interface_type"] != null && message.hasOwnProperty(".cosmos_proto.interface_type")) - object[".cosmos_proto.interface_type"] = message[".cosmos_proto.interface_type"]; - if (message[".cosmos_proto.implements_interface"] != null && message.hasOwnProperty(".cosmos_proto.implements_interface")) - object[".cosmos_proto.implements_interface"] = message[".cosmos_proto.implements_interface"]; - return object; - }; - - /** - * Converts this MessageOptions to JSON. - * @function toJSON - * @memberof google.protobuf.MessageOptions - * @instance - * @returns {Object.} JSON object - */ - MessageOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MessageOptions; - })(); - - protobuf.FieldOptions = (function() { - - /** - * Properties of a FieldOptions. - * @memberof google.protobuf - * @interface IFieldOptions - * @property {google.protobuf.FieldOptions.CType|null} [ctype] FieldOptions ctype - * @property {boolean|null} [packed] FieldOptions packed - * @property {google.protobuf.FieldOptions.JSType|null} [jstype] FieldOptions jstype - * @property {boolean|null} [lazy] FieldOptions lazy - * @property {boolean|null} [deprecated] FieldOptions deprecated - * @property {boolean|null} [weak] FieldOptions weak - * @property {Array.|null} [uninterpreted_option] FieldOptions uninterpreted_option - * @property {string|null} [".cosmos_proto.accepts_interface"] FieldOptions .cosmos_proto.accepts_interface - * @property {boolean|null} [".gogoproto.nullable"] FieldOptions .gogoproto.nullable - * @property {boolean|null} [".gogoproto.embed"] FieldOptions .gogoproto.embed - * @property {string|null} [".gogoproto.customtype"] FieldOptions .gogoproto.customtype - * @property {string|null} [".gogoproto.customname"] FieldOptions .gogoproto.customname - * @property {string|null} [".gogoproto.jsontag"] FieldOptions .gogoproto.jsontag - * @property {string|null} [".gogoproto.moretags"] FieldOptions .gogoproto.moretags - * @property {string|null} [".gogoproto.casttype"] FieldOptions .gogoproto.casttype - * @property {string|null} [".gogoproto.castkey"] FieldOptions .gogoproto.castkey - * @property {string|null} [".gogoproto.castvalue"] FieldOptions .gogoproto.castvalue - * @property {boolean|null} [".gogoproto.stdtime"] FieldOptions .gogoproto.stdtime - * @property {boolean|null} [".gogoproto.stdduration"] FieldOptions .gogoproto.stdduration - * @property {boolean|null} [".gogoproto.wktpointer"] FieldOptions .gogoproto.wktpointer - * @property {string|null} [".gogoproto.castrepeated"] FieldOptions .gogoproto.castrepeated - */ - - /** - * Constructs a new FieldOptions. - * @memberof google.protobuf - * @classdesc Represents a FieldOptions. - * @implements IFieldOptions - * @constructor - * @param {google.protobuf.IFieldOptions=} [properties] Properties to set - */ - function FieldOptions(properties) { - this.uninterpreted_option = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * FieldOptions ctype. - * @member {google.protobuf.FieldOptions.CType} ctype - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.ctype = 0; - - /** - * FieldOptions packed. - * @member {boolean} packed - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.packed = false; - - /** - * FieldOptions jstype. - * @member {google.protobuf.FieldOptions.JSType} jstype - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.jstype = 0; - - /** - * FieldOptions lazy. - * @member {boolean} lazy - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.lazy = false; - - /** - * FieldOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.deprecated = false; - - /** - * FieldOptions weak. - * @member {boolean} weak - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.weak = false; - - /** - * FieldOptions uninterpreted_option. - * @member {Array.} uninterpreted_option - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.uninterpreted_option = $util.emptyArray; - - /** - * FieldOptions .cosmos_proto.accepts_interface. - * @member {string} .cosmos_proto.accepts_interface - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype[".cosmos_proto.accepts_interface"] = ""; - - /** - * FieldOptions .gogoproto.nullable. - * @member {boolean} .gogoproto.nullable - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype[".gogoproto.nullable"] = false; - - /** - * FieldOptions .gogoproto.embed. - * @member {boolean} .gogoproto.embed - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype[".gogoproto.embed"] = false; - - /** - * FieldOptions .gogoproto.customtype. - * @member {string} .gogoproto.customtype - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype[".gogoproto.customtype"] = ""; - - /** - * FieldOptions .gogoproto.customname. - * @member {string} .gogoproto.customname - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype[".gogoproto.customname"] = ""; - - /** - * FieldOptions .gogoproto.jsontag. - * @member {string} .gogoproto.jsontag - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype[".gogoproto.jsontag"] = ""; - - /** - * FieldOptions .gogoproto.moretags. - * @member {string} .gogoproto.moretags - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype[".gogoproto.moretags"] = ""; - - /** - * FieldOptions .gogoproto.casttype. - * @member {string} .gogoproto.casttype - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype[".gogoproto.casttype"] = ""; - - /** - * FieldOptions .gogoproto.castkey. - * @member {string} .gogoproto.castkey - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype[".gogoproto.castkey"] = ""; - - /** - * FieldOptions .gogoproto.castvalue. - * @member {string} .gogoproto.castvalue - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype[".gogoproto.castvalue"] = ""; - - /** - * FieldOptions .gogoproto.stdtime. - * @member {boolean} .gogoproto.stdtime - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype[".gogoproto.stdtime"] = false; - - /** - * FieldOptions .gogoproto.stdduration. - * @member {boolean} .gogoproto.stdduration - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype[".gogoproto.stdduration"] = false; - - /** - * FieldOptions .gogoproto.wktpointer. - * @member {boolean} .gogoproto.wktpointer - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype[".gogoproto.wktpointer"] = false; - - /** - * FieldOptions .gogoproto.castrepeated. - * @member {string} .gogoproto.castrepeated - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype[".gogoproto.castrepeated"] = ""; - - /** - * Encodes the specified FieldOptions message. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.FieldOptions - * @static - * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FieldOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.ctype != null && Object.hasOwnProperty.call(message, "ctype")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ctype); - if (message.packed != null && Object.hasOwnProperty.call(message, "packed")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.packed); - if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); - if (message.lazy != null && Object.hasOwnProperty.call(message, "lazy")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.lazy); - if (message.jstype != null && Object.hasOwnProperty.call(message, "jstype")) - writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jstype); - if (message.weak != null && Object.hasOwnProperty.call(message, "weak")) - writer.uint32(/* id 10, wireType 0 =*/80).bool(message.weak); - if (message.uninterpreted_option != null && message.uninterpreted_option.length) - for (let i = 0; i < message.uninterpreted_option.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpreted_option[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - if (message[".gogoproto.nullable"] != null && Object.hasOwnProperty.call(message, ".gogoproto.nullable")) - writer.uint32(/* id 65001, wireType 0 =*/520008).bool(message[".gogoproto.nullable"]); - if (message[".gogoproto.embed"] != null && Object.hasOwnProperty.call(message, ".gogoproto.embed")) - writer.uint32(/* id 65002, wireType 0 =*/520016).bool(message[".gogoproto.embed"]); - if (message[".gogoproto.customtype"] != null && Object.hasOwnProperty.call(message, ".gogoproto.customtype")) - writer.uint32(/* id 65003, wireType 2 =*/520026).string(message[".gogoproto.customtype"]); - if (message[".gogoproto.customname"] != null && Object.hasOwnProperty.call(message, ".gogoproto.customname")) - writer.uint32(/* id 65004, wireType 2 =*/520034).string(message[".gogoproto.customname"]); - if (message[".gogoproto.jsontag"] != null && Object.hasOwnProperty.call(message, ".gogoproto.jsontag")) - writer.uint32(/* id 65005, wireType 2 =*/520042).string(message[".gogoproto.jsontag"]); - if (message[".gogoproto.moretags"] != null && Object.hasOwnProperty.call(message, ".gogoproto.moretags")) - writer.uint32(/* id 65006, wireType 2 =*/520050).string(message[".gogoproto.moretags"]); - if (message[".gogoproto.casttype"] != null && Object.hasOwnProperty.call(message, ".gogoproto.casttype")) - writer.uint32(/* id 65007, wireType 2 =*/520058).string(message[".gogoproto.casttype"]); - if (message[".gogoproto.castkey"] != null && Object.hasOwnProperty.call(message, ".gogoproto.castkey")) - writer.uint32(/* id 65008, wireType 2 =*/520066).string(message[".gogoproto.castkey"]); - if (message[".gogoproto.castvalue"] != null && Object.hasOwnProperty.call(message, ".gogoproto.castvalue")) - writer.uint32(/* id 65009, wireType 2 =*/520074).string(message[".gogoproto.castvalue"]); - if (message[".gogoproto.stdtime"] != null && Object.hasOwnProperty.call(message, ".gogoproto.stdtime")) - writer.uint32(/* id 65010, wireType 0 =*/520080).bool(message[".gogoproto.stdtime"]); - if (message[".gogoproto.stdduration"] != null && Object.hasOwnProperty.call(message, ".gogoproto.stdduration")) - writer.uint32(/* id 65011, wireType 0 =*/520088).bool(message[".gogoproto.stdduration"]); - if (message[".gogoproto.wktpointer"] != null && Object.hasOwnProperty.call(message, ".gogoproto.wktpointer")) - writer.uint32(/* id 65012, wireType 0 =*/520096).bool(message[".gogoproto.wktpointer"]); - if (message[".gogoproto.castrepeated"] != null && Object.hasOwnProperty.call(message, ".gogoproto.castrepeated")) - writer.uint32(/* id 65013, wireType 2 =*/520106).string(message[".gogoproto.castrepeated"]); - if (message[".cosmos_proto.accepts_interface"] != null && Object.hasOwnProperty.call(message, ".cosmos_proto.accepts_interface")) - writer.uint32(/* id 93001, wireType 2 =*/744010).string(message[".cosmos_proto.accepts_interface"]); - return writer; - }; - - /** - * Encodes the specified FieldOptions message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.FieldOptions - * @static - * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FieldOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FieldOptions message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.FieldOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FieldOptions} FieldOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FieldOptions.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.ctype = reader.int32(); - break; - case 2: - message.packed = reader.bool(); - break; - case 6: - message.jstype = reader.int32(); - break; - case 5: - message.lazy = reader.bool(); - break; - case 3: - message.deprecated = reader.bool(); - break; - case 10: - message.weak = reader.bool(); - break; - case 999: - if (!(message.uninterpreted_option && message.uninterpreted_option.length)) - message.uninterpreted_option = []; - message.uninterpreted_option.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - case 93001: - message[".cosmos_proto.accepts_interface"] = reader.string(); - break; - case 65001: - message[".gogoproto.nullable"] = reader.bool(); - break; - case 65002: - message[".gogoproto.embed"] = reader.bool(); - break; - case 65003: - message[".gogoproto.customtype"] = reader.string(); - break; - case 65004: - message[".gogoproto.customname"] = reader.string(); - break; - case 65005: - message[".gogoproto.jsontag"] = reader.string(); - break; - case 65006: - message[".gogoproto.moretags"] = reader.string(); - break; - case 65007: - message[".gogoproto.casttype"] = reader.string(); - break; - case 65008: - message[".gogoproto.castkey"] = reader.string(); - break; - case 65009: - message[".gogoproto.castvalue"] = reader.string(); - break; - case 65010: - message[".gogoproto.stdtime"] = reader.bool(); - break; - case 65011: - message[".gogoproto.stdduration"] = reader.bool(); - break; - case 65012: - message[".gogoproto.wktpointer"] = reader.bool(); - break; - case 65013: - message[".gogoproto.castrepeated"] = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FieldOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.FieldOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FieldOptions} FieldOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FieldOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FieldOptions message. - * @function verify - * @memberof google.protobuf.FieldOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FieldOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.ctype != null && message.hasOwnProperty("ctype")) - switch (message.ctype) { - default: - return "ctype: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.packed != null && message.hasOwnProperty("packed")) - if (typeof message.packed !== "boolean") - return "packed: boolean expected"; - if (message.jstype != null && message.hasOwnProperty("jstype")) - switch (message.jstype) { - default: - return "jstype: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.lazy != null && message.hasOwnProperty("lazy")) - if (typeof message.lazy !== "boolean") - return "lazy: boolean expected"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - if (typeof message.deprecated !== "boolean") - return "deprecated: boolean expected"; - if (message.weak != null && message.hasOwnProperty("weak")) - if (typeof message.weak !== "boolean") - return "weak: boolean expected"; - if (message.uninterpreted_option != null && message.hasOwnProperty("uninterpreted_option")) { - if (!Array.isArray(message.uninterpreted_option)) - return "uninterpreted_option: array expected"; - for (let i = 0; i < message.uninterpreted_option.length; ++i) { - let error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpreted_option[i]); - if (error) - return "uninterpreted_option." + error; - } - } - if (message[".cosmos_proto.accepts_interface"] != null && message.hasOwnProperty(".cosmos_proto.accepts_interface")) - if (!$util.isString(message[".cosmos_proto.accepts_interface"])) - return ".cosmos_proto.accepts_interface: string expected"; - if (message[".gogoproto.nullable"] != null && message.hasOwnProperty(".gogoproto.nullable")) - if (typeof message[".gogoproto.nullable"] !== "boolean") - return ".gogoproto.nullable: boolean expected"; - if (message[".gogoproto.embed"] != null && message.hasOwnProperty(".gogoproto.embed")) - if (typeof message[".gogoproto.embed"] !== "boolean") - return ".gogoproto.embed: boolean expected"; - if (message[".gogoproto.customtype"] != null && message.hasOwnProperty(".gogoproto.customtype")) - if (!$util.isString(message[".gogoproto.customtype"])) - return ".gogoproto.customtype: string expected"; - if (message[".gogoproto.customname"] != null && message.hasOwnProperty(".gogoproto.customname")) - if (!$util.isString(message[".gogoproto.customname"])) - return ".gogoproto.customname: string expected"; - if (message[".gogoproto.jsontag"] != null && message.hasOwnProperty(".gogoproto.jsontag")) - if (!$util.isString(message[".gogoproto.jsontag"])) - return ".gogoproto.jsontag: string expected"; - if (message[".gogoproto.moretags"] != null && message.hasOwnProperty(".gogoproto.moretags")) - if (!$util.isString(message[".gogoproto.moretags"])) - return ".gogoproto.moretags: string expected"; - if (message[".gogoproto.casttype"] != null && message.hasOwnProperty(".gogoproto.casttype")) - if (!$util.isString(message[".gogoproto.casttype"])) - return ".gogoproto.casttype: string expected"; - if (message[".gogoproto.castkey"] != null && message.hasOwnProperty(".gogoproto.castkey")) - if (!$util.isString(message[".gogoproto.castkey"])) - return ".gogoproto.castkey: string expected"; - if (message[".gogoproto.castvalue"] != null && message.hasOwnProperty(".gogoproto.castvalue")) - if (!$util.isString(message[".gogoproto.castvalue"])) - return ".gogoproto.castvalue: string expected"; - if (message[".gogoproto.stdtime"] != null && message.hasOwnProperty(".gogoproto.stdtime")) - if (typeof message[".gogoproto.stdtime"] !== "boolean") - return ".gogoproto.stdtime: boolean expected"; - if (message[".gogoproto.stdduration"] != null && message.hasOwnProperty(".gogoproto.stdduration")) - if (typeof message[".gogoproto.stdduration"] !== "boolean") - return ".gogoproto.stdduration: boolean expected"; - if (message[".gogoproto.wktpointer"] != null && message.hasOwnProperty(".gogoproto.wktpointer")) - if (typeof message[".gogoproto.wktpointer"] !== "boolean") - return ".gogoproto.wktpointer: boolean expected"; - if (message[".gogoproto.castrepeated"] != null && message.hasOwnProperty(".gogoproto.castrepeated")) - if (!$util.isString(message[".gogoproto.castrepeated"])) - return ".gogoproto.castrepeated: string expected"; - return null; - }; - - /** - * Creates a FieldOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.FieldOptions - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.FieldOptions} FieldOptions - */ - FieldOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FieldOptions) - return object; - let message = new $root.google.protobuf.FieldOptions(); - switch (object.ctype) { - case "STRING": - case 0: - message.ctype = 0; - break; - case "CORD": - case 1: - message.ctype = 1; - break; - case "STRING_PIECE": - case 2: - message.ctype = 2; - break; - } - if (object.packed != null) - message.packed = Boolean(object.packed); - switch (object.jstype) { - case "JS_NORMAL": - case 0: - message.jstype = 0; - break; - case "JS_STRING": - case 1: - message.jstype = 1; - break; - case "JS_NUMBER": - case 2: - message.jstype = 2; - break; - } - if (object.lazy != null) - message.lazy = Boolean(object.lazy); - if (object.deprecated != null) - message.deprecated = Boolean(object.deprecated); - if (object.weak != null) - message.weak = Boolean(object.weak); - if (object.uninterpreted_option) { - if (!Array.isArray(object.uninterpreted_option)) - throw TypeError(".google.protobuf.FieldOptions.uninterpreted_option: array expected"); - message.uninterpreted_option = []; - for (let i = 0; i < object.uninterpreted_option.length; ++i) { - if (typeof object.uninterpreted_option[i] !== "object") - throw TypeError(".google.protobuf.FieldOptions.uninterpreted_option: object expected"); - message.uninterpreted_option[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpreted_option[i]); - } - } - if (object[".cosmos_proto.accepts_interface"] != null) - message[".cosmos_proto.accepts_interface"] = String(object[".cosmos_proto.accepts_interface"]); - if (object[".gogoproto.nullable"] != null) - message[".gogoproto.nullable"] = Boolean(object[".gogoproto.nullable"]); - if (object[".gogoproto.embed"] != null) - message[".gogoproto.embed"] = Boolean(object[".gogoproto.embed"]); - if (object[".gogoproto.customtype"] != null) - message[".gogoproto.customtype"] = String(object[".gogoproto.customtype"]); - if (object[".gogoproto.customname"] != null) - message[".gogoproto.customname"] = String(object[".gogoproto.customname"]); - if (object[".gogoproto.jsontag"] != null) - message[".gogoproto.jsontag"] = String(object[".gogoproto.jsontag"]); - if (object[".gogoproto.moretags"] != null) - message[".gogoproto.moretags"] = String(object[".gogoproto.moretags"]); - if (object[".gogoproto.casttype"] != null) - message[".gogoproto.casttype"] = String(object[".gogoproto.casttype"]); - if (object[".gogoproto.castkey"] != null) - message[".gogoproto.castkey"] = String(object[".gogoproto.castkey"]); - if (object[".gogoproto.castvalue"] != null) - message[".gogoproto.castvalue"] = String(object[".gogoproto.castvalue"]); - if (object[".gogoproto.stdtime"] != null) - message[".gogoproto.stdtime"] = Boolean(object[".gogoproto.stdtime"]); - if (object[".gogoproto.stdduration"] != null) - message[".gogoproto.stdduration"] = Boolean(object[".gogoproto.stdduration"]); - if (object[".gogoproto.wktpointer"] != null) - message[".gogoproto.wktpointer"] = Boolean(object[".gogoproto.wktpointer"]); - if (object[".gogoproto.castrepeated"] != null) - message[".gogoproto.castrepeated"] = String(object[".gogoproto.castrepeated"]); - return message; - }; - - /** - * Creates a plain object from a FieldOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.FieldOptions - * @static - * @param {google.protobuf.FieldOptions} message FieldOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FieldOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.uninterpreted_option = []; - if (options.defaults) { - object.ctype = options.enums === String ? "STRING" : 0; - object.packed = false; - object.deprecated = false; - object.lazy = false; - object.jstype = options.enums === String ? "JS_NORMAL" : 0; - object.weak = false; - object[".gogoproto.nullable"] = false; - object[".gogoproto.embed"] = false; - object[".gogoproto.customtype"] = ""; - object[".gogoproto.customname"] = ""; - object[".gogoproto.jsontag"] = ""; - object[".gogoproto.moretags"] = ""; - object[".gogoproto.casttype"] = ""; - object[".gogoproto.castkey"] = ""; - object[".gogoproto.castvalue"] = ""; - object[".gogoproto.stdtime"] = false; - object[".gogoproto.stdduration"] = false; - object[".gogoproto.wktpointer"] = false; - object[".gogoproto.castrepeated"] = ""; - object[".cosmos_proto.accepts_interface"] = ""; - } - if (message.ctype != null && message.hasOwnProperty("ctype")) - object.ctype = options.enums === String ? $root.google.protobuf.FieldOptions.CType[message.ctype] : message.ctype; - if (message.packed != null && message.hasOwnProperty("packed")) - object.packed = message.packed; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - object.deprecated = message.deprecated; - if (message.lazy != null && message.hasOwnProperty("lazy")) - object.lazy = message.lazy; - if (message.jstype != null && message.hasOwnProperty("jstype")) - object.jstype = options.enums === String ? $root.google.protobuf.FieldOptions.JSType[message.jstype] : message.jstype; - if (message.weak != null && message.hasOwnProperty("weak")) - object.weak = message.weak; - if (message.uninterpreted_option && message.uninterpreted_option.length) { - object.uninterpreted_option = []; - for (let j = 0; j < message.uninterpreted_option.length; ++j) - object.uninterpreted_option[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpreted_option[j], options); - } - if (message[".gogoproto.nullable"] != null && message.hasOwnProperty(".gogoproto.nullable")) - object[".gogoproto.nullable"] = message[".gogoproto.nullable"]; - if (message[".gogoproto.embed"] != null && message.hasOwnProperty(".gogoproto.embed")) - object[".gogoproto.embed"] = message[".gogoproto.embed"]; - if (message[".gogoproto.customtype"] != null && message.hasOwnProperty(".gogoproto.customtype")) - object[".gogoproto.customtype"] = message[".gogoproto.customtype"]; - if (message[".gogoproto.customname"] != null && message.hasOwnProperty(".gogoproto.customname")) - object[".gogoproto.customname"] = message[".gogoproto.customname"]; - if (message[".gogoproto.jsontag"] != null && message.hasOwnProperty(".gogoproto.jsontag")) - object[".gogoproto.jsontag"] = message[".gogoproto.jsontag"]; - if (message[".gogoproto.moretags"] != null && message.hasOwnProperty(".gogoproto.moretags")) - object[".gogoproto.moretags"] = message[".gogoproto.moretags"]; - if (message[".gogoproto.casttype"] != null && message.hasOwnProperty(".gogoproto.casttype")) - object[".gogoproto.casttype"] = message[".gogoproto.casttype"]; - if (message[".gogoproto.castkey"] != null && message.hasOwnProperty(".gogoproto.castkey")) - object[".gogoproto.castkey"] = message[".gogoproto.castkey"]; - if (message[".gogoproto.castvalue"] != null && message.hasOwnProperty(".gogoproto.castvalue")) - object[".gogoproto.castvalue"] = message[".gogoproto.castvalue"]; - if (message[".gogoproto.stdtime"] != null && message.hasOwnProperty(".gogoproto.stdtime")) - object[".gogoproto.stdtime"] = message[".gogoproto.stdtime"]; - if (message[".gogoproto.stdduration"] != null && message.hasOwnProperty(".gogoproto.stdduration")) - object[".gogoproto.stdduration"] = message[".gogoproto.stdduration"]; - if (message[".gogoproto.wktpointer"] != null && message.hasOwnProperty(".gogoproto.wktpointer")) - object[".gogoproto.wktpointer"] = message[".gogoproto.wktpointer"]; - if (message[".gogoproto.castrepeated"] != null && message.hasOwnProperty(".gogoproto.castrepeated")) - object[".gogoproto.castrepeated"] = message[".gogoproto.castrepeated"]; - if (message[".cosmos_proto.accepts_interface"] != null && message.hasOwnProperty(".cosmos_proto.accepts_interface")) - object[".cosmos_proto.accepts_interface"] = message[".cosmos_proto.accepts_interface"]; - return object; - }; - - /** - * Converts this FieldOptions to JSON. - * @function toJSON - * @memberof google.protobuf.FieldOptions - * @instance - * @returns {Object.} JSON object - */ - FieldOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * CType enum. - * @name google.protobuf.FieldOptions.CType - * @enum {number} - * @property {number} STRING=0 STRING value - * @property {number} CORD=1 CORD value - * @property {number} STRING_PIECE=2 STRING_PIECE value - */ - FieldOptions.CType = (function() { - const valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STRING"] = 0; - values[valuesById[1] = "CORD"] = 1; - values[valuesById[2] = "STRING_PIECE"] = 2; - return values; - })(); - - /** - * JSType enum. - * @name google.protobuf.FieldOptions.JSType - * @enum {number} - * @property {number} JS_NORMAL=0 JS_NORMAL value - * @property {number} JS_STRING=1 JS_STRING value - * @property {number} JS_NUMBER=2 JS_NUMBER value - */ - FieldOptions.JSType = (function() { - const valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "JS_NORMAL"] = 0; - values[valuesById[1] = "JS_STRING"] = 1; - values[valuesById[2] = "JS_NUMBER"] = 2; - return values; - })(); - - return FieldOptions; - })(); - - protobuf.OneofOptions = (function() { - - /** - * Properties of an OneofOptions. - * @memberof google.protobuf - * @interface IOneofOptions - * @property {Array.|null} [uninterpreted_option] OneofOptions uninterpreted_option - */ - - /** - * Constructs a new OneofOptions. - * @memberof google.protobuf - * @classdesc Represents an OneofOptions. - * @implements IOneofOptions - * @constructor - * @param {google.protobuf.IOneofOptions=} [properties] Properties to set - */ - function OneofOptions(properties) { - this.uninterpreted_option = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * OneofOptions uninterpreted_option. - * @member {Array.} uninterpreted_option - * @memberof google.protobuf.OneofOptions - * @instance - */ - OneofOptions.prototype.uninterpreted_option = $util.emptyArray; - - /** - * Encodes the specified OneofOptions message. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.OneofOptions - * @static - * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OneofOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.uninterpreted_option != null && message.uninterpreted_option.length) - for (let i = 0; i < message.uninterpreted_option.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpreted_option[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified OneofOptions message, length delimited. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.OneofOptions - * @static - * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OneofOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an OneofOptions message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.OneofOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.OneofOptions} OneofOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OneofOptions.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofOptions(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 999: - if (!(message.uninterpreted_option && message.uninterpreted_option.length)) - message.uninterpreted_option = []; - message.uninterpreted_option.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an OneofOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.OneofOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.OneofOptions} OneofOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OneofOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an OneofOptions message. - * @function verify - * @memberof google.protobuf.OneofOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - OneofOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.uninterpreted_option != null && message.hasOwnProperty("uninterpreted_option")) { - if (!Array.isArray(message.uninterpreted_option)) - return "uninterpreted_option: array expected"; - for (let i = 0; i < message.uninterpreted_option.length; ++i) { - let error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpreted_option[i]); - if (error) - return "uninterpreted_option." + error; - } - } - return null; - }; - - /** - * Creates an OneofOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.OneofOptions - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.OneofOptions} OneofOptions - */ - OneofOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.OneofOptions) - return object; - let message = new $root.google.protobuf.OneofOptions(); - if (object.uninterpreted_option) { - if (!Array.isArray(object.uninterpreted_option)) - throw TypeError(".google.protobuf.OneofOptions.uninterpreted_option: array expected"); - message.uninterpreted_option = []; - for (let i = 0; i < object.uninterpreted_option.length; ++i) { - if (typeof object.uninterpreted_option[i] !== "object") - throw TypeError(".google.protobuf.OneofOptions.uninterpreted_option: object expected"); - message.uninterpreted_option[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpreted_option[i]); - } - } - return message; - }; - - /** - * Creates a plain object from an OneofOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.OneofOptions - * @static - * @param {google.protobuf.OneofOptions} message OneofOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - OneofOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.uninterpreted_option = []; - if (message.uninterpreted_option && message.uninterpreted_option.length) { - object.uninterpreted_option = []; - for (let j = 0; j < message.uninterpreted_option.length; ++j) - object.uninterpreted_option[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpreted_option[j], options); - } - return object; - }; - - /** - * Converts this OneofOptions to JSON. - * @function toJSON - * @memberof google.protobuf.OneofOptions - * @instance - * @returns {Object.} JSON object - */ - OneofOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return OneofOptions; - })(); - - protobuf.EnumOptions = (function() { - - /** - * Properties of an EnumOptions. - * @memberof google.protobuf - * @interface IEnumOptions - * @property {boolean|null} [allow_alias] EnumOptions allow_alias - * @property {boolean|null} [deprecated] EnumOptions deprecated - * @property {Array.|null} [uninterpreted_option] EnumOptions uninterpreted_option - * @property {boolean|null} [".gogoproto.goproto_enum_prefix"] EnumOptions .gogoproto.goproto_enum_prefix - * @property {boolean|null} [".gogoproto.goproto_enum_stringer"] EnumOptions .gogoproto.goproto_enum_stringer - * @property {boolean|null} [".gogoproto.enum_stringer"] EnumOptions .gogoproto.enum_stringer - * @property {string|null} [".gogoproto.enum_customname"] EnumOptions .gogoproto.enum_customname - * @property {boolean|null} [".gogoproto.enumdecl"] EnumOptions .gogoproto.enumdecl - */ - - /** - * Constructs a new EnumOptions. - * @memberof google.protobuf - * @classdesc Represents an EnumOptions. - * @implements IEnumOptions - * @constructor - * @param {google.protobuf.IEnumOptions=} [properties] Properties to set - */ - function EnumOptions(properties) { - this.uninterpreted_option = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * EnumOptions allow_alias. - * @member {boolean} allow_alias - * @memberof google.protobuf.EnumOptions - * @instance - */ - EnumOptions.prototype.allow_alias = false; - - /** - * EnumOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.EnumOptions - * @instance - */ - EnumOptions.prototype.deprecated = false; - - /** - * EnumOptions uninterpreted_option. - * @member {Array.} uninterpreted_option - * @memberof google.protobuf.EnumOptions - * @instance - */ - EnumOptions.prototype.uninterpreted_option = $util.emptyArray; - - /** - * EnumOptions .gogoproto.goproto_enum_prefix. - * @member {boolean} .gogoproto.goproto_enum_prefix - * @memberof google.protobuf.EnumOptions - * @instance - */ - EnumOptions.prototype[".gogoproto.goproto_enum_prefix"] = false; - - /** - * EnumOptions .gogoproto.goproto_enum_stringer. - * @member {boolean} .gogoproto.goproto_enum_stringer - * @memberof google.protobuf.EnumOptions - * @instance - */ - EnumOptions.prototype[".gogoproto.goproto_enum_stringer"] = false; - - /** - * EnumOptions .gogoproto.enum_stringer. - * @member {boolean} .gogoproto.enum_stringer - * @memberof google.protobuf.EnumOptions - * @instance - */ - EnumOptions.prototype[".gogoproto.enum_stringer"] = false; - - /** - * EnumOptions .gogoproto.enum_customname. - * @member {string} .gogoproto.enum_customname - * @memberof google.protobuf.EnumOptions - * @instance - */ - EnumOptions.prototype[".gogoproto.enum_customname"] = ""; - - /** - * EnumOptions .gogoproto.enumdecl. - * @member {boolean} .gogoproto.enumdecl - * @memberof google.protobuf.EnumOptions - * @instance - */ - EnumOptions.prototype[".gogoproto.enumdecl"] = false; - - /** - * Encodes the specified EnumOptions message. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.EnumOptions - * @static - * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.allow_alias != null && Object.hasOwnProperty.call(message, "allow_alias")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.allow_alias); - if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); - if (message.uninterpreted_option != null && message.uninterpreted_option.length) - for (let i = 0; i < message.uninterpreted_option.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpreted_option[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - if (message[".gogoproto.goproto_enum_prefix"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_enum_prefix")) - writer.uint32(/* id 62001, wireType 0 =*/496008).bool(message[".gogoproto.goproto_enum_prefix"]); - if (message[".gogoproto.goproto_enum_stringer"] != null && Object.hasOwnProperty.call(message, ".gogoproto.goproto_enum_stringer")) - writer.uint32(/* id 62021, wireType 0 =*/496168).bool(message[".gogoproto.goproto_enum_stringer"]); - if (message[".gogoproto.enum_stringer"] != null && Object.hasOwnProperty.call(message, ".gogoproto.enum_stringer")) - writer.uint32(/* id 62022, wireType 0 =*/496176).bool(message[".gogoproto.enum_stringer"]); - if (message[".gogoproto.enum_customname"] != null && Object.hasOwnProperty.call(message, ".gogoproto.enum_customname")) - writer.uint32(/* id 62023, wireType 2 =*/496186).string(message[".gogoproto.enum_customname"]); - if (message[".gogoproto.enumdecl"] != null && Object.hasOwnProperty.call(message, ".gogoproto.enumdecl")) - writer.uint32(/* id 62024, wireType 0 =*/496192).bool(message[".gogoproto.enumdecl"]); - return writer; - }; - - /** - * Encodes the specified EnumOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.EnumOptions - * @static - * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an EnumOptions message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.EnumOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.EnumOptions} EnumOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumOptions.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumOptions(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 2: - message.allow_alias = reader.bool(); - break; - case 3: - message.deprecated = reader.bool(); - break; - case 999: - if (!(message.uninterpreted_option && message.uninterpreted_option.length)) - message.uninterpreted_option = []; - message.uninterpreted_option.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - case 62001: - message[".gogoproto.goproto_enum_prefix"] = reader.bool(); - break; - case 62021: - message[".gogoproto.goproto_enum_stringer"] = reader.bool(); - break; - case 62022: - message[".gogoproto.enum_stringer"] = reader.bool(); - break; - case 62023: - message[".gogoproto.enum_customname"] = reader.string(); - break; - case 62024: - message[".gogoproto.enumdecl"] = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an EnumOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.EnumOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.EnumOptions} EnumOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an EnumOptions message. - * @function verify - * @memberof google.protobuf.EnumOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - EnumOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.allow_alias != null && message.hasOwnProperty("allow_alias")) - if (typeof message.allow_alias !== "boolean") - return "allow_alias: boolean expected"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - if (typeof message.deprecated !== "boolean") - return "deprecated: boolean expected"; - if (message.uninterpreted_option != null && message.hasOwnProperty("uninterpreted_option")) { - if (!Array.isArray(message.uninterpreted_option)) - return "uninterpreted_option: array expected"; - for (let i = 0; i < message.uninterpreted_option.length; ++i) { - let error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpreted_option[i]); - if (error) - return "uninterpreted_option." + error; - } - } - if (message[".gogoproto.goproto_enum_prefix"] != null && message.hasOwnProperty(".gogoproto.goproto_enum_prefix")) - if (typeof message[".gogoproto.goproto_enum_prefix"] !== "boolean") - return ".gogoproto.goproto_enum_prefix: boolean expected"; - if (message[".gogoproto.goproto_enum_stringer"] != null && message.hasOwnProperty(".gogoproto.goproto_enum_stringer")) - if (typeof message[".gogoproto.goproto_enum_stringer"] !== "boolean") - return ".gogoproto.goproto_enum_stringer: boolean expected"; - if (message[".gogoproto.enum_stringer"] != null && message.hasOwnProperty(".gogoproto.enum_stringer")) - if (typeof message[".gogoproto.enum_stringer"] !== "boolean") - return ".gogoproto.enum_stringer: boolean expected"; - if (message[".gogoproto.enum_customname"] != null && message.hasOwnProperty(".gogoproto.enum_customname")) - if (!$util.isString(message[".gogoproto.enum_customname"])) - return ".gogoproto.enum_customname: string expected"; - if (message[".gogoproto.enumdecl"] != null && message.hasOwnProperty(".gogoproto.enumdecl")) - if (typeof message[".gogoproto.enumdecl"] !== "boolean") - return ".gogoproto.enumdecl: boolean expected"; - return null; - }; - - /** - * Creates an EnumOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.EnumOptions - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.EnumOptions} EnumOptions - */ - EnumOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.EnumOptions) - return object; - let message = new $root.google.protobuf.EnumOptions(); - if (object.allow_alias != null) - message.allow_alias = Boolean(object.allow_alias); - if (object.deprecated != null) - message.deprecated = Boolean(object.deprecated); - if (object.uninterpreted_option) { - if (!Array.isArray(object.uninterpreted_option)) - throw TypeError(".google.protobuf.EnumOptions.uninterpreted_option: array expected"); - message.uninterpreted_option = []; - for (let i = 0; i < object.uninterpreted_option.length; ++i) { - if (typeof object.uninterpreted_option[i] !== "object") - throw TypeError(".google.protobuf.EnumOptions.uninterpreted_option: object expected"); - message.uninterpreted_option[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpreted_option[i]); - } - } - if (object[".gogoproto.goproto_enum_prefix"] != null) - message[".gogoproto.goproto_enum_prefix"] = Boolean(object[".gogoproto.goproto_enum_prefix"]); - if (object[".gogoproto.goproto_enum_stringer"] != null) - message[".gogoproto.goproto_enum_stringer"] = Boolean(object[".gogoproto.goproto_enum_stringer"]); - if (object[".gogoproto.enum_stringer"] != null) - message[".gogoproto.enum_stringer"] = Boolean(object[".gogoproto.enum_stringer"]); - if (object[".gogoproto.enum_customname"] != null) - message[".gogoproto.enum_customname"] = String(object[".gogoproto.enum_customname"]); - if (object[".gogoproto.enumdecl"] != null) - message[".gogoproto.enumdecl"] = Boolean(object[".gogoproto.enumdecl"]); - return message; - }; - - /** - * Creates a plain object from an EnumOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.EnumOptions - * @static - * @param {google.protobuf.EnumOptions} message EnumOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - EnumOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.uninterpreted_option = []; - if (options.defaults) { - object.allow_alias = false; - object.deprecated = false; - object[".gogoproto.goproto_enum_prefix"] = false; - object[".gogoproto.goproto_enum_stringer"] = false; - object[".gogoproto.enum_stringer"] = false; - object[".gogoproto.enum_customname"] = ""; - object[".gogoproto.enumdecl"] = false; - } - if (message.allow_alias != null && message.hasOwnProperty("allow_alias")) - object.allow_alias = message.allow_alias; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - object.deprecated = message.deprecated; - if (message.uninterpreted_option && message.uninterpreted_option.length) { - object.uninterpreted_option = []; - for (let j = 0; j < message.uninterpreted_option.length; ++j) - object.uninterpreted_option[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpreted_option[j], options); - } - if (message[".gogoproto.goproto_enum_prefix"] != null && message.hasOwnProperty(".gogoproto.goproto_enum_prefix")) - object[".gogoproto.goproto_enum_prefix"] = message[".gogoproto.goproto_enum_prefix"]; - if (message[".gogoproto.goproto_enum_stringer"] != null && message.hasOwnProperty(".gogoproto.goproto_enum_stringer")) - object[".gogoproto.goproto_enum_stringer"] = message[".gogoproto.goproto_enum_stringer"]; - if (message[".gogoproto.enum_stringer"] != null && message.hasOwnProperty(".gogoproto.enum_stringer")) - object[".gogoproto.enum_stringer"] = message[".gogoproto.enum_stringer"]; - if (message[".gogoproto.enum_customname"] != null && message.hasOwnProperty(".gogoproto.enum_customname")) - object[".gogoproto.enum_customname"] = message[".gogoproto.enum_customname"]; - if (message[".gogoproto.enumdecl"] != null && message.hasOwnProperty(".gogoproto.enumdecl")) - object[".gogoproto.enumdecl"] = message[".gogoproto.enumdecl"]; - return object; - }; - - /** - * Converts this EnumOptions to JSON. - * @function toJSON - * @memberof google.protobuf.EnumOptions - * @instance - * @returns {Object.} JSON object - */ - EnumOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return EnumOptions; - })(); - - protobuf.EnumValueOptions = (function() { - - /** - * Properties of an EnumValueOptions. - * @memberof google.protobuf - * @interface IEnumValueOptions - * @property {boolean|null} [deprecated] EnumValueOptions deprecated - * @property {Array.|null} [uninterpreted_option] EnumValueOptions uninterpreted_option - * @property {string|null} [".gogoproto.enumvalue_customname"] EnumValueOptions .gogoproto.enumvalue_customname - */ - - /** - * Constructs a new EnumValueOptions. - * @memberof google.protobuf - * @classdesc Represents an EnumValueOptions. - * @implements IEnumValueOptions - * @constructor - * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set - */ - function EnumValueOptions(properties) { - this.uninterpreted_option = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * EnumValueOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.EnumValueOptions - * @instance - */ - EnumValueOptions.prototype.deprecated = false; - - /** - * EnumValueOptions uninterpreted_option. - * @member {Array.} uninterpreted_option - * @memberof google.protobuf.EnumValueOptions - * @instance - */ - EnumValueOptions.prototype.uninterpreted_option = $util.emptyArray; - - /** - * EnumValueOptions .gogoproto.enumvalue_customname. - * @member {string} .gogoproto.enumvalue_customname - * @memberof google.protobuf.EnumValueOptions - * @instance - */ - EnumValueOptions.prototype[".gogoproto.enumvalue_customname"] = ""; - - /** - * Encodes the specified EnumValueOptions message. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.EnumValueOptions - * @static - * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumValueOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.deprecated); - if (message.uninterpreted_option != null && message.uninterpreted_option.length) - for (let i = 0; i < message.uninterpreted_option.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpreted_option[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - if (message[".gogoproto.enumvalue_customname"] != null && Object.hasOwnProperty.call(message, ".gogoproto.enumvalue_customname")) - writer.uint32(/* id 66001, wireType 2 =*/528010).string(message[".gogoproto.enumvalue_customname"]); - return writer; - }; - - /** - * Encodes the specified EnumValueOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.EnumValueOptions - * @static - * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumValueOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an EnumValueOptions message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.EnumValueOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.EnumValueOptions} EnumValueOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumValueOptions.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueOptions(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.deprecated = reader.bool(); - break; - case 999: - if (!(message.uninterpreted_option && message.uninterpreted_option.length)) - message.uninterpreted_option = []; - message.uninterpreted_option.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - case 66001: - message[".gogoproto.enumvalue_customname"] = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an EnumValueOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.EnumValueOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.EnumValueOptions} EnumValueOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumValueOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an EnumValueOptions message. - * @function verify - * @memberof google.protobuf.EnumValueOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - EnumValueOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - if (typeof message.deprecated !== "boolean") - return "deprecated: boolean expected"; - if (message.uninterpreted_option != null && message.hasOwnProperty("uninterpreted_option")) { - if (!Array.isArray(message.uninterpreted_option)) - return "uninterpreted_option: array expected"; - for (let i = 0; i < message.uninterpreted_option.length; ++i) { - let error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpreted_option[i]); - if (error) - return "uninterpreted_option." + error; - } - } - if (message[".gogoproto.enumvalue_customname"] != null && message.hasOwnProperty(".gogoproto.enumvalue_customname")) - if (!$util.isString(message[".gogoproto.enumvalue_customname"])) - return ".gogoproto.enumvalue_customname: string expected"; - return null; - }; - - /** - * Creates an EnumValueOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.EnumValueOptions - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.EnumValueOptions} EnumValueOptions - */ - EnumValueOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.EnumValueOptions) - return object; - let message = new $root.google.protobuf.EnumValueOptions(); - if (object.deprecated != null) - message.deprecated = Boolean(object.deprecated); - if (object.uninterpreted_option) { - if (!Array.isArray(object.uninterpreted_option)) - throw TypeError(".google.protobuf.EnumValueOptions.uninterpreted_option: array expected"); - message.uninterpreted_option = []; - for (let i = 0; i < object.uninterpreted_option.length; ++i) { - if (typeof object.uninterpreted_option[i] !== "object") - throw TypeError(".google.protobuf.EnumValueOptions.uninterpreted_option: object expected"); - message.uninterpreted_option[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpreted_option[i]); - } - } - if (object[".gogoproto.enumvalue_customname"] != null) - message[".gogoproto.enumvalue_customname"] = String(object[".gogoproto.enumvalue_customname"]); - return message; - }; - - /** - * Creates a plain object from an EnumValueOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.EnumValueOptions - * @static - * @param {google.protobuf.EnumValueOptions} message EnumValueOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - EnumValueOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.uninterpreted_option = []; - if (options.defaults) { - object.deprecated = false; - object[".gogoproto.enumvalue_customname"] = ""; - } - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - object.deprecated = message.deprecated; - if (message.uninterpreted_option && message.uninterpreted_option.length) { - object.uninterpreted_option = []; - for (let j = 0; j < message.uninterpreted_option.length; ++j) - object.uninterpreted_option[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpreted_option[j], options); - } - if (message[".gogoproto.enumvalue_customname"] != null && message.hasOwnProperty(".gogoproto.enumvalue_customname")) - object[".gogoproto.enumvalue_customname"] = message[".gogoproto.enumvalue_customname"]; - return object; - }; - - /** - * Converts this EnumValueOptions to JSON. - * @function toJSON - * @memberof google.protobuf.EnumValueOptions - * @instance - * @returns {Object.} JSON object - */ - EnumValueOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return EnumValueOptions; - })(); - - protobuf.ServiceOptions = (function() { - - /** - * Properties of a ServiceOptions. - * @memberof google.protobuf - * @interface IServiceOptions - * @property {boolean|null} [deprecated] ServiceOptions deprecated - * @property {Array.|null} [uninterpreted_option] ServiceOptions uninterpreted_option - */ - - /** - * Constructs a new ServiceOptions. - * @memberof google.protobuf - * @classdesc Represents a ServiceOptions. - * @implements IServiceOptions - * @constructor - * @param {google.protobuf.IServiceOptions=} [properties] Properties to set - */ - function ServiceOptions(properties) { - this.uninterpreted_option = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ServiceOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.ServiceOptions - * @instance - */ - ServiceOptions.prototype.deprecated = false; - - /** - * ServiceOptions uninterpreted_option. - * @member {Array.} uninterpreted_option - * @memberof google.protobuf.ServiceOptions - * @instance - */ - ServiceOptions.prototype.uninterpreted_option = $util.emptyArray; - - /** - * Encodes the specified ServiceOptions message. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.ServiceOptions - * @static - * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ServiceOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) - writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); - if (message.uninterpreted_option != null && message.uninterpreted_option.length) - for (let i = 0; i < message.uninterpreted_option.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpreted_option[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ServiceOptions message, length delimited. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.ServiceOptions - * @static - * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ServiceOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ServiceOptions message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.ServiceOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.ServiceOptions} ServiceOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ServiceOptions.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceOptions(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 33: - message.deprecated = reader.bool(); - break; - case 999: - if (!(message.uninterpreted_option && message.uninterpreted_option.length)) - message.uninterpreted_option = []; - message.uninterpreted_option.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ServiceOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.ServiceOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.ServiceOptions} ServiceOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ServiceOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ServiceOptions message. - * @function verify - * @memberof google.protobuf.ServiceOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ServiceOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - if (typeof message.deprecated !== "boolean") - return "deprecated: boolean expected"; - if (message.uninterpreted_option != null && message.hasOwnProperty("uninterpreted_option")) { - if (!Array.isArray(message.uninterpreted_option)) - return "uninterpreted_option: array expected"; - for (let i = 0; i < message.uninterpreted_option.length; ++i) { - let error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpreted_option[i]); - if (error) - return "uninterpreted_option." + error; - } - } - return null; - }; - - /** - * Creates a ServiceOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.ServiceOptions - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.ServiceOptions} ServiceOptions - */ - ServiceOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.ServiceOptions) - return object; - let message = new $root.google.protobuf.ServiceOptions(); - if (object.deprecated != null) - message.deprecated = Boolean(object.deprecated); - if (object.uninterpreted_option) { - if (!Array.isArray(object.uninterpreted_option)) - throw TypeError(".google.protobuf.ServiceOptions.uninterpreted_option: array expected"); - message.uninterpreted_option = []; - for (let i = 0; i < object.uninterpreted_option.length; ++i) { - if (typeof object.uninterpreted_option[i] !== "object") - throw TypeError(".google.protobuf.ServiceOptions.uninterpreted_option: object expected"); - message.uninterpreted_option[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpreted_option[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a ServiceOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.ServiceOptions - * @static - * @param {google.protobuf.ServiceOptions} message ServiceOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ServiceOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.uninterpreted_option = []; - if (options.defaults) - object.deprecated = false; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - object.deprecated = message.deprecated; - if (message.uninterpreted_option && message.uninterpreted_option.length) { - object.uninterpreted_option = []; - for (let j = 0; j < message.uninterpreted_option.length; ++j) - object.uninterpreted_option[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpreted_option[j], options); - } - return object; - }; - - /** - * Converts this ServiceOptions to JSON. - * @function toJSON - * @memberof google.protobuf.ServiceOptions - * @instance - * @returns {Object.} JSON object - */ - ServiceOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ServiceOptions; - })(); - - protobuf.MethodOptions = (function() { - - /** - * Properties of a MethodOptions. - * @memberof google.protobuf - * @interface IMethodOptions - * @property {boolean|null} [deprecated] MethodOptions deprecated - * @property {Array.|null} [uninterpreted_option] MethodOptions uninterpreted_option - * @property {google.api.IHttpRule|null} [".google.api.http"] MethodOptions .google.api.http - */ - - /** - * Constructs a new MethodOptions. - * @memberof google.protobuf - * @classdesc Represents a MethodOptions. - * @implements IMethodOptions - * @constructor - * @param {google.protobuf.IMethodOptions=} [properties] Properties to set - */ - function MethodOptions(properties) { - this.uninterpreted_option = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MethodOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.MethodOptions - * @instance - */ - MethodOptions.prototype.deprecated = false; - - /** - * MethodOptions uninterpreted_option. - * @member {Array.} uninterpreted_option - * @memberof google.protobuf.MethodOptions - * @instance - */ - MethodOptions.prototype.uninterpreted_option = $util.emptyArray; - - /** - * MethodOptions .google.api.http. - * @member {google.api.IHttpRule|null|undefined} .google.api.http - * @memberof google.protobuf.MethodOptions - * @instance - */ - MethodOptions.prototype[".google.api.http"] = null; - - /** - * Encodes the specified MethodOptions message. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.MethodOptions - * @static - * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MethodOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) - writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); - if (message.uninterpreted_option != null && message.uninterpreted_option.length) - for (let i = 0; i < message.uninterpreted_option.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpreted_option[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - if (message[".google.api.http"] != null && Object.hasOwnProperty.call(message, ".google.api.http")) - $root.google.api.HttpRule.encode(message[".google.api.http"], writer.uint32(/* id 72295728, wireType 2 =*/578365826).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified MethodOptions message, length delimited. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.MethodOptions - * @static - * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MethodOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MethodOptions message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.MethodOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.MethodOptions} MethodOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MethodOptions.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodOptions(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 33: - message.deprecated = reader.bool(); - break; - case 999: - if (!(message.uninterpreted_option && message.uninterpreted_option.length)) - message.uninterpreted_option = []; - message.uninterpreted_option.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - case 72295728: - message[".google.api.http"] = $root.google.api.HttpRule.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MethodOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.MethodOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.MethodOptions} MethodOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MethodOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MethodOptions message. - * @function verify - * @memberof google.protobuf.MethodOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MethodOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - if (typeof message.deprecated !== "boolean") - return "deprecated: boolean expected"; - if (message.uninterpreted_option != null && message.hasOwnProperty("uninterpreted_option")) { - if (!Array.isArray(message.uninterpreted_option)) - return "uninterpreted_option: array expected"; - for (let i = 0; i < message.uninterpreted_option.length; ++i) { - let error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpreted_option[i]); - if (error) - return "uninterpreted_option." + error; - } - } - if (message[".google.api.http"] != null && message.hasOwnProperty(".google.api.http")) { - let error = $root.google.api.HttpRule.verify(message[".google.api.http"]); - if (error) - return ".google.api.http." + error; - } - return null; - }; - - /** - * Creates a MethodOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.MethodOptions - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.MethodOptions} MethodOptions - */ - MethodOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.MethodOptions) - return object; - let message = new $root.google.protobuf.MethodOptions(); - if (object.deprecated != null) - message.deprecated = Boolean(object.deprecated); - if (object.uninterpreted_option) { - if (!Array.isArray(object.uninterpreted_option)) - throw TypeError(".google.protobuf.MethodOptions.uninterpreted_option: array expected"); - message.uninterpreted_option = []; - for (let i = 0; i < object.uninterpreted_option.length; ++i) { - if (typeof object.uninterpreted_option[i] !== "object") - throw TypeError(".google.protobuf.MethodOptions.uninterpreted_option: object expected"); - message.uninterpreted_option[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpreted_option[i]); - } - } - if (object[".google.api.http"] != null) { - if (typeof object[".google.api.http"] !== "object") - throw TypeError(".google.protobuf.MethodOptions..google.api.http: object expected"); - message[".google.api.http"] = $root.google.api.HttpRule.fromObject(object[".google.api.http"]); - } - return message; - }; - - /** - * Creates a plain object from a MethodOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.MethodOptions - * @static - * @param {google.protobuf.MethodOptions} message MethodOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MethodOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.uninterpreted_option = []; - if (options.defaults) { - object.deprecated = false; - object[".google.api.http"] = null; - } - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - object.deprecated = message.deprecated; - if (message.uninterpreted_option && message.uninterpreted_option.length) { - object.uninterpreted_option = []; - for (let j = 0; j < message.uninterpreted_option.length; ++j) - object.uninterpreted_option[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpreted_option[j], options); - } - if (message[".google.api.http"] != null && message.hasOwnProperty(".google.api.http")) - object[".google.api.http"] = $root.google.api.HttpRule.toObject(message[".google.api.http"], options); - return object; - }; - - /** - * Converts this MethodOptions to JSON. - * @function toJSON - * @memberof google.protobuf.MethodOptions - * @instance - * @returns {Object.} JSON object - */ - MethodOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MethodOptions; - })(); - - protobuf.UninterpretedOption = (function() { - - /** - * Properties of an UninterpretedOption. - * @memberof google.protobuf - * @interface IUninterpretedOption - * @property {Array.|null} [name] UninterpretedOption name - * @property {string|null} [identifier_value] UninterpretedOption identifier_value - * @property {Long|null} [positive_int_value] UninterpretedOption positive_int_value - * @property {Long|null} [negative_int_value] UninterpretedOption negative_int_value - * @property {number|null} [double_value] UninterpretedOption double_value - * @property {Uint8Array|null} [string_value] UninterpretedOption string_value - * @property {string|null} [aggregate_value] UninterpretedOption aggregate_value - */ - - /** - * Constructs a new UninterpretedOption. - * @memberof google.protobuf - * @classdesc Represents an UninterpretedOption. - * @implements IUninterpretedOption - * @constructor - * @param {google.protobuf.IUninterpretedOption=} [properties] Properties to set - */ - function UninterpretedOption(properties) { - this.name = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * UninterpretedOption name. - * @member {Array.} name - * @memberof google.protobuf.UninterpretedOption - * @instance - */ - UninterpretedOption.prototype.name = $util.emptyArray; - - /** - * UninterpretedOption identifier_value. - * @member {string} identifier_value - * @memberof google.protobuf.UninterpretedOption - * @instance - */ - UninterpretedOption.prototype.identifier_value = ""; - - /** - * UninterpretedOption positive_int_value. - * @member {Long} positive_int_value - * @memberof google.protobuf.UninterpretedOption - * @instance - */ - UninterpretedOption.prototype.positive_int_value = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * UninterpretedOption negative_int_value. - * @member {Long} negative_int_value - * @memberof google.protobuf.UninterpretedOption - * @instance - */ - UninterpretedOption.prototype.negative_int_value = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * UninterpretedOption double_value. - * @member {number} double_value - * @memberof google.protobuf.UninterpretedOption - * @instance - */ - UninterpretedOption.prototype.double_value = 0; - - /** - * UninterpretedOption string_value. - * @member {Uint8Array} string_value - * @memberof google.protobuf.UninterpretedOption - * @instance - */ - UninterpretedOption.prototype.string_value = $util.newBuffer([]); - - /** - * UninterpretedOption aggregate_value. - * @member {string} aggregate_value - * @memberof google.protobuf.UninterpretedOption - * @instance - */ - UninterpretedOption.prototype.aggregate_value = ""; - - /** - * Encodes the specified UninterpretedOption message. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. - * @function encode - * @memberof google.protobuf.UninterpretedOption - * @static - * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UninterpretedOption.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && message.name.length) - for (let i = 0; i < message.name.length; ++i) - $root.google.protobuf.UninterpretedOption.NamePart.encode(message.name[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.identifier_value != null && Object.hasOwnProperty.call(message, "identifier_value")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.identifier_value); - if (message.positive_int_value != null && Object.hasOwnProperty.call(message, "positive_int_value")) - writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.positive_int_value); - if (message.negative_int_value != null && Object.hasOwnProperty.call(message, "negative_int_value")) - writer.uint32(/* id 5, wireType 0 =*/40).int64(message.negative_int_value); - if (message.double_value != null && Object.hasOwnProperty.call(message, "double_value")) - writer.uint32(/* id 6, wireType 1 =*/49).double(message.double_value); - if (message.string_value != null && Object.hasOwnProperty.call(message, "string_value")) - writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.string_value); - if (message.aggregate_value != null && Object.hasOwnProperty.call(message, "aggregate_value")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.aggregate_value); - return writer; - }; - - /** - * Encodes the specified UninterpretedOption message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.UninterpretedOption - * @static - * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UninterpretedOption.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an UninterpretedOption message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.UninterpretedOption - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.UninterpretedOption} UninterpretedOption - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UninterpretedOption.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 2: - if (!(message.name && message.name.length)) - message.name = []; - message.name.push($root.google.protobuf.UninterpretedOption.NamePart.decode(reader, reader.uint32())); - break; - case 3: - message.identifier_value = reader.string(); - break; - case 4: - message.positive_int_value = reader.uint64(); - break; - case 5: - message.negative_int_value = reader.int64(); - break; - case 6: - message.double_value = reader.double(); - break; - case 7: - message.string_value = reader.bytes(); - break; - case 8: - message.aggregate_value = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an UninterpretedOption message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.UninterpretedOption - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.UninterpretedOption} UninterpretedOption - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UninterpretedOption.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an UninterpretedOption message. - * @function verify - * @memberof google.protobuf.UninterpretedOption - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - UninterpretedOption.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) { - if (!Array.isArray(message.name)) - return "name: array expected"; - for (let i = 0; i < message.name.length; ++i) { - let error = $root.google.protobuf.UninterpretedOption.NamePart.verify(message.name[i]); - if (error) - return "name." + error; - } - } - if (message.identifier_value != null && message.hasOwnProperty("identifier_value")) - if (!$util.isString(message.identifier_value)) - return "identifier_value: string expected"; - if (message.positive_int_value != null && message.hasOwnProperty("positive_int_value")) - if (!$util.isInteger(message.positive_int_value) && !(message.positive_int_value && $util.isInteger(message.positive_int_value.low) && $util.isInteger(message.positive_int_value.high))) - return "positive_int_value: integer|Long expected"; - if (message.negative_int_value != null && message.hasOwnProperty("negative_int_value")) - if (!$util.isInteger(message.negative_int_value) && !(message.negative_int_value && $util.isInteger(message.negative_int_value.low) && $util.isInteger(message.negative_int_value.high))) - return "negative_int_value: integer|Long expected"; - if (message.double_value != null && message.hasOwnProperty("double_value")) - if (typeof message.double_value !== "number") - return "double_value: number expected"; - if (message.string_value != null && message.hasOwnProperty("string_value")) - if (!(message.string_value && typeof message.string_value.length === "number" || $util.isString(message.string_value))) - return "string_value: buffer expected"; - if (message.aggregate_value != null && message.hasOwnProperty("aggregate_value")) - if (!$util.isString(message.aggregate_value)) - return "aggregate_value: string expected"; - return null; - }; - - /** - * Creates an UninterpretedOption message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.UninterpretedOption - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.UninterpretedOption} UninterpretedOption - */ - UninterpretedOption.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.UninterpretedOption) - return object; - let message = new $root.google.protobuf.UninterpretedOption(); - if (object.name) { - if (!Array.isArray(object.name)) - throw TypeError(".google.protobuf.UninterpretedOption.name: array expected"); - message.name = []; - for (let i = 0; i < object.name.length; ++i) { - if (typeof object.name[i] !== "object") - throw TypeError(".google.protobuf.UninterpretedOption.name: object expected"); - message.name[i] = $root.google.protobuf.UninterpretedOption.NamePart.fromObject(object.name[i]); - } - } - if (object.identifier_value != null) - message.identifier_value = String(object.identifier_value); - if (object.positive_int_value != null) - if ($util.Long) - (message.positive_int_value = $util.Long.fromValue(object.positive_int_value)).unsigned = true; - else if (typeof object.positive_int_value === "string") - message.positive_int_value = parseInt(object.positive_int_value, 10); - else if (typeof object.positive_int_value === "number") - message.positive_int_value = object.positive_int_value; - else if (typeof object.positive_int_value === "object") - message.positive_int_value = new $util.LongBits(object.positive_int_value.low >>> 0, object.positive_int_value.high >>> 0).toNumber(true); - if (object.negative_int_value != null) - if ($util.Long) - (message.negative_int_value = $util.Long.fromValue(object.negative_int_value)).unsigned = false; - else if (typeof object.negative_int_value === "string") - message.negative_int_value = parseInt(object.negative_int_value, 10); - else if (typeof object.negative_int_value === "number") - message.negative_int_value = object.negative_int_value; - else if (typeof object.negative_int_value === "object") - message.negative_int_value = new $util.LongBits(object.negative_int_value.low >>> 0, object.negative_int_value.high >>> 0).toNumber(); - if (object.double_value != null) - message.double_value = Number(object.double_value); - if (object.string_value != null) - if (typeof object.string_value === "string") - $util.base64.decode(object.string_value, message.string_value = $util.newBuffer($util.base64.length(object.string_value)), 0); - else if (object.string_value.length) - message.string_value = object.string_value; - if (object.aggregate_value != null) - message.aggregate_value = String(object.aggregate_value); - return message; - }; - - /** - * Creates a plain object from an UninterpretedOption message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.UninterpretedOption - * @static - * @param {google.protobuf.UninterpretedOption} message UninterpretedOption - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UninterpretedOption.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.name = []; - if (options.defaults) { - object.identifier_value = ""; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.positive_int_value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.positive_int_value = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.negative_int_value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.negative_int_value = options.longs === String ? "0" : 0; - object.double_value = 0; - if (options.bytes === String) - object.string_value = ""; - else { - object.string_value = []; - if (options.bytes !== Array) - object.string_value = $util.newBuffer(object.string_value); - } - object.aggregate_value = ""; - } - if (message.name && message.name.length) { - object.name = []; - for (let j = 0; j < message.name.length; ++j) - object.name[j] = $root.google.protobuf.UninterpretedOption.NamePart.toObject(message.name[j], options); - } - if (message.identifier_value != null && message.hasOwnProperty("identifier_value")) - object.identifier_value = message.identifier_value; - if (message.positive_int_value != null && message.hasOwnProperty("positive_int_value")) - if (typeof message.positive_int_value === "number") - object.positive_int_value = options.longs === String ? String(message.positive_int_value) : message.positive_int_value; - else - object.positive_int_value = options.longs === String ? $util.Long.prototype.toString.call(message.positive_int_value) : options.longs === Number ? new $util.LongBits(message.positive_int_value.low >>> 0, message.positive_int_value.high >>> 0).toNumber(true) : message.positive_int_value; - if (message.negative_int_value != null && message.hasOwnProperty("negative_int_value")) - if (typeof message.negative_int_value === "number") - object.negative_int_value = options.longs === String ? String(message.negative_int_value) : message.negative_int_value; - else - object.negative_int_value = options.longs === String ? $util.Long.prototype.toString.call(message.negative_int_value) : options.longs === Number ? new $util.LongBits(message.negative_int_value.low >>> 0, message.negative_int_value.high >>> 0).toNumber() : message.negative_int_value; - if (message.double_value != null && message.hasOwnProperty("double_value")) - object.double_value = options.json && !isFinite(message.double_value) ? String(message.double_value) : message.double_value; - if (message.string_value != null && message.hasOwnProperty("string_value")) - object.string_value = options.bytes === String ? $util.base64.encode(message.string_value, 0, message.string_value.length) : options.bytes === Array ? Array.prototype.slice.call(message.string_value) : message.string_value; - if (message.aggregate_value != null && message.hasOwnProperty("aggregate_value")) - object.aggregate_value = message.aggregate_value; - return object; - }; - - /** - * Converts this UninterpretedOption to JSON. - * @function toJSON - * @memberof google.protobuf.UninterpretedOption - * @instance - * @returns {Object.} JSON object - */ - UninterpretedOption.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - UninterpretedOption.NamePart = (function() { - - /** - * Properties of a NamePart. - * @memberof google.protobuf.UninterpretedOption - * @interface INamePart - * @property {string} name_part NamePart name_part - * @property {boolean} is_extension NamePart is_extension - */ - - /** - * Constructs a new NamePart. - * @memberof google.protobuf.UninterpretedOption - * @classdesc Represents a NamePart. - * @implements INamePart - * @constructor - * @param {google.protobuf.UninterpretedOption.INamePart=} [properties] Properties to set - */ - function NamePart(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * NamePart name_part. - * @member {string} name_part - * @memberof google.protobuf.UninterpretedOption.NamePart - * @instance - */ - NamePart.prototype.name_part = ""; - - /** - * NamePart is_extension. - * @member {boolean} is_extension - * @memberof google.protobuf.UninterpretedOption.NamePart - * @instance - */ - NamePart.prototype.is_extension = false; - - /** - * Encodes the specified NamePart message. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. - * @function encode - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {google.protobuf.UninterpretedOption.INamePart} message NamePart message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - NamePart.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name_part); - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.is_extension); - return writer; - }; - - /** - * Encodes the specified NamePart message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {google.protobuf.UninterpretedOption.INamePart} message NamePart message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - NamePart.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a NamePart message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - NamePart.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption.NamePart(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.name_part = reader.string(); - break; - case 2: - message.is_extension = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - if (!message.hasOwnProperty("name_part")) - throw $util.ProtocolError("missing required 'name_part'", { instance: message }); - if (!message.hasOwnProperty("is_extension")) - throw $util.ProtocolError("missing required 'is_extension'", { instance: message }); - return message; - }; - - /** - * Decodes a NamePart message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - NamePart.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a NamePart message. - * @function verify - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - NamePart.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (!$util.isString(message.name_part)) - return "name_part: string expected"; - if (typeof message.is_extension !== "boolean") - return "is_extension: boolean expected"; - return null; - }; - - /** - * Creates a NamePart message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart - */ - NamePart.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.UninterpretedOption.NamePart) - return object; - let message = new $root.google.protobuf.UninterpretedOption.NamePart(); - if (object.name_part != null) - message.name_part = String(object.name_part); - if (object.is_extension != null) - message.is_extension = Boolean(object.is_extension); - return message; - }; - - /** - * Creates a plain object from a NamePart message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {google.protobuf.UninterpretedOption.NamePart} message NamePart - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - NamePart.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.name_part = ""; - object.is_extension = false; - } - if (message.name_part != null && message.hasOwnProperty("name_part")) - object.name_part = message.name_part; - if (message.is_extension != null && message.hasOwnProperty("is_extension")) - object.is_extension = message.is_extension; - return object; - }; - - /** - * Converts this NamePart to JSON. - * @function toJSON - * @memberof google.protobuf.UninterpretedOption.NamePart - * @instance - * @returns {Object.} JSON object - */ - NamePart.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return NamePart; - })(); - - return UninterpretedOption; - })(); - - protobuf.SourceCodeInfo = (function() { - - /** - * Properties of a SourceCodeInfo. - * @memberof google.protobuf - * @interface ISourceCodeInfo - * @property {Array.|null} [location] SourceCodeInfo location - */ - - /** - * Constructs a new SourceCodeInfo. - * @memberof google.protobuf - * @classdesc Represents a SourceCodeInfo. - * @implements ISourceCodeInfo - * @constructor - * @param {google.protobuf.ISourceCodeInfo=} [properties] Properties to set - */ - function SourceCodeInfo(properties) { - this.location = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SourceCodeInfo location. - * @member {Array.} location - * @memberof google.protobuf.SourceCodeInfo - * @instance - */ - SourceCodeInfo.prototype.location = $util.emptyArray; - - /** - * Encodes the specified SourceCodeInfo message. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. - * @function encode - * @memberof google.protobuf.SourceCodeInfo - * @static - * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SourceCodeInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.location != null && message.location.length) - for (let i = 0; i < message.location.length; ++i) - $root.google.protobuf.SourceCodeInfo.Location.encode(message.location[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SourceCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.SourceCodeInfo - * @static - * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SourceCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SourceCodeInfo message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.SourceCodeInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SourceCodeInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.location && message.location.length)) - message.location = []; - message.location.push($root.google.protobuf.SourceCodeInfo.Location.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SourceCodeInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.SourceCodeInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SourceCodeInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SourceCodeInfo message. - * @function verify - * @memberof google.protobuf.SourceCodeInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SourceCodeInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.location != null && message.hasOwnProperty("location")) { - if (!Array.isArray(message.location)) - return "location: array expected"; - for (let i = 0; i < message.location.length; ++i) { - let error = $root.google.protobuf.SourceCodeInfo.Location.verify(message.location[i]); - if (error) - return "location." + error; - } - } - return null; - }; - - /** - * Creates a SourceCodeInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.SourceCodeInfo - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo - */ - SourceCodeInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.SourceCodeInfo) - return object; - let message = new $root.google.protobuf.SourceCodeInfo(); - if (object.location) { - if (!Array.isArray(object.location)) - throw TypeError(".google.protobuf.SourceCodeInfo.location: array expected"); - message.location = []; - for (let i = 0; i < object.location.length; ++i) { - if (typeof object.location[i] !== "object") - throw TypeError(".google.protobuf.SourceCodeInfo.location: object expected"); - message.location[i] = $root.google.protobuf.SourceCodeInfo.Location.fromObject(object.location[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a SourceCodeInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.SourceCodeInfo - * @static - * @param {google.protobuf.SourceCodeInfo} message SourceCodeInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SourceCodeInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.location = []; - if (message.location && message.location.length) { - object.location = []; - for (let j = 0; j < message.location.length; ++j) - object.location[j] = $root.google.protobuf.SourceCodeInfo.Location.toObject(message.location[j], options); - } - return object; - }; - - /** - * Converts this SourceCodeInfo to JSON. - * @function toJSON - * @memberof google.protobuf.SourceCodeInfo - * @instance - * @returns {Object.} JSON object - */ - SourceCodeInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - SourceCodeInfo.Location = (function() { - - /** - * Properties of a Location. - * @memberof google.protobuf.SourceCodeInfo - * @interface ILocation - * @property {Array.|null} [path] Location path - * @property {Array.|null} [span] Location span - * @property {string|null} [leading_comments] Location leading_comments - * @property {string|null} [trailing_comments] Location trailing_comments - * @property {Array.|null} [leading_detached_comments] Location leading_detached_comments - */ - - /** - * Constructs a new Location. - * @memberof google.protobuf.SourceCodeInfo - * @classdesc Represents a Location. - * @implements ILocation - * @constructor - * @param {google.protobuf.SourceCodeInfo.ILocation=} [properties] Properties to set - */ - function Location(properties) { - this.path = []; - this.span = []; - this.leading_detached_comments = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Location path. - * @member {Array.} path - * @memberof google.protobuf.SourceCodeInfo.Location - * @instance - */ - Location.prototype.path = $util.emptyArray; - - /** - * Location span. - * @member {Array.} span - * @memberof google.protobuf.SourceCodeInfo.Location - * @instance - */ - Location.prototype.span = $util.emptyArray; - - /** - * Location leading_comments. - * @member {string} leading_comments - * @memberof google.protobuf.SourceCodeInfo.Location - * @instance - */ - Location.prototype.leading_comments = ""; - - /** - * Location trailing_comments. - * @member {string} trailing_comments - * @memberof google.protobuf.SourceCodeInfo.Location - * @instance - */ - Location.prototype.trailing_comments = ""; - - /** - * Location leading_detached_comments. - * @member {Array.} leading_detached_comments - * @memberof google.protobuf.SourceCodeInfo.Location - * @instance - */ - Location.prototype.leading_detached_comments = $util.emptyArray; - - /** - * Encodes the specified Location message. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. - * @function encode - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {google.protobuf.SourceCodeInfo.ILocation} message Location message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Location.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.path != null && message.path.length) { - writer.uint32(/* id 1, wireType 2 =*/10).fork(); - for (let i = 0; i < message.path.length; ++i) - writer.int32(message.path[i]); - writer.ldelim(); - } - if (message.span != null && message.span.length) { - writer.uint32(/* id 2, wireType 2 =*/18).fork(); - for (let i = 0; i < message.span.length; ++i) - writer.int32(message.span[i]); - writer.ldelim(); - } - if (message.leading_comments != null && Object.hasOwnProperty.call(message, "leading_comments")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.leading_comments); - if (message.trailing_comments != null && Object.hasOwnProperty.call(message, "trailing_comments")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.trailing_comments); - if (message.leading_detached_comments != null && message.leading_detached_comments.length) - for (let i = 0; i < message.leading_detached_comments.length; ++i) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.leading_detached_comments[i]); - return writer; - }; - - /** - * Encodes the specified Location message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {google.protobuf.SourceCodeInfo.ILocation} message Location message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Location.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Location message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.SourceCodeInfo.Location} Location - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Location.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo.Location(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.path && message.path.length)) - message.path = []; - if ((tag & 7) === 2) { - let end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.path.push(reader.int32()); - } else - message.path.push(reader.int32()); - break; - case 2: - if (!(message.span && message.span.length)) - message.span = []; - if ((tag & 7) === 2) { - let end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.span.push(reader.int32()); - } else - message.span.push(reader.int32()); - break; - case 3: - message.leading_comments = reader.string(); - break; - case 4: - message.trailing_comments = reader.string(); - break; - case 6: - if (!(message.leading_detached_comments && message.leading_detached_comments.length)) - message.leading_detached_comments = []; - message.leading_detached_comments.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Location message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.SourceCodeInfo.Location} Location - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Location.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Location message. - * @function verify - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Location.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.path != null && message.hasOwnProperty("path")) { - if (!Array.isArray(message.path)) - return "path: array expected"; - for (let i = 0; i < message.path.length; ++i) - if (!$util.isInteger(message.path[i])) - return "path: integer[] expected"; - } - if (message.span != null && message.hasOwnProperty("span")) { - if (!Array.isArray(message.span)) - return "span: array expected"; - for (let i = 0; i < message.span.length; ++i) - if (!$util.isInteger(message.span[i])) - return "span: integer[] expected"; - } - if (message.leading_comments != null && message.hasOwnProperty("leading_comments")) - if (!$util.isString(message.leading_comments)) - return "leading_comments: string expected"; - if (message.trailing_comments != null && message.hasOwnProperty("trailing_comments")) - if (!$util.isString(message.trailing_comments)) - return "trailing_comments: string expected"; - if (message.leading_detached_comments != null && message.hasOwnProperty("leading_detached_comments")) { - if (!Array.isArray(message.leading_detached_comments)) - return "leading_detached_comments: array expected"; - for (let i = 0; i < message.leading_detached_comments.length; ++i) - if (!$util.isString(message.leading_detached_comments[i])) - return "leading_detached_comments: string[] expected"; - } - return null; - }; - - /** - * Creates a Location message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.SourceCodeInfo.Location} Location - */ - Location.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.SourceCodeInfo.Location) - return object; - let message = new $root.google.protobuf.SourceCodeInfo.Location(); - if (object.path) { - if (!Array.isArray(object.path)) - throw TypeError(".google.protobuf.SourceCodeInfo.Location.path: array expected"); - message.path = []; - for (let i = 0; i < object.path.length; ++i) - message.path[i] = object.path[i] | 0; - } - if (object.span) { - if (!Array.isArray(object.span)) - throw TypeError(".google.protobuf.SourceCodeInfo.Location.span: array expected"); - message.span = []; - for (let i = 0; i < object.span.length; ++i) - message.span[i] = object.span[i] | 0; - } - if (object.leading_comments != null) - message.leading_comments = String(object.leading_comments); - if (object.trailing_comments != null) - message.trailing_comments = String(object.trailing_comments); - if (object.leading_detached_comments) { - if (!Array.isArray(object.leading_detached_comments)) - throw TypeError(".google.protobuf.SourceCodeInfo.Location.leading_detached_comments: array expected"); - message.leading_detached_comments = []; - for (let i = 0; i < object.leading_detached_comments.length; ++i) - message.leading_detached_comments[i] = String(object.leading_detached_comments[i]); - } - return message; - }; - - /** - * Creates a plain object from a Location message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {google.protobuf.SourceCodeInfo.Location} message Location - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Location.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) { - object.path = []; - object.span = []; - object.leading_detached_comments = []; - } - if (options.defaults) { - object.leading_comments = ""; - object.trailing_comments = ""; - } - if (message.path && message.path.length) { - object.path = []; - for (let j = 0; j < message.path.length; ++j) - object.path[j] = message.path[j]; - } - if (message.span && message.span.length) { - object.span = []; - for (let j = 0; j < message.span.length; ++j) - object.span[j] = message.span[j]; - } - if (message.leading_comments != null && message.hasOwnProperty("leading_comments")) - object.leading_comments = message.leading_comments; - if (message.trailing_comments != null && message.hasOwnProperty("trailing_comments")) - object.trailing_comments = message.trailing_comments; - if (message.leading_detached_comments && message.leading_detached_comments.length) { - object.leading_detached_comments = []; - for (let j = 0; j < message.leading_detached_comments.length; ++j) - object.leading_detached_comments[j] = message.leading_detached_comments[j]; - } - return object; - }; - - /** - * Converts this Location to JSON. - * @function toJSON - * @memberof google.protobuf.SourceCodeInfo.Location - * @instance - * @returns {Object.} JSON object - */ - Location.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Location; - })(); - - return SourceCodeInfo; - })(); - - protobuf.GeneratedCodeInfo = (function() { - - /** - * Properties of a GeneratedCodeInfo. - * @memberof google.protobuf - * @interface IGeneratedCodeInfo - * @property {Array.|null} [annotation] GeneratedCodeInfo annotation - */ - - /** - * Constructs a new GeneratedCodeInfo. - * @memberof google.protobuf - * @classdesc Represents a GeneratedCodeInfo. - * @implements IGeneratedCodeInfo - * @constructor - * @param {google.protobuf.IGeneratedCodeInfo=} [properties] Properties to set - */ - function GeneratedCodeInfo(properties) { - this.annotation = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GeneratedCodeInfo annotation. - * @member {Array.} annotation - * @memberof google.protobuf.GeneratedCodeInfo - * @instance - */ - GeneratedCodeInfo.prototype.annotation = $util.emptyArray; - - /** - * Encodes the specified GeneratedCodeInfo message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. - * @function encode - * @memberof google.protobuf.GeneratedCodeInfo - * @static - * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GeneratedCodeInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.annotation != null && message.annotation.length) - for (let i = 0; i < message.annotation.length; ++i) - $root.google.protobuf.GeneratedCodeInfo.Annotation.encode(message.annotation[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GeneratedCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.GeneratedCodeInfo - * @static - * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GeneratedCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GeneratedCodeInfo message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.GeneratedCodeInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GeneratedCodeInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.GeneratedCodeInfo(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.annotation && message.annotation.length)) - message.annotation = []; - message.annotation.push($root.google.protobuf.GeneratedCodeInfo.Annotation.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GeneratedCodeInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.GeneratedCodeInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GeneratedCodeInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GeneratedCodeInfo message. - * @function verify - * @memberof google.protobuf.GeneratedCodeInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GeneratedCodeInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.annotation != null && message.hasOwnProperty("annotation")) { - if (!Array.isArray(message.annotation)) - return "annotation: array expected"; - for (let i = 0; i < message.annotation.length; ++i) { - let error = $root.google.protobuf.GeneratedCodeInfo.Annotation.verify(message.annotation[i]); - if (error) - return "annotation." + error; - } - } - return null; - }; - - /** - * Creates a GeneratedCodeInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.GeneratedCodeInfo - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo - */ - GeneratedCodeInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.GeneratedCodeInfo) - return object; - let message = new $root.google.protobuf.GeneratedCodeInfo(); - if (object.annotation) { - if (!Array.isArray(object.annotation)) - throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: array expected"); - message.annotation = []; - for (let i = 0; i < object.annotation.length; ++i) { - if (typeof object.annotation[i] !== "object") - throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: object expected"); - message.annotation[i] = $root.google.protobuf.GeneratedCodeInfo.Annotation.fromObject(object.annotation[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a GeneratedCodeInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.GeneratedCodeInfo - * @static - * @param {google.protobuf.GeneratedCodeInfo} message GeneratedCodeInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GeneratedCodeInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.annotation = []; - if (message.annotation && message.annotation.length) { - object.annotation = []; - for (let j = 0; j < message.annotation.length; ++j) - object.annotation[j] = $root.google.protobuf.GeneratedCodeInfo.Annotation.toObject(message.annotation[j], options); - } - return object; - }; - - /** - * Converts this GeneratedCodeInfo to JSON. - * @function toJSON - * @memberof google.protobuf.GeneratedCodeInfo - * @instance - * @returns {Object.} JSON object - */ - GeneratedCodeInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - GeneratedCodeInfo.Annotation = (function() { - - /** - * Properties of an Annotation. - * @memberof google.protobuf.GeneratedCodeInfo - * @interface IAnnotation - * @property {Array.|null} [path] Annotation path - * @property {string|null} [source_file] Annotation source_file - * @property {number|null} [begin] Annotation begin - * @property {number|null} [end] Annotation end - */ - - /** - * Constructs a new Annotation. - * @memberof google.protobuf.GeneratedCodeInfo - * @classdesc Represents an Annotation. - * @implements IAnnotation - * @constructor - * @param {google.protobuf.GeneratedCodeInfo.IAnnotation=} [properties] Properties to set - */ - function Annotation(properties) { - this.path = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Annotation path. - * @member {Array.} path - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @instance - */ - Annotation.prototype.path = $util.emptyArray; - - /** - * Annotation source_file. - * @member {string} source_file - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @instance - */ - Annotation.prototype.source_file = ""; - - /** - * Annotation begin. - * @member {number} begin - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @instance - */ - Annotation.prototype.begin = 0; - - /** - * Annotation end. - * @member {number} end - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @instance - */ - Annotation.prototype.end = 0; - - /** - * Encodes the specified Annotation message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. - * @function encode - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {google.protobuf.GeneratedCodeInfo.IAnnotation} message Annotation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Annotation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.path != null && message.path.length) { - writer.uint32(/* id 1, wireType 2 =*/10).fork(); - for (let i = 0; i < message.path.length; ++i) - writer.int32(message.path[i]); - writer.ldelim(); - } - if (message.source_file != null && Object.hasOwnProperty.call(message, "source_file")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.source_file); - if (message.begin != null && Object.hasOwnProperty.call(message, "begin")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.begin); - if (message.end != null && Object.hasOwnProperty.call(message, "end")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.end); - return writer; - }; - - /** - * Encodes the specified Annotation message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {google.protobuf.GeneratedCodeInfo.IAnnotation} message Annotation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Annotation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Annotation message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Annotation.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.GeneratedCodeInfo.Annotation(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.path && message.path.length)) - message.path = []; - if ((tag & 7) === 2) { - let end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.path.push(reader.int32()); - } else - message.path.push(reader.int32()); - break; - case 2: - message.source_file = reader.string(); - break; - case 3: - message.begin = reader.int32(); - break; - case 4: - message.end = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Annotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Annotation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Annotation message. - * @function verify - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Annotation.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.path != null && message.hasOwnProperty("path")) { - if (!Array.isArray(message.path)) - return "path: array expected"; - for (let i = 0; i < message.path.length; ++i) - if (!$util.isInteger(message.path[i])) - return "path: integer[] expected"; - } - if (message.source_file != null && message.hasOwnProperty("source_file")) - if (!$util.isString(message.source_file)) - return "source_file: string expected"; - if (message.begin != null && message.hasOwnProperty("begin")) - if (!$util.isInteger(message.begin)) - return "begin: integer expected"; - if (message.end != null && message.hasOwnProperty("end")) - if (!$util.isInteger(message.end)) - return "end: integer expected"; - return null; - }; - - /** - * Creates an Annotation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation - */ - Annotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.GeneratedCodeInfo.Annotation) - return object; - let message = new $root.google.protobuf.GeneratedCodeInfo.Annotation(); - if (object.path) { - if (!Array.isArray(object.path)) - throw TypeError(".google.protobuf.GeneratedCodeInfo.Annotation.path: array expected"); - message.path = []; - for (let i = 0; i < object.path.length; ++i) - message.path[i] = object.path[i] | 0; - } - if (object.source_file != null) - message.source_file = String(object.source_file); - if (object.begin != null) - message.begin = object.begin | 0; - if (object.end != null) - message.end = object.end | 0; - return message; - }; - - /** - * Creates a plain object from an Annotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {google.protobuf.GeneratedCodeInfo.Annotation} message Annotation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Annotation.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.path = []; - if (options.defaults) { - object.source_file = ""; - object.begin = 0; - object.end = 0; - } - if (message.path && message.path.length) { - object.path = []; - for (let j = 0; j < message.path.length; ++j) - object.path[j] = message.path[j]; - } - if (message.source_file != null && message.hasOwnProperty("source_file")) - object.source_file = message.source_file; - if (message.begin != null && message.hasOwnProperty("begin")) - object.begin = message.begin; - if (message.end != null && message.hasOwnProperty("end")) - object.end = message.end; - return object; - }; - - /** - * Converts this Annotation to JSON. - * @function toJSON - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @instance - * @returns {Object.} JSON object - */ - Annotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Annotation; - })(); - - return GeneratedCodeInfo; - })(); - - protobuf.Timestamp = (function() { - - /** - * Properties of a Timestamp. - * @memberof google.protobuf - * @interface ITimestamp - * @property {Long|null} [seconds] Timestamp seconds - * @property {number|null} [nanos] Timestamp nanos - */ - - /** - * Constructs a new Timestamp. - * @memberof google.protobuf - * @classdesc Represents a Timestamp. - * @implements ITimestamp - * @constructor - * @param {google.protobuf.ITimestamp=} [properties] Properties to set - */ - function Timestamp(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Timestamp seconds. - * @member {Long} seconds - * @memberof google.protobuf.Timestamp - * @instance - */ - Timestamp.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Timestamp nanos. - * @member {number} nanos - * @memberof google.protobuf.Timestamp - * @instance - */ - Timestamp.prototype.nanos = 0; - - /** - * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. - * @function encode - * @memberof google.protobuf.Timestamp - * @static - * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Timestamp.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); - if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); - return writer; - }; - - /** - * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.Timestamp - * @static - * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Timestamp.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Timestamp message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.Timestamp - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.Timestamp} Timestamp - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Timestamp.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Timestamp(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.seconds = reader.int64(); - break; - case 2: - message.nanos = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Timestamp message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.Timestamp - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Timestamp} Timestamp - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Timestamp.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Timestamp message. - * @function verify - * @memberof google.protobuf.Timestamp - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Timestamp.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.seconds != null && message.hasOwnProperty("seconds")) - if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) - return "seconds: integer|Long expected"; - if (message.nanos != null && message.hasOwnProperty("nanos")) - if (!$util.isInteger(message.nanos)) - return "nanos: integer expected"; - return null; - }; - - /** - * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.Timestamp - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.Timestamp} Timestamp - */ - Timestamp.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Timestamp) - return object; - let message = new $root.google.protobuf.Timestamp(); - if (object.seconds != null) - if ($util.Long) - (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; - else if (typeof object.seconds === "string") - message.seconds = parseInt(object.seconds, 10); - else if (typeof object.seconds === "number") - message.seconds = object.seconds; - else if (typeof object.seconds === "object") - message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); - if (object.nanos != null) - message.nanos = object.nanos | 0; - return message; - }; - - /** - * Creates a plain object from a Timestamp message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.Timestamp - * @static - * @param {google.protobuf.Timestamp} message Timestamp - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Timestamp.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.seconds = options.longs === String ? "0" : 0; - object.nanos = 0; - } - if (message.seconds != null && message.hasOwnProperty("seconds")) - if (typeof message.seconds === "number") - object.seconds = options.longs === String ? String(message.seconds) : message.seconds; - else - object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; - if (message.nanos != null && message.hasOwnProperty("nanos")) - object.nanos = message.nanos; - return object; - }; - - /** - * Converts this Timestamp to JSON. - * @function toJSON - * @memberof google.protobuf.Timestamp - * @instance - * @returns {Object.} JSON object - */ - Timestamp.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Timestamp; - })(); - - protobuf.Duration = (function() { - - /** - * Properties of a Duration. - * @memberof google.protobuf - * @interface IDuration - * @property {Long|null} [seconds] Duration seconds - * @property {number|null} [nanos] Duration nanos - */ - - /** - * Constructs a new Duration. - * @memberof google.protobuf - * @classdesc Represents a Duration. - * @implements IDuration - * @constructor - * @param {google.protobuf.IDuration=} [properties] Properties to set - */ - function Duration(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Duration seconds. - * @member {Long} seconds - * @memberof google.protobuf.Duration - * @instance - */ - Duration.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Duration nanos. - * @member {number} nanos - * @memberof google.protobuf.Duration - * @instance - */ - Duration.prototype.nanos = 0; - - /** - * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. - * @function encode - * @memberof google.protobuf.Duration - * @static - * @param {google.protobuf.IDuration} message Duration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Duration.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); - if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); - return writer; - }; - - /** - * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.Duration - * @static - * @param {google.protobuf.IDuration} message Duration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Duration.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Duration message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.Duration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.Duration} Duration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Duration.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Duration(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.seconds = reader.int64(); - break; - case 2: - message.nanos = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Duration message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.Duration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Duration} Duration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Duration.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Duration message. - * @function verify - * @memberof google.protobuf.Duration - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Duration.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.seconds != null && message.hasOwnProperty("seconds")) - if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) - return "seconds: integer|Long expected"; - if (message.nanos != null && message.hasOwnProperty("nanos")) - if (!$util.isInteger(message.nanos)) - return "nanos: integer expected"; - return null; - }; - - /** - * Creates a Duration message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.Duration - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.Duration} Duration - */ - Duration.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Duration) - return object; - let message = new $root.google.protobuf.Duration(); - if (object.seconds != null) - if ($util.Long) - (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; - else if (typeof object.seconds === "string") - message.seconds = parseInt(object.seconds, 10); - else if (typeof object.seconds === "number") - message.seconds = object.seconds; - else if (typeof object.seconds === "object") - message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); - if (object.nanos != null) - message.nanos = object.nanos | 0; - return message; - }; - - /** - * Creates a plain object from a Duration message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.Duration - * @static - * @param {google.protobuf.Duration} message Duration - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Duration.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.seconds = options.longs === String ? "0" : 0; - object.nanos = 0; - } - if (message.seconds != null && message.hasOwnProperty("seconds")) - if (typeof message.seconds === "number") - object.seconds = options.longs === String ? String(message.seconds) : message.seconds; - else - object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; - if (message.nanos != null && message.hasOwnProperty("nanos")) - object.nanos = message.nanos; - return object; - }; - - /** - * Converts this Duration to JSON. - * @function toJSON - * @memberof google.protobuf.Duration - * @instance - * @returns {Object.} JSON object - */ - Duration.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Duration; - })(); - - return protobuf; - })(); - - google.api = (function() { - - /** - * Namespace api. - * @memberof google - * @namespace - */ - const api = {}; - - api.Http = (function() { - - /** - * Properties of a Http. - * @memberof google.api - * @interface IHttp - * @property {Array.|null} [rules] Http rules - */ - - /** - * Constructs a new Http. - * @memberof google.api - * @classdesc Represents a Http. - * @implements IHttp - * @constructor - * @param {google.api.IHttp=} [properties] Properties to set - */ - function Http(properties) { - this.rules = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Http rules. - * @member {Array.} rules - * @memberof google.api.Http - * @instance - */ - Http.prototype.rules = $util.emptyArray; - - /** - * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. - * @function encode - * @memberof google.api.Http - * @static - * @param {google.api.IHttp} message Http message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Http.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.rules != null && message.rules.length) - for (let i = 0; i < message.rules.length; ++i) - $root.google.api.HttpRule.encode(message.rules[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.Http - * @static - * @param {google.api.IHttp} message Http message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Http.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Http message from the specified reader or buffer. - * @function decode - * @memberof google.api.Http - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.Http} Http - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Http.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Http(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.rules && message.rules.length)) - message.rules = []; - message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Http message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.Http - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.Http} Http - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Http.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Http message. - * @function verify - * @memberof google.api.Http - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Http.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.rules != null && message.hasOwnProperty("rules")) { - if (!Array.isArray(message.rules)) - return "rules: array expected"; - for (let i = 0; i < message.rules.length; ++i) { - let error = $root.google.api.HttpRule.verify(message.rules[i]); - if (error) - return "rules." + error; - } - } - return null; - }; - - /** - * Creates a Http message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.Http - * @static - * @param {Object.} object Plain object - * @returns {google.api.Http} Http - */ - Http.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.Http) - return object; - let message = new $root.google.api.Http(); - if (object.rules) { - if (!Array.isArray(object.rules)) - throw TypeError(".google.api.Http.rules: array expected"); - message.rules = []; - for (let i = 0; i < object.rules.length; ++i) { - if (typeof object.rules[i] !== "object") - throw TypeError(".google.api.Http.rules: object expected"); - message.rules[i] = $root.google.api.HttpRule.fromObject(object.rules[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a Http message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.Http - * @static - * @param {google.api.Http} message Http - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Http.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.rules = []; - if (message.rules && message.rules.length) { - object.rules = []; - for (let j = 0; j < message.rules.length; ++j) - object.rules[j] = $root.google.api.HttpRule.toObject(message.rules[j], options); - } - return object; - }; - - /** - * Converts this Http to JSON. - * @function toJSON - * @memberof google.api.Http - * @instance - * @returns {Object.} JSON object - */ - Http.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Http; - })(); - - api.HttpRule = (function() { - - /** - * Properties of a HttpRule. - * @memberof google.api - * @interface IHttpRule - * @property {string|null} [get] HttpRule get - * @property {string|null} [put] HttpRule put - * @property {string|null} [post] HttpRule post - * @property {string|null} ["delete"] HttpRule delete - * @property {string|null} [patch] HttpRule patch - * @property {google.api.ICustomHttpPattern|null} [custom] HttpRule custom - * @property {string|null} [selector] HttpRule selector - * @property {string|null} [body] HttpRule body - * @property {Array.|null} [additional_bindings] HttpRule additional_bindings - */ - - /** - * Constructs a new HttpRule. - * @memberof google.api - * @classdesc Represents a HttpRule. - * @implements IHttpRule - * @constructor - * @param {google.api.IHttpRule=} [properties] Properties to set - */ - function HttpRule(properties) { - this.additional_bindings = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * HttpRule get. - * @member {string} get - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.get = ""; - - /** - * HttpRule put. - * @member {string} put - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.put = ""; - - /** - * HttpRule post. - * @member {string} post - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.post = ""; - - /** - * HttpRule delete. - * @member {string} delete - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype["delete"] = ""; - - /** - * HttpRule patch. - * @member {string} patch - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.patch = ""; - - /** - * HttpRule custom. - * @member {google.api.ICustomHttpPattern|null|undefined} custom - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.custom = null; - - /** - * HttpRule selector. - * @member {string} selector - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.selector = ""; - - /** - * HttpRule body. - * @member {string} body - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.body = ""; - - /** - * HttpRule additional_bindings. - * @member {Array.} additional_bindings - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.additional_bindings = $util.emptyArray; - - // OneOf field names bound to virtual getters and setters - let $oneOfFields; - - /** - * HttpRule pattern. - * @member {"get"|"put"|"post"|"delete"|"patch"|"custom"|undefined} pattern - * @memberof google.api.HttpRule - * @instance - */ - Object.defineProperty(HttpRule.prototype, "pattern", { - get: $util.oneOfGetter($oneOfFields = ["get", "put", "post", "delete", "patch", "custom"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. - * @function encode - * @memberof google.api.HttpRule - * @static - * @param {google.api.IHttpRule} message HttpRule message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - HttpRule.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); - if (message.get != null && Object.hasOwnProperty.call(message, "get")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.get); - if (message.put != null && Object.hasOwnProperty.call(message, "put")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.put); - if (message.post != null && Object.hasOwnProperty.call(message, "post")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.post); - if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message["delete"]); - if (message.patch != null && Object.hasOwnProperty.call(message, "patch")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.patch); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.body); - if (message.custom != null && Object.hasOwnProperty.call(message, "custom")) - $root.google.api.CustomHttpPattern.encode(message.custom, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.additional_bindings != null && message.additional_bindings.length) - for (let i = 0; i < message.additional_bindings.length; ++i) - $root.google.api.HttpRule.encode(message.additional_bindings[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.HttpRule - * @static - * @param {google.api.IHttpRule} message HttpRule message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - HttpRule.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a HttpRule message from the specified reader or buffer. - * @function decode - * @memberof google.api.HttpRule - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.HttpRule} HttpRule - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - HttpRule.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.HttpRule(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - 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 = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32()); - break; - case 1: - message.selector = reader.string(); - break; - case 7: - message.body = reader.string(); - break; - case 11: - if (!(message.additional_bindings && message.additional_bindings.length)) - message.additional_bindings = []; - message.additional_bindings.push($root.google.api.HttpRule.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a HttpRule message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.HttpRule - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.HttpRule} HttpRule - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - HttpRule.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a HttpRule message. - * @function verify - * @memberof google.api.HttpRule - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - HttpRule.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - let properties = {}; - if (message.get != null && message.hasOwnProperty("get")) { - properties.pattern = 1; - if (!$util.isString(message.get)) - return "get: string expected"; - } - if (message.put != null && message.hasOwnProperty("put")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - if (!$util.isString(message.put)) - return "put: string expected"; - } - if (message.post != null && message.hasOwnProperty("post")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - if (!$util.isString(message.post)) - return "post: string expected"; - } - if (message["delete"] != null && message.hasOwnProperty("delete")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - if (!$util.isString(message["delete"])) - return "delete: string expected"; - } - if (message.patch != null && message.hasOwnProperty("patch")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - if (!$util.isString(message.patch)) - return "patch: string expected"; - } - if (message.custom != null && message.hasOwnProperty("custom")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - { - let error = $root.google.api.CustomHttpPattern.verify(message.custom); - if (error) - return "custom." + error; - } - } - if (message.selector != null && message.hasOwnProperty("selector")) - if (!$util.isString(message.selector)) - return "selector: string expected"; - if (message.body != null && message.hasOwnProperty("body")) - if (!$util.isString(message.body)) - return "body: string expected"; - if (message.additional_bindings != null && message.hasOwnProperty("additional_bindings")) { - if (!Array.isArray(message.additional_bindings)) - return "additional_bindings: array expected"; - for (let i = 0; i < message.additional_bindings.length; ++i) { - let error = $root.google.api.HttpRule.verify(message.additional_bindings[i]); - if (error) - return "additional_bindings." + error; - } - } - return null; - }; - - /** - * Creates a HttpRule message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.HttpRule - * @static - * @param {Object.} object Plain object - * @returns {google.api.HttpRule} HttpRule - */ - HttpRule.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.HttpRule) - return object; - let message = new $root.google.api.HttpRule(); - if (object.get != null) - message.get = String(object.get); - if (object.put != null) - message.put = String(object.put); - if (object.post != null) - message.post = String(object.post); - if (object["delete"] != null) - message["delete"] = String(object["delete"]); - if (object.patch != null) - message.patch = String(object.patch); - if (object.custom != null) { - if (typeof object.custom !== "object") - throw TypeError(".google.api.HttpRule.custom: object expected"); - message.custom = $root.google.api.CustomHttpPattern.fromObject(object.custom); - } - if (object.selector != null) - message.selector = String(object.selector); - if (object.body != null) - message.body = String(object.body); - if (object.additional_bindings) { - if (!Array.isArray(object.additional_bindings)) - throw TypeError(".google.api.HttpRule.additional_bindings: array expected"); - message.additional_bindings = []; - for (let i = 0; i < object.additional_bindings.length; ++i) { - if (typeof object.additional_bindings[i] !== "object") - throw TypeError(".google.api.HttpRule.additional_bindings: object expected"); - message.additional_bindings[i] = $root.google.api.HttpRule.fromObject(object.additional_bindings[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a HttpRule message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.HttpRule - * @static - * @param {google.api.HttpRule} message HttpRule - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - HttpRule.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.additional_bindings = []; - if (options.defaults) { - object.selector = ""; - object.body = ""; - } - if (message.selector != null && message.hasOwnProperty("selector")) - object.selector = message.selector; - if (message.get != null && message.hasOwnProperty("get")) { - object.get = message.get; - if (options.oneofs) - object.pattern = "get"; - } - if (message.put != null && message.hasOwnProperty("put")) { - object.put = message.put; - if (options.oneofs) - object.pattern = "put"; - } - if (message.post != null && message.hasOwnProperty("post")) { - object.post = message.post; - if (options.oneofs) - object.pattern = "post"; - } - if (message["delete"] != null && message.hasOwnProperty("delete")) { - object["delete"] = message["delete"]; - if (options.oneofs) - object.pattern = "delete"; - } - if (message.patch != null && message.hasOwnProperty("patch")) { - object.patch = message.patch; - if (options.oneofs) - object.pattern = "patch"; - } - if (message.body != null && message.hasOwnProperty("body")) - object.body = message.body; - if (message.custom != null && message.hasOwnProperty("custom")) { - object.custom = $root.google.api.CustomHttpPattern.toObject(message.custom, options); - if (options.oneofs) - object.pattern = "custom"; - } - if (message.additional_bindings && message.additional_bindings.length) { - object.additional_bindings = []; - for (let j = 0; j < message.additional_bindings.length; ++j) - object.additional_bindings[j] = $root.google.api.HttpRule.toObject(message.additional_bindings[j], options); - } - return object; - }; - - /** - * Converts this HttpRule to JSON. - * @function toJSON - * @memberof google.api.HttpRule - * @instance - * @returns {Object.} JSON object - */ - HttpRule.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return HttpRule; - })(); - - api.CustomHttpPattern = (function() { - - /** - * Properties of a CustomHttpPattern. - * @memberof google.api - * @interface ICustomHttpPattern - * @property {string|null} [kind] CustomHttpPattern kind - * @property {string|null} [path] CustomHttpPattern path - */ - - /** - * Constructs a new CustomHttpPattern. - * @memberof google.api - * @classdesc Represents a CustomHttpPattern. - * @implements ICustomHttpPattern - * @constructor - * @param {google.api.ICustomHttpPattern=} [properties] Properties to set - */ - function CustomHttpPattern(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * CustomHttpPattern kind. - * @member {string} kind - * @memberof google.api.CustomHttpPattern - * @instance - */ - CustomHttpPattern.prototype.kind = ""; - - /** - * CustomHttpPattern path. - * @member {string} path - * @memberof google.api.CustomHttpPattern - * @instance - */ - CustomHttpPattern.prototype.path = ""; - - /** - * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. - * @function encode - * @memberof google.api.CustomHttpPattern - * @static - * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CustomHttpPattern.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.path != null && Object.hasOwnProperty.call(message, "path")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); - return writer; - }; - - /** - * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.CustomHttpPattern - * @static - * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CustomHttpPattern.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CustomHttpPattern message from the specified reader or buffer. - * @function decode - * @memberof google.api.CustomHttpPattern - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.CustomHttpPattern} CustomHttpPattern - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CustomHttpPattern.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CustomHttpPattern(); - while (reader.pos < end) { - let 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; - }; - - /** - * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.CustomHttpPattern - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.CustomHttpPattern} CustomHttpPattern - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CustomHttpPattern.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CustomHttpPattern message. - * @function verify - * @memberof google.api.CustomHttpPattern - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CustomHttpPattern.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.path != null && message.hasOwnProperty("path")) - if (!$util.isString(message.path)) - return "path: string expected"; - return null; - }; - - /** - * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.CustomHttpPattern - * @static - * @param {Object.} object Plain object - * @returns {google.api.CustomHttpPattern} CustomHttpPattern - */ - CustomHttpPattern.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.CustomHttpPattern) - return object; - let message = new $root.google.api.CustomHttpPattern(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.path != null) - message.path = String(object.path); - return message; - }; - - /** - * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.CustomHttpPattern - * @static - * @param {google.api.CustomHttpPattern} message CustomHttpPattern - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CustomHttpPattern.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.kind = ""; - object.path = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.path != null && message.hasOwnProperty("path")) - object.path = message.path; - return object; - }; - - /** - * Converts this CustomHttpPattern to JSON. - * @function toJSON - * @memberof google.api.CustomHttpPattern - * @instance - * @returns {Object.} JSON object - */ - CustomHttpPattern.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return CustomHttpPattern; - })(); - - api.HttpBody = (function() { - - /** - * Properties of a HttpBody. - * @memberof google.api - * @interface IHttpBody - * @property {string|null} [content_type] HttpBody content_type - * @property {Uint8Array|null} [data] HttpBody data - * @property {Array.|null} [extensions] HttpBody extensions - */ - - /** - * Constructs a new HttpBody. - * @memberof google.api - * @classdesc Represents a HttpBody. - * @implements IHttpBody - * @constructor - * @param {google.api.IHttpBody=} [properties] Properties to set - */ - function HttpBody(properties) { - this.extensions = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * HttpBody content_type. - * @member {string} content_type - * @memberof google.api.HttpBody - * @instance - */ - HttpBody.prototype.content_type = ""; - - /** - * HttpBody data. - * @member {Uint8Array} data - * @memberof google.api.HttpBody - * @instance - */ - HttpBody.prototype.data = $util.newBuffer([]); - - /** - * HttpBody extensions. - * @member {Array.} extensions - * @memberof google.api.HttpBody - * @instance - */ - HttpBody.prototype.extensions = $util.emptyArray; - - /** - * Encodes the specified HttpBody message. Does not implicitly {@link google.api.HttpBody.verify|verify} messages. - * @function encode - * @memberof google.api.HttpBody - * @static - * @param {google.api.IHttpBody} message HttpBody message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - HttpBody.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.content_type != null && Object.hasOwnProperty.call(message, "content_type")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.content_type); - if (message.data != null && Object.hasOwnProperty.call(message, "data")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.data); - if (message.extensions != null && message.extensions.length) - for (let i = 0; i < message.extensions.length; ++i) - $root.google.protobuf.Any.encode(message.extensions[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified HttpBody message, length delimited. Does not implicitly {@link google.api.HttpBody.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.HttpBody - * @static - * @param {google.api.IHttpBody} message HttpBody message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - HttpBody.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a HttpBody message from the specified reader or buffer. - * @function decode - * @memberof google.api.HttpBody - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.HttpBody} HttpBody - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - HttpBody.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.HttpBody(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.content_type = reader.string(); - break; - case 2: - message.data = reader.bytes(); - break; - case 3: - if (!(message.extensions && message.extensions.length)) - message.extensions = []; - message.extensions.push($root.google.protobuf.Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a HttpBody message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.HttpBody - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.HttpBody} HttpBody - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - HttpBody.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a HttpBody message. - * @function verify - * @memberof google.api.HttpBody - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - HttpBody.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.content_type != null && message.hasOwnProperty("content_type")) - if (!$util.isString(message.content_type)) - return "content_type: string expected"; - if (message.data != null && message.hasOwnProperty("data")) - if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) - return "data: buffer expected"; - if (message.extensions != null && message.hasOwnProperty("extensions")) { - if (!Array.isArray(message.extensions)) - return "extensions: array expected"; - for (let i = 0; i < message.extensions.length; ++i) { - let error = $root.google.protobuf.Any.verify(message.extensions[i]); - if (error) - return "extensions." + error; - } - } - return null; - }; - - /** - * Creates a HttpBody message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.HttpBody - * @static - * @param {Object.} object Plain object - * @returns {google.api.HttpBody} HttpBody - */ - HttpBody.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.HttpBody) - return object; - let message = new $root.google.api.HttpBody(); - if (object.content_type != null) - message.content_type = String(object.content_type); - if (object.data != null) - if (typeof object.data === "string") - $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); - else if (object.data.length) - message.data = object.data; - if (object.extensions) { - if (!Array.isArray(object.extensions)) - throw TypeError(".google.api.HttpBody.extensions: array expected"); - message.extensions = []; - for (let i = 0; i < object.extensions.length; ++i) { - if (typeof object.extensions[i] !== "object") - throw TypeError(".google.api.HttpBody.extensions: object expected"); - message.extensions[i] = $root.google.protobuf.Any.fromObject(object.extensions[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a HttpBody message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.HttpBody - * @static - * @param {google.api.HttpBody} message HttpBody - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - HttpBody.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.extensions = []; - if (options.defaults) { - object.content_type = ""; - if (options.bytes === String) - object.data = ""; - else { - object.data = []; - if (options.bytes !== Array) - object.data = $util.newBuffer(object.data); - } - } - if (message.content_type != null && message.hasOwnProperty("content_type")) - object.content_type = message.content_type; - if (message.data != null && message.hasOwnProperty("data")) - object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; - if (message.extensions && message.extensions.length) { - object.extensions = []; - for (let j = 0; j < message.extensions.length; ++j) - object.extensions[j] = $root.google.protobuf.Any.toObject(message.extensions[j], options); - } - return object; - }; - - /** - * Converts this HttpBody to JSON. - * @function toJSON - * @memberof google.api.HttpBody - * @instance - * @returns {Object.} JSON object - */ - HttpBody.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return HttpBody; - })(); - - return api; - })(); - - return google; -})(); - -export const cosmos_proto = $root.cosmos_proto = (() => { - - /** - * Namespace cosmos_proto. - * @exports cosmos_proto - * @namespace - */ - const cosmos_proto = {}; - - return cosmos_proto; -})(); - -export const gogoproto = $root.gogoproto = (() => { - - /** - * Namespace gogoproto. - * @exports gogoproto - * @namespace - */ - const gogoproto = {}; - - return gogoproto; -})(); - -export const ibc = $root.ibc = (() => { - - /** - * Namespace ibc. - * @exports ibc - * @namespace - */ - const ibc = {}; - - ibc.applications = (function() { - - /** - * Namespace applications. - * @memberof ibc - * @namespace - */ - const applications = {}; - - applications.transfer = (function() { - - /** - * Namespace transfer. - * @memberof ibc.applications - * @namespace - */ - const transfer = {}; - - transfer.v1 = (function() { - - /** - * Namespace v1. - * @memberof ibc.applications.transfer - * @namespace - */ - const v1 = {}; - - v1.Msg = (function() { - - /** - * Constructs a new Msg service. - * @memberof ibc.applications.transfer.v1 - * @classdesc Represents a Msg - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function Msg(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Msg.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Msg; - - /** - * Callback as used by {@link ibc.applications.transfer.v1.Msg#transfer}. - * @memberof ibc.applications.transfer.v1.Msg - * @typedef TransferCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.applications.transfer.v1.MsgTransferResponse} [response] MsgTransferResponse - */ - - /** - * Calls Transfer. - * @function transfer - * @memberof ibc.applications.transfer.v1.Msg - * @instance - * @param {ibc.applications.transfer.v1.IMsgTransfer} request MsgTransfer message or plain object - * @param {ibc.applications.transfer.v1.Msg.TransferCallback} callback Node-style callback called with the error, if any, and MsgTransferResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.transfer = function transfer(request, callback) { - return this.rpcCall(transfer, $root.ibc.applications.transfer.v1.MsgTransfer, $root.ibc.applications.transfer.v1.MsgTransferResponse, request, callback); - }, "name", { value: "Transfer" }); - - /** - * Calls Transfer. - * @function transfer - * @memberof ibc.applications.transfer.v1.Msg - * @instance - * @param {ibc.applications.transfer.v1.IMsgTransfer} request MsgTransfer message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return Msg; - })(); - - v1.MsgTransfer = (function() { - - /** - * Properties of a MsgTransfer. - * @memberof ibc.applications.transfer.v1 - * @interface IMsgTransfer - * @property {string|null} [source_port] MsgTransfer source_port - * @property {string|null} [source_channel] MsgTransfer source_channel - * @property {cosmos.base.v1beta1.ICoin|null} [token] MsgTransfer token - * @property {string|null} [sender] MsgTransfer sender - * @property {string|null} [receiver] MsgTransfer receiver - * @property {ibc.core.client.v1.IHeight|null} [timeout_height] MsgTransfer timeout_height - * @property {Long|null} [timeout_timestamp] MsgTransfer timeout_timestamp - */ - - /** - * Constructs a new MsgTransfer. - * @memberof ibc.applications.transfer.v1 - * @classdesc Represents a MsgTransfer. - * @implements IMsgTransfer - * @constructor - * @param {ibc.applications.transfer.v1.IMsgTransfer=} [properties] Properties to set - */ - function MsgTransfer(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgTransfer source_port. - * @member {string} source_port - * @memberof ibc.applications.transfer.v1.MsgTransfer - * @instance - */ - MsgTransfer.prototype.source_port = ""; - - /** - * MsgTransfer source_channel. - * @member {string} source_channel - * @memberof ibc.applications.transfer.v1.MsgTransfer - * @instance - */ - MsgTransfer.prototype.source_channel = ""; - - /** - * MsgTransfer token. - * @member {cosmos.base.v1beta1.ICoin|null|undefined} token - * @memberof ibc.applications.transfer.v1.MsgTransfer - * @instance - */ - MsgTransfer.prototype.token = null; - - /** - * MsgTransfer sender. - * @member {string} sender - * @memberof ibc.applications.transfer.v1.MsgTransfer - * @instance - */ - MsgTransfer.prototype.sender = ""; - - /** - * MsgTransfer receiver. - * @member {string} receiver - * @memberof ibc.applications.transfer.v1.MsgTransfer - * @instance - */ - MsgTransfer.prototype.receiver = ""; - - /** - * MsgTransfer timeout_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} timeout_height - * @memberof ibc.applications.transfer.v1.MsgTransfer - * @instance - */ - MsgTransfer.prototype.timeout_height = null; - - /** - * MsgTransfer timeout_timestamp. - * @member {Long} timeout_timestamp - * @memberof ibc.applications.transfer.v1.MsgTransfer - * @instance - */ - MsgTransfer.prototype.timeout_timestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified MsgTransfer message. Does not implicitly {@link ibc.applications.transfer.v1.MsgTransfer.verify|verify} messages. - * @function encode - * @memberof ibc.applications.transfer.v1.MsgTransfer - * @static - * @param {ibc.applications.transfer.v1.IMsgTransfer} message MsgTransfer message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgTransfer.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.source_port != null && Object.hasOwnProperty.call(message, "source_port")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.source_port); - if (message.source_channel != null && Object.hasOwnProperty.call(message, "source_channel")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.source_channel); - if (message.token != null && Object.hasOwnProperty.call(message, "token")) - $root.cosmos.base.v1beta1.Coin.encode(message.token, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.sender != null && Object.hasOwnProperty.call(message, "sender")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.sender); - if (message.receiver != null && Object.hasOwnProperty.call(message, "receiver")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.receiver); - if (message.timeout_height != null && Object.hasOwnProperty.call(message, "timeout_height")) - $root.ibc.core.client.v1.Height.encode(message.timeout_height, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.timeout_timestamp != null && Object.hasOwnProperty.call(message, "timeout_timestamp")) - writer.uint32(/* id 7, wireType 0 =*/56).uint64(message.timeout_timestamp); - return writer; - }; - - /** - * Encodes the specified MsgTransfer message, length delimited. Does not implicitly {@link ibc.applications.transfer.v1.MsgTransfer.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.applications.transfer.v1.MsgTransfer - * @static - * @param {ibc.applications.transfer.v1.IMsgTransfer} message MsgTransfer message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgTransfer.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgTransfer message from the specified reader or buffer. - * @function decode - * @memberof ibc.applications.transfer.v1.MsgTransfer - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.applications.transfer.v1.MsgTransfer} MsgTransfer - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgTransfer.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.applications.transfer.v1.MsgTransfer(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.source_port = reader.string(); - break; - case 2: - message.source_channel = reader.string(); - break; - case 3: - message.token = $root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32()); - break; - case 4: - message.sender = reader.string(); - break; - case 5: - message.receiver = reader.string(); - break; - case 6: - message.timeout_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - case 7: - message.timeout_timestamp = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgTransfer message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.applications.transfer.v1.MsgTransfer - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.applications.transfer.v1.MsgTransfer} MsgTransfer - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgTransfer.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgTransfer message. - * @function verify - * @memberof ibc.applications.transfer.v1.MsgTransfer - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgTransfer.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.source_port != null && message.hasOwnProperty("source_port")) - if (!$util.isString(message.source_port)) - return "source_port: string expected"; - if (message.source_channel != null && message.hasOwnProperty("source_channel")) - if (!$util.isString(message.source_channel)) - return "source_channel: string expected"; - if (message.token != null && message.hasOwnProperty("token")) { - let error = $root.cosmos.base.v1beta1.Coin.verify(message.token); - if (error) - return "token." + error; - } - if (message.sender != null && message.hasOwnProperty("sender")) - if (!$util.isString(message.sender)) - return "sender: string expected"; - if (message.receiver != null && message.hasOwnProperty("receiver")) - if (!$util.isString(message.receiver)) - return "receiver: string expected"; - if (message.timeout_height != null && message.hasOwnProperty("timeout_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.timeout_height); - if (error) - return "timeout_height." + error; - } - if (message.timeout_timestamp != null && message.hasOwnProperty("timeout_timestamp")) - if (!$util.isInteger(message.timeout_timestamp) && !(message.timeout_timestamp && $util.isInteger(message.timeout_timestamp.low) && $util.isInteger(message.timeout_timestamp.high))) - return "timeout_timestamp: integer|Long expected"; - return null; - }; - - /** - * Creates a MsgTransfer message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.applications.transfer.v1.MsgTransfer - * @static - * @param {Object.} object Plain object - * @returns {ibc.applications.transfer.v1.MsgTransfer} MsgTransfer - */ - MsgTransfer.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.applications.transfer.v1.MsgTransfer) - return object; - let message = new $root.ibc.applications.transfer.v1.MsgTransfer(); - if (object.source_port != null) - message.source_port = String(object.source_port); - if (object.source_channel != null) - message.source_channel = String(object.source_channel); - if (object.token != null) { - if (typeof object.token !== "object") - throw TypeError(".ibc.applications.transfer.v1.MsgTransfer.token: object expected"); - message.token = $root.cosmos.base.v1beta1.Coin.fromObject(object.token); - } - if (object.sender != null) - message.sender = String(object.sender); - if (object.receiver != null) - message.receiver = String(object.receiver); - if (object.timeout_height != null) { - if (typeof object.timeout_height !== "object") - throw TypeError(".ibc.applications.transfer.v1.MsgTransfer.timeout_height: object expected"); - message.timeout_height = $root.ibc.core.client.v1.Height.fromObject(object.timeout_height); - } - if (object.timeout_timestamp != null) - if ($util.Long) - (message.timeout_timestamp = $util.Long.fromValue(object.timeout_timestamp)).unsigned = true; - else if (typeof object.timeout_timestamp === "string") - message.timeout_timestamp = parseInt(object.timeout_timestamp, 10); - else if (typeof object.timeout_timestamp === "number") - message.timeout_timestamp = object.timeout_timestamp; - else if (typeof object.timeout_timestamp === "object") - message.timeout_timestamp = new $util.LongBits(object.timeout_timestamp.low >>> 0, object.timeout_timestamp.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a MsgTransfer message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.applications.transfer.v1.MsgTransfer - * @static - * @param {ibc.applications.transfer.v1.MsgTransfer} message MsgTransfer - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgTransfer.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.source_port = ""; - object.source_channel = ""; - object.token = null; - object.sender = ""; - object.receiver = ""; - object.timeout_height = null; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.timeout_timestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.timeout_timestamp = options.longs === String ? "0" : 0; - } - if (message.source_port != null && message.hasOwnProperty("source_port")) - object.source_port = message.source_port; - if (message.source_channel != null && message.hasOwnProperty("source_channel")) - object.source_channel = message.source_channel; - if (message.token != null && message.hasOwnProperty("token")) - object.token = $root.cosmos.base.v1beta1.Coin.toObject(message.token, options); - if (message.sender != null && message.hasOwnProperty("sender")) - object.sender = message.sender; - if (message.receiver != null && message.hasOwnProperty("receiver")) - object.receiver = message.receiver; - if (message.timeout_height != null && message.hasOwnProperty("timeout_height")) - object.timeout_height = $root.ibc.core.client.v1.Height.toObject(message.timeout_height, options); - if (message.timeout_timestamp != null && message.hasOwnProperty("timeout_timestamp")) - if (typeof message.timeout_timestamp === "number") - object.timeout_timestamp = options.longs === String ? String(message.timeout_timestamp) : message.timeout_timestamp; - else - object.timeout_timestamp = options.longs === String ? $util.Long.prototype.toString.call(message.timeout_timestamp) : options.longs === Number ? new $util.LongBits(message.timeout_timestamp.low >>> 0, message.timeout_timestamp.high >>> 0).toNumber(true) : message.timeout_timestamp; - return object; - }; - - /** - * Converts this MsgTransfer to JSON. - * @function toJSON - * @memberof ibc.applications.transfer.v1.MsgTransfer - * @instance - * @returns {Object.} JSON object - */ - MsgTransfer.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgTransfer; - })(); - - v1.MsgTransferResponse = (function() { - - /** - * Properties of a MsgTransferResponse. - * @memberof ibc.applications.transfer.v1 - * @interface IMsgTransferResponse - */ - - /** - * Constructs a new MsgTransferResponse. - * @memberof ibc.applications.transfer.v1 - * @classdesc Represents a MsgTransferResponse. - * @implements IMsgTransferResponse - * @constructor - * @param {ibc.applications.transfer.v1.IMsgTransferResponse=} [properties] Properties to set - */ - function MsgTransferResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgTransferResponse message. Does not implicitly {@link ibc.applications.transfer.v1.MsgTransferResponse.verify|verify} messages. - * @function encode - * @memberof ibc.applications.transfer.v1.MsgTransferResponse - * @static - * @param {ibc.applications.transfer.v1.IMsgTransferResponse} message MsgTransferResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgTransferResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgTransferResponse message, length delimited. Does not implicitly {@link ibc.applications.transfer.v1.MsgTransferResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.applications.transfer.v1.MsgTransferResponse - * @static - * @param {ibc.applications.transfer.v1.IMsgTransferResponse} message MsgTransferResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgTransferResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgTransferResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.applications.transfer.v1.MsgTransferResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.applications.transfer.v1.MsgTransferResponse} MsgTransferResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgTransferResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.applications.transfer.v1.MsgTransferResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgTransferResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.applications.transfer.v1.MsgTransferResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.applications.transfer.v1.MsgTransferResponse} MsgTransferResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgTransferResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgTransferResponse message. - * @function verify - * @memberof ibc.applications.transfer.v1.MsgTransferResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgTransferResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgTransferResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.applications.transfer.v1.MsgTransferResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.applications.transfer.v1.MsgTransferResponse} MsgTransferResponse - */ - MsgTransferResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.applications.transfer.v1.MsgTransferResponse) - return object; - return new $root.ibc.applications.transfer.v1.MsgTransferResponse(); - }; - - /** - * Creates a plain object from a MsgTransferResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.applications.transfer.v1.MsgTransferResponse - * @static - * @param {ibc.applications.transfer.v1.MsgTransferResponse} message MsgTransferResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgTransferResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgTransferResponse to JSON. - * @function toJSON - * @memberof ibc.applications.transfer.v1.MsgTransferResponse - * @instance - * @returns {Object.} JSON object - */ - MsgTransferResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgTransferResponse; - })(); - - v1.FungibleTokenPacketData = (function() { - - /** - * Properties of a FungibleTokenPacketData. - * @memberof ibc.applications.transfer.v1 - * @interface IFungibleTokenPacketData - * @property {string|null} [denom] FungibleTokenPacketData denom - * @property {Long|null} [amount] FungibleTokenPacketData amount - * @property {string|null} [sender] FungibleTokenPacketData sender - * @property {string|null} [receiver] FungibleTokenPacketData receiver - */ - - /** - * Constructs a new FungibleTokenPacketData. - * @memberof ibc.applications.transfer.v1 - * @classdesc Represents a FungibleTokenPacketData. - * @implements IFungibleTokenPacketData - * @constructor - * @param {ibc.applications.transfer.v1.IFungibleTokenPacketData=} [properties] Properties to set - */ - function FungibleTokenPacketData(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * FungibleTokenPacketData denom. - * @member {string} denom - * @memberof ibc.applications.transfer.v1.FungibleTokenPacketData - * @instance - */ - FungibleTokenPacketData.prototype.denom = ""; - - /** - * FungibleTokenPacketData amount. - * @member {Long} amount - * @memberof ibc.applications.transfer.v1.FungibleTokenPacketData - * @instance - */ - FungibleTokenPacketData.prototype.amount = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * FungibleTokenPacketData sender. - * @member {string} sender - * @memberof ibc.applications.transfer.v1.FungibleTokenPacketData - * @instance - */ - FungibleTokenPacketData.prototype.sender = ""; - - /** - * FungibleTokenPacketData receiver. - * @member {string} receiver - * @memberof ibc.applications.transfer.v1.FungibleTokenPacketData - * @instance - */ - FungibleTokenPacketData.prototype.receiver = ""; - - /** - * Encodes the specified FungibleTokenPacketData message. Does not implicitly {@link ibc.applications.transfer.v1.FungibleTokenPacketData.verify|verify} messages. - * @function encode - * @memberof ibc.applications.transfer.v1.FungibleTokenPacketData - * @static - * @param {ibc.applications.transfer.v1.IFungibleTokenPacketData} message FungibleTokenPacketData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FungibleTokenPacketData.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.denom != null && Object.hasOwnProperty.call(message, "denom")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.denom); - if (message.amount != null && Object.hasOwnProperty.call(message, "amount")) - writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.amount); - if (message.sender != null && Object.hasOwnProperty.call(message, "sender")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.sender); - if (message.receiver != null && Object.hasOwnProperty.call(message, "receiver")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.receiver); - return writer; - }; - - /** - * Encodes the specified FungibleTokenPacketData message, length delimited. Does not implicitly {@link ibc.applications.transfer.v1.FungibleTokenPacketData.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.applications.transfer.v1.FungibleTokenPacketData - * @static - * @param {ibc.applications.transfer.v1.IFungibleTokenPacketData} message FungibleTokenPacketData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FungibleTokenPacketData.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FungibleTokenPacketData message from the specified reader or buffer. - * @function decode - * @memberof ibc.applications.transfer.v1.FungibleTokenPacketData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.applications.transfer.v1.FungibleTokenPacketData} FungibleTokenPacketData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FungibleTokenPacketData.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.applications.transfer.v1.FungibleTokenPacketData(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.denom = reader.string(); - break; - case 2: - message.amount = reader.uint64(); - break; - case 3: - message.sender = reader.string(); - break; - case 4: - message.receiver = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FungibleTokenPacketData message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.applications.transfer.v1.FungibleTokenPacketData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.applications.transfer.v1.FungibleTokenPacketData} FungibleTokenPacketData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FungibleTokenPacketData.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FungibleTokenPacketData message. - * @function verify - * @memberof ibc.applications.transfer.v1.FungibleTokenPacketData - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FungibleTokenPacketData.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.denom != null && message.hasOwnProperty("denom")) - if (!$util.isString(message.denom)) - return "denom: string expected"; - if (message.amount != null && message.hasOwnProperty("amount")) - if (!$util.isInteger(message.amount) && !(message.amount && $util.isInteger(message.amount.low) && $util.isInteger(message.amount.high))) - return "amount: integer|Long expected"; - if (message.sender != null && message.hasOwnProperty("sender")) - if (!$util.isString(message.sender)) - return "sender: string expected"; - if (message.receiver != null && message.hasOwnProperty("receiver")) - if (!$util.isString(message.receiver)) - return "receiver: string expected"; - return null; - }; - - /** - * Creates a FungibleTokenPacketData message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.applications.transfer.v1.FungibleTokenPacketData - * @static - * @param {Object.} object Plain object - * @returns {ibc.applications.transfer.v1.FungibleTokenPacketData} FungibleTokenPacketData - */ - FungibleTokenPacketData.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.applications.transfer.v1.FungibleTokenPacketData) - return object; - let message = new $root.ibc.applications.transfer.v1.FungibleTokenPacketData(); - if (object.denom != null) - message.denom = String(object.denom); - if (object.amount != null) - if ($util.Long) - (message.amount = $util.Long.fromValue(object.amount)).unsigned = true; - else if (typeof object.amount === "string") - message.amount = parseInt(object.amount, 10); - else if (typeof object.amount === "number") - message.amount = object.amount; - else if (typeof object.amount === "object") - message.amount = new $util.LongBits(object.amount.low >>> 0, object.amount.high >>> 0).toNumber(true); - if (object.sender != null) - message.sender = String(object.sender); - if (object.receiver != null) - message.receiver = String(object.receiver); - return message; - }; - - /** - * Creates a plain object from a FungibleTokenPacketData message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.applications.transfer.v1.FungibleTokenPacketData - * @static - * @param {ibc.applications.transfer.v1.FungibleTokenPacketData} message FungibleTokenPacketData - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FungibleTokenPacketData.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.denom = ""; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.amount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.amount = options.longs === String ? "0" : 0; - object.sender = ""; - object.receiver = ""; - } - if (message.denom != null && message.hasOwnProperty("denom")) - object.denom = message.denom; - if (message.amount != null && message.hasOwnProperty("amount")) - if (typeof message.amount === "number") - object.amount = options.longs === String ? String(message.amount) : message.amount; - else - object.amount = options.longs === String ? $util.Long.prototype.toString.call(message.amount) : options.longs === Number ? new $util.LongBits(message.amount.low >>> 0, message.amount.high >>> 0).toNumber(true) : message.amount; - if (message.sender != null && message.hasOwnProperty("sender")) - object.sender = message.sender; - if (message.receiver != null && message.hasOwnProperty("receiver")) - object.receiver = message.receiver; - return object; - }; - - /** - * Converts this FungibleTokenPacketData to JSON. - * @function toJSON - * @memberof ibc.applications.transfer.v1.FungibleTokenPacketData - * @instance - * @returns {Object.} JSON object - */ - FungibleTokenPacketData.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return FungibleTokenPacketData; - })(); - - v1.DenomTrace = (function() { - - /** - * Properties of a DenomTrace. - * @memberof ibc.applications.transfer.v1 - * @interface IDenomTrace - * @property {string|null} [path] DenomTrace path - * @property {string|null} [base_denom] DenomTrace base_denom - */ - - /** - * Constructs a new DenomTrace. - * @memberof ibc.applications.transfer.v1 - * @classdesc Represents a DenomTrace. - * @implements IDenomTrace - * @constructor - * @param {ibc.applications.transfer.v1.IDenomTrace=} [properties] Properties to set - */ - function DenomTrace(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DenomTrace path. - * @member {string} path - * @memberof ibc.applications.transfer.v1.DenomTrace - * @instance - */ - DenomTrace.prototype.path = ""; - - /** - * DenomTrace base_denom. - * @member {string} base_denom - * @memberof ibc.applications.transfer.v1.DenomTrace - * @instance - */ - DenomTrace.prototype.base_denom = ""; - - /** - * Encodes the specified DenomTrace message. Does not implicitly {@link ibc.applications.transfer.v1.DenomTrace.verify|verify} messages. - * @function encode - * @memberof ibc.applications.transfer.v1.DenomTrace - * @static - * @param {ibc.applications.transfer.v1.IDenomTrace} message DenomTrace message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DenomTrace.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.path != null && Object.hasOwnProperty.call(message, "path")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.path); - if (message.base_denom != null && Object.hasOwnProperty.call(message, "base_denom")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.base_denom); - return writer; - }; - - /** - * Encodes the specified DenomTrace message, length delimited. Does not implicitly {@link ibc.applications.transfer.v1.DenomTrace.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.applications.transfer.v1.DenomTrace - * @static - * @param {ibc.applications.transfer.v1.IDenomTrace} message DenomTrace message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DenomTrace.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DenomTrace message from the specified reader or buffer. - * @function decode - * @memberof ibc.applications.transfer.v1.DenomTrace - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.applications.transfer.v1.DenomTrace} DenomTrace - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DenomTrace.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.applications.transfer.v1.DenomTrace(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.path = reader.string(); - break; - case 2: - message.base_denom = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DenomTrace message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.applications.transfer.v1.DenomTrace - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.applications.transfer.v1.DenomTrace} DenomTrace - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DenomTrace.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DenomTrace message. - * @function verify - * @memberof ibc.applications.transfer.v1.DenomTrace - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DenomTrace.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.path != null && message.hasOwnProperty("path")) - if (!$util.isString(message.path)) - return "path: string expected"; - if (message.base_denom != null && message.hasOwnProperty("base_denom")) - if (!$util.isString(message.base_denom)) - return "base_denom: string expected"; - return null; - }; - - /** - * Creates a DenomTrace message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.applications.transfer.v1.DenomTrace - * @static - * @param {Object.} object Plain object - * @returns {ibc.applications.transfer.v1.DenomTrace} DenomTrace - */ - DenomTrace.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.applications.transfer.v1.DenomTrace) - return object; - let message = new $root.ibc.applications.transfer.v1.DenomTrace(); - if (object.path != null) - message.path = String(object.path); - if (object.base_denom != null) - message.base_denom = String(object.base_denom); - return message; - }; - - /** - * Creates a plain object from a DenomTrace message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.applications.transfer.v1.DenomTrace - * @static - * @param {ibc.applications.transfer.v1.DenomTrace} message DenomTrace - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DenomTrace.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.path = ""; - object.base_denom = ""; - } - if (message.path != null && message.hasOwnProperty("path")) - object.path = message.path; - if (message.base_denom != null && message.hasOwnProperty("base_denom")) - object.base_denom = message.base_denom; - return object; - }; - - /** - * Converts this DenomTrace to JSON. - * @function toJSON - * @memberof ibc.applications.transfer.v1.DenomTrace - * @instance - * @returns {Object.} JSON object - */ - DenomTrace.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return DenomTrace; - })(); - - v1.Params = (function() { - - /** - * Properties of a Params. - * @memberof ibc.applications.transfer.v1 - * @interface IParams - * @property {boolean|null} [send_enabled] Params send_enabled - * @property {boolean|null} [receive_enabled] Params receive_enabled - */ - - /** - * Constructs a new Params. - * @memberof ibc.applications.transfer.v1 - * @classdesc Represents a Params. - * @implements IParams - * @constructor - * @param {ibc.applications.transfer.v1.IParams=} [properties] Properties to set - */ - function Params(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Params send_enabled. - * @member {boolean} send_enabled - * @memberof ibc.applications.transfer.v1.Params - * @instance - */ - Params.prototype.send_enabled = false; - - /** - * Params receive_enabled. - * @member {boolean} receive_enabled - * @memberof ibc.applications.transfer.v1.Params - * @instance - */ - Params.prototype.receive_enabled = false; - - /** - * Encodes the specified Params message. Does not implicitly {@link ibc.applications.transfer.v1.Params.verify|verify} messages. - * @function encode - * @memberof ibc.applications.transfer.v1.Params - * @static - * @param {ibc.applications.transfer.v1.IParams} message Params message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Params.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.send_enabled != null && Object.hasOwnProperty.call(message, "send_enabled")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.send_enabled); - if (message.receive_enabled != null && Object.hasOwnProperty.call(message, "receive_enabled")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.receive_enabled); - return writer; - }; - - /** - * Encodes the specified Params message, length delimited. Does not implicitly {@link ibc.applications.transfer.v1.Params.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.applications.transfer.v1.Params - * @static - * @param {ibc.applications.transfer.v1.IParams} message Params message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Params.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Params message from the specified reader or buffer. - * @function decode - * @memberof ibc.applications.transfer.v1.Params - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.applications.transfer.v1.Params} Params - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Params.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.applications.transfer.v1.Params(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.send_enabled = reader.bool(); - break; - case 2: - message.receive_enabled = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Params message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.applications.transfer.v1.Params - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.applications.transfer.v1.Params} Params - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Params.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Params message. - * @function verify - * @memberof ibc.applications.transfer.v1.Params - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Params.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.send_enabled != null && message.hasOwnProperty("send_enabled")) - if (typeof message.send_enabled !== "boolean") - return "send_enabled: boolean expected"; - if (message.receive_enabled != null && message.hasOwnProperty("receive_enabled")) - if (typeof message.receive_enabled !== "boolean") - return "receive_enabled: boolean expected"; - return null; - }; - - /** - * Creates a Params message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.applications.transfer.v1.Params - * @static - * @param {Object.} object Plain object - * @returns {ibc.applications.transfer.v1.Params} Params - */ - Params.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.applications.transfer.v1.Params) - return object; - let message = new $root.ibc.applications.transfer.v1.Params(); - if (object.send_enabled != null) - message.send_enabled = Boolean(object.send_enabled); - if (object.receive_enabled != null) - message.receive_enabled = Boolean(object.receive_enabled); - return message; - }; - - /** - * Creates a plain object from a Params message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.applications.transfer.v1.Params - * @static - * @param {ibc.applications.transfer.v1.Params} message Params - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Params.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.send_enabled = false; - object.receive_enabled = false; - } - if (message.send_enabled != null && message.hasOwnProperty("send_enabled")) - object.send_enabled = message.send_enabled; - if (message.receive_enabled != null && message.hasOwnProperty("receive_enabled")) - object.receive_enabled = message.receive_enabled; - return object; - }; - - /** - * Converts this Params to JSON. - * @function toJSON - * @memberof ibc.applications.transfer.v1.Params - * @instance - * @returns {Object.} JSON object - */ - Params.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Params; - })(); - - v1.Query = (function() { - - /** - * Constructs a new Query service. - * @memberof ibc.applications.transfer.v1 - * @classdesc Represents a Query - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function Query(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Query.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Query; - - /** - * Callback as used by {@link ibc.applications.transfer.v1.Query#denomTrace}. - * @memberof ibc.applications.transfer.v1.Query - * @typedef DenomTraceCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.applications.transfer.v1.QueryDenomTraceResponse} [response] QueryDenomTraceResponse - */ - - /** - * Calls DenomTrace. - * @function denomTrace - * @memberof ibc.applications.transfer.v1.Query - * @instance - * @param {ibc.applications.transfer.v1.IQueryDenomTraceRequest} request QueryDenomTraceRequest message or plain object - * @param {ibc.applications.transfer.v1.Query.DenomTraceCallback} callback Node-style callback called with the error, if any, and QueryDenomTraceResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.denomTrace = function denomTrace(request, callback) { - return this.rpcCall(denomTrace, $root.ibc.applications.transfer.v1.QueryDenomTraceRequest, $root.ibc.applications.transfer.v1.QueryDenomTraceResponse, request, callback); - }, "name", { value: "DenomTrace" }); - - /** - * Calls DenomTrace. - * @function denomTrace - * @memberof ibc.applications.transfer.v1.Query - * @instance - * @param {ibc.applications.transfer.v1.IQueryDenomTraceRequest} request QueryDenomTraceRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.applications.transfer.v1.Query#denomTraces}. - * @memberof ibc.applications.transfer.v1.Query - * @typedef DenomTracesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.applications.transfer.v1.QueryDenomTracesResponse} [response] QueryDenomTracesResponse - */ - - /** - * Calls DenomTraces. - * @function denomTraces - * @memberof ibc.applications.transfer.v1.Query - * @instance - * @param {ibc.applications.transfer.v1.IQueryDenomTracesRequest} request QueryDenomTracesRequest message or plain object - * @param {ibc.applications.transfer.v1.Query.DenomTracesCallback} callback Node-style callback called with the error, if any, and QueryDenomTracesResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.denomTraces = function denomTraces(request, callback) { - return this.rpcCall(denomTraces, $root.ibc.applications.transfer.v1.QueryDenomTracesRequest, $root.ibc.applications.transfer.v1.QueryDenomTracesResponse, request, callback); - }, "name", { value: "DenomTraces" }); - - /** - * Calls DenomTraces. - * @function denomTraces - * @memberof ibc.applications.transfer.v1.Query - * @instance - * @param {ibc.applications.transfer.v1.IQueryDenomTracesRequest} request QueryDenomTracesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.applications.transfer.v1.Query#params}. - * @memberof ibc.applications.transfer.v1.Query - * @typedef ParamsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.applications.transfer.v1.QueryParamsResponse} [response] QueryParamsResponse - */ - - /** - * Calls Params. - * @function params - * @memberof ibc.applications.transfer.v1.Query - * @instance - * @param {ibc.applications.transfer.v1.IQueryParamsRequest} request QueryParamsRequest message or plain object - * @param {ibc.applications.transfer.v1.Query.ParamsCallback} callback Node-style callback called with the error, if any, and QueryParamsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.params = function params(request, callback) { - return this.rpcCall(params, $root.ibc.applications.transfer.v1.QueryParamsRequest, $root.ibc.applications.transfer.v1.QueryParamsResponse, request, callback); - }, "name", { value: "Params" }); - - /** - * Calls Params. - * @function params - * @memberof ibc.applications.transfer.v1.Query - * @instance - * @param {ibc.applications.transfer.v1.IQueryParamsRequest} request QueryParamsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return Query; - })(); - - v1.QueryDenomTraceRequest = (function() { - - /** - * Properties of a QueryDenomTraceRequest. - * @memberof ibc.applications.transfer.v1 - * @interface IQueryDenomTraceRequest - * @property {string|null} [hash] QueryDenomTraceRequest hash - */ - - /** - * Constructs a new QueryDenomTraceRequest. - * @memberof ibc.applications.transfer.v1 - * @classdesc Represents a QueryDenomTraceRequest. - * @implements IQueryDenomTraceRequest - * @constructor - * @param {ibc.applications.transfer.v1.IQueryDenomTraceRequest=} [properties] Properties to set - */ - function QueryDenomTraceRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryDenomTraceRequest hash. - * @member {string} hash - * @memberof ibc.applications.transfer.v1.QueryDenomTraceRequest - * @instance - */ - QueryDenomTraceRequest.prototype.hash = ""; - - /** - * Encodes the specified QueryDenomTraceRequest message. Does not implicitly {@link ibc.applications.transfer.v1.QueryDenomTraceRequest.verify|verify} messages. - * @function encode - * @memberof ibc.applications.transfer.v1.QueryDenomTraceRequest - * @static - * @param {ibc.applications.transfer.v1.IQueryDenomTraceRequest} message QueryDenomTraceRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDenomTraceRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.hash != null && Object.hasOwnProperty.call(message, "hash")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.hash); - return writer; - }; - - /** - * Encodes the specified QueryDenomTraceRequest message, length delimited. Does not implicitly {@link ibc.applications.transfer.v1.QueryDenomTraceRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.applications.transfer.v1.QueryDenomTraceRequest - * @static - * @param {ibc.applications.transfer.v1.IQueryDenomTraceRequest} message QueryDenomTraceRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDenomTraceRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryDenomTraceRequest message from the specified reader or buffer. - * @function decode - * @memberof ibc.applications.transfer.v1.QueryDenomTraceRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.applications.transfer.v1.QueryDenomTraceRequest} QueryDenomTraceRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDenomTraceRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.applications.transfer.v1.QueryDenomTraceRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.hash = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryDenomTraceRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.applications.transfer.v1.QueryDenomTraceRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.applications.transfer.v1.QueryDenomTraceRequest} QueryDenomTraceRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDenomTraceRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryDenomTraceRequest message. - * @function verify - * @memberof ibc.applications.transfer.v1.QueryDenomTraceRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryDenomTraceRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.hash != null && message.hasOwnProperty("hash")) - if (!$util.isString(message.hash)) - return "hash: string expected"; - return null; - }; - - /** - * Creates a QueryDenomTraceRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.applications.transfer.v1.QueryDenomTraceRequest - * @static - * @param {Object.} object Plain object - * @returns {ibc.applications.transfer.v1.QueryDenomTraceRequest} QueryDenomTraceRequest - */ - QueryDenomTraceRequest.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.applications.transfer.v1.QueryDenomTraceRequest) - return object; - let message = new $root.ibc.applications.transfer.v1.QueryDenomTraceRequest(); - if (object.hash != null) - message.hash = String(object.hash); - return message; - }; - - /** - * Creates a plain object from a QueryDenomTraceRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.applications.transfer.v1.QueryDenomTraceRequest - * @static - * @param {ibc.applications.transfer.v1.QueryDenomTraceRequest} message QueryDenomTraceRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryDenomTraceRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.hash = ""; - if (message.hash != null && message.hasOwnProperty("hash")) - object.hash = message.hash; - return object; - }; - - /** - * Converts this QueryDenomTraceRequest to JSON. - * @function toJSON - * @memberof ibc.applications.transfer.v1.QueryDenomTraceRequest - * @instance - * @returns {Object.} JSON object - */ - QueryDenomTraceRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryDenomTraceRequest; - })(); - - v1.QueryDenomTraceResponse = (function() { - - /** - * Properties of a QueryDenomTraceResponse. - * @memberof ibc.applications.transfer.v1 - * @interface IQueryDenomTraceResponse - * @property {ibc.applications.transfer.v1.IDenomTrace|null} [denom_trace] QueryDenomTraceResponse denom_trace - */ - - /** - * Constructs a new QueryDenomTraceResponse. - * @memberof ibc.applications.transfer.v1 - * @classdesc Represents a QueryDenomTraceResponse. - * @implements IQueryDenomTraceResponse - * @constructor - * @param {ibc.applications.transfer.v1.IQueryDenomTraceResponse=} [properties] Properties to set - */ - function QueryDenomTraceResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryDenomTraceResponse denom_trace. - * @member {ibc.applications.transfer.v1.IDenomTrace|null|undefined} denom_trace - * @memberof ibc.applications.transfer.v1.QueryDenomTraceResponse - * @instance - */ - QueryDenomTraceResponse.prototype.denom_trace = null; - - /** - * Encodes the specified QueryDenomTraceResponse message. Does not implicitly {@link ibc.applications.transfer.v1.QueryDenomTraceResponse.verify|verify} messages. - * @function encode - * @memberof ibc.applications.transfer.v1.QueryDenomTraceResponse - * @static - * @param {ibc.applications.transfer.v1.IQueryDenomTraceResponse} message QueryDenomTraceResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDenomTraceResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.denom_trace != null && Object.hasOwnProperty.call(message, "denom_trace")) - $root.ibc.applications.transfer.v1.DenomTrace.encode(message.denom_trace, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryDenomTraceResponse message, length delimited. Does not implicitly {@link ibc.applications.transfer.v1.QueryDenomTraceResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.applications.transfer.v1.QueryDenomTraceResponse - * @static - * @param {ibc.applications.transfer.v1.IQueryDenomTraceResponse} message QueryDenomTraceResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDenomTraceResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryDenomTraceResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.applications.transfer.v1.QueryDenomTraceResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.applications.transfer.v1.QueryDenomTraceResponse} QueryDenomTraceResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDenomTraceResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.applications.transfer.v1.QueryDenomTraceResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.denom_trace = $root.ibc.applications.transfer.v1.DenomTrace.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryDenomTraceResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.applications.transfer.v1.QueryDenomTraceResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.applications.transfer.v1.QueryDenomTraceResponse} QueryDenomTraceResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDenomTraceResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryDenomTraceResponse message. - * @function verify - * @memberof ibc.applications.transfer.v1.QueryDenomTraceResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryDenomTraceResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.denom_trace != null && message.hasOwnProperty("denom_trace")) { - let error = $root.ibc.applications.transfer.v1.DenomTrace.verify(message.denom_trace); - if (error) - return "denom_trace." + error; - } - return null; - }; - - /** - * Creates a QueryDenomTraceResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.applications.transfer.v1.QueryDenomTraceResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.applications.transfer.v1.QueryDenomTraceResponse} QueryDenomTraceResponse - */ - QueryDenomTraceResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.applications.transfer.v1.QueryDenomTraceResponse) - return object; - let message = new $root.ibc.applications.transfer.v1.QueryDenomTraceResponse(); - if (object.denom_trace != null) { - if (typeof object.denom_trace !== "object") - throw TypeError(".ibc.applications.transfer.v1.QueryDenomTraceResponse.denom_trace: object expected"); - message.denom_trace = $root.ibc.applications.transfer.v1.DenomTrace.fromObject(object.denom_trace); - } - return message; - }; - - /** - * Creates a plain object from a QueryDenomTraceResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.applications.transfer.v1.QueryDenomTraceResponse - * @static - * @param {ibc.applications.transfer.v1.QueryDenomTraceResponse} message QueryDenomTraceResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryDenomTraceResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.denom_trace = null; - if (message.denom_trace != null && message.hasOwnProperty("denom_trace")) - object.denom_trace = $root.ibc.applications.transfer.v1.DenomTrace.toObject(message.denom_trace, options); - return object; - }; - - /** - * Converts this QueryDenomTraceResponse to JSON. - * @function toJSON - * @memberof ibc.applications.transfer.v1.QueryDenomTraceResponse - * @instance - * @returns {Object.} JSON object - */ - QueryDenomTraceResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryDenomTraceResponse; - })(); - - v1.QueryDenomTracesRequest = (function() { - - /** - * Properties of a QueryDenomTracesRequest. - * @memberof ibc.applications.transfer.v1 - * @interface IQueryDenomTracesRequest - * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryDenomTracesRequest pagination - */ - - /** - * Constructs a new QueryDenomTracesRequest. - * @memberof ibc.applications.transfer.v1 - * @classdesc Represents a QueryDenomTracesRequest. - * @implements IQueryDenomTracesRequest - * @constructor - * @param {ibc.applications.transfer.v1.IQueryDenomTracesRequest=} [properties] Properties to set - */ - function QueryDenomTracesRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryDenomTracesRequest pagination. - * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination - * @memberof ibc.applications.transfer.v1.QueryDenomTracesRequest - * @instance - */ - QueryDenomTracesRequest.prototype.pagination = null; - - /** - * Encodes the specified QueryDenomTracesRequest message. Does not implicitly {@link ibc.applications.transfer.v1.QueryDenomTracesRequest.verify|verify} messages. - * @function encode - * @memberof ibc.applications.transfer.v1.QueryDenomTracesRequest - * @static - * @param {ibc.applications.transfer.v1.IQueryDenomTracesRequest} message QueryDenomTracesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDenomTracesRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryDenomTracesRequest message, length delimited. Does not implicitly {@link ibc.applications.transfer.v1.QueryDenomTracesRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.applications.transfer.v1.QueryDenomTracesRequest - * @static - * @param {ibc.applications.transfer.v1.IQueryDenomTracesRequest} message QueryDenomTracesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDenomTracesRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryDenomTracesRequest message from the specified reader or buffer. - * @function decode - * @memberof ibc.applications.transfer.v1.QueryDenomTracesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.applications.transfer.v1.QueryDenomTracesRequest} QueryDenomTracesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDenomTracesRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.applications.transfer.v1.QueryDenomTracesRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryDenomTracesRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.applications.transfer.v1.QueryDenomTracesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.applications.transfer.v1.QueryDenomTracesRequest} QueryDenomTracesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDenomTracesRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryDenomTracesRequest message. - * @function verify - * @memberof ibc.applications.transfer.v1.QueryDenomTracesRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryDenomTracesRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryDenomTracesRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.applications.transfer.v1.QueryDenomTracesRequest - * @static - * @param {Object.} object Plain object - * @returns {ibc.applications.transfer.v1.QueryDenomTracesRequest} QueryDenomTracesRequest - */ - QueryDenomTracesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.applications.transfer.v1.QueryDenomTracesRequest) - return object; - let message = new $root.ibc.applications.transfer.v1.QueryDenomTracesRequest(); - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".ibc.applications.transfer.v1.QueryDenomTracesRequest.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryDenomTracesRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.applications.transfer.v1.QueryDenomTracesRequest - * @static - * @param {ibc.applications.transfer.v1.QueryDenomTracesRequest} message QueryDenomTracesRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryDenomTracesRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.pagination = null; - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryDenomTracesRequest to JSON. - * @function toJSON - * @memberof ibc.applications.transfer.v1.QueryDenomTracesRequest - * @instance - * @returns {Object.} JSON object - */ - QueryDenomTracesRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryDenomTracesRequest; - })(); - - v1.QueryDenomTracesResponse = (function() { - - /** - * Properties of a QueryDenomTracesResponse. - * @memberof ibc.applications.transfer.v1 - * @interface IQueryDenomTracesResponse - * @property {Array.|null} [denom_traces] QueryDenomTracesResponse denom_traces - * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryDenomTracesResponse pagination - */ - - /** - * Constructs a new QueryDenomTracesResponse. - * @memberof ibc.applications.transfer.v1 - * @classdesc Represents a QueryDenomTracesResponse. - * @implements IQueryDenomTracesResponse - * @constructor - * @param {ibc.applications.transfer.v1.IQueryDenomTracesResponse=} [properties] Properties to set - */ - function QueryDenomTracesResponse(properties) { - this.denom_traces = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryDenomTracesResponse denom_traces. - * @member {Array.} denom_traces - * @memberof ibc.applications.transfer.v1.QueryDenomTracesResponse - * @instance - */ - QueryDenomTracesResponse.prototype.denom_traces = $util.emptyArray; - - /** - * QueryDenomTracesResponse pagination. - * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination - * @memberof ibc.applications.transfer.v1.QueryDenomTracesResponse - * @instance - */ - QueryDenomTracesResponse.prototype.pagination = null; - - /** - * Encodes the specified QueryDenomTracesResponse message. Does not implicitly {@link ibc.applications.transfer.v1.QueryDenomTracesResponse.verify|verify} messages. - * @function encode - * @memberof ibc.applications.transfer.v1.QueryDenomTracesResponse - * @static - * @param {ibc.applications.transfer.v1.IQueryDenomTracesResponse} message QueryDenomTracesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDenomTracesResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.denom_traces != null && message.denom_traces.length) - for (let i = 0; i < message.denom_traces.length; ++i) - $root.ibc.applications.transfer.v1.DenomTrace.encode(message.denom_traces[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryDenomTracesResponse message, length delimited. Does not implicitly {@link ibc.applications.transfer.v1.QueryDenomTracesResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.applications.transfer.v1.QueryDenomTracesResponse - * @static - * @param {ibc.applications.transfer.v1.IQueryDenomTracesResponse} message QueryDenomTracesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryDenomTracesResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryDenomTracesResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.applications.transfer.v1.QueryDenomTracesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.applications.transfer.v1.QueryDenomTracesResponse} QueryDenomTracesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDenomTracesResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.applications.transfer.v1.QueryDenomTracesResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.denom_traces && message.denom_traces.length)) - message.denom_traces = []; - message.denom_traces.push($root.ibc.applications.transfer.v1.DenomTrace.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryDenomTracesResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.applications.transfer.v1.QueryDenomTracesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.applications.transfer.v1.QueryDenomTracesResponse} QueryDenomTracesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryDenomTracesResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryDenomTracesResponse message. - * @function verify - * @memberof ibc.applications.transfer.v1.QueryDenomTracesResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryDenomTracesResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.denom_traces != null && message.hasOwnProperty("denom_traces")) { - if (!Array.isArray(message.denom_traces)) - return "denom_traces: array expected"; - for (let i = 0; i < message.denom_traces.length; ++i) { - let error = $root.ibc.applications.transfer.v1.DenomTrace.verify(message.denom_traces[i]); - if (error) - return "denom_traces." + error; - } - } - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryDenomTracesResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.applications.transfer.v1.QueryDenomTracesResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.applications.transfer.v1.QueryDenomTracesResponse} QueryDenomTracesResponse - */ - QueryDenomTracesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.applications.transfer.v1.QueryDenomTracesResponse) - return object; - let message = new $root.ibc.applications.transfer.v1.QueryDenomTracesResponse(); - if (object.denom_traces) { - if (!Array.isArray(object.denom_traces)) - throw TypeError(".ibc.applications.transfer.v1.QueryDenomTracesResponse.denom_traces: array expected"); - message.denom_traces = []; - for (let i = 0; i < object.denom_traces.length; ++i) { - if (typeof object.denom_traces[i] !== "object") - throw TypeError(".ibc.applications.transfer.v1.QueryDenomTracesResponse.denom_traces: object expected"); - message.denom_traces[i] = $root.ibc.applications.transfer.v1.DenomTrace.fromObject(object.denom_traces[i]); - } - } - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".ibc.applications.transfer.v1.QueryDenomTracesResponse.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryDenomTracesResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.applications.transfer.v1.QueryDenomTracesResponse - * @static - * @param {ibc.applications.transfer.v1.QueryDenomTracesResponse} message QueryDenomTracesResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryDenomTracesResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.denom_traces = []; - if (options.defaults) - object.pagination = null; - if (message.denom_traces && message.denom_traces.length) { - object.denom_traces = []; - for (let j = 0; j < message.denom_traces.length; ++j) - object.denom_traces[j] = $root.ibc.applications.transfer.v1.DenomTrace.toObject(message.denom_traces[j], options); - } - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryDenomTracesResponse to JSON. - * @function toJSON - * @memberof ibc.applications.transfer.v1.QueryDenomTracesResponse - * @instance - * @returns {Object.} JSON object - */ - QueryDenomTracesResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryDenomTracesResponse; - })(); - - v1.QueryParamsRequest = (function() { - - /** - * Properties of a QueryParamsRequest. - * @memberof ibc.applications.transfer.v1 - * @interface IQueryParamsRequest - */ - - /** - * Constructs a new QueryParamsRequest. - * @memberof ibc.applications.transfer.v1 - * @classdesc Represents a QueryParamsRequest. - * @implements IQueryParamsRequest - * @constructor - * @param {ibc.applications.transfer.v1.IQueryParamsRequest=} [properties] Properties to set - */ - function QueryParamsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified QueryParamsRequest message. Does not implicitly {@link ibc.applications.transfer.v1.QueryParamsRequest.verify|verify} messages. - * @function encode - * @memberof ibc.applications.transfer.v1.QueryParamsRequest - * @static - * @param {ibc.applications.transfer.v1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified QueryParamsRequest message, length delimited. Does not implicitly {@link ibc.applications.transfer.v1.QueryParamsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.applications.transfer.v1.QueryParamsRequest - * @static - * @param {ibc.applications.transfer.v1.IQueryParamsRequest} message QueryParamsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryParamsRequest message from the specified reader or buffer. - * @function decode - * @memberof ibc.applications.transfer.v1.QueryParamsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.applications.transfer.v1.QueryParamsRequest} QueryParamsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.applications.transfer.v1.QueryParamsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryParamsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.applications.transfer.v1.QueryParamsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.applications.transfer.v1.QueryParamsRequest} QueryParamsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryParamsRequest message. - * @function verify - * @memberof ibc.applications.transfer.v1.QueryParamsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryParamsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a QueryParamsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.applications.transfer.v1.QueryParamsRequest - * @static - * @param {Object.} object Plain object - * @returns {ibc.applications.transfer.v1.QueryParamsRequest} QueryParamsRequest - */ - QueryParamsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.applications.transfer.v1.QueryParamsRequest) - return object; - return new $root.ibc.applications.transfer.v1.QueryParamsRequest(); - }; - - /** - * Creates a plain object from a QueryParamsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.applications.transfer.v1.QueryParamsRequest - * @static - * @param {ibc.applications.transfer.v1.QueryParamsRequest} message QueryParamsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryParamsRequest.toObject = function toObject() { - return {}; - }; - - /** - * Converts this QueryParamsRequest to JSON. - * @function toJSON - * @memberof ibc.applications.transfer.v1.QueryParamsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryParamsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryParamsRequest; - })(); - - v1.QueryParamsResponse = (function() { - - /** - * Properties of a QueryParamsResponse. - * @memberof ibc.applications.transfer.v1 - * @interface IQueryParamsResponse - * @property {ibc.applications.transfer.v1.IParams|null} [params] QueryParamsResponse params - */ - - /** - * Constructs a new QueryParamsResponse. - * @memberof ibc.applications.transfer.v1 - * @classdesc Represents a QueryParamsResponse. - * @implements IQueryParamsResponse - * @constructor - * @param {ibc.applications.transfer.v1.IQueryParamsResponse=} [properties] Properties to set - */ - function QueryParamsResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryParamsResponse params. - * @member {ibc.applications.transfer.v1.IParams|null|undefined} params - * @memberof ibc.applications.transfer.v1.QueryParamsResponse - * @instance - */ - QueryParamsResponse.prototype.params = null; - - /** - * Encodes the specified QueryParamsResponse message. Does not implicitly {@link ibc.applications.transfer.v1.QueryParamsResponse.verify|verify} messages. - * @function encode - * @memberof ibc.applications.transfer.v1.QueryParamsResponse - * @static - * @param {ibc.applications.transfer.v1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.params != null && Object.hasOwnProperty.call(message, "params")) - $root.ibc.applications.transfer.v1.Params.encode(message.params, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryParamsResponse message, length delimited. Does not implicitly {@link ibc.applications.transfer.v1.QueryParamsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.applications.transfer.v1.QueryParamsResponse - * @static - * @param {ibc.applications.transfer.v1.IQueryParamsResponse} message QueryParamsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryParamsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryParamsResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.applications.transfer.v1.QueryParamsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.applications.transfer.v1.QueryParamsResponse} QueryParamsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.applications.transfer.v1.QueryParamsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.params = $root.ibc.applications.transfer.v1.Params.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryParamsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.applications.transfer.v1.QueryParamsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.applications.transfer.v1.QueryParamsResponse} QueryParamsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryParamsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryParamsResponse message. - * @function verify - * @memberof ibc.applications.transfer.v1.QueryParamsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryParamsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.params != null && message.hasOwnProperty("params")) { - let error = $root.ibc.applications.transfer.v1.Params.verify(message.params); - if (error) - return "params." + error; - } - return null; - }; - - /** - * Creates a QueryParamsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.applications.transfer.v1.QueryParamsResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.applications.transfer.v1.QueryParamsResponse} QueryParamsResponse - */ - QueryParamsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.applications.transfer.v1.QueryParamsResponse) - return object; - let message = new $root.ibc.applications.transfer.v1.QueryParamsResponse(); - if (object.params != null) { - if (typeof object.params !== "object") - throw TypeError(".ibc.applications.transfer.v1.QueryParamsResponse.params: object expected"); - message.params = $root.ibc.applications.transfer.v1.Params.fromObject(object.params); - } - return message; - }; - - /** - * Creates a plain object from a QueryParamsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.applications.transfer.v1.QueryParamsResponse - * @static - * @param {ibc.applications.transfer.v1.QueryParamsResponse} message QueryParamsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryParamsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.params = null; - if (message.params != null && message.hasOwnProperty("params")) - object.params = $root.ibc.applications.transfer.v1.Params.toObject(message.params, options); - return object; - }; - - /** - * Converts this QueryParamsResponse to JSON. - * @function toJSON - * @memberof ibc.applications.transfer.v1.QueryParamsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryParamsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryParamsResponse; - })(); - - v1.GenesisState = (function() { - - /** - * Properties of a GenesisState. - * @memberof ibc.applications.transfer.v1 - * @interface IGenesisState - * @property {string|null} [port_id] GenesisState port_id - * @property {Array.|null} [denom_traces] GenesisState denom_traces - * @property {ibc.applications.transfer.v1.IParams|null} [params] GenesisState params - */ - - /** - * Constructs a new GenesisState. - * @memberof ibc.applications.transfer.v1 - * @classdesc Represents a GenesisState. - * @implements IGenesisState - * @constructor - * @param {ibc.applications.transfer.v1.IGenesisState=} [properties] Properties to set - */ - function GenesisState(properties) { - this.denom_traces = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GenesisState port_id. - * @member {string} port_id - * @memberof ibc.applications.transfer.v1.GenesisState - * @instance - */ - GenesisState.prototype.port_id = ""; - - /** - * GenesisState denom_traces. - * @member {Array.} denom_traces - * @memberof ibc.applications.transfer.v1.GenesisState - * @instance - */ - GenesisState.prototype.denom_traces = $util.emptyArray; - - /** - * GenesisState params. - * @member {ibc.applications.transfer.v1.IParams|null|undefined} params - * @memberof ibc.applications.transfer.v1.GenesisState - * @instance - */ - GenesisState.prototype.params = null; - - /** - * Encodes the specified GenesisState message. Does not implicitly {@link ibc.applications.transfer.v1.GenesisState.verify|verify} messages. - * @function encode - * @memberof ibc.applications.transfer.v1.GenesisState - * @static - * @param {ibc.applications.transfer.v1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); - if (message.denom_traces != null && message.denom_traces.length) - for (let i = 0; i < message.denom_traces.length; ++i) - $root.ibc.applications.transfer.v1.DenomTrace.encode(message.denom_traces[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.params != null && Object.hasOwnProperty.call(message, "params")) - $root.ibc.applications.transfer.v1.Params.encode(message.params, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link ibc.applications.transfer.v1.GenesisState.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.applications.transfer.v1.GenesisState - * @static - * @param {ibc.applications.transfer.v1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer. - * @function decode - * @memberof ibc.applications.transfer.v1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.applications.transfer.v1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.applications.transfer.v1.GenesisState(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.port_id = reader.string(); - break; - case 2: - if (!(message.denom_traces && message.denom_traces.length)) - message.denom_traces = []; - message.denom_traces.push($root.ibc.applications.transfer.v1.DenomTrace.decode(reader, reader.uint32())); - break; - case 3: - message.params = $root.ibc.applications.transfer.v1.Params.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.applications.transfer.v1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.applications.transfer.v1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GenesisState message. - * @function verify - * @memberof ibc.applications.transfer.v1.GenesisState - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GenesisState.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.port_id != null && message.hasOwnProperty("port_id")) - if (!$util.isString(message.port_id)) - return "port_id: string expected"; - if (message.denom_traces != null && message.hasOwnProperty("denom_traces")) { - if (!Array.isArray(message.denom_traces)) - return "denom_traces: array expected"; - for (let i = 0; i < message.denom_traces.length; ++i) { - let error = $root.ibc.applications.transfer.v1.DenomTrace.verify(message.denom_traces[i]); - if (error) - return "denom_traces." + error; - } - } - if (message.params != null && message.hasOwnProperty("params")) { - let error = $root.ibc.applications.transfer.v1.Params.verify(message.params); - if (error) - return "params." + error; - } - return null; - }; - - /** - * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.applications.transfer.v1.GenesisState - * @static - * @param {Object.} object Plain object - * @returns {ibc.applications.transfer.v1.GenesisState} GenesisState - */ - GenesisState.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.applications.transfer.v1.GenesisState) - return object; - let message = new $root.ibc.applications.transfer.v1.GenesisState(); - if (object.port_id != null) - message.port_id = String(object.port_id); - if (object.denom_traces) { - if (!Array.isArray(object.denom_traces)) - throw TypeError(".ibc.applications.transfer.v1.GenesisState.denom_traces: array expected"); - message.denom_traces = []; - for (let i = 0; i < object.denom_traces.length; ++i) { - if (typeof object.denom_traces[i] !== "object") - throw TypeError(".ibc.applications.transfer.v1.GenesisState.denom_traces: object expected"); - message.denom_traces[i] = $root.ibc.applications.transfer.v1.DenomTrace.fromObject(object.denom_traces[i]); - } - } - if (object.params != null) { - if (typeof object.params !== "object") - throw TypeError(".ibc.applications.transfer.v1.GenesisState.params: object expected"); - message.params = $root.ibc.applications.transfer.v1.Params.fromObject(object.params); - } - return message; - }; - - /** - * Creates a plain object from a GenesisState message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.applications.transfer.v1.GenesisState - * @static - * @param {ibc.applications.transfer.v1.GenesisState} message GenesisState - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GenesisState.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.denom_traces = []; - if (options.defaults) { - object.port_id = ""; - object.params = null; - } - if (message.port_id != null && message.hasOwnProperty("port_id")) - object.port_id = message.port_id; - if (message.denom_traces && message.denom_traces.length) { - object.denom_traces = []; - for (let j = 0; j < message.denom_traces.length; ++j) - object.denom_traces[j] = $root.ibc.applications.transfer.v1.DenomTrace.toObject(message.denom_traces[j], options); - } - if (message.params != null && message.hasOwnProperty("params")) - object.params = $root.ibc.applications.transfer.v1.Params.toObject(message.params, options); - return object; - }; - - /** - * Converts this GenesisState to JSON. - * @function toJSON - * @memberof ibc.applications.transfer.v1.GenesisState - * @instance - * @returns {Object.} JSON object - */ - GenesisState.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GenesisState; - })(); - - return v1; - })(); - - return transfer; - })(); - - return applications; - })(); - - ibc.core = (function() { - - /** - * Namespace core. - * @memberof ibc - * @namespace - */ - const core = {}; - - core.channel = (function() { - - /** - * Namespace channel. - * @memberof ibc.core - * @namespace - */ - const channel = {}; - - channel.v1 = (function() { - - /** - * Namespace v1. - * @memberof ibc.core.channel - * @namespace - */ - const v1 = {}; - - v1.Msg = (function() { - - /** - * Constructs a new Msg service. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a Msg - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function Msg(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Msg.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Msg; - - /** - * Callback as used by {@link ibc.core.channel.v1.Msg#channelOpenInit}. - * @memberof ibc.core.channel.v1.Msg - * @typedef ChannelOpenInitCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.channel.v1.MsgChannelOpenInitResponse} [response] MsgChannelOpenInitResponse - */ - - /** - * Calls ChannelOpenInit. - * @function channelOpenInit - * @memberof ibc.core.channel.v1.Msg - * @instance - * @param {ibc.core.channel.v1.IMsgChannelOpenInit} request MsgChannelOpenInit message or plain object - * @param {ibc.core.channel.v1.Msg.ChannelOpenInitCallback} callback Node-style callback called with the error, if any, and MsgChannelOpenInitResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.channelOpenInit = function channelOpenInit(request, callback) { - return this.rpcCall(channelOpenInit, $root.ibc.core.channel.v1.MsgChannelOpenInit, $root.ibc.core.channel.v1.MsgChannelOpenInitResponse, request, callback); - }, "name", { value: "ChannelOpenInit" }); - - /** - * Calls ChannelOpenInit. - * @function channelOpenInit - * @memberof ibc.core.channel.v1.Msg - * @instance - * @param {ibc.core.channel.v1.IMsgChannelOpenInit} request MsgChannelOpenInit message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.channel.v1.Msg#channelOpenTry}. - * @memberof ibc.core.channel.v1.Msg - * @typedef ChannelOpenTryCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.channel.v1.MsgChannelOpenTryResponse} [response] MsgChannelOpenTryResponse - */ - - /** - * Calls ChannelOpenTry. - * @function channelOpenTry - * @memberof ibc.core.channel.v1.Msg - * @instance - * @param {ibc.core.channel.v1.IMsgChannelOpenTry} request MsgChannelOpenTry message or plain object - * @param {ibc.core.channel.v1.Msg.ChannelOpenTryCallback} callback Node-style callback called with the error, if any, and MsgChannelOpenTryResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.channelOpenTry = function channelOpenTry(request, callback) { - return this.rpcCall(channelOpenTry, $root.ibc.core.channel.v1.MsgChannelOpenTry, $root.ibc.core.channel.v1.MsgChannelOpenTryResponse, request, callback); - }, "name", { value: "ChannelOpenTry" }); - - /** - * Calls ChannelOpenTry. - * @function channelOpenTry - * @memberof ibc.core.channel.v1.Msg - * @instance - * @param {ibc.core.channel.v1.IMsgChannelOpenTry} request MsgChannelOpenTry message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.channel.v1.Msg#channelOpenAck}. - * @memberof ibc.core.channel.v1.Msg - * @typedef ChannelOpenAckCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.channel.v1.MsgChannelOpenAckResponse} [response] MsgChannelOpenAckResponse - */ - - /** - * Calls ChannelOpenAck. - * @function channelOpenAck - * @memberof ibc.core.channel.v1.Msg - * @instance - * @param {ibc.core.channel.v1.IMsgChannelOpenAck} request MsgChannelOpenAck message or plain object - * @param {ibc.core.channel.v1.Msg.ChannelOpenAckCallback} callback Node-style callback called with the error, if any, and MsgChannelOpenAckResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.channelOpenAck = function channelOpenAck(request, callback) { - return this.rpcCall(channelOpenAck, $root.ibc.core.channel.v1.MsgChannelOpenAck, $root.ibc.core.channel.v1.MsgChannelOpenAckResponse, request, callback); - }, "name", { value: "ChannelOpenAck" }); - - /** - * Calls ChannelOpenAck. - * @function channelOpenAck - * @memberof ibc.core.channel.v1.Msg - * @instance - * @param {ibc.core.channel.v1.IMsgChannelOpenAck} request MsgChannelOpenAck message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.channel.v1.Msg#channelOpenConfirm}. - * @memberof ibc.core.channel.v1.Msg - * @typedef ChannelOpenConfirmCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.channel.v1.MsgChannelOpenConfirmResponse} [response] MsgChannelOpenConfirmResponse - */ - - /** - * Calls ChannelOpenConfirm. - * @function channelOpenConfirm - * @memberof ibc.core.channel.v1.Msg - * @instance - * @param {ibc.core.channel.v1.IMsgChannelOpenConfirm} request MsgChannelOpenConfirm message or plain object - * @param {ibc.core.channel.v1.Msg.ChannelOpenConfirmCallback} callback Node-style callback called with the error, if any, and MsgChannelOpenConfirmResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.channelOpenConfirm = function channelOpenConfirm(request, callback) { - return this.rpcCall(channelOpenConfirm, $root.ibc.core.channel.v1.MsgChannelOpenConfirm, $root.ibc.core.channel.v1.MsgChannelOpenConfirmResponse, request, callback); - }, "name", { value: "ChannelOpenConfirm" }); - - /** - * Calls ChannelOpenConfirm. - * @function channelOpenConfirm - * @memberof ibc.core.channel.v1.Msg - * @instance - * @param {ibc.core.channel.v1.IMsgChannelOpenConfirm} request MsgChannelOpenConfirm message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.channel.v1.Msg#channelCloseInit}. - * @memberof ibc.core.channel.v1.Msg - * @typedef ChannelCloseInitCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.channel.v1.MsgChannelCloseInitResponse} [response] MsgChannelCloseInitResponse - */ - - /** - * Calls ChannelCloseInit. - * @function channelCloseInit - * @memberof ibc.core.channel.v1.Msg - * @instance - * @param {ibc.core.channel.v1.IMsgChannelCloseInit} request MsgChannelCloseInit message or plain object - * @param {ibc.core.channel.v1.Msg.ChannelCloseInitCallback} callback Node-style callback called with the error, if any, and MsgChannelCloseInitResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.channelCloseInit = function channelCloseInit(request, callback) { - return this.rpcCall(channelCloseInit, $root.ibc.core.channel.v1.MsgChannelCloseInit, $root.ibc.core.channel.v1.MsgChannelCloseInitResponse, request, callback); - }, "name", { value: "ChannelCloseInit" }); - - /** - * Calls ChannelCloseInit. - * @function channelCloseInit - * @memberof ibc.core.channel.v1.Msg - * @instance - * @param {ibc.core.channel.v1.IMsgChannelCloseInit} request MsgChannelCloseInit message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.channel.v1.Msg#channelCloseConfirm}. - * @memberof ibc.core.channel.v1.Msg - * @typedef ChannelCloseConfirmCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.channel.v1.MsgChannelCloseConfirmResponse} [response] MsgChannelCloseConfirmResponse - */ - - /** - * Calls ChannelCloseConfirm. - * @function channelCloseConfirm - * @memberof ibc.core.channel.v1.Msg - * @instance - * @param {ibc.core.channel.v1.IMsgChannelCloseConfirm} request MsgChannelCloseConfirm message or plain object - * @param {ibc.core.channel.v1.Msg.ChannelCloseConfirmCallback} callback Node-style callback called with the error, if any, and MsgChannelCloseConfirmResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.channelCloseConfirm = function channelCloseConfirm(request, callback) { - return this.rpcCall(channelCloseConfirm, $root.ibc.core.channel.v1.MsgChannelCloseConfirm, $root.ibc.core.channel.v1.MsgChannelCloseConfirmResponse, request, callback); - }, "name", { value: "ChannelCloseConfirm" }); - - /** - * Calls ChannelCloseConfirm. - * @function channelCloseConfirm - * @memberof ibc.core.channel.v1.Msg - * @instance - * @param {ibc.core.channel.v1.IMsgChannelCloseConfirm} request MsgChannelCloseConfirm message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.channel.v1.Msg#recvPacket}. - * @memberof ibc.core.channel.v1.Msg - * @typedef RecvPacketCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.channel.v1.MsgRecvPacketResponse} [response] MsgRecvPacketResponse - */ - - /** - * Calls RecvPacket. - * @function recvPacket - * @memberof ibc.core.channel.v1.Msg - * @instance - * @param {ibc.core.channel.v1.IMsgRecvPacket} request MsgRecvPacket message or plain object - * @param {ibc.core.channel.v1.Msg.RecvPacketCallback} callback Node-style callback called with the error, if any, and MsgRecvPacketResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.recvPacket = function recvPacket(request, callback) { - return this.rpcCall(recvPacket, $root.ibc.core.channel.v1.MsgRecvPacket, $root.ibc.core.channel.v1.MsgRecvPacketResponse, request, callback); - }, "name", { value: "RecvPacket" }); - - /** - * Calls RecvPacket. - * @function recvPacket - * @memberof ibc.core.channel.v1.Msg - * @instance - * @param {ibc.core.channel.v1.IMsgRecvPacket} request MsgRecvPacket message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.channel.v1.Msg#timeout}. - * @memberof ibc.core.channel.v1.Msg - * @typedef TimeoutCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.channel.v1.MsgTimeoutResponse} [response] MsgTimeoutResponse - */ - - /** - * Calls Timeout. - * @function timeout - * @memberof ibc.core.channel.v1.Msg - * @instance - * @param {ibc.core.channel.v1.IMsgTimeout} request MsgTimeout message or plain object - * @param {ibc.core.channel.v1.Msg.TimeoutCallback} callback Node-style callback called with the error, if any, and MsgTimeoutResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.timeout = function timeout(request, callback) { - return this.rpcCall(timeout, $root.ibc.core.channel.v1.MsgTimeout, $root.ibc.core.channel.v1.MsgTimeoutResponse, request, callback); - }, "name", { value: "Timeout" }); - - /** - * Calls Timeout. - * @function timeout - * @memberof ibc.core.channel.v1.Msg - * @instance - * @param {ibc.core.channel.v1.IMsgTimeout} request MsgTimeout message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.channel.v1.Msg#timeoutOnClose}. - * @memberof ibc.core.channel.v1.Msg - * @typedef TimeoutOnCloseCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.channel.v1.MsgTimeoutOnCloseResponse} [response] MsgTimeoutOnCloseResponse - */ - - /** - * Calls TimeoutOnClose. - * @function timeoutOnClose - * @memberof ibc.core.channel.v1.Msg - * @instance - * @param {ibc.core.channel.v1.IMsgTimeoutOnClose} request MsgTimeoutOnClose message or plain object - * @param {ibc.core.channel.v1.Msg.TimeoutOnCloseCallback} callback Node-style callback called with the error, if any, and MsgTimeoutOnCloseResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.timeoutOnClose = function timeoutOnClose(request, callback) { - return this.rpcCall(timeoutOnClose, $root.ibc.core.channel.v1.MsgTimeoutOnClose, $root.ibc.core.channel.v1.MsgTimeoutOnCloseResponse, request, callback); - }, "name", { value: "TimeoutOnClose" }); - - /** - * Calls TimeoutOnClose. - * @function timeoutOnClose - * @memberof ibc.core.channel.v1.Msg - * @instance - * @param {ibc.core.channel.v1.IMsgTimeoutOnClose} request MsgTimeoutOnClose message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.channel.v1.Msg#acknowledgement}. - * @memberof ibc.core.channel.v1.Msg - * @typedef AcknowledgementCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.channel.v1.MsgAcknowledgementResponse} [response] MsgAcknowledgementResponse - */ - - /** - * Calls Acknowledgement. - * @function acknowledgement - * @memberof ibc.core.channel.v1.Msg - * @instance - * @param {ibc.core.channel.v1.IMsgAcknowledgement} request MsgAcknowledgement message or plain object - * @param {ibc.core.channel.v1.Msg.AcknowledgementCallback} callback Node-style callback called with the error, if any, and MsgAcknowledgementResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.acknowledgement = function acknowledgement(request, callback) { - return this.rpcCall(acknowledgement, $root.ibc.core.channel.v1.MsgAcknowledgement, $root.ibc.core.channel.v1.MsgAcknowledgementResponse, request, callback); - }, "name", { value: "Acknowledgement" }); - - /** - * Calls Acknowledgement. - * @function acknowledgement - * @memberof ibc.core.channel.v1.Msg - * @instance - * @param {ibc.core.channel.v1.IMsgAcknowledgement} request MsgAcknowledgement message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return Msg; - })(); - - v1.MsgChannelOpenInit = (function() { - - /** - * Properties of a MsgChannelOpenInit. - * @memberof ibc.core.channel.v1 - * @interface IMsgChannelOpenInit - * @property {string|null} [port_id] MsgChannelOpenInit port_id - * @property {ibc.core.channel.v1.IChannel|null} [channel] MsgChannelOpenInit channel - * @property {string|null} [signer] MsgChannelOpenInit signer - */ - - /** - * Constructs a new MsgChannelOpenInit. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a MsgChannelOpenInit. - * @implements IMsgChannelOpenInit - * @constructor - * @param {ibc.core.channel.v1.IMsgChannelOpenInit=} [properties] Properties to set - */ - function MsgChannelOpenInit(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgChannelOpenInit port_id. - * @member {string} port_id - * @memberof ibc.core.channel.v1.MsgChannelOpenInit - * @instance - */ - MsgChannelOpenInit.prototype.port_id = ""; - - /** - * MsgChannelOpenInit channel. - * @member {ibc.core.channel.v1.IChannel|null|undefined} channel - * @memberof ibc.core.channel.v1.MsgChannelOpenInit - * @instance - */ - MsgChannelOpenInit.prototype.channel = null; - - /** - * MsgChannelOpenInit signer. - * @member {string} signer - * @memberof ibc.core.channel.v1.MsgChannelOpenInit - * @instance - */ - MsgChannelOpenInit.prototype.signer = ""; - - /** - * Encodes the specified MsgChannelOpenInit message. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenInit.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.MsgChannelOpenInit - * @static - * @param {ibc.core.channel.v1.IMsgChannelOpenInit} message MsgChannelOpenInit message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgChannelOpenInit.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); - if (message.channel != null && Object.hasOwnProperty.call(message, "channel")) - $root.ibc.core.channel.v1.Channel.encode(message.channel, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.signer); - return writer; - }; - - /** - * Encodes the specified MsgChannelOpenInit message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenInit.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.MsgChannelOpenInit - * @static - * @param {ibc.core.channel.v1.IMsgChannelOpenInit} message MsgChannelOpenInit message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgChannelOpenInit.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgChannelOpenInit message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.MsgChannelOpenInit - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.MsgChannelOpenInit} MsgChannelOpenInit - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgChannelOpenInit.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgChannelOpenInit(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.port_id = reader.string(); - break; - case 2: - message.channel = $root.ibc.core.channel.v1.Channel.decode(reader, reader.uint32()); - break; - case 3: - message.signer = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgChannelOpenInit message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.MsgChannelOpenInit - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.MsgChannelOpenInit} MsgChannelOpenInit - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgChannelOpenInit.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgChannelOpenInit message. - * @function verify - * @memberof ibc.core.channel.v1.MsgChannelOpenInit - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgChannelOpenInit.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.port_id != null && message.hasOwnProperty("port_id")) - if (!$util.isString(message.port_id)) - return "port_id: string expected"; - if (message.channel != null && message.hasOwnProperty("channel")) { - let error = $root.ibc.core.channel.v1.Channel.verify(message.channel); - if (error) - return "channel." + error; - } - if (message.signer != null && message.hasOwnProperty("signer")) - if (!$util.isString(message.signer)) - return "signer: string expected"; - return null; - }; - - /** - * Creates a MsgChannelOpenInit message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.MsgChannelOpenInit - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.MsgChannelOpenInit} MsgChannelOpenInit - */ - MsgChannelOpenInit.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.MsgChannelOpenInit) - return object; - let message = new $root.ibc.core.channel.v1.MsgChannelOpenInit(); - if (object.port_id != null) - message.port_id = String(object.port_id); - if (object.channel != null) { - if (typeof object.channel !== "object") - throw TypeError(".ibc.core.channel.v1.MsgChannelOpenInit.channel: object expected"); - message.channel = $root.ibc.core.channel.v1.Channel.fromObject(object.channel); - } - if (object.signer != null) - message.signer = String(object.signer); - return message; - }; - - /** - * Creates a plain object from a MsgChannelOpenInit message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.MsgChannelOpenInit - * @static - * @param {ibc.core.channel.v1.MsgChannelOpenInit} message MsgChannelOpenInit - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgChannelOpenInit.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.port_id = ""; - object.channel = null; - object.signer = ""; - } - if (message.port_id != null && message.hasOwnProperty("port_id")) - object.port_id = message.port_id; - if (message.channel != null && message.hasOwnProperty("channel")) - object.channel = $root.ibc.core.channel.v1.Channel.toObject(message.channel, options); - if (message.signer != null && message.hasOwnProperty("signer")) - object.signer = message.signer; - return object; - }; - - /** - * Converts this MsgChannelOpenInit to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.MsgChannelOpenInit - * @instance - * @returns {Object.} JSON object - */ - MsgChannelOpenInit.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgChannelOpenInit; - })(); - - v1.MsgChannelOpenInitResponse = (function() { - - /** - * Properties of a MsgChannelOpenInitResponse. - * @memberof ibc.core.channel.v1 - * @interface IMsgChannelOpenInitResponse - */ - - /** - * Constructs a new MsgChannelOpenInitResponse. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a MsgChannelOpenInitResponse. - * @implements IMsgChannelOpenInitResponse - * @constructor - * @param {ibc.core.channel.v1.IMsgChannelOpenInitResponse=} [properties] Properties to set - */ - function MsgChannelOpenInitResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgChannelOpenInitResponse message. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenInitResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.MsgChannelOpenInitResponse - * @static - * @param {ibc.core.channel.v1.IMsgChannelOpenInitResponse} message MsgChannelOpenInitResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgChannelOpenInitResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgChannelOpenInitResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenInitResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.MsgChannelOpenInitResponse - * @static - * @param {ibc.core.channel.v1.IMsgChannelOpenInitResponse} message MsgChannelOpenInitResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgChannelOpenInitResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgChannelOpenInitResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.MsgChannelOpenInitResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.MsgChannelOpenInitResponse} MsgChannelOpenInitResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgChannelOpenInitResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgChannelOpenInitResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgChannelOpenInitResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.MsgChannelOpenInitResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.MsgChannelOpenInitResponse} MsgChannelOpenInitResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgChannelOpenInitResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgChannelOpenInitResponse message. - * @function verify - * @memberof ibc.core.channel.v1.MsgChannelOpenInitResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgChannelOpenInitResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgChannelOpenInitResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.MsgChannelOpenInitResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.MsgChannelOpenInitResponse} MsgChannelOpenInitResponse - */ - MsgChannelOpenInitResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.MsgChannelOpenInitResponse) - return object; - return new $root.ibc.core.channel.v1.MsgChannelOpenInitResponse(); - }; - - /** - * Creates a plain object from a MsgChannelOpenInitResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.MsgChannelOpenInitResponse - * @static - * @param {ibc.core.channel.v1.MsgChannelOpenInitResponse} message MsgChannelOpenInitResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgChannelOpenInitResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgChannelOpenInitResponse to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.MsgChannelOpenInitResponse - * @instance - * @returns {Object.} JSON object - */ - MsgChannelOpenInitResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgChannelOpenInitResponse; - })(); - - v1.MsgChannelOpenTry = (function() { - - /** - * Properties of a MsgChannelOpenTry. - * @memberof ibc.core.channel.v1 - * @interface IMsgChannelOpenTry - * @property {string|null} [port_id] MsgChannelOpenTry port_id - * @property {string|null} [previous_channel_id] MsgChannelOpenTry previous_channel_id - * @property {ibc.core.channel.v1.IChannel|null} [channel] MsgChannelOpenTry channel - * @property {string|null} [counterparty_version] MsgChannelOpenTry counterparty_version - * @property {Uint8Array|null} [proof_init] MsgChannelOpenTry proof_init - * @property {ibc.core.client.v1.IHeight|null} [proof_height] MsgChannelOpenTry proof_height - * @property {string|null} [signer] MsgChannelOpenTry signer - */ - - /** - * Constructs a new MsgChannelOpenTry. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a MsgChannelOpenTry. - * @implements IMsgChannelOpenTry - * @constructor - * @param {ibc.core.channel.v1.IMsgChannelOpenTry=} [properties] Properties to set - */ - function MsgChannelOpenTry(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgChannelOpenTry port_id. - * @member {string} port_id - * @memberof ibc.core.channel.v1.MsgChannelOpenTry - * @instance - */ - MsgChannelOpenTry.prototype.port_id = ""; - - /** - * MsgChannelOpenTry previous_channel_id. - * @member {string} previous_channel_id - * @memberof ibc.core.channel.v1.MsgChannelOpenTry - * @instance - */ - MsgChannelOpenTry.prototype.previous_channel_id = ""; - - /** - * MsgChannelOpenTry channel. - * @member {ibc.core.channel.v1.IChannel|null|undefined} channel - * @memberof ibc.core.channel.v1.MsgChannelOpenTry - * @instance - */ - MsgChannelOpenTry.prototype.channel = null; - - /** - * MsgChannelOpenTry counterparty_version. - * @member {string} counterparty_version - * @memberof ibc.core.channel.v1.MsgChannelOpenTry - * @instance - */ - MsgChannelOpenTry.prototype.counterparty_version = ""; - - /** - * MsgChannelOpenTry proof_init. - * @member {Uint8Array} proof_init - * @memberof ibc.core.channel.v1.MsgChannelOpenTry - * @instance - */ - MsgChannelOpenTry.prototype.proof_init = $util.newBuffer([]); - - /** - * MsgChannelOpenTry proof_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height - * @memberof ibc.core.channel.v1.MsgChannelOpenTry - * @instance - */ - MsgChannelOpenTry.prototype.proof_height = null; - - /** - * MsgChannelOpenTry signer. - * @member {string} signer - * @memberof ibc.core.channel.v1.MsgChannelOpenTry - * @instance - */ - MsgChannelOpenTry.prototype.signer = ""; - - /** - * Encodes the specified MsgChannelOpenTry message. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenTry.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.MsgChannelOpenTry - * @static - * @param {ibc.core.channel.v1.IMsgChannelOpenTry} message MsgChannelOpenTry message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgChannelOpenTry.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); - if (message.previous_channel_id != null && Object.hasOwnProperty.call(message, "previous_channel_id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.previous_channel_id); - if (message.channel != null && Object.hasOwnProperty.call(message, "channel")) - $root.ibc.core.channel.v1.Channel.encode(message.channel, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.counterparty_version != null && Object.hasOwnProperty.call(message, "counterparty_version")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.counterparty_version); - if (message.proof_init != null && Object.hasOwnProperty.call(message, "proof_init")) - writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.proof_init); - if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) - $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.signer); - return writer; - }; - - /** - * Encodes the specified MsgChannelOpenTry message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenTry.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.MsgChannelOpenTry - * @static - * @param {ibc.core.channel.v1.IMsgChannelOpenTry} message MsgChannelOpenTry message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgChannelOpenTry.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgChannelOpenTry message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.MsgChannelOpenTry - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.MsgChannelOpenTry} MsgChannelOpenTry - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgChannelOpenTry.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgChannelOpenTry(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.port_id = reader.string(); - break; - case 2: - message.previous_channel_id = reader.string(); - break; - case 3: - message.channel = $root.ibc.core.channel.v1.Channel.decode(reader, reader.uint32()); - break; - case 4: - message.counterparty_version = reader.string(); - break; - case 5: - message.proof_init = reader.bytes(); - break; - case 6: - message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - case 7: - message.signer = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgChannelOpenTry message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.MsgChannelOpenTry - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.MsgChannelOpenTry} MsgChannelOpenTry - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgChannelOpenTry.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgChannelOpenTry message. - * @function verify - * @memberof ibc.core.channel.v1.MsgChannelOpenTry - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgChannelOpenTry.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.port_id != null && message.hasOwnProperty("port_id")) - if (!$util.isString(message.port_id)) - return "port_id: string expected"; - if (message.previous_channel_id != null && message.hasOwnProperty("previous_channel_id")) - if (!$util.isString(message.previous_channel_id)) - return "previous_channel_id: string expected"; - if (message.channel != null && message.hasOwnProperty("channel")) { - let error = $root.ibc.core.channel.v1.Channel.verify(message.channel); - if (error) - return "channel." + error; - } - if (message.counterparty_version != null && message.hasOwnProperty("counterparty_version")) - if (!$util.isString(message.counterparty_version)) - return "counterparty_version: string expected"; - if (message.proof_init != null && message.hasOwnProperty("proof_init")) - if (!(message.proof_init && typeof message.proof_init.length === "number" || $util.isString(message.proof_init))) - return "proof_init: buffer expected"; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); - if (error) - return "proof_height." + error; - } - if (message.signer != null && message.hasOwnProperty("signer")) - if (!$util.isString(message.signer)) - return "signer: string expected"; - return null; - }; - - /** - * Creates a MsgChannelOpenTry message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.MsgChannelOpenTry - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.MsgChannelOpenTry} MsgChannelOpenTry - */ - MsgChannelOpenTry.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.MsgChannelOpenTry) - return object; - let message = new $root.ibc.core.channel.v1.MsgChannelOpenTry(); - if (object.port_id != null) - message.port_id = String(object.port_id); - if (object.previous_channel_id != null) - message.previous_channel_id = String(object.previous_channel_id); - if (object.channel != null) { - if (typeof object.channel !== "object") - throw TypeError(".ibc.core.channel.v1.MsgChannelOpenTry.channel: object expected"); - message.channel = $root.ibc.core.channel.v1.Channel.fromObject(object.channel); - } - if (object.counterparty_version != null) - message.counterparty_version = String(object.counterparty_version); - if (object.proof_init != null) - if (typeof object.proof_init === "string") - $util.base64.decode(object.proof_init, message.proof_init = $util.newBuffer($util.base64.length(object.proof_init)), 0); - else if (object.proof_init.length) - message.proof_init = object.proof_init; - if (object.proof_height != null) { - if (typeof object.proof_height !== "object") - throw TypeError(".ibc.core.channel.v1.MsgChannelOpenTry.proof_height: object expected"); - message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); - } - if (object.signer != null) - message.signer = String(object.signer); - return message; - }; - - /** - * Creates a plain object from a MsgChannelOpenTry message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.MsgChannelOpenTry - * @static - * @param {ibc.core.channel.v1.MsgChannelOpenTry} message MsgChannelOpenTry - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgChannelOpenTry.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.port_id = ""; - object.previous_channel_id = ""; - object.channel = null; - object.counterparty_version = ""; - if (options.bytes === String) - object.proof_init = ""; - else { - object.proof_init = []; - if (options.bytes !== Array) - object.proof_init = $util.newBuffer(object.proof_init); - } - object.proof_height = null; - object.signer = ""; - } - if (message.port_id != null && message.hasOwnProperty("port_id")) - object.port_id = message.port_id; - if (message.previous_channel_id != null && message.hasOwnProperty("previous_channel_id")) - object.previous_channel_id = message.previous_channel_id; - if (message.channel != null && message.hasOwnProperty("channel")) - object.channel = $root.ibc.core.channel.v1.Channel.toObject(message.channel, options); - if (message.counterparty_version != null && message.hasOwnProperty("counterparty_version")) - object.counterparty_version = message.counterparty_version; - if (message.proof_init != null && message.hasOwnProperty("proof_init")) - object.proof_init = options.bytes === String ? $util.base64.encode(message.proof_init, 0, message.proof_init.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_init) : message.proof_init; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) - object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); - if (message.signer != null && message.hasOwnProperty("signer")) - object.signer = message.signer; - return object; - }; - - /** - * Converts this MsgChannelOpenTry to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.MsgChannelOpenTry - * @instance - * @returns {Object.} JSON object - */ - MsgChannelOpenTry.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgChannelOpenTry; - })(); - - v1.MsgChannelOpenTryResponse = (function() { - - /** - * Properties of a MsgChannelOpenTryResponse. - * @memberof ibc.core.channel.v1 - * @interface IMsgChannelOpenTryResponse - */ - - /** - * Constructs a new MsgChannelOpenTryResponse. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a MsgChannelOpenTryResponse. - * @implements IMsgChannelOpenTryResponse - * @constructor - * @param {ibc.core.channel.v1.IMsgChannelOpenTryResponse=} [properties] Properties to set - */ - function MsgChannelOpenTryResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgChannelOpenTryResponse message. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenTryResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.MsgChannelOpenTryResponse - * @static - * @param {ibc.core.channel.v1.IMsgChannelOpenTryResponse} message MsgChannelOpenTryResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgChannelOpenTryResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgChannelOpenTryResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenTryResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.MsgChannelOpenTryResponse - * @static - * @param {ibc.core.channel.v1.IMsgChannelOpenTryResponse} message MsgChannelOpenTryResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgChannelOpenTryResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgChannelOpenTryResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.MsgChannelOpenTryResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.MsgChannelOpenTryResponse} MsgChannelOpenTryResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgChannelOpenTryResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgChannelOpenTryResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgChannelOpenTryResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.MsgChannelOpenTryResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.MsgChannelOpenTryResponse} MsgChannelOpenTryResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgChannelOpenTryResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgChannelOpenTryResponse message. - * @function verify - * @memberof ibc.core.channel.v1.MsgChannelOpenTryResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgChannelOpenTryResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgChannelOpenTryResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.MsgChannelOpenTryResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.MsgChannelOpenTryResponse} MsgChannelOpenTryResponse - */ - MsgChannelOpenTryResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.MsgChannelOpenTryResponse) - return object; - return new $root.ibc.core.channel.v1.MsgChannelOpenTryResponse(); - }; - - /** - * Creates a plain object from a MsgChannelOpenTryResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.MsgChannelOpenTryResponse - * @static - * @param {ibc.core.channel.v1.MsgChannelOpenTryResponse} message MsgChannelOpenTryResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgChannelOpenTryResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgChannelOpenTryResponse to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.MsgChannelOpenTryResponse - * @instance - * @returns {Object.} JSON object - */ - MsgChannelOpenTryResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgChannelOpenTryResponse; - })(); - - v1.MsgChannelOpenAck = (function() { - - /** - * Properties of a MsgChannelOpenAck. - * @memberof ibc.core.channel.v1 - * @interface IMsgChannelOpenAck - * @property {string|null} [port_id] MsgChannelOpenAck port_id - * @property {string|null} [channel_id] MsgChannelOpenAck channel_id - * @property {string|null} [counterparty_channel_id] MsgChannelOpenAck counterparty_channel_id - * @property {string|null} [counterparty_version] MsgChannelOpenAck counterparty_version - * @property {Uint8Array|null} [proof_try] MsgChannelOpenAck proof_try - * @property {ibc.core.client.v1.IHeight|null} [proof_height] MsgChannelOpenAck proof_height - * @property {string|null} [signer] MsgChannelOpenAck signer - */ - - /** - * Constructs a new MsgChannelOpenAck. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a MsgChannelOpenAck. - * @implements IMsgChannelOpenAck - * @constructor - * @param {ibc.core.channel.v1.IMsgChannelOpenAck=} [properties] Properties to set - */ - function MsgChannelOpenAck(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgChannelOpenAck port_id. - * @member {string} port_id - * @memberof ibc.core.channel.v1.MsgChannelOpenAck - * @instance - */ - MsgChannelOpenAck.prototype.port_id = ""; - - /** - * MsgChannelOpenAck channel_id. - * @member {string} channel_id - * @memberof ibc.core.channel.v1.MsgChannelOpenAck - * @instance - */ - MsgChannelOpenAck.prototype.channel_id = ""; - - /** - * MsgChannelOpenAck counterparty_channel_id. - * @member {string} counterparty_channel_id - * @memberof ibc.core.channel.v1.MsgChannelOpenAck - * @instance - */ - MsgChannelOpenAck.prototype.counterparty_channel_id = ""; - - /** - * MsgChannelOpenAck counterparty_version. - * @member {string} counterparty_version - * @memberof ibc.core.channel.v1.MsgChannelOpenAck - * @instance - */ - MsgChannelOpenAck.prototype.counterparty_version = ""; - - /** - * MsgChannelOpenAck proof_try. - * @member {Uint8Array} proof_try - * @memberof ibc.core.channel.v1.MsgChannelOpenAck - * @instance - */ - MsgChannelOpenAck.prototype.proof_try = $util.newBuffer([]); - - /** - * MsgChannelOpenAck proof_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height - * @memberof ibc.core.channel.v1.MsgChannelOpenAck - * @instance - */ - MsgChannelOpenAck.prototype.proof_height = null; - - /** - * MsgChannelOpenAck signer. - * @member {string} signer - * @memberof ibc.core.channel.v1.MsgChannelOpenAck - * @instance - */ - MsgChannelOpenAck.prototype.signer = ""; - - /** - * Encodes the specified MsgChannelOpenAck message. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenAck.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.MsgChannelOpenAck - * @static - * @param {ibc.core.channel.v1.IMsgChannelOpenAck} message MsgChannelOpenAck message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgChannelOpenAck.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); - if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); - if (message.counterparty_channel_id != null && Object.hasOwnProperty.call(message, "counterparty_channel_id")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.counterparty_channel_id); - if (message.counterparty_version != null && Object.hasOwnProperty.call(message, "counterparty_version")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.counterparty_version); - if (message.proof_try != null && Object.hasOwnProperty.call(message, "proof_try")) - writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.proof_try); - if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) - $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.signer); - return writer; - }; - - /** - * Encodes the specified MsgChannelOpenAck message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenAck.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.MsgChannelOpenAck - * @static - * @param {ibc.core.channel.v1.IMsgChannelOpenAck} message MsgChannelOpenAck message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgChannelOpenAck.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgChannelOpenAck message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.MsgChannelOpenAck - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.MsgChannelOpenAck} MsgChannelOpenAck - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgChannelOpenAck.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgChannelOpenAck(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.port_id = reader.string(); - break; - case 2: - message.channel_id = reader.string(); - break; - case 3: - message.counterparty_channel_id = reader.string(); - break; - case 4: - message.counterparty_version = reader.string(); - break; - case 5: - message.proof_try = reader.bytes(); - break; - case 6: - message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - case 7: - message.signer = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgChannelOpenAck message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.MsgChannelOpenAck - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.MsgChannelOpenAck} MsgChannelOpenAck - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgChannelOpenAck.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgChannelOpenAck message. - * @function verify - * @memberof ibc.core.channel.v1.MsgChannelOpenAck - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgChannelOpenAck.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.port_id != null && message.hasOwnProperty("port_id")) - if (!$util.isString(message.port_id)) - return "port_id: string expected"; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - if (!$util.isString(message.channel_id)) - return "channel_id: string expected"; - if (message.counterparty_channel_id != null && message.hasOwnProperty("counterparty_channel_id")) - if (!$util.isString(message.counterparty_channel_id)) - return "counterparty_channel_id: string expected"; - if (message.counterparty_version != null && message.hasOwnProperty("counterparty_version")) - if (!$util.isString(message.counterparty_version)) - return "counterparty_version: string expected"; - if (message.proof_try != null && message.hasOwnProperty("proof_try")) - if (!(message.proof_try && typeof message.proof_try.length === "number" || $util.isString(message.proof_try))) - return "proof_try: buffer expected"; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); - if (error) - return "proof_height." + error; - } - if (message.signer != null && message.hasOwnProperty("signer")) - if (!$util.isString(message.signer)) - return "signer: string expected"; - return null; - }; - - /** - * Creates a MsgChannelOpenAck message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.MsgChannelOpenAck - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.MsgChannelOpenAck} MsgChannelOpenAck - */ - MsgChannelOpenAck.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.MsgChannelOpenAck) - return object; - let message = new $root.ibc.core.channel.v1.MsgChannelOpenAck(); - if (object.port_id != null) - message.port_id = String(object.port_id); - if (object.channel_id != null) - message.channel_id = String(object.channel_id); - if (object.counterparty_channel_id != null) - message.counterparty_channel_id = String(object.counterparty_channel_id); - if (object.counterparty_version != null) - message.counterparty_version = String(object.counterparty_version); - if (object.proof_try != null) - if (typeof object.proof_try === "string") - $util.base64.decode(object.proof_try, message.proof_try = $util.newBuffer($util.base64.length(object.proof_try)), 0); - else if (object.proof_try.length) - message.proof_try = object.proof_try; - if (object.proof_height != null) { - if (typeof object.proof_height !== "object") - throw TypeError(".ibc.core.channel.v1.MsgChannelOpenAck.proof_height: object expected"); - message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); - } - if (object.signer != null) - message.signer = String(object.signer); - return message; - }; - - /** - * Creates a plain object from a MsgChannelOpenAck message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.MsgChannelOpenAck - * @static - * @param {ibc.core.channel.v1.MsgChannelOpenAck} message MsgChannelOpenAck - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgChannelOpenAck.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.port_id = ""; - object.channel_id = ""; - object.counterparty_channel_id = ""; - object.counterparty_version = ""; - if (options.bytes === String) - object.proof_try = ""; - else { - object.proof_try = []; - if (options.bytes !== Array) - object.proof_try = $util.newBuffer(object.proof_try); - } - object.proof_height = null; - object.signer = ""; - } - if (message.port_id != null && message.hasOwnProperty("port_id")) - object.port_id = message.port_id; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - object.channel_id = message.channel_id; - if (message.counterparty_channel_id != null && message.hasOwnProperty("counterparty_channel_id")) - object.counterparty_channel_id = message.counterparty_channel_id; - if (message.counterparty_version != null && message.hasOwnProperty("counterparty_version")) - object.counterparty_version = message.counterparty_version; - if (message.proof_try != null && message.hasOwnProperty("proof_try")) - object.proof_try = options.bytes === String ? $util.base64.encode(message.proof_try, 0, message.proof_try.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_try) : message.proof_try; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) - object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); - if (message.signer != null && message.hasOwnProperty("signer")) - object.signer = message.signer; - return object; - }; - - /** - * Converts this MsgChannelOpenAck to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.MsgChannelOpenAck - * @instance - * @returns {Object.} JSON object - */ - MsgChannelOpenAck.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgChannelOpenAck; - })(); - - v1.MsgChannelOpenAckResponse = (function() { - - /** - * Properties of a MsgChannelOpenAckResponse. - * @memberof ibc.core.channel.v1 - * @interface IMsgChannelOpenAckResponse - */ - - /** - * Constructs a new MsgChannelOpenAckResponse. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a MsgChannelOpenAckResponse. - * @implements IMsgChannelOpenAckResponse - * @constructor - * @param {ibc.core.channel.v1.IMsgChannelOpenAckResponse=} [properties] Properties to set - */ - function MsgChannelOpenAckResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgChannelOpenAckResponse message. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenAckResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.MsgChannelOpenAckResponse - * @static - * @param {ibc.core.channel.v1.IMsgChannelOpenAckResponse} message MsgChannelOpenAckResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgChannelOpenAckResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgChannelOpenAckResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenAckResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.MsgChannelOpenAckResponse - * @static - * @param {ibc.core.channel.v1.IMsgChannelOpenAckResponse} message MsgChannelOpenAckResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgChannelOpenAckResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgChannelOpenAckResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.MsgChannelOpenAckResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.MsgChannelOpenAckResponse} MsgChannelOpenAckResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgChannelOpenAckResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgChannelOpenAckResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgChannelOpenAckResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.MsgChannelOpenAckResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.MsgChannelOpenAckResponse} MsgChannelOpenAckResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgChannelOpenAckResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgChannelOpenAckResponse message. - * @function verify - * @memberof ibc.core.channel.v1.MsgChannelOpenAckResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgChannelOpenAckResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgChannelOpenAckResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.MsgChannelOpenAckResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.MsgChannelOpenAckResponse} MsgChannelOpenAckResponse - */ - MsgChannelOpenAckResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.MsgChannelOpenAckResponse) - return object; - return new $root.ibc.core.channel.v1.MsgChannelOpenAckResponse(); - }; - - /** - * Creates a plain object from a MsgChannelOpenAckResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.MsgChannelOpenAckResponse - * @static - * @param {ibc.core.channel.v1.MsgChannelOpenAckResponse} message MsgChannelOpenAckResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgChannelOpenAckResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgChannelOpenAckResponse to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.MsgChannelOpenAckResponse - * @instance - * @returns {Object.} JSON object - */ - MsgChannelOpenAckResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgChannelOpenAckResponse; - })(); - - v1.MsgChannelOpenConfirm = (function() { - - /** - * Properties of a MsgChannelOpenConfirm. - * @memberof ibc.core.channel.v1 - * @interface IMsgChannelOpenConfirm - * @property {string|null} [port_id] MsgChannelOpenConfirm port_id - * @property {string|null} [channel_id] MsgChannelOpenConfirm channel_id - * @property {Uint8Array|null} [proof_ack] MsgChannelOpenConfirm proof_ack - * @property {ibc.core.client.v1.IHeight|null} [proof_height] MsgChannelOpenConfirm proof_height - * @property {string|null} [signer] MsgChannelOpenConfirm signer - */ - - /** - * Constructs a new MsgChannelOpenConfirm. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a MsgChannelOpenConfirm. - * @implements IMsgChannelOpenConfirm - * @constructor - * @param {ibc.core.channel.v1.IMsgChannelOpenConfirm=} [properties] Properties to set - */ - function MsgChannelOpenConfirm(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgChannelOpenConfirm port_id. - * @member {string} port_id - * @memberof ibc.core.channel.v1.MsgChannelOpenConfirm - * @instance - */ - MsgChannelOpenConfirm.prototype.port_id = ""; - - /** - * MsgChannelOpenConfirm channel_id. - * @member {string} channel_id - * @memberof ibc.core.channel.v1.MsgChannelOpenConfirm - * @instance - */ - MsgChannelOpenConfirm.prototype.channel_id = ""; - - /** - * MsgChannelOpenConfirm proof_ack. - * @member {Uint8Array} proof_ack - * @memberof ibc.core.channel.v1.MsgChannelOpenConfirm - * @instance - */ - MsgChannelOpenConfirm.prototype.proof_ack = $util.newBuffer([]); - - /** - * MsgChannelOpenConfirm proof_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height - * @memberof ibc.core.channel.v1.MsgChannelOpenConfirm - * @instance - */ - MsgChannelOpenConfirm.prototype.proof_height = null; - - /** - * MsgChannelOpenConfirm signer. - * @member {string} signer - * @memberof ibc.core.channel.v1.MsgChannelOpenConfirm - * @instance - */ - MsgChannelOpenConfirm.prototype.signer = ""; - - /** - * Encodes the specified MsgChannelOpenConfirm message. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenConfirm.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.MsgChannelOpenConfirm - * @static - * @param {ibc.core.channel.v1.IMsgChannelOpenConfirm} message MsgChannelOpenConfirm message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgChannelOpenConfirm.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); - if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); - if (message.proof_ack != null && Object.hasOwnProperty.call(message, "proof_ack")) - writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.proof_ack); - if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) - $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.signer); - return writer; - }; - - /** - * Encodes the specified MsgChannelOpenConfirm message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenConfirm.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.MsgChannelOpenConfirm - * @static - * @param {ibc.core.channel.v1.IMsgChannelOpenConfirm} message MsgChannelOpenConfirm message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgChannelOpenConfirm.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgChannelOpenConfirm message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.MsgChannelOpenConfirm - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.MsgChannelOpenConfirm} MsgChannelOpenConfirm - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgChannelOpenConfirm.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgChannelOpenConfirm(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.port_id = reader.string(); - break; - case 2: - message.channel_id = reader.string(); - break; - case 3: - message.proof_ack = reader.bytes(); - break; - case 4: - message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - case 5: - message.signer = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgChannelOpenConfirm message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.MsgChannelOpenConfirm - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.MsgChannelOpenConfirm} MsgChannelOpenConfirm - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgChannelOpenConfirm.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgChannelOpenConfirm message. - * @function verify - * @memberof ibc.core.channel.v1.MsgChannelOpenConfirm - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgChannelOpenConfirm.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.port_id != null && message.hasOwnProperty("port_id")) - if (!$util.isString(message.port_id)) - return "port_id: string expected"; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - if (!$util.isString(message.channel_id)) - return "channel_id: string expected"; - if (message.proof_ack != null && message.hasOwnProperty("proof_ack")) - if (!(message.proof_ack && typeof message.proof_ack.length === "number" || $util.isString(message.proof_ack))) - return "proof_ack: buffer expected"; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); - if (error) - return "proof_height." + error; - } - if (message.signer != null && message.hasOwnProperty("signer")) - if (!$util.isString(message.signer)) - return "signer: string expected"; - return null; - }; - - /** - * Creates a MsgChannelOpenConfirm message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.MsgChannelOpenConfirm - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.MsgChannelOpenConfirm} MsgChannelOpenConfirm - */ - MsgChannelOpenConfirm.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.MsgChannelOpenConfirm) - return object; - let message = new $root.ibc.core.channel.v1.MsgChannelOpenConfirm(); - if (object.port_id != null) - message.port_id = String(object.port_id); - if (object.channel_id != null) - message.channel_id = String(object.channel_id); - if (object.proof_ack != null) - if (typeof object.proof_ack === "string") - $util.base64.decode(object.proof_ack, message.proof_ack = $util.newBuffer($util.base64.length(object.proof_ack)), 0); - else if (object.proof_ack.length) - message.proof_ack = object.proof_ack; - if (object.proof_height != null) { - if (typeof object.proof_height !== "object") - throw TypeError(".ibc.core.channel.v1.MsgChannelOpenConfirm.proof_height: object expected"); - message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); - } - if (object.signer != null) - message.signer = String(object.signer); - return message; - }; - - /** - * Creates a plain object from a MsgChannelOpenConfirm message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.MsgChannelOpenConfirm - * @static - * @param {ibc.core.channel.v1.MsgChannelOpenConfirm} message MsgChannelOpenConfirm - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgChannelOpenConfirm.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.port_id = ""; - object.channel_id = ""; - if (options.bytes === String) - object.proof_ack = ""; - else { - object.proof_ack = []; - if (options.bytes !== Array) - object.proof_ack = $util.newBuffer(object.proof_ack); - } - object.proof_height = null; - object.signer = ""; - } - if (message.port_id != null && message.hasOwnProperty("port_id")) - object.port_id = message.port_id; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - object.channel_id = message.channel_id; - if (message.proof_ack != null && message.hasOwnProperty("proof_ack")) - object.proof_ack = options.bytes === String ? $util.base64.encode(message.proof_ack, 0, message.proof_ack.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_ack) : message.proof_ack; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) - object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); - if (message.signer != null && message.hasOwnProperty("signer")) - object.signer = message.signer; - return object; - }; - - /** - * Converts this MsgChannelOpenConfirm to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.MsgChannelOpenConfirm - * @instance - * @returns {Object.} JSON object - */ - MsgChannelOpenConfirm.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgChannelOpenConfirm; - })(); - - v1.MsgChannelOpenConfirmResponse = (function() { - - /** - * Properties of a MsgChannelOpenConfirmResponse. - * @memberof ibc.core.channel.v1 - * @interface IMsgChannelOpenConfirmResponse - */ - - /** - * Constructs a new MsgChannelOpenConfirmResponse. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a MsgChannelOpenConfirmResponse. - * @implements IMsgChannelOpenConfirmResponse - * @constructor - * @param {ibc.core.channel.v1.IMsgChannelOpenConfirmResponse=} [properties] Properties to set - */ - function MsgChannelOpenConfirmResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgChannelOpenConfirmResponse message. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenConfirmResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.MsgChannelOpenConfirmResponse - * @static - * @param {ibc.core.channel.v1.IMsgChannelOpenConfirmResponse} message MsgChannelOpenConfirmResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgChannelOpenConfirmResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgChannelOpenConfirmResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgChannelOpenConfirmResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.MsgChannelOpenConfirmResponse - * @static - * @param {ibc.core.channel.v1.IMsgChannelOpenConfirmResponse} message MsgChannelOpenConfirmResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgChannelOpenConfirmResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgChannelOpenConfirmResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.MsgChannelOpenConfirmResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.MsgChannelOpenConfirmResponse} MsgChannelOpenConfirmResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgChannelOpenConfirmResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgChannelOpenConfirmResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgChannelOpenConfirmResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.MsgChannelOpenConfirmResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.MsgChannelOpenConfirmResponse} MsgChannelOpenConfirmResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgChannelOpenConfirmResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgChannelOpenConfirmResponse message. - * @function verify - * @memberof ibc.core.channel.v1.MsgChannelOpenConfirmResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgChannelOpenConfirmResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgChannelOpenConfirmResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.MsgChannelOpenConfirmResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.MsgChannelOpenConfirmResponse} MsgChannelOpenConfirmResponse - */ - MsgChannelOpenConfirmResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.MsgChannelOpenConfirmResponse) - return object; - return new $root.ibc.core.channel.v1.MsgChannelOpenConfirmResponse(); - }; - - /** - * Creates a plain object from a MsgChannelOpenConfirmResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.MsgChannelOpenConfirmResponse - * @static - * @param {ibc.core.channel.v1.MsgChannelOpenConfirmResponse} message MsgChannelOpenConfirmResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgChannelOpenConfirmResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgChannelOpenConfirmResponse to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.MsgChannelOpenConfirmResponse - * @instance - * @returns {Object.} JSON object - */ - MsgChannelOpenConfirmResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgChannelOpenConfirmResponse; - })(); - - v1.MsgChannelCloseInit = (function() { - - /** - * Properties of a MsgChannelCloseInit. - * @memberof ibc.core.channel.v1 - * @interface IMsgChannelCloseInit - * @property {string|null} [port_id] MsgChannelCloseInit port_id - * @property {string|null} [channel_id] MsgChannelCloseInit channel_id - * @property {string|null} [signer] MsgChannelCloseInit signer - */ - - /** - * Constructs a new MsgChannelCloseInit. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a MsgChannelCloseInit. - * @implements IMsgChannelCloseInit - * @constructor - * @param {ibc.core.channel.v1.IMsgChannelCloseInit=} [properties] Properties to set - */ - function MsgChannelCloseInit(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgChannelCloseInit port_id. - * @member {string} port_id - * @memberof ibc.core.channel.v1.MsgChannelCloseInit - * @instance - */ - MsgChannelCloseInit.prototype.port_id = ""; - - /** - * MsgChannelCloseInit channel_id. - * @member {string} channel_id - * @memberof ibc.core.channel.v1.MsgChannelCloseInit - * @instance - */ - MsgChannelCloseInit.prototype.channel_id = ""; - - /** - * MsgChannelCloseInit signer. - * @member {string} signer - * @memberof ibc.core.channel.v1.MsgChannelCloseInit - * @instance - */ - MsgChannelCloseInit.prototype.signer = ""; - - /** - * Encodes the specified MsgChannelCloseInit message. Does not implicitly {@link ibc.core.channel.v1.MsgChannelCloseInit.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.MsgChannelCloseInit - * @static - * @param {ibc.core.channel.v1.IMsgChannelCloseInit} message MsgChannelCloseInit message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgChannelCloseInit.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); - if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); - if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.signer); - return writer; - }; - - /** - * Encodes the specified MsgChannelCloseInit message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgChannelCloseInit.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.MsgChannelCloseInit - * @static - * @param {ibc.core.channel.v1.IMsgChannelCloseInit} message MsgChannelCloseInit message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgChannelCloseInit.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgChannelCloseInit message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.MsgChannelCloseInit - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.MsgChannelCloseInit} MsgChannelCloseInit - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgChannelCloseInit.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgChannelCloseInit(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.port_id = reader.string(); - break; - case 2: - message.channel_id = reader.string(); - break; - case 3: - message.signer = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgChannelCloseInit message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.MsgChannelCloseInit - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.MsgChannelCloseInit} MsgChannelCloseInit - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgChannelCloseInit.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgChannelCloseInit message. - * @function verify - * @memberof ibc.core.channel.v1.MsgChannelCloseInit - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgChannelCloseInit.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.port_id != null && message.hasOwnProperty("port_id")) - if (!$util.isString(message.port_id)) - return "port_id: string expected"; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - if (!$util.isString(message.channel_id)) - return "channel_id: string expected"; - if (message.signer != null && message.hasOwnProperty("signer")) - if (!$util.isString(message.signer)) - return "signer: string expected"; - return null; - }; - - /** - * Creates a MsgChannelCloseInit message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.MsgChannelCloseInit - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.MsgChannelCloseInit} MsgChannelCloseInit - */ - MsgChannelCloseInit.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.MsgChannelCloseInit) - return object; - let message = new $root.ibc.core.channel.v1.MsgChannelCloseInit(); - if (object.port_id != null) - message.port_id = String(object.port_id); - if (object.channel_id != null) - message.channel_id = String(object.channel_id); - if (object.signer != null) - message.signer = String(object.signer); - return message; - }; - - /** - * Creates a plain object from a MsgChannelCloseInit message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.MsgChannelCloseInit - * @static - * @param {ibc.core.channel.v1.MsgChannelCloseInit} message MsgChannelCloseInit - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgChannelCloseInit.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.port_id = ""; - object.channel_id = ""; - object.signer = ""; - } - if (message.port_id != null && message.hasOwnProperty("port_id")) - object.port_id = message.port_id; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - object.channel_id = message.channel_id; - if (message.signer != null && message.hasOwnProperty("signer")) - object.signer = message.signer; - return object; - }; - - /** - * Converts this MsgChannelCloseInit to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.MsgChannelCloseInit - * @instance - * @returns {Object.} JSON object - */ - MsgChannelCloseInit.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgChannelCloseInit; - })(); - - v1.MsgChannelCloseInitResponse = (function() { - - /** - * Properties of a MsgChannelCloseInitResponse. - * @memberof ibc.core.channel.v1 - * @interface IMsgChannelCloseInitResponse - */ - - /** - * Constructs a new MsgChannelCloseInitResponse. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a MsgChannelCloseInitResponse. - * @implements IMsgChannelCloseInitResponse - * @constructor - * @param {ibc.core.channel.v1.IMsgChannelCloseInitResponse=} [properties] Properties to set - */ - function MsgChannelCloseInitResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgChannelCloseInitResponse message. Does not implicitly {@link ibc.core.channel.v1.MsgChannelCloseInitResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.MsgChannelCloseInitResponse - * @static - * @param {ibc.core.channel.v1.IMsgChannelCloseInitResponse} message MsgChannelCloseInitResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgChannelCloseInitResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgChannelCloseInitResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgChannelCloseInitResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.MsgChannelCloseInitResponse - * @static - * @param {ibc.core.channel.v1.IMsgChannelCloseInitResponse} message MsgChannelCloseInitResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgChannelCloseInitResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgChannelCloseInitResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.MsgChannelCloseInitResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.MsgChannelCloseInitResponse} MsgChannelCloseInitResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgChannelCloseInitResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgChannelCloseInitResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgChannelCloseInitResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.MsgChannelCloseInitResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.MsgChannelCloseInitResponse} MsgChannelCloseInitResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgChannelCloseInitResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgChannelCloseInitResponse message. - * @function verify - * @memberof ibc.core.channel.v1.MsgChannelCloseInitResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgChannelCloseInitResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgChannelCloseInitResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.MsgChannelCloseInitResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.MsgChannelCloseInitResponse} MsgChannelCloseInitResponse - */ - MsgChannelCloseInitResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.MsgChannelCloseInitResponse) - return object; - return new $root.ibc.core.channel.v1.MsgChannelCloseInitResponse(); - }; - - /** - * Creates a plain object from a MsgChannelCloseInitResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.MsgChannelCloseInitResponse - * @static - * @param {ibc.core.channel.v1.MsgChannelCloseInitResponse} message MsgChannelCloseInitResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgChannelCloseInitResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgChannelCloseInitResponse to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.MsgChannelCloseInitResponse - * @instance - * @returns {Object.} JSON object - */ - MsgChannelCloseInitResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgChannelCloseInitResponse; - })(); - - v1.MsgChannelCloseConfirm = (function() { - - /** - * Properties of a MsgChannelCloseConfirm. - * @memberof ibc.core.channel.v1 - * @interface IMsgChannelCloseConfirm - * @property {string|null} [port_id] MsgChannelCloseConfirm port_id - * @property {string|null} [channel_id] MsgChannelCloseConfirm channel_id - * @property {Uint8Array|null} [proof_init] MsgChannelCloseConfirm proof_init - * @property {ibc.core.client.v1.IHeight|null} [proof_height] MsgChannelCloseConfirm proof_height - * @property {string|null} [signer] MsgChannelCloseConfirm signer - */ - - /** - * Constructs a new MsgChannelCloseConfirm. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a MsgChannelCloseConfirm. - * @implements IMsgChannelCloseConfirm - * @constructor - * @param {ibc.core.channel.v1.IMsgChannelCloseConfirm=} [properties] Properties to set - */ - function MsgChannelCloseConfirm(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgChannelCloseConfirm port_id. - * @member {string} port_id - * @memberof ibc.core.channel.v1.MsgChannelCloseConfirm - * @instance - */ - MsgChannelCloseConfirm.prototype.port_id = ""; - - /** - * MsgChannelCloseConfirm channel_id. - * @member {string} channel_id - * @memberof ibc.core.channel.v1.MsgChannelCloseConfirm - * @instance - */ - MsgChannelCloseConfirm.prototype.channel_id = ""; - - /** - * MsgChannelCloseConfirm proof_init. - * @member {Uint8Array} proof_init - * @memberof ibc.core.channel.v1.MsgChannelCloseConfirm - * @instance - */ - MsgChannelCloseConfirm.prototype.proof_init = $util.newBuffer([]); - - /** - * MsgChannelCloseConfirm proof_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height - * @memberof ibc.core.channel.v1.MsgChannelCloseConfirm - * @instance - */ - MsgChannelCloseConfirm.prototype.proof_height = null; - - /** - * MsgChannelCloseConfirm signer. - * @member {string} signer - * @memberof ibc.core.channel.v1.MsgChannelCloseConfirm - * @instance - */ - MsgChannelCloseConfirm.prototype.signer = ""; - - /** - * Encodes the specified MsgChannelCloseConfirm message. Does not implicitly {@link ibc.core.channel.v1.MsgChannelCloseConfirm.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.MsgChannelCloseConfirm - * @static - * @param {ibc.core.channel.v1.IMsgChannelCloseConfirm} message MsgChannelCloseConfirm message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgChannelCloseConfirm.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); - if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); - if (message.proof_init != null && Object.hasOwnProperty.call(message, "proof_init")) - writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.proof_init); - if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) - $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.signer); - return writer; - }; - - /** - * Encodes the specified MsgChannelCloseConfirm message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgChannelCloseConfirm.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.MsgChannelCloseConfirm - * @static - * @param {ibc.core.channel.v1.IMsgChannelCloseConfirm} message MsgChannelCloseConfirm message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgChannelCloseConfirm.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgChannelCloseConfirm message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.MsgChannelCloseConfirm - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.MsgChannelCloseConfirm} MsgChannelCloseConfirm - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgChannelCloseConfirm.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgChannelCloseConfirm(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.port_id = reader.string(); - break; - case 2: - message.channel_id = reader.string(); - break; - case 3: - message.proof_init = reader.bytes(); - break; - case 4: - message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - case 5: - message.signer = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgChannelCloseConfirm message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.MsgChannelCloseConfirm - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.MsgChannelCloseConfirm} MsgChannelCloseConfirm - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgChannelCloseConfirm.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgChannelCloseConfirm message. - * @function verify - * @memberof ibc.core.channel.v1.MsgChannelCloseConfirm - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgChannelCloseConfirm.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.port_id != null && message.hasOwnProperty("port_id")) - if (!$util.isString(message.port_id)) - return "port_id: string expected"; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - if (!$util.isString(message.channel_id)) - return "channel_id: string expected"; - if (message.proof_init != null && message.hasOwnProperty("proof_init")) - if (!(message.proof_init && typeof message.proof_init.length === "number" || $util.isString(message.proof_init))) - return "proof_init: buffer expected"; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); - if (error) - return "proof_height." + error; - } - if (message.signer != null && message.hasOwnProperty("signer")) - if (!$util.isString(message.signer)) - return "signer: string expected"; - return null; - }; - - /** - * Creates a MsgChannelCloseConfirm message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.MsgChannelCloseConfirm - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.MsgChannelCloseConfirm} MsgChannelCloseConfirm - */ - MsgChannelCloseConfirm.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.MsgChannelCloseConfirm) - return object; - let message = new $root.ibc.core.channel.v1.MsgChannelCloseConfirm(); - if (object.port_id != null) - message.port_id = String(object.port_id); - if (object.channel_id != null) - message.channel_id = String(object.channel_id); - if (object.proof_init != null) - if (typeof object.proof_init === "string") - $util.base64.decode(object.proof_init, message.proof_init = $util.newBuffer($util.base64.length(object.proof_init)), 0); - else if (object.proof_init.length) - message.proof_init = object.proof_init; - if (object.proof_height != null) { - if (typeof object.proof_height !== "object") - throw TypeError(".ibc.core.channel.v1.MsgChannelCloseConfirm.proof_height: object expected"); - message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); - } - if (object.signer != null) - message.signer = String(object.signer); - return message; - }; - - /** - * Creates a plain object from a MsgChannelCloseConfirm message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.MsgChannelCloseConfirm - * @static - * @param {ibc.core.channel.v1.MsgChannelCloseConfirm} message MsgChannelCloseConfirm - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgChannelCloseConfirm.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.port_id = ""; - object.channel_id = ""; - if (options.bytes === String) - object.proof_init = ""; - else { - object.proof_init = []; - if (options.bytes !== Array) - object.proof_init = $util.newBuffer(object.proof_init); - } - object.proof_height = null; - object.signer = ""; - } - if (message.port_id != null && message.hasOwnProperty("port_id")) - object.port_id = message.port_id; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - object.channel_id = message.channel_id; - if (message.proof_init != null && message.hasOwnProperty("proof_init")) - object.proof_init = options.bytes === String ? $util.base64.encode(message.proof_init, 0, message.proof_init.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_init) : message.proof_init; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) - object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); - if (message.signer != null && message.hasOwnProperty("signer")) - object.signer = message.signer; - return object; - }; - - /** - * Converts this MsgChannelCloseConfirm to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.MsgChannelCloseConfirm - * @instance - * @returns {Object.} JSON object - */ - MsgChannelCloseConfirm.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgChannelCloseConfirm; - })(); - - v1.MsgChannelCloseConfirmResponse = (function() { - - /** - * Properties of a MsgChannelCloseConfirmResponse. - * @memberof ibc.core.channel.v1 - * @interface IMsgChannelCloseConfirmResponse - */ - - /** - * Constructs a new MsgChannelCloseConfirmResponse. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a MsgChannelCloseConfirmResponse. - * @implements IMsgChannelCloseConfirmResponse - * @constructor - * @param {ibc.core.channel.v1.IMsgChannelCloseConfirmResponse=} [properties] Properties to set - */ - function MsgChannelCloseConfirmResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgChannelCloseConfirmResponse message. Does not implicitly {@link ibc.core.channel.v1.MsgChannelCloseConfirmResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.MsgChannelCloseConfirmResponse - * @static - * @param {ibc.core.channel.v1.IMsgChannelCloseConfirmResponse} message MsgChannelCloseConfirmResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgChannelCloseConfirmResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgChannelCloseConfirmResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgChannelCloseConfirmResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.MsgChannelCloseConfirmResponse - * @static - * @param {ibc.core.channel.v1.IMsgChannelCloseConfirmResponse} message MsgChannelCloseConfirmResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgChannelCloseConfirmResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgChannelCloseConfirmResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.MsgChannelCloseConfirmResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.MsgChannelCloseConfirmResponse} MsgChannelCloseConfirmResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgChannelCloseConfirmResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgChannelCloseConfirmResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgChannelCloseConfirmResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.MsgChannelCloseConfirmResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.MsgChannelCloseConfirmResponse} MsgChannelCloseConfirmResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgChannelCloseConfirmResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgChannelCloseConfirmResponse message. - * @function verify - * @memberof ibc.core.channel.v1.MsgChannelCloseConfirmResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgChannelCloseConfirmResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgChannelCloseConfirmResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.MsgChannelCloseConfirmResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.MsgChannelCloseConfirmResponse} MsgChannelCloseConfirmResponse - */ - MsgChannelCloseConfirmResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.MsgChannelCloseConfirmResponse) - return object; - return new $root.ibc.core.channel.v1.MsgChannelCloseConfirmResponse(); - }; - - /** - * Creates a plain object from a MsgChannelCloseConfirmResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.MsgChannelCloseConfirmResponse - * @static - * @param {ibc.core.channel.v1.MsgChannelCloseConfirmResponse} message MsgChannelCloseConfirmResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgChannelCloseConfirmResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgChannelCloseConfirmResponse to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.MsgChannelCloseConfirmResponse - * @instance - * @returns {Object.} JSON object - */ - MsgChannelCloseConfirmResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgChannelCloseConfirmResponse; - })(); - - v1.MsgRecvPacket = (function() { - - /** - * Properties of a MsgRecvPacket. - * @memberof ibc.core.channel.v1 - * @interface IMsgRecvPacket - * @property {ibc.core.channel.v1.IPacket|null} [packet] MsgRecvPacket packet - * @property {Uint8Array|null} [proof_commitment] MsgRecvPacket proof_commitment - * @property {ibc.core.client.v1.IHeight|null} [proof_height] MsgRecvPacket proof_height - * @property {string|null} [signer] MsgRecvPacket signer - */ - - /** - * Constructs a new MsgRecvPacket. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a MsgRecvPacket. - * @implements IMsgRecvPacket - * @constructor - * @param {ibc.core.channel.v1.IMsgRecvPacket=} [properties] Properties to set - */ - function MsgRecvPacket(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgRecvPacket packet. - * @member {ibc.core.channel.v1.IPacket|null|undefined} packet - * @memberof ibc.core.channel.v1.MsgRecvPacket - * @instance - */ - MsgRecvPacket.prototype.packet = null; - - /** - * MsgRecvPacket proof_commitment. - * @member {Uint8Array} proof_commitment - * @memberof ibc.core.channel.v1.MsgRecvPacket - * @instance - */ - MsgRecvPacket.prototype.proof_commitment = $util.newBuffer([]); - - /** - * MsgRecvPacket proof_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height - * @memberof ibc.core.channel.v1.MsgRecvPacket - * @instance - */ - MsgRecvPacket.prototype.proof_height = null; - - /** - * MsgRecvPacket signer. - * @member {string} signer - * @memberof ibc.core.channel.v1.MsgRecvPacket - * @instance - */ - MsgRecvPacket.prototype.signer = ""; - - /** - * Encodes the specified MsgRecvPacket message. Does not implicitly {@link ibc.core.channel.v1.MsgRecvPacket.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.MsgRecvPacket - * @static - * @param {ibc.core.channel.v1.IMsgRecvPacket} message MsgRecvPacket message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgRecvPacket.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.packet != null && Object.hasOwnProperty.call(message, "packet")) - $root.ibc.core.channel.v1.Packet.encode(message.packet, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.proof_commitment != null && Object.hasOwnProperty.call(message, "proof_commitment")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proof_commitment); - if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) - $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.signer); - return writer; - }; - - /** - * Encodes the specified MsgRecvPacket message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgRecvPacket.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.MsgRecvPacket - * @static - * @param {ibc.core.channel.v1.IMsgRecvPacket} message MsgRecvPacket message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgRecvPacket.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgRecvPacket message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.MsgRecvPacket - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.MsgRecvPacket} MsgRecvPacket - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgRecvPacket.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgRecvPacket(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.packet = $root.ibc.core.channel.v1.Packet.decode(reader, reader.uint32()); - break; - case 2: - message.proof_commitment = reader.bytes(); - break; - case 3: - message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - case 4: - message.signer = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgRecvPacket message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.MsgRecvPacket - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.MsgRecvPacket} MsgRecvPacket - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgRecvPacket.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgRecvPacket message. - * @function verify - * @memberof ibc.core.channel.v1.MsgRecvPacket - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgRecvPacket.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.packet != null && message.hasOwnProperty("packet")) { - let error = $root.ibc.core.channel.v1.Packet.verify(message.packet); - if (error) - return "packet." + error; - } - if (message.proof_commitment != null && message.hasOwnProperty("proof_commitment")) - if (!(message.proof_commitment && typeof message.proof_commitment.length === "number" || $util.isString(message.proof_commitment))) - return "proof_commitment: buffer expected"; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); - if (error) - return "proof_height." + error; - } - if (message.signer != null && message.hasOwnProperty("signer")) - if (!$util.isString(message.signer)) - return "signer: string expected"; - return null; - }; - - /** - * Creates a MsgRecvPacket message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.MsgRecvPacket - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.MsgRecvPacket} MsgRecvPacket - */ - MsgRecvPacket.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.MsgRecvPacket) - return object; - let message = new $root.ibc.core.channel.v1.MsgRecvPacket(); - if (object.packet != null) { - if (typeof object.packet !== "object") - throw TypeError(".ibc.core.channel.v1.MsgRecvPacket.packet: object expected"); - message.packet = $root.ibc.core.channel.v1.Packet.fromObject(object.packet); - } - if (object.proof_commitment != null) - if (typeof object.proof_commitment === "string") - $util.base64.decode(object.proof_commitment, message.proof_commitment = $util.newBuffer($util.base64.length(object.proof_commitment)), 0); - else if (object.proof_commitment.length) - message.proof_commitment = object.proof_commitment; - if (object.proof_height != null) { - if (typeof object.proof_height !== "object") - throw TypeError(".ibc.core.channel.v1.MsgRecvPacket.proof_height: object expected"); - message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); - } - if (object.signer != null) - message.signer = String(object.signer); - return message; - }; - - /** - * Creates a plain object from a MsgRecvPacket message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.MsgRecvPacket - * @static - * @param {ibc.core.channel.v1.MsgRecvPacket} message MsgRecvPacket - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgRecvPacket.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.packet = null; - if (options.bytes === String) - object.proof_commitment = ""; - else { - object.proof_commitment = []; - if (options.bytes !== Array) - object.proof_commitment = $util.newBuffer(object.proof_commitment); - } - object.proof_height = null; - object.signer = ""; - } - if (message.packet != null && message.hasOwnProperty("packet")) - object.packet = $root.ibc.core.channel.v1.Packet.toObject(message.packet, options); - if (message.proof_commitment != null && message.hasOwnProperty("proof_commitment")) - object.proof_commitment = options.bytes === String ? $util.base64.encode(message.proof_commitment, 0, message.proof_commitment.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_commitment) : message.proof_commitment; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) - object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); - if (message.signer != null && message.hasOwnProperty("signer")) - object.signer = message.signer; - return object; - }; - - /** - * Converts this MsgRecvPacket to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.MsgRecvPacket - * @instance - * @returns {Object.} JSON object - */ - MsgRecvPacket.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgRecvPacket; - })(); - - v1.MsgRecvPacketResponse = (function() { - - /** - * Properties of a MsgRecvPacketResponse. - * @memberof ibc.core.channel.v1 - * @interface IMsgRecvPacketResponse - */ - - /** - * Constructs a new MsgRecvPacketResponse. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a MsgRecvPacketResponse. - * @implements IMsgRecvPacketResponse - * @constructor - * @param {ibc.core.channel.v1.IMsgRecvPacketResponse=} [properties] Properties to set - */ - function MsgRecvPacketResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgRecvPacketResponse message. Does not implicitly {@link ibc.core.channel.v1.MsgRecvPacketResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.MsgRecvPacketResponse - * @static - * @param {ibc.core.channel.v1.IMsgRecvPacketResponse} message MsgRecvPacketResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgRecvPacketResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgRecvPacketResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgRecvPacketResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.MsgRecvPacketResponse - * @static - * @param {ibc.core.channel.v1.IMsgRecvPacketResponse} message MsgRecvPacketResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgRecvPacketResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgRecvPacketResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.MsgRecvPacketResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.MsgRecvPacketResponse} MsgRecvPacketResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgRecvPacketResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgRecvPacketResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgRecvPacketResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.MsgRecvPacketResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.MsgRecvPacketResponse} MsgRecvPacketResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgRecvPacketResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgRecvPacketResponse message. - * @function verify - * @memberof ibc.core.channel.v1.MsgRecvPacketResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgRecvPacketResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgRecvPacketResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.MsgRecvPacketResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.MsgRecvPacketResponse} MsgRecvPacketResponse - */ - MsgRecvPacketResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.MsgRecvPacketResponse) - return object; - return new $root.ibc.core.channel.v1.MsgRecvPacketResponse(); - }; - - /** - * Creates a plain object from a MsgRecvPacketResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.MsgRecvPacketResponse - * @static - * @param {ibc.core.channel.v1.MsgRecvPacketResponse} message MsgRecvPacketResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgRecvPacketResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgRecvPacketResponse to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.MsgRecvPacketResponse - * @instance - * @returns {Object.} JSON object - */ - MsgRecvPacketResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgRecvPacketResponse; - })(); - - v1.MsgTimeout = (function() { - - /** - * Properties of a MsgTimeout. - * @memberof ibc.core.channel.v1 - * @interface IMsgTimeout - * @property {ibc.core.channel.v1.IPacket|null} [packet] MsgTimeout packet - * @property {Uint8Array|null} [proof_unreceived] MsgTimeout proof_unreceived - * @property {ibc.core.client.v1.IHeight|null} [proof_height] MsgTimeout proof_height - * @property {Long|null} [next_sequence_recv] MsgTimeout next_sequence_recv - * @property {string|null} [signer] MsgTimeout signer - */ - - /** - * Constructs a new MsgTimeout. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a MsgTimeout. - * @implements IMsgTimeout - * @constructor - * @param {ibc.core.channel.v1.IMsgTimeout=} [properties] Properties to set - */ - function MsgTimeout(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgTimeout packet. - * @member {ibc.core.channel.v1.IPacket|null|undefined} packet - * @memberof ibc.core.channel.v1.MsgTimeout - * @instance - */ - MsgTimeout.prototype.packet = null; - - /** - * MsgTimeout proof_unreceived. - * @member {Uint8Array} proof_unreceived - * @memberof ibc.core.channel.v1.MsgTimeout - * @instance - */ - MsgTimeout.prototype.proof_unreceived = $util.newBuffer([]); - - /** - * MsgTimeout proof_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height - * @memberof ibc.core.channel.v1.MsgTimeout - * @instance - */ - MsgTimeout.prototype.proof_height = null; - - /** - * MsgTimeout next_sequence_recv. - * @member {Long} next_sequence_recv - * @memberof ibc.core.channel.v1.MsgTimeout - * @instance - */ - MsgTimeout.prototype.next_sequence_recv = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * MsgTimeout signer. - * @member {string} signer - * @memberof ibc.core.channel.v1.MsgTimeout - * @instance - */ - MsgTimeout.prototype.signer = ""; - - /** - * Encodes the specified MsgTimeout message. Does not implicitly {@link ibc.core.channel.v1.MsgTimeout.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.MsgTimeout - * @static - * @param {ibc.core.channel.v1.IMsgTimeout} message MsgTimeout message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgTimeout.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.packet != null && Object.hasOwnProperty.call(message, "packet")) - $root.ibc.core.channel.v1.Packet.encode(message.packet, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.proof_unreceived != null && Object.hasOwnProperty.call(message, "proof_unreceived")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proof_unreceived); - if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) - $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.next_sequence_recv != null && Object.hasOwnProperty.call(message, "next_sequence_recv")) - writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.next_sequence_recv); - if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.signer); - return writer; - }; - - /** - * Encodes the specified MsgTimeout message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgTimeout.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.MsgTimeout - * @static - * @param {ibc.core.channel.v1.IMsgTimeout} message MsgTimeout message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgTimeout.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgTimeout message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.MsgTimeout - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.MsgTimeout} MsgTimeout - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgTimeout.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgTimeout(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.packet = $root.ibc.core.channel.v1.Packet.decode(reader, reader.uint32()); - break; - case 2: - message.proof_unreceived = reader.bytes(); - break; - case 3: - message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - case 4: - message.next_sequence_recv = reader.uint64(); - break; - case 5: - message.signer = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgTimeout message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.MsgTimeout - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.MsgTimeout} MsgTimeout - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgTimeout.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgTimeout message. - * @function verify - * @memberof ibc.core.channel.v1.MsgTimeout - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgTimeout.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.packet != null && message.hasOwnProperty("packet")) { - let error = $root.ibc.core.channel.v1.Packet.verify(message.packet); - if (error) - return "packet." + error; - } - if (message.proof_unreceived != null && message.hasOwnProperty("proof_unreceived")) - if (!(message.proof_unreceived && typeof message.proof_unreceived.length === "number" || $util.isString(message.proof_unreceived))) - return "proof_unreceived: buffer expected"; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); - if (error) - return "proof_height." + error; - } - if (message.next_sequence_recv != null && message.hasOwnProperty("next_sequence_recv")) - if (!$util.isInteger(message.next_sequence_recv) && !(message.next_sequence_recv && $util.isInteger(message.next_sequence_recv.low) && $util.isInteger(message.next_sequence_recv.high))) - return "next_sequence_recv: integer|Long expected"; - if (message.signer != null && message.hasOwnProperty("signer")) - if (!$util.isString(message.signer)) - return "signer: string expected"; - return null; - }; - - /** - * Creates a MsgTimeout message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.MsgTimeout - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.MsgTimeout} MsgTimeout - */ - MsgTimeout.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.MsgTimeout) - return object; - let message = new $root.ibc.core.channel.v1.MsgTimeout(); - if (object.packet != null) { - if (typeof object.packet !== "object") - throw TypeError(".ibc.core.channel.v1.MsgTimeout.packet: object expected"); - message.packet = $root.ibc.core.channel.v1.Packet.fromObject(object.packet); - } - if (object.proof_unreceived != null) - if (typeof object.proof_unreceived === "string") - $util.base64.decode(object.proof_unreceived, message.proof_unreceived = $util.newBuffer($util.base64.length(object.proof_unreceived)), 0); - else if (object.proof_unreceived.length) - message.proof_unreceived = object.proof_unreceived; - if (object.proof_height != null) { - if (typeof object.proof_height !== "object") - throw TypeError(".ibc.core.channel.v1.MsgTimeout.proof_height: object expected"); - message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); - } - if (object.next_sequence_recv != null) - if ($util.Long) - (message.next_sequence_recv = $util.Long.fromValue(object.next_sequence_recv)).unsigned = true; - else if (typeof object.next_sequence_recv === "string") - message.next_sequence_recv = parseInt(object.next_sequence_recv, 10); - else if (typeof object.next_sequence_recv === "number") - message.next_sequence_recv = object.next_sequence_recv; - else if (typeof object.next_sequence_recv === "object") - message.next_sequence_recv = new $util.LongBits(object.next_sequence_recv.low >>> 0, object.next_sequence_recv.high >>> 0).toNumber(true); - if (object.signer != null) - message.signer = String(object.signer); - return message; - }; - - /** - * Creates a plain object from a MsgTimeout message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.MsgTimeout - * @static - * @param {ibc.core.channel.v1.MsgTimeout} message MsgTimeout - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgTimeout.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.packet = null; - if (options.bytes === String) - object.proof_unreceived = ""; - else { - object.proof_unreceived = []; - if (options.bytes !== Array) - object.proof_unreceived = $util.newBuffer(object.proof_unreceived); - } - object.proof_height = null; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.next_sequence_recv = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.next_sequence_recv = options.longs === String ? "0" : 0; - object.signer = ""; - } - if (message.packet != null && message.hasOwnProperty("packet")) - object.packet = $root.ibc.core.channel.v1.Packet.toObject(message.packet, options); - if (message.proof_unreceived != null && message.hasOwnProperty("proof_unreceived")) - object.proof_unreceived = options.bytes === String ? $util.base64.encode(message.proof_unreceived, 0, message.proof_unreceived.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_unreceived) : message.proof_unreceived; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) - object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); - if (message.next_sequence_recv != null && message.hasOwnProperty("next_sequence_recv")) - if (typeof message.next_sequence_recv === "number") - object.next_sequence_recv = options.longs === String ? String(message.next_sequence_recv) : message.next_sequence_recv; - else - object.next_sequence_recv = options.longs === String ? $util.Long.prototype.toString.call(message.next_sequence_recv) : options.longs === Number ? new $util.LongBits(message.next_sequence_recv.low >>> 0, message.next_sequence_recv.high >>> 0).toNumber(true) : message.next_sequence_recv; - if (message.signer != null && message.hasOwnProperty("signer")) - object.signer = message.signer; - return object; - }; - - /** - * Converts this MsgTimeout to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.MsgTimeout - * @instance - * @returns {Object.} JSON object - */ - MsgTimeout.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgTimeout; - })(); - - v1.MsgTimeoutResponse = (function() { - - /** - * Properties of a MsgTimeoutResponse. - * @memberof ibc.core.channel.v1 - * @interface IMsgTimeoutResponse - */ - - /** - * Constructs a new MsgTimeoutResponse. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a MsgTimeoutResponse. - * @implements IMsgTimeoutResponse - * @constructor - * @param {ibc.core.channel.v1.IMsgTimeoutResponse=} [properties] Properties to set - */ - function MsgTimeoutResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgTimeoutResponse message. Does not implicitly {@link ibc.core.channel.v1.MsgTimeoutResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.MsgTimeoutResponse - * @static - * @param {ibc.core.channel.v1.IMsgTimeoutResponse} message MsgTimeoutResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgTimeoutResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgTimeoutResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgTimeoutResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.MsgTimeoutResponse - * @static - * @param {ibc.core.channel.v1.IMsgTimeoutResponse} message MsgTimeoutResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgTimeoutResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgTimeoutResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.MsgTimeoutResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.MsgTimeoutResponse} MsgTimeoutResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgTimeoutResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgTimeoutResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgTimeoutResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.MsgTimeoutResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.MsgTimeoutResponse} MsgTimeoutResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgTimeoutResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgTimeoutResponse message. - * @function verify - * @memberof ibc.core.channel.v1.MsgTimeoutResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgTimeoutResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgTimeoutResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.MsgTimeoutResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.MsgTimeoutResponse} MsgTimeoutResponse - */ - MsgTimeoutResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.MsgTimeoutResponse) - return object; - return new $root.ibc.core.channel.v1.MsgTimeoutResponse(); - }; - - /** - * Creates a plain object from a MsgTimeoutResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.MsgTimeoutResponse - * @static - * @param {ibc.core.channel.v1.MsgTimeoutResponse} message MsgTimeoutResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgTimeoutResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgTimeoutResponse to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.MsgTimeoutResponse - * @instance - * @returns {Object.} JSON object - */ - MsgTimeoutResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgTimeoutResponse; - })(); - - v1.MsgTimeoutOnClose = (function() { - - /** - * Properties of a MsgTimeoutOnClose. - * @memberof ibc.core.channel.v1 - * @interface IMsgTimeoutOnClose - * @property {ibc.core.channel.v1.IPacket|null} [packet] MsgTimeoutOnClose packet - * @property {Uint8Array|null} [proof_unreceived] MsgTimeoutOnClose proof_unreceived - * @property {Uint8Array|null} [proof_close] MsgTimeoutOnClose proof_close - * @property {ibc.core.client.v1.IHeight|null} [proof_height] MsgTimeoutOnClose proof_height - * @property {Long|null} [next_sequence_recv] MsgTimeoutOnClose next_sequence_recv - * @property {string|null} [signer] MsgTimeoutOnClose signer - */ - - /** - * Constructs a new MsgTimeoutOnClose. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a MsgTimeoutOnClose. - * @implements IMsgTimeoutOnClose - * @constructor - * @param {ibc.core.channel.v1.IMsgTimeoutOnClose=} [properties] Properties to set - */ - function MsgTimeoutOnClose(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgTimeoutOnClose packet. - * @member {ibc.core.channel.v1.IPacket|null|undefined} packet - * @memberof ibc.core.channel.v1.MsgTimeoutOnClose - * @instance - */ - MsgTimeoutOnClose.prototype.packet = null; - - /** - * MsgTimeoutOnClose proof_unreceived. - * @member {Uint8Array} proof_unreceived - * @memberof ibc.core.channel.v1.MsgTimeoutOnClose - * @instance - */ - MsgTimeoutOnClose.prototype.proof_unreceived = $util.newBuffer([]); - - /** - * MsgTimeoutOnClose proof_close. - * @member {Uint8Array} proof_close - * @memberof ibc.core.channel.v1.MsgTimeoutOnClose - * @instance - */ - MsgTimeoutOnClose.prototype.proof_close = $util.newBuffer([]); - - /** - * MsgTimeoutOnClose proof_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height - * @memberof ibc.core.channel.v1.MsgTimeoutOnClose - * @instance - */ - MsgTimeoutOnClose.prototype.proof_height = null; - - /** - * MsgTimeoutOnClose next_sequence_recv. - * @member {Long} next_sequence_recv - * @memberof ibc.core.channel.v1.MsgTimeoutOnClose - * @instance - */ - MsgTimeoutOnClose.prototype.next_sequence_recv = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * MsgTimeoutOnClose signer. - * @member {string} signer - * @memberof ibc.core.channel.v1.MsgTimeoutOnClose - * @instance - */ - MsgTimeoutOnClose.prototype.signer = ""; - - /** - * Encodes the specified MsgTimeoutOnClose message. Does not implicitly {@link ibc.core.channel.v1.MsgTimeoutOnClose.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.MsgTimeoutOnClose - * @static - * @param {ibc.core.channel.v1.IMsgTimeoutOnClose} message MsgTimeoutOnClose message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgTimeoutOnClose.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.packet != null && Object.hasOwnProperty.call(message, "packet")) - $root.ibc.core.channel.v1.Packet.encode(message.packet, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.proof_unreceived != null && Object.hasOwnProperty.call(message, "proof_unreceived")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proof_unreceived); - if (message.proof_close != null && Object.hasOwnProperty.call(message, "proof_close")) - writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.proof_close); - if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) - $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.next_sequence_recv != null && Object.hasOwnProperty.call(message, "next_sequence_recv")) - writer.uint32(/* id 5, wireType 0 =*/40).uint64(message.next_sequence_recv); - if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.signer); - return writer; - }; - - /** - * Encodes the specified MsgTimeoutOnClose message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgTimeoutOnClose.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.MsgTimeoutOnClose - * @static - * @param {ibc.core.channel.v1.IMsgTimeoutOnClose} message MsgTimeoutOnClose message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgTimeoutOnClose.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgTimeoutOnClose message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.MsgTimeoutOnClose - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.MsgTimeoutOnClose} MsgTimeoutOnClose - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgTimeoutOnClose.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgTimeoutOnClose(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.packet = $root.ibc.core.channel.v1.Packet.decode(reader, reader.uint32()); - break; - case 2: - message.proof_unreceived = reader.bytes(); - break; - case 3: - message.proof_close = reader.bytes(); - break; - case 4: - message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - case 5: - message.next_sequence_recv = reader.uint64(); - break; - case 6: - message.signer = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgTimeoutOnClose message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.MsgTimeoutOnClose - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.MsgTimeoutOnClose} MsgTimeoutOnClose - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgTimeoutOnClose.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgTimeoutOnClose message. - * @function verify - * @memberof ibc.core.channel.v1.MsgTimeoutOnClose - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgTimeoutOnClose.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.packet != null && message.hasOwnProperty("packet")) { - let error = $root.ibc.core.channel.v1.Packet.verify(message.packet); - if (error) - return "packet." + error; - } - if (message.proof_unreceived != null && message.hasOwnProperty("proof_unreceived")) - if (!(message.proof_unreceived && typeof message.proof_unreceived.length === "number" || $util.isString(message.proof_unreceived))) - return "proof_unreceived: buffer expected"; - if (message.proof_close != null && message.hasOwnProperty("proof_close")) - if (!(message.proof_close && typeof message.proof_close.length === "number" || $util.isString(message.proof_close))) - return "proof_close: buffer expected"; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); - if (error) - return "proof_height." + error; - } - if (message.next_sequence_recv != null && message.hasOwnProperty("next_sequence_recv")) - if (!$util.isInteger(message.next_sequence_recv) && !(message.next_sequence_recv && $util.isInteger(message.next_sequence_recv.low) && $util.isInteger(message.next_sequence_recv.high))) - return "next_sequence_recv: integer|Long expected"; - if (message.signer != null && message.hasOwnProperty("signer")) - if (!$util.isString(message.signer)) - return "signer: string expected"; - return null; - }; - - /** - * Creates a MsgTimeoutOnClose message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.MsgTimeoutOnClose - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.MsgTimeoutOnClose} MsgTimeoutOnClose - */ - MsgTimeoutOnClose.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.MsgTimeoutOnClose) - return object; - let message = new $root.ibc.core.channel.v1.MsgTimeoutOnClose(); - if (object.packet != null) { - if (typeof object.packet !== "object") - throw TypeError(".ibc.core.channel.v1.MsgTimeoutOnClose.packet: object expected"); - message.packet = $root.ibc.core.channel.v1.Packet.fromObject(object.packet); - } - if (object.proof_unreceived != null) - if (typeof object.proof_unreceived === "string") - $util.base64.decode(object.proof_unreceived, message.proof_unreceived = $util.newBuffer($util.base64.length(object.proof_unreceived)), 0); - else if (object.proof_unreceived.length) - message.proof_unreceived = object.proof_unreceived; - if (object.proof_close != null) - if (typeof object.proof_close === "string") - $util.base64.decode(object.proof_close, message.proof_close = $util.newBuffer($util.base64.length(object.proof_close)), 0); - else if (object.proof_close.length) - message.proof_close = object.proof_close; - if (object.proof_height != null) { - if (typeof object.proof_height !== "object") - throw TypeError(".ibc.core.channel.v1.MsgTimeoutOnClose.proof_height: object expected"); - message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); - } - if (object.next_sequence_recv != null) - if ($util.Long) - (message.next_sequence_recv = $util.Long.fromValue(object.next_sequence_recv)).unsigned = true; - else if (typeof object.next_sequence_recv === "string") - message.next_sequence_recv = parseInt(object.next_sequence_recv, 10); - else if (typeof object.next_sequence_recv === "number") - message.next_sequence_recv = object.next_sequence_recv; - else if (typeof object.next_sequence_recv === "object") - message.next_sequence_recv = new $util.LongBits(object.next_sequence_recv.low >>> 0, object.next_sequence_recv.high >>> 0).toNumber(true); - if (object.signer != null) - message.signer = String(object.signer); - return message; - }; - - /** - * Creates a plain object from a MsgTimeoutOnClose message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.MsgTimeoutOnClose - * @static - * @param {ibc.core.channel.v1.MsgTimeoutOnClose} message MsgTimeoutOnClose - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgTimeoutOnClose.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.packet = null; - if (options.bytes === String) - object.proof_unreceived = ""; - else { - object.proof_unreceived = []; - if (options.bytes !== Array) - object.proof_unreceived = $util.newBuffer(object.proof_unreceived); - } - if (options.bytes === String) - object.proof_close = ""; - else { - object.proof_close = []; - if (options.bytes !== Array) - object.proof_close = $util.newBuffer(object.proof_close); - } - object.proof_height = null; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.next_sequence_recv = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.next_sequence_recv = options.longs === String ? "0" : 0; - object.signer = ""; - } - if (message.packet != null && message.hasOwnProperty("packet")) - object.packet = $root.ibc.core.channel.v1.Packet.toObject(message.packet, options); - if (message.proof_unreceived != null && message.hasOwnProperty("proof_unreceived")) - object.proof_unreceived = options.bytes === String ? $util.base64.encode(message.proof_unreceived, 0, message.proof_unreceived.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_unreceived) : message.proof_unreceived; - if (message.proof_close != null && message.hasOwnProperty("proof_close")) - object.proof_close = options.bytes === String ? $util.base64.encode(message.proof_close, 0, message.proof_close.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_close) : message.proof_close; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) - object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); - if (message.next_sequence_recv != null && message.hasOwnProperty("next_sequence_recv")) - if (typeof message.next_sequence_recv === "number") - object.next_sequence_recv = options.longs === String ? String(message.next_sequence_recv) : message.next_sequence_recv; - else - object.next_sequence_recv = options.longs === String ? $util.Long.prototype.toString.call(message.next_sequence_recv) : options.longs === Number ? new $util.LongBits(message.next_sequence_recv.low >>> 0, message.next_sequence_recv.high >>> 0).toNumber(true) : message.next_sequence_recv; - if (message.signer != null && message.hasOwnProperty("signer")) - object.signer = message.signer; - return object; - }; - - /** - * Converts this MsgTimeoutOnClose to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.MsgTimeoutOnClose - * @instance - * @returns {Object.} JSON object - */ - MsgTimeoutOnClose.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgTimeoutOnClose; - })(); - - v1.MsgTimeoutOnCloseResponse = (function() { - - /** - * Properties of a MsgTimeoutOnCloseResponse. - * @memberof ibc.core.channel.v1 - * @interface IMsgTimeoutOnCloseResponse - */ - - /** - * Constructs a new MsgTimeoutOnCloseResponse. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a MsgTimeoutOnCloseResponse. - * @implements IMsgTimeoutOnCloseResponse - * @constructor - * @param {ibc.core.channel.v1.IMsgTimeoutOnCloseResponse=} [properties] Properties to set - */ - function MsgTimeoutOnCloseResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgTimeoutOnCloseResponse message. Does not implicitly {@link ibc.core.channel.v1.MsgTimeoutOnCloseResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.MsgTimeoutOnCloseResponse - * @static - * @param {ibc.core.channel.v1.IMsgTimeoutOnCloseResponse} message MsgTimeoutOnCloseResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgTimeoutOnCloseResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgTimeoutOnCloseResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgTimeoutOnCloseResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.MsgTimeoutOnCloseResponse - * @static - * @param {ibc.core.channel.v1.IMsgTimeoutOnCloseResponse} message MsgTimeoutOnCloseResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgTimeoutOnCloseResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgTimeoutOnCloseResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.MsgTimeoutOnCloseResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.MsgTimeoutOnCloseResponse} MsgTimeoutOnCloseResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgTimeoutOnCloseResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgTimeoutOnCloseResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgTimeoutOnCloseResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.MsgTimeoutOnCloseResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.MsgTimeoutOnCloseResponse} MsgTimeoutOnCloseResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgTimeoutOnCloseResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgTimeoutOnCloseResponse message. - * @function verify - * @memberof ibc.core.channel.v1.MsgTimeoutOnCloseResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgTimeoutOnCloseResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgTimeoutOnCloseResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.MsgTimeoutOnCloseResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.MsgTimeoutOnCloseResponse} MsgTimeoutOnCloseResponse - */ - MsgTimeoutOnCloseResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.MsgTimeoutOnCloseResponse) - return object; - return new $root.ibc.core.channel.v1.MsgTimeoutOnCloseResponse(); - }; - - /** - * Creates a plain object from a MsgTimeoutOnCloseResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.MsgTimeoutOnCloseResponse - * @static - * @param {ibc.core.channel.v1.MsgTimeoutOnCloseResponse} message MsgTimeoutOnCloseResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgTimeoutOnCloseResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgTimeoutOnCloseResponse to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.MsgTimeoutOnCloseResponse - * @instance - * @returns {Object.} JSON object - */ - MsgTimeoutOnCloseResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgTimeoutOnCloseResponse; - })(); - - v1.MsgAcknowledgement = (function() { - - /** - * Properties of a MsgAcknowledgement. - * @memberof ibc.core.channel.v1 - * @interface IMsgAcknowledgement - * @property {ibc.core.channel.v1.IPacket|null} [packet] MsgAcknowledgement packet - * @property {Uint8Array|null} [acknowledgement] MsgAcknowledgement acknowledgement - * @property {Uint8Array|null} [proof_acked] MsgAcknowledgement proof_acked - * @property {ibc.core.client.v1.IHeight|null} [proof_height] MsgAcknowledgement proof_height - * @property {string|null} [signer] MsgAcknowledgement signer - */ - - /** - * Constructs a new MsgAcknowledgement. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a MsgAcknowledgement. - * @implements IMsgAcknowledgement - * @constructor - * @param {ibc.core.channel.v1.IMsgAcknowledgement=} [properties] Properties to set - */ - function MsgAcknowledgement(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgAcknowledgement packet. - * @member {ibc.core.channel.v1.IPacket|null|undefined} packet - * @memberof ibc.core.channel.v1.MsgAcknowledgement - * @instance - */ - MsgAcknowledgement.prototype.packet = null; - - /** - * MsgAcknowledgement acknowledgement. - * @member {Uint8Array} acknowledgement - * @memberof ibc.core.channel.v1.MsgAcknowledgement - * @instance - */ - MsgAcknowledgement.prototype.acknowledgement = $util.newBuffer([]); - - /** - * MsgAcknowledgement proof_acked. - * @member {Uint8Array} proof_acked - * @memberof ibc.core.channel.v1.MsgAcknowledgement - * @instance - */ - MsgAcknowledgement.prototype.proof_acked = $util.newBuffer([]); - - /** - * MsgAcknowledgement proof_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height - * @memberof ibc.core.channel.v1.MsgAcknowledgement - * @instance - */ - MsgAcknowledgement.prototype.proof_height = null; - - /** - * MsgAcknowledgement signer. - * @member {string} signer - * @memberof ibc.core.channel.v1.MsgAcknowledgement - * @instance - */ - MsgAcknowledgement.prototype.signer = ""; - - /** - * Encodes the specified MsgAcknowledgement message. Does not implicitly {@link ibc.core.channel.v1.MsgAcknowledgement.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.MsgAcknowledgement - * @static - * @param {ibc.core.channel.v1.IMsgAcknowledgement} message MsgAcknowledgement message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgAcknowledgement.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.packet != null && Object.hasOwnProperty.call(message, "packet")) - $root.ibc.core.channel.v1.Packet.encode(message.packet, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.acknowledgement != null && Object.hasOwnProperty.call(message, "acknowledgement")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.acknowledgement); - if (message.proof_acked != null && Object.hasOwnProperty.call(message, "proof_acked")) - writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.proof_acked); - if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) - $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.signer); - return writer; - }; - - /** - * Encodes the specified MsgAcknowledgement message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgAcknowledgement.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.MsgAcknowledgement - * @static - * @param {ibc.core.channel.v1.IMsgAcknowledgement} message MsgAcknowledgement message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgAcknowledgement.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgAcknowledgement message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.MsgAcknowledgement - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.MsgAcknowledgement} MsgAcknowledgement - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgAcknowledgement.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgAcknowledgement(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.packet = $root.ibc.core.channel.v1.Packet.decode(reader, reader.uint32()); - break; - case 2: - message.acknowledgement = reader.bytes(); - break; - case 3: - message.proof_acked = reader.bytes(); - break; - case 4: - message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - case 5: - message.signer = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgAcknowledgement message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.MsgAcknowledgement - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.MsgAcknowledgement} MsgAcknowledgement - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgAcknowledgement.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgAcknowledgement message. - * @function verify - * @memberof ibc.core.channel.v1.MsgAcknowledgement - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgAcknowledgement.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.packet != null && message.hasOwnProperty("packet")) { - let error = $root.ibc.core.channel.v1.Packet.verify(message.packet); - if (error) - return "packet." + error; - } - if (message.acknowledgement != null && message.hasOwnProperty("acknowledgement")) - if (!(message.acknowledgement && typeof message.acknowledgement.length === "number" || $util.isString(message.acknowledgement))) - return "acknowledgement: buffer expected"; - if (message.proof_acked != null && message.hasOwnProperty("proof_acked")) - if (!(message.proof_acked && typeof message.proof_acked.length === "number" || $util.isString(message.proof_acked))) - return "proof_acked: buffer expected"; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); - if (error) - return "proof_height." + error; - } - if (message.signer != null && message.hasOwnProperty("signer")) - if (!$util.isString(message.signer)) - return "signer: string expected"; - return null; - }; - - /** - * Creates a MsgAcknowledgement message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.MsgAcknowledgement - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.MsgAcknowledgement} MsgAcknowledgement - */ - MsgAcknowledgement.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.MsgAcknowledgement) - return object; - let message = new $root.ibc.core.channel.v1.MsgAcknowledgement(); - if (object.packet != null) { - if (typeof object.packet !== "object") - throw TypeError(".ibc.core.channel.v1.MsgAcknowledgement.packet: object expected"); - message.packet = $root.ibc.core.channel.v1.Packet.fromObject(object.packet); - } - if (object.acknowledgement != null) - if (typeof object.acknowledgement === "string") - $util.base64.decode(object.acknowledgement, message.acknowledgement = $util.newBuffer($util.base64.length(object.acknowledgement)), 0); - else if (object.acknowledgement.length) - message.acknowledgement = object.acknowledgement; - if (object.proof_acked != null) - if (typeof object.proof_acked === "string") - $util.base64.decode(object.proof_acked, message.proof_acked = $util.newBuffer($util.base64.length(object.proof_acked)), 0); - else if (object.proof_acked.length) - message.proof_acked = object.proof_acked; - if (object.proof_height != null) { - if (typeof object.proof_height !== "object") - throw TypeError(".ibc.core.channel.v1.MsgAcknowledgement.proof_height: object expected"); - message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); - } - if (object.signer != null) - message.signer = String(object.signer); - return message; - }; - - /** - * Creates a plain object from a MsgAcknowledgement message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.MsgAcknowledgement - * @static - * @param {ibc.core.channel.v1.MsgAcknowledgement} message MsgAcknowledgement - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgAcknowledgement.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.packet = null; - if (options.bytes === String) - object.acknowledgement = ""; - else { - object.acknowledgement = []; - if (options.bytes !== Array) - object.acknowledgement = $util.newBuffer(object.acknowledgement); - } - if (options.bytes === String) - object.proof_acked = ""; - else { - object.proof_acked = []; - if (options.bytes !== Array) - object.proof_acked = $util.newBuffer(object.proof_acked); - } - object.proof_height = null; - object.signer = ""; - } - if (message.packet != null && message.hasOwnProperty("packet")) - object.packet = $root.ibc.core.channel.v1.Packet.toObject(message.packet, options); - if (message.acknowledgement != null && message.hasOwnProperty("acknowledgement")) - object.acknowledgement = options.bytes === String ? $util.base64.encode(message.acknowledgement, 0, message.acknowledgement.length) : options.bytes === Array ? Array.prototype.slice.call(message.acknowledgement) : message.acknowledgement; - if (message.proof_acked != null && message.hasOwnProperty("proof_acked")) - object.proof_acked = options.bytes === String ? $util.base64.encode(message.proof_acked, 0, message.proof_acked.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_acked) : message.proof_acked; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) - object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); - if (message.signer != null && message.hasOwnProperty("signer")) - object.signer = message.signer; - return object; - }; - - /** - * Converts this MsgAcknowledgement to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.MsgAcknowledgement - * @instance - * @returns {Object.} JSON object - */ - MsgAcknowledgement.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgAcknowledgement; - })(); - - v1.MsgAcknowledgementResponse = (function() { - - /** - * Properties of a MsgAcknowledgementResponse. - * @memberof ibc.core.channel.v1 - * @interface IMsgAcknowledgementResponse - */ - - /** - * Constructs a new MsgAcknowledgementResponse. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a MsgAcknowledgementResponse. - * @implements IMsgAcknowledgementResponse - * @constructor - * @param {ibc.core.channel.v1.IMsgAcknowledgementResponse=} [properties] Properties to set - */ - function MsgAcknowledgementResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgAcknowledgementResponse message. Does not implicitly {@link ibc.core.channel.v1.MsgAcknowledgementResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.MsgAcknowledgementResponse - * @static - * @param {ibc.core.channel.v1.IMsgAcknowledgementResponse} message MsgAcknowledgementResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgAcknowledgementResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgAcknowledgementResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.MsgAcknowledgementResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.MsgAcknowledgementResponse - * @static - * @param {ibc.core.channel.v1.IMsgAcknowledgementResponse} message MsgAcknowledgementResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgAcknowledgementResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgAcknowledgementResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.MsgAcknowledgementResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.MsgAcknowledgementResponse} MsgAcknowledgementResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgAcknowledgementResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.MsgAcknowledgementResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgAcknowledgementResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.MsgAcknowledgementResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.MsgAcknowledgementResponse} MsgAcknowledgementResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgAcknowledgementResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgAcknowledgementResponse message. - * @function verify - * @memberof ibc.core.channel.v1.MsgAcknowledgementResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgAcknowledgementResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgAcknowledgementResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.MsgAcknowledgementResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.MsgAcknowledgementResponse} MsgAcknowledgementResponse - */ - MsgAcknowledgementResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.MsgAcknowledgementResponse) - return object; - return new $root.ibc.core.channel.v1.MsgAcknowledgementResponse(); - }; - - /** - * Creates a plain object from a MsgAcknowledgementResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.MsgAcknowledgementResponse - * @static - * @param {ibc.core.channel.v1.MsgAcknowledgementResponse} message MsgAcknowledgementResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgAcknowledgementResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgAcknowledgementResponse to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.MsgAcknowledgementResponse - * @instance - * @returns {Object.} JSON object - */ - MsgAcknowledgementResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgAcknowledgementResponse; - })(); - - v1.Query = (function() { - - /** - * Constructs a new Query service. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a Query - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function Query(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Query.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Query; - - /** - * Callback as used by {@link ibc.core.channel.v1.Query#channel}. - * @memberof ibc.core.channel.v1.Query - * @typedef ChannelCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.channel.v1.QueryChannelResponse} [response] QueryChannelResponse - */ - - /** - * Calls Channel. - * @function channel - * @memberof ibc.core.channel.v1.Query - * @instance - * @param {ibc.core.channel.v1.IQueryChannelRequest} request QueryChannelRequest message or plain object - * @param {ibc.core.channel.v1.Query.ChannelCallback} callback Node-style callback called with the error, if any, and QueryChannelResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.channel = function channel(request, callback) { - return this.rpcCall(channel, $root.ibc.core.channel.v1.QueryChannelRequest, $root.ibc.core.channel.v1.QueryChannelResponse, request, callback); - }, "name", { value: "Channel" }); - - /** - * Calls Channel. - * @function channel - * @memberof ibc.core.channel.v1.Query - * @instance - * @param {ibc.core.channel.v1.IQueryChannelRequest} request QueryChannelRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.channel.v1.Query#channels}. - * @memberof ibc.core.channel.v1.Query - * @typedef ChannelsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.channel.v1.QueryChannelsResponse} [response] QueryChannelsResponse - */ - - /** - * Calls Channels. - * @function channels - * @memberof ibc.core.channel.v1.Query - * @instance - * @param {ibc.core.channel.v1.IQueryChannelsRequest} request QueryChannelsRequest message or plain object - * @param {ibc.core.channel.v1.Query.ChannelsCallback} callback Node-style callback called with the error, if any, and QueryChannelsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.channels = function channels(request, callback) { - return this.rpcCall(channels, $root.ibc.core.channel.v1.QueryChannelsRequest, $root.ibc.core.channel.v1.QueryChannelsResponse, request, callback); - }, "name", { value: "Channels" }); - - /** - * Calls Channels. - * @function channels - * @memberof ibc.core.channel.v1.Query - * @instance - * @param {ibc.core.channel.v1.IQueryChannelsRequest} request QueryChannelsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.channel.v1.Query#connectionChannels}. - * @memberof ibc.core.channel.v1.Query - * @typedef ConnectionChannelsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.channel.v1.QueryConnectionChannelsResponse} [response] QueryConnectionChannelsResponse - */ - - /** - * Calls ConnectionChannels. - * @function connectionChannels - * @memberof ibc.core.channel.v1.Query - * @instance - * @param {ibc.core.channel.v1.IQueryConnectionChannelsRequest} request QueryConnectionChannelsRequest message or plain object - * @param {ibc.core.channel.v1.Query.ConnectionChannelsCallback} callback Node-style callback called with the error, if any, and QueryConnectionChannelsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.connectionChannels = function connectionChannels(request, callback) { - return this.rpcCall(connectionChannels, $root.ibc.core.channel.v1.QueryConnectionChannelsRequest, $root.ibc.core.channel.v1.QueryConnectionChannelsResponse, request, callback); - }, "name", { value: "ConnectionChannels" }); - - /** - * Calls ConnectionChannels. - * @function connectionChannels - * @memberof ibc.core.channel.v1.Query - * @instance - * @param {ibc.core.channel.v1.IQueryConnectionChannelsRequest} request QueryConnectionChannelsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.channel.v1.Query#channelClientState}. - * @memberof ibc.core.channel.v1.Query - * @typedef ChannelClientStateCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.channel.v1.QueryChannelClientStateResponse} [response] QueryChannelClientStateResponse - */ - - /** - * Calls ChannelClientState. - * @function channelClientState - * @memberof ibc.core.channel.v1.Query - * @instance - * @param {ibc.core.channel.v1.IQueryChannelClientStateRequest} request QueryChannelClientStateRequest message or plain object - * @param {ibc.core.channel.v1.Query.ChannelClientStateCallback} callback Node-style callback called with the error, if any, and QueryChannelClientStateResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.channelClientState = function channelClientState(request, callback) { - return this.rpcCall(channelClientState, $root.ibc.core.channel.v1.QueryChannelClientStateRequest, $root.ibc.core.channel.v1.QueryChannelClientStateResponse, request, callback); - }, "name", { value: "ChannelClientState" }); - - /** - * Calls ChannelClientState. - * @function channelClientState - * @memberof ibc.core.channel.v1.Query - * @instance - * @param {ibc.core.channel.v1.IQueryChannelClientStateRequest} request QueryChannelClientStateRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.channel.v1.Query#channelConsensusState}. - * @memberof ibc.core.channel.v1.Query - * @typedef ChannelConsensusStateCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.channel.v1.QueryChannelConsensusStateResponse} [response] QueryChannelConsensusStateResponse - */ - - /** - * Calls ChannelConsensusState. - * @function channelConsensusState - * @memberof ibc.core.channel.v1.Query - * @instance - * @param {ibc.core.channel.v1.IQueryChannelConsensusStateRequest} request QueryChannelConsensusStateRequest message or plain object - * @param {ibc.core.channel.v1.Query.ChannelConsensusStateCallback} callback Node-style callback called with the error, if any, and QueryChannelConsensusStateResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.channelConsensusState = function channelConsensusState(request, callback) { - return this.rpcCall(channelConsensusState, $root.ibc.core.channel.v1.QueryChannelConsensusStateRequest, $root.ibc.core.channel.v1.QueryChannelConsensusStateResponse, request, callback); - }, "name", { value: "ChannelConsensusState" }); - - /** - * Calls ChannelConsensusState. - * @function channelConsensusState - * @memberof ibc.core.channel.v1.Query - * @instance - * @param {ibc.core.channel.v1.IQueryChannelConsensusStateRequest} request QueryChannelConsensusStateRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.channel.v1.Query#packetCommitment}. - * @memberof ibc.core.channel.v1.Query - * @typedef PacketCommitmentCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.channel.v1.QueryPacketCommitmentResponse} [response] QueryPacketCommitmentResponse - */ - - /** - * Calls PacketCommitment. - * @function packetCommitment - * @memberof ibc.core.channel.v1.Query - * @instance - * @param {ibc.core.channel.v1.IQueryPacketCommitmentRequest} request QueryPacketCommitmentRequest message or plain object - * @param {ibc.core.channel.v1.Query.PacketCommitmentCallback} callback Node-style callback called with the error, if any, and QueryPacketCommitmentResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.packetCommitment = function packetCommitment(request, callback) { - return this.rpcCall(packetCommitment, $root.ibc.core.channel.v1.QueryPacketCommitmentRequest, $root.ibc.core.channel.v1.QueryPacketCommitmentResponse, request, callback); - }, "name", { value: "PacketCommitment" }); - - /** - * Calls PacketCommitment. - * @function packetCommitment - * @memberof ibc.core.channel.v1.Query - * @instance - * @param {ibc.core.channel.v1.IQueryPacketCommitmentRequest} request QueryPacketCommitmentRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.channel.v1.Query#packetCommitments}. - * @memberof ibc.core.channel.v1.Query - * @typedef PacketCommitmentsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.channel.v1.QueryPacketCommitmentsResponse} [response] QueryPacketCommitmentsResponse - */ - - /** - * Calls PacketCommitments. - * @function packetCommitments - * @memberof ibc.core.channel.v1.Query - * @instance - * @param {ibc.core.channel.v1.IQueryPacketCommitmentsRequest} request QueryPacketCommitmentsRequest message or plain object - * @param {ibc.core.channel.v1.Query.PacketCommitmentsCallback} callback Node-style callback called with the error, if any, and QueryPacketCommitmentsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.packetCommitments = function packetCommitments(request, callback) { - return this.rpcCall(packetCommitments, $root.ibc.core.channel.v1.QueryPacketCommitmentsRequest, $root.ibc.core.channel.v1.QueryPacketCommitmentsResponse, request, callback); - }, "name", { value: "PacketCommitments" }); - - /** - * Calls PacketCommitments. - * @function packetCommitments - * @memberof ibc.core.channel.v1.Query - * @instance - * @param {ibc.core.channel.v1.IQueryPacketCommitmentsRequest} request QueryPacketCommitmentsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.channel.v1.Query#packetReceipt}. - * @memberof ibc.core.channel.v1.Query - * @typedef PacketReceiptCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.channel.v1.QueryPacketReceiptResponse} [response] QueryPacketReceiptResponse - */ - - /** - * Calls PacketReceipt. - * @function packetReceipt - * @memberof ibc.core.channel.v1.Query - * @instance - * @param {ibc.core.channel.v1.IQueryPacketReceiptRequest} request QueryPacketReceiptRequest message or plain object - * @param {ibc.core.channel.v1.Query.PacketReceiptCallback} callback Node-style callback called with the error, if any, and QueryPacketReceiptResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.packetReceipt = function packetReceipt(request, callback) { - return this.rpcCall(packetReceipt, $root.ibc.core.channel.v1.QueryPacketReceiptRequest, $root.ibc.core.channel.v1.QueryPacketReceiptResponse, request, callback); - }, "name", { value: "PacketReceipt" }); - - /** - * Calls PacketReceipt. - * @function packetReceipt - * @memberof ibc.core.channel.v1.Query - * @instance - * @param {ibc.core.channel.v1.IQueryPacketReceiptRequest} request QueryPacketReceiptRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.channel.v1.Query#packetAcknowledgement}. - * @memberof ibc.core.channel.v1.Query - * @typedef PacketAcknowledgementCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.channel.v1.QueryPacketAcknowledgementResponse} [response] QueryPacketAcknowledgementResponse - */ - - /** - * Calls PacketAcknowledgement. - * @function packetAcknowledgement - * @memberof ibc.core.channel.v1.Query - * @instance - * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementRequest} request QueryPacketAcknowledgementRequest message or plain object - * @param {ibc.core.channel.v1.Query.PacketAcknowledgementCallback} callback Node-style callback called with the error, if any, and QueryPacketAcknowledgementResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.packetAcknowledgement = function packetAcknowledgement(request, callback) { - return this.rpcCall(packetAcknowledgement, $root.ibc.core.channel.v1.QueryPacketAcknowledgementRequest, $root.ibc.core.channel.v1.QueryPacketAcknowledgementResponse, request, callback); - }, "name", { value: "PacketAcknowledgement" }); - - /** - * Calls PacketAcknowledgement. - * @function packetAcknowledgement - * @memberof ibc.core.channel.v1.Query - * @instance - * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementRequest} request QueryPacketAcknowledgementRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.channel.v1.Query#packetAcknowledgements}. - * @memberof ibc.core.channel.v1.Query - * @typedef PacketAcknowledgementsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.channel.v1.QueryPacketAcknowledgementsResponse} [response] QueryPacketAcknowledgementsResponse - */ - - /** - * Calls PacketAcknowledgements. - * @function packetAcknowledgements - * @memberof ibc.core.channel.v1.Query - * @instance - * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementsRequest} request QueryPacketAcknowledgementsRequest message or plain object - * @param {ibc.core.channel.v1.Query.PacketAcknowledgementsCallback} callback Node-style callback called with the error, if any, and QueryPacketAcknowledgementsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.packetAcknowledgements = function packetAcknowledgements(request, callback) { - return this.rpcCall(packetAcknowledgements, $root.ibc.core.channel.v1.QueryPacketAcknowledgementsRequest, $root.ibc.core.channel.v1.QueryPacketAcknowledgementsResponse, request, callback); - }, "name", { value: "PacketAcknowledgements" }); - - /** - * Calls PacketAcknowledgements. - * @function packetAcknowledgements - * @memberof ibc.core.channel.v1.Query - * @instance - * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementsRequest} request QueryPacketAcknowledgementsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.channel.v1.Query#unreceivedPackets}. - * @memberof ibc.core.channel.v1.Query - * @typedef UnreceivedPacketsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.channel.v1.QueryUnreceivedPacketsResponse} [response] QueryUnreceivedPacketsResponse - */ - - /** - * Calls UnreceivedPackets. - * @function unreceivedPackets - * @memberof ibc.core.channel.v1.Query - * @instance - * @param {ibc.core.channel.v1.IQueryUnreceivedPacketsRequest} request QueryUnreceivedPacketsRequest message or plain object - * @param {ibc.core.channel.v1.Query.UnreceivedPacketsCallback} callback Node-style callback called with the error, if any, and QueryUnreceivedPacketsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.unreceivedPackets = function unreceivedPackets(request, callback) { - return this.rpcCall(unreceivedPackets, $root.ibc.core.channel.v1.QueryUnreceivedPacketsRequest, $root.ibc.core.channel.v1.QueryUnreceivedPacketsResponse, request, callback); - }, "name", { value: "UnreceivedPackets" }); - - /** - * Calls UnreceivedPackets. - * @function unreceivedPackets - * @memberof ibc.core.channel.v1.Query - * @instance - * @param {ibc.core.channel.v1.IQueryUnreceivedPacketsRequest} request QueryUnreceivedPacketsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.channel.v1.Query#unreceivedAcks}. - * @memberof ibc.core.channel.v1.Query - * @typedef UnreceivedAcksCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.channel.v1.QueryUnreceivedAcksResponse} [response] QueryUnreceivedAcksResponse - */ - - /** - * Calls UnreceivedAcks. - * @function unreceivedAcks - * @memberof ibc.core.channel.v1.Query - * @instance - * @param {ibc.core.channel.v1.IQueryUnreceivedAcksRequest} request QueryUnreceivedAcksRequest message or plain object - * @param {ibc.core.channel.v1.Query.UnreceivedAcksCallback} callback Node-style callback called with the error, if any, and QueryUnreceivedAcksResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.unreceivedAcks = function unreceivedAcks(request, callback) { - return this.rpcCall(unreceivedAcks, $root.ibc.core.channel.v1.QueryUnreceivedAcksRequest, $root.ibc.core.channel.v1.QueryUnreceivedAcksResponse, request, callback); - }, "name", { value: "UnreceivedAcks" }); - - /** - * Calls UnreceivedAcks. - * @function unreceivedAcks - * @memberof ibc.core.channel.v1.Query - * @instance - * @param {ibc.core.channel.v1.IQueryUnreceivedAcksRequest} request QueryUnreceivedAcksRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.channel.v1.Query#nextSequenceReceive}. - * @memberof ibc.core.channel.v1.Query - * @typedef NextSequenceReceiveCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.channel.v1.QueryNextSequenceReceiveResponse} [response] QueryNextSequenceReceiveResponse - */ - - /** - * Calls NextSequenceReceive. - * @function nextSequenceReceive - * @memberof ibc.core.channel.v1.Query - * @instance - * @param {ibc.core.channel.v1.IQueryNextSequenceReceiveRequest} request QueryNextSequenceReceiveRequest message or plain object - * @param {ibc.core.channel.v1.Query.NextSequenceReceiveCallback} callback Node-style callback called with the error, if any, and QueryNextSequenceReceiveResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.nextSequenceReceive = function nextSequenceReceive(request, callback) { - return this.rpcCall(nextSequenceReceive, $root.ibc.core.channel.v1.QueryNextSequenceReceiveRequest, $root.ibc.core.channel.v1.QueryNextSequenceReceiveResponse, request, callback); - }, "name", { value: "NextSequenceReceive" }); - - /** - * Calls NextSequenceReceive. - * @function nextSequenceReceive - * @memberof ibc.core.channel.v1.Query - * @instance - * @param {ibc.core.channel.v1.IQueryNextSequenceReceiveRequest} request QueryNextSequenceReceiveRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return Query; - })(); - - v1.QueryChannelRequest = (function() { - - /** - * Properties of a QueryChannelRequest. - * @memberof ibc.core.channel.v1 - * @interface IQueryChannelRequest - * @property {string|null} [port_id] QueryChannelRequest port_id - * @property {string|null} [channel_id] QueryChannelRequest channel_id - */ - - /** - * Constructs a new QueryChannelRequest. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a QueryChannelRequest. - * @implements IQueryChannelRequest - * @constructor - * @param {ibc.core.channel.v1.IQueryChannelRequest=} [properties] Properties to set - */ - function QueryChannelRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryChannelRequest port_id. - * @member {string} port_id - * @memberof ibc.core.channel.v1.QueryChannelRequest - * @instance - */ - QueryChannelRequest.prototype.port_id = ""; - - /** - * QueryChannelRequest channel_id. - * @member {string} channel_id - * @memberof ibc.core.channel.v1.QueryChannelRequest - * @instance - */ - QueryChannelRequest.prototype.channel_id = ""; - - /** - * Encodes the specified QueryChannelRequest message. Does not implicitly {@link ibc.core.channel.v1.QueryChannelRequest.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.QueryChannelRequest - * @static - * @param {ibc.core.channel.v1.IQueryChannelRequest} message QueryChannelRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryChannelRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); - if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); - return writer; - }; - - /** - * Encodes the specified QueryChannelRequest message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryChannelRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.QueryChannelRequest - * @static - * @param {ibc.core.channel.v1.IQueryChannelRequest} message QueryChannelRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryChannelRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryChannelRequest message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.QueryChannelRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.QueryChannelRequest} QueryChannelRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryChannelRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryChannelRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.port_id = reader.string(); - break; - case 2: - message.channel_id = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryChannelRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.QueryChannelRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.QueryChannelRequest} QueryChannelRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryChannelRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryChannelRequest message. - * @function verify - * @memberof ibc.core.channel.v1.QueryChannelRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryChannelRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.port_id != null && message.hasOwnProperty("port_id")) - if (!$util.isString(message.port_id)) - return "port_id: string expected"; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - if (!$util.isString(message.channel_id)) - return "channel_id: string expected"; - return null; - }; - - /** - * Creates a QueryChannelRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.QueryChannelRequest - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.QueryChannelRequest} QueryChannelRequest - */ - QueryChannelRequest.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.QueryChannelRequest) - return object; - let message = new $root.ibc.core.channel.v1.QueryChannelRequest(); - if (object.port_id != null) - message.port_id = String(object.port_id); - if (object.channel_id != null) - message.channel_id = String(object.channel_id); - return message; - }; - - /** - * Creates a plain object from a QueryChannelRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.QueryChannelRequest - * @static - * @param {ibc.core.channel.v1.QueryChannelRequest} message QueryChannelRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryChannelRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.port_id = ""; - object.channel_id = ""; - } - if (message.port_id != null && message.hasOwnProperty("port_id")) - object.port_id = message.port_id; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - object.channel_id = message.channel_id; - return object; - }; - - /** - * Converts this QueryChannelRequest to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.QueryChannelRequest - * @instance - * @returns {Object.} JSON object - */ - QueryChannelRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryChannelRequest; - })(); - - v1.QueryChannelResponse = (function() { - - /** - * Properties of a QueryChannelResponse. - * @memberof ibc.core.channel.v1 - * @interface IQueryChannelResponse - * @property {ibc.core.channel.v1.IChannel|null} [channel] QueryChannelResponse channel - * @property {Uint8Array|null} [proof] QueryChannelResponse proof - * @property {ibc.core.client.v1.IHeight|null} [proof_height] QueryChannelResponse proof_height - */ - - /** - * Constructs a new QueryChannelResponse. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a QueryChannelResponse. - * @implements IQueryChannelResponse - * @constructor - * @param {ibc.core.channel.v1.IQueryChannelResponse=} [properties] Properties to set - */ - function QueryChannelResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryChannelResponse channel. - * @member {ibc.core.channel.v1.IChannel|null|undefined} channel - * @memberof ibc.core.channel.v1.QueryChannelResponse - * @instance - */ - QueryChannelResponse.prototype.channel = null; - - /** - * QueryChannelResponse proof. - * @member {Uint8Array} proof - * @memberof ibc.core.channel.v1.QueryChannelResponse - * @instance - */ - QueryChannelResponse.prototype.proof = $util.newBuffer([]); - - /** - * QueryChannelResponse proof_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height - * @memberof ibc.core.channel.v1.QueryChannelResponse - * @instance - */ - QueryChannelResponse.prototype.proof_height = null; - - /** - * Encodes the specified QueryChannelResponse message. Does not implicitly {@link ibc.core.channel.v1.QueryChannelResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.QueryChannelResponse - * @static - * @param {ibc.core.channel.v1.IQueryChannelResponse} message QueryChannelResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryChannelResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.channel != null && Object.hasOwnProperty.call(message, "channel")) - $root.ibc.core.channel.v1.Channel.encode(message.channel, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proof); - if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) - $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryChannelResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryChannelResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.QueryChannelResponse - * @static - * @param {ibc.core.channel.v1.IQueryChannelResponse} message QueryChannelResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryChannelResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryChannelResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.QueryChannelResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.QueryChannelResponse} QueryChannelResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryChannelResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryChannelResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.channel = $root.ibc.core.channel.v1.Channel.decode(reader, reader.uint32()); - break; - case 2: - message.proof = reader.bytes(); - break; - case 3: - message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryChannelResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.QueryChannelResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.QueryChannelResponse} QueryChannelResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryChannelResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryChannelResponse message. - * @function verify - * @memberof ibc.core.channel.v1.QueryChannelResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryChannelResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.channel != null && message.hasOwnProperty("channel")) { - let error = $root.ibc.core.channel.v1.Channel.verify(message.channel); - if (error) - return "channel." + error; - } - if (message.proof != null && message.hasOwnProperty("proof")) - if (!(message.proof && typeof message.proof.length === "number" || $util.isString(message.proof))) - return "proof: buffer expected"; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); - if (error) - return "proof_height." + error; - } - return null; - }; - - /** - * Creates a QueryChannelResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.QueryChannelResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.QueryChannelResponse} QueryChannelResponse - */ - QueryChannelResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.QueryChannelResponse) - return object; - let message = new $root.ibc.core.channel.v1.QueryChannelResponse(); - if (object.channel != null) { - if (typeof object.channel !== "object") - throw TypeError(".ibc.core.channel.v1.QueryChannelResponse.channel: object expected"); - message.channel = $root.ibc.core.channel.v1.Channel.fromObject(object.channel); - } - if (object.proof != null) - if (typeof object.proof === "string") - $util.base64.decode(object.proof, message.proof = $util.newBuffer($util.base64.length(object.proof)), 0); - else if (object.proof.length) - message.proof = object.proof; - if (object.proof_height != null) { - if (typeof object.proof_height !== "object") - throw TypeError(".ibc.core.channel.v1.QueryChannelResponse.proof_height: object expected"); - message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); - } - return message; - }; - - /** - * Creates a plain object from a QueryChannelResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.QueryChannelResponse - * @static - * @param {ibc.core.channel.v1.QueryChannelResponse} message QueryChannelResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryChannelResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.channel = null; - if (options.bytes === String) - object.proof = ""; - else { - object.proof = []; - if (options.bytes !== Array) - object.proof = $util.newBuffer(object.proof); - } - object.proof_height = null; - } - if (message.channel != null && message.hasOwnProperty("channel")) - object.channel = $root.ibc.core.channel.v1.Channel.toObject(message.channel, options); - if (message.proof != null && message.hasOwnProperty("proof")) - object.proof = options.bytes === String ? $util.base64.encode(message.proof, 0, message.proof.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof) : message.proof; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) - object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); - return object; - }; - - /** - * Converts this QueryChannelResponse to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.QueryChannelResponse - * @instance - * @returns {Object.} JSON object - */ - QueryChannelResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryChannelResponse; - })(); - - v1.QueryChannelsRequest = (function() { - - /** - * Properties of a QueryChannelsRequest. - * @memberof ibc.core.channel.v1 - * @interface IQueryChannelsRequest - * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryChannelsRequest pagination - */ - - /** - * Constructs a new QueryChannelsRequest. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a QueryChannelsRequest. - * @implements IQueryChannelsRequest - * @constructor - * @param {ibc.core.channel.v1.IQueryChannelsRequest=} [properties] Properties to set - */ - function QueryChannelsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryChannelsRequest pagination. - * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination - * @memberof ibc.core.channel.v1.QueryChannelsRequest - * @instance - */ - QueryChannelsRequest.prototype.pagination = null; - - /** - * Encodes the specified QueryChannelsRequest message. Does not implicitly {@link ibc.core.channel.v1.QueryChannelsRequest.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.QueryChannelsRequest - * @static - * @param {ibc.core.channel.v1.IQueryChannelsRequest} message QueryChannelsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryChannelsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryChannelsRequest message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryChannelsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.QueryChannelsRequest - * @static - * @param {ibc.core.channel.v1.IQueryChannelsRequest} message QueryChannelsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryChannelsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryChannelsRequest message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.QueryChannelsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.QueryChannelsRequest} QueryChannelsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryChannelsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryChannelsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryChannelsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.QueryChannelsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.QueryChannelsRequest} QueryChannelsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryChannelsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryChannelsRequest message. - * @function verify - * @memberof ibc.core.channel.v1.QueryChannelsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryChannelsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryChannelsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.QueryChannelsRequest - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.QueryChannelsRequest} QueryChannelsRequest - */ - QueryChannelsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.QueryChannelsRequest) - return object; - let message = new $root.ibc.core.channel.v1.QueryChannelsRequest(); - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".ibc.core.channel.v1.QueryChannelsRequest.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryChannelsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.QueryChannelsRequest - * @static - * @param {ibc.core.channel.v1.QueryChannelsRequest} message QueryChannelsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryChannelsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.pagination = null; - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryChannelsRequest to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.QueryChannelsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryChannelsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryChannelsRequest; - })(); - - v1.QueryChannelsResponse = (function() { - - /** - * Properties of a QueryChannelsResponse. - * @memberof ibc.core.channel.v1 - * @interface IQueryChannelsResponse - * @property {Array.|null} [channels] QueryChannelsResponse channels - * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryChannelsResponse pagination - * @property {ibc.core.client.v1.IHeight|null} [height] QueryChannelsResponse height - */ - - /** - * Constructs a new QueryChannelsResponse. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a QueryChannelsResponse. - * @implements IQueryChannelsResponse - * @constructor - * @param {ibc.core.channel.v1.IQueryChannelsResponse=} [properties] Properties to set - */ - function QueryChannelsResponse(properties) { - this.channels = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryChannelsResponse channels. - * @member {Array.} channels - * @memberof ibc.core.channel.v1.QueryChannelsResponse - * @instance - */ - QueryChannelsResponse.prototype.channels = $util.emptyArray; - - /** - * QueryChannelsResponse pagination. - * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination - * @memberof ibc.core.channel.v1.QueryChannelsResponse - * @instance - */ - QueryChannelsResponse.prototype.pagination = null; - - /** - * QueryChannelsResponse height. - * @member {ibc.core.client.v1.IHeight|null|undefined} height - * @memberof ibc.core.channel.v1.QueryChannelsResponse - * @instance - */ - QueryChannelsResponse.prototype.height = null; - - /** - * Encodes the specified QueryChannelsResponse message. Does not implicitly {@link ibc.core.channel.v1.QueryChannelsResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.QueryChannelsResponse - * @static - * @param {ibc.core.channel.v1.IQueryChannelsResponse} message QueryChannelsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryChannelsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.channels != null && message.channels.length) - for (let i = 0; i < message.channels.length; ++i) - $root.ibc.core.channel.v1.IdentifiedChannel.encode(message.channels[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - $root.ibc.core.client.v1.Height.encode(message.height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryChannelsResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryChannelsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.QueryChannelsResponse - * @static - * @param {ibc.core.channel.v1.IQueryChannelsResponse} message QueryChannelsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryChannelsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryChannelsResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.QueryChannelsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.QueryChannelsResponse} QueryChannelsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryChannelsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryChannelsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.channels && message.channels.length)) - message.channels = []; - message.channels.push($root.ibc.core.channel.v1.IdentifiedChannel.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); - break; - case 3: - message.height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryChannelsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.QueryChannelsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.QueryChannelsResponse} QueryChannelsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryChannelsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryChannelsResponse message. - * @function verify - * @memberof ibc.core.channel.v1.QueryChannelsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryChannelsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.channels != null && message.hasOwnProperty("channels")) { - if (!Array.isArray(message.channels)) - return "channels: array expected"; - for (let i = 0; i < message.channels.length; ++i) { - let error = $root.ibc.core.channel.v1.IdentifiedChannel.verify(message.channels[i]); - if (error) - return "channels." + error; - } - } - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); - if (error) - return "pagination." + error; - } - if (message.height != null && message.hasOwnProperty("height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.height); - if (error) - return "height." + error; - } - return null; - }; - - /** - * Creates a QueryChannelsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.QueryChannelsResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.QueryChannelsResponse} QueryChannelsResponse - */ - QueryChannelsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.QueryChannelsResponse) - return object; - let message = new $root.ibc.core.channel.v1.QueryChannelsResponse(); - if (object.channels) { - if (!Array.isArray(object.channels)) - throw TypeError(".ibc.core.channel.v1.QueryChannelsResponse.channels: array expected"); - message.channels = []; - for (let i = 0; i < object.channels.length; ++i) { - if (typeof object.channels[i] !== "object") - throw TypeError(".ibc.core.channel.v1.QueryChannelsResponse.channels: object expected"); - message.channels[i] = $root.ibc.core.channel.v1.IdentifiedChannel.fromObject(object.channels[i]); - } - } - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".ibc.core.channel.v1.QueryChannelsResponse.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); - } - if (object.height != null) { - if (typeof object.height !== "object") - throw TypeError(".ibc.core.channel.v1.QueryChannelsResponse.height: object expected"); - message.height = $root.ibc.core.client.v1.Height.fromObject(object.height); - } - return message; - }; - - /** - * Creates a plain object from a QueryChannelsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.QueryChannelsResponse - * @static - * @param {ibc.core.channel.v1.QueryChannelsResponse} message QueryChannelsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryChannelsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.channels = []; - if (options.defaults) { - object.pagination = null; - object.height = null; - } - if (message.channels && message.channels.length) { - object.channels = []; - for (let j = 0; j < message.channels.length; ++j) - object.channels[j] = $root.ibc.core.channel.v1.IdentifiedChannel.toObject(message.channels[j], options); - } - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); - if (message.height != null && message.hasOwnProperty("height")) - object.height = $root.ibc.core.client.v1.Height.toObject(message.height, options); - return object; - }; - - /** - * Converts this QueryChannelsResponse to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.QueryChannelsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryChannelsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryChannelsResponse; - })(); - - v1.QueryConnectionChannelsRequest = (function() { - - /** - * Properties of a QueryConnectionChannelsRequest. - * @memberof ibc.core.channel.v1 - * @interface IQueryConnectionChannelsRequest - * @property {string|null} [connection] QueryConnectionChannelsRequest connection - * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryConnectionChannelsRequest pagination - */ - - /** - * Constructs a new QueryConnectionChannelsRequest. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a QueryConnectionChannelsRequest. - * @implements IQueryConnectionChannelsRequest - * @constructor - * @param {ibc.core.channel.v1.IQueryConnectionChannelsRequest=} [properties] Properties to set - */ - function QueryConnectionChannelsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryConnectionChannelsRequest connection. - * @member {string} connection - * @memberof ibc.core.channel.v1.QueryConnectionChannelsRequest - * @instance - */ - QueryConnectionChannelsRequest.prototype.connection = ""; - - /** - * QueryConnectionChannelsRequest pagination. - * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination - * @memberof ibc.core.channel.v1.QueryConnectionChannelsRequest - * @instance - */ - QueryConnectionChannelsRequest.prototype.pagination = null; - - /** - * Encodes the specified QueryConnectionChannelsRequest message. Does not implicitly {@link ibc.core.channel.v1.QueryConnectionChannelsRequest.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.QueryConnectionChannelsRequest - * @static - * @param {ibc.core.channel.v1.IQueryConnectionChannelsRequest} message QueryConnectionChannelsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryConnectionChannelsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.connection != null && Object.hasOwnProperty.call(message, "connection")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.connection); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryConnectionChannelsRequest message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryConnectionChannelsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.QueryConnectionChannelsRequest - * @static - * @param {ibc.core.channel.v1.IQueryConnectionChannelsRequest} message QueryConnectionChannelsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryConnectionChannelsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryConnectionChannelsRequest message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.QueryConnectionChannelsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.QueryConnectionChannelsRequest} QueryConnectionChannelsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryConnectionChannelsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryConnectionChannelsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.connection = reader.string(); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryConnectionChannelsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.QueryConnectionChannelsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.QueryConnectionChannelsRequest} QueryConnectionChannelsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryConnectionChannelsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryConnectionChannelsRequest message. - * @function verify - * @memberof ibc.core.channel.v1.QueryConnectionChannelsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryConnectionChannelsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.connection != null && message.hasOwnProperty("connection")) - if (!$util.isString(message.connection)) - return "connection: string expected"; - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryConnectionChannelsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.QueryConnectionChannelsRequest - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.QueryConnectionChannelsRequest} QueryConnectionChannelsRequest - */ - QueryConnectionChannelsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.QueryConnectionChannelsRequest) - return object; - let message = new $root.ibc.core.channel.v1.QueryConnectionChannelsRequest(); - if (object.connection != null) - message.connection = String(object.connection); - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".ibc.core.channel.v1.QueryConnectionChannelsRequest.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryConnectionChannelsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.QueryConnectionChannelsRequest - * @static - * @param {ibc.core.channel.v1.QueryConnectionChannelsRequest} message QueryConnectionChannelsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryConnectionChannelsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.connection = ""; - object.pagination = null; - } - if (message.connection != null && message.hasOwnProperty("connection")) - object.connection = message.connection; - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryConnectionChannelsRequest to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.QueryConnectionChannelsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryConnectionChannelsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryConnectionChannelsRequest; - })(); - - v1.QueryConnectionChannelsResponse = (function() { - - /** - * Properties of a QueryConnectionChannelsResponse. - * @memberof ibc.core.channel.v1 - * @interface IQueryConnectionChannelsResponse - * @property {Array.|null} [channels] QueryConnectionChannelsResponse channels - * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryConnectionChannelsResponse pagination - * @property {ibc.core.client.v1.IHeight|null} [height] QueryConnectionChannelsResponse height - */ - - /** - * Constructs a new QueryConnectionChannelsResponse. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a QueryConnectionChannelsResponse. - * @implements IQueryConnectionChannelsResponse - * @constructor - * @param {ibc.core.channel.v1.IQueryConnectionChannelsResponse=} [properties] Properties to set - */ - function QueryConnectionChannelsResponse(properties) { - this.channels = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryConnectionChannelsResponse channels. - * @member {Array.} channels - * @memberof ibc.core.channel.v1.QueryConnectionChannelsResponse - * @instance - */ - QueryConnectionChannelsResponse.prototype.channels = $util.emptyArray; - - /** - * QueryConnectionChannelsResponse pagination. - * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination - * @memberof ibc.core.channel.v1.QueryConnectionChannelsResponse - * @instance - */ - QueryConnectionChannelsResponse.prototype.pagination = null; - - /** - * QueryConnectionChannelsResponse height. - * @member {ibc.core.client.v1.IHeight|null|undefined} height - * @memberof ibc.core.channel.v1.QueryConnectionChannelsResponse - * @instance - */ - QueryConnectionChannelsResponse.prototype.height = null; - - /** - * Encodes the specified QueryConnectionChannelsResponse message. Does not implicitly {@link ibc.core.channel.v1.QueryConnectionChannelsResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.QueryConnectionChannelsResponse - * @static - * @param {ibc.core.channel.v1.IQueryConnectionChannelsResponse} message QueryConnectionChannelsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryConnectionChannelsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.channels != null && message.channels.length) - for (let i = 0; i < message.channels.length; ++i) - $root.ibc.core.channel.v1.IdentifiedChannel.encode(message.channels[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - $root.ibc.core.client.v1.Height.encode(message.height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryConnectionChannelsResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryConnectionChannelsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.QueryConnectionChannelsResponse - * @static - * @param {ibc.core.channel.v1.IQueryConnectionChannelsResponse} message QueryConnectionChannelsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryConnectionChannelsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryConnectionChannelsResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.QueryConnectionChannelsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.QueryConnectionChannelsResponse} QueryConnectionChannelsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryConnectionChannelsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryConnectionChannelsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.channels && message.channels.length)) - message.channels = []; - message.channels.push($root.ibc.core.channel.v1.IdentifiedChannel.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); - break; - case 3: - message.height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryConnectionChannelsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.QueryConnectionChannelsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.QueryConnectionChannelsResponse} QueryConnectionChannelsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryConnectionChannelsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryConnectionChannelsResponse message. - * @function verify - * @memberof ibc.core.channel.v1.QueryConnectionChannelsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryConnectionChannelsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.channels != null && message.hasOwnProperty("channels")) { - if (!Array.isArray(message.channels)) - return "channels: array expected"; - for (let i = 0; i < message.channels.length; ++i) { - let error = $root.ibc.core.channel.v1.IdentifiedChannel.verify(message.channels[i]); - if (error) - return "channels." + error; - } - } - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); - if (error) - return "pagination." + error; - } - if (message.height != null && message.hasOwnProperty("height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.height); - if (error) - return "height." + error; - } - return null; - }; - - /** - * Creates a QueryConnectionChannelsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.QueryConnectionChannelsResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.QueryConnectionChannelsResponse} QueryConnectionChannelsResponse - */ - QueryConnectionChannelsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.QueryConnectionChannelsResponse) - return object; - let message = new $root.ibc.core.channel.v1.QueryConnectionChannelsResponse(); - if (object.channels) { - if (!Array.isArray(object.channels)) - throw TypeError(".ibc.core.channel.v1.QueryConnectionChannelsResponse.channels: array expected"); - message.channels = []; - for (let i = 0; i < object.channels.length; ++i) { - if (typeof object.channels[i] !== "object") - throw TypeError(".ibc.core.channel.v1.QueryConnectionChannelsResponse.channels: object expected"); - message.channels[i] = $root.ibc.core.channel.v1.IdentifiedChannel.fromObject(object.channels[i]); - } - } - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".ibc.core.channel.v1.QueryConnectionChannelsResponse.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); - } - if (object.height != null) { - if (typeof object.height !== "object") - throw TypeError(".ibc.core.channel.v1.QueryConnectionChannelsResponse.height: object expected"); - message.height = $root.ibc.core.client.v1.Height.fromObject(object.height); - } - return message; - }; - - /** - * Creates a plain object from a QueryConnectionChannelsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.QueryConnectionChannelsResponse - * @static - * @param {ibc.core.channel.v1.QueryConnectionChannelsResponse} message QueryConnectionChannelsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryConnectionChannelsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.channels = []; - if (options.defaults) { - object.pagination = null; - object.height = null; - } - if (message.channels && message.channels.length) { - object.channels = []; - for (let j = 0; j < message.channels.length; ++j) - object.channels[j] = $root.ibc.core.channel.v1.IdentifiedChannel.toObject(message.channels[j], options); - } - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); - if (message.height != null && message.hasOwnProperty("height")) - object.height = $root.ibc.core.client.v1.Height.toObject(message.height, options); - return object; - }; - - /** - * Converts this QueryConnectionChannelsResponse to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.QueryConnectionChannelsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryConnectionChannelsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryConnectionChannelsResponse; - })(); - - v1.QueryChannelClientStateRequest = (function() { - - /** - * Properties of a QueryChannelClientStateRequest. - * @memberof ibc.core.channel.v1 - * @interface IQueryChannelClientStateRequest - * @property {string|null} [port_id] QueryChannelClientStateRequest port_id - * @property {string|null} [channel_id] QueryChannelClientStateRequest channel_id - */ - - /** - * Constructs a new QueryChannelClientStateRequest. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a QueryChannelClientStateRequest. - * @implements IQueryChannelClientStateRequest - * @constructor - * @param {ibc.core.channel.v1.IQueryChannelClientStateRequest=} [properties] Properties to set - */ - function QueryChannelClientStateRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryChannelClientStateRequest port_id. - * @member {string} port_id - * @memberof ibc.core.channel.v1.QueryChannelClientStateRequest - * @instance - */ - QueryChannelClientStateRequest.prototype.port_id = ""; - - /** - * QueryChannelClientStateRequest channel_id. - * @member {string} channel_id - * @memberof ibc.core.channel.v1.QueryChannelClientStateRequest - * @instance - */ - QueryChannelClientStateRequest.prototype.channel_id = ""; - - /** - * Encodes the specified QueryChannelClientStateRequest message. Does not implicitly {@link ibc.core.channel.v1.QueryChannelClientStateRequest.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.QueryChannelClientStateRequest - * @static - * @param {ibc.core.channel.v1.IQueryChannelClientStateRequest} message QueryChannelClientStateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryChannelClientStateRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); - if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); - return writer; - }; - - /** - * Encodes the specified QueryChannelClientStateRequest message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryChannelClientStateRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.QueryChannelClientStateRequest - * @static - * @param {ibc.core.channel.v1.IQueryChannelClientStateRequest} message QueryChannelClientStateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryChannelClientStateRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryChannelClientStateRequest message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.QueryChannelClientStateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.QueryChannelClientStateRequest} QueryChannelClientStateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryChannelClientStateRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryChannelClientStateRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.port_id = reader.string(); - break; - case 2: - message.channel_id = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryChannelClientStateRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.QueryChannelClientStateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.QueryChannelClientStateRequest} QueryChannelClientStateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryChannelClientStateRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryChannelClientStateRequest message. - * @function verify - * @memberof ibc.core.channel.v1.QueryChannelClientStateRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryChannelClientStateRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.port_id != null && message.hasOwnProperty("port_id")) - if (!$util.isString(message.port_id)) - return "port_id: string expected"; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - if (!$util.isString(message.channel_id)) - return "channel_id: string expected"; - return null; - }; - - /** - * Creates a QueryChannelClientStateRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.QueryChannelClientStateRequest - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.QueryChannelClientStateRequest} QueryChannelClientStateRequest - */ - QueryChannelClientStateRequest.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.QueryChannelClientStateRequest) - return object; - let message = new $root.ibc.core.channel.v1.QueryChannelClientStateRequest(); - if (object.port_id != null) - message.port_id = String(object.port_id); - if (object.channel_id != null) - message.channel_id = String(object.channel_id); - return message; - }; - - /** - * Creates a plain object from a QueryChannelClientStateRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.QueryChannelClientStateRequest - * @static - * @param {ibc.core.channel.v1.QueryChannelClientStateRequest} message QueryChannelClientStateRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryChannelClientStateRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.port_id = ""; - object.channel_id = ""; - } - if (message.port_id != null && message.hasOwnProperty("port_id")) - object.port_id = message.port_id; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - object.channel_id = message.channel_id; - return object; - }; - - /** - * Converts this QueryChannelClientStateRequest to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.QueryChannelClientStateRequest - * @instance - * @returns {Object.} JSON object - */ - QueryChannelClientStateRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryChannelClientStateRequest; - })(); - - v1.QueryChannelClientStateResponse = (function() { - - /** - * Properties of a QueryChannelClientStateResponse. - * @memberof ibc.core.channel.v1 - * @interface IQueryChannelClientStateResponse - * @property {ibc.core.client.v1.IIdentifiedClientState|null} [identified_client_state] QueryChannelClientStateResponse identified_client_state - * @property {Uint8Array|null} [proof] QueryChannelClientStateResponse proof - * @property {ibc.core.client.v1.IHeight|null} [proof_height] QueryChannelClientStateResponse proof_height - */ - - /** - * Constructs a new QueryChannelClientStateResponse. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a QueryChannelClientStateResponse. - * @implements IQueryChannelClientStateResponse - * @constructor - * @param {ibc.core.channel.v1.IQueryChannelClientStateResponse=} [properties] Properties to set - */ - function QueryChannelClientStateResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryChannelClientStateResponse identified_client_state. - * @member {ibc.core.client.v1.IIdentifiedClientState|null|undefined} identified_client_state - * @memberof ibc.core.channel.v1.QueryChannelClientStateResponse - * @instance - */ - QueryChannelClientStateResponse.prototype.identified_client_state = null; - - /** - * QueryChannelClientStateResponse proof. - * @member {Uint8Array} proof - * @memberof ibc.core.channel.v1.QueryChannelClientStateResponse - * @instance - */ - QueryChannelClientStateResponse.prototype.proof = $util.newBuffer([]); - - /** - * QueryChannelClientStateResponse proof_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height - * @memberof ibc.core.channel.v1.QueryChannelClientStateResponse - * @instance - */ - QueryChannelClientStateResponse.prototype.proof_height = null; - - /** - * Encodes the specified QueryChannelClientStateResponse message. Does not implicitly {@link ibc.core.channel.v1.QueryChannelClientStateResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.QueryChannelClientStateResponse - * @static - * @param {ibc.core.channel.v1.IQueryChannelClientStateResponse} message QueryChannelClientStateResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryChannelClientStateResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.identified_client_state != null && Object.hasOwnProperty.call(message, "identified_client_state")) - $root.ibc.core.client.v1.IdentifiedClientState.encode(message.identified_client_state, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proof); - if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) - $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryChannelClientStateResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryChannelClientStateResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.QueryChannelClientStateResponse - * @static - * @param {ibc.core.channel.v1.IQueryChannelClientStateResponse} message QueryChannelClientStateResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryChannelClientStateResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryChannelClientStateResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.QueryChannelClientStateResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.QueryChannelClientStateResponse} QueryChannelClientStateResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryChannelClientStateResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryChannelClientStateResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.identified_client_state = $root.ibc.core.client.v1.IdentifiedClientState.decode(reader, reader.uint32()); - break; - case 2: - message.proof = reader.bytes(); - break; - case 3: - message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryChannelClientStateResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.QueryChannelClientStateResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.QueryChannelClientStateResponse} QueryChannelClientStateResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryChannelClientStateResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryChannelClientStateResponse message. - * @function verify - * @memberof ibc.core.channel.v1.QueryChannelClientStateResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryChannelClientStateResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.identified_client_state != null && message.hasOwnProperty("identified_client_state")) { - let error = $root.ibc.core.client.v1.IdentifiedClientState.verify(message.identified_client_state); - if (error) - return "identified_client_state." + error; - } - if (message.proof != null && message.hasOwnProperty("proof")) - if (!(message.proof && typeof message.proof.length === "number" || $util.isString(message.proof))) - return "proof: buffer expected"; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); - if (error) - return "proof_height." + error; - } - return null; - }; - - /** - * Creates a QueryChannelClientStateResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.QueryChannelClientStateResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.QueryChannelClientStateResponse} QueryChannelClientStateResponse - */ - QueryChannelClientStateResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.QueryChannelClientStateResponse) - return object; - let message = new $root.ibc.core.channel.v1.QueryChannelClientStateResponse(); - if (object.identified_client_state != null) { - if (typeof object.identified_client_state !== "object") - throw TypeError(".ibc.core.channel.v1.QueryChannelClientStateResponse.identified_client_state: object expected"); - message.identified_client_state = $root.ibc.core.client.v1.IdentifiedClientState.fromObject(object.identified_client_state); - } - if (object.proof != null) - if (typeof object.proof === "string") - $util.base64.decode(object.proof, message.proof = $util.newBuffer($util.base64.length(object.proof)), 0); - else if (object.proof.length) - message.proof = object.proof; - if (object.proof_height != null) { - if (typeof object.proof_height !== "object") - throw TypeError(".ibc.core.channel.v1.QueryChannelClientStateResponse.proof_height: object expected"); - message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); - } - return message; - }; - - /** - * Creates a plain object from a QueryChannelClientStateResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.QueryChannelClientStateResponse - * @static - * @param {ibc.core.channel.v1.QueryChannelClientStateResponse} message QueryChannelClientStateResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryChannelClientStateResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.identified_client_state = null; - if (options.bytes === String) - object.proof = ""; - else { - object.proof = []; - if (options.bytes !== Array) - object.proof = $util.newBuffer(object.proof); - } - object.proof_height = null; - } - if (message.identified_client_state != null && message.hasOwnProperty("identified_client_state")) - object.identified_client_state = $root.ibc.core.client.v1.IdentifiedClientState.toObject(message.identified_client_state, options); - if (message.proof != null && message.hasOwnProperty("proof")) - object.proof = options.bytes === String ? $util.base64.encode(message.proof, 0, message.proof.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof) : message.proof; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) - object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); - return object; - }; - - /** - * Converts this QueryChannelClientStateResponse to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.QueryChannelClientStateResponse - * @instance - * @returns {Object.} JSON object - */ - QueryChannelClientStateResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryChannelClientStateResponse; - })(); - - v1.QueryChannelConsensusStateRequest = (function() { - - /** - * Properties of a QueryChannelConsensusStateRequest. - * @memberof ibc.core.channel.v1 - * @interface IQueryChannelConsensusStateRequest - * @property {string|null} [port_id] QueryChannelConsensusStateRequest port_id - * @property {string|null} [channel_id] QueryChannelConsensusStateRequest channel_id - * @property {Long|null} [revision_number] QueryChannelConsensusStateRequest revision_number - * @property {Long|null} [revision_height] QueryChannelConsensusStateRequest revision_height - */ - - /** - * Constructs a new QueryChannelConsensusStateRequest. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a QueryChannelConsensusStateRequest. - * @implements IQueryChannelConsensusStateRequest - * @constructor - * @param {ibc.core.channel.v1.IQueryChannelConsensusStateRequest=} [properties] Properties to set - */ - function QueryChannelConsensusStateRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryChannelConsensusStateRequest port_id. - * @member {string} port_id - * @memberof ibc.core.channel.v1.QueryChannelConsensusStateRequest - * @instance - */ - QueryChannelConsensusStateRequest.prototype.port_id = ""; - - /** - * QueryChannelConsensusStateRequest channel_id. - * @member {string} channel_id - * @memberof ibc.core.channel.v1.QueryChannelConsensusStateRequest - * @instance - */ - QueryChannelConsensusStateRequest.prototype.channel_id = ""; - - /** - * QueryChannelConsensusStateRequest revision_number. - * @member {Long} revision_number - * @memberof ibc.core.channel.v1.QueryChannelConsensusStateRequest - * @instance - */ - QueryChannelConsensusStateRequest.prototype.revision_number = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * QueryChannelConsensusStateRequest revision_height. - * @member {Long} revision_height - * @memberof ibc.core.channel.v1.QueryChannelConsensusStateRequest - * @instance - */ - QueryChannelConsensusStateRequest.prototype.revision_height = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified QueryChannelConsensusStateRequest message. Does not implicitly {@link ibc.core.channel.v1.QueryChannelConsensusStateRequest.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.QueryChannelConsensusStateRequest - * @static - * @param {ibc.core.channel.v1.IQueryChannelConsensusStateRequest} message QueryChannelConsensusStateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryChannelConsensusStateRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); - if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); - if (message.revision_number != null && Object.hasOwnProperty.call(message, "revision_number")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.revision_number); - if (message.revision_height != null && Object.hasOwnProperty.call(message, "revision_height")) - writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.revision_height); - return writer; - }; - - /** - * Encodes the specified QueryChannelConsensusStateRequest message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryChannelConsensusStateRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.QueryChannelConsensusStateRequest - * @static - * @param {ibc.core.channel.v1.IQueryChannelConsensusStateRequest} message QueryChannelConsensusStateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryChannelConsensusStateRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryChannelConsensusStateRequest message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.QueryChannelConsensusStateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.QueryChannelConsensusStateRequest} QueryChannelConsensusStateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryChannelConsensusStateRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryChannelConsensusStateRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.port_id = reader.string(); - break; - case 2: - message.channel_id = reader.string(); - break; - case 3: - message.revision_number = reader.uint64(); - break; - case 4: - message.revision_height = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryChannelConsensusStateRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.QueryChannelConsensusStateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.QueryChannelConsensusStateRequest} QueryChannelConsensusStateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryChannelConsensusStateRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryChannelConsensusStateRequest message. - * @function verify - * @memberof ibc.core.channel.v1.QueryChannelConsensusStateRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryChannelConsensusStateRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.port_id != null && message.hasOwnProperty("port_id")) - if (!$util.isString(message.port_id)) - return "port_id: string expected"; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - if (!$util.isString(message.channel_id)) - return "channel_id: string expected"; - if (message.revision_number != null && message.hasOwnProperty("revision_number")) - if (!$util.isInteger(message.revision_number) && !(message.revision_number && $util.isInteger(message.revision_number.low) && $util.isInteger(message.revision_number.high))) - return "revision_number: integer|Long expected"; - if (message.revision_height != null && message.hasOwnProperty("revision_height")) - if (!$util.isInteger(message.revision_height) && !(message.revision_height && $util.isInteger(message.revision_height.low) && $util.isInteger(message.revision_height.high))) - return "revision_height: integer|Long expected"; - return null; - }; - - /** - * Creates a QueryChannelConsensusStateRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.QueryChannelConsensusStateRequest - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.QueryChannelConsensusStateRequest} QueryChannelConsensusStateRequest - */ - QueryChannelConsensusStateRequest.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.QueryChannelConsensusStateRequest) - return object; - let message = new $root.ibc.core.channel.v1.QueryChannelConsensusStateRequest(); - if (object.port_id != null) - message.port_id = String(object.port_id); - if (object.channel_id != null) - message.channel_id = String(object.channel_id); - if (object.revision_number != null) - if ($util.Long) - (message.revision_number = $util.Long.fromValue(object.revision_number)).unsigned = true; - else if (typeof object.revision_number === "string") - message.revision_number = parseInt(object.revision_number, 10); - else if (typeof object.revision_number === "number") - message.revision_number = object.revision_number; - else if (typeof object.revision_number === "object") - message.revision_number = new $util.LongBits(object.revision_number.low >>> 0, object.revision_number.high >>> 0).toNumber(true); - if (object.revision_height != null) - if ($util.Long) - (message.revision_height = $util.Long.fromValue(object.revision_height)).unsigned = true; - else if (typeof object.revision_height === "string") - message.revision_height = parseInt(object.revision_height, 10); - else if (typeof object.revision_height === "number") - message.revision_height = object.revision_height; - else if (typeof object.revision_height === "object") - message.revision_height = new $util.LongBits(object.revision_height.low >>> 0, object.revision_height.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a QueryChannelConsensusStateRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.QueryChannelConsensusStateRequest - * @static - * @param {ibc.core.channel.v1.QueryChannelConsensusStateRequest} message QueryChannelConsensusStateRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryChannelConsensusStateRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.port_id = ""; - object.channel_id = ""; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.revision_number = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.revision_number = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.revision_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.revision_height = options.longs === String ? "0" : 0; - } - if (message.port_id != null && message.hasOwnProperty("port_id")) - object.port_id = message.port_id; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - object.channel_id = message.channel_id; - if (message.revision_number != null && message.hasOwnProperty("revision_number")) - if (typeof message.revision_number === "number") - object.revision_number = options.longs === String ? String(message.revision_number) : message.revision_number; - else - object.revision_number = options.longs === String ? $util.Long.prototype.toString.call(message.revision_number) : options.longs === Number ? new $util.LongBits(message.revision_number.low >>> 0, message.revision_number.high >>> 0).toNumber(true) : message.revision_number; - if (message.revision_height != null && message.hasOwnProperty("revision_height")) - if (typeof message.revision_height === "number") - object.revision_height = options.longs === String ? String(message.revision_height) : message.revision_height; - else - object.revision_height = options.longs === String ? $util.Long.prototype.toString.call(message.revision_height) : options.longs === Number ? new $util.LongBits(message.revision_height.low >>> 0, message.revision_height.high >>> 0).toNumber(true) : message.revision_height; - return object; - }; - - /** - * Converts this QueryChannelConsensusStateRequest to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.QueryChannelConsensusStateRequest - * @instance - * @returns {Object.} JSON object - */ - QueryChannelConsensusStateRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryChannelConsensusStateRequest; - })(); - - v1.QueryChannelConsensusStateResponse = (function() { - - /** - * Properties of a QueryChannelConsensusStateResponse. - * @memberof ibc.core.channel.v1 - * @interface IQueryChannelConsensusStateResponse - * @property {google.protobuf.IAny|null} [consensus_state] QueryChannelConsensusStateResponse consensus_state - * @property {string|null} [client_id] QueryChannelConsensusStateResponse client_id - * @property {Uint8Array|null} [proof] QueryChannelConsensusStateResponse proof - * @property {ibc.core.client.v1.IHeight|null} [proof_height] QueryChannelConsensusStateResponse proof_height - */ - - /** - * Constructs a new QueryChannelConsensusStateResponse. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a QueryChannelConsensusStateResponse. - * @implements IQueryChannelConsensusStateResponse - * @constructor - * @param {ibc.core.channel.v1.IQueryChannelConsensusStateResponse=} [properties] Properties to set - */ - function QueryChannelConsensusStateResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryChannelConsensusStateResponse consensus_state. - * @member {google.protobuf.IAny|null|undefined} consensus_state - * @memberof ibc.core.channel.v1.QueryChannelConsensusStateResponse - * @instance - */ - QueryChannelConsensusStateResponse.prototype.consensus_state = null; - - /** - * QueryChannelConsensusStateResponse client_id. - * @member {string} client_id - * @memberof ibc.core.channel.v1.QueryChannelConsensusStateResponse - * @instance - */ - QueryChannelConsensusStateResponse.prototype.client_id = ""; - - /** - * QueryChannelConsensusStateResponse proof. - * @member {Uint8Array} proof - * @memberof ibc.core.channel.v1.QueryChannelConsensusStateResponse - * @instance - */ - QueryChannelConsensusStateResponse.prototype.proof = $util.newBuffer([]); - - /** - * QueryChannelConsensusStateResponse proof_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height - * @memberof ibc.core.channel.v1.QueryChannelConsensusStateResponse - * @instance - */ - QueryChannelConsensusStateResponse.prototype.proof_height = null; - - /** - * Encodes the specified QueryChannelConsensusStateResponse message. Does not implicitly {@link ibc.core.channel.v1.QueryChannelConsensusStateResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.QueryChannelConsensusStateResponse - * @static - * @param {ibc.core.channel.v1.IQueryChannelConsensusStateResponse} message QueryChannelConsensusStateResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryChannelConsensusStateResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.consensus_state != null && Object.hasOwnProperty.call(message, "consensus_state")) - $root.google.protobuf.Any.encode(message.consensus_state, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.client_id); - if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) - writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.proof); - if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) - $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryChannelConsensusStateResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryChannelConsensusStateResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.QueryChannelConsensusStateResponse - * @static - * @param {ibc.core.channel.v1.IQueryChannelConsensusStateResponse} message QueryChannelConsensusStateResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryChannelConsensusStateResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryChannelConsensusStateResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.QueryChannelConsensusStateResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.QueryChannelConsensusStateResponse} QueryChannelConsensusStateResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryChannelConsensusStateResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryChannelConsensusStateResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.consensus_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - case 2: - message.client_id = reader.string(); - break; - case 3: - message.proof = reader.bytes(); - break; - case 4: - message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryChannelConsensusStateResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.QueryChannelConsensusStateResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.QueryChannelConsensusStateResponse} QueryChannelConsensusStateResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryChannelConsensusStateResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryChannelConsensusStateResponse message. - * @function verify - * @memberof ibc.core.channel.v1.QueryChannelConsensusStateResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryChannelConsensusStateResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) { - let error = $root.google.protobuf.Any.verify(message.consensus_state); - if (error) - return "consensus_state." + error; - } - if (message.client_id != null && message.hasOwnProperty("client_id")) - if (!$util.isString(message.client_id)) - return "client_id: string expected"; - if (message.proof != null && message.hasOwnProperty("proof")) - if (!(message.proof && typeof message.proof.length === "number" || $util.isString(message.proof))) - return "proof: buffer expected"; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); - if (error) - return "proof_height." + error; - } - return null; - }; - - /** - * Creates a QueryChannelConsensusStateResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.QueryChannelConsensusStateResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.QueryChannelConsensusStateResponse} QueryChannelConsensusStateResponse - */ - QueryChannelConsensusStateResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.QueryChannelConsensusStateResponse) - return object; - let message = new $root.ibc.core.channel.v1.QueryChannelConsensusStateResponse(); - if (object.consensus_state != null) { - if (typeof object.consensus_state !== "object") - throw TypeError(".ibc.core.channel.v1.QueryChannelConsensusStateResponse.consensus_state: object expected"); - message.consensus_state = $root.google.protobuf.Any.fromObject(object.consensus_state); - } - if (object.client_id != null) - message.client_id = String(object.client_id); - if (object.proof != null) - if (typeof object.proof === "string") - $util.base64.decode(object.proof, message.proof = $util.newBuffer($util.base64.length(object.proof)), 0); - else if (object.proof.length) - message.proof = object.proof; - if (object.proof_height != null) { - if (typeof object.proof_height !== "object") - throw TypeError(".ibc.core.channel.v1.QueryChannelConsensusStateResponse.proof_height: object expected"); - message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); - } - return message; - }; - - /** - * Creates a plain object from a QueryChannelConsensusStateResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.QueryChannelConsensusStateResponse - * @static - * @param {ibc.core.channel.v1.QueryChannelConsensusStateResponse} message QueryChannelConsensusStateResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryChannelConsensusStateResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.consensus_state = null; - object.client_id = ""; - if (options.bytes === String) - object.proof = ""; - else { - object.proof = []; - if (options.bytes !== Array) - object.proof = $util.newBuffer(object.proof); - } - object.proof_height = null; - } - if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) - object.consensus_state = $root.google.protobuf.Any.toObject(message.consensus_state, options); - if (message.client_id != null && message.hasOwnProperty("client_id")) - object.client_id = message.client_id; - if (message.proof != null && message.hasOwnProperty("proof")) - object.proof = options.bytes === String ? $util.base64.encode(message.proof, 0, message.proof.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof) : message.proof; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) - object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); - return object; - }; - - /** - * Converts this QueryChannelConsensusStateResponse to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.QueryChannelConsensusStateResponse - * @instance - * @returns {Object.} JSON object - */ - QueryChannelConsensusStateResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryChannelConsensusStateResponse; - })(); - - v1.QueryPacketCommitmentRequest = (function() { - - /** - * Properties of a QueryPacketCommitmentRequest. - * @memberof ibc.core.channel.v1 - * @interface IQueryPacketCommitmentRequest - * @property {string|null} [port_id] QueryPacketCommitmentRequest port_id - * @property {string|null} [channel_id] QueryPacketCommitmentRequest channel_id - * @property {Long|null} [sequence] QueryPacketCommitmentRequest sequence - */ - - /** - * Constructs a new QueryPacketCommitmentRequest. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a QueryPacketCommitmentRequest. - * @implements IQueryPacketCommitmentRequest - * @constructor - * @param {ibc.core.channel.v1.IQueryPacketCommitmentRequest=} [properties] Properties to set - */ - function QueryPacketCommitmentRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryPacketCommitmentRequest port_id. - * @member {string} port_id - * @memberof ibc.core.channel.v1.QueryPacketCommitmentRequest - * @instance - */ - QueryPacketCommitmentRequest.prototype.port_id = ""; - - /** - * QueryPacketCommitmentRequest channel_id. - * @member {string} channel_id - * @memberof ibc.core.channel.v1.QueryPacketCommitmentRequest - * @instance - */ - QueryPacketCommitmentRequest.prototype.channel_id = ""; - - /** - * QueryPacketCommitmentRequest sequence. - * @member {Long} sequence - * @memberof ibc.core.channel.v1.QueryPacketCommitmentRequest - * @instance - */ - QueryPacketCommitmentRequest.prototype.sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified QueryPacketCommitmentRequest message. Does not implicitly {@link ibc.core.channel.v1.QueryPacketCommitmentRequest.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.QueryPacketCommitmentRequest - * @static - * @param {ibc.core.channel.v1.IQueryPacketCommitmentRequest} message QueryPacketCommitmentRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryPacketCommitmentRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); - if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); - if (message.sequence != null && Object.hasOwnProperty.call(message, "sequence")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.sequence); - return writer; - }; - - /** - * Encodes the specified QueryPacketCommitmentRequest message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryPacketCommitmentRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.QueryPacketCommitmentRequest - * @static - * @param {ibc.core.channel.v1.IQueryPacketCommitmentRequest} message QueryPacketCommitmentRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryPacketCommitmentRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryPacketCommitmentRequest message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.QueryPacketCommitmentRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.QueryPacketCommitmentRequest} QueryPacketCommitmentRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryPacketCommitmentRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryPacketCommitmentRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.port_id = reader.string(); - break; - case 2: - message.channel_id = reader.string(); - break; - case 3: - message.sequence = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryPacketCommitmentRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.QueryPacketCommitmentRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.QueryPacketCommitmentRequest} QueryPacketCommitmentRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryPacketCommitmentRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryPacketCommitmentRequest message. - * @function verify - * @memberof ibc.core.channel.v1.QueryPacketCommitmentRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryPacketCommitmentRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.port_id != null && message.hasOwnProperty("port_id")) - if (!$util.isString(message.port_id)) - return "port_id: string expected"; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - if (!$util.isString(message.channel_id)) - return "channel_id: string expected"; - if (message.sequence != null && message.hasOwnProperty("sequence")) - if (!$util.isInteger(message.sequence) && !(message.sequence && $util.isInteger(message.sequence.low) && $util.isInteger(message.sequence.high))) - return "sequence: integer|Long expected"; - return null; - }; - - /** - * Creates a QueryPacketCommitmentRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.QueryPacketCommitmentRequest - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.QueryPacketCommitmentRequest} QueryPacketCommitmentRequest - */ - QueryPacketCommitmentRequest.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.QueryPacketCommitmentRequest) - return object; - let message = new $root.ibc.core.channel.v1.QueryPacketCommitmentRequest(); - if (object.port_id != null) - message.port_id = String(object.port_id); - if (object.channel_id != null) - message.channel_id = String(object.channel_id); - if (object.sequence != null) - if ($util.Long) - (message.sequence = $util.Long.fromValue(object.sequence)).unsigned = true; - else if (typeof object.sequence === "string") - message.sequence = parseInt(object.sequence, 10); - else if (typeof object.sequence === "number") - message.sequence = object.sequence; - else if (typeof object.sequence === "object") - message.sequence = new $util.LongBits(object.sequence.low >>> 0, object.sequence.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a QueryPacketCommitmentRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.QueryPacketCommitmentRequest - * @static - * @param {ibc.core.channel.v1.QueryPacketCommitmentRequest} message QueryPacketCommitmentRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryPacketCommitmentRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.port_id = ""; - object.channel_id = ""; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.sequence = options.longs === String ? "0" : 0; - } - if (message.port_id != null && message.hasOwnProperty("port_id")) - object.port_id = message.port_id; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - object.channel_id = message.channel_id; - if (message.sequence != null && message.hasOwnProperty("sequence")) - if (typeof message.sequence === "number") - object.sequence = options.longs === String ? String(message.sequence) : message.sequence; - else - object.sequence = options.longs === String ? $util.Long.prototype.toString.call(message.sequence) : options.longs === Number ? new $util.LongBits(message.sequence.low >>> 0, message.sequence.high >>> 0).toNumber(true) : message.sequence; - return object; - }; - - /** - * Converts this QueryPacketCommitmentRequest to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.QueryPacketCommitmentRequest - * @instance - * @returns {Object.} JSON object - */ - QueryPacketCommitmentRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryPacketCommitmentRequest; - })(); - - v1.QueryPacketCommitmentResponse = (function() { - - /** - * Properties of a QueryPacketCommitmentResponse. - * @memberof ibc.core.channel.v1 - * @interface IQueryPacketCommitmentResponse - * @property {Uint8Array|null} [commitment] QueryPacketCommitmentResponse commitment - * @property {Uint8Array|null} [proof] QueryPacketCommitmentResponse proof - * @property {ibc.core.client.v1.IHeight|null} [proof_height] QueryPacketCommitmentResponse proof_height - */ - - /** - * Constructs a new QueryPacketCommitmentResponse. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a QueryPacketCommitmentResponse. - * @implements IQueryPacketCommitmentResponse - * @constructor - * @param {ibc.core.channel.v1.IQueryPacketCommitmentResponse=} [properties] Properties to set - */ - function QueryPacketCommitmentResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryPacketCommitmentResponse commitment. - * @member {Uint8Array} commitment - * @memberof ibc.core.channel.v1.QueryPacketCommitmentResponse - * @instance - */ - QueryPacketCommitmentResponse.prototype.commitment = $util.newBuffer([]); - - /** - * QueryPacketCommitmentResponse proof. - * @member {Uint8Array} proof - * @memberof ibc.core.channel.v1.QueryPacketCommitmentResponse - * @instance - */ - QueryPacketCommitmentResponse.prototype.proof = $util.newBuffer([]); - - /** - * QueryPacketCommitmentResponse proof_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height - * @memberof ibc.core.channel.v1.QueryPacketCommitmentResponse - * @instance - */ - QueryPacketCommitmentResponse.prototype.proof_height = null; - - /** - * Encodes the specified QueryPacketCommitmentResponse message. Does not implicitly {@link ibc.core.channel.v1.QueryPacketCommitmentResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.QueryPacketCommitmentResponse - * @static - * @param {ibc.core.channel.v1.IQueryPacketCommitmentResponse} message QueryPacketCommitmentResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryPacketCommitmentResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.commitment != null && Object.hasOwnProperty.call(message, "commitment")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.commitment); - if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proof); - if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) - $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryPacketCommitmentResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryPacketCommitmentResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.QueryPacketCommitmentResponse - * @static - * @param {ibc.core.channel.v1.IQueryPacketCommitmentResponse} message QueryPacketCommitmentResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryPacketCommitmentResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryPacketCommitmentResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.QueryPacketCommitmentResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.QueryPacketCommitmentResponse} QueryPacketCommitmentResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryPacketCommitmentResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryPacketCommitmentResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.commitment = reader.bytes(); - break; - case 2: - message.proof = reader.bytes(); - break; - case 3: - message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryPacketCommitmentResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.QueryPacketCommitmentResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.QueryPacketCommitmentResponse} QueryPacketCommitmentResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryPacketCommitmentResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryPacketCommitmentResponse message. - * @function verify - * @memberof ibc.core.channel.v1.QueryPacketCommitmentResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryPacketCommitmentResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.commitment != null && message.hasOwnProperty("commitment")) - if (!(message.commitment && typeof message.commitment.length === "number" || $util.isString(message.commitment))) - return "commitment: buffer expected"; - if (message.proof != null && message.hasOwnProperty("proof")) - if (!(message.proof && typeof message.proof.length === "number" || $util.isString(message.proof))) - return "proof: buffer expected"; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); - if (error) - return "proof_height." + error; - } - return null; - }; - - /** - * Creates a QueryPacketCommitmentResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.QueryPacketCommitmentResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.QueryPacketCommitmentResponse} QueryPacketCommitmentResponse - */ - QueryPacketCommitmentResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.QueryPacketCommitmentResponse) - return object; - let message = new $root.ibc.core.channel.v1.QueryPacketCommitmentResponse(); - if (object.commitment != null) - if (typeof object.commitment === "string") - $util.base64.decode(object.commitment, message.commitment = $util.newBuffer($util.base64.length(object.commitment)), 0); - else if (object.commitment.length) - message.commitment = object.commitment; - if (object.proof != null) - if (typeof object.proof === "string") - $util.base64.decode(object.proof, message.proof = $util.newBuffer($util.base64.length(object.proof)), 0); - else if (object.proof.length) - message.proof = object.proof; - if (object.proof_height != null) { - if (typeof object.proof_height !== "object") - throw TypeError(".ibc.core.channel.v1.QueryPacketCommitmentResponse.proof_height: object expected"); - message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); - } - return message; - }; - - /** - * Creates a plain object from a QueryPacketCommitmentResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.QueryPacketCommitmentResponse - * @static - * @param {ibc.core.channel.v1.QueryPacketCommitmentResponse} message QueryPacketCommitmentResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryPacketCommitmentResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if (options.bytes === String) - object.commitment = ""; - else { - object.commitment = []; - if (options.bytes !== Array) - object.commitment = $util.newBuffer(object.commitment); - } - if (options.bytes === String) - object.proof = ""; - else { - object.proof = []; - if (options.bytes !== Array) - object.proof = $util.newBuffer(object.proof); - } - object.proof_height = null; - } - if (message.commitment != null && message.hasOwnProperty("commitment")) - object.commitment = options.bytes === String ? $util.base64.encode(message.commitment, 0, message.commitment.length) : options.bytes === Array ? Array.prototype.slice.call(message.commitment) : message.commitment; - if (message.proof != null && message.hasOwnProperty("proof")) - object.proof = options.bytes === String ? $util.base64.encode(message.proof, 0, message.proof.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof) : message.proof; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) - object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); - return object; - }; - - /** - * Converts this QueryPacketCommitmentResponse to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.QueryPacketCommitmentResponse - * @instance - * @returns {Object.} JSON object - */ - QueryPacketCommitmentResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryPacketCommitmentResponse; - })(); - - v1.QueryPacketCommitmentsRequest = (function() { - - /** - * Properties of a QueryPacketCommitmentsRequest. - * @memberof ibc.core.channel.v1 - * @interface IQueryPacketCommitmentsRequest - * @property {string|null} [port_id] QueryPacketCommitmentsRequest port_id - * @property {string|null} [channel_id] QueryPacketCommitmentsRequest channel_id - * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryPacketCommitmentsRequest pagination - */ - - /** - * Constructs a new QueryPacketCommitmentsRequest. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a QueryPacketCommitmentsRequest. - * @implements IQueryPacketCommitmentsRequest - * @constructor - * @param {ibc.core.channel.v1.IQueryPacketCommitmentsRequest=} [properties] Properties to set - */ - function QueryPacketCommitmentsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryPacketCommitmentsRequest port_id. - * @member {string} port_id - * @memberof ibc.core.channel.v1.QueryPacketCommitmentsRequest - * @instance - */ - QueryPacketCommitmentsRequest.prototype.port_id = ""; - - /** - * QueryPacketCommitmentsRequest channel_id. - * @member {string} channel_id - * @memberof ibc.core.channel.v1.QueryPacketCommitmentsRequest - * @instance - */ - QueryPacketCommitmentsRequest.prototype.channel_id = ""; - - /** - * QueryPacketCommitmentsRequest pagination. - * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination - * @memberof ibc.core.channel.v1.QueryPacketCommitmentsRequest - * @instance - */ - QueryPacketCommitmentsRequest.prototype.pagination = null; - - /** - * Encodes the specified QueryPacketCommitmentsRequest message. Does not implicitly {@link ibc.core.channel.v1.QueryPacketCommitmentsRequest.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.QueryPacketCommitmentsRequest - * @static - * @param {ibc.core.channel.v1.IQueryPacketCommitmentsRequest} message QueryPacketCommitmentsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryPacketCommitmentsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); - if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryPacketCommitmentsRequest message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryPacketCommitmentsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.QueryPacketCommitmentsRequest - * @static - * @param {ibc.core.channel.v1.IQueryPacketCommitmentsRequest} message QueryPacketCommitmentsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryPacketCommitmentsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryPacketCommitmentsRequest message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.QueryPacketCommitmentsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.QueryPacketCommitmentsRequest} QueryPacketCommitmentsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryPacketCommitmentsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryPacketCommitmentsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.port_id = reader.string(); - break; - case 2: - message.channel_id = reader.string(); - break; - case 3: - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryPacketCommitmentsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.QueryPacketCommitmentsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.QueryPacketCommitmentsRequest} QueryPacketCommitmentsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryPacketCommitmentsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryPacketCommitmentsRequest message. - * @function verify - * @memberof ibc.core.channel.v1.QueryPacketCommitmentsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryPacketCommitmentsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.port_id != null && message.hasOwnProperty("port_id")) - if (!$util.isString(message.port_id)) - return "port_id: string expected"; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - if (!$util.isString(message.channel_id)) - return "channel_id: string expected"; - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryPacketCommitmentsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.QueryPacketCommitmentsRequest - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.QueryPacketCommitmentsRequest} QueryPacketCommitmentsRequest - */ - QueryPacketCommitmentsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.QueryPacketCommitmentsRequest) - return object; - let message = new $root.ibc.core.channel.v1.QueryPacketCommitmentsRequest(); - if (object.port_id != null) - message.port_id = String(object.port_id); - if (object.channel_id != null) - message.channel_id = String(object.channel_id); - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".ibc.core.channel.v1.QueryPacketCommitmentsRequest.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryPacketCommitmentsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.QueryPacketCommitmentsRequest - * @static - * @param {ibc.core.channel.v1.QueryPacketCommitmentsRequest} message QueryPacketCommitmentsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryPacketCommitmentsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.port_id = ""; - object.channel_id = ""; - object.pagination = null; - } - if (message.port_id != null && message.hasOwnProperty("port_id")) - object.port_id = message.port_id; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - object.channel_id = message.channel_id; - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryPacketCommitmentsRequest to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.QueryPacketCommitmentsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryPacketCommitmentsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryPacketCommitmentsRequest; - })(); - - v1.QueryPacketCommitmentsResponse = (function() { - - /** - * Properties of a QueryPacketCommitmentsResponse. - * @memberof ibc.core.channel.v1 - * @interface IQueryPacketCommitmentsResponse - * @property {Array.|null} [commitments] QueryPacketCommitmentsResponse commitments - * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryPacketCommitmentsResponse pagination - * @property {ibc.core.client.v1.IHeight|null} [height] QueryPacketCommitmentsResponse height - */ - - /** - * Constructs a new QueryPacketCommitmentsResponse. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a QueryPacketCommitmentsResponse. - * @implements IQueryPacketCommitmentsResponse - * @constructor - * @param {ibc.core.channel.v1.IQueryPacketCommitmentsResponse=} [properties] Properties to set - */ - function QueryPacketCommitmentsResponse(properties) { - this.commitments = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryPacketCommitmentsResponse commitments. - * @member {Array.} commitments - * @memberof ibc.core.channel.v1.QueryPacketCommitmentsResponse - * @instance - */ - QueryPacketCommitmentsResponse.prototype.commitments = $util.emptyArray; - - /** - * QueryPacketCommitmentsResponse pagination. - * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination - * @memberof ibc.core.channel.v1.QueryPacketCommitmentsResponse - * @instance - */ - QueryPacketCommitmentsResponse.prototype.pagination = null; - - /** - * QueryPacketCommitmentsResponse height. - * @member {ibc.core.client.v1.IHeight|null|undefined} height - * @memberof ibc.core.channel.v1.QueryPacketCommitmentsResponse - * @instance - */ - QueryPacketCommitmentsResponse.prototype.height = null; - - /** - * Encodes the specified QueryPacketCommitmentsResponse message. Does not implicitly {@link ibc.core.channel.v1.QueryPacketCommitmentsResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.QueryPacketCommitmentsResponse - * @static - * @param {ibc.core.channel.v1.IQueryPacketCommitmentsResponse} message QueryPacketCommitmentsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryPacketCommitmentsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.commitments != null && message.commitments.length) - for (let i = 0; i < message.commitments.length; ++i) - $root.ibc.core.channel.v1.PacketState.encode(message.commitments[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - $root.ibc.core.client.v1.Height.encode(message.height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryPacketCommitmentsResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryPacketCommitmentsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.QueryPacketCommitmentsResponse - * @static - * @param {ibc.core.channel.v1.IQueryPacketCommitmentsResponse} message QueryPacketCommitmentsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryPacketCommitmentsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryPacketCommitmentsResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.QueryPacketCommitmentsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.QueryPacketCommitmentsResponse} QueryPacketCommitmentsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryPacketCommitmentsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryPacketCommitmentsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.commitments && message.commitments.length)) - message.commitments = []; - message.commitments.push($root.ibc.core.channel.v1.PacketState.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); - break; - case 3: - message.height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryPacketCommitmentsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.QueryPacketCommitmentsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.QueryPacketCommitmentsResponse} QueryPacketCommitmentsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryPacketCommitmentsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryPacketCommitmentsResponse message. - * @function verify - * @memberof ibc.core.channel.v1.QueryPacketCommitmentsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryPacketCommitmentsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.commitments != null && message.hasOwnProperty("commitments")) { - if (!Array.isArray(message.commitments)) - return "commitments: array expected"; - for (let i = 0; i < message.commitments.length; ++i) { - let error = $root.ibc.core.channel.v1.PacketState.verify(message.commitments[i]); - if (error) - return "commitments." + error; - } - } - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); - if (error) - return "pagination." + error; - } - if (message.height != null && message.hasOwnProperty("height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.height); - if (error) - return "height." + error; - } - return null; - }; - - /** - * Creates a QueryPacketCommitmentsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.QueryPacketCommitmentsResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.QueryPacketCommitmentsResponse} QueryPacketCommitmentsResponse - */ - QueryPacketCommitmentsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.QueryPacketCommitmentsResponse) - return object; - let message = new $root.ibc.core.channel.v1.QueryPacketCommitmentsResponse(); - if (object.commitments) { - if (!Array.isArray(object.commitments)) - throw TypeError(".ibc.core.channel.v1.QueryPacketCommitmentsResponse.commitments: array expected"); - message.commitments = []; - for (let i = 0; i < object.commitments.length; ++i) { - if (typeof object.commitments[i] !== "object") - throw TypeError(".ibc.core.channel.v1.QueryPacketCommitmentsResponse.commitments: object expected"); - message.commitments[i] = $root.ibc.core.channel.v1.PacketState.fromObject(object.commitments[i]); - } - } - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".ibc.core.channel.v1.QueryPacketCommitmentsResponse.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); - } - if (object.height != null) { - if (typeof object.height !== "object") - throw TypeError(".ibc.core.channel.v1.QueryPacketCommitmentsResponse.height: object expected"); - message.height = $root.ibc.core.client.v1.Height.fromObject(object.height); - } - return message; - }; - - /** - * Creates a plain object from a QueryPacketCommitmentsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.QueryPacketCommitmentsResponse - * @static - * @param {ibc.core.channel.v1.QueryPacketCommitmentsResponse} message QueryPacketCommitmentsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryPacketCommitmentsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.commitments = []; - if (options.defaults) { - object.pagination = null; - object.height = null; - } - if (message.commitments && message.commitments.length) { - object.commitments = []; - for (let j = 0; j < message.commitments.length; ++j) - object.commitments[j] = $root.ibc.core.channel.v1.PacketState.toObject(message.commitments[j], options); - } - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); - if (message.height != null && message.hasOwnProperty("height")) - object.height = $root.ibc.core.client.v1.Height.toObject(message.height, options); - return object; - }; - - /** - * Converts this QueryPacketCommitmentsResponse to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.QueryPacketCommitmentsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryPacketCommitmentsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryPacketCommitmentsResponse; - })(); - - v1.QueryPacketReceiptRequest = (function() { - - /** - * Properties of a QueryPacketReceiptRequest. - * @memberof ibc.core.channel.v1 - * @interface IQueryPacketReceiptRequest - * @property {string|null} [port_id] QueryPacketReceiptRequest port_id - * @property {string|null} [channel_id] QueryPacketReceiptRequest channel_id - * @property {Long|null} [sequence] QueryPacketReceiptRequest sequence - */ - - /** - * Constructs a new QueryPacketReceiptRequest. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a QueryPacketReceiptRequest. - * @implements IQueryPacketReceiptRequest - * @constructor - * @param {ibc.core.channel.v1.IQueryPacketReceiptRequest=} [properties] Properties to set - */ - function QueryPacketReceiptRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryPacketReceiptRequest port_id. - * @member {string} port_id - * @memberof ibc.core.channel.v1.QueryPacketReceiptRequest - * @instance - */ - QueryPacketReceiptRequest.prototype.port_id = ""; - - /** - * QueryPacketReceiptRequest channel_id. - * @member {string} channel_id - * @memberof ibc.core.channel.v1.QueryPacketReceiptRequest - * @instance - */ - QueryPacketReceiptRequest.prototype.channel_id = ""; - - /** - * QueryPacketReceiptRequest sequence. - * @member {Long} sequence - * @memberof ibc.core.channel.v1.QueryPacketReceiptRequest - * @instance - */ - QueryPacketReceiptRequest.prototype.sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified QueryPacketReceiptRequest message. Does not implicitly {@link ibc.core.channel.v1.QueryPacketReceiptRequest.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.QueryPacketReceiptRequest - * @static - * @param {ibc.core.channel.v1.IQueryPacketReceiptRequest} message QueryPacketReceiptRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryPacketReceiptRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); - if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); - if (message.sequence != null && Object.hasOwnProperty.call(message, "sequence")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.sequence); - return writer; - }; - - /** - * Encodes the specified QueryPacketReceiptRequest message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryPacketReceiptRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.QueryPacketReceiptRequest - * @static - * @param {ibc.core.channel.v1.IQueryPacketReceiptRequest} message QueryPacketReceiptRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryPacketReceiptRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryPacketReceiptRequest message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.QueryPacketReceiptRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.QueryPacketReceiptRequest} QueryPacketReceiptRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryPacketReceiptRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryPacketReceiptRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.port_id = reader.string(); - break; - case 2: - message.channel_id = reader.string(); - break; - case 3: - message.sequence = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryPacketReceiptRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.QueryPacketReceiptRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.QueryPacketReceiptRequest} QueryPacketReceiptRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryPacketReceiptRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryPacketReceiptRequest message. - * @function verify - * @memberof ibc.core.channel.v1.QueryPacketReceiptRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryPacketReceiptRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.port_id != null && message.hasOwnProperty("port_id")) - if (!$util.isString(message.port_id)) - return "port_id: string expected"; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - if (!$util.isString(message.channel_id)) - return "channel_id: string expected"; - if (message.sequence != null && message.hasOwnProperty("sequence")) - if (!$util.isInteger(message.sequence) && !(message.sequence && $util.isInteger(message.sequence.low) && $util.isInteger(message.sequence.high))) - return "sequence: integer|Long expected"; - return null; - }; - - /** - * Creates a QueryPacketReceiptRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.QueryPacketReceiptRequest - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.QueryPacketReceiptRequest} QueryPacketReceiptRequest - */ - QueryPacketReceiptRequest.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.QueryPacketReceiptRequest) - return object; - let message = new $root.ibc.core.channel.v1.QueryPacketReceiptRequest(); - if (object.port_id != null) - message.port_id = String(object.port_id); - if (object.channel_id != null) - message.channel_id = String(object.channel_id); - if (object.sequence != null) - if ($util.Long) - (message.sequence = $util.Long.fromValue(object.sequence)).unsigned = true; - else if (typeof object.sequence === "string") - message.sequence = parseInt(object.sequence, 10); - else if (typeof object.sequence === "number") - message.sequence = object.sequence; - else if (typeof object.sequence === "object") - message.sequence = new $util.LongBits(object.sequence.low >>> 0, object.sequence.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a QueryPacketReceiptRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.QueryPacketReceiptRequest - * @static - * @param {ibc.core.channel.v1.QueryPacketReceiptRequest} message QueryPacketReceiptRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryPacketReceiptRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.port_id = ""; - object.channel_id = ""; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.sequence = options.longs === String ? "0" : 0; - } - if (message.port_id != null && message.hasOwnProperty("port_id")) - object.port_id = message.port_id; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - object.channel_id = message.channel_id; - if (message.sequence != null && message.hasOwnProperty("sequence")) - if (typeof message.sequence === "number") - object.sequence = options.longs === String ? String(message.sequence) : message.sequence; - else - object.sequence = options.longs === String ? $util.Long.prototype.toString.call(message.sequence) : options.longs === Number ? new $util.LongBits(message.sequence.low >>> 0, message.sequence.high >>> 0).toNumber(true) : message.sequence; - return object; - }; - - /** - * Converts this QueryPacketReceiptRequest to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.QueryPacketReceiptRequest - * @instance - * @returns {Object.} JSON object - */ - QueryPacketReceiptRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryPacketReceiptRequest; - })(); - - v1.QueryPacketReceiptResponse = (function() { - - /** - * Properties of a QueryPacketReceiptResponse. - * @memberof ibc.core.channel.v1 - * @interface IQueryPacketReceiptResponse - * @property {boolean|null} [received] QueryPacketReceiptResponse received - * @property {Uint8Array|null} [proof] QueryPacketReceiptResponse proof - * @property {ibc.core.client.v1.IHeight|null} [proof_height] QueryPacketReceiptResponse proof_height - */ - - /** - * Constructs a new QueryPacketReceiptResponse. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a QueryPacketReceiptResponse. - * @implements IQueryPacketReceiptResponse - * @constructor - * @param {ibc.core.channel.v1.IQueryPacketReceiptResponse=} [properties] Properties to set - */ - function QueryPacketReceiptResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryPacketReceiptResponse received. - * @member {boolean} received - * @memberof ibc.core.channel.v1.QueryPacketReceiptResponse - * @instance - */ - QueryPacketReceiptResponse.prototype.received = false; - - /** - * QueryPacketReceiptResponse proof. - * @member {Uint8Array} proof - * @memberof ibc.core.channel.v1.QueryPacketReceiptResponse - * @instance - */ - QueryPacketReceiptResponse.prototype.proof = $util.newBuffer([]); - - /** - * QueryPacketReceiptResponse proof_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height - * @memberof ibc.core.channel.v1.QueryPacketReceiptResponse - * @instance - */ - QueryPacketReceiptResponse.prototype.proof_height = null; - - /** - * Encodes the specified QueryPacketReceiptResponse message. Does not implicitly {@link ibc.core.channel.v1.QueryPacketReceiptResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.QueryPacketReceiptResponse - * @static - * @param {ibc.core.channel.v1.IQueryPacketReceiptResponse} message QueryPacketReceiptResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryPacketReceiptResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.received != null && Object.hasOwnProperty.call(message, "received")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.received); - if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) - writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.proof); - if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) - $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryPacketReceiptResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryPacketReceiptResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.QueryPacketReceiptResponse - * @static - * @param {ibc.core.channel.v1.IQueryPacketReceiptResponse} message QueryPacketReceiptResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryPacketReceiptResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryPacketReceiptResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.QueryPacketReceiptResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.QueryPacketReceiptResponse} QueryPacketReceiptResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryPacketReceiptResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryPacketReceiptResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 2: - message.received = reader.bool(); - break; - case 3: - message.proof = reader.bytes(); - break; - case 4: - message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryPacketReceiptResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.QueryPacketReceiptResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.QueryPacketReceiptResponse} QueryPacketReceiptResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryPacketReceiptResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryPacketReceiptResponse message. - * @function verify - * @memberof ibc.core.channel.v1.QueryPacketReceiptResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryPacketReceiptResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.received != null && message.hasOwnProperty("received")) - if (typeof message.received !== "boolean") - return "received: boolean expected"; - if (message.proof != null && message.hasOwnProperty("proof")) - if (!(message.proof && typeof message.proof.length === "number" || $util.isString(message.proof))) - return "proof: buffer expected"; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); - if (error) - return "proof_height." + error; - } - return null; - }; - - /** - * Creates a QueryPacketReceiptResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.QueryPacketReceiptResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.QueryPacketReceiptResponse} QueryPacketReceiptResponse - */ - QueryPacketReceiptResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.QueryPacketReceiptResponse) - return object; - let message = new $root.ibc.core.channel.v1.QueryPacketReceiptResponse(); - if (object.received != null) - message.received = Boolean(object.received); - if (object.proof != null) - if (typeof object.proof === "string") - $util.base64.decode(object.proof, message.proof = $util.newBuffer($util.base64.length(object.proof)), 0); - else if (object.proof.length) - message.proof = object.proof; - if (object.proof_height != null) { - if (typeof object.proof_height !== "object") - throw TypeError(".ibc.core.channel.v1.QueryPacketReceiptResponse.proof_height: object expected"); - message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); - } - return message; - }; - - /** - * Creates a plain object from a QueryPacketReceiptResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.QueryPacketReceiptResponse - * @static - * @param {ibc.core.channel.v1.QueryPacketReceiptResponse} message QueryPacketReceiptResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryPacketReceiptResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.received = false; - if (options.bytes === String) - object.proof = ""; - else { - object.proof = []; - if (options.bytes !== Array) - object.proof = $util.newBuffer(object.proof); - } - object.proof_height = null; - } - if (message.received != null && message.hasOwnProperty("received")) - object.received = message.received; - if (message.proof != null && message.hasOwnProperty("proof")) - object.proof = options.bytes === String ? $util.base64.encode(message.proof, 0, message.proof.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof) : message.proof; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) - object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); - return object; - }; - - /** - * Converts this QueryPacketReceiptResponse to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.QueryPacketReceiptResponse - * @instance - * @returns {Object.} JSON object - */ - QueryPacketReceiptResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryPacketReceiptResponse; - })(); - - v1.QueryPacketAcknowledgementRequest = (function() { - - /** - * Properties of a QueryPacketAcknowledgementRequest. - * @memberof ibc.core.channel.v1 - * @interface IQueryPacketAcknowledgementRequest - * @property {string|null} [port_id] QueryPacketAcknowledgementRequest port_id - * @property {string|null} [channel_id] QueryPacketAcknowledgementRequest channel_id - * @property {Long|null} [sequence] QueryPacketAcknowledgementRequest sequence - */ - - /** - * Constructs a new QueryPacketAcknowledgementRequest. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a QueryPacketAcknowledgementRequest. - * @implements IQueryPacketAcknowledgementRequest - * @constructor - * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementRequest=} [properties] Properties to set - */ - function QueryPacketAcknowledgementRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryPacketAcknowledgementRequest port_id. - * @member {string} port_id - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementRequest - * @instance - */ - QueryPacketAcknowledgementRequest.prototype.port_id = ""; - - /** - * QueryPacketAcknowledgementRequest channel_id. - * @member {string} channel_id - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementRequest - * @instance - */ - QueryPacketAcknowledgementRequest.prototype.channel_id = ""; - - /** - * QueryPacketAcknowledgementRequest sequence. - * @member {Long} sequence - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementRequest - * @instance - */ - QueryPacketAcknowledgementRequest.prototype.sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified QueryPacketAcknowledgementRequest message. Does not implicitly {@link ibc.core.channel.v1.QueryPacketAcknowledgementRequest.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementRequest - * @static - * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementRequest} message QueryPacketAcknowledgementRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryPacketAcknowledgementRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); - if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); - if (message.sequence != null && Object.hasOwnProperty.call(message, "sequence")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.sequence); - return writer; - }; - - /** - * Encodes the specified QueryPacketAcknowledgementRequest message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryPacketAcknowledgementRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementRequest - * @static - * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementRequest} message QueryPacketAcknowledgementRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryPacketAcknowledgementRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryPacketAcknowledgementRequest message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.QueryPacketAcknowledgementRequest} QueryPacketAcknowledgementRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryPacketAcknowledgementRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryPacketAcknowledgementRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.port_id = reader.string(); - break; - case 2: - message.channel_id = reader.string(); - break; - case 3: - message.sequence = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryPacketAcknowledgementRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.QueryPacketAcknowledgementRequest} QueryPacketAcknowledgementRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryPacketAcknowledgementRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryPacketAcknowledgementRequest message. - * @function verify - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryPacketAcknowledgementRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.port_id != null && message.hasOwnProperty("port_id")) - if (!$util.isString(message.port_id)) - return "port_id: string expected"; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - if (!$util.isString(message.channel_id)) - return "channel_id: string expected"; - if (message.sequence != null && message.hasOwnProperty("sequence")) - if (!$util.isInteger(message.sequence) && !(message.sequence && $util.isInteger(message.sequence.low) && $util.isInteger(message.sequence.high))) - return "sequence: integer|Long expected"; - return null; - }; - - /** - * Creates a QueryPacketAcknowledgementRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementRequest - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.QueryPacketAcknowledgementRequest} QueryPacketAcknowledgementRequest - */ - QueryPacketAcknowledgementRequest.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.QueryPacketAcknowledgementRequest) - return object; - let message = new $root.ibc.core.channel.v1.QueryPacketAcknowledgementRequest(); - if (object.port_id != null) - message.port_id = String(object.port_id); - if (object.channel_id != null) - message.channel_id = String(object.channel_id); - if (object.sequence != null) - if ($util.Long) - (message.sequence = $util.Long.fromValue(object.sequence)).unsigned = true; - else if (typeof object.sequence === "string") - message.sequence = parseInt(object.sequence, 10); - else if (typeof object.sequence === "number") - message.sequence = object.sequence; - else if (typeof object.sequence === "object") - message.sequence = new $util.LongBits(object.sequence.low >>> 0, object.sequence.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a QueryPacketAcknowledgementRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementRequest - * @static - * @param {ibc.core.channel.v1.QueryPacketAcknowledgementRequest} message QueryPacketAcknowledgementRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryPacketAcknowledgementRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.port_id = ""; - object.channel_id = ""; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.sequence = options.longs === String ? "0" : 0; - } - if (message.port_id != null && message.hasOwnProperty("port_id")) - object.port_id = message.port_id; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - object.channel_id = message.channel_id; - if (message.sequence != null && message.hasOwnProperty("sequence")) - if (typeof message.sequence === "number") - object.sequence = options.longs === String ? String(message.sequence) : message.sequence; - else - object.sequence = options.longs === String ? $util.Long.prototype.toString.call(message.sequence) : options.longs === Number ? new $util.LongBits(message.sequence.low >>> 0, message.sequence.high >>> 0).toNumber(true) : message.sequence; - return object; - }; - - /** - * Converts this QueryPacketAcknowledgementRequest to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementRequest - * @instance - * @returns {Object.} JSON object - */ - QueryPacketAcknowledgementRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryPacketAcknowledgementRequest; - })(); - - v1.QueryPacketAcknowledgementResponse = (function() { - - /** - * Properties of a QueryPacketAcknowledgementResponse. - * @memberof ibc.core.channel.v1 - * @interface IQueryPacketAcknowledgementResponse - * @property {Uint8Array|null} [acknowledgement] QueryPacketAcknowledgementResponse acknowledgement - * @property {Uint8Array|null} [proof] QueryPacketAcknowledgementResponse proof - * @property {ibc.core.client.v1.IHeight|null} [proof_height] QueryPacketAcknowledgementResponse proof_height - */ - - /** - * Constructs a new QueryPacketAcknowledgementResponse. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a QueryPacketAcknowledgementResponse. - * @implements IQueryPacketAcknowledgementResponse - * @constructor - * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementResponse=} [properties] Properties to set - */ - function QueryPacketAcknowledgementResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryPacketAcknowledgementResponse acknowledgement. - * @member {Uint8Array} acknowledgement - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementResponse - * @instance - */ - QueryPacketAcknowledgementResponse.prototype.acknowledgement = $util.newBuffer([]); - - /** - * QueryPacketAcknowledgementResponse proof. - * @member {Uint8Array} proof - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementResponse - * @instance - */ - QueryPacketAcknowledgementResponse.prototype.proof = $util.newBuffer([]); - - /** - * QueryPacketAcknowledgementResponse proof_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementResponse - * @instance - */ - QueryPacketAcknowledgementResponse.prototype.proof_height = null; - - /** - * Encodes the specified QueryPacketAcknowledgementResponse message. Does not implicitly {@link ibc.core.channel.v1.QueryPacketAcknowledgementResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementResponse - * @static - * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementResponse} message QueryPacketAcknowledgementResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryPacketAcknowledgementResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.acknowledgement != null && Object.hasOwnProperty.call(message, "acknowledgement")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.acknowledgement); - if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proof); - if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) - $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryPacketAcknowledgementResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryPacketAcknowledgementResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementResponse - * @static - * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementResponse} message QueryPacketAcknowledgementResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryPacketAcknowledgementResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryPacketAcknowledgementResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.QueryPacketAcknowledgementResponse} QueryPacketAcknowledgementResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryPacketAcknowledgementResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryPacketAcknowledgementResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.acknowledgement = reader.bytes(); - break; - case 2: - message.proof = reader.bytes(); - break; - case 3: - message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryPacketAcknowledgementResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.QueryPacketAcknowledgementResponse} QueryPacketAcknowledgementResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryPacketAcknowledgementResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryPacketAcknowledgementResponse message. - * @function verify - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryPacketAcknowledgementResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.acknowledgement != null && message.hasOwnProperty("acknowledgement")) - if (!(message.acknowledgement && typeof message.acknowledgement.length === "number" || $util.isString(message.acknowledgement))) - return "acknowledgement: buffer expected"; - if (message.proof != null && message.hasOwnProperty("proof")) - if (!(message.proof && typeof message.proof.length === "number" || $util.isString(message.proof))) - return "proof: buffer expected"; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); - if (error) - return "proof_height." + error; - } - return null; - }; - - /** - * Creates a QueryPacketAcknowledgementResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.QueryPacketAcknowledgementResponse} QueryPacketAcknowledgementResponse - */ - QueryPacketAcknowledgementResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.QueryPacketAcknowledgementResponse) - return object; - let message = new $root.ibc.core.channel.v1.QueryPacketAcknowledgementResponse(); - if (object.acknowledgement != null) - if (typeof object.acknowledgement === "string") - $util.base64.decode(object.acknowledgement, message.acknowledgement = $util.newBuffer($util.base64.length(object.acknowledgement)), 0); - else if (object.acknowledgement.length) - message.acknowledgement = object.acknowledgement; - if (object.proof != null) - if (typeof object.proof === "string") - $util.base64.decode(object.proof, message.proof = $util.newBuffer($util.base64.length(object.proof)), 0); - else if (object.proof.length) - message.proof = object.proof; - if (object.proof_height != null) { - if (typeof object.proof_height !== "object") - throw TypeError(".ibc.core.channel.v1.QueryPacketAcknowledgementResponse.proof_height: object expected"); - message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); - } - return message; - }; - - /** - * Creates a plain object from a QueryPacketAcknowledgementResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementResponse - * @static - * @param {ibc.core.channel.v1.QueryPacketAcknowledgementResponse} message QueryPacketAcknowledgementResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryPacketAcknowledgementResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if (options.bytes === String) - object.acknowledgement = ""; - else { - object.acknowledgement = []; - if (options.bytes !== Array) - object.acknowledgement = $util.newBuffer(object.acknowledgement); - } - if (options.bytes === String) - object.proof = ""; - else { - object.proof = []; - if (options.bytes !== Array) - object.proof = $util.newBuffer(object.proof); - } - object.proof_height = null; - } - if (message.acknowledgement != null && message.hasOwnProperty("acknowledgement")) - object.acknowledgement = options.bytes === String ? $util.base64.encode(message.acknowledgement, 0, message.acknowledgement.length) : options.bytes === Array ? Array.prototype.slice.call(message.acknowledgement) : message.acknowledgement; - if (message.proof != null && message.hasOwnProperty("proof")) - object.proof = options.bytes === String ? $util.base64.encode(message.proof, 0, message.proof.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof) : message.proof; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) - object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); - return object; - }; - - /** - * Converts this QueryPacketAcknowledgementResponse to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementResponse - * @instance - * @returns {Object.} JSON object - */ - QueryPacketAcknowledgementResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryPacketAcknowledgementResponse; - })(); - - v1.QueryPacketAcknowledgementsRequest = (function() { - - /** - * Properties of a QueryPacketAcknowledgementsRequest. - * @memberof ibc.core.channel.v1 - * @interface IQueryPacketAcknowledgementsRequest - * @property {string|null} [port_id] QueryPacketAcknowledgementsRequest port_id - * @property {string|null} [channel_id] QueryPacketAcknowledgementsRequest channel_id - * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryPacketAcknowledgementsRequest pagination - */ - - /** - * Constructs a new QueryPacketAcknowledgementsRequest. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a QueryPacketAcknowledgementsRequest. - * @implements IQueryPacketAcknowledgementsRequest - * @constructor - * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementsRequest=} [properties] Properties to set - */ - function QueryPacketAcknowledgementsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryPacketAcknowledgementsRequest port_id. - * @member {string} port_id - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsRequest - * @instance - */ - QueryPacketAcknowledgementsRequest.prototype.port_id = ""; - - /** - * QueryPacketAcknowledgementsRequest channel_id. - * @member {string} channel_id - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsRequest - * @instance - */ - QueryPacketAcknowledgementsRequest.prototype.channel_id = ""; - - /** - * QueryPacketAcknowledgementsRequest pagination. - * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsRequest - * @instance - */ - QueryPacketAcknowledgementsRequest.prototype.pagination = null; - - /** - * Encodes the specified QueryPacketAcknowledgementsRequest message. Does not implicitly {@link ibc.core.channel.v1.QueryPacketAcknowledgementsRequest.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsRequest - * @static - * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementsRequest} message QueryPacketAcknowledgementsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryPacketAcknowledgementsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); - if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryPacketAcknowledgementsRequest message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryPacketAcknowledgementsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsRequest - * @static - * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementsRequest} message QueryPacketAcknowledgementsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryPacketAcknowledgementsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryPacketAcknowledgementsRequest message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.QueryPacketAcknowledgementsRequest} QueryPacketAcknowledgementsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryPacketAcknowledgementsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryPacketAcknowledgementsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.port_id = reader.string(); - break; - case 2: - message.channel_id = reader.string(); - break; - case 3: - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryPacketAcknowledgementsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.QueryPacketAcknowledgementsRequest} QueryPacketAcknowledgementsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryPacketAcknowledgementsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryPacketAcknowledgementsRequest message. - * @function verify - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryPacketAcknowledgementsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.port_id != null && message.hasOwnProperty("port_id")) - if (!$util.isString(message.port_id)) - return "port_id: string expected"; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - if (!$util.isString(message.channel_id)) - return "channel_id: string expected"; - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryPacketAcknowledgementsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsRequest - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.QueryPacketAcknowledgementsRequest} QueryPacketAcknowledgementsRequest - */ - QueryPacketAcknowledgementsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.QueryPacketAcknowledgementsRequest) - return object; - let message = new $root.ibc.core.channel.v1.QueryPacketAcknowledgementsRequest(); - if (object.port_id != null) - message.port_id = String(object.port_id); - if (object.channel_id != null) - message.channel_id = String(object.channel_id); - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".ibc.core.channel.v1.QueryPacketAcknowledgementsRequest.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryPacketAcknowledgementsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsRequest - * @static - * @param {ibc.core.channel.v1.QueryPacketAcknowledgementsRequest} message QueryPacketAcknowledgementsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryPacketAcknowledgementsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.port_id = ""; - object.channel_id = ""; - object.pagination = null; - } - if (message.port_id != null && message.hasOwnProperty("port_id")) - object.port_id = message.port_id; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - object.channel_id = message.channel_id; - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryPacketAcknowledgementsRequest to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryPacketAcknowledgementsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryPacketAcknowledgementsRequest; - })(); - - v1.QueryPacketAcknowledgementsResponse = (function() { - - /** - * Properties of a QueryPacketAcknowledgementsResponse. - * @memberof ibc.core.channel.v1 - * @interface IQueryPacketAcknowledgementsResponse - * @property {Array.|null} [acknowledgements] QueryPacketAcknowledgementsResponse acknowledgements - * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryPacketAcknowledgementsResponse pagination - * @property {ibc.core.client.v1.IHeight|null} [height] QueryPacketAcknowledgementsResponse height - */ - - /** - * Constructs a new QueryPacketAcknowledgementsResponse. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a QueryPacketAcknowledgementsResponse. - * @implements IQueryPacketAcknowledgementsResponse - * @constructor - * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementsResponse=} [properties] Properties to set - */ - function QueryPacketAcknowledgementsResponse(properties) { - this.acknowledgements = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryPacketAcknowledgementsResponse acknowledgements. - * @member {Array.} acknowledgements - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsResponse - * @instance - */ - QueryPacketAcknowledgementsResponse.prototype.acknowledgements = $util.emptyArray; - - /** - * QueryPacketAcknowledgementsResponse pagination. - * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsResponse - * @instance - */ - QueryPacketAcknowledgementsResponse.prototype.pagination = null; - - /** - * QueryPacketAcknowledgementsResponse height. - * @member {ibc.core.client.v1.IHeight|null|undefined} height - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsResponse - * @instance - */ - QueryPacketAcknowledgementsResponse.prototype.height = null; - - /** - * Encodes the specified QueryPacketAcknowledgementsResponse message. Does not implicitly {@link ibc.core.channel.v1.QueryPacketAcknowledgementsResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsResponse - * @static - * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementsResponse} message QueryPacketAcknowledgementsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryPacketAcknowledgementsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.acknowledgements != null && message.acknowledgements.length) - for (let i = 0; i < message.acknowledgements.length; ++i) - $root.ibc.core.channel.v1.PacketState.encode(message.acknowledgements[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - $root.ibc.core.client.v1.Height.encode(message.height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryPacketAcknowledgementsResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryPacketAcknowledgementsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsResponse - * @static - * @param {ibc.core.channel.v1.IQueryPacketAcknowledgementsResponse} message QueryPacketAcknowledgementsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryPacketAcknowledgementsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryPacketAcknowledgementsResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.QueryPacketAcknowledgementsResponse} QueryPacketAcknowledgementsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryPacketAcknowledgementsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryPacketAcknowledgementsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.acknowledgements && message.acknowledgements.length)) - message.acknowledgements = []; - message.acknowledgements.push($root.ibc.core.channel.v1.PacketState.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); - break; - case 3: - message.height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryPacketAcknowledgementsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.QueryPacketAcknowledgementsResponse} QueryPacketAcknowledgementsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryPacketAcknowledgementsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryPacketAcknowledgementsResponse message. - * @function verify - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryPacketAcknowledgementsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.acknowledgements != null && message.hasOwnProperty("acknowledgements")) { - if (!Array.isArray(message.acknowledgements)) - return "acknowledgements: array expected"; - for (let i = 0; i < message.acknowledgements.length; ++i) { - let error = $root.ibc.core.channel.v1.PacketState.verify(message.acknowledgements[i]); - if (error) - return "acknowledgements." + error; - } - } - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); - if (error) - return "pagination." + error; - } - if (message.height != null && message.hasOwnProperty("height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.height); - if (error) - return "height." + error; - } - return null; - }; - - /** - * Creates a QueryPacketAcknowledgementsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.QueryPacketAcknowledgementsResponse} QueryPacketAcknowledgementsResponse - */ - QueryPacketAcknowledgementsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.QueryPacketAcknowledgementsResponse) - return object; - let message = new $root.ibc.core.channel.v1.QueryPacketAcknowledgementsResponse(); - if (object.acknowledgements) { - if (!Array.isArray(object.acknowledgements)) - throw TypeError(".ibc.core.channel.v1.QueryPacketAcknowledgementsResponse.acknowledgements: array expected"); - message.acknowledgements = []; - for (let i = 0; i < object.acknowledgements.length; ++i) { - if (typeof object.acknowledgements[i] !== "object") - throw TypeError(".ibc.core.channel.v1.QueryPacketAcknowledgementsResponse.acknowledgements: object expected"); - message.acknowledgements[i] = $root.ibc.core.channel.v1.PacketState.fromObject(object.acknowledgements[i]); - } - } - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".ibc.core.channel.v1.QueryPacketAcknowledgementsResponse.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); - } - if (object.height != null) { - if (typeof object.height !== "object") - throw TypeError(".ibc.core.channel.v1.QueryPacketAcknowledgementsResponse.height: object expected"); - message.height = $root.ibc.core.client.v1.Height.fromObject(object.height); - } - return message; - }; - - /** - * Creates a plain object from a QueryPacketAcknowledgementsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsResponse - * @static - * @param {ibc.core.channel.v1.QueryPacketAcknowledgementsResponse} message QueryPacketAcknowledgementsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryPacketAcknowledgementsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.acknowledgements = []; - if (options.defaults) { - object.pagination = null; - object.height = null; - } - if (message.acknowledgements && message.acknowledgements.length) { - object.acknowledgements = []; - for (let j = 0; j < message.acknowledgements.length; ++j) - object.acknowledgements[j] = $root.ibc.core.channel.v1.PacketState.toObject(message.acknowledgements[j], options); - } - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); - if (message.height != null && message.hasOwnProperty("height")) - object.height = $root.ibc.core.client.v1.Height.toObject(message.height, options); - return object; - }; - - /** - * Converts this QueryPacketAcknowledgementsResponse to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.QueryPacketAcknowledgementsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryPacketAcknowledgementsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryPacketAcknowledgementsResponse; - })(); - - v1.QueryUnreceivedPacketsRequest = (function() { - - /** - * Properties of a QueryUnreceivedPacketsRequest. - * @memberof ibc.core.channel.v1 - * @interface IQueryUnreceivedPacketsRequest - * @property {string|null} [port_id] QueryUnreceivedPacketsRequest port_id - * @property {string|null} [channel_id] QueryUnreceivedPacketsRequest channel_id - * @property {Array.|null} [packet_commitment_sequences] QueryUnreceivedPacketsRequest packet_commitment_sequences - */ - - /** - * Constructs a new QueryUnreceivedPacketsRequest. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a QueryUnreceivedPacketsRequest. - * @implements IQueryUnreceivedPacketsRequest - * @constructor - * @param {ibc.core.channel.v1.IQueryUnreceivedPacketsRequest=} [properties] Properties to set - */ - function QueryUnreceivedPacketsRequest(properties) { - this.packet_commitment_sequences = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryUnreceivedPacketsRequest port_id. - * @member {string} port_id - * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsRequest - * @instance - */ - QueryUnreceivedPacketsRequest.prototype.port_id = ""; - - /** - * QueryUnreceivedPacketsRequest channel_id. - * @member {string} channel_id - * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsRequest - * @instance - */ - QueryUnreceivedPacketsRequest.prototype.channel_id = ""; - - /** - * QueryUnreceivedPacketsRequest packet_commitment_sequences. - * @member {Array.} packet_commitment_sequences - * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsRequest - * @instance - */ - QueryUnreceivedPacketsRequest.prototype.packet_commitment_sequences = $util.emptyArray; - - /** - * Encodes the specified QueryUnreceivedPacketsRequest message. Does not implicitly {@link ibc.core.channel.v1.QueryUnreceivedPacketsRequest.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsRequest - * @static - * @param {ibc.core.channel.v1.IQueryUnreceivedPacketsRequest} message QueryUnreceivedPacketsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryUnreceivedPacketsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); - if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); - if (message.packet_commitment_sequences != null && message.packet_commitment_sequences.length) { - writer.uint32(/* id 3, wireType 2 =*/26).fork(); - for (let i = 0; i < message.packet_commitment_sequences.length; ++i) - writer.uint64(message.packet_commitment_sequences[i]); - writer.ldelim(); - } - return writer; - }; - - /** - * Encodes the specified QueryUnreceivedPacketsRequest message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryUnreceivedPacketsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsRequest - * @static - * @param {ibc.core.channel.v1.IQueryUnreceivedPacketsRequest} message QueryUnreceivedPacketsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryUnreceivedPacketsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryUnreceivedPacketsRequest message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.QueryUnreceivedPacketsRequest} QueryUnreceivedPacketsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryUnreceivedPacketsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryUnreceivedPacketsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.port_id = reader.string(); - break; - case 2: - message.channel_id = reader.string(); - break; - case 3: - if (!(message.packet_commitment_sequences && message.packet_commitment_sequences.length)) - message.packet_commitment_sequences = []; - if ((tag & 7) === 2) { - let end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.packet_commitment_sequences.push(reader.uint64()); - } else - message.packet_commitment_sequences.push(reader.uint64()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryUnreceivedPacketsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.QueryUnreceivedPacketsRequest} QueryUnreceivedPacketsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryUnreceivedPacketsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryUnreceivedPacketsRequest message. - * @function verify - * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryUnreceivedPacketsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.port_id != null && message.hasOwnProperty("port_id")) - if (!$util.isString(message.port_id)) - return "port_id: string expected"; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - if (!$util.isString(message.channel_id)) - return "channel_id: string expected"; - if (message.packet_commitment_sequences != null && message.hasOwnProperty("packet_commitment_sequences")) { - if (!Array.isArray(message.packet_commitment_sequences)) - return "packet_commitment_sequences: array expected"; - for (let i = 0; i < message.packet_commitment_sequences.length; ++i) - if (!$util.isInteger(message.packet_commitment_sequences[i]) && !(message.packet_commitment_sequences[i] && $util.isInteger(message.packet_commitment_sequences[i].low) && $util.isInteger(message.packet_commitment_sequences[i].high))) - return "packet_commitment_sequences: integer|Long[] expected"; - } - return null; - }; - - /** - * Creates a QueryUnreceivedPacketsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsRequest - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.QueryUnreceivedPacketsRequest} QueryUnreceivedPacketsRequest - */ - QueryUnreceivedPacketsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.QueryUnreceivedPacketsRequest) - return object; - let message = new $root.ibc.core.channel.v1.QueryUnreceivedPacketsRequest(); - if (object.port_id != null) - message.port_id = String(object.port_id); - if (object.channel_id != null) - message.channel_id = String(object.channel_id); - if (object.packet_commitment_sequences) { - if (!Array.isArray(object.packet_commitment_sequences)) - throw TypeError(".ibc.core.channel.v1.QueryUnreceivedPacketsRequest.packet_commitment_sequences: array expected"); - message.packet_commitment_sequences = []; - for (let i = 0; i < object.packet_commitment_sequences.length; ++i) - if ($util.Long) - (message.packet_commitment_sequences[i] = $util.Long.fromValue(object.packet_commitment_sequences[i])).unsigned = true; - else if (typeof object.packet_commitment_sequences[i] === "string") - message.packet_commitment_sequences[i] = parseInt(object.packet_commitment_sequences[i], 10); - else if (typeof object.packet_commitment_sequences[i] === "number") - message.packet_commitment_sequences[i] = object.packet_commitment_sequences[i]; - else if (typeof object.packet_commitment_sequences[i] === "object") - message.packet_commitment_sequences[i] = new $util.LongBits(object.packet_commitment_sequences[i].low >>> 0, object.packet_commitment_sequences[i].high >>> 0).toNumber(true); - } - return message; - }; - - /** - * Creates a plain object from a QueryUnreceivedPacketsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsRequest - * @static - * @param {ibc.core.channel.v1.QueryUnreceivedPacketsRequest} message QueryUnreceivedPacketsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryUnreceivedPacketsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.packet_commitment_sequences = []; - if (options.defaults) { - object.port_id = ""; - object.channel_id = ""; - } - if (message.port_id != null && message.hasOwnProperty("port_id")) - object.port_id = message.port_id; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - object.channel_id = message.channel_id; - if (message.packet_commitment_sequences && message.packet_commitment_sequences.length) { - object.packet_commitment_sequences = []; - for (let j = 0; j < message.packet_commitment_sequences.length; ++j) - if (typeof message.packet_commitment_sequences[j] === "number") - object.packet_commitment_sequences[j] = options.longs === String ? String(message.packet_commitment_sequences[j]) : message.packet_commitment_sequences[j]; - else - object.packet_commitment_sequences[j] = options.longs === String ? $util.Long.prototype.toString.call(message.packet_commitment_sequences[j]) : options.longs === Number ? new $util.LongBits(message.packet_commitment_sequences[j].low >>> 0, message.packet_commitment_sequences[j].high >>> 0).toNumber(true) : message.packet_commitment_sequences[j]; - } - return object; - }; - - /** - * Converts this QueryUnreceivedPacketsRequest to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryUnreceivedPacketsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryUnreceivedPacketsRequest; - })(); - - v1.QueryUnreceivedPacketsResponse = (function() { - - /** - * Properties of a QueryUnreceivedPacketsResponse. - * @memberof ibc.core.channel.v1 - * @interface IQueryUnreceivedPacketsResponse - * @property {Array.|null} [sequences] QueryUnreceivedPacketsResponse sequences - * @property {ibc.core.client.v1.IHeight|null} [height] QueryUnreceivedPacketsResponse height - */ - - /** - * Constructs a new QueryUnreceivedPacketsResponse. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a QueryUnreceivedPacketsResponse. - * @implements IQueryUnreceivedPacketsResponse - * @constructor - * @param {ibc.core.channel.v1.IQueryUnreceivedPacketsResponse=} [properties] Properties to set - */ - function QueryUnreceivedPacketsResponse(properties) { - this.sequences = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryUnreceivedPacketsResponse sequences. - * @member {Array.} sequences - * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsResponse - * @instance - */ - QueryUnreceivedPacketsResponse.prototype.sequences = $util.emptyArray; - - /** - * QueryUnreceivedPacketsResponse height. - * @member {ibc.core.client.v1.IHeight|null|undefined} height - * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsResponse - * @instance - */ - QueryUnreceivedPacketsResponse.prototype.height = null; - - /** - * Encodes the specified QueryUnreceivedPacketsResponse message. Does not implicitly {@link ibc.core.channel.v1.QueryUnreceivedPacketsResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsResponse - * @static - * @param {ibc.core.channel.v1.IQueryUnreceivedPacketsResponse} message QueryUnreceivedPacketsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryUnreceivedPacketsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.sequences != null && message.sequences.length) { - writer.uint32(/* id 1, wireType 2 =*/10).fork(); - for (let i = 0; i < message.sequences.length; ++i) - writer.uint64(message.sequences[i]); - writer.ldelim(); - } - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - $root.ibc.core.client.v1.Height.encode(message.height, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryUnreceivedPacketsResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryUnreceivedPacketsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsResponse - * @static - * @param {ibc.core.channel.v1.IQueryUnreceivedPacketsResponse} message QueryUnreceivedPacketsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryUnreceivedPacketsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryUnreceivedPacketsResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.QueryUnreceivedPacketsResponse} QueryUnreceivedPacketsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryUnreceivedPacketsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryUnreceivedPacketsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.sequences && message.sequences.length)) - message.sequences = []; - if ((tag & 7) === 2) { - let end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.sequences.push(reader.uint64()); - } else - message.sequences.push(reader.uint64()); - break; - case 2: - message.height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryUnreceivedPacketsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.QueryUnreceivedPacketsResponse} QueryUnreceivedPacketsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryUnreceivedPacketsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryUnreceivedPacketsResponse message. - * @function verify - * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryUnreceivedPacketsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.sequences != null && message.hasOwnProperty("sequences")) { - if (!Array.isArray(message.sequences)) - return "sequences: array expected"; - for (let i = 0; i < message.sequences.length; ++i) - if (!$util.isInteger(message.sequences[i]) && !(message.sequences[i] && $util.isInteger(message.sequences[i].low) && $util.isInteger(message.sequences[i].high))) - return "sequences: integer|Long[] expected"; - } - if (message.height != null && message.hasOwnProperty("height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.height); - if (error) - return "height." + error; - } - return null; - }; - - /** - * Creates a QueryUnreceivedPacketsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.QueryUnreceivedPacketsResponse} QueryUnreceivedPacketsResponse - */ - QueryUnreceivedPacketsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.QueryUnreceivedPacketsResponse) - return object; - let message = new $root.ibc.core.channel.v1.QueryUnreceivedPacketsResponse(); - if (object.sequences) { - if (!Array.isArray(object.sequences)) - throw TypeError(".ibc.core.channel.v1.QueryUnreceivedPacketsResponse.sequences: array expected"); - message.sequences = []; - for (let i = 0; i < object.sequences.length; ++i) - if ($util.Long) - (message.sequences[i] = $util.Long.fromValue(object.sequences[i])).unsigned = true; - else if (typeof object.sequences[i] === "string") - message.sequences[i] = parseInt(object.sequences[i], 10); - else if (typeof object.sequences[i] === "number") - message.sequences[i] = object.sequences[i]; - else if (typeof object.sequences[i] === "object") - message.sequences[i] = new $util.LongBits(object.sequences[i].low >>> 0, object.sequences[i].high >>> 0).toNumber(true); - } - if (object.height != null) { - if (typeof object.height !== "object") - throw TypeError(".ibc.core.channel.v1.QueryUnreceivedPacketsResponse.height: object expected"); - message.height = $root.ibc.core.client.v1.Height.fromObject(object.height); - } - return message; - }; - - /** - * Creates a plain object from a QueryUnreceivedPacketsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsResponse - * @static - * @param {ibc.core.channel.v1.QueryUnreceivedPacketsResponse} message QueryUnreceivedPacketsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryUnreceivedPacketsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.sequences = []; - if (options.defaults) - object.height = null; - if (message.sequences && message.sequences.length) { - object.sequences = []; - for (let j = 0; j < message.sequences.length; ++j) - if (typeof message.sequences[j] === "number") - object.sequences[j] = options.longs === String ? String(message.sequences[j]) : message.sequences[j]; - else - object.sequences[j] = options.longs === String ? $util.Long.prototype.toString.call(message.sequences[j]) : options.longs === Number ? new $util.LongBits(message.sequences[j].low >>> 0, message.sequences[j].high >>> 0).toNumber(true) : message.sequences[j]; - } - if (message.height != null && message.hasOwnProperty("height")) - object.height = $root.ibc.core.client.v1.Height.toObject(message.height, options); - return object; - }; - - /** - * Converts this QueryUnreceivedPacketsResponse to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.QueryUnreceivedPacketsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryUnreceivedPacketsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryUnreceivedPacketsResponse; - })(); - - v1.QueryUnreceivedAcksRequest = (function() { - - /** - * Properties of a QueryUnreceivedAcksRequest. - * @memberof ibc.core.channel.v1 - * @interface IQueryUnreceivedAcksRequest - * @property {string|null} [port_id] QueryUnreceivedAcksRequest port_id - * @property {string|null} [channel_id] QueryUnreceivedAcksRequest channel_id - * @property {Array.|null} [packet_ack_sequences] QueryUnreceivedAcksRequest packet_ack_sequences - */ - - /** - * Constructs a new QueryUnreceivedAcksRequest. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a QueryUnreceivedAcksRequest. - * @implements IQueryUnreceivedAcksRequest - * @constructor - * @param {ibc.core.channel.v1.IQueryUnreceivedAcksRequest=} [properties] Properties to set - */ - function QueryUnreceivedAcksRequest(properties) { - this.packet_ack_sequences = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryUnreceivedAcksRequest port_id. - * @member {string} port_id - * @memberof ibc.core.channel.v1.QueryUnreceivedAcksRequest - * @instance - */ - QueryUnreceivedAcksRequest.prototype.port_id = ""; - - /** - * QueryUnreceivedAcksRequest channel_id. - * @member {string} channel_id - * @memberof ibc.core.channel.v1.QueryUnreceivedAcksRequest - * @instance - */ - QueryUnreceivedAcksRequest.prototype.channel_id = ""; - - /** - * QueryUnreceivedAcksRequest packet_ack_sequences. - * @member {Array.} packet_ack_sequences - * @memberof ibc.core.channel.v1.QueryUnreceivedAcksRequest - * @instance - */ - QueryUnreceivedAcksRequest.prototype.packet_ack_sequences = $util.emptyArray; - - /** - * Encodes the specified QueryUnreceivedAcksRequest message. Does not implicitly {@link ibc.core.channel.v1.QueryUnreceivedAcksRequest.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.QueryUnreceivedAcksRequest - * @static - * @param {ibc.core.channel.v1.IQueryUnreceivedAcksRequest} message QueryUnreceivedAcksRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryUnreceivedAcksRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); - if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); - if (message.packet_ack_sequences != null && message.packet_ack_sequences.length) { - writer.uint32(/* id 3, wireType 2 =*/26).fork(); - for (let i = 0; i < message.packet_ack_sequences.length; ++i) - writer.uint64(message.packet_ack_sequences[i]); - writer.ldelim(); - } - return writer; - }; - - /** - * Encodes the specified QueryUnreceivedAcksRequest message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryUnreceivedAcksRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.QueryUnreceivedAcksRequest - * @static - * @param {ibc.core.channel.v1.IQueryUnreceivedAcksRequest} message QueryUnreceivedAcksRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryUnreceivedAcksRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryUnreceivedAcksRequest message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.QueryUnreceivedAcksRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.QueryUnreceivedAcksRequest} QueryUnreceivedAcksRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryUnreceivedAcksRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryUnreceivedAcksRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.port_id = reader.string(); - break; - case 2: - message.channel_id = reader.string(); - break; - case 3: - if (!(message.packet_ack_sequences && message.packet_ack_sequences.length)) - message.packet_ack_sequences = []; - if ((tag & 7) === 2) { - let end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.packet_ack_sequences.push(reader.uint64()); - } else - message.packet_ack_sequences.push(reader.uint64()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryUnreceivedAcksRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.QueryUnreceivedAcksRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.QueryUnreceivedAcksRequest} QueryUnreceivedAcksRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryUnreceivedAcksRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryUnreceivedAcksRequest message. - * @function verify - * @memberof ibc.core.channel.v1.QueryUnreceivedAcksRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryUnreceivedAcksRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.port_id != null && message.hasOwnProperty("port_id")) - if (!$util.isString(message.port_id)) - return "port_id: string expected"; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - if (!$util.isString(message.channel_id)) - return "channel_id: string expected"; - if (message.packet_ack_sequences != null && message.hasOwnProperty("packet_ack_sequences")) { - if (!Array.isArray(message.packet_ack_sequences)) - return "packet_ack_sequences: array expected"; - for (let i = 0; i < message.packet_ack_sequences.length; ++i) - if (!$util.isInteger(message.packet_ack_sequences[i]) && !(message.packet_ack_sequences[i] && $util.isInteger(message.packet_ack_sequences[i].low) && $util.isInteger(message.packet_ack_sequences[i].high))) - return "packet_ack_sequences: integer|Long[] expected"; - } - return null; - }; - - /** - * Creates a QueryUnreceivedAcksRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.QueryUnreceivedAcksRequest - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.QueryUnreceivedAcksRequest} QueryUnreceivedAcksRequest - */ - QueryUnreceivedAcksRequest.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.QueryUnreceivedAcksRequest) - return object; - let message = new $root.ibc.core.channel.v1.QueryUnreceivedAcksRequest(); - if (object.port_id != null) - message.port_id = String(object.port_id); - if (object.channel_id != null) - message.channel_id = String(object.channel_id); - if (object.packet_ack_sequences) { - if (!Array.isArray(object.packet_ack_sequences)) - throw TypeError(".ibc.core.channel.v1.QueryUnreceivedAcksRequest.packet_ack_sequences: array expected"); - message.packet_ack_sequences = []; - for (let i = 0; i < object.packet_ack_sequences.length; ++i) - if ($util.Long) - (message.packet_ack_sequences[i] = $util.Long.fromValue(object.packet_ack_sequences[i])).unsigned = true; - else if (typeof object.packet_ack_sequences[i] === "string") - message.packet_ack_sequences[i] = parseInt(object.packet_ack_sequences[i], 10); - else if (typeof object.packet_ack_sequences[i] === "number") - message.packet_ack_sequences[i] = object.packet_ack_sequences[i]; - else if (typeof object.packet_ack_sequences[i] === "object") - message.packet_ack_sequences[i] = new $util.LongBits(object.packet_ack_sequences[i].low >>> 0, object.packet_ack_sequences[i].high >>> 0).toNumber(true); - } - return message; - }; - - /** - * Creates a plain object from a QueryUnreceivedAcksRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.QueryUnreceivedAcksRequest - * @static - * @param {ibc.core.channel.v1.QueryUnreceivedAcksRequest} message QueryUnreceivedAcksRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryUnreceivedAcksRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.packet_ack_sequences = []; - if (options.defaults) { - object.port_id = ""; - object.channel_id = ""; - } - if (message.port_id != null && message.hasOwnProperty("port_id")) - object.port_id = message.port_id; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - object.channel_id = message.channel_id; - if (message.packet_ack_sequences && message.packet_ack_sequences.length) { - object.packet_ack_sequences = []; - for (let j = 0; j < message.packet_ack_sequences.length; ++j) - if (typeof message.packet_ack_sequences[j] === "number") - object.packet_ack_sequences[j] = options.longs === String ? String(message.packet_ack_sequences[j]) : message.packet_ack_sequences[j]; - else - object.packet_ack_sequences[j] = options.longs === String ? $util.Long.prototype.toString.call(message.packet_ack_sequences[j]) : options.longs === Number ? new $util.LongBits(message.packet_ack_sequences[j].low >>> 0, message.packet_ack_sequences[j].high >>> 0).toNumber(true) : message.packet_ack_sequences[j]; - } - return object; - }; - - /** - * Converts this QueryUnreceivedAcksRequest to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.QueryUnreceivedAcksRequest - * @instance - * @returns {Object.} JSON object - */ - QueryUnreceivedAcksRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryUnreceivedAcksRequest; - })(); - - v1.QueryUnreceivedAcksResponse = (function() { - - /** - * Properties of a QueryUnreceivedAcksResponse. - * @memberof ibc.core.channel.v1 - * @interface IQueryUnreceivedAcksResponse - * @property {Array.|null} [sequences] QueryUnreceivedAcksResponse sequences - * @property {ibc.core.client.v1.IHeight|null} [height] QueryUnreceivedAcksResponse height - */ - - /** - * Constructs a new QueryUnreceivedAcksResponse. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a QueryUnreceivedAcksResponse. - * @implements IQueryUnreceivedAcksResponse - * @constructor - * @param {ibc.core.channel.v1.IQueryUnreceivedAcksResponse=} [properties] Properties to set - */ - function QueryUnreceivedAcksResponse(properties) { - this.sequences = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryUnreceivedAcksResponse sequences. - * @member {Array.} sequences - * @memberof ibc.core.channel.v1.QueryUnreceivedAcksResponse - * @instance - */ - QueryUnreceivedAcksResponse.prototype.sequences = $util.emptyArray; - - /** - * QueryUnreceivedAcksResponse height. - * @member {ibc.core.client.v1.IHeight|null|undefined} height - * @memberof ibc.core.channel.v1.QueryUnreceivedAcksResponse - * @instance - */ - QueryUnreceivedAcksResponse.prototype.height = null; - - /** - * Encodes the specified QueryUnreceivedAcksResponse message. Does not implicitly {@link ibc.core.channel.v1.QueryUnreceivedAcksResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.QueryUnreceivedAcksResponse - * @static - * @param {ibc.core.channel.v1.IQueryUnreceivedAcksResponse} message QueryUnreceivedAcksResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryUnreceivedAcksResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.sequences != null && message.sequences.length) { - writer.uint32(/* id 1, wireType 2 =*/10).fork(); - for (let i = 0; i < message.sequences.length; ++i) - writer.uint64(message.sequences[i]); - writer.ldelim(); - } - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - $root.ibc.core.client.v1.Height.encode(message.height, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryUnreceivedAcksResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryUnreceivedAcksResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.QueryUnreceivedAcksResponse - * @static - * @param {ibc.core.channel.v1.IQueryUnreceivedAcksResponse} message QueryUnreceivedAcksResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryUnreceivedAcksResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryUnreceivedAcksResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.QueryUnreceivedAcksResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.QueryUnreceivedAcksResponse} QueryUnreceivedAcksResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryUnreceivedAcksResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryUnreceivedAcksResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.sequences && message.sequences.length)) - message.sequences = []; - if ((tag & 7) === 2) { - let end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.sequences.push(reader.uint64()); - } else - message.sequences.push(reader.uint64()); - break; - case 2: - message.height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryUnreceivedAcksResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.QueryUnreceivedAcksResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.QueryUnreceivedAcksResponse} QueryUnreceivedAcksResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryUnreceivedAcksResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryUnreceivedAcksResponse message. - * @function verify - * @memberof ibc.core.channel.v1.QueryUnreceivedAcksResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryUnreceivedAcksResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.sequences != null && message.hasOwnProperty("sequences")) { - if (!Array.isArray(message.sequences)) - return "sequences: array expected"; - for (let i = 0; i < message.sequences.length; ++i) - if (!$util.isInteger(message.sequences[i]) && !(message.sequences[i] && $util.isInteger(message.sequences[i].low) && $util.isInteger(message.sequences[i].high))) - return "sequences: integer|Long[] expected"; - } - if (message.height != null && message.hasOwnProperty("height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.height); - if (error) - return "height." + error; - } - return null; - }; - - /** - * Creates a QueryUnreceivedAcksResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.QueryUnreceivedAcksResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.QueryUnreceivedAcksResponse} QueryUnreceivedAcksResponse - */ - QueryUnreceivedAcksResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.QueryUnreceivedAcksResponse) - return object; - let message = new $root.ibc.core.channel.v1.QueryUnreceivedAcksResponse(); - if (object.sequences) { - if (!Array.isArray(object.sequences)) - throw TypeError(".ibc.core.channel.v1.QueryUnreceivedAcksResponse.sequences: array expected"); - message.sequences = []; - for (let i = 0; i < object.sequences.length; ++i) - if ($util.Long) - (message.sequences[i] = $util.Long.fromValue(object.sequences[i])).unsigned = true; - else if (typeof object.sequences[i] === "string") - message.sequences[i] = parseInt(object.sequences[i], 10); - else if (typeof object.sequences[i] === "number") - message.sequences[i] = object.sequences[i]; - else if (typeof object.sequences[i] === "object") - message.sequences[i] = new $util.LongBits(object.sequences[i].low >>> 0, object.sequences[i].high >>> 0).toNumber(true); - } - if (object.height != null) { - if (typeof object.height !== "object") - throw TypeError(".ibc.core.channel.v1.QueryUnreceivedAcksResponse.height: object expected"); - message.height = $root.ibc.core.client.v1.Height.fromObject(object.height); - } - return message; - }; - - /** - * Creates a plain object from a QueryUnreceivedAcksResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.QueryUnreceivedAcksResponse - * @static - * @param {ibc.core.channel.v1.QueryUnreceivedAcksResponse} message QueryUnreceivedAcksResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryUnreceivedAcksResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.sequences = []; - if (options.defaults) - object.height = null; - if (message.sequences && message.sequences.length) { - object.sequences = []; - for (let j = 0; j < message.sequences.length; ++j) - if (typeof message.sequences[j] === "number") - object.sequences[j] = options.longs === String ? String(message.sequences[j]) : message.sequences[j]; - else - object.sequences[j] = options.longs === String ? $util.Long.prototype.toString.call(message.sequences[j]) : options.longs === Number ? new $util.LongBits(message.sequences[j].low >>> 0, message.sequences[j].high >>> 0).toNumber(true) : message.sequences[j]; - } - if (message.height != null && message.hasOwnProperty("height")) - object.height = $root.ibc.core.client.v1.Height.toObject(message.height, options); - return object; - }; - - /** - * Converts this QueryUnreceivedAcksResponse to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.QueryUnreceivedAcksResponse - * @instance - * @returns {Object.} JSON object - */ - QueryUnreceivedAcksResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryUnreceivedAcksResponse; - })(); - - v1.QueryNextSequenceReceiveRequest = (function() { - - /** - * Properties of a QueryNextSequenceReceiveRequest. - * @memberof ibc.core.channel.v1 - * @interface IQueryNextSequenceReceiveRequest - * @property {string|null} [port_id] QueryNextSequenceReceiveRequest port_id - * @property {string|null} [channel_id] QueryNextSequenceReceiveRequest channel_id - */ - - /** - * Constructs a new QueryNextSequenceReceiveRequest. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a QueryNextSequenceReceiveRequest. - * @implements IQueryNextSequenceReceiveRequest - * @constructor - * @param {ibc.core.channel.v1.IQueryNextSequenceReceiveRequest=} [properties] Properties to set - */ - function QueryNextSequenceReceiveRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryNextSequenceReceiveRequest port_id. - * @member {string} port_id - * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveRequest - * @instance - */ - QueryNextSequenceReceiveRequest.prototype.port_id = ""; - - /** - * QueryNextSequenceReceiveRequest channel_id. - * @member {string} channel_id - * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveRequest - * @instance - */ - QueryNextSequenceReceiveRequest.prototype.channel_id = ""; - - /** - * Encodes the specified QueryNextSequenceReceiveRequest message. Does not implicitly {@link ibc.core.channel.v1.QueryNextSequenceReceiveRequest.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveRequest - * @static - * @param {ibc.core.channel.v1.IQueryNextSequenceReceiveRequest} message QueryNextSequenceReceiveRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryNextSequenceReceiveRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); - if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); - return writer; - }; - - /** - * Encodes the specified QueryNextSequenceReceiveRequest message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryNextSequenceReceiveRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveRequest - * @static - * @param {ibc.core.channel.v1.IQueryNextSequenceReceiveRequest} message QueryNextSequenceReceiveRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryNextSequenceReceiveRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryNextSequenceReceiveRequest message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.QueryNextSequenceReceiveRequest} QueryNextSequenceReceiveRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryNextSequenceReceiveRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryNextSequenceReceiveRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.port_id = reader.string(); - break; - case 2: - message.channel_id = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryNextSequenceReceiveRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.QueryNextSequenceReceiveRequest} QueryNextSequenceReceiveRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryNextSequenceReceiveRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryNextSequenceReceiveRequest message. - * @function verify - * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryNextSequenceReceiveRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.port_id != null && message.hasOwnProperty("port_id")) - if (!$util.isString(message.port_id)) - return "port_id: string expected"; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - if (!$util.isString(message.channel_id)) - return "channel_id: string expected"; - return null; - }; - - /** - * Creates a QueryNextSequenceReceiveRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveRequest - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.QueryNextSequenceReceiveRequest} QueryNextSequenceReceiveRequest - */ - QueryNextSequenceReceiveRequest.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.QueryNextSequenceReceiveRequest) - return object; - let message = new $root.ibc.core.channel.v1.QueryNextSequenceReceiveRequest(); - if (object.port_id != null) - message.port_id = String(object.port_id); - if (object.channel_id != null) - message.channel_id = String(object.channel_id); - return message; - }; - - /** - * Creates a plain object from a QueryNextSequenceReceiveRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveRequest - * @static - * @param {ibc.core.channel.v1.QueryNextSequenceReceiveRequest} message QueryNextSequenceReceiveRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryNextSequenceReceiveRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.port_id = ""; - object.channel_id = ""; - } - if (message.port_id != null && message.hasOwnProperty("port_id")) - object.port_id = message.port_id; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - object.channel_id = message.channel_id; - return object; - }; - - /** - * Converts this QueryNextSequenceReceiveRequest to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveRequest - * @instance - * @returns {Object.} JSON object - */ - QueryNextSequenceReceiveRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryNextSequenceReceiveRequest; - })(); - - v1.QueryNextSequenceReceiveResponse = (function() { - - /** - * Properties of a QueryNextSequenceReceiveResponse. - * @memberof ibc.core.channel.v1 - * @interface IQueryNextSequenceReceiveResponse - * @property {Long|null} [next_sequence_receive] QueryNextSequenceReceiveResponse next_sequence_receive - * @property {Uint8Array|null} [proof] QueryNextSequenceReceiveResponse proof - * @property {ibc.core.client.v1.IHeight|null} [proof_height] QueryNextSequenceReceiveResponse proof_height - */ - - /** - * Constructs a new QueryNextSequenceReceiveResponse. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a QueryNextSequenceReceiveResponse. - * @implements IQueryNextSequenceReceiveResponse - * @constructor - * @param {ibc.core.channel.v1.IQueryNextSequenceReceiveResponse=} [properties] Properties to set - */ - function QueryNextSequenceReceiveResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryNextSequenceReceiveResponse next_sequence_receive. - * @member {Long} next_sequence_receive - * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveResponse - * @instance - */ - QueryNextSequenceReceiveResponse.prototype.next_sequence_receive = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * QueryNextSequenceReceiveResponse proof. - * @member {Uint8Array} proof - * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveResponse - * @instance - */ - QueryNextSequenceReceiveResponse.prototype.proof = $util.newBuffer([]); - - /** - * QueryNextSequenceReceiveResponse proof_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height - * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveResponse - * @instance - */ - QueryNextSequenceReceiveResponse.prototype.proof_height = null; - - /** - * Encodes the specified QueryNextSequenceReceiveResponse message. Does not implicitly {@link ibc.core.channel.v1.QueryNextSequenceReceiveResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveResponse - * @static - * @param {ibc.core.channel.v1.IQueryNextSequenceReceiveResponse} message QueryNextSequenceReceiveResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryNextSequenceReceiveResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.next_sequence_receive != null && Object.hasOwnProperty.call(message, "next_sequence_receive")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.next_sequence_receive); - if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proof); - if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) - $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryNextSequenceReceiveResponse message, length delimited. Does not implicitly {@link ibc.core.channel.v1.QueryNextSequenceReceiveResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveResponse - * @static - * @param {ibc.core.channel.v1.IQueryNextSequenceReceiveResponse} message QueryNextSequenceReceiveResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryNextSequenceReceiveResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryNextSequenceReceiveResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.QueryNextSequenceReceiveResponse} QueryNextSequenceReceiveResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryNextSequenceReceiveResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.QueryNextSequenceReceiveResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.next_sequence_receive = reader.uint64(); - break; - case 2: - message.proof = reader.bytes(); - break; - case 3: - message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryNextSequenceReceiveResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.QueryNextSequenceReceiveResponse} QueryNextSequenceReceiveResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryNextSequenceReceiveResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryNextSequenceReceiveResponse message. - * @function verify - * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryNextSequenceReceiveResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.next_sequence_receive != null && message.hasOwnProperty("next_sequence_receive")) - if (!$util.isInteger(message.next_sequence_receive) && !(message.next_sequence_receive && $util.isInteger(message.next_sequence_receive.low) && $util.isInteger(message.next_sequence_receive.high))) - return "next_sequence_receive: integer|Long expected"; - if (message.proof != null && message.hasOwnProperty("proof")) - if (!(message.proof && typeof message.proof.length === "number" || $util.isString(message.proof))) - return "proof: buffer expected"; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); - if (error) - return "proof_height." + error; - } - return null; - }; - - /** - * Creates a QueryNextSequenceReceiveResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.QueryNextSequenceReceiveResponse} QueryNextSequenceReceiveResponse - */ - QueryNextSequenceReceiveResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.QueryNextSequenceReceiveResponse) - return object; - let message = new $root.ibc.core.channel.v1.QueryNextSequenceReceiveResponse(); - if (object.next_sequence_receive != null) - if ($util.Long) - (message.next_sequence_receive = $util.Long.fromValue(object.next_sequence_receive)).unsigned = true; - else if (typeof object.next_sequence_receive === "string") - message.next_sequence_receive = parseInt(object.next_sequence_receive, 10); - else if (typeof object.next_sequence_receive === "number") - message.next_sequence_receive = object.next_sequence_receive; - else if (typeof object.next_sequence_receive === "object") - message.next_sequence_receive = new $util.LongBits(object.next_sequence_receive.low >>> 0, object.next_sequence_receive.high >>> 0).toNumber(true); - if (object.proof != null) - if (typeof object.proof === "string") - $util.base64.decode(object.proof, message.proof = $util.newBuffer($util.base64.length(object.proof)), 0); - else if (object.proof.length) - message.proof = object.proof; - if (object.proof_height != null) { - if (typeof object.proof_height !== "object") - throw TypeError(".ibc.core.channel.v1.QueryNextSequenceReceiveResponse.proof_height: object expected"); - message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); - } - return message; - }; - - /** - * Creates a plain object from a QueryNextSequenceReceiveResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveResponse - * @static - * @param {ibc.core.channel.v1.QueryNextSequenceReceiveResponse} message QueryNextSequenceReceiveResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryNextSequenceReceiveResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.next_sequence_receive = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.next_sequence_receive = options.longs === String ? "0" : 0; - if (options.bytes === String) - object.proof = ""; - else { - object.proof = []; - if (options.bytes !== Array) - object.proof = $util.newBuffer(object.proof); - } - object.proof_height = null; - } - if (message.next_sequence_receive != null && message.hasOwnProperty("next_sequence_receive")) - if (typeof message.next_sequence_receive === "number") - object.next_sequence_receive = options.longs === String ? String(message.next_sequence_receive) : message.next_sequence_receive; - else - object.next_sequence_receive = options.longs === String ? $util.Long.prototype.toString.call(message.next_sequence_receive) : options.longs === Number ? new $util.LongBits(message.next_sequence_receive.low >>> 0, message.next_sequence_receive.high >>> 0).toNumber(true) : message.next_sequence_receive; - if (message.proof != null && message.hasOwnProperty("proof")) - object.proof = options.bytes === String ? $util.base64.encode(message.proof, 0, message.proof.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof) : message.proof; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) - object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); - return object; - }; - - /** - * Converts this QueryNextSequenceReceiveResponse to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.QueryNextSequenceReceiveResponse - * @instance - * @returns {Object.} JSON object - */ - QueryNextSequenceReceiveResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryNextSequenceReceiveResponse; - })(); - - v1.GenesisState = (function() { - - /** - * Properties of a GenesisState. - * @memberof ibc.core.channel.v1 - * @interface IGenesisState - * @property {Array.|null} [channels] GenesisState channels - * @property {Array.|null} [acknowledgements] GenesisState acknowledgements - * @property {Array.|null} [commitments] GenesisState commitments - * @property {Array.|null} [receipts] GenesisState receipts - * @property {Array.|null} [send_sequences] GenesisState send_sequences - * @property {Array.|null} [recv_sequences] GenesisState recv_sequences - * @property {Array.|null} [ack_sequences] GenesisState ack_sequences - * @property {Long|null} [next_channel_sequence] GenesisState next_channel_sequence - */ - - /** - * Constructs a new GenesisState. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a GenesisState. - * @implements IGenesisState - * @constructor - * @param {ibc.core.channel.v1.IGenesisState=} [properties] Properties to set - */ - function GenesisState(properties) { - this.channels = []; - this.acknowledgements = []; - this.commitments = []; - this.receipts = []; - this.send_sequences = []; - this.recv_sequences = []; - this.ack_sequences = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GenesisState channels. - * @member {Array.} channels - * @memberof ibc.core.channel.v1.GenesisState - * @instance - */ - GenesisState.prototype.channels = $util.emptyArray; - - /** - * GenesisState acknowledgements. - * @member {Array.} acknowledgements - * @memberof ibc.core.channel.v1.GenesisState - * @instance - */ - GenesisState.prototype.acknowledgements = $util.emptyArray; - - /** - * GenesisState commitments. - * @member {Array.} commitments - * @memberof ibc.core.channel.v1.GenesisState - * @instance - */ - GenesisState.prototype.commitments = $util.emptyArray; - - /** - * GenesisState receipts. - * @member {Array.} receipts - * @memberof ibc.core.channel.v1.GenesisState - * @instance - */ - GenesisState.prototype.receipts = $util.emptyArray; - - /** - * GenesisState send_sequences. - * @member {Array.} send_sequences - * @memberof ibc.core.channel.v1.GenesisState - * @instance - */ - GenesisState.prototype.send_sequences = $util.emptyArray; - - /** - * GenesisState recv_sequences. - * @member {Array.} recv_sequences - * @memberof ibc.core.channel.v1.GenesisState - * @instance - */ - GenesisState.prototype.recv_sequences = $util.emptyArray; - - /** - * GenesisState ack_sequences. - * @member {Array.} ack_sequences - * @memberof ibc.core.channel.v1.GenesisState - * @instance - */ - GenesisState.prototype.ack_sequences = $util.emptyArray; - - /** - * GenesisState next_channel_sequence. - * @member {Long} next_channel_sequence - * @memberof ibc.core.channel.v1.GenesisState - * @instance - */ - GenesisState.prototype.next_channel_sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified GenesisState message. Does not implicitly {@link ibc.core.channel.v1.GenesisState.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.GenesisState - * @static - * @param {ibc.core.channel.v1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.channels != null && message.channels.length) - for (let i = 0; i < message.channels.length; ++i) - $root.ibc.core.channel.v1.IdentifiedChannel.encode(message.channels[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.acknowledgements != null && message.acknowledgements.length) - for (let i = 0; i < message.acknowledgements.length; ++i) - $root.ibc.core.channel.v1.PacketState.encode(message.acknowledgements[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.commitments != null && message.commitments.length) - for (let i = 0; i < message.commitments.length; ++i) - $root.ibc.core.channel.v1.PacketState.encode(message.commitments[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.receipts != null && message.receipts.length) - for (let i = 0; i < message.receipts.length; ++i) - $root.ibc.core.channel.v1.PacketState.encode(message.receipts[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.send_sequences != null && message.send_sequences.length) - for (let i = 0; i < message.send_sequences.length; ++i) - $root.ibc.core.channel.v1.PacketSequence.encode(message.send_sequences[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.recv_sequences != null && message.recv_sequences.length) - for (let i = 0; i < message.recv_sequences.length; ++i) - $root.ibc.core.channel.v1.PacketSequence.encode(message.recv_sequences[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.ack_sequences != null && message.ack_sequences.length) - for (let i = 0; i < message.ack_sequences.length; ++i) - $root.ibc.core.channel.v1.PacketSequence.encode(message.ack_sequences[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.next_channel_sequence != null && Object.hasOwnProperty.call(message, "next_channel_sequence")) - writer.uint32(/* id 8, wireType 0 =*/64).uint64(message.next_channel_sequence); - return writer; - }; - - /** - * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link ibc.core.channel.v1.GenesisState.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.GenesisState - * @static - * @param {ibc.core.channel.v1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.GenesisState(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.channels && message.channels.length)) - message.channels = []; - message.channels.push($root.ibc.core.channel.v1.IdentifiedChannel.decode(reader, reader.uint32())); - break; - case 2: - if (!(message.acknowledgements && message.acknowledgements.length)) - message.acknowledgements = []; - message.acknowledgements.push($root.ibc.core.channel.v1.PacketState.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.commitments && message.commitments.length)) - message.commitments = []; - message.commitments.push($root.ibc.core.channel.v1.PacketState.decode(reader, reader.uint32())); - break; - case 4: - if (!(message.receipts && message.receipts.length)) - message.receipts = []; - message.receipts.push($root.ibc.core.channel.v1.PacketState.decode(reader, reader.uint32())); - break; - case 5: - if (!(message.send_sequences && message.send_sequences.length)) - message.send_sequences = []; - message.send_sequences.push($root.ibc.core.channel.v1.PacketSequence.decode(reader, reader.uint32())); - break; - case 6: - if (!(message.recv_sequences && message.recv_sequences.length)) - message.recv_sequences = []; - message.recv_sequences.push($root.ibc.core.channel.v1.PacketSequence.decode(reader, reader.uint32())); - break; - case 7: - if (!(message.ack_sequences && message.ack_sequences.length)) - message.ack_sequences = []; - message.ack_sequences.push($root.ibc.core.channel.v1.PacketSequence.decode(reader, reader.uint32())); - break; - case 8: - message.next_channel_sequence = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GenesisState message. - * @function verify - * @memberof ibc.core.channel.v1.GenesisState - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GenesisState.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.channels != null && message.hasOwnProperty("channels")) { - if (!Array.isArray(message.channels)) - return "channels: array expected"; - for (let i = 0; i < message.channels.length; ++i) { - let error = $root.ibc.core.channel.v1.IdentifiedChannel.verify(message.channels[i]); - if (error) - return "channels." + error; - } - } - if (message.acknowledgements != null && message.hasOwnProperty("acknowledgements")) { - if (!Array.isArray(message.acknowledgements)) - return "acknowledgements: array expected"; - for (let i = 0; i < message.acknowledgements.length; ++i) { - let error = $root.ibc.core.channel.v1.PacketState.verify(message.acknowledgements[i]); - if (error) - return "acknowledgements." + error; - } - } - if (message.commitments != null && message.hasOwnProperty("commitments")) { - if (!Array.isArray(message.commitments)) - return "commitments: array expected"; - for (let i = 0; i < message.commitments.length; ++i) { - let error = $root.ibc.core.channel.v1.PacketState.verify(message.commitments[i]); - if (error) - return "commitments." + error; - } - } - if (message.receipts != null && message.hasOwnProperty("receipts")) { - if (!Array.isArray(message.receipts)) - return "receipts: array expected"; - for (let i = 0; i < message.receipts.length; ++i) { - let error = $root.ibc.core.channel.v1.PacketState.verify(message.receipts[i]); - if (error) - return "receipts." + error; - } - } - if (message.send_sequences != null && message.hasOwnProperty("send_sequences")) { - if (!Array.isArray(message.send_sequences)) - return "send_sequences: array expected"; - for (let i = 0; i < message.send_sequences.length; ++i) { - let error = $root.ibc.core.channel.v1.PacketSequence.verify(message.send_sequences[i]); - if (error) - return "send_sequences." + error; - } - } - if (message.recv_sequences != null && message.hasOwnProperty("recv_sequences")) { - if (!Array.isArray(message.recv_sequences)) - return "recv_sequences: array expected"; - for (let i = 0; i < message.recv_sequences.length; ++i) { - let error = $root.ibc.core.channel.v1.PacketSequence.verify(message.recv_sequences[i]); - if (error) - return "recv_sequences." + error; - } - } - if (message.ack_sequences != null && message.hasOwnProperty("ack_sequences")) { - if (!Array.isArray(message.ack_sequences)) - return "ack_sequences: array expected"; - for (let i = 0; i < message.ack_sequences.length; ++i) { - let error = $root.ibc.core.channel.v1.PacketSequence.verify(message.ack_sequences[i]); - if (error) - return "ack_sequences." + error; - } - } - if (message.next_channel_sequence != null && message.hasOwnProperty("next_channel_sequence")) - if (!$util.isInteger(message.next_channel_sequence) && !(message.next_channel_sequence && $util.isInteger(message.next_channel_sequence.low) && $util.isInteger(message.next_channel_sequence.high))) - return "next_channel_sequence: integer|Long expected"; - return null; - }; - - /** - * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.GenesisState - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.GenesisState} GenesisState - */ - GenesisState.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.GenesisState) - return object; - let message = new $root.ibc.core.channel.v1.GenesisState(); - if (object.channels) { - if (!Array.isArray(object.channels)) - throw TypeError(".ibc.core.channel.v1.GenesisState.channels: array expected"); - message.channels = []; - for (let i = 0; i < object.channels.length; ++i) { - if (typeof object.channels[i] !== "object") - throw TypeError(".ibc.core.channel.v1.GenesisState.channels: object expected"); - message.channels[i] = $root.ibc.core.channel.v1.IdentifiedChannel.fromObject(object.channels[i]); - } - } - if (object.acknowledgements) { - if (!Array.isArray(object.acknowledgements)) - throw TypeError(".ibc.core.channel.v1.GenesisState.acknowledgements: array expected"); - message.acknowledgements = []; - for (let i = 0; i < object.acknowledgements.length; ++i) { - if (typeof object.acknowledgements[i] !== "object") - throw TypeError(".ibc.core.channel.v1.GenesisState.acknowledgements: object expected"); - message.acknowledgements[i] = $root.ibc.core.channel.v1.PacketState.fromObject(object.acknowledgements[i]); - } - } - if (object.commitments) { - if (!Array.isArray(object.commitments)) - throw TypeError(".ibc.core.channel.v1.GenesisState.commitments: array expected"); - message.commitments = []; - for (let i = 0; i < object.commitments.length; ++i) { - if (typeof object.commitments[i] !== "object") - throw TypeError(".ibc.core.channel.v1.GenesisState.commitments: object expected"); - message.commitments[i] = $root.ibc.core.channel.v1.PacketState.fromObject(object.commitments[i]); - } - } - if (object.receipts) { - if (!Array.isArray(object.receipts)) - throw TypeError(".ibc.core.channel.v1.GenesisState.receipts: array expected"); - message.receipts = []; - for (let i = 0; i < object.receipts.length; ++i) { - if (typeof object.receipts[i] !== "object") - throw TypeError(".ibc.core.channel.v1.GenesisState.receipts: object expected"); - message.receipts[i] = $root.ibc.core.channel.v1.PacketState.fromObject(object.receipts[i]); - } - } - if (object.send_sequences) { - if (!Array.isArray(object.send_sequences)) - throw TypeError(".ibc.core.channel.v1.GenesisState.send_sequences: array expected"); - message.send_sequences = []; - for (let i = 0; i < object.send_sequences.length; ++i) { - if (typeof object.send_sequences[i] !== "object") - throw TypeError(".ibc.core.channel.v1.GenesisState.send_sequences: object expected"); - message.send_sequences[i] = $root.ibc.core.channel.v1.PacketSequence.fromObject(object.send_sequences[i]); - } - } - if (object.recv_sequences) { - if (!Array.isArray(object.recv_sequences)) - throw TypeError(".ibc.core.channel.v1.GenesisState.recv_sequences: array expected"); - message.recv_sequences = []; - for (let i = 0; i < object.recv_sequences.length; ++i) { - if (typeof object.recv_sequences[i] !== "object") - throw TypeError(".ibc.core.channel.v1.GenesisState.recv_sequences: object expected"); - message.recv_sequences[i] = $root.ibc.core.channel.v1.PacketSequence.fromObject(object.recv_sequences[i]); - } - } - if (object.ack_sequences) { - if (!Array.isArray(object.ack_sequences)) - throw TypeError(".ibc.core.channel.v1.GenesisState.ack_sequences: array expected"); - message.ack_sequences = []; - for (let i = 0; i < object.ack_sequences.length; ++i) { - if (typeof object.ack_sequences[i] !== "object") - throw TypeError(".ibc.core.channel.v1.GenesisState.ack_sequences: object expected"); - message.ack_sequences[i] = $root.ibc.core.channel.v1.PacketSequence.fromObject(object.ack_sequences[i]); - } - } - if (object.next_channel_sequence != null) - if ($util.Long) - (message.next_channel_sequence = $util.Long.fromValue(object.next_channel_sequence)).unsigned = true; - else if (typeof object.next_channel_sequence === "string") - message.next_channel_sequence = parseInt(object.next_channel_sequence, 10); - else if (typeof object.next_channel_sequence === "number") - message.next_channel_sequence = object.next_channel_sequence; - else if (typeof object.next_channel_sequence === "object") - message.next_channel_sequence = new $util.LongBits(object.next_channel_sequence.low >>> 0, object.next_channel_sequence.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a GenesisState message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.GenesisState - * @static - * @param {ibc.core.channel.v1.GenesisState} message GenesisState - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GenesisState.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) { - object.channels = []; - object.acknowledgements = []; - object.commitments = []; - object.receipts = []; - object.send_sequences = []; - object.recv_sequences = []; - object.ack_sequences = []; - } - if (options.defaults) - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.next_channel_sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.next_channel_sequence = options.longs === String ? "0" : 0; - if (message.channels && message.channels.length) { - object.channels = []; - for (let j = 0; j < message.channels.length; ++j) - object.channels[j] = $root.ibc.core.channel.v1.IdentifiedChannel.toObject(message.channels[j], options); - } - if (message.acknowledgements && message.acknowledgements.length) { - object.acknowledgements = []; - for (let j = 0; j < message.acknowledgements.length; ++j) - object.acknowledgements[j] = $root.ibc.core.channel.v1.PacketState.toObject(message.acknowledgements[j], options); - } - if (message.commitments && message.commitments.length) { - object.commitments = []; - for (let j = 0; j < message.commitments.length; ++j) - object.commitments[j] = $root.ibc.core.channel.v1.PacketState.toObject(message.commitments[j], options); - } - if (message.receipts && message.receipts.length) { - object.receipts = []; - for (let j = 0; j < message.receipts.length; ++j) - object.receipts[j] = $root.ibc.core.channel.v1.PacketState.toObject(message.receipts[j], options); - } - if (message.send_sequences && message.send_sequences.length) { - object.send_sequences = []; - for (let j = 0; j < message.send_sequences.length; ++j) - object.send_sequences[j] = $root.ibc.core.channel.v1.PacketSequence.toObject(message.send_sequences[j], options); - } - if (message.recv_sequences && message.recv_sequences.length) { - object.recv_sequences = []; - for (let j = 0; j < message.recv_sequences.length; ++j) - object.recv_sequences[j] = $root.ibc.core.channel.v1.PacketSequence.toObject(message.recv_sequences[j], options); - } - if (message.ack_sequences && message.ack_sequences.length) { - object.ack_sequences = []; - for (let j = 0; j < message.ack_sequences.length; ++j) - object.ack_sequences[j] = $root.ibc.core.channel.v1.PacketSequence.toObject(message.ack_sequences[j], options); - } - if (message.next_channel_sequence != null && message.hasOwnProperty("next_channel_sequence")) - if (typeof message.next_channel_sequence === "number") - object.next_channel_sequence = options.longs === String ? String(message.next_channel_sequence) : message.next_channel_sequence; - else - object.next_channel_sequence = options.longs === String ? $util.Long.prototype.toString.call(message.next_channel_sequence) : options.longs === Number ? new $util.LongBits(message.next_channel_sequence.low >>> 0, message.next_channel_sequence.high >>> 0).toNumber(true) : message.next_channel_sequence; - return object; - }; - - /** - * Converts this GenesisState to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.GenesisState - * @instance - * @returns {Object.} JSON object - */ - GenesisState.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GenesisState; - })(); - - v1.PacketSequence = (function() { - - /** - * Properties of a PacketSequence. - * @memberof ibc.core.channel.v1 - * @interface IPacketSequence - * @property {string|null} [port_id] PacketSequence port_id - * @property {string|null} [channel_id] PacketSequence channel_id - * @property {Long|null} [sequence] PacketSequence sequence - */ - - /** - * Constructs a new PacketSequence. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a PacketSequence. - * @implements IPacketSequence - * @constructor - * @param {ibc.core.channel.v1.IPacketSequence=} [properties] Properties to set - */ - function PacketSequence(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PacketSequence port_id. - * @member {string} port_id - * @memberof ibc.core.channel.v1.PacketSequence - * @instance - */ - PacketSequence.prototype.port_id = ""; - - /** - * PacketSequence channel_id. - * @member {string} channel_id - * @memberof ibc.core.channel.v1.PacketSequence - * @instance - */ - PacketSequence.prototype.channel_id = ""; - - /** - * PacketSequence sequence. - * @member {Long} sequence - * @memberof ibc.core.channel.v1.PacketSequence - * @instance - */ - PacketSequence.prototype.sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified PacketSequence message. Does not implicitly {@link ibc.core.channel.v1.PacketSequence.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.PacketSequence - * @static - * @param {ibc.core.channel.v1.IPacketSequence} message PacketSequence message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PacketSequence.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); - if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); - if (message.sequence != null && Object.hasOwnProperty.call(message, "sequence")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.sequence); - return writer; - }; - - /** - * Encodes the specified PacketSequence message, length delimited. Does not implicitly {@link ibc.core.channel.v1.PacketSequence.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.PacketSequence - * @static - * @param {ibc.core.channel.v1.IPacketSequence} message PacketSequence message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PacketSequence.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PacketSequence message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.PacketSequence - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.PacketSequence} PacketSequence - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PacketSequence.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.PacketSequence(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.port_id = reader.string(); - break; - case 2: - message.channel_id = reader.string(); - break; - case 3: - message.sequence = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PacketSequence message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.PacketSequence - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.PacketSequence} PacketSequence - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PacketSequence.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PacketSequence message. - * @function verify - * @memberof ibc.core.channel.v1.PacketSequence - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PacketSequence.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.port_id != null && message.hasOwnProperty("port_id")) - if (!$util.isString(message.port_id)) - return "port_id: string expected"; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - if (!$util.isString(message.channel_id)) - return "channel_id: string expected"; - if (message.sequence != null && message.hasOwnProperty("sequence")) - if (!$util.isInteger(message.sequence) && !(message.sequence && $util.isInteger(message.sequence.low) && $util.isInteger(message.sequence.high))) - return "sequence: integer|Long expected"; - return null; - }; - - /** - * Creates a PacketSequence message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.PacketSequence - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.PacketSequence} PacketSequence - */ - PacketSequence.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.PacketSequence) - return object; - let message = new $root.ibc.core.channel.v1.PacketSequence(); - if (object.port_id != null) - message.port_id = String(object.port_id); - if (object.channel_id != null) - message.channel_id = String(object.channel_id); - if (object.sequence != null) - if ($util.Long) - (message.sequence = $util.Long.fromValue(object.sequence)).unsigned = true; - else if (typeof object.sequence === "string") - message.sequence = parseInt(object.sequence, 10); - else if (typeof object.sequence === "number") - message.sequence = object.sequence; - else if (typeof object.sequence === "object") - message.sequence = new $util.LongBits(object.sequence.low >>> 0, object.sequence.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a PacketSequence message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.PacketSequence - * @static - * @param {ibc.core.channel.v1.PacketSequence} message PacketSequence - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PacketSequence.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.port_id = ""; - object.channel_id = ""; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.sequence = options.longs === String ? "0" : 0; - } - if (message.port_id != null && message.hasOwnProperty("port_id")) - object.port_id = message.port_id; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - object.channel_id = message.channel_id; - if (message.sequence != null && message.hasOwnProperty("sequence")) - if (typeof message.sequence === "number") - object.sequence = options.longs === String ? String(message.sequence) : message.sequence; - else - object.sequence = options.longs === String ? $util.Long.prototype.toString.call(message.sequence) : options.longs === Number ? new $util.LongBits(message.sequence.low >>> 0, message.sequence.high >>> 0).toNumber(true) : message.sequence; - return object; - }; - - /** - * Converts this PacketSequence to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.PacketSequence - * @instance - * @returns {Object.} JSON object - */ - PacketSequence.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return PacketSequence; - })(); - - v1.Channel = (function() { - - /** - * Properties of a Channel. - * @memberof ibc.core.channel.v1 - * @interface IChannel - * @property {ibc.core.channel.v1.State|null} [state] Channel state - * @property {ibc.core.channel.v1.Order|null} [ordering] Channel ordering - * @property {ibc.core.channel.v1.ICounterparty|null} [counterparty] Channel counterparty - * @property {Array.|null} [connection_hops] Channel connection_hops - * @property {string|null} [version] Channel version - */ - - /** - * Constructs a new Channel. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a Channel. - * @implements IChannel - * @constructor - * @param {ibc.core.channel.v1.IChannel=} [properties] Properties to set - */ - function Channel(properties) { - this.connection_hops = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Channel state. - * @member {ibc.core.channel.v1.State} state - * @memberof ibc.core.channel.v1.Channel - * @instance - */ - Channel.prototype.state = 0; - - /** - * Channel ordering. - * @member {ibc.core.channel.v1.Order} ordering - * @memberof ibc.core.channel.v1.Channel - * @instance - */ - Channel.prototype.ordering = 0; - - /** - * Channel counterparty. - * @member {ibc.core.channel.v1.ICounterparty|null|undefined} counterparty - * @memberof ibc.core.channel.v1.Channel - * @instance - */ - Channel.prototype.counterparty = null; - - /** - * Channel connection_hops. - * @member {Array.} connection_hops - * @memberof ibc.core.channel.v1.Channel - * @instance - */ - Channel.prototype.connection_hops = $util.emptyArray; - - /** - * Channel version. - * @member {string} version - * @memberof ibc.core.channel.v1.Channel - * @instance - */ - Channel.prototype.version = ""; - - /** - * Encodes the specified Channel message. Does not implicitly {@link ibc.core.channel.v1.Channel.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.Channel - * @static - * @param {ibc.core.channel.v1.IChannel} message Channel message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Channel.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); - if (message.ordering != null && Object.hasOwnProperty.call(message, "ordering")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.ordering); - if (message.counterparty != null && Object.hasOwnProperty.call(message, "counterparty")) - $root.ibc.core.channel.v1.Counterparty.encode(message.counterparty, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.connection_hops != null && message.connection_hops.length) - for (let i = 0; i < message.connection_hops.length; ++i) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.connection_hops[i]); - if (message.version != null && Object.hasOwnProperty.call(message, "version")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.version); - return writer; - }; - - /** - * Encodes the specified Channel message, length delimited. Does not implicitly {@link ibc.core.channel.v1.Channel.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.Channel - * @static - * @param {ibc.core.channel.v1.IChannel} message Channel message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Channel.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Channel message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.Channel - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.Channel} Channel - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Channel.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.Channel(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.state = reader.int32(); - break; - case 2: - message.ordering = reader.int32(); - break; - case 3: - message.counterparty = $root.ibc.core.channel.v1.Counterparty.decode(reader, reader.uint32()); - break; - case 4: - if (!(message.connection_hops && message.connection_hops.length)) - message.connection_hops = []; - message.connection_hops.push(reader.string()); - break; - case 5: - message.version = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Channel message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.Channel - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.Channel} Channel - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Channel.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Channel message. - * @function verify - * @memberof ibc.core.channel.v1.Channel - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Channel.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.state != null && message.hasOwnProperty("state")) - switch (message.state) { - default: - return "state: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; - } - if (message.ordering != null && message.hasOwnProperty("ordering")) - switch (message.ordering) { - default: - return "ordering: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.counterparty != null && message.hasOwnProperty("counterparty")) { - let error = $root.ibc.core.channel.v1.Counterparty.verify(message.counterparty); - if (error) - return "counterparty." + error; - } - if (message.connection_hops != null && message.hasOwnProperty("connection_hops")) { - if (!Array.isArray(message.connection_hops)) - return "connection_hops: array expected"; - for (let i = 0; i < message.connection_hops.length; ++i) - if (!$util.isString(message.connection_hops[i])) - return "connection_hops: string[] expected"; - } - if (message.version != null && message.hasOwnProperty("version")) - if (!$util.isString(message.version)) - return "version: string expected"; - return null; - }; - - /** - * Creates a Channel message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.Channel - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.Channel} Channel - */ - Channel.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.Channel) - return object; - let message = new $root.ibc.core.channel.v1.Channel(); - switch (object.state) { - case "STATE_UNINITIALIZED_UNSPECIFIED": - case 0: - message.state = 0; - break; - case "STATE_INIT": - case 1: - message.state = 1; - break; - case "STATE_TRYOPEN": - case 2: - message.state = 2; - break; - case "STATE_OPEN": - case 3: - message.state = 3; - break; - case "STATE_CLOSED": - case 4: - message.state = 4; - break; - } - switch (object.ordering) { - case "ORDER_NONE_UNSPECIFIED": - case 0: - message.ordering = 0; - break; - case "ORDER_UNORDERED": - case 1: - message.ordering = 1; - break; - case "ORDER_ORDERED": - case 2: - message.ordering = 2; - break; - } - if (object.counterparty != null) { - if (typeof object.counterparty !== "object") - throw TypeError(".ibc.core.channel.v1.Channel.counterparty: object expected"); - message.counterparty = $root.ibc.core.channel.v1.Counterparty.fromObject(object.counterparty); - } - if (object.connection_hops) { - if (!Array.isArray(object.connection_hops)) - throw TypeError(".ibc.core.channel.v1.Channel.connection_hops: array expected"); - message.connection_hops = []; - for (let i = 0; i < object.connection_hops.length; ++i) - message.connection_hops[i] = String(object.connection_hops[i]); - } - if (object.version != null) - message.version = String(object.version); - return message; - }; - - /** - * Creates a plain object from a Channel message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.Channel - * @static - * @param {ibc.core.channel.v1.Channel} message Channel - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Channel.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.connection_hops = []; - if (options.defaults) { - object.state = options.enums === String ? "STATE_UNINITIALIZED_UNSPECIFIED" : 0; - object.ordering = options.enums === String ? "ORDER_NONE_UNSPECIFIED" : 0; - object.counterparty = null; - object.version = ""; - } - if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.ibc.core.channel.v1.State[message.state] : message.state; - if (message.ordering != null && message.hasOwnProperty("ordering")) - object.ordering = options.enums === String ? $root.ibc.core.channel.v1.Order[message.ordering] : message.ordering; - if (message.counterparty != null && message.hasOwnProperty("counterparty")) - object.counterparty = $root.ibc.core.channel.v1.Counterparty.toObject(message.counterparty, options); - if (message.connection_hops && message.connection_hops.length) { - object.connection_hops = []; - for (let j = 0; j < message.connection_hops.length; ++j) - object.connection_hops[j] = message.connection_hops[j]; - } - if (message.version != null && message.hasOwnProperty("version")) - object.version = message.version; - return object; - }; - - /** - * Converts this Channel to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.Channel - * @instance - * @returns {Object.} JSON object - */ - Channel.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Channel; - })(); - - v1.IdentifiedChannel = (function() { - - /** - * Properties of an IdentifiedChannel. - * @memberof ibc.core.channel.v1 - * @interface IIdentifiedChannel - * @property {ibc.core.channel.v1.State|null} [state] IdentifiedChannel state - * @property {ibc.core.channel.v1.Order|null} [ordering] IdentifiedChannel ordering - * @property {ibc.core.channel.v1.ICounterparty|null} [counterparty] IdentifiedChannel counterparty - * @property {Array.|null} [connection_hops] IdentifiedChannel connection_hops - * @property {string|null} [version] IdentifiedChannel version - * @property {string|null} [port_id] IdentifiedChannel port_id - * @property {string|null} [channel_id] IdentifiedChannel channel_id - */ - - /** - * Constructs a new IdentifiedChannel. - * @memberof ibc.core.channel.v1 - * @classdesc Represents an IdentifiedChannel. - * @implements IIdentifiedChannel - * @constructor - * @param {ibc.core.channel.v1.IIdentifiedChannel=} [properties] Properties to set - */ - function IdentifiedChannel(properties) { - this.connection_hops = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * IdentifiedChannel state. - * @member {ibc.core.channel.v1.State} state - * @memberof ibc.core.channel.v1.IdentifiedChannel - * @instance - */ - IdentifiedChannel.prototype.state = 0; - - /** - * IdentifiedChannel ordering. - * @member {ibc.core.channel.v1.Order} ordering - * @memberof ibc.core.channel.v1.IdentifiedChannel - * @instance - */ - IdentifiedChannel.prototype.ordering = 0; - - /** - * IdentifiedChannel counterparty. - * @member {ibc.core.channel.v1.ICounterparty|null|undefined} counterparty - * @memberof ibc.core.channel.v1.IdentifiedChannel - * @instance - */ - IdentifiedChannel.prototype.counterparty = null; - - /** - * IdentifiedChannel connection_hops. - * @member {Array.} connection_hops - * @memberof ibc.core.channel.v1.IdentifiedChannel - * @instance - */ - IdentifiedChannel.prototype.connection_hops = $util.emptyArray; - - /** - * IdentifiedChannel version. - * @member {string} version - * @memberof ibc.core.channel.v1.IdentifiedChannel - * @instance - */ - IdentifiedChannel.prototype.version = ""; - - /** - * IdentifiedChannel port_id. - * @member {string} port_id - * @memberof ibc.core.channel.v1.IdentifiedChannel - * @instance - */ - IdentifiedChannel.prototype.port_id = ""; - - /** - * IdentifiedChannel channel_id. - * @member {string} channel_id - * @memberof ibc.core.channel.v1.IdentifiedChannel - * @instance - */ - IdentifiedChannel.prototype.channel_id = ""; - - /** - * Encodes the specified IdentifiedChannel message. Does not implicitly {@link ibc.core.channel.v1.IdentifiedChannel.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.IdentifiedChannel - * @static - * @param {ibc.core.channel.v1.IIdentifiedChannel} message IdentifiedChannel message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - IdentifiedChannel.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); - if (message.ordering != null && Object.hasOwnProperty.call(message, "ordering")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.ordering); - if (message.counterparty != null && Object.hasOwnProperty.call(message, "counterparty")) - $root.ibc.core.channel.v1.Counterparty.encode(message.counterparty, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.connection_hops != null && message.connection_hops.length) - for (let i = 0; i < message.connection_hops.length; ++i) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.connection_hops[i]); - if (message.version != null && Object.hasOwnProperty.call(message, "version")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.version); - if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.port_id); - if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.channel_id); - return writer; - }; - - /** - * Encodes the specified IdentifiedChannel message, length delimited. Does not implicitly {@link ibc.core.channel.v1.IdentifiedChannel.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.IdentifiedChannel - * @static - * @param {ibc.core.channel.v1.IIdentifiedChannel} message IdentifiedChannel message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - IdentifiedChannel.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an IdentifiedChannel message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.IdentifiedChannel - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.IdentifiedChannel} IdentifiedChannel - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - IdentifiedChannel.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.IdentifiedChannel(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.state = reader.int32(); - break; - case 2: - message.ordering = reader.int32(); - break; - case 3: - message.counterparty = $root.ibc.core.channel.v1.Counterparty.decode(reader, reader.uint32()); - break; - case 4: - if (!(message.connection_hops && message.connection_hops.length)) - message.connection_hops = []; - message.connection_hops.push(reader.string()); - break; - case 5: - message.version = reader.string(); - break; - case 6: - message.port_id = reader.string(); - break; - case 7: - message.channel_id = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an IdentifiedChannel message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.IdentifiedChannel - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.IdentifiedChannel} IdentifiedChannel - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - IdentifiedChannel.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an IdentifiedChannel message. - * @function verify - * @memberof ibc.core.channel.v1.IdentifiedChannel - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - IdentifiedChannel.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.state != null && message.hasOwnProperty("state")) - switch (message.state) { - default: - return "state: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; - } - if (message.ordering != null && message.hasOwnProperty("ordering")) - switch (message.ordering) { - default: - return "ordering: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.counterparty != null && message.hasOwnProperty("counterparty")) { - let error = $root.ibc.core.channel.v1.Counterparty.verify(message.counterparty); - if (error) - return "counterparty." + error; - } - if (message.connection_hops != null && message.hasOwnProperty("connection_hops")) { - if (!Array.isArray(message.connection_hops)) - return "connection_hops: array expected"; - for (let i = 0; i < message.connection_hops.length; ++i) - if (!$util.isString(message.connection_hops[i])) - return "connection_hops: string[] expected"; - } - if (message.version != null && message.hasOwnProperty("version")) - if (!$util.isString(message.version)) - return "version: string expected"; - if (message.port_id != null && message.hasOwnProperty("port_id")) - if (!$util.isString(message.port_id)) - return "port_id: string expected"; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - if (!$util.isString(message.channel_id)) - return "channel_id: string expected"; - return null; - }; - - /** - * Creates an IdentifiedChannel message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.IdentifiedChannel - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.IdentifiedChannel} IdentifiedChannel - */ - IdentifiedChannel.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.IdentifiedChannel) - return object; - let message = new $root.ibc.core.channel.v1.IdentifiedChannel(); - switch (object.state) { - case "STATE_UNINITIALIZED_UNSPECIFIED": - case 0: - message.state = 0; - break; - case "STATE_INIT": - case 1: - message.state = 1; - break; - case "STATE_TRYOPEN": - case 2: - message.state = 2; - break; - case "STATE_OPEN": - case 3: - message.state = 3; - break; - case "STATE_CLOSED": - case 4: - message.state = 4; - break; - } - switch (object.ordering) { - case "ORDER_NONE_UNSPECIFIED": - case 0: - message.ordering = 0; - break; - case "ORDER_UNORDERED": - case 1: - message.ordering = 1; - break; - case "ORDER_ORDERED": - case 2: - message.ordering = 2; - break; - } - if (object.counterparty != null) { - if (typeof object.counterparty !== "object") - throw TypeError(".ibc.core.channel.v1.IdentifiedChannel.counterparty: object expected"); - message.counterparty = $root.ibc.core.channel.v1.Counterparty.fromObject(object.counterparty); - } - if (object.connection_hops) { - if (!Array.isArray(object.connection_hops)) - throw TypeError(".ibc.core.channel.v1.IdentifiedChannel.connection_hops: array expected"); - message.connection_hops = []; - for (let i = 0; i < object.connection_hops.length; ++i) - message.connection_hops[i] = String(object.connection_hops[i]); - } - if (object.version != null) - message.version = String(object.version); - if (object.port_id != null) - message.port_id = String(object.port_id); - if (object.channel_id != null) - message.channel_id = String(object.channel_id); - return message; - }; - - /** - * Creates a plain object from an IdentifiedChannel message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.IdentifiedChannel - * @static - * @param {ibc.core.channel.v1.IdentifiedChannel} message IdentifiedChannel - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - IdentifiedChannel.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.connection_hops = []; - if (options.defaults) { - object.state = options.enums === String ? "STATE_UNINITIALIZED_UNSPECIFIED" : 0; - object.ordering = options.enums === String ? "ORDER_NONE_UNSPECIFIED" : 0; - object.counterparty = null; - object.version = ""; - object.port_id = ""; - object.channel_id = ""; - } - if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.ibc.core.channel.v1.State[message.state] : message.state; - if (message.ordering != null && message.hasOwnProperty("ordering")) - object.ordering = options.enums === String ? $root.ibc.core.channel.v1.Order[message.ordering] : message.ordering; - if (message.counterparty != null && message.hasOwnProperty("counterparty")) - object.counterparty = $root.ibc.core.channel.v1.Counterparty.toObject(message.counterparty, options); - if (message.connection_hops && message.connection_hops.length) { - object.connection_hops = []; - for (let j = 0; j < message.connection_hops.length; ++j) - object.connection_hops[j] = message.connection_hops[j]; - } - if (message.version != null && message.hasOwnProperty("version")) - object.version = message.version; - if (message.port_id != null && message.hasOwnProperty("port_id")) - object.port_id = message.port_id; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - object.channel_id = message.channel_id; - return object; - }; - - /** - * Converts this IdentifiedChannel to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.IdentifiedChannel - * @instance - * @returns {Object.} JSON object - */ - IdentifiedChannel.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return IdentifiedChannel; - })(); - - /** - * State enum. - * @name ibc.core.channel.v1.State - * @enum {number} - * @property {number} STATE_UNINITIALIZED_UNSPECIFIED=0 STATE_UNINITIALIZED_UNSPECIFIED value - * @property {number} STATE_INIT=1 STATE_INIT value - * @property {number} STATE_TRYOPEN=2 STATE_TRYOPEN value - * @property {number} STATE_OPEN=3 STATE_OPEN value - * @property {number} STATE_CLOSED=4 STATE_CLOSED value - */ - v1.State = (function() { - const valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STATE_UNINITIALIZED_UNSPECIFIED"] = 0; - values[valuesById[1] = "STATE_INIT"] = 1; - values[valuesById[2] = "STATE_TRYOPEN"] = 2; - values[valuesById[3] = "STATE_OPEN"] = 3; - values[valuesById[4] = "STATE_CLOSED"] = 4; - return values; - })(); - - /** - * Order enum. - * @name ibc.core.channel.v1.Order - * @enum {number} - * @property {number} ORDER_NONE_UNSPECIFIED=0 ORDER_NONE_UNSPECIFIED value - * @property {number} ORDER_UNORDERED=1 ORDER_UNORDERED value - * @property {number} ORDER_ORDERED=2 ORDER_ORDERED value - */ - v1.Order = (function() { - const valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "ORDER_NONE_UNSPECIFIED"] = 0; - values[valuesById[1] = "ORDER_UNORDERED"] = 1; - values[valuesById[2] = "ORDER_ORDERED"] = 2; - return values; - })(); - - v1.Counterparty = (function() { - - /** - * Properties of a Counterparty. - * @memberof ibc.core.channel.v1 - * @interface ICounterparty - * @property {string|null} [port_id] Counterparty port_id - * @property {string|null} [channel_id] Counterparty channel_id - */ - - /** - * Constructs a new Counterparty. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a Counterparty. - * @implements ICounterparty - * @constructor - * @param {ibc.core.channel.v1.ICounterparty=} [properties] Properties to set - */ - function Counterparty(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Counterparty port_id. - * @member {string} port_id - * @memberof ibc.core.channel.v1.Counterparty - * @instance - */ - Counterparty.prototype.port_id = ""; - - /** - * Counterparty channel_id. - * @member {string} channel_id - * @memberof ibc.core.channel.v1.Counterparty - * @instance - */ - Counterparty.prototype.channel_id = ""; - - /** - * Encodes the specified Counterparty message. Does not implicitly {@link ibc.core.channel.v1.Counterparty.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.Counterparty - * @static - * @param {ibc.core.channel.v1.ICounterparty} message Counterparty message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Counterparty.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); - if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); - return writer; - }; - - /** - * Encodes the specified Counterparty message, length delimited. Does not implicitly {@link ibc.core.channel.v1.Counterparty.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.Counterparty - * @static - * @param {ibc.core.channel.v1.ICounterparty} message Counterparty message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Counterparty.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Counterparty message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.Counterparty - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.Counterparty} Counterparty - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Counterparty.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.Counterparty(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.port_id = reader.string(); - break; - case 2: - message.channel_id = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Counterparty message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.Counterparty - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.Counterparty} Counterparty - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Counterparty.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Counterparty message. - * @function verify - * @memberof ibc.core.channel.v1.Counterparty - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Counterparty.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.port_id != null && message.hasOwnProperty("port_id")) - if (!$util.isString(message.port_id)) - return "port_id: string expected"; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - if (!$util.isString(message.channel_id)) - return "channel_id: string expected"; - return null; - }; - - /** - * Creates a Counterparty message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.Counterparty - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.Counterparty} Counterparty - */ - Counterparty.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.Counterparty) - return object; - let message = new $root.ibc.core.channel.v1.Counterparty(); - if (object.port_id != null) - message.port_id = String(object.port_id); - if (object.channel_id != null) - message.channel_id = String(object.channel_id); - return message; - }; - - /** - * Creates a plain object from a Counterparty message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.Counterparty - * @static - * @param {ibc.core.channel.v1.Counterparty} message Counterparty - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Counterparty.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.port_id = ""; - object.channel_id = ""; - } - if (message.port_id != null && message.hasOwnProperty("port_id")) - object.port_id = message.port_id; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - object.channel_id = message.channel_id; - return object; - }; - - /** - * Converts this Counterparty to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.Counterparty - * @instance - * @returns {Object.} JSON object - */ - Counterparty.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Counterparty; - })(); - - v1.Packet = (function() { - - /** - * Properties of a Packet. - * @memberof ibc.core.channel.v1 - * @interface IPacket - * @property {Long|null} [sequence] Packet sequence - * @property {string|null} [source_port] Packet source_port - * @property {string|null} [source_channel] Packet source_channel - * @property {string|null} [destination_port] Packet destination_port - * @property {string|null} [destination_channel] Packet destination_channel - * @property {Uint8Array|null} [data] Packet data - * @property {ibc.core.client.v1.IHeight|null} [timeout_height] Packet timeout_height - * @property {Long|null} [timeout_timestamp] Packet timeout_timestamp - */ - - /** - * Constructs a new Packet. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a Packet. - * @implements IPacket - * @constructor - * @param {ibc.core.channel.v1.IPacket=} [properties] Properties to set - */ - function Packet(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Packet sequence. - * @member {Long} sequence - * @memberof ibc.core.channel.v1.Packet - * @instance - */ - Packet.prototype.sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Packet source_port. - * @member {string} source_port - * @memberof ibc.core.channel.v1.Packet - * @instance - */ - Packet.prototype.source_port = ""; - - /** - * Packet source_channel. - * @member {string} source_channel - * @memberof ibc.core.channel.v1.Packet - * @instance - */ - Packet.prototype.source_channel = ""; - - /** - * Packet destination_port. - * @member {string} destination_port - * @memberof ibc.core.channel.v1.Packet - * @instance - */ - Packet.prototype.destination_port = ""; - - /** - * Packet destination_channel. - * @member {string} destination_channel - * @memberof ibc.core.channel.v1.Packet - * @instance - */ - Packet.prototype.destination_channel = ""; - - /** - * Packet data. - * @member {Uint8Array} data - * @memberof ibc.core.channel.v1.Packet - * @instance - */ - Packet.prototype.data = $util.newBuffer([]); - - /** - * Packet timeout_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} timeout_height - * @memberof ibc.core.channel.v1.Packet - * @instance - */ - Packet.prototype.timeout_height = null; - - /** - * Packet timeout_timestamp. - * @member {Long} timeout_timestamp - * @memberof ibc.core.channel.v1.Packet - * @instance - */ - Packet.prototype.timeout_timestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified Packet message. Does not implicitly {@link ibc.core.channel.v1.Packet.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.Packet - * @static - * @param {ibc.core.channel.v1.IPacket} message Packet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Packet.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.sequence != null && Object.hasOwnProperty.call(message, "sequence")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.sequence); - if (message.source_port != null && Object.hasOwnProperty.call(message, "source_port")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.source_port); - if (message.source_channel != null && Object.hasOwnProperty.call(message, "source_channel")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.source_channel); - if (message.destination_port != null && Object.hasOwnProperty.call(message, "destination_port")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.destination_port); - if (message.destination_channel != null && Object.hasOwnProperty.call(message, "destination_channel")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.destination_channel); - if (message.data != null && Object.hasOwnProperty.call(message, "data")) - writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.data); - if (message.timeout_height != null && Object.hasOwnProperty.call(message, "timeout_height")) - $root.ibc.core.client.v1.Height.encode(message.timeout_height, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.timeout_timestamp != null && Object.hasOwnProperty.call(message, "timeout_timestamp")) - writer.uint32(/* id 8, wireType 0 =*/64).uint64(message.timeout_timestamp); - return writer; - }; - - /** - * Encodes the specified Packet message, length delimited. Does not implicitly {@link ibc.core.channel.v1.Packet.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.Packet - * @static - * @param {ibc.core.channel.v1.IPacket} message Packet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Packet.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Packet message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.Packet - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.Packet} Packet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Packet.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.Packet(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.sequence = reader.uint64(); - break; - case 2: - message.source_port = reader.string(); - break; - case 3: - message.source_channel = reader.string(); - break; - case 4: - message.destination_port = reader.string(); - break; - case 5: - message.destination_channel = reader.string(); - break; - case 6: - message.data = reader.bytes(); - break; - case 7: - message.timeout_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - case 8: - message.timeout_timestamp = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Packet message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.Packet - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.Packet} Packet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Packet.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Packet message. - * @function verify - * @memberof ibc.core.channel.v1.Packet - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Packet.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.sequence != null && message.hasOwnProperty("sequence")) - if (!$util.isInteger(message.sequence) && !(message.sequence && $util.isInteger(message.sequence.low) && $util.isInteger(message.sequence.high))) - return "sequence: integer|Long expected"; - if (message.source_port != null && message.hasOwnProperty("source_port")) - if (!$util.isString(message.source_port)) - return "source_port: string expected"; - if (message.source_channel != null && message.hasOwnProperty("source_channel")) - if (!$util.isString(message.source_channel)) - return "source_channel: string expected"; - if (message.destination_port != null && message.hasOwnProperty("destination_port")) - if (!$util.isString(message.destination_port)) - return "destination_port: string expected"; - if (message.destination_channel != null && message.hasOwnProperty("destination_channel")) - if (!$util.isString(message.destination_channel)) - return "destination_channel: string expected"; - if (message.data != null && message.hasOwnProperty("data")) - if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) - return "data: buffer expected"; - if (message.timeout_height != null && message.hasOwnProperty("timeout_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.timeout_height); - if (error) - return "timeout_height." + error; - } - if (message.timeout_timestamp != null && message.hasOwnProperty("timeout_timestamp")) - if (!$util.isInteger(message.timeout_timestamp) && !(message.timeout_timestamp && $util.isInteger(message.timeout_timestamp.low) && $util.isInteger(message.timeout_timestamp.high))) - return "timeout_timestamp: integer|Long expected"; - return null; - }; - - /** - * Creates a Packet message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.Packet - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.Packet} Packet - */ - Packet.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.Packet) - return object; - let message = new $root.ibc.core.channel.v1.Packet(); - if (object.sequence != null) - if ($util.Long) - (message.sequence = $util.Long.fromValue(object.sequence)).unsigned = true; - else if (typeof object.sequence === "string") - message.sequence = parseInt(object.sequence, 10); - else if (typeof object.sequence === "number") - message.sequence = object.sequence; - else if (typeof object.sequence === "object") - message.sequence = new $util.LongBits(object.sequence.low >>> 0, object.sequence.high >>> 0).toNumber(true); - if (object.source_port != null) - message.source_port = String(object.source_port); - if (object.source_channel != null) - message.source_channel = String(object.source_channel); - if (object.destination_port != null) - message.destination_port = String(object.destination_port); - if (object.destination_channel != null) - message.destination_channel = String(object.destination_channel); - if (object.data != null) - if (typeof object.data === "string") - $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); - else if (object.data.length) - message.data = object.data; - if (object.timeout_height != null) { - if (typeof object.timeout_height !== "object") - throw TypeError(".ibc.core.channel.v1.Packet.timeout_height: object expected"); - message.timeout_height = $root.ibc.core.client.v1.Height.fromObject(object.timeout_height); - } - if (object.timeout_timestamp != null) - if ($util.Long) - (message.timeout_timestamp = $util.Long.fromValue(object.timeout_timestamp)).unsigned = true; - else if (typeof object.timeout_timestamp === "string") - message.timeout_timestamp = parseInt(object.timeout_timestamp, 10); - else if (typeof object.timeout_timestamp === "number") - message.timeout_timestamp = object.timeout_timestamp; - else if (typeof object.timeout_timestamp === "object") - message.timeout_timestamp = new $util.LongBits(object.timeout_timestamp.low >>> 0, object.timeout_timestamp.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a Packet message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.Packet - * @static - * @param {ibc.core.channel.v1.Packet} message Packet - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Packet.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.sequence = options.longs === String ? "0" : 0; - object.source_port = ""; - object.source_channel = ""; - object.destination_port = ""; - object.destination_channel = ""; - if (options.bytes === String) - object.data = ""; - else { - object.data = []; - if (options.bytes !== Array) - object.data = $util.newBuffer(object.data); - } - object.timeout_height = null; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.timeout_timestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.timeout_timestamp = options.longs === String ? "0" : 0; - } - if (message.sequence != null && message.hasOwnProperty("sequence")) - if (typeof message.sequence === "number") - object.sequence = options.longs === String ? String(message.sequence) : message.sequence; - else - object.sequence = options.longs === String ? $util.Long.prototype.toString.call(message.sequence) : options.longs === Number ? new $util.LongBits(message.sequence.low >>> 0, message.sequence.high >>> 0).toNumber(true) : message.sequence; - if (message.source_port != null && message.hasOwnProperty("source_port")) - object.source_port = message.source_port; - if (message.source_channel != null && message.hasOwnProperty("source_channel")) - object.source_channel = message.source_channel; - if (message.destination_port != null && message.hasOwnProperty("destination_port")) - object.destination_port = message.destination_port; - if (message.destination_channel != null && message.hasOwnProperty("destination_channel")) - object.destination_channel = message.destination_channel; - if (message.data != null && message.hasOwnProperty("data")) - object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; - if (message.timeout_height != null && message.hasOwnProperty("timeout_height")) - object.timeout_height = $root.ibc.core.client.v1.Height.toObject(message.timeout_height, options); - if (message.timeout_timestamp != null && message.hasOwnProperty("timeout_timestamp")) - if (typeof message.timeout_timestamp === "number") - object.timeout_timestamp = options.longs === String ? String(message.timeout_timestamp) : message.timeout_timestamp; - else - object.timeout_timestamp = options.longs === String ? $util.Long.prototype.toString.call(message.timeout_timestamp) : options.longs === Number ? new $util.LongBits(message.timeout_timestamp.low >>> 0, message.timeout_timestamp.high >>> 0).toNumber(true) : message.timeout_timestamp; - return object; - }; - - /** - * Converts this Packet to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.Packet - * @instance - * @returns {Object.} JSON object - */ - Packet.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Packet; - })(); - - v1.PacketState = (function() { - - /** - * Properties of a PacketState. - * @memberof ibc.core.channel.v1 - * @interface IPacketState - * @property {string|null} [port_id] PacketState port_id - * @property {string|null} [channel_id] PacketState channel_id - * @property {Long|null} [sequence] PacketState sequence - * @property {Uint8Array|null} [data] PacketState data - */ - - /** - * Constructs a new PacketState. - * @memberof ibc.core.channel.v1 - * @classdesc Represents a PacketState. - * @implements IPacketState - * @constructor - * @param {ibc.core.channel.v1.IPacketState=} [properties] Properties to set - */ - function PacketState(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PacketState port_id. - * @member {string} port_id - * @memberof ibc.core.channel.v1.PacketState - * @instance - */ - PacketState.prototype.port_id = ""; - - /** - * PacketState channel_id. - * @member {string} channel_id - * @memberof ibc.core.channel.v1.PacketState - * @instance - */ - PacketState.prototype.channel_id = ""; - - /** - * PacketState sequence. - * @member {Long} sequence - * @memberof ibc.core.channel.v1.PacketState - * @instance - */ - PacketState.prototype.sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * PacketState data. - * @member {Uint8Array} data - * @memberof ibc.core.channel.v1.PacketState - * @instance - */ - PacketState.prototype.data = $util.newBuffer([]); - - /** - * Encodes the specified PacketState message. Does not implicitly {@link ibc.core.channel.v1.PacketState.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.PacketState - * @static - * @param {ibc.core.channel.v1.IPacketState} message PacketState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PacketState.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.port_id != null && Object.hasOwnProperty.call(message, "port_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.port_id); - if (message.channel_id != null && Object.hasOwnProperty.call(message, "channel_id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.channel_id); - if (message.sequence != null && Object.hasOwnProperty.call(message, "sequence")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.sequence); - if (message.data != null && Object.hasOwnProperty.call(message, "data")) - writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.data); - return writer; - }; - - /** - * Encodes the specified PacketState message, length delimited. Does not implicitly {@link ibc.core.channel.v1.PacketState.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.PacketState - * @static - * @param {ibc.core.channel.v1.IPacketState} message PacketState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PacketState.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PacketState message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.PacketState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.PacketState} PacketState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PacketState.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.PacketState(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.port_id = reader.string(); - break; - case 2: - message.channel_id = reader.string(); - break; - case 3: - message.sequence = reader.uint64(); - break; - case 4: - message.data = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PacketState message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.PacketState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.PacketState} PacketState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PacketState.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PacketState message. - * @function verify - * @memberof ibc.core.channel.v1.PacketState - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PacketState.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.port_id != null && message.hasOwnProperty("port_id")) - if (!$util.isString(message.port_id)) - return "port_id: string expected"; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - if (!$util.isString(message.channel_id)) - return "channel_id: string expected"; - if (message.sequence != null && message.hasOwnProperty("sequence")) - if (!$util.isInteger(message.sequence) && !(message.sequence && $util.isInteger(message.sequence.low) && $util.isInteger(message.sequence.high))) - return "sequence: integer|Long expected"; - if (message.data != null && message.hasOwnProperty("data")) - if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) - return "data: buffer expected"; - return null; - }; - - /** - * Creates a PacketState message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.PacketState - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.PacketState} PacketState - */ - PacketState.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.PacketState) - return object; - let message = new $root.ibc.core.channel.v1.PacketState(); - if (object.port_id != null) - message.port_id = String(object.port_id); - if (object.channel_id != null) - message.channel_id = String(object.channel_id); - if (object.sequence != null) - if ($util.Long) - (message.sequence = $util.Long.fromValue(object.sequence)).unsigned = true; - else if (typeof object.sequence === "string") - message.sequence = parseInt(object.sequence, 10); - else if (typeof object.sequence === "number") - message.sequence = object.sequence; - else if (typeof object.sequence === "object") - message.sequence = new $util.LongBits(object.sequence.low >>> 0, object.sequence.high >>> 0).toNumber(true); - if (object.data != null) - if (typeof object.data === "string") - $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); - else if (object.data.length) - message.data = object.data; - return message; - }; - - /** - * Creates a plain object from a PacketState message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.PacketState - * @static - * @param {ibc.core.channel.v1.PacketState} message PacketState - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PacketState.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.port_id = ""; - object.channel_id = ""; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.sequence = options.longs === String ? "0" : 0; - if (options.bytes === String) - object.data = ""; - else { - object.data = []; - if (options.bytes !== Array) - object.data = $util.newBuffer(object.data); - } - } - if (message.port_id != null && message.hasOwnProperty("port_id")) - object.port_id = message.port_id; - if (message.channel_id != null && message.hasOwnProperty("channel_id")) - object.channel_id = message.channel_id; - if (message.sequence != null && message.hasOwnProperty("sequence")) - if (typeof message.sequence === "number") - object.sequence = options.longs === String ? String(message.sequence) : message.sequence; - else - object.sequence = options.longs === String ? $util.Long.prototype.toString.call(message.sequence) : options.longs === Number ? new $util.LongBits(message.sequence.low >>> 0, message.sequence.high >>> 0).toNumber(true) : message.sequence; - if (message.data != null && message.hasOwnProperty("data")) - object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; - return object; - }; - - /** - * Converts this PacketState to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.PacketState - * @instance - * @returns {Object.} JSON object - */ - PacketState.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return PacketState; - })(); - - v1.Acknowledgement = (function() { - - /** - * Properties of an Acknowledgement. - * @memberof ibc.core.channel.v1 - * @interface IAcknowledgement - * @property {Uint8Array|null} [result] Acknowledgement result - * @property {string|null} [error] Acknowledgement error - */ - - /** - * Constructs a new Acknowledgement. - * @memberof ibc.core.channel.v1 - * @classdesc Represents an Acknowledgement. - * @implements IAcknowledgement - * @constructor - * @param {ibc.core.channel.v1.IAcknowledgement=} [properties] Properties to set - */ - function Acknowledgement(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Acknowledgement result. - * @member {Uint8Array} result - * @memberof ibc.core.channel.v1.Acknowledgement - * @instance - */ - Acknowledgement.prototype.result = $util.newBuffer([]); - - /** - * Acknowledgement error. - * @member {string} error - * @memberof ibc.core.channel.v1.Acknowledgement - * @instance - */ - Acknowledgement.prototype.error = ""; - - // OneOf field names bound to virtual getters and setters - let $oneOfFields; - - /** - * Acknowledgement response. - * @member {"result"|"error"|undefined} response - * @memberof ibc.core.channel.v1.Acknowledgement - * @instance - */ - Object.defineProperty(Acknowledgement.prototype, "response", { - get: $util.oneOfGetter($oneOfFields = ["result", "error"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Encodes the specified Acknowledgement message. Does not implicitly {@link ibc.core.channel.v1.Acknowledgement.verify|verify} messages. - * @function encode - * @memberof ibc.core.channel.v1.Acknowledgement - * @static - * @param {ibc.core.channel.v1.IAcknowledgement} message Acknowledgement message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Acknowledgement.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.result != null && Object.hasOwnProperty.call(message, "result")) - writer.uint32(/* id 21, wireType 2 =*/170).bytes(message.result); - if (message.error != null && Object.hasOwnProperty.call(message, "error")) - writer.uint32(/* id 22, wireType 2 =*/178).string(message.error); - return writer; - }; - - /** - * Encodes the specified Acknowledgement message, length delimited. Does not implicitly {@link ibc.core.channel.v1.Acknowledgement.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.channel.v1.Acknowledgement - * @static - * @param {ibc.core.channel.v1.IAcknowledgement} message Acknowledgement message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Acknowledgement.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Acknowledgement message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.channel.v1.Acknowledgement - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.channel.v1.Acknowledgement} Acknowledgement - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Acknowledgement.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.channel.v1.Acknowledgement(); - while (reader.pos < end) { - let 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; - }; - - /** - * Decodes an Acknowledgement message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.channel.v1.Acknowledgement - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.channel.v1.Acknowledgement} Acknowledgement - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Acknowledgement.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Acknowledgement message. - * @function verify - * @memberof ibc.core.channel.v1.Acknowledgement - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Acknowledgement.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - let properties = {}; - if (message.result != null && message.hasOwnProperty("result")) { - properties.response = 1; - if (!(message.result && typeof message.result.length === "number" || $util.isString(message.result))) - return "result: buffer expected"; - } - if (message.error != null && message.hasOwnProperty("error")) { - if (properties.response === 1) - return "response: multiple values"; - properties.response = 1; - if (!$util.isString(message.error)) - return "error: string expected"; - } - return null; - }; - - /** - * Creates an Acknowledgement message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.channel.v1.Acknowledgement - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.channel.v1.Acknowledgement} Acknowledgement - */ - Acknowledgement.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.channel.v1.Acknowledgement) - return object; - let message = new $root.ibc.core.channel.v1.Acknowledgement(); - if (object.result != null) - if (typeof object.result === "string") - $util.base64.decode(object.result, message.result = $util.newBuffer($util.base64.length(object.result)), 0); - else if (object.result.length) - message.result = object.result; - if (object.error != null) - message.error = String(object.error); - return message; - }; - - /** - * Creates a plain object from an Acknowledgement message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.channel.v1.Acknowledgement - * @static - * @param {ibc.core.channel.v1.Acknowledgement} message Acknowledgement - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Acknowledgement.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (message.result != null && message.hasOwnProperty("result")) { - object.result = options.bytes === String ? $util.base64.encode(message.result, 0, message.result.length) : options.bytes === Array ? Array.prototype.slice.call(message.result) : message.result; - if (options.oneofs) - object.response = "result"; - } - if (message.error != null && message.hasOwnProperty("error")) { - object.error = message.error; - if (options.oneofs) - object.response = "error"; - } - return object; - }; - - /** - * Converts this Acknowledgement to JSON. - * @function toJSON - * @memberof ibc.core.channel.v1.Acknowledgement - * @instance - * @returns {Object.} JSON object - */ - Acknowledgement.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Acknowledgement; - })(); - - return v1; - })(); - - return channel; - })(); - - core.client = (function() { - - /** - * Namespace client. - * @memberof ibc.core - * @namespace - */ - const client = {}; - - client.v1 = (function() { - - /** - * Namespace v1. - * @memberof ibc.core.client - * @namespace - */ - const v1 = {}; - - v1.Msg = (function() { - - /** - * Constructs a new Msg service. - * @memberof ibc.core.client.v1 - * @classdesc Represents a Msg - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function Msg(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Msg.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Msg; - - /** - * Callback as used by {@link ibc.core.client.v1.Msg#createClient}. - * @memberof ibc.core.client.v1.Msg - * @typedef CreateClientCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.client.v1.MsgCreateClientResponse} [response] MsgCreateClientResponse - */ - - /** - * Calls CreateClient. - * @function createClient - * @memberof ibc.core.client.v1.Msg - * @instance - * @param {ibc.core.client.v1.IMsgCreateClient} request MsgCreateClient message or plain object - * @param {ibc.core.client.v1.Msg.CreateClientCallback} callback Node-style callback called with the error, if any, and MsgCreateClientResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.createClient = function createClient(request, callback) { - return this.rpcCall(createClient, $root.ibc.core.client.v1.MsgCreateClient, $root.ibc.core.client.v1.MsgCreateClientResponse, request, callback); - }, "name", { value: "CreateClient" }); - - /** - * Calls CreateClient. - * @function createClient - * @memberof ibc.core.client.v1.Msg - * @instance - * @param {ibc.core.client.v1.IMsgCreateClient} request MsgCreateClient message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.client.v1.Msg#updateClient}. - * @memberof ibc.core.client.v1.Msg - * @typedef UpdateClientCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.client.v1.MsgUpdateClientResponse} [response] MsgUpdateClientResponse - */ - - /** - * Calls UpdateClient. - * @function updateClient - * @memberof ibc.core.client.v1.Msg - * @instance - * @param {ibc.core.client.v1.IMsgUpdateClient} request MsgUpdateClient message or plain object - * @param {ibc.core.client.v1.Msg.UpdateClientCallback} callback Node-style callback called with the error, if any, and MsgUpdateClientResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.updateClient = function updateClient(request, callback) { - return this.rpcCall(updateClient, $root.ibc.core.client.v1.MsgUpdateClient, $root.ibc.core.client.v1.MsgUpdateClientResponse, request, callback); - }, "name", { value: "UpdateClient" }); - - /** - * Calls UpdateClient. - * @function updateClient - * @memberof ibc.core.client.v1.Msg - * @instance - * @param {ibc.core.client.v1.IMsgUpdateClient} request MsgUpdateClient message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.client.v1.Msg#upgradeClient}. - * @memberof ibc.core.client.v1.Msg - * @typedef UpgradeClientCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.client.v1.MsgUpgradeClientResponse} [response] MsgUpgradeClientResponse - */ - - /** - * Calls UpgradeClient. - * @function upgradeClient - * @memberof ibc.core.client.v1.Msg - * @instance - * @param {ibc.core.client.v1.IMsgUpgradeClient} request MsgUpgradeClient message or plain object - * @param {ibc.core.client.v1.Msg.UpgradeClientCallback} callback Node-style callback called with the error, if any, and MsgUpgradeClientResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.upgradeClient = function upgradeClient(request, callback) { - return this.rpcCall(upgradeClient, $root.ibc.core.client.v1.MsgUpgradeClient, $root.ibc.core.client.v1.MsgUpgradeClientResponse, request, callback); - }, "name", { value: "UpgradeClient" }); - - /** - * Calls UpgradeClient. - * @function upgradeClient - * @memberof ibc.core.client.v1.Msg - * @instance - * @param {ibc.core.client.v1.IMsgUpgradeClient} request MsgUpgradeClient message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.client.v1.Msg#submitMisbehaviour}. - * @memberof ibc.core.client.v1.Msg - * @typedef SubmitMisbehaviourCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.client.v1.MsgSubmitMisbehaviourResponse} [response] MsgSubmitMisbehaviourResponse - */ - - /** - * Calls SubmitMisbehaviour. - * @function submitMisbehaviour - * @memberof ibc.core.client.v1.Msg - * @instance - * @param {ibc.core.client.v1.IMsgSubmitMisbehaviour} request MsgSubmitMisbehaviour message or plain object - * @param {ibc.core.client.v1.Msg.SubmitMisbehaviourCallback} callback Node-style callback called with the error, if any, and MsgSubmitMisbehaviourResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.submitMisbehaviour = function submitMisbehaviour(request, callback) { - return this.rpcCall(submitMisbehaviour, $root.ibc.core.client.v1.MsgSubmitMisbehaviour, $root.ibc.core.client.v1.MsgSubmitMisbehaviourResponse, request, callback); - }, "name", { value: "SubmitMisbehaviour" }); - - /** - * Calls SubmitMisbehaviour. - * @function submitMisbehaviour - * @memberof ibc.core.client.v1.Msg - * @instance - * @param {ibc.core.client.v1.IMsgSubmitMisbehaviour} request MsgSubmitMisbehaviour message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return Msg; - })(); - - v1.MsgCreateClient = (function() { - - /** - * Properties of a MsgCreateClient. - * @memberof ibc.core.client.v1 - * @interface IMsgCreateClient - * @property {google.protobuf.IAny|null} [client_state] MsgCreateClient client_state - * @property {google.protobuf.IAny|null} [consensus_state] MsgCreateClient consensus_state - * @property {string|null} [signer] MsgCreateClient signer - */ - - /** - * Constructs a new MsgCreateClient. - * @memberof ibc.core.client.v1 - * @classdesc Represents a MsgCreateClient. - * @implements IMsgCreateClient - * @constructor - * @param {ibc.core.client.v1.IMsgCreateClient=} [properties] Properties to set - */ - function MsgCreateClient(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgCreateClient client_state. - * @member {google.protobuf.IAny|null|undefined} client_state - * @memberof ibc.core.client.v1.MsgCreateClient - * @instance - */ - MsgCreateClient.prototype.client_state = null; - - /** - * MsgCreateClient consensus_state. - * @member {google.protobuf.IAny|null|undefined} consensus_state - * @memberof ibc.core.client.v1.MsgCreateClient - * @instance - */ - MsgCreateClient.prototype.consensus_state = null; - - /** - * MsgCreateClient signer. - * @member {string} signer - * @memberof ibc.core.client.v1.MsgCreateClient - * @instance - */ - MsgCreateClient.prototype.signer = ""; - - /** - * Encodes the specified MsgCreateClient message. Does not implicitly {@link ibc.core.client.v1.MsgCreateClient.verify|verify} messages. - * @function encode - * @memberof ibc.core.client.v1.MsgCreateClient - * @static - * @param {ibc.core.client.v1.IMsgCreateClient} message MsgCreateClient message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgCreateClient.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.client_state != null && Object.hasOwnProperty.call(message, "client_state")) - $root.google.protobuf.Any.encode(message.client_state, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.consensus_state != null && Object.hasOwnProperty.call(message, "consensus_state")) - $root.google.protobuf.Any.encode(message.consensus_state, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.signer); - return writer; - }; - - /** - * Encodes the specified MsgCreateClient message, length delimited. Does not implicitly {@link ibc.core.client.v1.MsgCreateClient.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.client.v1.MsgCreateClient - * @static - * @param {ibc.core.client.v1.IMsgCreateClient} message MsgCreateClient message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgCreateClient.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgCreateClient message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.client.v1.MsgCreateClient - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.client.v1.MsgCreateClient} MsgCreateClient - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgCreateClient.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.MsgCreateClient(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.client_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - case 2: - message.consensus_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - case 3: - message.signer = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgCreateClient message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.client.v1.MsgCreateClient - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.client.v1.MsgCreateClient} MsgCreateClient - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgCreateClient.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgCreateClient message. - * @function verify - * @memberof ibc.core.client.v1.MsgCreateClient - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgCreateClient.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.client_state != null && message.hasOwnProperty("client_state")) { - let error = $root.google.protobuf.Any.verify(message.client_state); - if (error) - return "client_state." + error; - } - if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) { - let error = $root.google.protobuf.Any.verify(message.consensus_state); - if (error) - return "consensus_state." + error; - } - if (message.signer != null && message.hasOwnProperty("signer")) - if (!$util.isString(message.signer)) - return "signer: string expected"; - return null; - }; - - /** - * Creates a MsgCreateClient message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.client.v1.MsgCreateClient - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.client.v1.MsgCreateClient} MsgCreateClient - */ - MsgCreateClient.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.client.v1.MsgCreateClient) - return object; - let message = new $root.ibc.core.client.v1.MsgCreateClient(); - if (object.client_state != null) { - if (typeof object.client_state !== "object") - throw TypeError(".ibc.core.client.v1.MsgCreateClient.client_state: object expected"); - message.client_state = $root.google.protobuf.Any.fromObject(object.client_state); - } - if (object.consensus_state != null) { - if (typeof object.consensus_state !== "object") - throw TypeError(".ibc.core.client.v1.MsgCreateClient.consensus_state: object expected"); - message.consensus_state = $root.google.protobuf.Any.fromObject(object.consensus_state); - } - if (object.signer != null) - message.signer = String(object.signer); - return message; - }; - - /** - * Creates a plain object from a MsgCreateClient message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.client.v1.MsgCreateClient - * @static - * @param {ibc.core.client.v1.MsgCreateClient} message MsgCreateClient - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgCreateClient.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.client_state = null; - object.consensus_state = null; - object.signer = ""; - } - if (message.client_state != null && message.hasOwnProperty("client_state")) - object.client_state = $root.google.protobuf.Any.toObject(message.client_state, options); - if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) - object.consensus_state = $root.google.protobuf.Any.toObject(message.consensus_state, options); - if (message.signer != null && message.hasOwnProperty("signer")) - object.signer = message.signer; - return object; - }; - - /** - * Converts this MsgCreateClient to JSON. - * @function toJSON - * @memberof ibc.core.client.v1.MsgCreateClient - * @instance - * @returns {Object.} JSON object - */ - MsgCreateClient.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgCreateClient; - })(); - - v1.MsgCreateClientResponse = (function() { - - /** - * Properties of a MsgCreateClientResponse. - * @memberof ibc.core.client.v1 - * @interface IMsgCreateClientResponse - */ - - /** - * Constructs a new MsgCreateClientResponse. - * @memberof ibc.core.client.v1 - * @classdesc Represents a MsgCreateClientResponse. - * @implements IMsgCreateClientResponse - * @constructor - * @param {ibc.core.client.v1.IMsgCreateClientResponse=} [properties] Properties to set - */ - function MsgCreateClientResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgCreateClientResponse message. Does not implicitly {@link ibc.core.client.v1.MsgCreateClientResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.client.v1.MsgCreateClientResponse - * @static - * @param {ibc.core.client.v1.IMsgCreateClientResponse} message MsgCreateClientResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgCreateClientResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgCreateClientResponse message, length delimited. Does not implicitly {@link ibc.core.client.v1.MsgCreateClientResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.client.v1.MsgCreateClientResponse - * @static - * @param {ibc.core.client.v1.IMsgCreateClientResponse} message MsgCreateClientResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgCreateClientResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgCreateClientResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.client.v1.MsgCreateClientResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.client.v1.MsgCreateClientResponse} MsgCreateClientResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgCreateClientResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.MsgCreateClientResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgCreateClientResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.client.v1.MsgCreateClientResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.client.v1.MsgCreateClientResponse} MsgCreateClientResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgCreateClientResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgCreateClientResponse message. - * @function verify - * @memberof ibc.core.client.v1.MsgCreateClientResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgCreateClientResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgCreateClientResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.client.v1.MsgCreateClientResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.client.v1.MsgCreateClientResponse} MsgCreateClientResponse - */ - MsgCreateClientResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.client.v1.MsgCreateClientResponse) - return object; - return new $root.ibc.core.client.v1.MsgCreateClientResponse(); - }; - - /** - * Creates a plain object from a MsgCreateClientResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.client.v1.MsgCreateClientResponse - * @static - * @param {ibc.core.client.v1.MsgCreateClientResponse} message MsgCreateClientResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgCreateClientResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgCreateClientResponse to JSON. - * @function toJSON - * @memberof ibc.core.client.v1.MsgCreateClientResponse - * @instance - * @returns {Object.} JSON object - */ - MsgCreateClientResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgCreateClientResponse; - })(); - - v1.MsgUpdateClient = (function() { - - /** - * Properties of a MsgUpdateClient. - * @memberof ibc.core.client.v1 - * @interface IMsgUpdateClient - * @property {string|null} [client_id] MsgUpdateClient client_id - * @property {google.protobuf.IAny|null} [header] MsgUpdateClient header - * @property {string|null} [signer] MsgUpdateClient signer - */ - - /** - * Constructs a new MsgUpdateClient. - * @memberof ibc.core.client.v1 - * @classdesc Represents a MsgUpdateClient. - * @implements IMsgUpdateClient - * @constructor - * @param {ibc.core.client.v1.IMsgUpdateClient=} [properties] Properties to set - */ - function MsgUpdateClient(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgUpdateClient client_id. - * @member {string} client_id - * @memberof ibc.core.client.v1.MsgUpdateClient - * @instance - */ - MsgUpdateClient.prototype.client_id = ""; - - /** - * MsgUpdateClient header. - * @member {google.protobuf.IAny|null|undefined} header - * @memberof ibc.core.client.v1.MsgUpdateClient - * @instance - */ - MsgUpdateClient.prototype.header = null; - - /** - * MsgUpdateClient signer. - * @member {string} signer - * @memberof ibc.core.client.v1.MsgUpdateClient - * @instance - */ - MsgUpdateClient.prototype.signer = ""; - - /** - * Encodes the specified MsgUpdateClient message. Does not implicitly {@link ibc.core.client.v1.MsgUpdateClient.verify|verify} messages. - * @function encode - * @memberof ibc.core.client.v1.MsgUpdateClient - * @static - * @param {ibc.core.client.v1.IMsgUpdateClient} message MsgUpdateClient message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgUpdateClient.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); - if (message.header != null && Object.hasOwnProperty.call(message, "header")) - $root.google.protobuf.Any.encode(message.header, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.signer); - return writer; - }; - - /** - * Encodes the specified MsgUpdateClient message, length delimited. Does not implicitly {@link ibc.core.client.v1.MsgUpdateClient.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.client.v1.MsgUpdateClient - * @static - * @param {ibc.core.client.v1.IMsgUpdateClient} message MsgUpdateClient message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgUpdateClient.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgUpdateClient message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.client.v1.MsgUpdateClient - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.client.v1.MsgUpdateClient} MsgUpdateClient - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgUpdateClient.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.MsgUpdateClient(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.client_id = reader.string(); - break; - case 2: - message.header = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - case 3: - message.signer = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgUpdateClient message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.client.v1.MsgUpdateClient - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.client.v1.MsgUpdateClient} MsgUpdateClient - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgUpdateClient.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgUpdateClient message. - * @function verify - * @memberof ibc.core.client.v1.MsgUpdateClient - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgUpdateClient.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.client_id != null && message.hasOwnProperty("client_id")) - if (!$util.isString(message.client_id)) - return "client_id: string expected"; - if (message.header != null && message.hasOwnProperty("header")) { - let error = $root.google.protobuf.Any.verify(message.header); - if (error) - return "header." + error; - } - if (message.signer != null && message.hasOwnProperty("signer")) - if (!$util.isString(message.signer)) - return "signer: string expected"; - return null; - }; - - /** - * Creates a MsgUpdateClient message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.client.v1.MsgUpdateClient - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.client.v1.MsgUpdateClient} MsgUpdateClient - */ - MsgUpdateClient.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.client.v1.MsgUpdateClient) - return object; - let message = new $root.ibc.core.client.v1.MsgUpdateClient(); - if (object.client_id != null) - message.client_id = String(object.client_id); - if (object.header != null) { - if (typeof object.header !== "object") - throw TypeError(".ibc.core.client.v1.MsgUpdateClient.header: object expected"); - message.header = $root.google.protobuf.Any.fromObject(object.header); - } - if (object.signer != null) - message.signer = String(object.signer); - return message; - }; - - /** - * Creates a plain object from a MsgUpdateClient message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.client.v1.MsgUpdateClient - * @static - * @param {ibc.core.client.v1.MsgUpdateClient} message MsgUpdateClient - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgUpdateClient.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.client_id = ""; - object.header = null; - object.signer = ""; - } - if (message.client_id != null && message.hasOwnProperty("client_id")) - object.client_id = message.client_id; - if (message.header != null && message.hasOwnProperty("header")) - object.header = $root.google.protobuf.Any.toObject(message.header, options); - if (message.signer != null && message.hasOwnProperty("signer")) - object.signer = message.signer; - return object; - }; - - /** - * Converts this MsgUpdateClient to JSON. - * @function toJSON - * @memberof ibc.core.client.v1.MsgUpdateClient - * @instance - * @returns {Object.} JSON object - */ - MsgUpdateClient.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgUpdateClient; - })(); - - v1.MsgUpdateClientResponse = (function() { - - /** - * Properties of a MsgUpdateClientResponse. - * @memberof ibc.core.client.v1 - * @interface IMsgUpdateClientResponse - */ - - /** - * Constructs a new MsgUpdateClientResponse. - * @memberof ibc.core.client.v1 - * @classdesc Represents a MsgUpdateClientResponse. - * @implements IMsgUpdateClientResponse - * @constructor - * @param {ibc.core.client.v1.IMsgUpdateClientResponse=} [properties] Properties to set - */ - function MsgUpdateClientResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgUpdateClientResponse message. Does not implicitly {@link ibc.core.client.v1.MsgUpdateClientResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.client.v1.MsgUpdateClientResponse - * @static - * @param {ibc.core.client.v1.IMsgUpdateClientResponse} message MsgUpdateClientResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgUpdateClientResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgUpdateClientResponse message, length delimited. Does not implicitly {@link ibc.core.client.v1.MsgUpdateClientResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.client.v1.MsgUpdateClientResponse - * @static - * @param {ibc.core.client.v1.IMsgUpdateClientResponse} message MsgUpdateClientResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgUpdateClientResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgUpdateClientResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.client.v1.MsgUpdateClientResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.client.v1.MsgUpdateClientResponse} MsgUpdateClientResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgUpdateClientResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.MsgUpdateClientResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgUpdateClientResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.client.v1.MsgUpdateClientResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.client.v1.MsgUpdateClientResponse} MsgUpdateClientResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgUpdateClientResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgUpdateClientResponse message. - * @function verify - * @memberof ibc.core.client.v1.MsgUpdateClientResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgUpdateClientResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgUpdateClientResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.client.v1.MsgUpdateClientResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.client.v1.MsgUpdateClientResponse} MsgUpdateClientResponse - */ - MsgUpdateClientResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.client.v1.MsgUpdateClientResponse) - return object; - return new $root.ibc.core.client.v1.MsgUpdateClientResponse(); - }; - - /** - * Creates a plain object from a MsgUpdateClientResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.client.v1.MsgUpdateClientResponse - * @static - * @param {ibc.core.client.v1.MsgUpdateClientResponse} message MsgUpdateClientResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgUpdateClientResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgUpdateClientResponse to JSON. - * @function toJSON - * @memberof ibc.core.client.v1.MsgUpdateClientResponse - * @instance - * @returns {Object.} JSON object - */ - MsgUpdateClientResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgUpdateClientResponse; - })(); - - v1.MsgUpgradeClient = (function() { - - /** - * Properties of a MsgUpgradeClient. - * @memberof ibc.core.client.v1 - * @interface IMsgUpgradeClient - * @property {string|null} [client_id] MsgUpgradeClient client_id - * @property {google.protobuf.IAny|null} [client_state] MsgUpgradeClient client_state - * @property {google.protobuf.IAny|null} [consensus_state] MsgUpgradeClient consensus_state - * @property {Uint8Array|null} [proof_upgrade_client] MsgUpgradeClient proof_upgrade_client - * @property {Uint8Array|null} [proof_upgrade_consensus_state] MsgUpgradeClient proof_upgrade_consensus_state - * @property {string|null} [signer] MsgUpgradeClient signer - */ - - /** - * Constructs a new MsgUpgradeClient. - * @memberof ibc.core.client.v1 - * @classdesc Represents a MsgUpgradeClient. - * @implements IMsgUpgradeClient - * @constructor - * @param {ibc.core.client.v1.IMsgUpgradeClient=} [properties] Properties to set - */ - function MsgUpgradeClient(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgUpgradeClient client_id. - * @member {string} client_id - * @memberof ibc.core.client.v1.MsgUpgradeClient - * @instance - */ - MsgUpgradeClient.prototype.client_id = ""; - - /** - * MsgUpgradeClient client_state. - * @member {google.protobuf.IAny|null|undefined} client_state - * @memberof ibc.core.client.v1.MsgUpgradeClient - * @instance - */ - MsgUpgradeClient.prototype.client_state = null; - - /** - * MsgUpgradeClient consensus_state. - * @member {google.protobuf.IAny|null|undefined} consensus_state - * @memberof ibc.core.client.v1.MsgUpgradeClient - * @instance - */ - MsgUpgradeClient.prototype.consensus_state = null; - - /** - * MsgUpgradeClient proof_upgrade_client. - * @member {Uint8Array} proof_upgrade_client - * @memberof ibc.core.client.v1.MsgUpgradeClient - * @instance - */ - MsgUpgradeClient.prototype.proof_upgrade_client = $util.newBuffer([]); - - /** - * MsgUpgradeClient proof_upgrade_consensus_state. - * @member {Uint8Array} proof_upgrade_consensus_state - * @memberof ibc.core.client.v1.MsgUpgradeClient - * @instance - */ - MsgUpgradeClient.prototype.proof_upgrade_consensus_state = $util.newBuffer([]); - - /** - * MsgUpgradeClient signer. - * @member {string} signer - * @memberof ibc.core.client.v1.MsgUpgradeClient - * @instance - */ - MsgUpgradeClient.prototype.signer = ""; - - /** - * Encodes the specified MsgUpgradeClient message. Does not implicitly {@link ibc.core.client.v1.MsgUpgradeClient.verify|verify} messages. - * @function encode - * @memberof ibc.core.client.v1.MsgUpgradeClient - * @static - * @param {ibc.core.client.v1.IMsgUpgradeClient} message MsgUpgradeClient message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgUpgradeClient.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); - if (message.client_state != null && Object.hasOwnProperty.call(message, "client_state")) - $root.google.protobuf.Any.encode(message.client_state, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.consensus_state != null && Object.hasOwnProperty.call(message, "consensus_state")) - $root.google.protobuf.Any.encode(message.consensus_state, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.proof_upgrade_client != null && Object.hasOwnProperty.call(message, "proof_upgrade_client")) - writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.proof_upgrade_client); - if (message.proof_upgrade_consensus_state != null && Object.hasOwnProperty.call(message, "proof_upgrade_consensus_state")) - writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.proof_upgrade_consensus_state); - if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.signer); - return writer; - }; - - /** - * Encodes the specified MsgUpgradeClient message, length delimited. Does not implicitly {@link ibc.core.client.v1.MsgUpgradeClient.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.client.v1.MsgUpgradeClient - * @static - * @param {ibc.core.client.v1.IMsgUpgradeClient} message MsgUpgradeClient message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgUpgradeClient.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgUpgradeClient message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.client.v1.MsgUpgradeClient - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.client.v1.MsgUpgradeClient} MsgUpgradeClient - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgUpgradeClient.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.MsgUpgradeClient(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.client_id = reader.string(); - break; - case 2: - message.client_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - case 3: - message.consensus_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - case 4: - message.proof_upgrade_client = reader.bytes(); - break; - case 5: - message.proof_upgrade_consensus_state = reader.bytes(); - break; - case 6: - message.signer = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgUpgradeClient message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.client.v1.MsgUpgradeClient - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.client.v1.MsgUpgradeClient} MsgUpgradeClient - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgUpgradeClient.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgUpgradeClient message. - * @function verify - * @memberof ibc.core.client.v1.MsgUpgradeClient - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgUpgradeClient.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.client_id != null && message.hasOwnProperty("client_id")) - if (!$util.isString(message.client_id)) - return "client_id: string expected"; - if (message.client_state != null && message.hasOwnProperty("client_state")) { - let error = $root.google.protobuf.Any.verify(message.client_state); - if (error) - return "client_state." + error; - } - if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) { - let error = $root.google.protobuf.Any.verify(message.consensus_state); - if (error) - return "consensus_state." + error; - } - if (message.proof_upgrade_client != null && message.hasOwnProperty("proof_upgrade_client")) - if (!(message.proof_upgrade_client && typeof message.proof_upgrade_client.length === "number" || $util.isString(message.proof_upgrade_client))) - return "proof_upgrade_client: buffer expected"; - if (message.proof_upgrade_consensus_state != null && message.hasOwnProperty("proof_upgrade_consensus_state")) - if (!(message.proof_upgrade_consensus_state && typeof message.proof_upgrade_consensus_state.length === "number" || $util.isString(message.proof_upgrade_consensus_state))) - return "proof_upgrade_consensus_state: buffer expected"; - if (message.signer != null && message.hasOwnProperty("signer")) - if (!$util.isString(message.signer)) - return "signer: string expected"; - return null; - }; - - /** - * Creates a MsgUpgradeClient message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.client.v1.MsgUpgradeClient - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.client.v1.MsgUpgradeClient} MsgUpgradeClient - */ - MsgUpgradeClient.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.client.v1.MsgUpgradeClient) - return object; - let message = new $root.ibc.core.client.v1.MsgUpgradeClient(); - if (object.client_id != null) - message.client_id = String(object.client_id); - if (object.client_state != null) { - if (typeof object.client_state !== "object") - throw TypeError(".ibc.core.client.v1.MsgUpgradeClient.client_state: object expected"); - message.client_state = $root.google.protobuf.Any.fromObject(object.client_state); - } - if (object.consensus_state != null) { - if (typeof object.consensus_state !== "object") - throw TypeError(".ibc.core.client.v1.MsgUpgradeClient.consensus_state: object expected"); - message.consensus_state = $root.google.protobuf.Any.fromObject(object.consensus_state); - } - if (object.proof_upgrade_client != null) - if (typeof object.proof_upgrade_client === "string") - $util.base64.decode(object.proof_upgrade_client, message.proof_upgrade_client = $util.newBuffer($util.base64.length(object.proof_upgrade_client)), 0); - else if (object.proof_upgrade_client.length) - message.proof_upgrade_client = object.proof_upgrade_client; - if (object.proof_upgrade_consensus_state != null) - if (typeof object.proof_upgrade_consensus_state === "string") - $util.base64.decode(object.proof_upgrade_consensus_state, message.proof_upgrade_consensus_state = $util.newBuffer($util.base64.length(object.proof_upgrade_consensus_state)), 0); - else if (object.proof_upgrade_consensus_state.length) - message.proof_upgrade_consensus_state = object.proof_upgrade_consensus_state; - if (object.signer != null) - message.signer = String(object.signer); - return message; - }; - - /** - * Creates a plain object from a MsgUpgradeClient message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.client.v1.MsgUpgradeClient - * @static - * @param {ibc.core.client.v1.MsgUpgradeClient} message MsgUpgradeClient - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgUpgradeClient.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.client_id = ""; - object.client_state = null; - object.consensus_state = null; - if (options.bytes === String) - object.proof_upgrade_client = ""; - else { - object.proof_upgrade_client = []; - if (options.bytes !== Array) - object.proof_upgrade_client = $util.newBuffer(object.proof_upgrade_client); - } - if (options.bytes === String) - object.proof_upgrade_consensus_state = ""; - else { - object.proof_upgrade_consensus_state = []; - if (options.bytes !== Array) - object.proof_upgrade_consensus_state = $util.newBuffer(object.proof_upgrade_consensus_state); - } - object.signer = ""; - } - if (message.client_id != null && message.hasOwnProperty("client_id")) - object.client_id = message.client_id; - if (message.client_state != null && message.hasOwnProperty("client_state")) - object.client_state = $root.google.protobuf.Any.toObject(message.client_state, options); - if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) - object.consensus_state = $root.google.protobuf.Any.toObject(message.consensus_state, options); - if (message.proof_upgrade_client != null && message.hasOwnProperty("proof_upgrade_client")) - object.proof_upgrade_client = options.bytes === String ? $util.base64.encode(message.proof_upgrade_client, 0, message.proof_upgrade_client.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_upgrade_client) : message.proof_upgrade_client; - if (message.proof_upgrade_consensus_state != null && message.hasOwnProperty("proof_upgrade_consensus_state")) - object.proof_upgrade_consensus_state = options.bytes === String ? $util.base64.encode(message.proof_upgrade_consensus_state, 0, message.proof_upgrade_consensus_state.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_upgrade_consensus_state) : message.proof_upgrade_consensus_state; - if (message.signer != null && message.hasOwnProperty("signer")) - object.signer = message.signer; - return object; - }; - - /** - * Converts this MsgUpgradeClient to JSON. - * @function toJSON - * @memberof ibc.core.client.v1.MsgUpgradeClient - * @instance - * @returns {Object.} JSON object - */ - MsgUpgradeClient.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgUpgradeClient; - })(); - - v1.MsgUpgradeClientResponse = (function() { - - /** - * Properties of a MsgUpgradeClientResponse. - * @memberof ibc.core.client.v1 - * @interface IMsgUpgradeClientResponse - */ - - /** - * Constructs a new MsgUpgradeClientResponse. - * @memberof ibc.core.client.v1 - * @classdesc Represents a MsgUpgradeClientResponse. - * @implements IMsgUpgradeClientResponse - * @constructor - * @param {ibc.core.client.v1.IMsgUpgradeClientResponse=} [properties] Properties to set - */ - function MsgUpgradeClientResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgUpgradeClientResponse message. Does not implicitly {@link ibc.core.client.v1.MsgUpgradeClientResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.client.v1.MsgUpgradeClientResponse - * @static - * @param {ibc.core.client.v1.IMsgUpgradeClientResponse} message MsgUpgradeClientResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgUpgradeClientResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgUpgradeClientResponse message, length delimited. Does not implicitly {@link ibc.core.client.v1.MsgUpgradeClientResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.client.v1.MsgUpgradeClientResponse - * @static - * @param {ibc.core.client.v1.IMsgUpgradeClientResponse} message MsgUpgradeClientResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgUpgradeClientResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgUpgradeClientResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.client.v1.MsgUpgradeClientResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.client.v1.MsgUpgradeClientResponse} MsgUpgradeClientResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgUpgradeClientResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.MsgUpgradeClientResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgUpgradeClientResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.client.v1.MsgUpgradeClientResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.client.v1.MsgUpgradeClientResponse} MsgUpgradeClientResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgUpgradeClientResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgUpgradeClientResponse message. - * @function verify - * @memberof ibc.core.client.v1.MsgUpgradeClientResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgUpgradeClientResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgUpgradeClientResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.client.v1.MsgUpgradeClientResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.client.v1.MsgUpgradeClientResponse} MsgUpgradeClientResponse - */ - MsgUpgradeClientResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.client.v1.MsgUpgradeClientResponse) - return object; - return new $root.ibc.core.client.v1.MsgUpgradeClientResponse(); - }; - - /** - * Creates a plain object from a MsgUpgradeClientResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.client.v1.MsgUpgradeClientResponse - * @static - * @param {ibc.core.client.v1.MsgUpgradeClientResponse} message MsgUpgradeClientResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgUpgradeClientResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgUpgradeClientResponse to JSON. - * @function toJSON - * @memberof ibc.core.client.v1.MsgUpgradeClientResponse - * @instance - * @returns {Object.} JSON object - */ - MsgUpgradeClientResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgUpgradeClientResponse; - })(); - - v1.MsgSubmitMisbehaviour = (function() { - - /** - * Properties of a MsgSubmitMisbehaviour. - * @memberof ibc.core.client.v1 - * @interface IMsgSubmitMisbehaviour - * @property {string|null} [client_id] MsgSubmitMisbehaviour client_id - * @property {google.protobuf.IAny|null} [misbehaviour] MsgSubmitMisbehaviour misbehaviour - * @property {string|null} [signer] MsgSubmitMisbehaviour signer - */ - - /** - * Constructs a new MsgSubmitMisbehaviour. - * @memberof ibc.core.client.v1 - * @classdesc Represents a MsgSubmitMisbehaviour. - * @implements IMsgSubmitMisbehaviour - * @constructor - * @param {ibc.core.client.v1.IMsgSubmitMisbehaviour=} [properties] Properties to set - */ - function MsgSubmitMisbehaviour(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgSubmitMisbehaviour client_id. - * @member {string} client_id - * @memberof ibc.core.client.v1.MsgSubmitMisbehaviour - * @instance - */ - MsgSubmitMisbehaviour.prototype.client_id = ""; - - /** - * MsgSubmitMisbehaviour misbehaviour. - * @member {google.protobuf.IAny|null|undefined} misbehaviour - * @memberof ibc.core.client.v1.MsgSubmitMisbehaviour - * @instance - */ - MsgSubmitMisbehaviour.prototype.misbehaviour = null; - - /** - * MsgSubmitMisbehaviour signer. - * @member {string} signer - * @memberof ibc.core.client.v1.MsgSubmitMisbehaviour - * @instance - */ - MsgSubmitMisbehaviour.prototype.signer = ""; - - /** - * Encodes the specified MsgSubmitMisbehaviour message. Does not implicitly {@link ibc.core.client.v1.MsgSubmitMisbehaviour.verify|verify} messages. - * @function encode - * @memberof ibc.core.client.v1.MsgSubmitMisbehaviour - * @static - * @param {ibc.core.client.v1.IMsgSubmitMisbehaviour} message MsgSubmitMisbehaviour message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgSubmitMisbehaviour.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); - if (message.misbehaviour != null && Object.hasOwnProperty.call(message, "misbehaviour")) - $root.google.protobuf.Any.encode(message.misbehaviour, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.signer); - return writer; - }; - - /** - * Encodes the specified MsgSubmitMisbehaviour message, length delimited. Does not implicitly {@link ibc.core.client.v1.MsgSubmitMisbehaviour.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.client.v1.MsgSubmitMisbehaviour - * @static - * @param {ibc.core.client.v1.IMsgSubmitMisbehaviour} message MsgSubmitMisbehaviour message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgSubmitMisbehaviour.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgSubmitMisbehaviour message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.client.v1.MsgSubmitMisbehaviour - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.client.v1.MsgSubmitMisbehaviour} MsgSubmitMisbehaviour - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgSubmitMisbehaviour.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.MsgSubmitMisbehaviour(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.client_id = reader.string(); - break; - case 2: - message.misbehaviour = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - case 3: - message.signer = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgSubmitMisbehaviour message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.client.v1.MsgSubmitMisbehaviour - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.client.v1.MsgSubmitMisbehaviour} MsgSubmitMisbehaviour - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgSubmitMisbehaviour.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgSubmitMisbehaviour message. - * @function verify - * @memberof ibc.core.client.v1.MsgSubmitMisbehaviour - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgSubmitMisbehaviour.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.client_id != null && message.hasOwnProperty("client_id")) - if (!$util.isString(message.client_id)) - return "client_id: string expected"; - if (message.misbehaviour != null && message.hasOwnProperty("misbehaviour")) { - let error = $root.google.protobuf.Any.verify(message.misbehaviour); - if (error) - return "misbehaviour." + error; - } - if (message.signer != null && message.hasOwnProperty("signer")) - if (!$util.isString(message.signer)) - return "signer: string expected"; - return null; - }; - - /** - * Creates a MsgSubmitMisbehaviour message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.client.v1.MsgSubmitMisbehaviour - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.client.v1.MsgSubmitMisbehaviour} MsgSubmitMisbehaviour - */ - MsgSubmitMisbehaviour.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.client.v1.MsgSubmitMisbehaviour) - return object; - let message = new $root.ibc.core.client.v1.MsgSubmitMisbehaviour(); - if (object.client_id != null) - message.client_id = String(object.client_id); - if (object.misbehaviour != null) { - if (typeof object.misbehaviour !== "object") - throw TypeError(".ibc.core.client.v1.MsgSubmitMisbehaviour.misbehaviour: object expected"); - message.misbehaviour = $root.google.protobuf.Any.fromObject(object.misbehaviour); - } - if (object.signer != null) - message.signer = String(object.signer); - return message; - }; - - /** - * Creates a plain object from a MsgSubmitMisbehaviour message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.client.v1.MsgSubmitMisbehaviour - * @static - * @param {ibc.core.client.v1.MsgSubmitMisbehaviour} message MsgSubmitMisbehaviour - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgSubmitMisbehaviour.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.client_id = ""; - object.misbehaviour = null; - object.signer = ""; - } - if (message.client_id != null && message.hasOwnProperty("client_id")) - object.client_id = message.client_id; - if (message.misbehaviour != null && message.hasOwnProperty("misbehaviour")) - object.misbehaviour = $root.google.protobuf.Any.toObject(message.misbehaviour, options); - if (message.signer != null && message.hasOwnProperty("signer")) - object.signer = message.signer; - return object; - }; - - /** - * Converts this MsgSubmitMisbehaviour to JSON. - * @function toJSON - * @memberof ibc.core.client.v1.MsgSubmitMisbehaviour - * @instance - * @returns {Object.} JSON object - */ - MsgSubmitMisbehaviour.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgSubmitMisbehaviour; - })(); - - v1.MsgSubmitMisbehaviourResponse = (function() { - - /** - * Properties of a MsgSubmitMisbehaviourResponse. - * @memberof ibc.core.client.v1 - * @interface IMsgSubmitMisbehaviourResponse - */ - - /** - * Constructs a new MsgSubmitMisbehaviourResponse. - * @memberof ibc.core.client.v1 - * @classdesc Represents a MsgSubmitMisbehaviourResponse. - * @implements IMsgSubmitMisbehaviourResponse - * @constructor - * @param {ibc.core.client.v1.IMsgSubmitMisbehaviourResponse=} [properties] Properties to set - */ - function MsgSubmitMisbehaviourResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgSubmitMisbehaviourResponse message. Does not implicitly {@link ibc.core.client.v1.MsgSubmitMisbehaviourResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.client.v1.MsgSubmitMisbehaviourResponse - * @static - * @param {ibc.core.client.v1.IMsgSubmitMisbehaviourResponse} message MsgSubmitMisbehaviourResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgSubmitMisbehaviourResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgSubmitMisbehaviourResponse message, length delimited. Does not implicitly {@link ibc.core.client.v1.MsgSubmitMisbehaviourResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.client.v1.MsgSubmitMisbehaviourResponse - * @static - * @param {ibc.core.client.v1.IMsgSubmitMisbehaviourResponse} message MsgSubmitMisbehaviourResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgSubmitMisbehaviourResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgSubmitMisbehaviourResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.client.v1.MsgSubmitMisbehaviourResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.client.v1.MsgSubmitMisbehaviourResponse} MsgSubmitMisbehaviourResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgSubmitMisbehaviourResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.MsgSubmitMisbehaviourResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgSubmitMisbehaviourResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.client.v1.MsgSubmitMisbehaviourResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.client.v1.MsgSubmitMisbehaviourResponse} MsgSubmitMisbehaviourResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgSubmitMisbehaviourResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgSubmitMisbehaviourResponse message. - * @function verify - * @memberof ibc.core.client.v1.MsgSubmitMisbehaviourResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgSubmitMisbehaviourResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgSubmitMisbehaviourResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.client.v1.MsgSubmitMisbehaviourResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.client.v1.MsgSubmitMisbehaviourResponse} MsgSubmitMisbehaviourResponse - */ - MsgSubmitMisbehaviourResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.client.v1.MsgSubmitMisbehaviourResponse) - return object; - return new $root.ibc.core.client.v1.MsgSubmitMisbehaviourResponse(); - }; - - /** - * Creates a plain object from a MsgSubmitMisbehaviourResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.client.v1.MsgSubmitMisbehaviourResponse - * @static - * @param {ibc.core.client.v1.MsgSubmitMisbehaviourResponse} message MsgSubmitMisbehaviourResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgSubmitMisbehaviourResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgSubmitMisbehaviourResponse to JSON. - * @function toJSON - * @memberof ibc.core.client.v1.MsgSubmitMisbehaviourResponse - * @instance - * @returns {Object.} JSON object - */ - MsgSubmitMisbehaviourResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgSubmitMisbehaviourResponse; - })(); - - v1.IdentifiedClientState = (function() { - - /** - * Properties of an IdentifiedClientState. - * @memberof ibc.core.client.v1 - * @interface IIdentifiedClientState - * @property {string|null} [client_id] IdentifiedClientState client_id - * @property {google.protobuf.IAny|null} [client_state] IdentifiedClientState client_state - */ - - /** - * Constructs a new IdentifiedClientState. - * @memberof ibc.core.client.v1 - * @classdesc Represents an IdentifiedClientState. - * @implements IIdentifiedClientState - * @constructor - * @param {ibc.core.client.v1.IIdentifiedClientState=} [properties] Properties to set - */ - function IdentifiedClientState(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * IdentifiedClientState client_id. - * @member {string} client_id - * @memberof ibc.core.client.v1.IdentifiedClientState - * @instance - */ - IdentifiedClientState.prototype.client_id = ""; - - /** - * IdentifiedClientState client_state. - * @member {google.protobuf.IAny|null|undefined} client_state - * @memberof ibc.core.client.v1.IdentifiedClientState - * @instance - */ - IdentifiedClientState.prototype.client_state = null; - - /** - * Encodes the specified IdentifiedClientState message. Does not implicitly {@link ibc.core.client.v1.IdentifiedClientState.verify|verify} messages. - * @function encode - * @memberof ibc.core.client.v1.IdentifiedClientState - * @static - * @param {ibc.core.client.v1.IIdentifiedClientState} message IdentifiedClientState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - IdentifiedClientState.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); - if (message.client_state != null && Object.hasOwnProperty.call(message, "client_state")) - $root.google.protobuf.Any.encode(message.client_state, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified IdentifiedClientState message, length delimited. Does not implicitly {@link ibc.core.client.v1.IdentifiedClientState.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.client.v1.IdentifiedClientState - * @static - * @param {ibc.core.client.v1.IIdentifiedClientState} message IdentifiedClientState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - IdentifiedClientState.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an IdentifiedClientState message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.client.v1.IdentifiedClientState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.client.v1.IdentifiedClientState} IdentifiedClientState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - IdentifiedClientState.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.IdentifiedClientState(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.client_id = reader.string(); - break; - case 2: - message.client_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an IdentifiedClientState message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.client.v1.IdentifiedClientState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.client.v1.IdentifiedClientState} IdentifiedClientState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - IdentifiedClientState.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an IdentifiedClientState message. - * @function verify - * @memberof ibc.core.client.v1.IdentifiedClientState - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - IdentifiedClientState.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.client_id != null && message.hasOwnProperty("client_id")) - if (!$util.isString(message.client_id)) - return "client_id: string expected"; - if (message.client_state != null && message.hasOwnProperty("client_state")) { - let error = $root.google.protobuf.Any.verify(message.client_state); - if (error) - return "client_state." + error; - } - return null; - }; - - /** - * Creates an IdentifiedClientState message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.client.v1.IdentifiedClientState - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.client.v1.IdentifiedClientState} IdentifiedClientState - */ - IdentifiedClientState.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.client.v1.IdentifiedClientState) - return object; - let message = new $root.ibc.core.client.v1.IdentifiedClientState(); - if (object.client_id != null) - message.client_id = String(object.client_id); - if (object.client_state != null) { - if (typeof object.client_state !== "object") - throw TypeError(".ibc.core.client.v1.IdentifiedClientState.client_state: object expected"); - message.client_state = $root.google.protobuf.Any.fromObject(object.client_state); - } - return message; - }; - - /** - * Creates a plain object from an IdentifiedClientState message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.client.v1.IdentifiedClientState - * @static - * @param {ibc.core.client.v1.IdentifiedClientState} message IdentifiedClientState - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - IdentifiedClientState.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.client_id = ""; - object.client_state = null; - } - if (message.client_id != null && message.hasOwnProperty("client_id")) - object.client_id = message.client_id; - if (message.client_state != null && message.hasOwnProperty("client_state")) - object.client_state = $root.google.protobuf.Any.toObject(message.client_state, options); - return object; - }; - - /** - * Converts this IdentifiedClientState to JSON. - * @function toJSON - * @memberof ibc.core.client.v1.IdentifiedClientState - * @instance - * @returns {Object.} JSON object - */ - IdentifiedClientState.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return IdentifiedClientState; - })(); - - v1.ConsensusStateWithHeight = (function() { - - /** - * Properties of a ConsensusStateWithHeight. - * @memberof ibc.core.client.v1 - * @interface IConsensusStateWithHeight - * @property {ibc.core.client.v1.IHeight|null} [height] ConsensusStateWithHeight height - * @property {google.protobuf.IAny|null} [consensus_state] ConsensusStateWithHeight consensus_state - */ - - /** - * Constructs a new ConsensusStateWithHeight. - * @memberof ibc.core.client.v1 - * @classdesc Represents a ConsensusStateWithHeight. - * @implements IConsensusStateWithHeight - * @constructor - * @param {ibc.core.client.v1.IConsensusStateWithHeight=} [properties] Properties to set - */ - function ConsensusStateWithHeight(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ConsensusStateWithHeight height. - * @member {ibc.core.client.v1.IHeight|null|undefined} height - * @memberof ibc.core.client.v1.ConsensusStateWithHeight - * @instance - */ - ConsensusStateWithHeight.prototype.height = null; - - /** - * ConsensusStateWithHeight consensus_state. - * @member {google.protobuf.IAny|null|undefined} consensus_state - * @memberof ibc.core.client.v1.ConsensusStateWithHeight - * @instance - */ - ConsensusStateWithHeight.prototype.consensus_state = null; - - /** - * Encodes the specified ConsensusStateWithHeight message. Does not implicitly {@link ibc.core.client.v1.ConsensusStateWithHeight.verify|verify} messages. - * @function encode - * @memberof ibc.core.client.v1.ConsensusStateWithHeight - * @static - * @param {ibc.core.client.v1.IConsensusStateWithHeight} message ConsensusStateWithHeight message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConsensusStateWithHeight.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - $root.ibc.core.client.v1.Height.encode(message.height, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.consensus_state != null && Object.hasOwnProperty.call(message, "consensus_state")) - $root.google.protobuf.Any.encode(message.consensus_state, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ConsensusStateWithHeight message, length delimited. Does not implicitly {@link ibc.core.client.v1.ConsensusStateWithHeight.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.client.v1.ConsensusStateWithHeight - * @static - * @param {ibc.core.client.v1.IConsensusStateWithHeight} message ConsensusStateWithHeight message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConsensusStateWithHeight.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ConsensusStateWithHeight message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.client.v1.ConsensusStateWithHeight - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.client.v1.ConsensusStateWithHeight} ConsensusStateWithHeight - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConsensusStateWithHeight.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.ConsensusStateWithHeight(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - case 2: - message.consensus_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ConsensusStateWithHeight message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.client.v1.ConsensusStateWithHeight - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.client.v1.ConsensusStateWithHeight} ConsensusStateWithHeight - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConsensusStateWithHeight.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ConsensusStateWithHeight message. - * @function verify - * @memberof ibc.core.client.v1.ConsensusStateWithHeight - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ConsensusStateWithHeight.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.height != null && message.hasOwnProperty("height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.height); - if (error) - return "height." + error; - } - if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) { - let error = $root.google.protobuf.Any.verify(message.consensus_state); - if (error) - return "consensus_state." + error; - } - return null; - }; - - /** - * Creates a ConsensusStateWithHeight message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.client.v1.ConsensusStateWithHeight - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.client.v1.ConsensusStateWithHeight} ConsensusStateWithHeight - */ - ConsensusStateWithHeight.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.client.v1.ConsensusStateWithHeight) - return object; - let message = new $root.ibc.core.client.v1.ConsensusStateWithHeight(); - if (object.height != null) { - if (typeof object.height !== "object") - throw TypeError(".ibc.core.client.v1.ConsensusStateWithHeight.height: object expected"); - message.height = $root.ibc.core.client.v1.Height.fromObject(object.height); - } - if (object.consensus_state != null) { - if (typeof object.consensus_state !== "object") - throw TypeError(".ibc.core.client.v1.ConsensusStateWithHeight.consensus_state: object expected"); - message.consensus_state = $root.google.protobuf.Any.fromObject(object.consensus_state); - } - return message; - }; - - /** - * Creates a plain object from a ConsensusStateWithHeight message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.client.v1.ConsensusStateWithHeight - * @static - * @param {ibc.core.client.v1.ConsensusStateWithHeight} message ConsensusStateWithHeight - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ConsensusStateWithHeight.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.height = null; - object.consensus_state = null; - } - if (message.height != null && message.hasOwnProperty("height")) - object.height = $root.ibc.core.client.v1.Height.toObject(message.height, options); - if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) - object.consensus_state = $root.google.protobuf.Any.toObject(message.consensus_state, options); - return object; - }; - - /** - * Converts this ConsensusStateWithHeight to JSON. - * @function toJSON - * @memberof ibc.core.client.v1.ConsensusStateWithHeight - * @instance - * @returns {Object.} JSON object - */ - ConsensusStateWithHeight.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ConsensusStateWithHeight; - })(); - - v1.ClientConsensusStates = (function() { - - /** - * Properties of a ClientConsensusStates. - * @memberof ibc.core.client.v1 - * @interface IClientConsensusStates - * @property {string|null} [client_id] ClientConsensusStates client_id - * @property {Array.|null} [consensus_states] ClientConsensusStates consensus_states - */ - - /** - * Constructs a new ClientConsensusStates. - * @memberof ibc.core.client.v1 - * @classdesc Represents a ClientConsensusStates. - * @implements IClientConsensusStates - * @constructor - * @param {ibc.core.client.v1.IClientConsensusStates=} [properties] Properties to set - */ - function ClientConsensusStates(properties) { - this.consensus_states = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ClientConsensusStates client_id. - * @member {string} client_id - * @memberof ibc.core.client.v1.ClientConsensusStates - * @instance - */ - ClientConsensusStates.prototype.client_id = ""; - - /** - * ClientConsensusStates consensus_states. - * @member {Array.} consensus_states - * @memberof ibc.core.client.v1.ClientConsensusStates - * @instance - */ - ClientConsensusStates.prototype.consensus_states = $util.emptyArray; - - /** - * Encodes the specified ClientConsensusStates message. Does not implicitly {@link ibc.core.client.v1.ClientConsensusStates.verify|verify} messages. - * @function encode - * @memberof ibc.core.client.v1.ClientConsensusStates - * @static - * @param {ibc.core.client.v1.IClientConsensusStates} message ClientConsensusStates message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ClientConsensusStates.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); - if (message.consensus_states != null && message.consensus_states.length) - for (let i = 0; i < message.consensus_states.length; ++i) - $root.ibc.core.client.v1.ConsensusStateWithHeight.encode(message.consensus_states[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ClientConsensusStates message, length delimited. Does not implicitly {@link ibc.core.client.v1.ClientConsensusStates.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.client.v1.ClientConsensusStates - * @static - * @param {ibc.core.client.v1.IClientConsensusStates} message ClientConsensusStates message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ClientConsensusStates.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ClientConsensusStates message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.client.v1.ClientConsensusStates - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.client.v1.ClientConsensusStates} ClientConsensusStates - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ClientConsensusStates.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.ClientConsensusStates(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.client_id = reader.string(); - break; - case 2: - if (!(message.consensus_states && message.consensus_states.length)) - message.consensus_states = []; - message.consensus_states.push($root.ibc.core.client.v1.ConsensusStateWithHeight.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ClientConsensusStates message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.client.v1.ClientConsensusStates - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.client.v1.ClientConsensusStates} ClientConsensusStates - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ClientConsensusStates.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ClientConsensusStates message. - * @function verify - * @memberof ibc.core.client.v1.ClientConsensusStates - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ClientConsensusStates.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.client_id != null && message.hasOwnProperty("client_id")) - if (!$util.isString(message.client_id)) - return "client_id: string expected"; - if (message.consensus_states != null && message.hasOwnProperty("consensus_states")) { - if (!Array.isArray(message.consensus_states)) - return "consensus_states: array expected"; - for (let i = 0; i < message.consensus_states.length; ++i) { - let error = $root.ibc.core.client.v1.ConsensusStateWithHeight.verify(message.consensus_states[i]); - if (error) - return "consensus_states." + error; - } - } - return null; - }; - - /** - * Creates a ClientConsensusStates message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.client.v1.ClientConsensusStates - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.client.v1.ClientConsensusStates} ClientConsensusStates - */ - ClientConsensusStates.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.client.v1.ClientConsensusStates) - return object; - let message = new $root.ibc.core.client.v1.ClientConsensusStates(); - if (object.client_id != null) - message.client_id = String(object.client_id); - if (object.consensus_states) { - if (!Array.isArray(object.consensus_states)) - throw TypeError(".ibc.core.client.v1.ClientConsensusStates.consensus_states: array expected"); - message.consensus_states = []; - for (let i = 0; i < object.consensus_states.length; ++i) { - if (typeof object.consensus_states[i] !== "object") - throw TypeError(".ibc.core.client.v1.ClientConsensusStates.consensus_states: object expected"); - message.consensus_states[i] = $root.ibc.core.client.v1.ConsensusStateWithHeight.fromObject(object.consensus_states[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a ClientConsensusStates message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.client.v1.ClientConsensusStates - * @static - * @param {ibc.core.client.v1.ClientConsensusStates} message ClientConsensusStates - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ClientConsensusStates.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.consensus_states = []; - if (options.defaults) - object.client_id = ""; - if (message.client_id != null && message.hasOwnProperty("client_id")) - object.client_id = message.client_id; - if (message.consensus_states && message.consensus_states.length) { - object.consensus_states = []; - for (let j = 0; j < message.consensus_states.length; ++j) - object.consensus_states[j] = $root.ibc.core.client.v1.ConsensusStateWithHeight.toObject(message.consensus_states[j], options); - } - return object; - }; - - /** - * Converts this ClientConsensusStates to JSON. - * @function toJSON - * @memberof ibc.core.client.v1.ClientConsensusStates - * @instance - * @returns {Object.} JSON object - */ - ClientConsensusStates.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ClientConsensusStates; - })(); - - v1.ClientUpdateProposal = (function() { - - /** - * Properties of a ClientUpdateProposal. - * @memberof ibc.core.client.v1 - * @interface IClientUpdateProposal - * @property {string|null} [title] ClientUpdateProposal title - * @property {string|null} [description] ClientUpdateProposal description - * @property {string|null} [client_id] ClientUpdateProposal client_id - * @property {google.protobuf.IAny|null} [header] ClientUpdateProposal header - */ - - /** - * Constructs a new ClientUpdateProposal. - * @memberof ibc.core.client.v1 - * @classdesc Represents a ClientUpdateProposal. - * @implements IClientUpdateProposal - * @constructor - * @param {ibc.core.client.v1.IClientUpdateProposal=} [properties] Properties to set - */ - function ClientUpdateProposal(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ClientUpdateProposal title. - * @member {string} title - * @memberof ibc.core.client.v1.ClientUpdateProposal - * @instance - */ - ClientUpdateProposal.prototype.title = ""; - - /** - * ClientUpdateProposal description. - * @member {string} description - * @memberof ibc.core.client.v1.ClientUpdateProposal - * @instance - */ - ClientUpdateProposal.prototype.description = ""; - - /** - * ClientUpdateProposal client_id. - * @member {string} client_id - * @memberof ibc.core.client.v1.ClientUpdateProposal - * @instance - */ - ClientUpdateProposal.prototype.client_id = ""; - - /** - * ClientUpdateProposal header. - * @member {google.protobuf.IAny|null|undefined} header - * @memberof ibc.core.client.v1.ClientUpdateProposal - * @instance - */ - ClientUpdateProposal.prototype.header = null; - - /** - * Encodes the specified ClientUpdateProposal message. Does not implicitly {@link ibc.core.client.v1.ClientUpdateProposal.verify|verify} messages. - * @function encode - * @memberof ibc.core.client.v1.ClientUpdateProposal - * @static - * @param {ibc.core.client.v1.IClientUpdateProposal} message ClientUpdateProposal message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ClientUpdateProposal.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.title != null && Object.hasOwnProperty.call(message, "title")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); - if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.client_id); - if (message.header != null && Object.hasOwnProperty.call(message, "header")) - $root.google.protobuf.Any.encode(message.header, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ClientUpdateProposal message, length delimited. Does not implicitly {@link ibc.core.client.v1.ClientUpdateProposal.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.client.v1.ClientUpdateProposal - * @static - * @param {ibc.core.client.v1.IClientUpdateProposal} message ClientUpdateProposal message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ClientUpdateProposal.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ClientUpdateProposal message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.client.v1.ClientUpdateProposal - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.client.v1.ClientUpdateProposal} ClientUpdateProposal - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ClientUpdateProposal.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.ClientUpdateProposal(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.title = reader.string(); - break; - case 2: - message.description = reader.string(); - break; - case 3: - message.client_id = reader.string(); - break; - case 4: - message.header = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ClientUpdateProposal message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.client.v1.ClientUpdateProposal - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.client.v1.ClientUpdateProposal} ClientUpdateProposal - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ClientUpdateProposal.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ClientUpdateProposal message. - * @function verify - * @memberof ibc.core.client.v1.ClientUpdateProposal - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ClientUpdateProposal.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.title != null && message.hasOwnProperty("title")) - if (!$util.isString(message.title)) - return "title: string expected"; - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - if (message.client_id != null && message.hasOwnProperty("client_id")) - if (!$util.isString(message.client_id)) - return "client_id: string expected"; - if (message.header != null && message.hasOwnProperty("header")) { - let error = $root.google.protobuf.Any.verify(message.header); - if (error) - return "header." + error; - } - return null; - }; - - /** - * Creates a ClientUpdateProposal message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.client.v1.ClientUpdateProposal - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.client.v1.ClientUpdateProposal} ClientUpdateProposal - */ - ClientUpdateProposal.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.client.v1.ClientUpdateProposal) - return object; - let message = new $root.ibc.core.client.v1.ClientUpdateProposal(); - if (object.title != null) - message.title = String(object.title); - if (object.description != null) - message.description = String(object.description); - if (object.client_id != null) - message.client_id = String(object.client_id); - if (object.header != null) { - if (typeof object.header !== "object") - throw TypeError(".ibc.core.client.v1.ClientUpdateProposal.header: object expected"); - message.header = $root.google.protobuf.Any.fromObject(object.header); - } - return message; - }; - - /** - * Creates a plain object from a ClientUpdateProposal message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.client.v1.ClientUpdateProposal - * @static - * @param {ibc.core.client.v1.ClientUpdateProposal} message ClientUpdateProposal - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ClientUpdateProposal.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.title = ""; - object.description = ""; - object.client_id = ""; - object.header = null; - } - if (message.title != null && message.hasOwnProperty("title")) - object.title = message.title; - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - if (message.client_id != null && message.hasOwnProperty("client_id")) - object.client_id = message.client_id; - if (message.header != null && message.hasOwnProperty("header")) - object.header = $root.google.protobuf.Any.toObject(message.header, options); - return object; - }; - - /** - * Converts this ClientUpdateProposal to JSON. - * @function toJSON - * @memberof ibc.core.client.v1.ClientUpdateProposal - * @instance - * @returns {Object.} JSON object - */ - ClientUpdateProposal.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ClientUpdateProposal; - })(); - - v1.Height = (function() { - - /** - * Properties of an Height. - * @memberof ibc.core.client.v1 - * @interface IHeight - * @property {Long|null} [revision_number] Height revision_number - * @property {Long|null} [revision_height] Height revision_height - */ - - /** - * Constructs a new Height. - * @memberof ibc.core.client.v1 - * @classdesc Represents an Height. - * @implements IHeight - * @constructor - * @param {ibc.core.client.v1.IHeight=} [properties] Properties to set - */ - function Height(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Height revision_number. - * @member {Long} revision_number - * @memberof ibc.core.client.v1.Height - * @instance - */ - Height.prototype.revision_number = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Height revision_height. - * @member {Long} revision_height - * @memberof ibc.core.client.v1.Height - * @instance - */ - Height.prototype.revision_height = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified Height message. Does not implicitly {@link ibc.core.client.v1.Height.verify|verify} messages. - * @function encode - * @memberof ibc.core.client.v1.Height - * @static - * @param {ibc.core.client.v1.IHeight} message Height message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Height.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.revision_number != null && Object.hasOwnProperty.call(message, "revision_number")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.revision_number); - if (message.revision_height != null && Object.hasOwnProperty.call(message, "revision_height")) - writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.revision_height); - return writer; - }; - - /** - * Encodes the specified Height message, length delimited. Does not implicitly {@link ibc.core.client.v1.Height.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.client.v1.Height - * @static - * @param {ibc.core.client.v1.IHeight} message Height message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Height.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Height message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.client.v1.Height - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.client.v1.Height} Height - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Height.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.Height(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.revision_number = reader.uint64(); - break; - case 2: - message.revision_height = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Height message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.client.v1.Height - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.client.v1.Height} Height - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Height.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Height message. - * @function verify - * @memberof ibc.core.client.v1.Height - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Height.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.revision_number != null && message.hasOwnProperty("revision_number")) - if (!$util.isInteger(message.revision_number) && !(message.revision_number && $util.isInteger(message.revision_number.low) && $util.isInteger(message.revision_number.high))) - return "revision_number: integer|Long expected"; - if (message.revision_height != null && message.hasOwnProperty("revision_height")) - if (!$util.isInteger(message.revision_height) && !(message.revision_height && $util.isInteger(message.revision_height.low) && $util.isInteger(message.revision_height.high))) - return "revision_height: integer|Long expected"; - return null; - }; - - /** - * Creates an Height message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.client.v1.Height - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.client.v1.Height} Height - */ - Height.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.client.v1.Height) - return object; - let message = new $root.ibc.core.client.v1.Height(); - if (object.revision_number != null) - if ($util.Long) - (message.revision_number = $util.Long.fromValue(object.revision_number)).unsigned = true; - else if (typeof object.revision_number === "string") - message.revision_number = parseInt(object.revision_number, 10); - else if (typeof object.revision_number === "number") - message.revision_number = object.revision_number; - else if (typeof object.revision_number === "object") - message.revision_number = new $util.LongBits(object.revision_number.low >>> 0, object.revision_number.high >>> 0).toNumber(true); - if (object.revision_height != null) - if ($util.Long) - (message.revision_height = $util.Long.fromValue(object.revision_height)).unsigned = true; - else if (typeof object.revision_height === "string") - message.revision_height = parseInt(object.revision_height, 10); - else if (typeof object.revision_height === "number") - message.revision_height = object.revision_height; - else if (typeof object.revision_height === "object") - message.revision_height = new $util.LongBits(object.revision_height.low >>> 0, object.revision_height.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from an Height message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.client.v1.Height - * @static - * @param {ibc.core.client.v1.Height} message Height - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Height.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.revision_number = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.revision_number = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.revision_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.revision_height = options.longs === String ? "0" : 0; - } - if (message.revision_number != null && message.hasOwnProperty("revision_number")) - if (typeof message.revision_number === "number") - object.revision_number = options.longs === String ? String(message.revision_number) : message.revision_number; - else - object.revision_number = options.longs === String ? $util.Long.prototype.toString.call(message.revision_number) : options.longs === Number ? new $util.LongBits(message.revision_number.low >>> 0, message.revision_number.high >>> 0).toNumber(true) : message.revision_number; - if (message.revision_height != null && message.hasOwnProperty("revision_height")) - if (typeof message.revision_height === "number") - object.revision_height = options.longs === String ? String(message.revision_height) : message.revision_height; - else - object.revision_height = options.longs === String ? $util.Long.prototype.toString.call(message.revision_height) : options.longs === Number ? new $util.LongBits(message.revision_height.low >>> 0, message.revision_height.high >>> 0).toNumber(true) : message.revision_height; - return object; - }; - - /** - * Converts this Height to JSON. - * @function toJSON - * @memberof ibc.core.client.v1.Height - * @instance - * @returns {Object.} JSON object - */ - Height.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Height; - })(); - - v1.Params = (function() { - - /** - * Properties of a Params. - * @memberof ibc.core.client.v1 - * @interface IParams - * @property {Array.|null} [allowed_clients] Params allowed_clients - */ - - /** - * Constructs a new Params. - * @memberof ibc.core.client.v1 - * @classdesc Represents a Params. - * @implements IParams - * @constructor - * @param {ibc.core.client.v1.IParams=} [properties] Properties to set - */ - function Params(properties) { - this.allowed_clients = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Params allowed_clients. - * @member {Array.} allowed_clients - * @memberof ibc.core.client.v1.Params - * @instance - */ - Params.prototype.allowed_clients = $util.emptyArray; - - /** - * Encodes the specified Params message. Does not implicitly {@link ibc.core.client.v1.Params.verify|verify} messages. - * @function encode - * @memberof ibc.core.client.v1.Params - * @static - * @param {ibc.core.client.v1.IParams} message Params message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Params.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.allowed_clients != null && message.allowed_clients.length) - for (let i = 0; i < message.allowed_clients.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.allowed_clients[i]); - return writer; - }; - - /** - * Encodes the specified Params message, length delimited. Does not implicitly {@link ibc.core.client.v1.Params.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.client.v1.Params - * @static - * @param {ibc.core.client.v1.IParams} message Params message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Params.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Params message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.client.v1.Params - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.client.v1.Params} Params - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Params.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.Params(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.allowed_clients && message.allowed_clients.length)) - message.allowed_clients = []; - message.allowed_clients.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Params message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.client.v1.Params - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.client.v1.Params} Params - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Params.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Params message. - * @function verify - * @memberof ibc.core.client.v1.Params - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Params.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.allowed_clients != null && message.hasOwnProperty("allowed_clients")) { - if (!Array.isArray(message.allowed_clients)) - return "allowed_clients: array expected"; - for (let i = 0; i < message.allowed_clients.length; ++i) - if (!$util.isString(message.allowed_clients[i])) - return "allowed_clients: string[] expected"; - } - return null; - }; - - /** - * Creates a Params message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.client.v1.Params - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.client.v1.Params} Params - */ - Params.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.client.v1.Params) - return object; - let message = new $root.ibc.core.client.v1.Params(); - if (object.allowed_clients) { - if (!Array.isArray(object.allowed_clients)) - throw TypeError(".ibc.core.client.v1.Params.allowed_clients: array expected"); - message.allowed_clients = []; - for (let i = 0; i < object.allowed_clients.length; ++i) - message.allowed_clients[i] = String(object.allowed_clients[i]); - } - return message; - }; - - /** - * Creates a plain object from a Params message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.client.v1.Params - * @static - * @param {ibc.core.client.v1.Params} message Params - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Params.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.allowed_clients = []; - if (message.allowed_clients && message.allowed_clients.length) { - object.allowed_clients = []; - for (let j = 0; j < message.allowed_clients.length; ++j) - object.allowed_clients[j] = message.allowed_clients[j]; - } - return object; - }; - - /** - * Converts this Params to JSON. - * @function toJSON - * @memberof ibc.core.client.v1.Params - * @instance - * @returns {Object.} JSON object - */ - Params.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Params; - })(); - - v1.Query = (function() { - - /** - * Constructs a new Query service. - * @memberof ibc.core.client.v1 - * @classdesc Represents a Query - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function Query(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Query.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Query; - - /** - * Callback as used by {@link ibc.core.client.v1.Query#clientState}. - * @memberof ibc.core.client.v1.Query - * @typedef ClientStateCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.client.v1.QueryClientStateResponse} [response] QueryClientStateResponse - */ - - /** - * Calls ClientState. - * @function clientState - * @memberof ibc.core.client.v1.Query - * @instance - * @param {ibc.core.client.v1.IQueryClientStateRequest} request QueryClientStateRequest message or plain object - * @param {ibc.core.client.v1.Query.ClientStateCallback} callback Node-style callback called with the error, if any, and QueryClientStateResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.clientState = function clientState(request, callback) { - return this.rpcCall(clientState, $root.ibc.core.client.v1.QueryClientStateRequest, $root.ibc.core.client.v1.QueryClientStateResponse, request, callback); - }, "name", { value: "ClientState" }); - - /** - * Calls ClientState. - * @function clientState - * @memberof ibc.core.client.v1.Query - * @instance - * @param {ibc.core.client.v1.IQueryClientStateRequest} request QueryClientStateRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.client.v1.Query#clientStates}. - * @memberof ibc.core.client.v1.Query - * @typedef ClientStatesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.client.v1.QueryClientStatesResponse} [response] QueryClientStatesResponse - */ - - /** - * Calls ClientStates. - * @function clientStates - * @memberof ibc.core.client.v1.Query - * @instance - * @param {ibc.core.client.v1.IQueryClientStatesRequest} request QueryClientStatesRequest message or plain object - * @param {ibc.core.client.v1.Query.ClientStatesCallback} callback Node-style callback called with the error, if any, and QueryClientStatesResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.clientStates = function clientStates(request, callback) { - return this.rpcCall(clientStates, $root.ibc.core.client.v1.QueryClientStatesRequest, $root.ibc.core.client.v1.QueryClientStatesResponse, request, callback); - }, "name", { value: "ClientStates" }); - - /** - * Calls ClientStates. - * @function clientStates - * @memberof ibc.core.client.v1.Query - * @instance - * @param {ibc.core.client.v1.IQueryClientStatesRequest} request QueryClientStatesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.client.v1.Query#consensusState}. - * @memberof ibc.core.client.v1.Query - * @typedef ConsensusStateCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.client.v1.QueryConsensusStateResponse} [response] QueryConsensusStateResponse - */ - - /** - * Calls ConsensusState. - * @function consensusState - * @memberof ibc.core.client.v1.Query - * @instance - * @param {ibc.core.client.v1.IQueryConsensusStateRequest} request QueryConsensusStateRequest message or plain object - * @param {ibc.core.client.v1.Query.ConsensusStateCallback} callback Node-style callback called with the error, if any, and QueryConsensusStateResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.consensusState = function consensusState(request, callback) { - return this.rpcCall(consensusState, $root.ibc.core.client.v1.QueryConsensusStateRequest, $root.ibc.core.client.v1.QueryConsensusStateResponse, request, callback); - }, "name", { value: "ConsensusState" }); - - /** - * Calls ConsensusState. - * @function consensusState - * @memberof ibc.core.client.v1.Query - * @instance - * @param {ibc.core.client.v1.IQueryConsensusStateRequest} request QueryConsensusStateRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.client.v1.Query#consensusStates}. - * @memberof ibc.core.client.v1.Query - * @typedef ConsensusStatesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.client.v1.QueryConsensusStatesResponse} [response] QueryConsensusStatesResponse - */ - - /** - * Calls ConsensusStates. - * @function consensusStates - * @memberof ibc.core.client.v1.Query - * @instance - * @param {ibc.core.client.v1.IQueryConsensusStatesRequest} request QueryConsensusStatesRequest message or plain object - * @param {ibc.core.client.v1.Query.ConsensusStatesCallback} callback Node-style callback called with the error, if any, and QueryConsensusStatesResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.consensusStates = function consensusStates(request, callback) { - return this.rpcCall(consensusStates, $root.ibc.core.client.v1.QueryConsensusStatesRequest, $root.ibc.core.client.v1.QueryConsensusStatesResponse, request, callback); - }, "name", { value: "ConsensusStates" }); - - /** - * Calls ConsensusStates. - * @function consensusStates - * @memberof ibc.core.client.v1.Query - * @instance - * @param {ibc.core.client.v1.IQueryConsensusStatesRequest} request QueryConsensusStatesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.client.v1.Query#clientParams}. - * @memberof ibc.core.client.v1.Query - * @typedef ClientParamsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.client.v1.QueryClientParamsResponse} [response] QueryClientParamsResponse - */ - - /** - * Calls ClientParams. - * @function clientParams - * @memberof ibc.core.client.v1.Query - * @instance - * @param {ibc.core.client.v1.IQueryClientParamsRequest} request QueryClientParamsRequest message or plain object - * @param {ibc.core.client.v1.Query.ClientParamsCallback} callback Node-style callback called with the error, if any, and QueryClientParamsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.clientParams = function clientParams(request, callback) { - return this.rpcCall(clientParams, $root.ibc.core.client.v1.QueryClientParamsRequest, $root.ibc.core.client.v1.QueryClientParamsResponse, request, callback); - }, "name", { value: "ClientParams" }); - - /** - * Calls ClientParams. - * @function clientParams - * @memberof ibc.core.client.v1.Query - * @instance - * @param {ibc.core.client.v1.IQueryClientParamsRequest} request QueryClientParamsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return Query; - })(); - - v1.QueryClientStateRequest = (function() { - - /** - * Properties of a QueryClientStateRequest. - * @memberof ibc.core.client.v1 - * @interface IQueryClientStateRequest - * @property {string|null} [client_id] QueryClientStateRequest client_id - */ - - /** - * Constructs a new QueryClientStateRequest. - * @memberof ibc.core.client.v1 - * @classdesc Represents a QueryClientStateRequest. - * @implements IQueryClientStateRequest - * @constructor - * @param {ibc.core.client.v1.IQueryClientStateRequest=} [properties] Properties to set - */ - function QueryClientStateRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryClientStateRequest client_id. - * @member {string} client_id - * @memberof ibc.core.client.v1.QueryClientStateRequest - * @instance - */ - QueryClientStateRequest.prototype.client_id = ""; - - /** - * Encodes the specified QueryClientStateRequest message. Does not implicitly {@link ibc.core.client.v1.QueryClientStateRequest.verify|verify} messages. - * @function encode - * @memberof ibc.core.client.v1.QueryClientStateRequest - * @static - * @param {ibc.core.client.v1.IQueryClientStateRequest} message QueryClientStateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryClientStateRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); - return writer; - }; - - /** - * Encodes the specified QueryClientStateRequest message, length delimited. Does not implicitly {@link ibc.core.client.v1.QueryClientStateRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.client.v1.QueryClientStateRequest - * @static - * @param {ibc.core.client.v1.IQueryClientStateRequest} message QueryClientStateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryClientStateRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryClientStateRequest message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.client.v1.QueryClientStateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.client.v1.QueryClientStateRequest} QueryClientStateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryClientStateRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.QueryClientStateRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.client_id = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryClientStateRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.client.v1.QueryClientStateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.client.v1.QueryClientStateRequest} QueryClientStateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryClientStateRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryClientStateRequest message. - * @function verify - * @memberof ibc.core.client.v1.QueryClientStateRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryClientStateRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.client_id != null && message.hasOwnProperty("client_id")) - if (!$util.isString(message.client_id)) - return "client_id: string expected"; - return null; - }; - - /** - * Creates a QueryClientStateRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.client.v1.QueryClientStateRequest - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.client.v1.QueryClientStateRequest} QueryClientStateRequest - */ - QueryClientStateRequest.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.client.v1.QueryClientStateRequest) - return object; - let message = new $root.ibc.core.client.v1.QueryClientStateRequest(); - if (object.client_id != null) - message.client_id = String(object.client_id); - return message; - }; - - /** - * Creates a plain object from a QueryClientStateRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.client.v1.QueryClientStateRequest - * @static - * @param {ibc.core.client.v1.QueryClientStateRequest} message QueryClientStateRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryClientStateRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.client_id = ""; - if (message.client_id != null && message.hasOwnProperty("client_id")) - object.client_id = message.client_id; - return object; - }; - - /** - * Converts this QueryClientStateRequest to JSON. - * @function toJSON - * @memberof ibc.core.client.v1.QueryClientStateRequest - * @instance - * @returns {Object.} JSON object - */ - QueryClientStateRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryClientStateRequest; - })(); - - v1.QueryClientStateResponse = (function() { - - /** - * Properties of a QueryClientStateResponse. - * @memberof ibc.core.client.v1 - * @interface IQueryClientStateResponse - * @property {google.protobuf.IAny|null} [client_state] QueryClientStateResponse client_state - * @property {Uint8Array|null} [proof] QueryClientStateResponse proof - * @property {ibc.core.client.v1.IHeight|null} [proof_height] QueryClientStateResponse proof_height - */ - - /** - * Constructs a new QueryClientStateResponse. - * @memberof ibc.core.client.v1 - * @classdesc Represents a QueryClientStateResponse. - * @implements IQueryClientStateResponse - * @constructor - * @param {ibc.core.client.v1.IQueryClientStateResponse=} [properties] Properties to set - */ - function QueryClientStateResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryClientStateResponse client_state. - * @member {google.protobuf.IAny|null|undefined} client_state - * @memberof ibc.core.client.v1.QueryClientStateResponse - * @instance - */ - QueryClientStateResponse.prototype.client_state = null; - - /** - * QueryClientStateResponse proof. - * @member {Uint8Array} proof - * @memberof ibc.core.client.v1.QueryClientStateResponse - * @instance - */ - QueryClientStateResponse.prototype.proof = $util.newBuffer([]); - - /** - * QueryClientStateResponse proof_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height - * @memberof ibc.core.client.v1.QueryClientStateResponse - * @instance - */ - QueryClientStateResponse.prototype.proof_height = null; - - /** - * Encodes the specified QueryClientStateResponse message. Does not implicitly {@link ibc.core.client.v1.QueryClientStateResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.client.v1.QueryClientStateResponse - * @static - * @param {ibc.core.client.v1.IQueryClientStateResponse} message QueryClientStateResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryClientStateResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.client_state != null && Object.hasOwnProperty.call(message, "client_state")) - $root.google.protobuf.Any.encode(message.client_state, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proof); - if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) - $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryClientStateResponse message, length delimited. Does not implicitly {@link ibc.core.client.v1.QueryClientStateResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.client.v1.QueryClientStateResponse - * @static - * @param {ibc.core.client.v1.IQueryClientStateResponse} message QueryClientStateResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryClientStateResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryClientStateResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.client.v1.QueryClientStateResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.client.v1.QueryClientStateResponse} QueryClientStateResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryClientStateResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.QueryClientStateResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.client_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - case 2: - message.proof = reader.bytes(); - break; - case 3: - message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryClientStateResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.client.v1.QueryClientStateResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.client.v1.QueryClientStateResponse} QueryClientStateResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryClientStateResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryClientStateResponse message. - * @function verify - * @memberof ibc.core.client.v1.QueryClientStateResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryClientStateResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.client_state != null && message.hasOwnProperty("client_state")) { - let error = $root.google.protobuf.Any.verify(message.client_state); - if (error) - return "client_state." + error; - } - if (message.proof != null && message.hasOwnProperty("proof")) - if (!(message.proof && typeof message.proof.length === "number" || $util.isString(message.proof))) - return "proof: buffer expected"; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); - if (error) - return "proof_height." + error; - } - return null; - }; - - /** - * Creates a QueryClientStateResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.client.v1.QueryClientStateResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.client.v1.QueryClientStateResponse} QueryClientStateResponse - */ - QueryClientStateResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.client.v1.QueryClientStateResponse) - return object; - let message = new $root.ibc.core.client.v1.QueryClientStateResponse(); - if (object.client_state != null) { - if (typeof object.client_state !== "object") - throw TypeError(".ibc.core.client.v1.QueryClientStateResponse.client_state: object expected"); - message.client_state = $root.google.protobuf.Any.fromObject(object.client_state); - } - if (object.proof != null) - if (typeof object.proof === "string") - $util.base64.decode(object.proof, message.proof = $util.newBuffer($util.base64.length(object.proof)), 0); - else if (object.proof.length) - message.proof = object.proof; - if (object.proof_height != null) { - if (typeof object.proof_height !== "object") - throw TypeError(".ibc.core.client.v1.QueryClientStateResponse.proof_height: object expected"); - message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); - } - return message; - }; - - /** - * Creates a plain object from a QueryClientStateResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.client.v1.QueryClientStateResponse - * @static - * @param {ibc.core.client.v1.QueryClientStateResponse} message QueryClientStateResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryClientStateResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.client_state = null; - if (options.bytes === String) - object.proof = ""; - else { - object.proof = []; - if (options.bytes !== Array) - object.proof = $util.newBuffer(object.proof); - } - object.proof_height = null; - } - if (message.client_state != null && message.hasOwnProperty("client_state")) - object.client_state = $root.google.protobuf.Any.toObject(message.client_state, options); - if (message.proof != null && message.hasOwnProperty("proof")) - object.proof = options.bytes === String ? $util.base64.encode(message.proof, 0, message.proof.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof) : message.proof; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) - object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); - return object; - }; - - /** - * Converts this QueryClientStateResponse to JSON. - * @function toJSON - * @memberof ibc.core.client.v1.QueryClientStateResponse - * @instance - * @returns {Object.} JSON object - */ - QueryClientStateResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryClientStateResponse; - })(); - - v1.QueryClientStatesRequest = (function() { - - /** - * Properties of a QueryClientStatesRequest. - * @memberof ibc.core.client.v1 - * @interface IQueryClientStatesRequest - * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryClientStatesRequest pagination - */ - - /** - * Constructs a new QueryClientStatesRequest. - * @memberof ibc.core.client.v1 - * @classdesc Represents a QueryClientStatesRequest. - * @implements IQueryClientStatesRequest - * @constructor - * @param {ibc.core.client.v1.IQueryClientStatesRequest=} [properties] Properties to set - */ - function QueryClientStatesRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryClientStatesRequest pagination. - * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination - * @memberof ibc.core.client.v1.QueryClientStatesRequest - * @instance - */ - QueryClientStatesRequest.prototype.pagination = null; - - /** - * Encodes the specified QueryClientStatesRequest message. Does not implicitly {@link ibc.core.client.v1.QueryClientStatesRequest.verify|verify} messages. - * @function encode - * @memberof ibc.core.client.v1.QueryClientStatesRequest - * @static - * @param {ibc.core.client.v1.IQueryClientStatesRequest} message QueryClientStatesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryClientStatesRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryClientStatesRequest message, length delimited. Does not implicitly {@link ibc.core.client.v1.QueryClientStatesRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.client.v1.QueryClientStatesRequest - * @static - * @param {ibc.core.client.v1.IQueryClientStatesRequest} message QueryClientStatesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryClientStatesRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryClientStatesRequest message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.client.v1.QueryClientStatesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.client.v1.QueryClientStatesRequest} QueryClientStatesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryClientStatesRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.QueryClientStatesRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryClientStatesRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.client.v1.QueryClientStatesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.client.v1.QueryClientStatesRequest} QueryClientStatesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryClientStatesRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryClientStatesRequest message. - * @function verify - * @memberof ibc.core.client.v1.QueryClientStatesRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryClientStatesRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryClientStatesRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.client.v1.QueryClientStatesRequest - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.client.v1.QueryClientStatesRequest} QueryClientStatesRequest - */ - QueryClientStatesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.client.v1.QueryClientStatesRequest) - return object; - let message = new $root.ibc.core.client.v1.QueryClientStatesRequest(); - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".ibc.core.client.v1.QueryClientStatesRequest.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryClientStatesRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.client.v1.QueryClientStatesRequest - * @static - * @param {ibc.core.client.v1.QueryClientStatesRequest} message QueryClientStatesRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryClientStatesRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.pagination = null; - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryClientStatesRequest to JSON. - * @function toJSON - * @memberof ibc.core.client.v1.QueryClientStatesRequest - * @instance - * @returns {Object.} JSON object - */ - QueryClientStatesRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryClientStatesRequest; - })(); - - v1.QueryClientStatesResponse = (function() { - - /** - * Properties of a QueryClientStatesResponse. - * @memberof ibc.core.client.v1 - * @interface IQueryClientStatesResponse - * @property {Array.|null} [client_states] QueryClientStatesResponse client_states - * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryClientStatesResponse pagination - */ - - /** - * Constructs a new QueryClientStatesResponse. - * @memberof ibc.core.client.v1 - * @classdesc Represents a QueryClientStatesResponse. - * @implements IQueryClientStatesResponse - * @constructor - * @param {ibc.core.client.v1.IQueryClientStatesResponse=} [properties] Properties to set - */ - function QueryClientStatesResponse(properties) { - this.client_states = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryClientStatesResponse client_states. - * @member {Array.} client_states - * @memberof ibc.core.client.v1.QueryClientStatesResponse - * @instance - */ - QueryClientStatesResponse.prototype.client_states = $util.emptyArray; - - /** - * QueryClientStatesResponse pagination. - * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination - * @memberof ibc.core.client.v1.QueryClientStatesResponse - * @instance - */ - QueryClientStatesResponse.prototype.pagination = null; - - /** - * Encodes the specified QueryClientStatesResponse message. Does not implicitly {@link ibc.core.client.v1.QueryClientStatesResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.client.v1.QueryClientStatesResponse - * @static - * @param {ibc.core.client.v1.IQueryClientStatesResponse} message QueryClientStatesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryClientStatesResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.client_states != null && message.client_states.length) - for (let i = 0; i < message.client_states.length; ++i) - $root.ibc.core.client.v1.IdentifiedClientState.encode(message.client_states[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryClientStatesResponse message, length delimited. Does not implicitly {@link ibc.core.client.v1.QueryClientStatesResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.client.v1.QueryClientStatesResponse - * @static - * @param {ibc.core.client.v1.IQueryClientStatesResponse} message QueryClientStatesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryClientStatesResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryClientStatesResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.client.v1.QueryClientStatesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.client.v1.QueryClientStatesResponse} QueryClientStatesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryClientStatesResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.QueryClientStatesResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.client_states && message.client_states.length)) - message.client_states = []; - message.client_states.push($root.ibc.core.client.v1.IdentifiedClientState.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryClientStatesResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.client.v1.QueryClientStatesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.client.v1.QueryClientStatesResponse} QueryClientStatesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryClientStatesResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryClientStatesResponse message. - * @function verify - * @memberof ibc.core.client.v1.QueryClientStatesResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryClientStatesResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.client_states != null && message.hasOwnProperty("client_states")) { - if (!Array.isArray(message.client_states)) - return "client_states: array expected"; - for (let i = 0; i < message.client_states.length; ++i) { - let error = $root.ibc.core.client.v1.IdentifiedClientState.verify(message.client_states[i]); - if (error) - return "client_states." + error; - } - } - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryClientStatesResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.client.v1.QueryClientStatesResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.client.v1.QueryClientStatesResponse} QueryClientStatesResponse - */ - QueryClientStatesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.client.v1.QueryClientStatesResponse) - return object; - let message = new $root.ibc.core.client.v1.QueryClientStatesResponse(); - if (object.client_states) { - if (!Array.isArray(object.client_states)) - throw TypeError(".ibc.core.client.v1.QueryClientStatesResponse.client_states: array expected"); - message.client_states = []; - for (let i = 0; i < object.client_states.length; ++i) { - if (typeof object.client_states[i] !== "object") - throw TypeError(".ibc.core.client.v1.QueryClientStatesResponse.client_states: object expected"); - message.client_states[i] = $root.ibc.core.client.v1.IdentifiedClientState.fromObject(object.client_states[i]); - } - } - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".ibc.core.client.v1.QueryClientStatesResponse.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryClientStatesResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.client.v1.QueryClientStatesResponse - * @static - * @param {ibc.core.client.v1.QueryClientStatesResponse} message QueryClientStatesResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryClientStatesResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.client_states = []; - if (options.defaults) - object.pagination = null; - if (message.client_states && message.client_states.length) { - object.client_states = []; - for (let j = 0; j < message.client_states.length; ++j) - object.client_states[j] = $root.ibc.core.client.v1.IdentifiedClientState.toObject(message.client_states[j], options); - } - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryClientStatesResponse to JSON. - * @function toJSON - * @memberof ibc.core.client.v1.QueryClientStatesResponse - * @instance - * @returns {Object.} JSON object - */ - QueryClientStatesResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryClientStatesResponse; - })(); - - v1.QueryConsensusStateRequest = (function() { - - /** - * Properties of a QueryConsensusStateRequest. - * @memberof ibc.core.client.v1 - * @interface IQueryConsensusStateRequest - * @property {string|null} [client_id] QueryConsensusStateRequest client_id - * @property {Long|null} [revision_number] QueryConsensusStateRequest revision_number - * @property {Long|null} [revision_height] QueryConsensusStateRequest revision_height - * @property {boolean|null} [latest_height] QueryConsensusStateRequest latest_height - */ - - /** - * Constructs a new QueryConsensusStateRequest. - * @memberof ibc.core.client.v1 - * @classdesc Represents a QueryConsensusStateRequest. - * @implements IQueryConsensusStateRequest - * @constructor - * @param {ibc.core.client.v1.IQueryConsensusStateRequest=} [properties] Properties to set - */ - function QueryConsensusStateRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryConsensusStateRequest client_id. - * @member {string} client_id - * @memberof ibc.core.client.v1.QueryConsensusStateRequest - * @instance - */ - QueryConsensusStateRequest.prototype.client_id = ""; - - /** - * QueryConsensusStateRequest revision_number. - * @member {Long} revision_number - * @memberof ibc.core.client.v1.QueryConsensusStateRequest - * @instance - */ - QueryConsensusStateRequest.prototype.revision_number = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * QueryConsensusStateRequest revision_height. - * @member {Long} revision_height - * @memberof ibc.core.client.v1.QueryConsensusStateRequest - * @instance - */ - QueryConsensusStateRequest.prototype.revision_height = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * QueryConsensusStateRequest latest_height. - * @member {boolean} latest_height - * @memberof ibc.core.client.v1.QueryConsensusStateRequest - * @instance - */ - QueryConsensusStateRequest.prototype.latest_height = false; - - /** - * Encodes the specified QueryConsensusStateRequest message. Does not implicitly {@link ibc.core.client.v1.QueryConsensusStateRequest.verify|verify} messages. - * @function encode - * @memberof ibc.core.client.v1.QueryConsensusStateRequest - * @static - * @param {ibc.core.client.v1.IQueryConsensusStateRequest} message QueryConsensusStateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryConsensusStateRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); - if (message.revision_number != null && Object.hasOwnProperty.call(message, "revision_number")) - writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.revision_number); - if (message.revision_height != null && Object.hasOwnProperty.call(message, "revision_height")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.revision_height); - if (message.latest_height != null && Object.hasOwnProperty.call(message, "latest_height")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.latest_height); - return writer; - }; - - /** - * Encodes the specified QueryConsensusStateRequest message, length delimited. Does not implicitly {@link ibc.core.client.v1.QueryConsensusStateRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.client.v1.QueryConsensusStateRequest - * @static - * @param {ibc.core.client.v1.IQueryConsensusStateRequest} message QueryConsensusStateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryConsensusStateRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryConsensusStateRequest message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.client.v1.QueryConsensusStateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.client.v1.QueryConsensusStateRequest} QueryConsensusStateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryConsensusStateRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.QueryConsensusStateRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.client_id = reader.string(); - break; - case 2: - message.revision_number = reader.uint64(); - break; - case 3: - message.revision_height = reader.uint64(); - break; - case 4: - message.latest_height = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryConsensusStateRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.client.v1.QueryConsensusStateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.client.v1.QueryConsensusStateRequest} QueryConsensusStateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryConsensusStateRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryConsensusStateRequest message. - * @function verify - * @memberof ibc.core.client.v1.QueryConsensusStateRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryConsensusStateRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.client_id != null && message.hasOwnProperty("client_id")) - if (!$util.isString(message.client_id)) - return "client_id: string expected"; - if (message.revision_number != null && message.hasOwnProperty("revision_number")) - if (!$util.isInteger(message.revision_number) && !(message.revision_number && $util.isInteger(message.revision_number.low) && $util.isInteger(message.revision_number.high))) - return "revision_number: integer|Long expected"; - if (message.revision_height != null && message.hasOwnProperty("revision_height")) - if (!$util.isInteger(message.revision_height) && !(message.revision_height && $util.isInteger(message.revision_height.low) && $util.isInteger(message.revision_height.high))) - return "revision_height: integer|Long expected"; - if (message.latest_height != null && message.hasOwnProperty("latest_height")) - if (typeof message.latest_height !== "boolean") - return "latest_height: boolean expected"; - return null; - }; - - /** - * Creates a QueryConsensusStateRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.client.v1.QueryConsensusStateRequest - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.client.v1.QueryConsensusStateRequest} QueryConsensusStateRequest - */ - QueryConsensusStateRequest.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.client.v1.QueryConsensusStateRequest) - return object; - let message = new $root.ibc.core.client.v1.QueryConsensusStateRequest(); - if (object.client_id != null) - message.client_id = String(object.client_id); - if (object.revision_number != null) - if ($util.Long) - (message.revision_number = $util.Long.fromValue(object.revision_number)).unsigned = true; - else if (typeof object.revision_number === "string") - message.revision_number = parseInt(object.revision_number, 10); - else if (typeof object.revision_number === "number") - message.revision_number = object.revision_number; - else if (typeof object.revision_number === "object") - message.revision_number = new $util.LongBits(object.revision_number.low >>> 0, object.revision_number.high >>> 0).toNumber(true); - if (object.revision_height != null) - if ($util.Long) - (message.revision_height = $util.Long.fromValue(object.revision_height)).unsigned = true; - else if (typeof object.revision_height === "string") - message.revision_height = parseInt(object.revision_height, 10); - else if (typeof object.revision_height === "number") - message.revision_height = object.revision_height; - else if (typeof object.revision_height === "object") - message.revision_height = new $util.LongBits(object.revision_height.low >>> 0, object.revision_height.high >>> 0).toNumber(true); - if (object.latest_height != null) - message.latest_height = Boolean(object.latest_height); - return message; - }; - - /** - * Creates a plain object from a QueryConsensusStateRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.client.v1.QueryConsensusStateRequest - * @static - * @param {ibc.core.client.v1.QueryConsensusStateRequest} message QueryConsensusStateRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryConsensusStateRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.client_id = ""; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.revision_number = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.revision_number = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.revision_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.revision_height = options.longs === String ? "0" : 0; - object.latest_height = false; - } - if (message.client_id != null && message.hasOwnProperty("client_id")) - object.client_id = message.client_id; - if (message.revision_number != null && message.hasOwnProperty("revision_number")) - if (typeof message.revision_number === "number") - object.revision_number = options.longs === String ? String(message.revision_number) : message.revision_number; - else - object.revision_number = options.longs === String ? $util.Long.prototype.toString.call(message.revision_number) : options.longs === Number ? new $util.LongBits(message.revision_number.low >>> 0, message.revision_number.high >>> 0).toNumber(true) : message.revision_number; - if (message.revision_height != null && message.hasOwnProperty("revision_height")) - if (typeof message.revision_height === "number") - object.revision_height = options.longs === String ? String(message.revision_height) : message.revision_height; - else - object.revision_height = options.longs === String ? $util.Long.prototype.toString.call(message.revision_height) : options.longs === Number ? new $util.LongBits(message.revision_height.low >>> 0, message.revision_height.high >>> 0).toNumber(true) : message.revision_height; - if (message.latest_height != null && message.hasOwnProperty("latest_height")) - object.latest_height = message.latest_height; - return object; - }; - - /** - * Converts this QueryConsensusStateRequest to JSON. - * @function toJSON - * @memberof ibc.core.client.v1.QueryConsensusStateRequest - * @instance - * @returns {Object.} JSON object - */ - QueryConsensusStateRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryConsensusStateRequest; - })(); - - v1.QueryConsensusStateResponse = (function() { - - /** - * Properties of a QueryConsensusStateResponse. - * @memberof ibc.core.client.v1 - * @interface IQueryConsensusStateResponse - * @property {google.protobuf.IAny|null} [consensus_state] QueryConsensusStateResponse consensus_state - * @property {Uint8Array|null} [proof] QueryConsensusStateResponse proof - * @property {ibc.core.client.v1.IHeight|null} [proof_height] QueryConsensusStateResponse proof_height - */ - - /** - * Constructs a new QueryConsensusStateResponse. - * @memberof ibc.core.client.v1 - * @classdesc Represents a QueryConsensusStateResponse. - * @implements IQueryConsensusStateResponse - * @constructor - * @param {ibc.core.client.v1.IQueryConsensusStateResponse=} [properties] Properties to set - */ - function QueryConsensusStateResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryConsensusStateResponse consensus_state. - * @member {google.protobuf.IAny|null|undefined} consensus_state - * @memberof ibc.core.client.v1.QueryConsensusStateResponse - * @instance - */ - QueryConsensusStateResponse.prototype.consensus_state = null; - - /** - * QueryConsensusStateResponse proof. - * @member {Uint8Array} proof - * @memberof ibc.core.client.v1.QueryConsensusStateResponse - * @instance - */ - QueryConsensusStateResponse.prototype.proof = $util.newBuffer([]); - - /** - * QueryConsensusStateResponse proof_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height - * @memberof ibc.core.client.v1.QueryConsensusStateResponse - * @instance - */ - QueryConsensusStateResponse.prototype.proof_height = null; - - /** - * Encodes the specified QueryConsensusStateResponse message. Does not implicitly {@link ibc.core.client.v1.QueryConsensusStateResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.client.v1.QueryConsensusStateResponse - * @static - * @param {ibc.core.client.v1.IQueryConsensusStateResponse} message QueryConsensusStateResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryConsensusStateResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.consensus_state != null && Object.hasOwnProperty.call(message, "consensus_state")) - $root.google.protobuf.Any.encode(message.consensus_state, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proof); - if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) - $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryConsensusStateResponse message, length delimited. Does not implicitly {@link ibc.core.client.v1.QueryConsensusStateResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.client.v1.QueryConsensusStateResponse - * @static - * @param {ibc.core.client.v1.IQueryConsensusStateResponse} message QueryConsensusStateResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryConsensusStateResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryConsensusStateResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.client.v1.QueryConsensusStateResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.client.v1.QueryConsensusStateResponse} QueryConsensusStateResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryConsensusStateResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.QueryConsensusStateResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.consensus_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - case 2: - message.proof = reader.bytes(); - break; - case 3: - message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryConsensusStateResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.client.v1.QueryConsensusStateResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.client.v1.QueryConsensusStateResponse} QueryConsensusStateResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryConsensusStateResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryConsensusStateResponse message. - * @function verify - * @memberof ibc.core.client.v1.QueryConsensusStateResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryConsensusStateResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) { - let error = $root.google.protobuf.Any.verify(message.consensus_state); - if (error) - return "consensus_state." + error; - } - if (message.proof != null && message.hasOwnProperty("proof")) - if (!(message.proof && typeof message.proof.length === "number" || $util.isString(message.proof))) - return "proof: buffer expected"; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); - if (error) - return "proof_height." + error; - } - return null; - }; - - /** - * Creates a QueryConsensusStateResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.client.v1.QueryConsensusStateResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.client.v1.QueryConsensusStateResponse} QueryConsensusStateResponse - */ - QueryConsensusStateResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.client.v1.QueryConsensusStateResponse) - return object; - let message = new $root.ibc.core.client.v1.QueryConsensusStateResponse(); - if (object.consensus_state != null) { - if (typeof object.consensus_state !== "object") - throw TypeError(".ibc.core.client.v1.QueryConsensusStateResponse.consensus_state: object expected"); - message.consensus_state = $root.google.protobuf.Any.fromObject(object.consensus_state); - } - if (object.proof != null) - if (typeof object.proof === "string") - $util.base64.decode(object.proof, message.proof = $util.newBuffer($util.base64.length(object.proof)), 0); - else if (object.proof.length) - message.proof = object.proof; - if (object.proof_height != null) { - if (typeof object.proof_height !== "object") - throw TypeError(".ibc.core.client.v1.QueryConsensusStateResponse.proof_height: object expected"); - message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); - } - return message; - }; - - /** - * Creates a plain object from a QueryConsensusStateResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.client.v1.QueryConsensusStateResponse - * @static - * @param {ibc.core.client.v1.QueryConsensusStateResponse} message QueryConsensusStateResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryConsensusStateResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.consensus_state = null; - if (options.bytes === String) - object.proof = ""; - else { - object.proof = []; - if (options.bytes !== Array) - object.proof = $util.newBuffer(object.proof); - } - object.proof_height = null; - } - if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) - object.consensus_state = $root.google.protobuf.Any.toObject(message.consensus_state, options); - if (message.proof != null && message.hasOwnProperty("proof")) - object.proof = options.bytes === String ? $util.base64.encode(message.proof, 0, message.proof.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof) : message.proof; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) - object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); - return object; - }; - - /** - * Converts this QueryConsensusStateResponse to JSON. - * @function toJSON - * @memberof ibc.core.client.v1.QueryConsensusStateResponse - * @instance - * @returns {Object.} JSON object - */ - QueryConsensusStateResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryConsensusStateResponse; - })(); - - v1.QueryConsensusStatesRequest = (function() { - - /** - * Properties of a QueryConsensusStatesRequest. - * @memberof ibc.core.client.v1 - * @interface IQueryConsensusStatesRequest - * @property {string|null} [client_id] QueryConsensusStatesRequest client_id - * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryConsensusStatesRequest pagination - */ - - /** - * Constructs a new QueryConsensusStatesRequest. - * @memberof ibc.core.client.v1 - * @classdesc Represents a QueryConsensusStatesRequest. - * @implements IQueryConsensusStatesRequest - * @constructor - * @param {ibc.core.client.v1.IQueryConsensusStatesRequest=} [properties] Properties to set - */ - function QueryConsensusStatesRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryConsensusStatesRequest client_id. - * @member {string} client_id - * @memberof ibc.core.client.v1.QueryConsensusStatesRequest - * @instance - */ - QueryConsensusStatesRequest.prototype.client_id = ""; - - /** - * QueryConsensusStatesRequest pagination. - * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination - * @memberof ibc.core.client.v1.QueryConsensusStatesRequest - * @instance - */ - QueryConsensusStatesRequest.prototype.pagination = null; - - /** - * Encodes the specified QueryConsensusStatesRequest message. Does not implicitly {@link ibc.core.client.v1.QueryConsensusStatesRequest.verify|verify} messages. - * @function encode - * @memberof ibc.core.client.v1.QueryConsensusStatesRequest - * @static - * @param {ibc.core.client.v1.IQueryConsensusStatesRequest} message QueryConsensusStatesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryConsensusStatesRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryConsensusStatesRequest message, length delimited. Does not implicitly {@link ibc.core.client.v1.QueryConsensusStatesRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.client.v1.QueryConsensusStatesRequest - * @static - * @param {ibc.core.client.v1.IQueryConsensusStatesRequest} message QueryConsensusStatesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryConsensusStatesRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryConsensusStatesRequest message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.client.v1.QueryConsensusStatesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.client.v1.QueryConsensusStatesRequest} QueryConsensusStatesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryConsensusStatesRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.QueryConsensusStatesRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.client_id = reader.string(); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryConsensusStatesRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.client.v1.QueryConsensusStatesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.client.v1.QueryConsensusStatesRequest} QueryConsensusStatesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryConsensusStatesRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryConsensusStatesRequest message. - * @function verify - * @memberof ibc.core.client.v1.QueryConsensusStatesRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryConsensusStatesRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.client_id != null && message.hasOwnProperty("client_id")) - if (!$util.isString(message.client_id)) - return "client_id: string expected"; - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryConsensusStatesRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.client.v1.QueryConsensusStatesRequest - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.client.v1.QueryConsensusStatesRequest} QueryConsensusStatesRequest - */ - QueryConsensusStatesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.client.v1.QueryConsensusStatesRequest) - return object; - let message = new $root.ibc.core.client.v1.QueryConsensusStatesRequest(); - if (object.client_id != null) - message.client_id = String(object.client_id); - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".ibc.core.client.v1.QueryConsensusStatesRequest.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryConsensusStatesRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.client.v1.QueryConsensusStatesRequest - * @static - * @param {ibc.core.client.v1.QueryConsensusStatesRequest} message QueryConsensusStatesRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryConsensusStatesRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.client_id = ""; - object.pagination = null; - } - if (message.client_id != null && message.hasOwnProperty("client_id")) - object.client_id = message.client_id; - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryConsensusStatesRequest to JSON. - * @function toJSON - * @memberof ibc.core.client.v1.QueryConsensusStatesRequest - * @instance - * @returns {Object.} JSON object - */ - QueryConsensusStatesRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryConsensusStatesRequest; - })(); - - v1.QueryConsensusStatesResponse = (function() { - - /** - * Properties of a QueryConsensusStatesResponse. - * @memberof ibc.core.client.v1 - * @interface IQueryConsensusStatesResponse - * @property {Array.|null} [consensus_states] QueryConsensusStatesResponse consensus_states - * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryConsensusStatesResponse pagination - */ - - /** - * Constructs a new QueryConsensusStatesResponse. - * @memberof ibc.core.client.v1 - * @classdesc Represents a QueryConsensusStatesResponse. - * @implements IQueryConsensusStatesResponse - * @constructor - * @param {ibc.core.client.v1.IQueryConsensusStatesResponse=} [properties] Properties to set - */ - function QueryConsensusStatesResponse(properties) { - this.consensus_states = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryConsensusStatesResponse consensus_states. - * @member {Array.} consensus_states - * @memberof ibc.core.client.v1.QueryConsensusStatesResponse - * @instance - */ - QueryConsensusStatesResponse.prototype.consensus_states = $util.emptyArray; - - /** - * QueryConsensusStatesResponse pagination. - * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination - * @memberof ibc.core.client.v1.QueryConsensusStatesResponse - * @instance - */ - QueryConsensusStatesResponse.prototype.pagination = null; - - /** - * Encodes the specified QueryConsensusStatesResponse message. Does not implicitly {@link ibc.core.client.v1.QueryConsensusStatesResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.client.v1.QueryConsensusStatesResponse - * @static - * @param {ibc.core.client.v1.IQueryConsensusStatesResponse} message QueryConsensusStatesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryConsensusStatesResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.consensus_states != null && message.consensus_states.length) - for (let i = 0; i < message.consensus_states.length; ++i) - $root.ibc.core.client.v1.ConsensusStateWithHeight.encode(message.consensus_states[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryConsensusStatesResponse message, length delimited. Does not implicitly {@link ibc.core.client.v1.QueryConsensusStatesResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.client.v1.QueryConsensusStatesResponse - * @static - * @param {ibc.core.client.v1.IQueryConsensusStatesResponse} message QueryConsensusStatesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryConsensusStatesResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryConsensusStatesResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.client.v1.QueryConsensusStatesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.client.v1.QueryConsensusStatesResponse} QueryConsensusStatesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryConsensusStatesResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.QueryConsensusStatesResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.consensus_states && message.consensus_states.length)) - message.consensus_states = []; - message.consensus_states.push($root.ibc.core.client.v1.ConsensusStateWithHeight.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryConsensusStatesResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.client.v1.QueryConsensusStatesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.client.v1.QueryConsensusStatesResponse} QueryConsensusStatesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryConsensusStatesResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryConsensusStatesResponse message. - * @function verify - * @memberof ibc.core.client.v1.QueryConsensusStatesResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryConsensusStatesResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.consensus_states != null && message.hasOwnProperty("consensus_states")) { - if (!Array.isArray(message.consensus_states)) - return "consensus_states: array expected"; - for (let i = 0; i < message.consensus_states.length; ++i) { - let error = $root.ibc.core.client.v1.ConsensusStateWithHeight.verify(message.consensus_states[i]); - if (error) - return "consensus_states." + error; - } - } - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryConsensusStatesResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.client.v1.QueryConsensusStatesResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.client.v1.QueryConsensusStatesResponse} QueryConsensusStatesResponse - */ - QueryConsensusStatesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.client.v1.QueryConsensusStatesResponse) - return object; - let message = new $root.ibc.core.client.v1.QueryConsensusStatesResponse(); - if (object.consensus_states) { - if (!Array.isArray(object.consensus_states)) - throw TypeError(".ibc.core.client.v1.QueryConsensusStatesResponse.consensus_states: array expected"); - message.consensus_states = []; - for (let i = 0; i < object.consensus_states.length; ++i) { - if (typeof object.consensus_states[i] !== "object") - throw TypeError(".ibc.core.client.v1.QueryConsensusStatesResponse.consensus_states: object expected"); - message.consensus_states[i] = $root.ibc.core.client.v1.ConsensusStateWithHeight.fromObject(object.consensus_states[i]); - } - } - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".ibc.core.client.v1.QueryConsensusStatesResponse.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryConsensusStatesResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.client.v1.QueryConsensusStatesResponse - * @static - * @param {ibc.core.client.v1.QueryConsensusStatesResponse} message QueryConsensusStatesResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryConsensusStatesResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.consensus_states = []; - if (options.defaults) - object.pagination = null; - if (message.consensus_states && message.consensus_states.length) { - object.consensus_states = []; - for (let j = 0; j < message.consensus_states.length; ++j) - object.consensus_states[j] = $root.ibc.core.client.v1.ConsensusStateWithHeight.toObject(message.consensus_states[j], options); - } - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryConsensusStatesResponse to JSON. - * @function toJSON - * @memberof ibc.core.client.v1.QueryConsensusStatesResponse - * @instance - * @returns {Object.} JSON object - */ - QueryConsensusStatesResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryConsensusStatesResponse; - })(); - - v1.QueryClientParamsRequest = (function() { - - /** - * Properties of a QueryClientParamsRequest. - * @memberof ibc.core.client.v1 - * @interface IQueryClientParamsRequest - */ - - /** - * Constructs a new QueryClientParamsRequest. - * @memberof ibc.core.client.v1 - * @classdesc Represents a QueryClientParamsRequest. - * @implements IQueryClientParamsRequest - * @constructor - * @param {ibc.core.client.v1.IQueryClientParamsRequest=} [properties] Properties to set - */ - function QueryClientParamsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified QueryClientParamsRequest message. Does not implicitly {@link ibc.core.client.v1.QueryClientParamsRequest.verify|verify} messages. - * @function encode - * @memberof ibc.core.client.v1.QueryClientParamsRequest - * @static - * @param {ibc.core.client.v1.IQueryClientParamsRequest} message QueryClientParamsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryClientParamsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified QueryClientParamsRequest message, length delimited. Does not implicitly {@link ibc.core.client.v1.QueryClientParamsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.client.v1.QueryClientParamsRequest - * @static - * @param {ibc.core.client.v1.IQueryClientParamsRequest} message QueryClientParamsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryClientParamsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryClientParamsRequest message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.client.v1.QueryClientParamsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.client.v1.QueryClientParamsRequest} QueryClientParamsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryClientParamsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.QueryClientParamsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryClientParamsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.client.v1.QueryClientParamsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.client.v1.QueryClientParamsRequest} QueryClientParamsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryClientParamsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryClientParamsRequest message. - * @function verify - * @memberof ibc.core.client.v1.QueryClientParamsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryClientParamsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a QueryClientParamsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.client.v1.QueryClientParamsRequest - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.client.v1.QueryClientParamsRequest} QueryClientParamsRequest - */ - QueryClientParamsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.client.v1.QueryClientParamsRequest) - return object; - return new $root.ibc.core.client.v1.QueryClientParamsRequest(); - }; - - /** - * Creates a plain object from a QueryClientParamsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.client.v1.QueryClientParamsRequest - * @static - * @param {ibc.core.client.v1.QueryClientParamsRequest} message QueryClientParamsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryClientParamsRequest.toObject = function toObject() { - return {}; - }; - - /** - * Converts this QueryClientParamsRequest to JSON. - * @function toJSON - * @memberof ibc.core.client.v1.QueryClientParamsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryClientParamsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryClientParamsRequest; - })(); - - v1.QueryClientParamsResponse = (function() { - - /** - * Properties of a QueryClientParamsResponse. - * @memberof ibc.core.client.v1 - * @interface IQueryClientParamsResponse - * @property {ibc.core.client.v1.IParams|null} [params] QueryClientParamsResponse params - */ - - /** - * Constructs a new QueryClientParamsResponse. - * @memberof ibc.core.client.v1 - * @classdesc Represents a QueryClientParamsResponse. - * @implements IQueryClientParamsResponse - * @constructor - * @param {ibc.core.client.v1.IQueryClientParamsResponse=} [properties] Properties to set - */ - function QueryClientParamsResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryClientParamsResponse params. - * @member {ibc.core.client.v1.IParams|null|undefined} params - * @memberof ibc.core.client.v1.QueryClientParamsResponse - * @instance - */ - QueryClientParamsResponse.prototype.params = null; - - /** - * Encodes the specified QueryClientParamsResponse message. Does not implicitly {@link ibc.core.client.v1.QueryClientParamsResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.client.v1.QueryClientParamsResponse - * @static - * @param {ibc.core.client.v1.IQueryClientParamsResponse} message QueryClientParamsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryClientParamsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.params != null && Object.hasOwnProperty.call(message, "params")) - $root.ibc.core.client.v1.Params.encode(message.params, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryClientParamsResponse message, length delimited. Does not implicitly {@link ibc.core.client.v1.QueryClientParamsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.client.v1.QueryClientParamsResponse - * @static - * @param {ibc.core.client.v1.IQueryClientParamsResponse} message QueryClientParamsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryClientParamsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryClientParamsResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.client.v1.QueryClientParamsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.client.v1.QueryClientParamsResponse} QueryClientParamsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryClientParamsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.QueryClientParamsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.params = $root.ibc.core.client.v1.Params.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryClientParamsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.client.v1.QueryClientParamsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.client.v1.QueryClientParamsResponse} QueryClientParamsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryClientParamsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryClientParamsResponse message. - * @function verify - * @memberof ibc.core.client.v1.QueryClientParamsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryClientParamsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.params != null && message.hasOwnProperty("params")) { - let error = $root.ibc.core.client.v1.Params.verify(message.params); - if (error) - return "params." + error; - } - return null; - }; - - /** - * Creates a QueryClientParamsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.client.v1.QueryClientParamsResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.client.v1.QueryClientParamsResponse} QueryClientParamsResponse - */ - QueryClientParamsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.client.v1.QueryClientParamsResponse) - return object; - let message = new $root.ibc.core.client.v1.QueryClientParamsResponse(); - if (object.params != null) { - if (typeof object.params !== "object") - throw TypeError(".ibc.core.client.v1.QueryClientParamsResponse.params: object expected"); - message.params = $root.ibc.core.client.v1.Params.fromObject(object.params); - } - return message; - }; - - /** - * Creates a plain object from a QueryClientParamsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.client.v1.QueryClientParamsResponse - * @static - * @param {ibc.core.client.v1.QueryClientParamsResponse} message QueryClientParamsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryClientParamsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.params = null; - if (message.params != null && message.hasOwnProperty("params")) - object.params = $root.ibc.core.client.v1.Params.toObject(message.params, options); - return object; - }; - - /** - * Converts this QueryClientParamsResponse to JSON. - * @function toJSON - * @memberof ibc.core.client.v1.QueryClientParamsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryClientParamsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryClientParamsResponse; - })(); - - v1.GenesisState = (function() { - - /** - * Properties of a GenesisState. - * @memberof ibc.core.client.v1 - * @interface IGenesisState - * @property {Array.|null} [clients] GenesisState clients - * @property {Array.|null} [clients_consensus] GenesisState clients_consensus - * @property {Array.|null} [clients_metadata] GenesisState clients_metadata - * @property {ibc.core.client.v1.IParams|null} [params] GenesisState params - * @property {boolean|null} [create_localhost] GenesisState create_localhost - * @property {Long|null} [next_client_sequence] GenesisState next_client_sequence - */ - - /** - * Constructs a new GenesisState. - * @memberof ibc.core.client.v1 - * @classdesc Represents a GenesisState. - * @implements IGenesisState - * @constructor - * @param {ibc.core.client.v1.IGenesisState=} [properties] Properties to set - */ - function GenesisState(properties) { - this.clients = []; - this.clients_consensus = []; - this.clients_metadata = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GenesisState clients. - * @member {Array.} clients - * @memberof ibc.core.client.v1.GenesisState - * @instance - */ - GenesisState.prototype.clients = $util.emptyArray; - - /** - * GenesisState clients_consensus. - * @member {Array.} clients_consensus - * @memberof ibc.core.client.v1.GenesisState - * @instance - */ - GenesisState.prototype.clients_consensus = $util.emptyArray; - - /** - * GenesisState clients_metadata. - * @member {Array.} clients_metadata - * @memberof ibc.core.client.v1.GenesisState - * @instance - */ - GenesisState.prototype.clients_metadata = $util.emptyArray; - - /** - * GenesisState params. - * @member {ibc.core.client.v1.IParams|null|undefined} params - * @memberof ibc.core.client.v1.GenesisState - * @instance - */ - GenesisState.prototype.params = null; - - /** - * GenesisState create_localhost. - * @member {boolean} create_localhost - * @memberof ibc.core.client.v1.GenesisState - * @instance - */ - GenesisState.prototype.create_localhost = false; - - /** - * GenesisState next_client_sequence. - * @member {Long} next_client_sequence - * @memberof ibc.core.client.v1.GenesisState - * @instance - */ - GenesisState.prototype.next_client_sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified GenesisState message. Does not implicitly {@link ibc.core.client.v1.GenesisState.verify|verify} messages. - * @function encode - * @memberof ibc.core.client.v1.GenesisState - * @static - * @param {ibc.core.client.v1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.clients != null && message.clients.length) - for (let i = 0; i < message.clients.length; ++i) - $root.ibc.core.client.v1.IdentifiedClientState.encode(message.clients[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.clients_consensus != null && message.clients_consensus.length) - for (let i = 0; i < message.clients_consensus.length; ++i) - $root.ibc.core.client.v1.ClientConsensusStates.encode(message.clients_consensus[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.clients_metadata != null && message.clients_metadata.length) - for (let i = 0; i < message.clients_metadata.length; ++i) - $root.ibc.core.client.v1.IdentifiedGenesisMetadata.encode(message.clients_metadata[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.params != null && Object.hasOwnProperty.call(message, "params")) - $root.ibc.core.client.v1.Params.encode(message.params, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.create_localhost != null && Object.hasOwnProperty.call(message, "create_localhost")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.create_localhost); - if (message.next_client_sequence != null && Object.hasOwnProperty.call(message, "next_client_sequence")) - writer.uint32(/* id 6, wireType 0 =*/48).uint64(message.next_client_sequence); - return writer; - }; - - /** - * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link ibc.core.client.v1.GenesisState.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.client.v1.GenesisState - * @static - * @param {ibc.core.client.v1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.client.v1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.client.v1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.GenesisState(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.clients && message.clients.length)) - message.clients = []; - message.clients.push($root.ibc.core.client.v1.IdentifiedClientState.decode(reader, reader.uint32())); - break; - case 2: - if (!(message.clients_consensus && message.clients_consensus.length)) - message.clients_consensus = []; - message.clients_consensus.push($root.ibc.core.client.v1.ClientConsensusStates.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.clients_metadata && message.clients_metadata.length)) - message.clients_metadata = []; - message.clients_metadata.push($root.ibc.core.client.v1.IdentifiedGenesisMetadata.decode(reader, reader.uint32())); - break; - case 4: - message.params = $root.ibc.core.client.v1.Params.decode(reader, reader.uint32()); - break; - case 5: - message.create_localhost = reader.bool(); - break; - case 6: - message.next_client_sequence = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.client.v1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.client.v1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GenesisState message. - * @function verify - * @memberof ibc.core.client.v1.GenesisState - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GenesisState.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.clients != null && message.hasOwnProperty("clients")) { - if (!Array.isArray(message.clients)) - return "clients: array expected"; - for (let i = 0; i < message.clients.length; ++i) { - let error = $root.ibc.core.client.v1.IdentifiedClientState.verify(message.clients[i]); - if (error) - return "clients." + error; - } - } - if (message.clients_consensus != null && message.hasOwnProperty("clients_consensus")) { - if (!Array.isArray(message.clients_consensus)) - return "clients_consensus: array expected"; - for (let i = 0; i < message.clients_consensus.length; ++i) { - let error = $root.ibc.core.client.v1.ClientConsensusStates.verify(message.clients_consensus[i]); - if (error) - return "clients_consensus." + error; - } - } - if (message.clients_metadata != null && message.hasOwnProperty("clients_metadata")) { - if (!Array.isArray(message.clients_metadata)) - return "clients_metadata: array expected"; - for (let i = 0; i < message.clients_metadata.length; ++i) { - let error = $root.ibc.core.client.v1.IdentifiedGenesisMetadata.verify(message.clients_metadata[i]); - if (error) - return "clients_metadata." + error; - } - } - if (message.params != null && message.hasOwnProperty("params")) { - let error = $root.ibc.core.client.v1.Params.verify(message.params); - if (error) - return "params." + error; - } - if (message.create_localhost != null && message.hasOwnProperty("create_localhost")) - if (typeof message.create_localhost !== "boolean") - return "create_localhost: boolean expected"; - if (message.next_client_sequence != null && message.hasOwnProperty("next_client_sequence")) - if (!$util.isInteger(message.next_client_sequence) && !(message.next_client_sequence && $util.isInteger(message.next_client_sequence.low) && $util.isInteger(message.next_client_sequence.high))) - return "next_client_sequence: integer|Long expected"; - return null; - }; - - /** - * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.client.v1.GenesisState - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.client.v1.GenesisState} GenesisState - */ - GenesisState.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.client.v1.GenesisState) - return object; - let message = new $root.ibc.core.client.v1.GenesisState(); - if (object.clients) { - if (!Array.isArray(object.clients)) - throw TypeError(".ibc.core.client.v1.GenesisState.clients: array expected"); - message.clients = []; - for (let i = 0; i < object.clients.length; ++i) { - if (typeof object.clients[i] !== "object") - throw TypeError(".ibc.core.client.v1.GenesisState.clients: object expected"); - message.clients[i] = $root.ibc.core.client.v1.IdentifiedClientState.fromObject(object.clients[i]); - } - } - if (object.clients_consensus) { - if (!Array.isArray(object.clients_consensus)) - throw TypeError(".ibc.core.client.v1.GenesisState.clients_consensus: array expected"); - message.clients_consensus = []; - for (let i = 0; i < object.clients_consensus.length; ++i) { - if (typeof object.clients_consensus[i] !== "object") - throw TypeError(".ibc.core.client.v1.GenesisState.clients_consensus: object expected"); - message.clients_consensus[i] = $root.ibc.core.client.v1.ClientConsensusStates.fromObject(object.clients_consensus[i]); - } - } - if (object.clients_metadata) { - if (!Array.isArray(object.clients_metadata)) - throw TypeError(".ibc.core.client.v1.GenesisState.clients_metadata: array expected"); - message.clients_metadata = []; - for (let i = 0; i < object.clients_metadata.length; ++i) { - if (typeof object.clients_metadata[i] !== "object") - throw TypeError(".ibc.core.client.v1.GenesisState.clients_metadata: object expected"); - message.clients_metadata[i] = $root.ibc.core.client.v1.IdentifiedGenesisMetadata.fromObject(object.clients_metadata[i]); - } - } - if (object.params != null) { - if (typeof object.params !== "object") - throw TypeError(".ibc.core.client.v1.GenesisState.params: object expected"); - message.params = $root.ibc.core.client.v1.Params.fromObject(object.params); - } - if (object.create_localhost != null) - message.create_localhost = Boolean(object.create_localhost); - if (object.next_client_sequence != null) - if ($util.Long) - (message.next_client_sequence = $util.Long.fromValue(object.next_client_sequence)).unsigned = true; - else if (typeof object.next_client_sequence === "string") - message.next_client_sequence = parseInt(object.next_client_sequence, 10); - else if (typeof object.next_client_sequence === "number") - message.next_client_sequence = object.next_client_sequence; - else if (typeof object.next_client_sequence === "object") - message.next_client_sequence = new $util.LongBits(object.next_client_sequence.low >>> 0, object.next_client_sequence.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a GenesisState message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.client.v1.GenesisState - * @static - * @param {ibc.core.client.v1.GenesisState} message GenesisState - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GenesisState.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) { - object.clients = []; - object.clients_consensus = []; - object.clients_metadata = []; - } - if (options.defaults) { - object.params = null; - object.create_localhost = false; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.next_client_sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.next_client_sequence = options.longs === String ? "0" : 0; - } - if (message.clients && message.clients.length) { - object.clients = []; - for (let j = 0; j < message.clients.length; ++j) - object.clients[j] = $root.ibc.core.client.v1.IdentifiedClientState.toObject(message.clients[j], options); - } - if (message.clients_consensus && message.clients_consensus.length) { - object.clients_consensus = []; - for (let j = 0; j < message.clients_consensus.length; ++j) - object.clients_consensus[j] = $root.ibc.core.client.v1.ClientConsensusStates.toObject(message.clients_consensus[j], options); - } - if (message.clients_metadata && message.clients_metadata.length) { - object.clients_metadata = []; - for (let j = 0; j < message.clients_metadata.length; ++j) - object.clients_metadata[j] = $root.ibc.core.client.v1.IdentifiedGenesisMetadata.toObject(message.clients_metadata[j], options); - } - if (message.params != null && message.hasOwnProperty("params")) - object.params = $root.ibc.core.client.v1.Params.toObject(message.params, options); - if (message.create_localhost != null && message.hasOwnProperty("create_localhost")) - object.create_localhost = message.create_localhost; - if (message.next_client_sequence != null && message.hasOwnProperty("next_client_sequence")) - if (typeof message.next_client_sequence === "number") - object.next_client_sequence = options.longs === String ? String(message.next_client_sequence) : message.next_client_sequence; - else - object.next_client_sequence = options.longs === String ? $util.Long.prototype.toString.call(message.next_client_sequence) : options.longs === Number ? new $util.LongBits(message.next_client_sequence.low >>> 0, message.next_client_sequence.high >>> 0).toNumber(true) : message.next_client_sequence; - return object; - }; - - /** - * Converts this GenesisState to JSON. - * @function toJSON - * @memberof ibc.core.client.v1.GenesisState - * @instance - * @returns {Object.} JSON object - */ - GenesisState.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GenesisState; - })(); - - v1.GenesisMetadata = (function() { - - /** - * Properties of a GenesisMetadata. - * @memberof ibc.core.client.v1 - * @interface IGenesisMetadata - * @property {Uint8Array|null} [key] GenesisMetadata key - * @property {Uint8Array|null} [value] GenesisMetadata value - */ - - /** - * Constructs a new GenesisMetadata. - * @memberof ibc.core.client.v1 - * @classdesc Represents a GenesisMetadata. - * @implements IGenesisMetadata - * @constructor - * @param {ibc.core.client.v1.IGenesisMetadata=} [properties] Properties to set - */ - function GenesisMetadata(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GenesisMetadata key. - * @member {Uint8Array} key - * @memberof ibc.core.client.v1.GenesisMetadata - * @instance - */ - GenesisMetadata.prototype.key = $util.newBuffer([]); - - /** - * GenesisMetadata value. - * @member {Uint8Array} value - * @memberof ibc.core.client.v1.GenesisMetadata - * @instance - */ - GenesisMetadata.prototype.value = $util.newBuffer([]); - - /** - * Encodes the specified GenesisMetadata message. Does not implicitly {@link ibc.core.client.v1.GenesisMetadata.verify|verify} messages. - * @function encode - * @memberof ibc.core.client.v1.GenesisMetadata - * @static - * @param {ibc.core.client.v1.IGenesisMetadata} message GenesisMetadata message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisMetadata.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value); - return writer; - }; - - /** - * Encodes the specified GenesisMetadata message, length delimited. Does not implicitly {@link ibc.core.client.v1.GenesisMetadata.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.client.v1.GenesisMetadata - * @static - * @param {ibc.core.client.v1.IGenesisMetadata} message GenesisMetadata message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisMetadata.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GenesisMetadata message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.client.v1.GenesisMetadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.client.v1.GenesisMetadata} GenesisMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisMetadata.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.GenesisMetadata(); - while (reader.pos < end) { - let 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; - }; - - /** - * Decodes a GenesisMetadata message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.client.v1.GenesisMetadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.client.v1.GenesisMetadata} GenesisMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisMetadata.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GenesisMetadata message. - * @function verify - * @memberof ibc.core.client.v1.GenesisMetadata - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GenesisMetadata.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) - return "key: buffer expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) - return "value: buffer expected"; - return null; - }; - - /** - * Creates a GenesisMetadata message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.client.v1.GenesisMetadata - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.client.v1.GenesisMetadata} GenesisMetadata - */ - GenesisMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.client.v1.GenesisMetadata) - return object; - let message = new $root.ibc.core.client.v1.GenesisMetadata(); - if (object.key != null) - if (typeof object.key === "string") - $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); - else if (object.key.length) - message.key = object.key; - if (object.value != null) - if (typeof object.value === "string") - $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); - else if (object.value.length) - message.value = object.value; - return message; - }; - - /** - * Creates a plain object from a GenesisMetadata message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.client.v1.GenesisMetadata - * @static - * @param {ibc.core.client.v1.GenesisMetadata} message GenesisMetadata - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GenesisMetadata.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if (options.bytes === String) - object.key = ""; - else { - object.key = []; - if (options.bytes !== Array) - object.key = $util.newBuffer(object.key); - } - if (options.bytes === String) - object.value = ""; - else { - object.value = []; - if (options.bytes !== Array) - object.value = $util.newBuffer(object.value); - } - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; - if (message.value != null && message.hasOwnProperty("value")) - object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; - return object; - }; - - /** - * Converts this GenesisMetadata to JSON. - * @function toJSON - * @memberof ibc.core.client.v1.GenesisMetadata - * @instance - * @returns {Object.} JSON object - */ - GenesisMetadata.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GenesisMetadata; - })(); - - v1.IdentifiedGenesisMetadata = (function() { - - /** - * Properties of an IdentifiedGenesisMetadata. - * @memberof ibc.core.client.v1 - * @interface IIdentifiedGenesisMetadata - * @property {string|null} [client_id] IdentifiedGenesisMetadata client_id - * @property {Array.|null} [client_metadata] IdentifiedGenesisMetadata client_metadata - */ - - /** - * Constructs a new IdentifiedGenesisMetadata. - * @memberof ibc.core.client.v1 - * @classdesc Represents an IdentifiedGenesisMetadata. - * @implements IIdentifiedGenesisMetadata - * @constructor - * @param {ibc.core.client.v1.IIdentifiedGenesisMetadata=} [properties] Properties to set - */ - function IdentifiedGenesisMetadata(properties) { - this.client_metadata = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * IdentifiedGenesisMetadata client_id. - * @member {string} client_id - * @memberof ibc.core.client.v1.IdentifiedGenesisMetadata - * @instance - */ - IdentifiedGenesisMetadata.prototype.client_id = ""; - - /** - * IdentifiedGenesisMetadata client_metadata. - * @member {Array.} client_metadata - * @memberof ibc.core.client.v1.IdentifiedGenesisMetadata - * @instance - */ - IdentifiedGenesisMetadata.prototype.client_metadata = $util.emptyArray; - - /** - * Encodes the specified IdentifiedGenesisMetadata message. Does not implicitly {@link ibc.core.client.v1.IdentifiedGenesisMetadata.verify|verify} messages. - * @function encode - * @memberof ibc.core.client.v1.IdentifiedGenesisMetadata - * @static - * @param {ibc.core.client.v1.IIdentifiedGenesisMetadata} message IdentifiedGenesisMetadata message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - IdentifiedGenesisMetadata.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); - if (message.client_metadata != null && message.client_metadata.length) - for (let i = 0; i < message.client_metadata.length; ++i) - $root.ibc.core.client.v1.GenesisMetadata.encode(message.client_metadata[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified IdentifiedGenesisMetadata message, length delimited. Does not implicitly {@link ibc.core.client.v1.IdentifiedGenesisMetadata.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.client.v1.IdentifiedGenesisMetadata - * @static - * @param {ibc.core.client.v1.IIdentifiedGenesisMetadata} message IdentifiedGenesisMetadata message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - IdentifiedGenesisMetadata.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an IdentifiedGenesisMetadata message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.client.v1.IdentifiedGenesisMetadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.client.v1.IdentifiedGenesisMetadata} IdentifiedGenesisMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - IdentifiedGenesisMetadata.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.client.v1.IdentifiedGenesisMetadata(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.client_id = reader.string(); - break; - case 2: - if (!(message.client_metadata && message.client_metadata.length)) - message.client_metadata = []; - message.client_metadata.push($root.ibc.core.client.v1.GenesisMetadata.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an IdentifiedGenesisMetadata message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.client.v1.IdentifiedGenesisMetadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.client.v1.IdentifiedGenesisMetadata} IdentifiedGenesisMetadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - IdentifiedGenesisMetadata.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an IdentifiedGenesisMetadata message. - * @function verify - * @memberof ibc.core.client.v1.IdentifiedGenesisMetadata - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - IdentifiedGenesisMetadata.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.client_id != null && message.hasOwnProperty("client_id")) - if (!$util.isString(message.client_id)) - return "client_id: string expected"; - if (message.client_metadata != null && message.hasOwnProperty("client_metadata")) { - if (!Array.isArray(message.client_metadata)) - return "client_metadata: array expected"; - for (let i = 0; i < message.client_metadata.length; ++i) { - let error = $root.ibc.core.client.v1.GenesisMetadata.verify(message.client_metadata[i]); - if (error) - return "client_metadata." + error; - } - } - return null; - }; - - /** - * Creates an IdentifiedGenesisMetadata message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.client.v1.IdentifiedGenesisMetadata - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.client.v1.IdentifiedGenesisMetadata} IdentifiedGenesisMetadata - */ - IdentifiedGenesisMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.client.v1.IdentifiedGenesisMetadata) - return object; - let message = new $root.ibc.core.client.v1.IdentifiedGenesisMetadata(); - if (object.client_id != null) - message.client_id = String(object.client_id); - if (object.client_metadata) { - if (!Array.isArray(object.client_metadata)) - throw TypeError(".ibc.core.client.v1.IdentifiedGenesisMetadata.client_metadata: array expected"); - message.client_metadata = []; - for (let i = 0; i < object.client_metadata.length; ++i) { - if (typeof object.client_metadata[i] !== "object") - throw TypeError(".ibc.core.client.v1.IdentifiedGenesisMetadata.client_metadata: object expected"); - message.client_metadata[i] = $root.ibc.core.client.v1.GenesisMetadata.fromObject(object.client_metadata[i]); - } - } - return message; - }; - - /** - * Creates a plain object from an IdentifiedGenesisMetadata message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.client.v1.IdentifiedGenesisMetadata - * @static - * @param {ibc.core.client.v1.IdentifiedGenesisMetadata} message IdentifiedGenesisMetadata - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - IdentifiedGenesisMetadata.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.client_metadata = []; - if (options.defaults) - object.client_id = ""; - if (message.client_id != null && message.hasOwnProperty("client_id")) - object.client_id = message.client_id; - if (message.client_metadata && message.client_metadata.length) { - object.client_metadata = []; - for (let j = 0; j < message.client_metadata.length; ++j) - object.client_metadata[j] = $root.ibc.core.client.v1.GenesisMetadata.toObject(message.client_metadata[j], options); - } - return object; - }; - - /** - * Converts this IdentifiedGenesisMetadata to JSON. - * @function toJSON - * @memberof ibc.core.client.v1.IdentifiedGenesisMetadata - * @instance - * @returns {Object.} JSON object - */ - IdentifiedGenesisMetadata.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return IdentifiedGenesisMetadata; - })(); - - return v1; - })(); - - return client; - })(); - - core.commitment = (function() { - - /** - * Namespace commitment. - * @memberof ibc.core - * @namespace - */ - const commitment = {}; - - commitment.v1 = (function() { - - /** - * Namespace v1. - * @memberof ibc.core.commitment - * @namespace - */ - const v1 = {}; - - v1.MerkleRoot = (function() { - - /** - * Properties of a MerkleRoot. - * @memberof ibc.core.commitment.v1 - * @interface IMerkleRoot - * @property {Uint8Array|null} [hash] MerkleRoot hash - */ - - /** - * Constructs a new MerkleRoot. - * @memberof ibc.core.commitment.v1 - * @classdesc Represents a MerkleRoot. - * @implements IMerkleRoot - * @constructor - * @param {ibc.core.commitment.v1.IMerkleRoot=} [properties] Properties to set - */ - function MerkleRoot(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MerkleRoot hash. - * @member {Uint8Array} hash - * @memberof ibc.core.commitment.v1.MerkleRoot - * @instance - */ - MerkleRoot.prototype.hash = $util.newBuffer([]); - - /** - * Encodes the specified MerkleRoot message. Does not implicitly {@link ibc.core.commitment.v1.MerkleRoot.verify|verify} messages. - * @function encode - * @memberof ibc.core.commitment.v1.MerkleRoot - * @static - * @param {ibc.core.commitment.v1.IMerkleRoot} message MerkleRoot message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MerkleRoot.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.hash != null && Object.hasOwnProperty.call(message, "hash")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.hash); - return writer; - }; - - /** - * Encodes the specified MerkleRoot message, length delimited. Does not implicitly {@link ibc.core.commitment.v1.MerkleRoot.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.commitment.v1.MerkleRoot - * @static - * @param {ibc.core.commitment.v1.IMerkleRoot} message MerkleRoot message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MerkleRoot.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MerkleRoot message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.commitment.v1.MerkleRoot - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.commitment.v1.MerkleRoot} MerkleRoot - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MerkleRoot.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.commitment.v1.MerkleRoot(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.hash = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MerkleRoot message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.commitment.v1.MerkleRoot - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.commitment.v1.MerkleRoot} MerkleRoot - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MerkleRoot.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MerkleRoot message. - * @function verify - * @memberof ibc.core.commitment.v1.MerkleRoot - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MerkleRoot.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.hash != null && message.hasOwnProperty("hash")) - if (!(message.hash && typeof message.hash.length === "number" || $util.isString(message.hash))) - return "hash: buffer expected"; - return null; - }; - - /** - * Creates a MerkleRoot message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.commitment.v1.MerkleRoot - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.commitment.v1.MerkleRoot} MerkleRoot - */ - MerkleRoot.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.commitment.v1.MerkleRoot) - return object; - let message = new $root.ibc.core.commitment.v1.MerkleRoot(); - if (object.hash != null) - if (typeof object.hash === "string") - $util.base64.decode(object.hash, message.hash = $util.newBuffer($util.base64.length(object.hash)), 0); - else if (object.hash.length) - message.hash = object.hash; - return message; - }; - - /** - * Creates a plain object from a MerkleRoot message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.commitment.v1.MerkleRoot - * @static - * @param {ibc.core.commitment.v1.MerkleRoot} message MerkleRoot - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MerkleRoot.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - if (options.bytes === String) - object.hash = ""; - else { - object.hash = []; - if (options.bytes !== Array) - object.hash = $util.newBuffer(object.hash); - } - if (message.hash != null && message.hasOwnProperty("hash")) - object.hash = options.bytes === String ? $util.base64.encode(message.hash, 0, message.hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.hash) : message.hash; - return object; - }; - - /** - * Converts this MerkleRoot to JSON. - * @function toJSON - * @memberof ibc.core.commitment.v1.MerkleRoot - * @instance - * @returns {Object.} JSON object - */ - MerkleRoot.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MerkleRoot; - })(); - - v1.MerklePrefix = (function() { - - /** - * Properties of a MerklePrefix. - * @memberof ibc.core.commitment.v1 - * @interface IMerklePrefix - * @property {Uint8Array|null} [key_prefix] MerklePrefix key_prefix - */ - - /** - * Constructs a new MerklePrefix. - * @memberof ibc.core.commitment.v1 - * @classdesc Represents a MerklePrefix. - * @implements IMerklePrefix - * @constructor - * @param {ibc.core.commitment.v1.IMerklePrefix=} [properties] Properties to set - */ - function MerklePrefix(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MerklePrefix key_prefix. - * @member {Uint8Array} key_prefix - * @memberof ibc.core.commitment.v1.MerklePrefix - * @instance - */ - MerklePrefix.prototype.key_prefix = $util.newBuffer([]); - - /** - * Encodes the specified MerklePrefix message. Does not implicitly {@link ibc.core.commitment.v1.MerklePrefix.verify|verify} messages. - * @function encode - * @memberof ibc.core.commitment.v1.MerklePrefix - * @static - * @param {ibc.core.commitment.v1.IMerklePrefix} message MerklePrefix message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MerklePrefix.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key_prefix != null && Object.hasOwnProperty.call(message, "key_prefix")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key_prefix); - return writer; - }; - - /** - * Encodes the specified MerklePrefix message, length delimited. Does not implicitly {@link ibc.core.commitment.v1.MerklePrefix.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.commitment.v1.MerklePrefix - * @static - * @param {ibc.core.commitment.v1.IMerklePrefix} message MerklePrefix message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MerklePrefix.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MerklePrefix message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.commitment.v1.MerklePrefix - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.commitment.v1.MerklePrefix} MerklePrefix - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MerklePrefix.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.commitment.v1.MerklePrefix(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key_prefix = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MerklePrefix message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.commitment.v1.MerklePrefix - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.commitment.v1.MerklePrefix} MerklePrefix - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MerklePrefix.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MerklePrefix message. - * @function verify - * @memberof ibc.core.commitment.v1.MerklePrefix - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MerklePrefix.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key_prefix != null && message.hasOwnProperty("key_prefix")) - if (!(message.key_prefix && typeof message.key_prefix.length === "number" || $util.isString(message.key_prefix))) - return "key_prefix: buffer expected"; - return null; - }; - - /** - * Creates a MerklePrefix message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.commitment.v1.MerklePrefix - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.commitment.v1.MerklePrefix} MerklePrefix - */ - MerklePrefix.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.commitment.v1.MerklePrefix) - return object; - let message = new $root.ibc.core.commitment.v1.MerklePrefix(); - if (object.key_prefix != null) - if (typeof object.key_prefix === "string") - $util.base64.decode(object.key_prefix, message.key_prefix = $util.newBuffer($util.base64.length(object.key_prefix)), 0); - else if (object.key_prefix.length) - message.key_prefix = object.key_prefix; - return message; - }; - - /** - * Creates a plain object from a MerklePrefix message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.commitment.v1.MerklePrefix - * @static - * @param {ibc.core.commitment.v1.MerklePrefix} message MerklePrefix - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MerklePrefix.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - if (options.bytes === String) - object.key_prefix = ""; - else { - object.key_prefix = []; - if (options.bytes !== Array) - object.key_prefix = $util.newBuffer(object.key_prefix); - } - if (message.key_prefix != null && message.hasOwnProperty("key_prefix")) - object.key_prefix = options.bytes === String ? $util.base64.encode(message.key_prefix, 0, message.key_prefix.length) : options.bytes === Array ? Array.prototype.slice.call(message.key_prefix) : message.key_prefix; - return object; - }; - - /** - * Converts this MerklePrefix to JSON. - * @function toJSON - * @memberof ibc.core.commitment.v1.MerklePrefix - * @instance - * @returns {Object.} JSON object - */ - MerklePrefix.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MerklePrefix; - })(); - - v1.MerklePath = (function() { - - /** - * Properties of a MerklePath. - * @memberof ibc.core.commitment.v1 - * @interface IMerklePath - * @property {Array.|null} [key_path] MerklePath key_path - */ - - /** - * Constructs a new MerklePath. - * @memberof ibc.core.commitment.v1 - * @classdesc Represents a MerklePath. - * @implements IMerklePath - * @constructor - * @param {ibc.core.commitment.v1.IMerklePath=} [properties] Properties to set - */ - function MerklePath(properties) { - this.key_path = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MerklePath key_path. - * @member {Array.} key_path - * @memberof ibc.core.commitment.v1.MerklePath - * @instance - */ - MerklePath.prototype.key_path = $util.emptyArray; - - /** - * Encodes the specified MerklePath message. Does not implicitly {@link ibc.core.commitment.v1.MerklePath.verify|verify} messages. - * @function encode - * @memberof ibc.core.commitment.v1.MerklePath - * @static - * @param {ibc.core.commitment.v1.IMerklePath} message MerklePath message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MerklePath.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key_path != null && message.key_path.length) - for (let i = 0; i < message.key_path.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.key_path[i]); - return writer; - }; - - /** - * Encodes the specified MerklePath message, length delimited. Does not implicitly {@link ibc.core.commitment.v1.MerklePath.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.commitment.v1.MerklePath - * @static - * @param {ibc.core.commitment.v1.IMerklePath} message MerklePath message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MerklePath.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MerklePath message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.commitment.v1.MerklePath - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.commitment.v1.MerklePath} MerklePath - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MerklePath.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.commitment.v1.MerklePath(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.key_path && message.key_path.length)) - message.key_path = []; - message.key_path.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MerklePath message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.commitment.v1.MerklePath - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.commitment.v1.MerklePath} MerklePath - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MerklePath.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MerklePath message. - * @function verify - * @memberof ibc.core.commitment.v1.MerklePath - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MerklePath.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key_path != null && message.hasOwnProperty("key_path")) { - if (!Array.isArray(message.key_path)) - return "key_path: array expected"; - for (let i = 0; i < message.key_path.length; ++i) - if (!$util.isString(message.key_path[i])) - return "key_path: string[] expected"; - } - return null; - }; - - /** - * Creates a MerklePath message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.commitment.v1.MerklePath - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.commitment.v1.MerklePath} MerklePath - */ - MerklePath.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.commitment.v1.MerklePath) - return object; - let message = new $root.ibc.core.commitment.v1.MerklePath(); - if (object.key_path) { - if (!Array.isArray(object.key_path)) - throw TypeError(".ibc.core.commitment.v1.MerklePath.key_path: array expected"); - message.key_path = []; - for (let i = 0; i < object.key_path.length; ++i) - message.key_path[i] = String(object.key_path[i]); - } - return message; - }; - - /** - * Creates a plain object from a MerklePath message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.commitment.v1.MerklePath - * @static - * @param {ibc.core.commitment.v1.MerklePath} message MerklePath - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MerklePath.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.key_path = []; - if (message.key_path && message.key_path.length) { - object.key_path = []; - for (let j = 0; j < message.key_path.length; ++j) - object.key_path[j] = message.key_path[j]; - } - return object; - }; - - /** - * Converts this MerklePath to JSON. - * @function toJSON - * @memberof ibc.core.commitment.v1.MerklePath - * @instance - * @returns {Object.} JSON object - */ - MerklePath.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MerklePath; - })(); - - v1.MerkleProof = (function() { - - /** - * Properties of a MerkleProof. - * @memberof ibc.core.commitment.v1 - * @interface IMerkleProof - * @property {Array.|null} [proofs] MerkleProof proofs - */ - - /** - * Constructs a new MerkleProof. - * @memberof ibc.core.commitment.v1 - * @classdesc Represents a MerkleProof. - * @implements IMerkleProof - * @constructor - * @param {ibc.core.commitment.v1.IMerkleProof=} [properties] Properties to set - */ - function MerkleProof(properties) { - this.proofs = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MerkleProof proofs. - * @member {Array.} proofs - * @memberof ibc.core.commitment.v1.MerkleProof - * @instance - */ - MerkleProof.prototype.proofs = $util.emptyArray; - - /** - * Encodes the specified MerkleProof message. Does not implicitly {@link ibc.core.commitment.v1.MerkleProof.verify|verify} messages. - * @function encode - * @memberof ibc.core.commitment.v1.MerkleProof - * @static - * @param {ibc.core.commitment.v1.IMerkleProof} message MerkleProof message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MerkleProof.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.proofs != null && message.proofs.length) - for (let i = 0; i < message.proofs.length; ++i) - $root.ics23.CommitmentProof.encode(message.proofs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified MerkleProof message, length delimited. Does not implicitly {@link ibc.core.commitment.v1.MerkleProof.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.commitment.v1.MerkleProof - * @static - * @param {ibc.core.commitment.v1.IMerkleProof} message MerkleProof message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MerkleProof.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MerkleProof message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.commitment.v1.MerkleProof - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.commitment.v1.MerkleProof} MerkleProof - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MerkleProof.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.commitment.v1.MerkleProof(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.proofs && message.proofs.length)) - message.proofs = []; - message.proofs.push($root.ics23.CommitmentProof.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MerkleProof message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.commitment.v1.MerkleProof - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.commitment.v1.MerkleProof} MerkleProof - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MerkleProof.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MerkleProof message. - * @function verify - * @memberof ibc.core.commitment.v1.MerkleProof - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MerkleProof.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.proofs != null && message.hasOwnProperty("proofs")) { - if (!Array.isArray(message.proofs)) - return "proofs: array expected"; - for (let i = 0; i < message.proofs.length; ++i) { - let error = $root.ics23.CommitmentProof.verify(message.proofs[i]); - if (error) - return "proofs." + error; - } - } - return null; - }; - - /** - * Creates a MerkleProof message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.commitment.v1.MerkleProof - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.commitment.v1.MerkleProof} MerkleProof - */ - MerkleProof.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.commitment.v1.MerkleProof) - return object; - let message = new $root.ibc.core.commitment.v1.MerkleProof(); - if (object.proofs) { - if (!Array.isArray(object.proofs)) - throw TypeError(".ibc.core.commitment.v1.MerkleProof.proofs: array expected"); - message.proofs = []; - for (let i = 0; i < object.proofs.length; ++i) { - if (typeof object.proofs[i] !== "object") - throw TypeError(".ibc.core.commitment.v1.MerkleProof.proofs: object expected"); - message.proofs[i] = $root.ics23.CommitmentProof.fromObject(object.proofs[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a MerkleProof message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.commitment.v1.MerkleProof - * @static - * @param {ibc.core.commitment.v1.MerkleProof} message MerkleProof - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MerkleProof.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.proofs = []; - if (message.proofs && message.proofs.length) { - object.proofs = []; - for (let j = 0; j < message.proofs.length; ++j) - object.proofs[j] = $root.ics23.CommitmentProof.toObject(message.proofs[j], options); - } - return object; - }; - - /** - * Converts this MerkleProof to JSON. - * @function toJSON - * @memberof ibc.core.commitment.v1.MerkleProof - * @instance - * @returns {Object.} JSON object - */ - MerkleProof.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MerkleProof; - })(); - - return v1; - })(); - - return commitment; - })(); - - core.connection = (function() { - - /** - * Namespace connection. - * @memberof ibc.core - * @namespace - */ - const connection = {}; - - connection.v1 = (function() { - - /** - * Namespace v1. - * @memberof ibc.core.connection - * @namespace - */ - const v1 = {}; - - v1.Msg = (function() { - - /** - * Constructs a new Msg service. - * @memberof ibc.core.connection.v1 - * @classdesc Represents a Msg - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function Msg(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Msg.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Msg; - - /** - * Callback as used by {@link ibc.core.connection.v1.Msg#connectionOpenInit}. - * @memberof ibc.core.connection.v1.Msg - * @typedef ConnectionOpenInitCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.connection.v1.MsgConnectionOpenInitResponse} [response] MsgConnectionOpenInitResponse - */ - - /** - * Calls ConnectionOpenInit. - * @function connectionOpenInit - * @memberof ibc.core.connection.v1.Msg - * @instance - * @param {ibc.core.connection.v1.IMsgConnectionOpenInit} request MsgConnectionOpenInit message or plain object - * @param {ibc.core.connection.v1.Msg.ConnectionOpenInitCallback} callback Node-style callback called with the error, if any, and MsgConnectionOpenInitResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.connectionOpenInit = function connectionOpenInit(request, callback) { - return this.rpcCall(connectionOpenInit, $root.ibc.core.connection.v1.MsgConnectionOpenInit, $root.ibc.core.connection.v1.MsgConnectionOpenInitResponse, request, callback); - }, "name", { value: "ConnectionOpenInit" }); - - /** - * Calls ConnectionOpenInit. - * @function connectionOpenInit - * @memberof ibc.core.connection.v1.Msg - * @instance - * @param {ibc.core.connection.v1.IMsgConnectionOpenInit} request MsgConnectionOpenInit message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.connection.v1.Msg#connectionOpenTry}. - * @memberof ibc.core.connection.v1.Msg - * @typedef ConnectionOpenTryCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.connection.v1.MsgConnectionOpenTryResponse} [response] MsgConnectionOpenTryResponse - */ - - /** - * Calls ConnectionOpenTry. - * @function connectionOpenTry - * @memberof ibc.core.connection.v1.Msg - * @instance - * @param {ibc.core.connection.v1.IMsgConnectionOpenTry} request MsgConnectionOpenTry message or plain object - * @param {ibc.core.connection.v1.Msg.ConnectionOpenTryCallback} callback Node-style callback called with the error, if any, and MsgConnectionOpenTryResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.connectionOpenTry = function connectionOpenTry(request, callback) { - return this.rpcCall(connectionOpenTry, $root.ibc.core.connection.v1.MsgConnectionOpenTry, $root.ibc.core.connection.v1.MsgConnectionOpenTryResponse, request, callback); - }, "name", { value: "ConnectionOpenTry" }); - - /** - * Calls ConnectionOpenTry. - * @function connectionOpenTry - * @memberof ibc.core.connection.v1.Msg - * @instance - * @param {ibc.core.connection.v1.IMsgConnectionOpenTry} request MsgConnectionOpenTry message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.connection.v1.Msg#connectionOpenAck}. - * @memberof ibc.core.connection.v1.Msg - * @typedef ConnectionOpenAckCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.connection.v1.MsgConnectionOpenAckResponse} [response] MsgConnectionOpenAckResponse - */ - - /** - * Calls ConnectionOpenAck. - * @function connectionOpenAck - * @memberof ibc.core.connection.v1.Msg - * @instance - * @param {ibc.core.connection.v1.IMsgConnectionOpenAck} request MsgConnectionOpenAck message or plain object - * @param {ibc.core.connection.v1.Msg.ConnectionOpenAckCallback} callback Node-style callback called with the error, if any, and MsgConnectionOpenAckResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.connectionOpenAck = function connectionOpenAck(request, callback) { - return this.rpcCall(connectionOpenAck, $root.ibc.core.connection.v1.MsgConnectionOpenAck, $root.ibc.core.connection.v1.MsgConnectionOpenAckResponse, request, callback); - }, "name", { value: "ConnectionOpenAck" }); - - /** - * Calls ConnectionOpenAck. - * @function connectionOpenAck - * @memberof ibc.core.connection.v1.Msg - * @instance - * @param {ibc.core.connection.v1.IMsgConnectionOpenAck} request MsgConnectionOpenAck message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.connection.v1.Msg#connectionOpenConfirm}. - * @memberof ibc.core.connection.v1.Msg - * @typedef ConnectionOpenConfirmCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.connection.v1.MsgConnectionOpenConfirmResponse} [response] MsgConnectionOpenConfirmResponse - */ - - /** - * Calls ConnectionOpenConfirm. - * @function connectionOpenConfirm - * @memberof ibc.core.connection.v1.Msg - * @instance - * @param {ibc.core.connection.v1.IMsgConnectionOpenConfirm} request MsgConnectionOpenConfirm message or plain object - * @param {ibc.core.connection.v1.Msg.ConnectionOpenConfirmCallback} callback Node-style callback called with the error, if any, and MsgConnectionOpenConfirmResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Msg.prototype.connectionOpenConfirm = function connectionOpenConfirm(request, callback) { - return this.rpcCall(connectionOpenConfirm, $root.ibc.core.connection.v1.MsgConnectionOpenConfirm, $root.ibc.core.connection.v1.MsgConnectionOpenConfirmResponse, request, callback); - }, "name", { value: "ConnectionOpenConfirm" }); - - /** - * Calls ConnectionOpenConfirm. - * @function connectionOpenConfirm - * @memberof ibc.core.connection.v1.Msg - * @instance - * @param {ibc.core.connection.v1.IMsgConnectionOpenConfirm} request MsgConnectionOpenConfirm message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return Msg; - })(); - - v1.MsgConnectionOpenInit = (function() { - - /** - * Properties of a MsgConnectionOpenInit. - * @memberof ibc.core.connection.v1 - * @interface IMsgConnectionOpenInit - * @property {string|null} [client_id] MsgConnectionOpenInit client_id - * @property {ibc.core.connection.v1.ICounterparty|null} [counterparty] MsgConnectionOpenInit counterparty - * @property {ibc.core.connection.v1.IVersion|null} [version] MsgConnectionOpenInit version - * @property {Long|null} [delay_period] MsgConnectionOpenInit delay_period - * @property {string|null} [signer] MsgConnectionOpenInit signer - */ - - /** - * Constructs a new MsgConnectionOpenInit. - * @memberof ibc.core.connection.v1 - * @classdesc Represents a MsgConnectionOpenInit. - * @implements IMsgConnectionOpenInit - * @constructor - * @param {ibc.core.connection.v1.IMsgConnectionOpenInit=} [properties] Properties to set - */ - function MsgConnectionOpenInit(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgConnectionOpenInit client_id. - * @member {string} client_id - * @memberof ibc.core.connection.v1.MsgConnectionOpenInit - * @instance - */ - MsgConnectionOpenInit.prototype.client_id = ""; - - /** - * MsgConnectionOpenInit counterparty. - * @member {ibc.core.connection.v1.ICounterparty|null|undefined} counterparty - * @memberof ibc.core.connection.v1.MsgConnectionOpenInit - * @instance - */ - MsgConnectionOpenInit.prototype.counterparty = null; - - /** - * MsgConnectionOpenInit version. - * @member {ibc.core.connection.v1.IVersion|null|undefined} version - * @memberof ibc.core.connection.v1.MsgConnectionOpenInit - * @instance - */ - MsgConnectionOpenInit.prototype.version = null; - - /** - * MsgConnectionOpenInit delay_period. - * @member {Long} delay_period - * @memberof ibc.core.connection.v1.MsgConnectionOpenInit - * @instance - */ - MsgConnectionOpenInit.prototype.delay_period = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * MsgConnectionOpenInit signer. - * @member {string} signer - * @memberof ibc.core.connection.v1.MsgConnectionOpenInit - * @instance - */ - MsgConnectionOpenInit.prototype.signer = ""; - - /** - * Encodes the specified MsgConnectionOpenInit message. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenInit.verify|verify} messages. - * @function encode - * @memberof ibc.core.connection.v1.MsgConnectionOpenInit - * @static - * @param {ibc.core.connection.v1.IMsgConnectionOpenInit} message MsgConnectionOpenInit message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgConnectionOpenInit.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); - if (message.counterparty != null && Object.hasOwnProperty.call(message, "counterparty")) - $root.ibc.core.connection.v1.Counterparty.encode(message.counterparty, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.version != null && Object.hasOwnProperty.call(message, "version")) - $root.ibc.core.connection.v1.Version.encode(message.version, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.delay_period != null && Object.hasOwnProperty.call(message, "delay_period")) - writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.delay_period); - if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.signer); - return writer; - }; - - /** - * Encodes the specified MsgConnectionOpenInit message, length delimited. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenInit.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.connection.v1.MsgConnectionOpenInit - * @static - * @param {ibc.core.connection.v1.IMsgConnectionOpenInit} message MsgConnectionOpenInit message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgConnectionOpenInit.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgConnectionOpenInit message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.connection.v1.MsgConnectionOpenInit - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.connection.v1.MsgConnectionOpenInit} MsgConnectionOpenInit - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgConnectionOpenInit.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.MsgConnectionOpenInit(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.client_id = reader.string(); - break; - case 2: - message.counterparty = $root.ibc.core.connection.v1.Counterparty.decode(reader, reader.uint32()); - break; - case 3: - message.version = $root.ibc.core.connection.v1.Version.decode(reader, reader.uint32()); - break; - case 4: - message.delay_period = reader.uint64(); - break; - case 5: - message.signer = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgConnectionOpenInit message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.connection.v1.MsgConnectionOpenInit - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.connection.v1.MsgConnectionOpenInit} MsgConnectionOpenInit - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgConnectionOpenInit.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgConnectionOpenInit message. - * @function verify - * @memberof ibc.core.connection.v1.MsgConnectionOpenInit - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgConnectionOpenInit.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.client_id != null && message.hasOwnProperty("client_id")) - if (!$util.isString(message.client_id)) - return "client_id: string expected"; - if (message.counterparty != null && message.hasOwnProperty("counterparty")) { - let error = $root.ibc.core.connection.v1.Counterparty.verify(message.counterparty); - if (error) - return "counterparty." + error; - } - if (message.version != null && message.hasOwnProperty("version")) { - let error = $root.ibc.core.connection.v1.Version.verify(message.version); - if (error) - return "version." + error; - } - if (message.delay_period != null && message.hasOwnProperty("delay_period")) - if (!$util.isInteger(message.delay_period) && !(message.delay_period && $util.isInteger(message.delay_period.low) && $util.isInteger(message.delay_period.high))) - return "delay_period: integer|Long expected"; - if (message.signer != null && message.hasOwnProperty("signer")) - if (!$util.isString(message.signer)) - return "signer: string expected"; - return null; - }; - - /** - * Creates a MsgConnectionOpenInit message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.connection.v1.MsgConnectionOpenInit - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.connection.v1.MsgConnectionOpenInit} MsgConnectionOpenInit - */ - MsgConnectionOpenInit.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.connection.v1.MsgConnectionOpenInit) - return object; - let message = new $root.ibc.core.connection.v1.MsgConnectionOpenInit(); - if (object.client_id != null) - message.client_id = String(object.client_id); - if (object.counterparty != null) { - if (typeof object.counterparty !== "object") - throw TypeError(".ibc.core.connection.v1.MsgConnectionOpenInit.counterparty: object expected"); - message.counterparty = $root.ibc.core.connection.v1.Counterparty.fromObject(object.counterparty); - } - if (object.version != null) { - if (typeof object.version !== "object") - throw TypeError(".ibc.core.connection.v1.MsgConnectionOpenInit.version: object expected"); - message.version = $root.ibc.core.connection.v1.Version.fromObject(object.version); - } - if (object.delay_period != null) - if ($util.Long) - (message.delay_period = $util.Long.fromValue(object.delay_period)).unsigned = true; - else if (typeof object.delay_period === "string") - message.delay_period = parseInt(object.delay_period, 10); - else if (typeof object.delay_period === "number") - message.delay_period = object.delay_period; - else if (typeof object.delay_period === "object") - message.delay_period = new $util.LongBits(object.delay_period.low >>> 0, object.delay_period.high >>> 0).toNumber(true); - if (object.signer != null) - message.signer = String(object.signer); - return message; - }; - - /** - * Creates a plain object from a MsgConnectionOpenInit message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.connection.v1.MsgConnectionOpenInit - * @static - * @param {ibc.core.connection.v1.MsgConnectionOpenInit} message MsgConnectionOpenInit - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgConnectionOpenInit.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.client_id = ""; - object.counterparty = null; - object.version = null; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.delay_period = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.delay_period = options.longs === String ? "0" : 0; - object.signer = ""; - } - if (message.client_id != null && message.hasOwnProperty("client_id")) - object.client_id = message.client_id; - if (message.counterparty != null && message.hasOwnProperty("counterparty")) - object.counterparty = $root.ibc.core.connection.v1.Counterparty.toObject(message.counterparty, options); - if (message.version != null && message.hasOwnProperty("version")) - object.version = $root.ibc.core.connection.v1.Version.toObject(message.version, options); - if (message.delay_period != null && message.hasOwnProperty("delay_period")) - if (typeof message.delay_period === "number") - object.delay_period = options.longs === String ? String(message.delay_period) : message.delay_period; - else - object.delay_period = options.longs === String ? $util.Long.prototype.toString.call(message.delay_period) : options.longs === Number ? new $util.LongBits(message.delay_period.low >>> 0, message.delay_period.high >>> 0).toNumber(true) : message.delay_period; - if (message.signer != null && message.hasOwnProperty("signer")) - object.signer = message.signer; - return object; - }; - - /** - * Converts this MsgConnectionOpenInit to JSON. - * @function toJSON - * @memberof ibc.core.connection.v1.MsgConnectionOpenInit - * @instance - * @returns {Object.} JSON object - */ - MsgConnectionOpenInit.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgConnectionOpenInit; - })(); - - v1.MsgConnectionOpenInitResponse = (function() { - - /** - * Properties of a MsgConnectionOpenInitResponse. - * @memberof ibc.core.connection.v1 - * @interface IMsgConnectionOpenInitResponse - */ - - /** - * Constructs a new MsgConnectionOpenInitResponse. - * @memberof ibc.core.connection.v1 - * @classdesc Represents a MsgConnectionOpenInitResponse. - * @implements IMsgConnectionOpenInitResponse - * @constructor - * @param {ibc.core.connection.v1.IMsgConnectionOpenInitResponse=} [properties] Properties to set - */ - function MsgConnectionOpenInitResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgConnectionOpenInitResponse message. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenInitResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.connection.v1.MsgConnectionOpenInitResponse - * @static - * @param {ibc.core.connection.v1.IMsgConnectionOpenInitResponse} message MsgConnectionOpenInitResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgConnectionOpenInitResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgConnectionOpenInitResponse message, length delimited. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenInitResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.connection.v1.MsgConnectionOpenInitResponse - * @static - * @param {ibc.core.connection.v1.IMsgConnectionOpenInitResponse} message MsgConnectionOpenInitResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgConnectionOpenInitResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgConnectionOpenInitResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.connection.v1.MsgConnectionOpenInitResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.connection.v1.MsgConnectionOpenInitResponse} MsgConnectionOpenInitResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgConnectionOpenInitResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.MsgConnectionOpenInitResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgConnectionOpenInitResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.connection.v1.MsgConnectionOpenInitResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.connection.v1.MsgConnectionOpenInitResponse} MsgConnectionOpenInitResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgConnectionOpenInitResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgConnectionOpenInitResponse message. - * @function verify - * @memberof ibc.core.connection.v1.MsgConnectionOpenInitResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgConnectionOpenInitResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgConnectionOpenInitResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.connection.v1.MsgConnectionOpenInitResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.connection.v1.MsgConnectionOpenInitResponse} MsgConnectionOpenInitResponse - */ - MsgConnectionOpenInitResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.connection.v1.MsgConnectionOpenInitResponse) - return object; - return new $root.ibc.core.connection.v1.MsgConnectionOpenInitResponse(); - }; - - /** - * Creates a plain object from a MsgConnectionOpenInitResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.connection.v1.MsgConnectionOpenInitResponse - * @static - * @param {ibc.core.connection.v1.MsgConnectionOpenInitResponse} message MsgConnectionOpenInitResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgConnectionOpenInitResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgConnectionOpenInitResponse to JSON. - * @function toJSON - * @memberof ibc.core.connection.v1.MsgConnectionOpenInitResponse - * @instance - * @returns {Object.} JSON object - */ - MsgConnectionOpenInitResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgConnectionOpenInitResponse; - })(); - - v1.MsgConnectionOpenTry = (function() { - - /** - * Properties of a MsgConnectionOpenTry. - * @memberof ibc.core.connection.v1 - * @interface IMsgConnectionOpenTry - * @property {string|null} [client_id] MsgConnectionOpenTry client_id - * @property {string|null} [previous_connection_id] MsgConnectionOpenTry previous_connection_id - * @property {google.protobuf.IAny|null} [client_state] MsgConnectionOpenTry client_state - * @property {ibc.core.connection.v1.ICounterparty|null} [counterparty] MsgConnectionOpenTry counterparty - * @property {Long|null} [delay_period] MsgConnectionOpenTry delay_period - * @property {Array.|null} [counterparty_versions] MsgConnectionOpenTry counterparty_versions - * @property {ibc.core.client.v1.IHeight|null} [proof_height] MsgConnectionOpenTry proof_height - * @property {Uint8Array|null} [proof_init] MsgConnectionOpenTry proof_init - * @property {Uint8Array|null} [proof_client] MsgConnectionOpenTry proof_client - * @property {Uint8Array|null} [proof_consensus] MsgConnectionOpenTry proof_consensus - * @property {ibc.core.client.v1.IHeight|null} [consensus_height] MsgConnectionOpenTry consensus_height - * @property {string|null} [signer] MsgConnectionOpenTry signer - */ - - /** - * Constructs a new MsgConnectionOpenTry. - * @memberof ibc.core.connection.v1 - * @classdesc Represents a MsgConnectionOpenTry. - * @implements IMsgConnectionOpenTry - * @constructor - * @param {ibc.core.connection.v1.IMsgConnectionOpenTry=} [properties] Properties to set - */ - function MsgConnectionOpenTry(properties) { - this.counterparty_versions = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgConnectionOpenTry client_id. - * @member {string} client_id - * @memberof ibc.core.connection.v1.MsgConnectionOpenTry - * @instance - */ - MsgConnectionOpenTry.prototype.client_id = ""; - - /** - * MsgConnectionOpenTry previous_connection_id. - * @member {string} previous_connection_id - * @memberof ibc.core.connection.v1.MsgConnectionOpenTry - * @instance - */ - MsgConnectionOpenTry.prototype.previous_connection_id = ""; - - /** - * MsgConnectionOpenTry client_state. - * @member {google.protobuf.IAny|null|undefined} client_state - * @memberof ibc.core.connection.v1.MsgConnectionOpenTry - * @instance - */ - MsgConnectionOpenTry.prototype.client_state = null; - - /** - * MsgConnectionOpenTry counterparty. - * @member {ibc.core.connection.v1.ICounterparty|null|undefined} counterparty - * @memberof ibc.core.connection.v1.MsgConnectionOpenTry - * @instance - */ - MsgConnectionOpenTry.prototype.counterparty = null; - - /** - * MsgConnectionOpenTry delay_period. - * @member {Long} delay_period - * @memberof ibc.core.connection.v1.MsgConnectionOpenTry - * @instance - */ - MsgConnectionOpenTry.prototype.delay_period = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * MsgConnectionOpenTry counterparty_versions. - * @member {Array.} counterparty_versions - * @memberof ibc.core.connection.v1.MsgConnectionOpenTry - * @instance - */ - MsgConnectionOpenTry.prototype.counterparty_versions = $util.emptyArray; - - /** - * MsgConnectionOpenTry proof_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height - * @memberof ibc.core.connection.v1.MsgConnectionOpenTry - * @instance - */ - MsgConnectionOpenTry.prototype.proof_height = null; - - /** - * MsgConnectionOpenTry proof_init. - * @member {Uint8Array} proof_init - * @memberof ibc.core.connection.v1.MsgConnectionOpenTry - * @instance - */ - MsgConnectionOpenTry.prototype.proof_init = $util.newBuffer([]); - - /** - * MsgConnectionOpenTry proof_client. - * @member {Uint8Array} proof_client - * @memberof ibc.core.connection.v1.MsgConnectionOpenTry - * @instance - */ - MsgConnectionOpenTry.prototype.proof_client = $util.newBuffer([]); - - /** - * MsgConnectionOpenTry proof_consensus. - * @member {Uint8Array} proof_consensus - * @memberof ibc.core.connection.v1.MsgConnectionOpenTry - * @instance - */ - MsgConnectionOpenTry.prototype.proof_consensus = $util.newBuffer([]); - - /** - * MsgConnectionOpenTry consensus_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} consensus_height - * @memberof ibc.core.connection.v1.MsgConnectionOpenTry - * @instance - */ - MsgConnectionOpenTry.prototype.consensus_height = null; - - /** - * MsgConnectionOpenTry signer. - * @member {string} signer - * @memberof ibc.core.connection.v1.MsgConnectionOpenTry - * @instance - */ - MsgConnectionOpenTry.prototype.signer = ""; - - /** - * Encodes the specified MsgConnectionOpenTry message. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenTry.verify|verify} messages. - * @function encode - * @memberof ibc.core.connection.v1.MsgConnectionOpenTry - * @static - * @param {ibc.core.connection.v1.IMsgConnectionOpenTry} message MsgConnectionOpenTry message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgConnectionOpenTry.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); - if (message.previous_connection_id != null && Object.hasOwnProperty.call(message, "previous_connection_id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.previous_connection_id); - if (message.client_state != null && Object.hasOwnProperty.call(message, "client_state")) - $root.google.protobuf.Any.encode(message.client_state, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.counterparty != null && Object.hasOwnProperty.call(message, "counterparty")) - $root.ibc.core.connection.v1.Counterparty.encode(message.counterparty, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.delay_period != null && Object.hasOwnProperty.call(message, "delay_period")) - writer.uint32(/* id 5, wireType 0 =*/40).uint64(message.delay_period); - if (message.counterparty_versions != null && message.counterparty_versions.length) - for (let i = 0; i < message.counterparty_versions.length; ++i) - $root.ibc.core.connection.v1.Version.encode(message.counterparty_versions[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) - $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.proof_init != null && Object.hasOwnProperty.call(message, "proof_init")) - writer.uint32(/* id 8, wireType 2 =*/66).bytes(message.proof_init); - if (message.proof_client != null && Object.hasOwnProperty.call(message, "proof_client")) - writer.uint32(/* id 9, wireType 2 =*/74).bytes(message.proof_client); - if (message.proof_consensus != null && Object.hasOwnProperty.call(message, "proof_consensus")) - writer.uint32(/* id 10, wireType 2 =*/82).bytes(message.proof_consensus); - if (message.consensus_height != null && Object.hasOwnProperty.call(message, "consensus_height")) - $root.ibc.core.client.v1.Height.encode(message.consensus_height, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) - writer.uint32(/* id 12, wireType 2 =*/98).string(message.signer); - return writer; - }; - - /** - * Encodes the specified MsgConnectionOpenTry message, length delimited. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenTry.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.connection.v1.MsgConnectionOpenTry - * @static - * @param {ibc.core.connection.v1.IMsgConnectionOpenTry} message MsgConnectionOpenTry message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgConnectionOpenTry.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgConnectionOpenTry message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.connection.v1.MsgConnectionOpenTry - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.connection.v1.MsgConnectionOpenTry} MsgConnectionOpenTry - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgConnectionOpenTry.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.MsgConnectionOpenTry(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.client_id = reader.string(); - break; - case 2: - message.previous_connection_id = reader.string(); - break; - case 3: - message.client_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - case 4: - message.counterparty = $root.ibc.core.connection.v1.Counterparty.decode(reader, reader.uint32()); - break; - case 5: - message.delay_period = reader.uint64(); - break; - case 6: - if (!(message.counterparty_versions && message.counterparty_versions.length)) - message.counterparty_versions = []; - message.counterparty_versions.push($root.ibc.core.connection.v1.Version.decode(reader, reader.uint32())); - break; - case 7: - message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - case 8: - message.proof_init = reader.bytes(); - break; - case 9: - message.proof_client = reader.bytes(); - break; - case 10: - message.proof_consensus = reader.bytes(); - break; - case 11: - message.consensus_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - case 12: - message.signer = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgConnectionOpenTry message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.connection.v1.MsgConnectionOpenTry - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.connection.v1.MsgConnectionOpenTry} MsgConnectionOpenTry - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgConnectionOpenTry.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgConnectionOpenTry message. - * @function verify - * @memberof ibc.core.connection.v1.MsgConnectionOpenTry - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgConnectionOpenTry.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.client_id != null && message.hasOwnProperty("client_id")) - if (!$util.isString(message.client_id)) - return "client_id: string expected"; - if (message.previous_connection_id != null && message.hasOwnProperty("previous_connection_id")) - if (!$util.isString(message.previous_connection_id)) - return "previous_connection_id: string expected"; - if (message.client_state != null && message.hasOwnProperty("client_state")) { - let error = $root.google.protobuf.Any.verify(message.client_state); - if (error) - return "client_state." + error; - } - if (message.counterparty != null && message.hasOwnProperty("counterparty")) { - let error = $root.ibc.core.connection.v1.Counterparty.verify(message.counterparty); - if (error) - return "counterparty." + error; - } - if (message.delay_period != null && message.hasOwnProperty("delay_period")) - if (!$util.isInteger(message.delay_period) && !(message.delay_period && $util.isInteger(message.delay_period.low) && $util.isInteger(message.delay_period.high))) - return "delay_period: integer|Long expected"; - if (message.counterparty_versions != null && message.hasOwnProperty("counterparty_versions")) { - if (!Array.isArray(message.counterparty_versions)) - return "counterparty_versions: array expected"; - for (let i = 0; i < message.counterparty_versions.length; ++i) { - let error = $root.ibc.core.connection.v1.Version.verify(message.counterparty_versions[i]); - if (error) - return "counterparty_versions." + error; - } - } - if (message.proof_height != null && message.hasOwnProperty("proof_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); - if (error) - return "proof_height." + error; - } - if (message.proof_init != null && message.hasOwnProperty("proof_init")) - if (!(message.proof_init && typeof message.proof_init.length === "number" || $util.isString(message.proof_init))) - return "proof_init: buffer expected"; - if (message.proof_client != null && message.hasOwnProperty("proof_client")) - if (!(message.proof_client && typeof message.proof_client.length === "number" || $util.isString(message.proof_client))) - return "proof_client: buffer expected"; - if (message.proof_consensus != null && message.hasOwnProperty("proof_consensus")) - if (!(message.proof_consensus && typeof message.proof_consensus.length === "number" || $util.isString(message.proof_consensus))) - return "proof_consensus: buffer expected"; - if (message.consensus_height != null && message.hasOwnProperty("consensus_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.consensus_height); - if (error) - return "consensus_height." + error; - } - if (message.signer != null && message.hasOwnProperty("signer")) - if (!$util.isString(message.signer)) - return "signer: string expected"; - return null; - }; - - /** - * Creates a MsgConnectionOpenTry message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.connection.v1.MsgConnectionOpenTry - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.connection.v1.MsgConnectionOpenTry} MsgConnectionOpenTry - */ - MsgConnectionOpenTry.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.connection.v1.MsgConnectionOpenTry) - return object; - let message = new $root.ibc.core.connection.v1.MsgConnectionOpenTry(); - if (object.client_id != null) - message.client_id = String(object.client_id); - if (object.previous_connection_id != null) - message.previous_connection_id = String(object.previous_connection_id); - if (object.client_state != null) { - if (typeof object.client_state !== "object") - throw TypeError(".ibc.core.connection.v1.MsgConnectionOpenTry.client_state: object expected"); - message.client_state = $root.google.protobuf.Any.fromObject(object.client_state); - } - if (object.counterparty != null) { - if (typeof object.counterparty !== "object") - throw TypeError(".ibc.core.connection.v1.MsgConnectionOpenTry.counterparty: object expected"); - message.counterparty = $root.ibc.core.connection.v1.Counterparty.fromObject(object.counterparty); - } - if (object.delay_period != null) - if ($util.Long) - (message.delay_period = $util.Long.fromValue(object.delay_period)).unsigned = true; - else if (typeof object.delay_period === "string") - message.delay_period = parseInt(object.delay_period, 10); - else if (typeof object.delay_period === "number") - message.delay_period = object.delay_period; - else if (typeof object.delay_period === "object") - message.delay_period = new $util.LongBits(object.delay_period.low >>> 0, object.delay_period.high >>> 0).toNumber(true); - if (object.counterparty_versions) { - if (!Array.isArray(object.counterparty_versions)) - throw TypeError(".ibc.core.connection.v1.MsgConnectionOpenTry.counterparty_versions: array expected"); - message.counterparty_versions = []; - for (let i = 0; i < object.counterparty_versions.length; ++i) { - if (typeof object.counterparty_versions[i] !== "object") - throw TypeError(".ibc.core.connection.v1.MsgConnectionOpenTry.counterparty_versions: object expected"); - message.counterparty_versions[i] = $root.ibc.core.connection.v1.Version.fromObject(object.counterparty_versions[i]); - } - } - if (object.proof_height != null) { - if (typeof object.proof_height !== "object") - throw TypeError(".ibc.core.connection.v1.MsgConnectionOpenTry.proof_height: object expected"); - message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); - } - if (object.proof_init != null) - if (typeof object.proof_init === "string") - $util.base64.decode(object.proof_init, message.proof_init = $util.newBuffer($util.base64.length(object.proof_init)), 0); - else if (object.proof_init.length) - message.proof_init = object.proof_init; - if (object.proof_client != null) - if (typeof object.proof_client === "string") - $util.base64.decode(object.proof_client, message.proof_client = $util.newBuffer($util.base64.length(object.proof_client)), 0); - else if (object.proof_client.length) - message.proof_client = object.proof_client; - if (object.proof_consensus != null) - if (typeof object.proof_consensus === "string") - $util.base64.decode(object.proof_consensus, message.proof_consensus = $util.newBuffer($util.base64.length(object.proof_consensus)), 0); - else if (object.proof_consensus.length) - message.proof_consensus = object.proof_consensus; - if (object.consensus_height != null) { - if (typeof object.consensus_height !== "object") - throw TypeError(".ibc.core.connection.v1.MsgConnectionOpenTry.consensus_height: object expected"); - message.consensus_height = $root.ibc.core.client.v1.Height.fromObject(object.consensus_height); - } - if (object.signer != null) - message.signer = String(object.signer); - return message; - }; - - /** - * Creates a plain object from a MsgConnectionOpenTry message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.connection.v1.MsgConnectionOpenTry - * @static - * @param {ibc.core.connection.v1.MsgConnectionOpenTry} message MsgConnectionOpenTry - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgConnectionOpenTry.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.counterparty_versions = []; - if (options.defaults) { - object.client_id = ""; - object.previous_connection_id = ""; - object.client_state = null; - object.counterparty = null; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.delay_period = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.delay_period = options.longs === String ? "0" : 0; - object.proof_height = null; - if (options.bytes === String) - object.proof_init = ""; - else { - object.proof_init = []; - if (options.bytes !== Array) - object.proof_init = $util.newBuffer(object.proof_init); - } - if (options.bytes === String) - object.proof_client = ""; - else { - object.proof_client = []; - if (options.bytes !== Array) - object.proof_client = $util.newBuffer(object.proof_client); - } - if (options.bytes === String) - object.proof_consensus = ""; - else { - object.proof_consensus = []; - if (options.bytes !== Array) - object.proof_consensus = $util.newBuffer(object.proof_consensus); - } - object.consensus_height = null; - object.signer = ""; - } - if (message.client_id != null && message.hasOwnProperty("client_id")) - object.client_id = message.client_id; - if (message.previous_connection_id != null && message.hasOwnProperty("previous_connection_id")) - object.previous_connection_id = message.previous_connection_id; - if (message.client_state != null && message.hasOwnProperty("client_state")) - object.client_state = $root.google.protobuf.Any.toObject(message.client_state, options); - if (message.counterparty != null && message.hasOwnProperty("counterparty")) - object.counterparty = $root.ibc.core.connection.v1.Counterparty.toObject(message.counterparty, options); - if (message.delay_period != null && message.hasOwnProperty("delay_period")) - if (typeof message.delay_period === "number") - object.delay_period = options.longs === String ? String(message.delay_period) : message.delay_period; - else - object.delay_period = options.longs === String ? $util.Long.prototype.toString.call(message.delay_period) : options.longs === Number ? new $util.LongBits(message.delay_period.low >>> 0, message.delay_period.high >>> 0).toNumber(true) : message.delay_period; - if (message.counterparty_versions && message.counterparty_versions.length) { - object.counterparty_versions = []; - for (let j = 0; j < message.counterparty_versions.length; ++j) - object.counterparty_versions[j] = $root.ibc.core.connection.v1.Version.toObject(message.counterparty_versions[j], options); - } - if (message.proof_height != null && message.hasOwnProperty("proof_height")) - object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); - if (message.proof_init != null && message.hasOwnProperty("proof_init")) - object.proof_init = options.bytes === String ? $util.base64.encode(message.proof_init, 0, message.proof_init.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_init) : message.proof_init; - if (message.proof_client != null && message.hasOwnProperty("proof_client")) - object.proof_client = options.bytes === String ? $util.base64.encode(message.proof_client, 0, message.proof_client.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_client) : message.proof_client; - if (message.proof_consensus != null && message.hasOwnProperty("proof_consensus")) - object.proof_consensus = options.bytes === String ? $util.base64.encode(message.proof_consensus, 0, message.proof_consensus.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_consensus) : message.proof_consensus; - if (message.consensus_height != null && message.hasOwnProperty("consensus_height")) - object.consensus_height = $root.ibc.core.client.v1.Height.toObject(message.consensus_height, options); - if (message.signer != null && message.hasOwnProperty("signer")) - object.signer = message.signer; - return object; - }; - - /** - * Converts this MsgConnectionOpenTry to JSON. - * @function toJSON - * @memberof ibc.core.connection.v1.MsgConnectionOpenTry - * @instance - * @returns {Object.} JSON object - */ - MsgConnectionOpenTry.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgConnectionOpenTry; - })(); - - v1.MsgConnectionOpenTryResponse = (function() { - - /** - * Properties of a MsgConnectionOpenTryResponse. - * @memberof ibc.core.connection.v1 - * @interface IMsgConnectionOpenTryResponse - */ - - /** - * Constructs a new MsgConnectionOpenTryResponse. - * @memberof ibc.core.connection.v1 - * @classdesc Represents a MsgConnectionOpenTryResponse. - * @implements IMsgConnectionOpenTryResponse - * @constructor - * @param {ibc.core.connection.v1.IMsgConnectionOpenTryResponse=} [properties] Properties to set - */ - function MsgConnectionOpenTryResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgConnectionOpenTryResponse message. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenTryResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.connection.v1.MsgConnectionOpenTryResponse - * @static - * @param {ibc.core.connection.v1.IMsgConnectionOpenTryResponse} message MsgConnectionOpenTryResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgConnectionOpenTryResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgConnectionOpenTryResponse message, length delimited. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenTryResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.connection.v1.MsgConnectionOpenTryResponse - * @static - * @param {ibc.core.connection.v1.IMsgConnectionOpenTryResponse} message MsgConnectionOpenTryResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgConnectionOpenTryResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgConnectionOpenTryResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.connection.v1.MsgConnectionOpenTryResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.connection.v1.MsgConnectionOpenTryResponse} MsgConnectionOpenTryResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgConnectionOpenTryResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.MsgConnectionOpenTryResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgConnectionOpenTryResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.connection.v1.MsgConnectionOpenTryResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.connection.v1.MsgConnectionOpenTryResponse} MsgConnectionOpenTryResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgConnectionOpenTryResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgConnectionOpenTryResponse message. - * @function verify - * @memberof ibc.core.connection.v1.MsgConnectionOpenTryResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgConnectionOpenTryResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgConnectionOpenTryResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.connection.v1.MsgConnectionOpenTryResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.connection.v1.MsgConnectionOpenTryResponse} MsgConnectionOpenTryResponse - */ - MsgConnectionOpenTryResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.connection.v1.MsgConnectionOpenTryResponse) - return object; - return new $root.ibc.core.connection.v1.MsgConnectionOpenTryResponse(); - }; - - /** - * Creates a plain object from a MsgConnectionOpenTryResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.connection.v1.MsgConnectionOpenTryResponse - * @static - * @param {ibc.core.connection.v1.MsgConnectionOpenTryResponse} message MsgConnectionOpenTryResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgConnectionOpenTryResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgConnectionOpenTryResponse to JSON. - * @function toJSON - * @memberof ibc.core.connection.v1.MsgConnectionOpenTryResponse - * @instance - * @returns {Object.} JSON object - */ - MsgConnectionOpenTryResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgConnectionOpenTryResponse; - })(); - - v1.MsgConnectionOpenAck = (function() { - - /** - * Properties of a MsgConnectionOpenAck. - * @memberof ibc.core.connection.v1 - * @interface IMsgConnectionOpenAck - * @property {string|null} [connection_id] MsgConnectionOpenAck connection_id - * @property {string|null} [counterparty_connection_id] MsgConnectionOpenAck counterparty_connection_id - * @property {ibc.core.connection.v1.IVersion|null} [version] MsgConnectionOpenAck version - * @property {google.protobuf.IAny|null} [client_state] MsgConnectionOpenAck client_state - * @property {ibc.core.client.v1.IHeight|null} [proof_height] MsgConnectionOpenAck proof_height - * @property {Uint8Array|null} [proof_try] MsgConnectionOpenAck proof_try - * @property {Uint8Array|null} [proof_client] MsgConnectionOpenAck proof_client - * @property {Uint8Array|null} [proof_consensus] MsgConnectionOpenAck proof_consensus - * @property {ibc.core.client.v1.IHeight|null} [consensus_height] MsgConnectionOpenAck consensus_height - * @property {string|null} [signer] MsgConnectionOpenAck signer - */ - - /** - * Constructs a new MsgConnectionOpenAck. - * @memberof ibc.core.connection.v1 - * @classdesc Represents a MsgConnectionOpenAck. - * @implements IMsgConnectionOpenAck - * @constructor - * @param {ibc.core.connection.v1.IMsgConnectionOpenAck=} [properties] Properties to set - */ - function MsgConnectionOpenAck(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgConnectionOpenAck connection_id. - * @member {string} connection_id - * @memberof ibc.core.connection.v1.MsgConnectionOpenAck - * @instance - */ - MsgConnectionOpenAck.prototype.connection_id = ""; - - /** - * MsgConnectionOpenAck counterparty_connection_id. - * @member {string} counterparty_connection_id - * @memberof ibc.core.connection.v1.MsgConnectionOpenAck - * @instance - */ - MsgConnectionOpenAck.prototype.counterparty_connection_id = ""; - - /** - * MsgConnectionOpenAck version. - * @member {ibc.core.connection.v1.IVersion|null|undefined} version - * @memberof ibc.core.connection.v1.MsgConnectionOpenAck - * @instance - */ - MsgConnectionOpenAck.prototype.version = null; - - /** - * MsgConnectionOpenAck client_state. - * @member {google.protobuf.IAny|null|undefined} client_state - * @memberof ibc.core.connection.v1.MsgConnectionOpenAck - * @instance - */ - MsgConnectionOpenAck.prototype.client_state = null; - - /** - * MsgConnectionOpenAck proof_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height - * @memberof ibc.core.connection.v1.MsgConnectionOpenAck - * @instance - */ - MsgConnectionOpenAck.prototype.proof_height = null; - - /** - * MsgConnectionOpenAck proof_try. - * @member {Uint8Array} proof_try - * @memberof ibc.core.connection.v1.MsgConnectionOpenAck - * @instance - */ - MsgConnectionOpenAck.prototype.proof_try = $util.newBuffer([]); - - /** - * MsgConnectionOpenAck proof_client. - * @member {Uint8Array} proof_client - * @memberof ibc.core.connection.v1.MsgConnectionOpenAck - * @instance - */ - MsgConnectionOpenAck.prototype.proof_client = $util.newBuffer([]); - - /** - * MsgConnectionOpenAck proof_consensus. - * @member {Uint8Array} proof_consensus - * @memberof ibc.core.connection.v1.MsgConnectionOpenAck - * @instance - */ - MsgConnectionOpenAck.prototype.proof_consensus = $util.newBuffer([]); - - /** - * MsgConnectionOpenAck consensus_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} consensus_height - * @memberof ibc.core.connection.v1.MsgConnectionOpenAck - * @instance - */ - MsgConnectionOpenAck.prototype.consensus_height = null; - - /** - * MsgConnectionOpenAck signer. - * @member {string} signer - * @memberof ibc.core.connection.v1.MsgConnectionOpenAck - * @instance - */ - MsgConnectionOpenAck.prototype.signer = ""; - - /** - * Encodes the specified MsgConnectionOpenAck message. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenAck.verify|verify} messages. - * @function encode - * @memberof ibc.core.connection.v1.MsgConnectionOpenAck - * @static - * @param {ibc.core.connection.v1.IMsgConnectionOpenAck} message MsgConnectionOpenAck message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgConnectionOpenAck.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.connection_id != null && Object.hasOwnProperty.call(message, "connection_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.connection_id); - if (message.counterparty_connection_id != null && Object.hasOwnProperty.call(message, "counterparty_connection_id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.counterparty_connection_id); - if (message.version != null && Object.hasOwnProperty.call(message, "version")) - $root.ibc.core.connection.v1.Version.encode(message.version, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.client_state != null && Object.hasOwnProperty.call(message, "client_state")) - $root.google.protobuf.Any.encode(message.client_state, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) - $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.proof_try != null && Object.hasOwnProperty.call(message, "proof_try")) - writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.proof_try); - if (message.proof_client != null && Object.hasOwnProperty.call(message, "proof_client")) - writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.proof_client); - if (message.proof_consensus != null && Object.hasOwnProperty.call(message, "proof_consensus")) - writer.uint32(/* id 8, wireType 2 =*/66).bytes(message.proof_consensus); - if (message.consensus_height != null && Object.hasOwnProperty.call(message, "consensus_height")) - $root.ibc.core.client.v1.Height.encode(message.consensus_height, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.signer); - return writer; - }; - - /** - * Encodes the specified MsgConnectionOpenAck message, length delimited. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenAck.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.connection.v1.MsgConnectionOpenAck - * @static - * @param {ibc.core.connection.v1.IMsgConnectionOpenAck} message MsgConnectionOpenAck message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgConnectionOpenAck.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgConnectionOpenAck message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.connection.v1.MsgConnectionOpenAck - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.connection.v1.MsgConnectionOpenAck} MsgConnectionOpenAck - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgConnectionOpenAck.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.MsgConnectionOpenAck(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.connection_id = reader.string(); - break; - case 2: - message.counterparty_connection_id = reader.string(); - break; - case 3: - message.version = $root.ibc.core.connection.v1.Version.decode(reader, reader.uint32()); - break; - case 4: - message.client_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - case 5: - message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - case 6: - message.proof_try = reader.bytes(); - break; - case 7: - message.proof_client = reader.bytes(); - break; - case 8: - message.proof_consensus = reader.bytes(); - break; - case 9: - message.consensus_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - case 10: - message.signer = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgConnectionOpenAck message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.connection.v1.MsgConnectionOpenAck - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.connection.v1.MsgConnectionOpenAck} MsgConnectionOpenAck - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgConnectionOpenAck.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgConnectionOpenAck message. - * @function verify - * @memberof ibc.core.connection.v1.MsgConnectionOpenAck - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgConnectionOpenAck.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.connection_id != null && message.hasOwnProperty("connection_id")) - if (!$util.isString(message.connection_id)) - return "connection_id: string expected"; - if (message.counterparty_connection_id != null && message.hasOwnProperty("counterparty_connection_id")) - if (!$util.isString(message.counterparty_connection_id)) - return "counterparty_connection_id: string expected"; - if (message.version != null && message.hasOwnProperty("version")) { - let error = $root.ibc.core.connection.v1.Version.verify(message.version); - if (error) - return "version." + error; - } - if (message.client_state != null && message.hasOwnProperty("client_state")) { - let error = $root.google.protobuf.Any.verify(message.client_state); - if (error) - return "client_state." + error; - } - if (message.proof_height != null && message.hasOwnProperty("proof_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); - if (error) - return "proof_height." + error; - } - if (message.proof_try != null && message.hasOwnProperty("proof_try")) - if (!(message.proof_try && typeof message.proof_try.length === "number" || $util.isString(message.proof_try))) - return "proof_try: buffer expected"; - if (message.proof_client != null && message.hasOwnProperty("proof_client")) - if (!(message.proof_client && typeof message.proof_client.length === "number" || $util.isString(message.proof_client))) - return "proof_client: buffer expected"; - if (message.proof_consensus != null && message.hasOwnProperty("proof_consensus")) - if (!(message.proof_consensus && typeof message.proof_consensus.length === "number" || $util.isString(message.proof_consensus))) - return "proof_consensus: buffer expected"; - if (message.consensus_height != null && message.hasOwnProperty("consensus_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.consensus_height); - if (error) - return "consensus_height." + error; - } - if (message.signer != null && message.hasOwnProperty("signer")) - if (!$util.isString(message.signer)) - return "signer: string expected"; - return null; - }; - - /** - * Creates a MsgConnectionOpenAck message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.connection.v1.MsgConnectionOpenAck - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.connection.v1.MsgConnectionOpenAck} MsgConnectionOpenAck - */ - MsgConnectionOpenAck.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.connection.v1.MsgConnectionOpenAck) - return object; - let message = new $root.ibc.core.connection.v1.MsgConnectionOpenAck(); - if (object.connection_id != null) - message.connection_id = String(object.connection_id); - if (object.counterparty_connection_id != null) - message.counterparty_connection_id = String(object.counterparty_connection_id); - if (object.version != null) { - if (typeof object.version !== "object") - throw TypeError(".ibc.core.connection.v1.MsgConnectionOpenAck.version: object expected"); - message.version = $root.ibc.core.connection.v1.Version.fromObject(object.version); - } - if (object.client_state != null) { - if (typeof object.client_state !== "object") - throw TypeError(".ibc.core.connection.v1.MsgConnectionOpenAck.client_state: object expected"); - message.client_state = $root.google.protobuf.Any.fromObject(object.client_state); - } - if (object.proof_height != null) { - if (typeof object.proof_height !== "object") - throw TypeError(".ibc.core.connection.v1.MsgConnectionOpenAck.proof_height: object expected"); - message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); - } - if (object.proof_try != null) - if (typeof object.proof_try === "string") - $util.base64.decode(object.proof_try, message.proof_try = $util.newBuffer($util.base64.length(object.proof_try)), 0); - else if (object.proof_try.length) - message.proof_try = object.proof_try; - if (object.proof_client != null) - if (typeof object.proof_client === "string") - $util.base64.decode(object.proof_client, message.proof_client = $util.newBuffer($util.base64.length(object.proof_client)), 0); - else if (object.proof_client.length) - message.proof_client = object.proof_client; - if (object.proof_consensus != null) - if (typeof object.proof_consensus === "string") - $util.base64.decode(object.proof_consensus, message.proof_consensus = $util.newBuffer($util.base64.length(object.proof_consensus)), 0); - else if (object.proof_consensus.length) - message.proof_consensus = object.proof_consensus; - if (object.consensus_height != null) { - if (typeof object.consensus_height !== "object") - throw TypeError(".ibc.core.connection.v1.MsgConnectionOpenAck.consensus_height: object expected"); - message.consensus_height = $root.ibc.core.client.v1.Height.fromObject(object.consensus_height); - } - if (object.signer != null) - message.signer = String(object.signer); - return message; - }; - - /** - * Creates a plain object from a MsgConnectionOpenAck message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.connection.v1.MsgConnectionOpenAck - * @static - * @param {ibc.core.connection.v1.MsgConnectionOpenAck} message MsgConnectionOpenAck - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgConnectionOpenAck.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.connection_id = ""; - object.counterparty_connection_id = ""; - object.version = null; - object.client_state = null; - object.proof_height = null; - if (options.bytes === String) - object.proof_try = ""; - else { - object.proof_try = []; - if (options.bytes !== Array) - object.proof_try = $util.newBuffer(object.proof_try); - } - if (options.bytes === String) - object.proof_client = ""; - else { - object.proof_client = []; - if (options.bytes !== Array) - object.proof_client = $util.newBuffer(object.proof_client); - } - if (options.bytes === String) - object.proof_consensus = ""; - else { - object.proof_consensus = []; - if (options.bytes !== Array) - object.proof_consensus = $util.newBuffer(object.proof_consensus); - } - object.consensus_height = null; - object.signer = ""; - } - if (message.connection_id != null && message.hasOwnProperty("connection_id")) - object.connection_id = message.connection_id; - if (message.counterparty_connection_id != null && message.hasOwnProperty("counterparty_connection_id")) - object.counterparty_connection_id = message.counterparty_connection_id; - if (message.version != null && message.hasOwnProperty("version")) - object.version = $root.ibc.core.connection.v1.Version.toObject(message.version, options); - if (message.client_state != null && message.hasOwnProperty("client_state")) - object.client_state = $root.google.protobuf.Any.toObject(message.client_state, options); - if (message.proof_height != null && message.hasOwnProperty("proof_height")) - object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); - if (message.proof_try != null && message.hasOwnProperty("proof_try")) - object.proof_try = options.bytes === String ? $util.base64.encode(message.proof_try, 0, message.proof_try.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_try) : message.proof_try; - if (message.proof_client != null && message.hasOwnProperty("proof_client")) - object.proof_client = options.bytes === String ? $util.base64.encode(message.proof_client, 0, message.proof_client.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_client) : message.proof_client; - if (message.proof_consensus != null && message.hasOwnProperty("proof_consensus")) - object.proof_consensus = options.bytes === String ? $util.base64.encode(message.proof_consensus, 0, message.proof_consensus.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_consensus) : message.proof_consensus; - if (message.consensus_height != null && message.hasOwnProperty("consensus_height")) - object.consensus_height = $root.ibc.core.client.v1.Height.toObject(message.consensus_height, options); - if (message.signer != null && message.hasOwnProperty("signer")) - object.signer = message.signer; - return object; - }; - - /** - * Converts this MsgConnectionOpenAck to JSON. - * @function toJSON - * @memberof ibc.core.connection.v1.MsgConnectionOpenAck - * @instance - * @returns {Object.} JSON object - */ - MsgConnectionOpenAck.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgConnectionOpenAck; - })(); - - v1.MsgConnectionOpenAckResponse = (function() { - - /** - * Properties of a MsgConnectionOpenAckResponse. - * @memberof ibc.core.connection.v1 - * @interface IMsgConnectionOpenAckResponse - */ - - /** - * Constructs a new MsgConnectionOpenAckResponse. - * @memberof ibc.core.connection.v1 - * @classdesc Represents a MsgConnectionOpenAckResponse. - * @implements IMsgConnectionOpenAckResponse - * @constructor - * @param {ibc.core.connection.v1.IMsgConnectionOpenAckResponse=} [properties] Properties to set - */ - function MsgConnectionOpenAckResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgConnectionOpenAckResponse message. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenAckResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.connection.v1.MsgConnectionOpenAckResponse - * @static - * @param {ibc.core.connection.v1.IMsgConnectionOpenAckResponse} message MsgConnectionOpenAckResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgConnectionOpenAckResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgConnectionOpenAckResponse message, length delimited. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenAckResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.connection.v1.MsgConnectionOpenAckResponse - * @static - * @param {ibc.core.connection.v1.IMsgConnectionOpenAckResponse} message MsgConnectionOpenAckResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgConnectionOpenAckResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgConnectionOpenAckResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.connection.v1.MsgConnectionOpenAckResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.connection.v1.MsgConnectionOpenAckResponse} MsgConnectionOpenAckResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgConnectionOpenAckResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.MsgConnectionOpenAckResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgConnectionOpenAckResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.connection.v1.MsgConnectionOpenAckResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.connection.v1.MsgConnectionOpenAckResponse} MsgConnectionOpenAckResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgConnectionOpenAckResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgConnectionOpenAckResponse message. - * @function verify - * @memberof ibc.core.connection.v1.MsgConnectionOpenAckResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgConnectionOpenAckResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgConnectionOpenAckResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.connection.v1.MsgConnectionOpenAckResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.connection.v1.MsgConnectionOpenAckResponse} MsgConnectionOpenAckResponse - */ - MsgConnectionOpenAckResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.connection.v1.MsgConnectionOpenAckResponse) - return object; - return new $root.ibc.core.connection.v1.MsgConnectionOpenAckResponse(); - }; - - /** - * Creates a plain object from a MsgConnectionOpenAckResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.connection.v1.MsgConnectionOpenAckResponse - * @static - * @param {ibc.core.connection.v1.MsgConnectionOpenAckResponse} message MsgConnectionOpenAckResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgConnectionOpenAckResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgConnectionOpenAckResponse to JSON. - * @function toJSON - * @memberof ibc.core.connection.v1.MsgConnectionOpenAckResponse - * @instance - * @returns {Object.} JSON object - */ - MsgConnectionOpenAckResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgConnectionOpenAckResponse; - })(); - - v1.MsgConnectionOpenConfirm = (function() { - - /** - * Properties of a MsgConnectionOpenConfirm. - * @memberof ibc.core.connection.v1 - * @interface IMsgConnectionOpenConfirm - * @property {string|null} [connection_id] MsgConnectionOpenConfirm connection_id - * @property {Uint8Array|null} [proof_ack] MsgConnectionOpenConfirm proof_ack - * @property {ibc.core.client.v1.IHeight|null} [proof_height] MsgConnectionOpenConfirm proof_height - * @property {string|null} [signer] MsgConnectionOpenConfirm signer - */ - - /** - * Constructs a new MsgConnectionOpenConfirm. - * @memberof ibc.core.connection.v1 - * @classdesc Represents a MsgConnectionOpenConfirm. - * @implements IMsgConnectionOpenConfirm - * @constructor - * @param {ibc.core.connection.v1.IMsgConnectionOpenConfirm=} [properties] Properties to set - */ - function MsgConnectionOpenConfirm(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MsgConnectionOpenConfirm connection_id. - * @member {string} connection_id - * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirm - * @instance - */ - MsgConnectionOpenConfirm.prototype.connection_id = ""; - - /** - * MsgConnectionOpenConfirm proof_ack. - * @member {Uint8Array} proof_ack - * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirm - * @instance - */ - MsgConnectionOpenConfirm.prototype.proof_ack = $util.newBuffer([]); - - /** - * MsgConnectionOpenConfirm proof_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height - * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirm - * @instance - */ - MsgConnectionOpenConfirm.prototype.proof_height = null; - - /** - * MsgConnectionOpenConfirm signer. - * @member {string} signer - * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirm - * @instance - */ - MsgConnectionOpenConfirm.prototype.signer = ""; - - /** - * Encodes the specified MsgConnectionOpenConfirm message. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenConfirm.verify|verify} messages. - * @function encode - * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirm - * @static - * @param {ibc.core.connection.v1.IMsgConnectionOpenConfirm} message MsgConnectionOpenConfirm message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgConnectionOpenConfirm.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.connection_id != null && Object.hasOwnProperty.call(message, "connection_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.connection_id); - if (message.proof_ack != null && Object.hasOwnProperty.call(message, "proof_ack")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proof_ack); - if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) - $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.signer != null && Object.hasOwnProperty.call(message, "signer")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.signer); - return writer; - }; - - /** - * Encodes the specified MsgConnectionOpenConfirm message, length delimited. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenConfirm.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirm - * @static - * @param {ibc.core.connection.v1.IMsgConnectionOpenConfirm} message MsgConnectionOpenConfirm message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgConnectionOpenConfirm.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgConnectionOpenConfirm message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirm - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.connection.v1.MsgConnectionOpenConfirm} MsgConnectionOpenConfirm - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgConnectionOpenConfirm.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.MsgConnectionOpenConfirm(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.connection_id = reader.string(); - break; - case 2: - message.proof_ack = reader.bytes(); - break; - case 3: - message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - case 4: - message.signer = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgConnectionOpenConfirm message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirm - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.connection.v1.MsgConnectionOpenConfirm} MsgConnectionOpenConfirm - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgConnectionOpenConfirm.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgConnectionOpenConfirm message. - * @function verify - * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirm - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgConnectionOpenConfirm.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.connection_id != null && message.hasOwnProperty("connection_id")) - if (!$util.isString(message.connection_id)) - return "connection_id: string expected"; - if (message.proof_ack != null && message.hasOwnProperty("proof_ack")) - if (!(message.proof_ack && typeof message.proof_ack.length === "number" || $util.isString(message.proof_ack))) - return "proof_ack: buffer expected"; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); - if (error) - return "proof_height." + error; - } - if (message.signer != null && message.hasOwnProperty("signer")) - if (!$util.isString(message.signer)) - return "signer: string expected"; - return null; - }; - - /** - * Creates a MsgConnectionOpenConfirm message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirm - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.connection.v1.MsgConnectionOpenConfirm} MsgConnectionOpenConfirm - */ - MsgConnectionOpenConfirm.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.connection.v1.MsgConnectionOpenConfirm) - return object; - let message = new $root.ibc.core.connection.v1.MsgConnectionOpenConfirm(); - if (object.connection_id != null) - message.connection_id = String(object.connection_id); - if (object.proof_ack != null) - if (typeof object.proof_ack === "string") - $util.base64.decode(object.proof_ack, message.proof_ack = $util.newBuffer($util.base64.length(object.proof_ack)), 0); - else if (object.proof_ack.length) - message.proof_ack = object.proof_ack; - if (object.proof_height != null) { - if (typeof object.proof_height !== "object") - throw TypeError(".ibc.core.connection.v1.MsgConnectionOpenConfirm.proof_height: object expected"); - message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); - } - if (object.signer != null) - message.signer = String(object.signer); - return message; - }; - - /** - * Creates a plain object from a MsgConnectionOpenConfirm message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirm - * @static - * @param {ibc.core.connection.v1.MsgConnectionOpenConfirm} message MsgConnectionOpenConfirm - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgConnectionOpenConfirm.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.connection_id = ""; - if (options.bytes === String) - object.proof_ack = ""; - else { - object.proof_ack = []; - if (options.bytes !== Array) - object.proof_ack = $util.newBuffer(object.proof_ack); - } - object.proof_height = null; - object.signer = ""; - } - if (message.connection_id != null && message.hasOwnProperty("connection_id")) - object.connection_id = message.connection_id; - if (message.proof_ack != null && message.hasOwnProperty("proof_ack")) - object.proof_ack = options.bytes === String ? $util.base64.encode(message.proof_ack, 0, message.proof_ack.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof_ack) : message.proof_ack; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) - object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); - if (message.signer != null && message.hasOwnProperty("signer")) - object.signer = message.signer; - return object; - }; - - /** - * Converts this MsgConnectionOpenConfirm to JSON. - * @function toJSON - * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirm - * @instance - * @returns {Object.} JSON object - */ - MsgConnectionOpenConfirm.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgConnectionOpenConfirm; - })(); - - v1.MsgConnectionOpenConfirmResponse = (function() { - - /** - * Properties of a MsgConnectionOpenConfirmResponse. - * @memberof ibc.core.connection.v1 - * @interface IMsgConnectionOpenConfirmResponse - */ - - /** - * Constructs a new MsgConnectionOpenConfirmResponse. - * @memberof ibc.core.connection.v1 - * @classdesc Represents a MsgConnectionOpenConfirmResponse. - * @implements IMsgConnectionOpenConfirmResponse - * @constructor - * @param {ibc.core.connection.v1.IMsgConnectionOpenConfirmResponse=} [properties] Properties to set - */ - function MsgConnectionOpenConfirmResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified MsgConnectionOpenConfirmResponse message. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenConfirmResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirmResponse - * @static - * @param {ibc.core.connection.v1.IMsgConnectionOpenConfirmResponse} message MsgConnectionOpenConfirmResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgConnectionOpenConfirmResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified MsgConnectionOpenConfirmResponse message, length delimited. Does not implicitly {@link ibc.core.connection.v1.MsgConnectionOpenConfirmResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirmResponse - * @static - * @param {ibc.core.connection.v1.IMsgConnectionOpenConfirmResponse} message MsgConnectionOpenConfirmResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MsgConnectionOpenConfirmResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MsgConnectionOpenConfirmResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirmResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.connection.v1.MsgConnectionOpenConfirmResponse} MsgConnectionOpenConfirmResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgConnectionOpenConfirmResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.MsgConnectionOpenConfirmResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MsgConnectionOpenConfirmResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirmResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.connection.v1.MsgConnectionOpenConfirmResponse} MsgConnectionOpenConfirmResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MsgConnectionOpenConfirmResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MsgConnectionOpenConfirmResponse message. - * @function verify - * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirmResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MsgConnectionOpenConfirmResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a MsgConnectionOpenConfirmResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirmResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.connection.v1.MsgConnectionOpenConfirmResponse} MsgConnectionOpenConfirmResponse - */ - MsgConnectionOpenConfirmResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.connection.v1.MsgConnectionOpenConfirmResponse) - return object; - return new $root.ibc.core.connection.v1.MsgConnectionOpenConfirmResponse(); - }; - - /** - * Creates a plain object from a MsgConnectionOpenConfirmResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirmResponse - * @static - * @param {ibc.core.connection.v1.MsgConnectionOpenConfirmResponse} message MsgConnectionOpenConfirmResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MsgConnectionOpenConfirmResponse.toObject = function toObject() { - return {}; - }; - - /** - * Converts this MsgConnectionOpenConfirmResponse to JSON. - * @function toJSON - * @memberof ibc.core.connection.v1.MsgConnectionOpenConfirmResponse - * @instance - * @returns {Object.} JSON object - */ - MsgConnectionOpenConfirmResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return MsgConnectionOpenConfirmResponse; - })(); - - v1.Query = (function() { - - /** - * Constructs a new Query service. - * @memberof ibc.core.connection.v1 - * @classdesc Represents a Query - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function Query(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Query.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Query; - - /** - * Callback as used by {@link ibc.core.connection.v1.Query#connection}. - * @memberof ibc.core.connection.v1.Query - * @typedef ConnectionCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.connection.v1.QueryConnectionResponse} [response] QueryConnectionResponse - */ - - /** - * Calls Connection. - * @function connection - * @memberof ibc.core.connection.v1.Query - * @instance - * @param {ibc.core.connection.v1.IQueryConnectionRequest} request QueryConnectionRequest message or plain object - * @param {ibc.core.connection.v1.Query.ConnectionCallback} callback Node-style callback called with the error, if any, and QueryConnectionResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.connection = function connection(request, callback) { - return this.rpcCall(connection, $root.ibc.core.connection.v1.QueryConnectionRequest, $root.ibc.core.connection.v1.QueryConnectionResponse, request, callback); - }, "name", { value: "Connection" }); - - /** - * Calls Connection. - * @function connection - * @memberof ibc.core.connection.v1.Query - * @instance - * @param {ibc.core.connection.v1.IQueryConnectionRequest} request QueryConnectionRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.connection.v1.Query#connections}. - * @memberof ibc.core.connection.v1.Query - * @typedef ConnectionsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.connection.v1.QueryConnectionsResponse} [response] QueryConnectionsResponse - */ - - /** - * Calls Connections. - * @function connections - * @memberof ibc.core.connection.v1.Query - * @instance - * @param {ibc.core.connection.v1.IQueryConnectionsRequest} request QueryConnectionsRequest message or plain object - * @param {ibc.core.connection.v1.Query.ConnectionsCallback} callback Node-style callback called with the error, if any, and QueryConnectionsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.connections = function connections(request, callback) { - return this.rpcCall(connections, $root.ibc.core.connection.v1.QueryConnectionsRequest, $root.ibc.core.connection.v1.QueryConnectionsResponse, request, callback); - }, "name", { value: "Connections" }); - - /** - * Calls Connections. - * @function connections - * @memberof ibc.core.connection.v1.Query - * @instance - * @param {ibc.core.connection.v1.IQueryConnectionsRequest} request QueryConnectionsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.connection.v1.Query#clientConnections}. - * @memberof ibc.core.connection.v1.Query - * @typedef ClientConnectionsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.connection.v1.QueryClientConnectionsResponse} [response] QueryClientConnectionsResponse - */ - - /** - * Calls ClientConnections. - * @function clientConnections - * @memberof ibc.core.connection.v1.Query - * @instance - * @param {ibc.core.connection.v1.IQueryClientConnectionsRequest} request QueryClientConnectionsRequest message or plain object - * @param {ibc.core.connection.v1.Query.ClientConnectionsCallback} callback Node-style callback called with the error, if any, and QueryClientConnectionsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.clientConnections = function clientConnections(request, callback) { - return this.rpcCall(clientConnections, $root.ibc.core.connection.v1.QueryClientConnectionsRequest, $root.ibc.core.connection.v1.QueryClientConnectionsResponse, request, callback); - }, "name", { value: "ClientConnections" }); - - /** - * Calls ClientConnections. - * @function clientConnections - * @memberof ibc.core.connection.v1.Query - * @instance - * @param {ibc.core.connection.v1.IQueryClientConnectionsRequest} request QueryClientConnectionsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.connection.v1.Query#connectionClientState}. - * @memberof ibc.core.connection.v1.Query - * @typedef ConnectionClientStateCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.connection.v1.QueryConnectionClientStateResponse} [response] QueryConnectionClientStateResponse - */ - - /** - * Calls ConnectionClientState. - * @function connectionClientState - * @memberof ibc.core.connection.v1.Query - * @instance - * @param {ibc.core.connection.v1.IQueryConnectionClientStateRequest} request QueryConnectionClientStateRequest message or plain object - * @param {ibc.core.connection.v1.Query.ConnectionClientStateCallback} callback Node-style callback called with the error, if any, and QueryConnectionClientStateResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.connectionClientState = function connectionClientState(request, callback) { - return this.rpcCall(connectionClientState, $root.ibc.core.connection.v1.QueryConnectionClientStateRequest, $root.ibc.core.connection.v1.QueryConnectionClientStateResponse, request, callback); - }, "name", { value: "ConnectionClientState" }); - - /** - * Calls ConnectionClientState. - * @function connectionClientState - * @memberof ibc.core.connection.v1.Query - * @instance - * @param {ibc.core.connection.v1.IQueryConnectionClientStateRequest} request QueryConnectionClientStateRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link ibc.core.connection.v1.Query#connectionConsensusState}. - * @memberof ibc.core.connection.v1.Query - * @typedef ConnectionConsensusStateCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {ibc.core.connection.v1.QueryConnectionConsensusStateResponse} [response] QueryConnectionConsensusStateResponse - */ - - /** - * Calls ConnectionConsensusState. - * @function connectionConsensusState - * @memberof ibc.core.connection.v1.Query - * @instance - * @param {ibc.core.connection.v1.IQueryConnectionConsensusStateRequest} request QueryConnectionConsensusStateRequest message or plain object - * @param {ibc.core.connection.v1.Query.ConnectionConsensusStateCallback} callback Node-style callback called with the error, if any, and QueryConnectionConsensusStateResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(Query.prototype.connectionConsensusState = function connectionConsensusState(request, callback) { - return this.rpcCall(connectionConsensusState, $root.ibc.core.connection.v1.QueryConnectionConsensusStateRequest, $root.ibc.core.connection.v1.QueryConnectionConsensusStateResponse, request, callback); - }, "name", { value: "ConnectionConsensusState" }); - - /** - * Calls ConnectionConsensusState. - * @function connectionConsensusState - * @memberof ibc.core.connection.v1.Query - * @instance - * @param {ibc.core.connection.v1.IQueryConnectionConsensusStateRequest} request QueryConnectionConsensusStateRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return Query; - })(); - - v1.QueryConnectionRequest = (function() { - - /** - * Properties of a QueryConnectionRequest. - * @memberof ibc.core.connection.v1 - * @interface IQueryConnectionRequest - * @property {string|null} [connection_id] QueryConnectionRequest connection_id - */ - - /** - * Constructs a new QueryConnectionRequest. - * @memberof ibc.core.connection.v1 - * @classdesc Represents a QueryConnectionRequest. - * @implements IQueryConnectionRequest - * @constructor - * @param {ibc.core.connection.v1.IQueryConnectionRequest=} [properties] Properties to set - */ - function QueryConnectionRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryConnectionRequest connection_id. - * @member {string} connection_id - * @memberof ibc.core.connection.v1.QueryConnectionRequest - * @instance - */ - QueryConnectionRequest.prototype.connection_id = ""; - - /** - * Encodes the specified QueryConnectionRequest message. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionRequest.verify|verify} messages. - * @function encode - * @memberof ibc.core.connection.v1.QueryConnectionRequest - * @static - * @param {ibc.core.connection.v1.IQueryConnectionRequest} message QueryConnectionRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryConnectionRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.connection_id != null && Object.hasOwnProperty.call(message, "connection_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.connection_id); - return writer; - }; - - /** - * Encodes the specified QueryConnectionRequest message, length delimited. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.connection.v1.QueryConnectionRequest - * @static - * @param {ibc.core.connection.v1.IQueryConnectionRequest} message QueryConnectionRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryConnectionRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryConnectionRequest message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.connection.v1.QueryConnectionRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.connection.v1.QueryConnectionRequest} QueryConnectionRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryConnectionRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.QueryConnectionRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.connection_id = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryConnectionRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.connection.v1.QueryConnectionRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.connection.v1.QueryConnectionRequest} QueryConnectionRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryConnectionRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryConnectionRequest message. - * @function verify - * @memberof ibc.core.connection.v1.QueryConnectionRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryConnectionRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.connection_id != null && message.hasOwnProperty("connection_id")) - if (!$util.isString(message.connection_id)) - return "connection_id: string expected"; - return null; - }; - - /** - * Creates a QueryConnectionRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.connection.v1.QueryConnectionRequest - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.connection.v1.QueryConnectionRequest} QueryConnectionRequest - */ - QueryConnectionRequest.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.connection.v1.QueryConnectionRequest) - return object; - let message = new $root.ibc.core.connection.v1.QueryConnectionRequest(); - if (object.connection_id != null) - message.connection_id = String(object.connection_id); - return message; - }; - - /** - * Creates a plain object from a QueryConnectionRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.connection.v1.QueryConnectionRequest - * @static - * @param {ibc.core.connection.v1.QueryConnectionRequest} message QueryConnectionRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryConnectionRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.connection_id = ""; - if (message.connection_id != null && message.hasOwnProperty("connection_id")) - object.connection_id = message.connection_id; - return object; - }; - - /** - * Converts this QueryConnectionRequest to JSON. - * @function toJSON - * @memberof ibc.core.connection.v1.QueryConnectionRequest - * @instance - * @returns {Object.} JSON object - */ - QueryConnectionRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryConnectionRequest; - })(); - - v1.QueryConnectionResponse = (function() { - - /** - * Properties of a QueryConnectionResponse. - * @memberof ibc.core.connection.v1 - * @interface IQueryConnectionResponse - * @property {ibc.core.connection.v1.IConnectionEnd|null} [connection] QueryConnectionResponse connection - * @property {Uint8Array|null} [proof] QueryConnectionResponse proof - * @property {ibc.core.client.v1.IHeight|null} [proof_height] QueryConnectionResponse proof_height - */ - - /** - * Constructs a new QueryConnectionResponse. - * @memberof ibc.core.connection.v1 - * @classdesc Represents a QueryConnectionResponse. - * @implements IQueryConnectionResponse - * @constructor - * @param {ibc.core.connection.v1.IQueryConnectionResponse=} [properties] Properties to set - */ - function QueryConnectionResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryConnectionResponse connection. - * @member {ibc.core.connection.v1.IConnectionEnd|null|undefined} connection - * @memberof ibc.core.connection.v1.QueryConnectionResponse - * @instance - */ - QueryConnectionResponse.prototype.connection = null; - - /** - * QueryConnectionResponse proof. - * @member {Uint8Array} proof - * @memberof ibc.core.connection.v1.QueryConnectionResponse - * @instance - */ - QueryConnectionResponse.prototype.proof = $util.newBuffer([]); - - /** - * QueryConnectionResponse proof_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height - * @memberof ibc.core.connection.v1.QueryConnectionResponse - * @instance - */ - QueryConnectionResponse.prototype.proof_height = null; - - /** - * Encodes the specified QueryConnectionResponse message. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.connection.v1.QueryConnectionResponse - * @static - * @param {ibc.core.connection.v1.IQueryConnectionResponse} message QueryConnectionResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryConnectionResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.connection != null && Object.hasOwnProperty.call(message, "connection")) - $root.ibc.core.connection.v1.ConnectionEnd.encode(message.connection, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proof); - if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) - $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryConnectionResponse message, length delimited. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.connection.v1.QueryConnectionResponse - * @static - * @param {ibc.core.connection.v1.IQueryConnectionResponse} message QueryConnectionResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryConnectionResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryConnectionResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.connection.v1.QueryConnectionResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.connection.v1.QueryConnectionResponse} QueryConnectionResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryConnectionResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.QueryConnectionResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.connection = $root.ibc.core.connection.v1.ConnectionEnd.decode(reader, reader.uint32()); - break; - case 2: - message.proof = reader.bytes(); - break; - case 3: - message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryConnectionResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.connection.v1.QueryConnectionResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.connection.v1.QueryConnectionResponse} QueryConnectionResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryConnectionResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryConnectionResponse message. - * @function verify - * @memberof ibc.core.connection.v1.QueryConnectionResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryConnectionResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.connection != null && message.hasOwnProperty("connection")) { - let error = $root.ibc.core.connection.v1.ConnectionEnd.verify(message.connection); - if (error) - return "connection." + error; - } - if (message.proof != null && message.hasOwnProperty("proof")) - if (!(message.proof && typeof message.proof.length === "number" || $util.isString(message.proof))) - return "proof: buffer expected"; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); - if (error) - return "proof_height." + error; - } - return null; - }; - - /** - * Creates a QueryConnectionResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.connection.v1.QueryConnectionResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.connection.v1.QueryConnectionResponse} QueryConnectionResponse - */ - QueryConnectionResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.connection.v1.QueryConnectionResponse) - return object; - let message = new $root.ibc.core.connection.v1.QueryConnectionResponse(); - if (object.connection != null) { - if (typeof object.connection !== "object") - throw TypeError(".ibc.core.connection.v1.QueryConnectionResponse.connection: object expected"); - message.connection = $root.ibc.core.connection.v1.ConnectionEnd.fromObject(object.connection); - } - if (object.proof != null) - if (typeof object.proof === "string") - $util.base64.decode(object.proof, message.proof = $util.newBuffer($util.base64.length(object.proof)), 0); - else if (object.proof.length) - message.proof = object.proof; - if (object.proof_height != null) { - if (typeof object.proof_height !== "object") - throw TypeError(".ibc.core.connection.v1.QueryConnectionResponse.proof_height: object expected"); - message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); - } - return message; - }; - - /** - * Creates a plain object from a QueryConnectionResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.connection.v1.QueryConnectionResponse - * @static - * @param {ibc.core.connection.v1.QueryConnectionResponse} message QueryConnectionResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryConnectionResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.connection = null; - if (options.bytes === String) - object.proof = ""; - else { - object.proof = []; - if (options.bytes !== Array) - object.proof = $util.newBuffer(object.proof); - } - object.proof_height = null; - } - if (message.connection != null && message.hasOwnProperty("connection")) - object.connection = $root.ibc.core.connection.v1.ConnectionEnd.toObject(message.connection, options); - if (message.proof != null && message.hasOwnProperty("proof")) - object.proof = options.bytes === String ? $util.base64.encode(message.proof, 0, message.proof.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof) : message.proof; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) - object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); - return object; - }; - - /** - * Converts this QueryConnectionResponse to JSON. - * @function toJSON - * @memberof ibc.core.connection.v1.QueryConnectionResponse - * @instance - * @returns {Object.} JSON object - */ - QueryConnectionResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryConnectionResponse; - })(); - - v1.QueryConnectionsRequest = (function() { - - /** - * Properties of a QueryConnectionsRequest. - * @memberof ibc.core.connection.v1 - * @interface IQueryConnectionsRequest - * @property {cosmos.base.query.v1beta1.IPageRequest|null} [pagination] QueryConnectionsRequest pagination - */ - - /** - * Constructs a new QueryConnectionsRequest. - * @memberof ibc.core.connection.v1 - * @classdesc Represents a QueryConnectionsRequest. - * @implements IQueryConnectionsRequest - * @constructor - * @param {ibc.core.connection.v1.IQueryConnectionsRequest=} [properties] Properties to set - */ - function QueryConnectionsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryConnectionsRequest pagination. - * @member {cosmos.base.query.v1beta1.IPageRequest|null|undefined} pagination - * @memberof ibc.core.connection.v1.QueryConnectionsRequest - * @instance - */ - QueryConnectionsRequest.prototype.pagination = null; - - /** - * Encodes the specified QueryConnectionsRequest message. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionsRequest.verify|verify} messages. - * @function encode - * @memberof ibc.core.connection.v1.QueryConnectionsRequest - * @static - * @param {ibc.core.connection.v1.IQueryConnectionsRequest} message QueryConnectionsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryConnectionsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageRequest.encode(message.pagination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryConnectionsRequest message, length delimited. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.connection.v1.QueryConnectionsRequest - * @static - * @param {ibc.core.connection.v1.IQueryConnectionsRequest} message QueryConnectionsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryConnectionsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryConnectionsRequest message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.connection.v1.QueryConnectionsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.connection.v1.QueryConnectionsRequest} QueryConnectionsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryConnectionsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.QueryConnectionsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryConnectionsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.connection.v1.QueryConnectionsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.connection.v1.QueryConnectionsRequest} QueryConnectionsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryConnectionsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryConnectionsRequest message. - * @function verify - * @memberof ibc.core.connection.v1.QueryConnectionsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryConnectionsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageRequest.verify(message.pagination); - if (error) - return "pagination." + error; - } - return null; - }; - - /** - * Creates a QueryConnectionsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.connection.v1.QueryConnectionsRequest - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.connection.v1.QueryConnectionsRequest} QueryConnectionsRequest - */ - QueryConnectionsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.connection.v1.QueryConnectionsRequest) - return object; - let message = new $root.ibc.core.connection.v1.QueryConnectionsRequest(); - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".ibc.core.connection.v1.QueryConnectionsRequest.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageRequest.fromObject(object.pagination); - } - return message; - }; - - /** - * Creates a plain object from a QueryConnectionsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.connection.v1.QueryConnectionsRequest - * @static - * @param {ibc.core.connection.v1.QueryConnectionsRequest} message QueryConnectionsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryConnectionsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.pagination = null; - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageRequest.toObject(message.pagination, options); - return object; - }; - - /** - * Converts this QueryConnectionsRequest to JSON. - * @function toJSON - * @memberof ibc.core.connection.v1.QueryConnectionsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryConnectionsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryConnectionsRequest; - })(); - - v1.QueryConnectionsResponse = (function() { - - /** - * Properties of a QueryConnectionsResponse. - * @memberof ibc.core.connection.v1 - * @interface IQueryConnectionsResponse - * @property {Array.|null} [connections] QueryConnectionsResponse connections - * @property {cosmos.base.query.v1beta1.IPageResponse|null} [pagination] QueryConnectionsResponse pagination - * @property {ibc.core.client.v1.IHeight|null} [height] QueryConnectionsResponse height - */ - - /** - * Constructs a new QueryConnectionsResponse. - * @memberof ibc.core.connection.v1 - * @classdesc Represents a QueryConnectionsResponse. - * @implements IQueryConnectionsResponse - * @constructor - * @param {ibc.core.connection.v1.IQueryConnectionsResponse=} [properties] Properties to set - */ - function QueryConnectionsResponse(properties) { - this.connections = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryConnectionsResponse connections. - * @member {Array.} connections - * @memberof ibc.core.connection.v1.QueryConnectionsResponse - * @instance - */ - QueryConnectionsResponse.prototype.connections = $util.emptyArray; - - /** - * QueryConnectionsResponse pagination. - * @member {cosmos.base.query.v1beta1.IPageResponse|null|undefined} pagination - * @memberof ibc.core.connection.v1.QueryConnectionsResponse - * @instance - */ - QueryConnectionsResponse.prototype.pagination = null; - - /** - * QueryConnectionsResponse height. - * @member {ibc.core.client.v1.IHeight|null|undefined} height - * @memberof ibc.core.connection.v1.QueryConnectionsResponse - * @instance - */ - QueryConnectionsResponse.prototype.height = null; - - /** - * Encodes the specified QueryConnectionsResponse message. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionsResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.connection.v1.QueryConnectionsResponse - * @static - * @param {ibc.core.connection.v1.IQueryConnectionsResponse} message QueryConnectionsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryConnectionsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.connections != null && message.connections.length) - for (let i = 0; i < message.connections.length; ++i) - $root.ibc.core.connection.v1.IdentifiedConnection.encode(message.connections[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.pagination != null && Object.hasOwnProperty.call(message, "pagination")) - $root.cosmos.base.query.v1beta1.PageResponse.encode(message.pagination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - $root.ibc.core.client.v1.Height.encode(message.height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryConnectionsResponse message, length delimited. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.connection.v1.QueryConnectionsResponse - * @static - * @param {ibc.core.connection.v1.IQueryConnectionsResponse} message QueryConnectionsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryConnectionsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryConnectionsResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.connection.v1.QueryConnectionsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.connection.v1.QueryConnectionsResponse} QueryConnectionsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryConnectionsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.QueryConnectionsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.connections && message.connections.length)) - message.connections = []; - message.connections.push($root.ibc.core.connection.v1.IdentifiedConnection.decode(reader, reader.uint32())); - break; - case 2: - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.decode(reader, reader.uint32()); - break; - case 3: - message.height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryConnectionsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.connection.v1.QueryConnectionsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.connection.v1.QueryConnectionsResponse} QueryConnectionsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryConnectionsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryConnectionsResponse message. - * @function verify - * @memberof ibc.core.connection.v1.QueryConnectionsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryConnectionsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.connections != null && message.hasOwnProperty("connections")) { - if (!Array.isArray(message.connections)) - return "connections: array expected"; - for (let i = 0; i < message.connections.length; ++i) { - let error = $root.ibc.core.connection.v1.IdentifiedConnection.verify(message.connections[i]); - if (error) - return "connections." + error; - } - } - if (message.pagination != null && message.hasOwnProperty("pagination")) { - let error = $root.cosmos.base.query.v1beta1.PageResponse.verify(message.pagination); - if (error) - return "pagination." + error; - } - if (message.height != null && message.hasOwnProperty("height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.height); - if (error) - return "height." + error; - } - return null; - }; - - /** - * Creates a QueryConnectionsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.connection.v1.QueryConnectionsResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.connection.v1.QueryConnectionsResponse} QueryConnectionsResponse - */ - QueryConnectionsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.connection.v1.QueryConnectionsResponse) - return object; - let message = new $root.ibc.core.connection.v1.QueryConnectionsResponse(); - if (object.connections) { - if (!Array.isArray(object.connections)) - throw TypeError(".ibc.core.connection.v1.QueryConnectionsResponse.connections: array expected"); - message.connections = []; - for (let i = 0; i < object.connections.length; ++i) { - if (typeof object.connections[i] !== "object") - throw TypeError(".ibc.core.connection.v1.QueryConnectionsResponse.connections: object expected"); - message.connections[i] = $root.ibc.core.connection.v1.IdentifiedConnection.fromObject(object.connections[i]); - } - } - if (object.pagination != null) { - if (typeof object.pagination !== "object") - throw TypeError(".ibc.core.connection.v1.QueryConnectionsResponse.pagination: object expected"); - message.pagination = $root.cosmos.base.query.v1beta1.PageResponse.fromObject(object.pagination); - } - if (object.height != null) { - if (typeof object.height !== "object") - throw TypeError(".ibc.core.connection.v1.QueryConnectionsResponse.height: object expected"); - message.height = $root.ibc.core.client.v1.Height.fromObject(object.height); - } - return message; - }; - - /** - * Creates a plain object from a QueryConnectionsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.connection.v1.QueryConnectionsResponse - * @static - * @param {ibc.core.connection.v1.QueryConnectionsResponse} message QueryConnectionsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryConnectionsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.connections = []; - if (options.defaults) { - object.pagination = null; - object.height = null; - } - if (message.connections && message.connections.length) { - object.connections = []; - for (let j = 0; j < message.connections.length; ++j) - object.connections[j] = $root.ibc.core.connection.v1.IdentifiedConnection.toObject(message.connections[j], options); - } - if (message.pagination != null && message.hasOwnProperty("pagination")) - object.pagination = $root.cosmos.base.query.v1beta1.PageResponse.toObject(message.pagination, options); - if (message.height != null && message.hasOwnProperty("height")) - object.height = $root.ibc.core.client.v1.Height.toObject(message.height, options); - return object; - }; - - /** - * Converts this QueryConnectionsResponse to JSON. - * @function toJSON - * @memberof ibc.core.connection.v1.QueryConnectionsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryConnectionsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryConnectionsResponse; - })(); - - v1.QueryClientConnectionsRequest = (function() { - - /** - * Properties of a QueryClientConnectionsRequest. - * @memberof ibc.core.connection.v1 - * @interface IQueryClientConnectionsRequest - * @property {string|null} [client_id] QueryClientConnectionsRequest client_id - */ - - /** - * Constructs a new QueryClientConnectionsRequest. - * @memberof ibc.core.connection.v1 - * @classdesc Represents a QueryClientConnectionsRequest. - * @implements IQueryClientConnectionsRequest - * @constructor - * @param {ibc.core.connection.v1.IQueryClientConnectionsRequest=} [properties] Properties to set - */ - function QueryClientConnectionsRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryClientConnectionsRequest client_id. - * @member {string} client_id - * @memberof ibc.core.connection.v1.QueryClientConnectionsRequest - * @instance - */ - QueryClientConnectionsRequest.prototype.client_id = ""; - - /** - * Encodes the specified QueryClientConnectionsRequest message. Does not implicitly {@link ibc.core.connection.v1.QueryClientConnectionsRequest.verify|verify} messages. - * @function encode - * @memberof ibc.core.connection.v1.QueryClientConnectionsRequest - * @static - * @param {ibc.core.connection.v1.IQueryClientConnectionsRequest} message QueryClientConnectionsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryClientConnectionsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); - return writer; - }; - - /** - * Encodes the specified QueryClientConnectionsRequest message, length delimited. Does not implicitly {@link ibc.core.connection.v1.QueryClientConnectionsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.connection.v1.QueryClientConnectionsRequest - * @static - * @param {ibc.core.connection.v1.IQueryClientConnectionsRequest} message QueryClientConnectionsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryClientConnectionsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryClientConnectionsRequest message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.connection.v1.QueryClientConnectionsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.connection.v1.QueryClientConnectionsRequest} QueryClientConnectionsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryClientConnectionsRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.QueryClientConnectionsRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.client_id = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryClientConnectionsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.connection.v1.QueryClientConnectionsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.connection.v1.QueryClientConnectionsRequest} QueryClientConnectionsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryClientConnectionsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryClientConnectionsRequest message. - * @function verify - * @memberof ibc.core.connection.v1.QueryClientConnectionsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryClientConnectionsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.client_id != null && message.hasOwnProperty("client_id")) - if (!$util.isString(message.client_id)) - return "client_id: string expected"; - return null; - }; - - /** - * Creates a QueryClientConnectionsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.connection.v1.QueryClientConnectionsRequest - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.connection.v1.QueryClientConnectionsRequest} QueryClientConnectionsRequest - */ - QueryClientConnectionsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.connection.v1.QueryClientConnectionsRequest) - return object; - let message = new $root.ibc.core.connection.v1.QueryClientConnectionsRequest(); - if (object.client_id != null) - message.client_id = String(object.client_id); - return message; - }; - - /** - * Creates a plain object from a QueryClientConnectionsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.connection.v1.QueryClientConnectionsRequest - * @static - * @param {ibc.core.connection.v1.QueryClientConnectionsRequest} message QueryClientConnectionsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryClientConnectionsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.client_id = ""; - if (message.client_id != null && message.hasOwnProperty("client_id")) - object.client_id = message.client_id; - return object; - }; - - /** - * Converts this QueryClientConnectionsRequest to JSON. - * @function toJSON - * @memberof ibc.core.connection.v1.QueryClientConnectionsRequest - * @instance - * @returns {Object.} JSON object - */ - QueryClientConnectionsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryClientConnectionsRequest; - })(); - - v1.QueryClientConnectionsResponse = (function() { - - /** - * Properties of a QueryClientConnectionsResponse. - * @memberof ibc.core.connection.v1 - * @interface IQueryClientConnectionsResponse - * @property {Array.|null} [connection_paths] QueryClientConnectionsResponse connection_paths - * @property {Uint8Array|null} [proof] QueryClientConnectionsResponse proof - * @property {ibc.core.client.v1.IHeight|null} [proof_height] QueryClientConnectionsResponse proof_height - */ - - /** - * Constructs a new QueryClientConnectionsResponse. - * @memberof ibc.core.connection.v1 - * @classdesc Represents a QueryClientConnectionsResponse. - * @implements IQueryClientConnectionsResponse - * @constructor - * @param {ibc.core.connection.v1.IQueryClientConnectionsResponse=} [properties] Properties to set - */ - function QueryClientConnectionsResponse(properties) { - this.connection_paths = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryClientConnectionsResponse connection_paths. - * @member {Array.} connection_paths - * @memberof ibc.core.connection.v1.QueryClientConnectionsResponse - * @instance - */ - QueryClientConnectionsResponse.prototype.connection_paths = $util.emptyArray; - - /** - * QueryClientConnectionsResponse proof. - * @member {Uint8Array} proof - * @memberof ibc.core.connection.v1.QueryClientConnectionsResponse - * @instance - */ - QueryClientConnectionsResponse.prototype.proof = $util.newBuffer([]); - - /** - * QueryClientConnectionsResponse proof_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height - * @memberof ibc.core.connection.v1.QueryClientConnectionsResponse - * @instance - */ - QueryClientConnectionsResponse.prototype.proof_height = null; - - /** - * Encodes the specified QueryClientConnectionsResponse message. Does not implicitly {@link ibc.core.connection.v1.QueryClientConnectionsResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.connection.v1.QueryClientConnectionsResponse - * @static - * @param {ibc.core.connection.v1.IQueryClientConnectionsResponse} message QueryClientConnectionsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryClientConnectionsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.connection_paths != null && message.connection_paths.length) - for (let i = 0; i < message.connection_paths.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.connection_paths[i]); - if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proof); - if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) - $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryClientConnectionsResponse message, length delimited. Does not implicitly {@link ibc.core.connection.v1.QueryClientConnectionsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.connection.v1.QueryClientConnectionsResponse - * @static - * @param {ibc.core.connection.v1.IQueryClientConnectionsResponse} message QueryClientConnectionsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryClientConnectionsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryClientConnectionsResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.connection.v1.QueryClientConnectionsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.connection.v1.QueryClientConnectionsResponse} QueryClientConnectionsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryClientConnectionsResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.QueryClientConnectionsResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.connection_paths && message.connection_paths.length)) - message.connection_paths = []; - message.connection_paths.push(reader.string()); - break; - case 2: - message.proof = reader.bytes(); - break; - case 3: - message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryClientConnectionsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.connection.v1.QueryClientConnectionsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.connection.v1.QueryClientConnectionsResponse} QueryClientConnectionsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryClientConnectionsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryClientConnectionsResponse message. - * @function verify - * @memberof ibc.core.connection.v1.QueryClientConnectionsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryClientConnectionsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.connection_paths != null && message.hasOwnProperty("connection_paths")) { - if (!Array.isArray(message.connection_paths)) - return "connection_paths: array expected"; - for (let i = 0; i < message.connection_paths.length; ++i) - if (!$util.isString(message.connection_paths[i])) - return "connection_paths: string[] expected"; - } - if (message.proof != null && message.hasOwnProperty("proof")) - if (!(message.proof && typeof message.proof.length === "number" || $util.isString(message.proof))) - return "proof: buffer expected"; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); - if (error) - return "proof_height." + error; - } - return null; - }; - - /** - * Creates a QueryClientConnectionsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.connection.v1.QueryClientConnectionsResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.connection.v1.QueryClientConnectionsResponse} QueryClientConnectionsResponse - */ - QueryClientConnectionsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.connection.v1.QueryClientConnectionsResponse) - return object; - let message = new $root.ibc.core.connection.v1.QueryClientConnectionsResponse(); - if (object.connection_paths) { - if (!Array.isArray(object.connection_paths)) - throw TypeError(".ibc.core.connection.v1.QueryClientConnectionsResponse.connection_paths: array expected"); - message.connection_paths = []; - for (let i = 0; i < object.connection_paths.length; ++i) - message.connection_paths[i] = String(object.connection_paths[i]); - } - if (object.proof != null) - if (typeof object.proof === "string") - $util.base64.decode(object.proof, message.proof = $util.newBuffer($util.base64.length(object.proof)), 0); - else if (object.proof.length) - message.proof = object.proof; - if (object.proof_height != null) { - if (typeof object.proof_height !== "object") - throw TypeError(".ibc.core.connection.v1.QueryClientConnectionsResponse.proof_height: object expected"); - message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); - } - return message; - }; - - /** - * Creates a plain object from a QueryClientConnectionsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.connection.v1.QueryClientConnectionsResponse - * @static - * @param {ibc.core.connection.v1.QueryClientConnectionsResponse} message QueryClientConnectionsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryClientConnectionsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.connection_paths = []; - if (options.defaults) { - if (options.bytes === String) - object.proof = ""; - else { - object.proof = []; - if (options.bytes !== Array) - object.proof = $util.newBuffer(object.proof); - } - object.proof_height = null; - } - if (message.connection_paths && message.connection_paths.length) { - object.connection_paths = []; - for (let j = 0; j < message.connection_paths.length; ++j) - object.connection_paths[j] = message.connection_paths[j]; - } - if (message.proof != null && message.hasOwnProperty("proof")) - object.proof = options.bytes === String ? $util.base64.encode(message.proof, 0, message.proof.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof) : message.proof; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) - object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); - return object; - }; - - /** - * Converts this QueryClientConnectionsResponse to JSON. - * @function toJSON - * @memberof ibc.core.connection.v1.QueryClientConnectionsResponse - * @instance - * @returns {Object.} JSON object - */ - QueryClientConnectionsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryClientConnectionsResponse; - })(); - - v1.QueryConnectionClientStateRequest = (function() { - - /** - * Properties of a QueryConnectionClientStateRequest. - * @memberof ibc.core.connection.v1 - * @interface IQueryConnectionClientStateRequest - * @property {string|null} [connection_id] QueryConnectionClientStateRequest connection_id - */ - - /** - * Constructs a new QueryConnectionClientStateRequest. - * @memberof ibc.core.connection.v1 - * @classdesc Represents a QueryConnectionClientStateRequest. - * @implements IQueryConnectionClientStateRequest - * @constructor - * @param {ibc.core.connection.v1.IQueryConnectionClientStateRequest=} [properties] Properties to set - */ - function QueryConnectionClientStateRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryConnectionClientStateRequest connection_id. - * @member {string} connection_id - * @memberof ibc.core.connection.v1.QueryConnectionClientStateRequest - * @instance - */ - QueryConnectionClientStateRequest.prototype.connection_id = ""; - - /** - * Encodes the specified QueryConnectionClientStateRequest message. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionClientStateRequest.verify|verify} messages. - * @function encode - * @memberof ibc.core.connection.v1.QueryConnectionClientStateRequest - * @static - * @param {ibc.core.connection.v1.IQueryConnectionClientStateRequest} message QueryConnectionClientStateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryConnectionClientStateRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.connection_id != null && Object.hasOwnProperty.call(message, "connection_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.connection_id); - return writer; - }; - - /** - * Encodes the specified QueryConnectionClientStateRequest message, length delimited. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionClientStateRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.connection.v1.QueryConnectionClientStateRequest - * @static - * @param {ibc.core.connection.v1.IQueryConnectionClientStateRequest} message QueryConnectionClientStateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryConnectionClientStateRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryConnectionClientStateRequest message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.connection.v1.QueryConnectionClientStateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.connection.v1.QueryConnectionClientStateRequest} QueryConnectionClientStateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryConnectionClientStateRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.QueryConnectionClientStateRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.connection_id = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryConnectionClientStateRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.connection.v1.QueryConnectionClientStateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.connection.v1.QueryConnectionClientStateRequest} QueryConnectionClientStateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryConnectionClientStateRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryConnectionClientStateRequest message. - * @function verify - * @memberof ibc.core.connection.v1.QueryConnectionClientStateRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryConnectionClientStateRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.connection_id != null && message.hasOwnProperty("connection_id")) - if (!$util.isString(message.connection_id)) - return "connection_id: string expected"; - return null; - }; - - /** - * Creates a QueryConnectionClientStateRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.connection.v1.QueryConnectionClientStateRequest - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.connection.v1.QueryConnectionClientStateRequest} QueryConnectionClientStateRequest - */ - QueryConnectionClientStateRequest.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.connection.v1.QueryConnectionClientStateRequest) - return object; - let message = new $root.ibc.core.connection.v1.QueryConnectionClientStateRequest(); - if (object.connection_id != null) - message.connection_id = String(object.connection_id); - return message; - }; - - /** - * Creates a plain object from a QueryConnectionClientStateRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.connection.v1.QueryConnectionClientStateRequest - * @static - * @param {ibc.core.connection.v1.QueryConnectionClientStateRequest} message QueryConnectionClientStateRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryConnectionClientStateRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.connection_id = ""; - if (message.connection_id != null && message.hasOwnProperty("connection_id")) - object.connection_id = message.connection_id; - return object; - }; - - /** - * Converts this QueryConnectionClientStateRequest to JSON. - * @function toJSON - * @memberof ibc.core.connection.v1.QueryConnectionClientStateRequest - * @instance - * @returns {Object.} JSON object - */ - QueryConnectionClientStateRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryConnectionClientStateRequest; - })(); - - v1.QueryConnectionClientStateResponse = (function() { - - /** - * Properties of a QueryConnectionClientStateResponse. - * @memberof ibc.core.connection.v1 - * @interface IQueryConnectionClientStateResponse - * @property {ibc.core.client.v1.IIdentifiedClientState|null} [identified_client_state] QueryConnectionClientStateResponse identified_client_state - * @property {Uint8Array|null} [proof] QueryConnectionClientStateResponse proof - * @property {ibc.core.client.v1.IHeight|null} [proof_height] QueryConnectionClientStateResponse proof_height - */ - - /** - * Constructs a new QueryConnectionClientStateResponse. - * @memberof ibc.core.connection.v1 - * @classdesc Represents a QueryConnectionClientStateResponse. - * @implements IQueryConnectionClientStateResponse - * @constructor - * @param {ibc.core.connection.v1.IQueryConnectionClientStateResponse=} [properties] Properties to set - */ - function QueryConnectionClientStateResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryConnectionClientStateResponse identified_client_state. - * @member {ibc.core.client.v1.IIdentifiedClientState|null|undefined} identified_client_state - * @memberof ibc.core.connection.v1.QueryConnectionClientStateResponse - * @instance - */ - QueryConnectionClientStateResponse.prototype.identified_client_state = null; - - /** - * QueryConnectionClientStateResponse proof. - * @member {Uint8Array} proof - * @memberof ibc.core.connection.v1.QueryConnectionClientStateResponse - * @instance - */ - QueryConnectionClientStateResponse.prototype.proof = $util.newBuffer([]); - - /** - * QueryConnectionClientStateResponse proof_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height - * @memberof ibc.core.connection.v1.QueryConnectionClientStateResponse - * @instance - */ - QueryConnectionClientStateResponse.prototype.proof_height = null; - - /** - * Encodes the specified QueryConnectionClientStateResponse message. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionClientStateResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.connection.v1.QueryConnectionClientStateResponse - * @static - * @param {ibc.core.connection.v1.IQueryConnectionClientStateResponse} message QueryConnectionClientStateResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryConnectionClientStateResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.identified_client_state != null && Object.hasOwnProperty.call(message, "identified_client_state")) - $root.ibc.core.client.v1.IdentifiedClientState.encode(message.identified_client_state, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.proof); - if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) - $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryConnectionClientStateResponse message, length delimited. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionClientStateResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.connection.v1.QueryConnectionClientStateResponse - * @static - * @param {ibc.core.connection.v1.IQueryConnectionClientStateResponse} message QueryConnectionClientStateResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryConnectionClientStateResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryConnectionClientStateResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.connection.v1.QueryConnectionClientStateResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.connection.v1.QueryConnectionClientStateResponse} QueryConnectionClientStateResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryConnectionClientStateResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.QueryConnectionClientStateResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.identified_client_state = $root.ibc.core.client.v1.IdentifiedClientState.decode(reader, reader.uint32()); - break; - case 2: - message.proof = reader.bytes(); - break; - case 3: - message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryConnectionClientStateResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.connection.v1.QueryConnectionClientStateResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.connection.v1.QueryConnectionClientStateResponse} QueryConnectionClientStateResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryConnectionClientStateResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryConnectionClientStateResponse message. - * @function verify - * @memberof ibc.core.connection.v1.QueryConnectionClientStateResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryConnectionClientStateResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.identified_client_state != null && message.hasOwnProperty("identified_client_state")) { - let error = $root.ibc.core.client.v1.IdentifiedClientState.verify(message.identified_client_state); - if (error) - return "identified_client_state." + error; - } - if (message.proof != null && message.hasOwnProperty("proof")) - if (!(message.proof && typeof message.proof.length === "number" || $util.isString(message.proof))) - return "proof: buffer expected"; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); - if (error) - return "proof_height." + error; - } - return null; - }; - - /** - * Creates a QueryConnectionClientStateResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.connection.v1.QueryConnectionClientStateResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.connection.v1.QueryConnectionClientStateResponse} QueryConnectionClientStateResponse - */ - QueryConnectionClientStateResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.connection.v1.QueryConnectionClientStateResponse) - return object; - let message = new $root.ibc.core.connection.v1.QueryConnectionClientStateResponse(); - if (object.identified_client_state != null) { - if (typeof object.identified_client_state !== "object") - throw TypeError(".ibc.core.connection.v1.QueryConnectionClientStateResponse.identified_client_state: object expected"); - message.identified_client_state = $root.ibc.core.client.v1.IdentifiedClientState.fromObject(object.identified_client_state); - } - if (object.proof != null) - if (typeof object.proof === "string") - $util.base64.decode(object.proof, message.proof = $util.newBuffer($util.base64.length(object.proof)), 0); - else if (object.proof.length) - message.proof = object.proof; - if (object.proof_height != null) { - if (typeof object.proof_height !== "object") - throw TypeError(".ibc.core.connection.v1.QueryConnectionClientStateResponse.proof_height: object expected"); - message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); - } - return message; - }; - - /** - * Creates a plain object from a QueryConnectionClientStateResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.connection.v1.QueryConnectionClientStateResponse - * @static - * @param {ibc.core.connection.v1.QueryConnectionClientStateResponse} message QueryConnectionClientStateResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryConnectionClientStateResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.identified_client_state = null; - if (options.bytes === String) - object.proof = ""; - else { - object.proof = []; - if (options.bytes !== Array) - object.proof = $util.newBuffer(object.proof); - } - object.proof_height = null; - } - if (message.identified_client_state != null && message.hasOwnProperty("identified_client_state")) - object.identified_client_state = $root.ibc.core.client.v1.IdentifiedClientState.toObject(message.identified_client_state, options); - if (message.proof != null && message.hasOwnProperty("proof")) - object.proof = options.bytes === String ? $util.base64.encode(message.proof, 0, message.proof.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof) : message.proof; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) - object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); - return object; - }; - - /** - * Converts this QueryConnectionClientStateResponse to JSON. - * @function toJSON - * @memberof ibc.core.connection.v1.QueryConnectionClientStateResponse - * @instance - * @returns {Object.} JSON object - */ - QueryConnectionClientStateResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryConnectionClientStateResponse; - })(); - - v1.QueryConnectionConsensusStateRequest = (function() { - - /** - * Properties of a QueryConnectionConsensusStateRequest. - * @memberof ibc.core.connection.v1 - * @interface IQueryConnectionConsensusStateRequest - * @property {string|null} [connection_id] QueryConnectionConsensusStateRequest connection_id - * @property {Long|null} [revision_number] QueryConnectionConsensusStateRequest revision_number - * @property {Long|null} [revision_height] QueryConnectionConsensusStateRequest revision_height - */ - - /** - * Constructs a new QueryConnectionConsensusStateRequest. - * @memberof ibc.core.connection.v1 - * @classdesc Represents a QueryConnectionConsensusStateRequest. - * @implements IQueryConnectionConsensusStateRequest - * @constructor - * @param {ibc.core.connection.v1.IQueryConnectionConsensusStateRequest=} [properties] Properties to set - */ - function QueryConnectionConsensusStateRequest(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryConnectionConsensusStateRequest connection_id. - * @member {string} connection_id - * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateRequest - * @instance - */ - QueryConnectionConsensusStateRequest.prototype.connection_id = ""; - - /** - * QueryConnectionConsensusStateRequest revision_number. - * @member {Long} revision_number - * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateRequest - * @instance - */ - QueryConnectionConsensusStateRequest.prototype.revision_number = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * QueryConnectionConsensusStateRequest revision_height. - * @member {Long} revision_height - * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateRequest - * @instance - */ - QueryConnectionConsensusStateRequest.prototype.revision_height = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified QueryConnectionConsensusStateRequest message. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionConsensusStateRequest.verify|verify} messages. - * @function encode - * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateRequest - * @static - * @param {ibc.core.connection.v1.IQueryConnectionConsensusStateRequest} message QueryConnectionConsensusStateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryConnectionConsensusStateRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.connection_id != null && Object.hasOwnProperty.call(message, "connection_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.connection_id); - if (message.revision_number != null && Object.hasOwnProperty.call(message, "revision_number")) - writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.revision_number); - if (message.revision_height != null && Object.hasOwnProperty.call(message, "revision_height")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.revision_height); - return writer; - }; - - /** - * Encodes the specified QueryConnectionConsensusStateRequest message, length delimited. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionConsensusStateRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateRequest - * @static - * @param {ibc.core.connection.v1.IQueryConnectionConsensusStateRequest} message QueryConnectionConsensusStateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryConnectionConsensusStateRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryConnectionConsensusStateRequest message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.connection.v1.QueryConnectionConsensusStateRequest} QueryConnectionConsensusStateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryConnectionConsensusStateRequest.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.QueryConnectionConsensusStateRequest(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.connection_id = reader.string(); - break; - case 2: - message.revision_number = reader.uint64(); - break; - case 3: - message.revision_height = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryConnectionConsensusStateRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.connection.v1.QueryConnectionConsensusStateRequest} QueryConnectionConsensusStateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryConnectionConsensusStateRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryConnectionConsensusStateRequest message. - * @function verify - * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryConnectionConsensusStateRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.connection_id != null && message.hasOwnProperty("connection_id")) - if (!$util.isString(message.connection_id)) - return "connection_id: string expected"; - if (message.revision_number != null && message.hasOwnProperty("revision_number")) - if (!$util.isInteger(message.revision_number) && !(message.revision_number && $util.isInteger(message.revision_number.low) && $util.isInteger(message.revision_number.high))) - return "revision_number: integer|Long expected"; - if (message.revision_height != null && message.hasOwnProperty("revision_height")) - if (!$util.isInteger(message.revision_height) && !(message.revision_height && $util.isInteger(message.revision_height.low) && $util.isInteger(message.revision_height.high))) - return "revision_height: integer|Long expected"; - return null; - }; - - /** - * Creates a QueryConnectionConsensusStateRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateRequest - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.connection.v1.QueryConnectionConsensusStateRequest} QueryConnectionConsensusStateRequest - */ - QueryConnectionConsensusStateRequest.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.connection.v1.QueryConnectionConsensusStateRequest) - return object; - let message = new $root.ibc.core.connection.v1.QueryConnectionConsensusStateRequest(); - if (object.connection_id != null) - message.connection_id = String(object.connection_id); - if (object.revision_number != null) - if ($util.Long) - (message.revision_number = $util.Long.fromValue(object.revision_number)).unsigned = true; - else if (typeof object.revision_number === "string") - message.revision_number = parseInt(object.revision_number, 10); - else if (typeof object.revision_number === "number") - message.revision_number = object.revision_number; - else if (typeof object.revision_number === "object") - message.revision_number = new $util.LongBits(object.revision_number.low >>> 0, object.revision_number.high >>> 0).toNumber(true); - if (object.revision_height != null) - if ($util.Long) - (message.revision_height = $util.Long.fromValue(object.revision_height)).unsigned = true; - else if (typeof object.revision_height === "string") - message.revision_height = parseInt(object.revision_height, 10); - else if (typeof object.revision_height === "number") - message.revision_height = object.revision_height; - else if (typeof object.revision_height === "object") - message.revision_height = new $util.LongBits(object.revision_height.low >>> 0, object.revision_height.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a QueryConnectionConsensusStateRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateRequest - * @static - * @param {ibc.core.connection.v1.QueryConnectionConsensusStateRequest} message QueryConnectionConsensusStateRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryConnectionConsensusStateRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.connection_id = ""; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.revision_number = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.revision_number = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.revision_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.revision_height = options.longs === String ? "0" : 0; - } - if (message.connection_id != null && message.hasOwnProperty("connection_id")) - object.connection_id = message.connection_id; - if (message.revision_number != null && message.hasOwnProperty("revision_number")) - if (typeof message.revision_number === "number") - object.revision_number = options.longs === String ? String(message.revision_number) : message.revision_number; - else - object.revision_number = options.longs === String ? $util.Long.prototype.toString.call(message.revision_number) : options.longs === Number ? new $util.LongBits(message.revision_number.low >>> 0, message.revision_number.high >>> 0).toNumber(true) : message.revision_number; - if (message.revision_height != null && message.hasOwnProperty("revision_height")) - if (typeof message.revision_height === "number") - object.revision_height = options.longs === String ? String(message.revision_height) : message.revision_height; - else - object.revision_height = options.longs === String ? $util.Long.prototype.toString.call(message.revision_height) : options.longs === Number ? new $util.LongBits(message.revision_height.low >>> 0, message.revision_height.high >>> 0).toNumber(true) : message.revision_height; - return object; - }; - - /** - * Converts this QueryConnectionConsensusStateRequest to JSON. - * @function toJSON - * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateRequest - * @instance - * @returns {Object.} JSON object - */ - QueryConnectionConsensusStateRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryConnectionConsensusStateRequest; - })(); - - v1.QueryConnectionConsensusStateResponse = (function() { - - /** - * Properties of a QueryConnectionConsensusStateResponse. - * @memberof ibc.core.connection.v1 - * @interface IQueryConnectionConsensusStateResponse - * @property {google.protobuf.IAny|null} [consensus_state] QueryConnectionConsensusStateResponse consensus_state - * @property {string|null} [client_id] QueryConnectionConsensusStateResponse client_id - * @property {Uint8Array|null} [proof] QueryConnectionConsensusStateResponse proof - * @property {ibc.core.client.v1.IHeight|null} [proof_height] QueryConnectionConsensusStateResponse proof_height - */ - - /** - * Constructs a new QueryConnectionConsensusStateResponse. - * @memberof ibc.core.connection.v1 - * @classdesc Represents a QueryConnectionConsensusStateResponse. - * @implements IQueryConnectionConsensusStateResponse - * @constructor - * @param {ibc.core.connection.v1.IQueryConnectionConsensusStateResponse=} [properties] Properties to set - */ - function QueryConnectionConsensusStateResponse(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryConnectionConsensusStateResponse consensus_state. - * @member {google.protobuf.IAny|null|undefined} consensus_state - * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateResponse - * @instance - */ - QueryConnectionConsensusStateResponse.prototype.consensus_state = null; - - /** - * QueryConnectionConsensusStateResponse client_id. - * @member {string} client_id - * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateResponse - * @instance - */ - QueryConnectionConsensusStateResponse.prototype.client_id = ""; - - /** - * QueryConnectionConsensusStateResponse proof. - * @member {Uint8Array} proof - * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateResponse - * @instance - */ - QueryConnectionConsensusStateResponse.prototype.proof = $util.newBuffer([]); - - /** - * QueryConnectionConsensusStateResponse proof_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} proof_height - * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateResponse - * @instance - */ - QueryConnectionConsensusStateResponse.prototype.proof_height = null; - - /** - * Encodes the specified QueryConnectionConsensusStateResponse message. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionConsensusStateResponse.verify|verify} messages. - * @function encode - * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateResponse - * @static - * @param {ibc.core.connection.v1.IQueryConnectionConsensusStateResponse} message QueryConnectionConsensusStateResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryConnectionConsensusStateResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.consensus_state != null && Object.hasOwnProperty.call(message, "consensus_state")) - $root.google.protobuf.Any.encode(message.consensus_state, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.client_id); - if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) - writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.proof); - if (message.proof_height != null && Object.hasOwnProperty.call(message, "proof_height")) - $root.ibc.core.client.v1.Height.encode(message.proof_height, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryConnectionConsensusStateResponse message, length delimited. Does not implicitly {@link ibc.core.connection.v1.QueryConnectionConsensusStateResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateResponse - * @static - * @param {ibc.core.connection.v1.IQueryConnectionConsensusStateResponse} message QueryConnectionConsensusStateResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryConnectionConsensusStateResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryConnectionConsensusStateResponse message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.connection.v1.QueryConnectionConsensusStateResponse} QueryConnectionConsensusStateResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryConnectionConsensusStateResponse.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.QueryConnectionConsensusStateResponse(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.consensus_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - case 2: - message.client_id = reader.string(); - break; - case 3: - message.proof = reader.bytes(); - break; - case 4: - message.proof_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryConnectionConsensusStateResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.connection.v1.QueryConnectionConsensusStateResponse} QueryConnectionConsensusStateResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryConnectionConsensusStateResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryConnectionConsensusStateResponse message. - * @function verify - * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryConnectionConsensusStateResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) { - let error = $root.google.protobuf.Any.verify(message.consensus_state); - if (error) - return "consensus_state." + error; - } - if (message.client_id != null && message.hasOwnProperty("client_id")) - if (!$util.isString(message.client_id)) - return "client_id: string expected"; - if (message.proof != null && message.hasOwnProperty("proof")) - if (!(message.proof && typeof message.proof.length === "number" || $util.isString(message.proof))) - return "proof: buffer expected"; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.proof_height); - if (error) - return "proof_height." + error; - } - return null; - }; - - /** - * Creates a QueryConnectionConsensusStateResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateResponse - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.connection.v1.QueryConnectionConsensusStateResponse} QueryConnectionConsensusStateResponse - */ - QueryConnectionConsensusStateResponse.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.connection.v1.QueryConnectionConsensusStateResponse) - return object; - let message = new $root.ibc.core.connection.v1.QueryConnectionConsensusStateResponse(); - if (object.consensus_state != null) { - if (typeof object.consensus_state !== "object") - throw TypeError(".ibc.core.connection.v1.QueryConnectionConsensusStateResponse.consensus_state: object expected"); - message.consensus_state = $root.google.protobuf.Any.fromObject(object.consensus_state); - } - if (object.client_id != null) - message.client_id = String(object.client_id); - if (object.proof != null) - if (typeof object.proof === "string") - $util.base64.decode(object.proof, message.proof = $util.newBuffer($util.base64.length(object.proof)), 0); - else if (object.proof.length) - message.proof = object.proof; - if (object.proof_height != null) { - if (typeof object.proof_height !== "object") - throw TypeError(".ibc.core.connection.v1.QueryConnectionConsensusStateResponse.proof_height: object expected"); - message.proof_height = $root.ibc.core.client.v1.Height.fromObject(object.proof_height); - } - return message; - }; - - /** - * Creates a plain object from a QueryConnectionConsensusStateResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateResponse - * @static - * @param {ibc.core.connection.v1.QueryConnectionConsensusStateResponse} message QueryConnectionConsensusStateResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryConnectionConsensusStateResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.consensus_state = null; - object.client_id = ""; - if (options.bytes === String) - object.proof = ""; - else { - object.proof = []; - if (options.bytes !== Array) - object.proof = $util.newBuffer(object.proof); - } - object.proof_height = null; - } - if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) - object.consensus_state = $root.google.protobuf.Any.toObject(message.consensus_state, options); - if (message.client_id != null && message.hasOwnProperty("client_id")) - object.client_id = message.client_id; - if (message.proof != null && message.hasOwnProperty("proof")) - object.proof = options.bytes === String ? $util.base64.encode(message.proof, 0, message.proof.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof) : message.proof; - if (message.proof_height != null && message.hasOwnProperty("proof_height")) - object.proof_height = $root.ibc.core.client.v1.Height.toObject(message.proof_height, options); - return object; - }; - - /** - * Converts this QueryConnectionConsensusStateResponse to JSON. - * @function toJSON - * @memberof ibc.core.connection.v1.QueryConnectionConsensusStateResponse - * @instance - * @returns {Object.} JSON object - */ - QueryConnectionConsensusStateResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return QueryConnectionConsensusStateResponse; - })(); - - v1.ConnectionEnd = (function() { - - /** - * Properties of a ConnectionEnd. - * @memberof ibc.core.connection.v1 - * @interface IConnectionEnd - * @property {string|null} [client_id] ConnectionEnd client_id - * @property {Array.|null} [versions] ConnectionEnd versions - * @property {ibc.core.connection.v1.State|null} [state] ConnectionEnd state - * @property {ibc.core.connection.v1.ICounterparty|null} [counterparty] ConnectionEnd counterparty - * @property {Long|null} [delay_period] ConnectionEnd delay_period - */ - - /** - * Constructs a new ConnectionEnd. - * @memberof ibc.core.connection.v1 - * @classdesc Represents a ConnectionEnd. - * @implements IConnectionEnd - * @constructor - * @param {ibc.core.connection.v1.IConnectionEnd=} [properties] Properties to set - */ - function ConnectionEnd(properties) { - this.versions = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ConnectionEnd client_id. - * @member {string} client_id - * @memberof ibc.core.connection.v1.ConnectionEnd - * @instance - */ - ConnectionEnd.prototype.client_id = ""; - - /** - * ConnectionEnd versions. - * @member {Array.} versions - * @memberof ibc.core.connection.v1.ConnectionEnd - * @instance - */ - ConnectionEnd.prototype.versions = $util.emptyArray; - - /** - * ConnectionEnd state. - * @member {ibc.core.connection.v1.State} state - * @memberof ibc.core.connection.v1.ConnectionEnd - * @instance - */ - ConnectionEnd.prototype.state = 0; - - /** - * ConnectionEnd counterparty. - * @member {ibc.core.connection.v1.ICounterparty|null|undefined} counterparty - * @memberof ibc.core.connection.v1.ConnectionEnd - * @instance - */ - ConnectionEnd.prototype.counterparty = null; - - /** - * ConnectionEnd delay_period. - * @member {Long} delay_period - * @memberof ibc.core.connection.v1.ConnectionEnd - * @instance - */ - ConnectionEnd.prototype.delay_period = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified ConnectionEnd message. Does not implicitly {@link ibc.core.connection.v1.ConnectionEnd.verify|verify} messages. - * @function encode - * @memberof ibc.core.connection.v1.ConnectionEnd - * @static - * @param {ibc.core.connection.v1.IConnectionEnd} message ConnectionEnd message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConnectionEnd.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); - if (message.versions != null && message.versions.length) - for (let i = 0; i < message.versions.length; ++i) - $root.ibc.core.connection.v1.Version.encode(message.versions[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.state); - if (message.counterparty != null && Object.hasOwnProperty.call(message, "counterparty")) - $root.ibc.core.connection.v1.Counterparty.encode(message.counterparty, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.delay_period != null && Object.hasOwnProperty.call(message, "delay_period")) - writer.uint32(/* id 5, wireType 0 =*/40).uint64(message.delay_period); - return writer; - }; - - /** - * Encodes the specified ConnectionEnd message, length delimited. Does not implicitly {@link ibc.core.connection.v1.ConnectionEnd.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.connection.v1.ConnectionEnd - * @static - * @param {ibc.core.connection.v1.IConnectionEnd} message ConnectionEnd message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConnectionEnd.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ConnectionEnd message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.connection.v1.ConnectionEnd - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.connection.v1.ConnectionEnd} ConnectionEnd - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConnectionEnd.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.ConnectionEnd(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.client_id = reader.string(); - break; - case 2: - if (!(message.versions && message.versions.length)) - message.versions = []; - message.versions.push($root.ibc.core.connection.v1.Version.decode(reader, reader.uint32())); - break; - case 3: - message.state = reader.int32(); - break; - case 4: - message.counterparty = $root.ibc.core.connection.v1.Counterparty.decode(reader, reader.uint32()); - break; - case 5: - message.delay_period = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ConnectionEnd message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.connection.v1.ConnectionEnd - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.connection.v1.ConnectionEnd} ConnectionEnd - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConnectionEnd.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ConnectionEnd message. - * @function verify - * @memberof ibc.core.connection.v1.ConnectionEnd - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ConnectionEnd.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.client_id != null && message.hasOwnProperty("client_id")) - if (!$util.isString(message.client_id)) - return "client_id: string expected"; - if (message.versions != null && message.hasOwnProperty("versions")) { - if (!Array.isArray(message.versions)) - return "versions: array expected"; - for (let i = 0; i < message.versions.length; ++i) { - let error = $root.ibc.core.connection.v1.Version.verify(message.versions[i]); - if (error) - return "versions." + error; - } - } - if (message.state != null && message.hasOwnProperty("state")) - switch (message.state) { - default: - return "state: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.counterparty != null && message.hasOwnProperty("counterparty")) { - let error = $root.ibc.core.connection.v1.Counterparty.verify(message.counterparty); - if (error) - return "counterparty." + error; - } - if (message.delay_period != null && message.hasOwnProperty("delay_period")) - if (!$util.isInteger(message.delay_period) && !(message.delay_period && $util.isInteger(message.delay_period.low) && $util.isInteger(message.delay_period.high))) - return "delay_period: integer|Long expected"; - return null; - }; - - /** - * Creates a ConnectionEnd message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.connection.v1.ConnectionEnd - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.connection.v1.ConnectionEnd} ConnectionEnd - */ - ConnectionEnd.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.connection.v1.ConnectionEnd) - return object; - let message = new $root.ibc.core.connection.v1.ConnectionEnd(); - if (object.client_id != null) - message.client_id = String(object.client_id); - if (object.versions) { - if (!Array.isArray(object.versions)) - throw TypeError(".ibc.core.connection.v1.ConnectionEnd.versions: array expected"); - message.versions = []; - for (let i = 0; i < object.versions.length; ++i) { - if (typeof object.versions[i] !== "object") - throw TypeError(".ibc.core.connection.v1.ConnectionEnd.versions: object expected"); - message.versions[i] = $root.ibc.core.connection.v1.Version.fromObject(object.versions[i]); - } - } - switch (object.state) { - case "STATE_UNINITIALIZED_UNSPECIFIED": - case 0: - message.state = 0; - break; - case "STATE_INIT": - case 1: - message.state = 1; - break; - case "STATE_TRYOPEN": - case 2: - message.state = 2; - break; - case "STATE_OPEN": - case 3: - message.state = 3; - break; - } - if (object.counterparty != null) { - if (typeof object.counterparty !== "object") - throw TypeError(".ibc.core.connection.v1.ConnectionEnd.counterparty: object expected"); - message.counterparty = $root.ibc.core.connection.v1.Counterparty.fromObject(object.counterparty); - } - if (object.delay_period != null) - if ($util.Long) - (message.delay_period = $util.Long.fromValue(object.delay_period)).unsigned = true; - else if (typeof object.delay_period === "string") - message.delay_period = parseInt(object.delay_period, 10); - else if (typeof object.delay_period === "number") - message.delay_period = object.delay_period; - else if (typeof object.delay_period === "object") - message.delay_period = new $util.LongBits(object.delay_period.low >>> 0, object.delay_period.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a ConnectionEnd message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.connection.v1.ConnectionEnd - * @static - * @param {ibc.core.connection.v1.ConnectionEnd} message ConnectionEnd - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ConnectionEnd.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.versions = []; - if (options.defaults) { - object.client_id = ""; - object.state = options.enums === String ? "STATE_UNINITIALIZED_UNSPECIFIED" : 0; - object.counterparty = null; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.delay_period = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.delay_period = options.longs === String ? "0" : 0; - } - if (message.client_id != null && message.hasOwnProperty("client_id")) - object.client_id = message.client_id; - if (message.versions && message.versions.length) { - object.versions = []; - for (let j = 0; j < message.versions.length; ++j) - object.versions[j] = $root.ibc.core.connection.v1.Version.toObject(message.versions[j], options); - } - if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.ibc.core.connection.v1.State[message.state] : message.state; - if (message.counterparty != null && message.hasOwnProperty("counterparty")) - object.counterparty = $root.ibc.core.connection.v1.Counterparty.toObject(message.counterparty, options); - if (message.delay_period != null && message.hasOwnProperty("delay_period")) - if (typeof message.delay_period === "number") - object.delay_period = options.longs === String ? String(message.delay_period) : message.delay_period; - else - object.delay_period = options.longs === String ? $util.Long.prototype.toString.call(message.delay_period) : options.longs === Number ? new $util.LongBits(message.delay_period.low >>> 0, message.delay_period.high >>> 0).toNumber(true) : message.delay_period; - return object; - }; - - /** - * Converts this ConnectionEnd to JSON. - * @function toJSON - * @memberof ibc.core.connection.v1.ConnectionEnd - * @instance - * @returns {Object.} JSON object - */ - ConnectionEnd.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ConnectionEnd; - })(); - - v1.IdentifiedConnection = (function() { - - /** - * Properties of an IdentifiedConnection. - * @memberof ibc.core.connection.v1 - * @interface IIdentifiedConnection - * @property {string|null} [id] IdentifiedConnection id - * @property {string|null} [client_id] IdentifiedConnection client_id - * @property {Array.|null} [versions] IdentifiedConnection versions - * @property {ibc.core.connection.v1.State|null} [state] IdentifiedConnection state - * @property {ibc.core.connection.v1.ICounterparty|null} [counterparty] IdentifiedConnection counterparty - * @property {Long|null} [delay_period] IdentifiedConnection delay_period - */ - - /** - * Constructs a new IdentifiedConnection. - * @memberof ibc.core.connection.v1 - * @classdesc Represents an IdentifiedConnection. - * @implements IIdentifiedConnection - * @constructor - * @param {ibc.core.connection.v1.IIdentifiedConnection=} [properties] Properties to set - */ - function IdentifiedConnection(properties) { - this.versions = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * IdentifiedConnection id. - * @member {string} id - * @memberof ibc.core.connection.v1.IdentifiedConnection - * @instance - */ - IdentifiedConnection.prototype.id = ""; - - /** - * IdentifiedConnection client_id. - * @member {string} client_id - * @memberof ibc.core.connection.v1.IdentifiedConnection - * @instance - */ - IdentifiedConnection.prototype.client_id = ""; - - /** - * IdentifiedConnection versions. - * @member {Array.} versions - * @memberof ibc.core.connection.v1.IdentifiedConnection - * @instance - */ - IdentifiedConnection.prototype.versions = $util.emptyArray; - - /** - * IdentifiedConnection state. - * @member {ibc.core.connection.v1.State} state - * @memberof ibc.core.connection.v1.IdentifiedConnection - * @instance - */ - IdentifiedConnection.prototype.state = 0; - - /** - * IdentifiedConnection counterparty. - * @member {ibc.core.connection.v1.ICounterparty|null|undefined} counterparty - * @memberof ibc.core.connection.v1.IdentifiedConnection - * @instance - */ - IdentifiedConnection.prototype.counterparty = null; - - /** - * IdentifiedConnection delay_period. - * @member {Long} delay_period - * @memberof ibc.core.connection.v1.IdentifiedConnection - * @instance - */ - IdentifiedConnection.prototype.delay_period = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified IdentifiedConnection message. Does not implicitly {@link ibc.core.connection.v1.IdentifiedConnection.verify|verify} messages. - * @function encode - * @memberof ibc.core.connection.v1.IdentifiedConnection - * @static - * @param {ibc.core.connection.v1.IIdentifiedConnection} message IdentifiedConnection message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - IdentifiedConnection.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); - if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.client_id); - if (message.versions != null && message.versions.length) - for (let i = 0; i < message.versions.length; ++i) - $root.ibc.core.connection.v1.Version.encode(message.versions[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.state); - if (message.counterparty != null && Object.hasOwnProperty.call(message, "counterparty")) - $root.ibc.core.connection.v1.Counterparty.encode(message.counterparty, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.delay_period != null && Object.hasOwnProperty.call(message, "delay_period")) - writer.uint32(/* id 6, wireType 0 =*/48).uint64(message.delay_period); - return writer; - }; - - /** - * Encodes the specified IdentifiedConnection message, length delimited. Does not implicitly {@link ibc.core.connection.v1.IdentifiedConnection.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.connection.v1.IdentifiedConnection - * @static - * @param {ibc.core.connection.v1.IIdentifiedConnection} message IdentifiedConnection message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - IdentifiedConnection.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an IdentifiedConnection message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.connection.v1.IdentifiedConnection - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.connection.v1.IdentifiedConnection} IdentifiedConnection - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - IdentifiedConnection.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.IdentifiedConnection(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.id = reader.string(); - break; - case 2: - message.client_id = reader.string(); - break; - case 3: - if (!(message.versions && message.versions.length)) - message.versions = []; - message.versions.push($root.ibc.core.connection.v1.Version.decode(reader, reader.uint32())); - break; - case 4: - message.state = reader.int32(); - break; - case 5: - message.counterparty = $root.ibc.core.connection.v1.Counterparty.decode(reader, reader.uint32()); - break; - case 6: - message.delay_period = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an IdentifiedConnection message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.connection.v1.IdentifiedConnection - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.connection.v1.IdentifiedConnection} IdentifiedConnection - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - IdentifiedConnection.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an IdentifiedConnection message. - * @function verify - * @memberof ibc.core.connection.v1.IdentifiedConnection - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - IdentifiedConnection.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isString(message.id)) - return "id: string expected"; - if (message.client_id != null && message.hasOwnProperty("client_id")) - if (!$util.isString(message.client_id)) - return "client_id: string expected"; - if (message.versions != null && message.hasOwnProperty("versions")) { - if (!Array.isArray(message.versions)) - return "versions: array expected"; - for (let i = 0; i < message.versions.length; ++i) { - let error = $root.ibc.core.connection.v1.Version.verify(message.versions[i]); - if (error) - return "versions." + error; - } - } - if (message.state != null && message.hasOwnProperty("state")) - switch (message.state) { - default: - return "state: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.counterparty != null && message.hasOwnProperty("counterparty")) { - let error = $root.ibc.core.connection.v1.Counterparty.verify(message.counterparty); - if (error) - return "counterparty." + error; - } - if (message.delay_period != null && message.hasOwnProperty("delay_period")) - if (!$util.isInteger(message.delay_period) && !(message.delay_period && $util.isInteger(message.delay_period.low) && $util.isInteger(message.delay_period.high))) - return "delay_period: integer|Long expected"; - return null; - }; - - /** - * Creates an IdentifiedConnection message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.connection.v1.IdentifiedConnection - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.connection.v1.IdentifiedConnection} IdentifiedConnection - */ - IdentifiedConnection.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.connection.v1.IdentifiedConnection) - return object; - let message = new $root.ibc.core.connection.v1.IdentifiedConnection(); - if (object.id != null) - message.id = String(object.id); - if (object.client_id != null) - message.client_id = String(object.client_id); - if (object.versions) { - if (!Array.isArray(object.versions)) - throw TypeError(".ibc.core.connection.v1.IdentifiedConnection.versions: array expected"); - message.versions = []; - for (let i = 0; i < object.versions.length; ++i) { - if (typeof object.versions[i] !== "object") - throw TypeError(".ibc.core.connection.v1.IdentifiedConnection.versions: object expected"); - message.versions[i] = $root.ibc.core.connection.v1.Version.fromObject(object.versions[i]); - } - } - switch (object.state) { - case "STATE_UNINITIALIZED_UNSPECIFIED": - case 0: - message.state = 0; - break; - case "STATE_INIT": - case 1: - message.state = 1; - break; - case "STATE_TRYOPEN": - case 2: - message.state = 2; - break; - case "STATE_OPEN": - case 3: - message.state = 3; - break; - } - if (object.counterparty != null) { - if (typeof object.counterparty !== "object") - throw TypeError(".ibc.core.connection.v1.IdentifiedConnection.counterparty: object expected"); - message.counterparty = $root.ibc.core.connection.v1.Counterparty.fromObject(object.counterparty); - } - if (object.delay_period != null) - if ($util.Long) - (message.delay_period = $util.Long.fromValue(object.delay_period)).unsigned = true; - else if (typeof object.delay_period === "string") - message.delay_period = parseInt(object.delay_period, 10); - else if (typeof object.delay_period === "number") - message.delay_period = object.delay_period; - else if (typeof object.delay_period === "object") - message.delay_period = new $util.LongBits(object.delay_period.low >>> 0, object.delay_period.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from an IdentifiedConnection message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.connection.v1.IdentifiedConnection - * @static - * @param {ibc.core.connection.v1.IdentifiedConnection} message IdentifiedConnection - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - IdentifiedConnection.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.versions = []; - if (options.defaults) { - object.id = ""; - object.client_id = ""; - object.state = options.enums === String ? "STATE_UNINITIALIZED_UNSPECIFIED" : 0; - object.counterparty = null; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.delay_period = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.delay_period = options.longs === String ? "0" : 0; - } - if (message.id != null && message.hasOwnProperty("id")) - object.id = message.id; - if (message.client_id != null && message.hasOwnProperty("client_id")) - object.client_id = message.client_id; - if (message.versions && message.versions.length) { - object.versions = []; - for (let j = 0; j < message.versions.length; ++j) - object.versions[j] = $root.ibc.core.connection.v1.Version.toObject(message.versions[j], options); - } - if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.ibc.core.connection.v1.State[message.state] : message.state; - if (message.counterparty != null && message.hasOwnProperty("counterparty")) - object.counterparty = $root.ibc.core.connection.v1.Counterparty.toObject(message.counterparty, options); - if (message.delay_period != null && message.hasOwnProperty("delay_period")) - if (typeof message.delay_period === "number") - object.delay_period = options.longs === String ? String(message.delay_period) : message.delay_period; - else - object.delay_period = options.longs === String ? $util.Long.prototype.toString.call(message.delay_period) : options.longs === Number ? new $util.LongBits(message.delay_period.low >>> 0, message.delay_period.high >>> 0).toNumber(true) : message.delay_period; - return object; - }; - - /** - * Converts this IdentifiedConnection to JSON. - * @function toJSON - * @memberof ibc.core.connection.v1.IdentifiedConnection - * @instance - * @returns {Object.} JSON object - */ - IdentifiedConnection.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return IdentifiedConnection; - })(); - - /** - * State enum. - * @name ibc.core.connection.v1.State - * @enum {number} - * @property {number} STATE_UNINITIALIZED_UNSPECIFIED=0 STATE_UNINITIALIZED_UNSPECIFIED value - * @property {number} STATE_INIT=1 STATE_INIT value - * @property {number} STATE_TRYOPEN=2 STATE_TRYOPEN value - * @property {number} STATE_OPEN=3 STATE_OPEN value - */ - v1.State = (function() { - const valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STATE_UNINITIALIZED_UNSPECIFIED"] = 0; - values[valuesById[1] = "STATE_INIT"] = 1; - values[valuesById[2] = "STATE_TRYOPEN"] = 2; - values[valuesById[3] = "STATE_OPEN"] = 3; - return values; - })(); - - v1.Counterparty = (function() { - - /** - * Properties of a Counterparty. - * @memberof ibc.core.connection.v1 - * @interface ICounterparty - * @property {string|null} [client_id] Counterparty client_id - * @property {string|null} [connection_id] Counterparty connection_id - * @property {ibc.core.commitment.v1.IMerklePrefix|null} [prefix] Counterparty prefix - */ - - /** - * Constructs a new Counterparty. - * @memberof ibc.core.connection.v1 - * @classdesc Represents a Counterparty. - * @implements ICounterparty - * @constructor - * @param {ibc.core.connection.v1.ICounterparty=} [properties] Properties to set - */ - function Counterparty(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Counterparty client_id. - * @member {string} client_id - * @memberof ibc.core.connection.v1.Counterparty - * @instance - */ - Counterparty.prototype.client_id = ""; - - /** - * Counterparty connection_id. - * @member {string} connection_id - * @memberof ibc.core.connection.v1.Counterparty - * @instance - */ - Counterparty.prototype.connection_id = ""; - - /** - * Counterparty prefix. - * @member {ibc.core.commitment.v1.IMerklePrefix|null|undefined} prefix - * @memberof ibc.core.connection.v1.Counterparty - * @instance - */ - Counterparty.prototype.prefix = null; - - /** - * Encodes the specified Counterparty message. Does not implicitly {@link ibc.core.connection.v1.Counterparty.verify|verify} messages. - * @function encode - * @memberof ibc.core.connection.v1.Counterparty - * @static - * @param {ibc.core.connection.v1.ICounterparty} message Counterparty message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Counterparty.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); - if (message.connection_id != null && Object.hasOwnProperty.call(message, "connection_id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.connection_id); - if (message.prefix != null && Object.hasOwnProperty.call(message, "prefix")) - $root.ibc.core.commitment.v1.MerklePrefix.encode(message.prefix, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Counterparty message, length delimited. Does not implicitly {@link ibc.core.connection.v1.Counterparty.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.connection.v1.Counterparty - * @static - * @param {ibc.core.connection.v1.ICounterparty} message Counterparty message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Counterparty.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Counterparty message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.connection.v1.Counterparty - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.connection.v1.Counterparty} Counterparty - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Counterparty.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.Counterparty(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.client_id = reader.string(); - break; - case 2: - message.connection_id = reader.string(); - break; - case 3: - message.prefix = $root.ibc.core.commitment.v1.MerklePrefix.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Counterparty message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.connection.v1.Counterparty - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.connection.v1.Counterparty} Counterparty - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Counterparty.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Counterparty message. - * @function verify - * @memberof ibc.core.connection.v1.Counterparty - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Counterparty.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.client_id != null && message.hasOwnProperty("client_id")) - if (!$util.isString(message.client_id)) - return "client_id: string expected"; - if (message.connection_id != null && message.hasOwnProperty("connection_id")) - if (!$util.isString(message.connection_id)) - return "connection_id: string expected"; - if (message.prefix != null && message.hasOwnProperty("prefix")) { - let error = $root.ibc.core.commitment.v1.MerklePrefix.verify(message.prefix); - if (error) - return "prefix." + error; - } - return null; - }; - - /** - * Creates a Counterparty message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.connection.v1.Counterparty - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.connection.v1.Counterparty} Counterparty - */ - Counterparty.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.connection.v1.Counterparty) - return object; - let message = new $root.ibc.core.connection.v1.Counterparty(); - if (object.client_id != null) - message.client_id = String(object.client_id); - if (object.connection_id != null) - message.connection_id = String(object.connection_id); - if (object.prefix != null) { - if (typeof object.prefix !== "object") - throw TypeError(".ibc.core.connection.v1.Counterparty.prefix: object expected"); - message.prefix = $root.ibc.core.commitment.v1.MerklePrefix.fromObject(object.prefix); - } - return message; - }; - - /** - * Creates a plain object from a Counterparty message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.connection.v1.Counterparty - * @static - * @param {ibc.core.connection.v1.Counterparty} message Counterparty - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Counterparty.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.client_id = ""; - object.connection_id = ""; - object.prefix = null; - } - if (message.client_id != null && message.hasOwnProperty("client_id")) - object.client_id = message.client_id; - if (message.connection_id != null && message.hasOwnProperty("connection_id")) - object.connection_id = message.connection_id; - if (message.prefix != null && message.hasOwnProperty("prefix")) - object.prefix = $root.ibc.core.commitment.v1.MerklePrefix.toObject(message.prefix, options); - return object; - }; - - /** - * Converts this Counterparty to JSON. - * @function toJSON - * @memberof ibc.core.connection.v1.Counterparty - * @instance - * @returns {Object.} JSON object - */ - Counterparty.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Counterparty; - })(); - - v1.ClientPaths = (function() { - - /** - * Properties of a ClientPaths. - * @memberof ibc.core.connection.v1 - * @interface IClientPaths - * @property {Array.|null} [paths] ClientPaths paths - */ - - /** - * Constructs a new ClientPaths. - * @memberof ibc.core.connection.v1 - * @classdesc Represents a ClientPaths. - * @implements IClientPaths - * @constructor - * @param {ibc.core.connection.v1.IClientPaths=} [properties] Properties to set - */ - function ClientPaths(properties) { - this.paths = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ClientPaths paths. - * @member {Array.} paths - * @memberof ibc.core.connection.v1.ClientPaths - * @instance - */ - ClientPaths.prototype.paths = $util.emptyArray; - - /** - * Encodes the specified ClientPaths message. Does not implicitly {@link ibc.core.connection.v1.ClientPaths.verify|verify} messages. - * @function encode - * @memberof ibc.core.connection.v1.ClientPaths - * @static - * @param {ibc.core.connection.v1.IClientPaths} message ClientPaths message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ClientPaths.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.paths != null && message.paths.length) - for (let i = 0; i < message.paths.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.paths[i]); - return writer; - }; - - /** - * Encodes the specified ClientPaths message, length delimited. Does not implicitly {@link ibc.core.connection.v1.ClientPaths.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.connection.v1.ClientPaths - * @static - * @param {ibc.core.connection.v1.IClientPaths} message ClientPaths message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ClientPaths.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ClientPaths message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.connection.v1.ClientPaths - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.connection.v1.ClientPaths} ClientPaths - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ClientPaths.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.ClientPaths(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.paths && message.paths.length)) - message.paths = []; - message.paths.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ClientPaths message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.connection.v1.ClientPaths - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.connection.v1.ClientPaths} ClientPaths - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ClientPaths.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ClientPaths message. - * @function verify - * @memberof ibc.core.connection.v1.ClientPaths - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ClientPaths.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.paths != null && message.hasOwnProperty("paths")) { - if (!Array.isArray(message.paths)) - return "paths: array expected"; - for (let i = 0; i < message.paths.length; ++i) - if (!$util.isString(message.paths[i])) - return "paths: string[] expected"; - } - return null; - }; - - /** - * Creates a ClientPaths message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.connection.v1.ClientPaths - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.connection.v1.ClientPaths} ClientPaths - */ - ClientPaths.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.connection.v1.ClientPaths) - return object; - let message = new $root.ibc.core.connection.v1.ClientPaths(); - if (object.paths) { - if (!Array.isArray(object.paths)) - throw TypeError(".ibc.core.connection.v1.ClientPaths.paths: array expected"); - message.paths = []; - for (let i = 0; i < object.paths.length; ++i) - message.paths[i] = String(object.paths[i]); - } - return message; - }; - - /** - * Creates a plain object from a ClientPaths message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.connection.v1.ClientPaths - * @static - * @param {ibc.core.connection.v1.ClientPaths} message ClientPaths - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ClientPaths.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.paths = []; - if (message.paths && message.paths.length) { - object.paths = []; - for (let j = 0; j < message.paths.length; ++j) - object.paths[j] = message.paths[j]; - } - return object; - }; - - /** - * Converts this ClientPaths to JSON. - * @function toJSON - * @memberof ibc.core.connection.v1.ClientPaths - * @instance - * @returns {Object.} JSON object - */ - ClientPaths.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ClientPaths; - })(); - - v1.ConnectionPaths = (function() { - - /** - * Properties of a ConnectionPaths. - * @memberof ibc.core.connection.v1 - * @interface IConnectionPaths - * @property {string|null} [client_id] ConnectionPaths client_id - * @property {Array.|null} [paths] ConnectionPaths paths - */ - - /** - * Constructs a new ConnectionPaths. - * @memberof ibc.core.connection.v1 - * @classdesc Represents a ConnectionPaths. - * @implements IConnectionPaths - * @constructor - * @param {ibc.core.connection.v1.IConnectionPaths=} [properties] Properties to set - */ - function ConnectionPaths(properties) { - this.paths = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ConnectionPaths client_id. - * @member {string} client_id - * @memberof ibc.core.connection.v1.ConnectionPaths - * @instance - */ - ConnectionPaths.prototype.client_id = ""; - - /** - * ConnectionPaths paths. - * @member {Array.} paths - * @memberof ibc.core.connection.v1.ConnectionPaths - * @instance - */ - ConnectionPaths.prototype.paths = $util.emptyArray; - - /** - * Encodes the specified ConnectionPaths message. Does not implicitly {@link ibc.core.connection.v1.ConnectionPaths.verify|verify} messages. - * @function encode - * @memberof ibc.core.connection.v1.ConnectionPaths - * @static - * @param {ibc.core.connection.v1.IConnectionPaths} message ConnectionPaths message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConnectionPaths.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); - if (message.paths != null && message.paths.length) - for (let i = 0; i < message.paths.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.paths[i]); - return writer; - }; - - /** - * Encodes the specified ConnectionPaths message, length delimited. Does not implicitly {@link ibc.core.connection.v1.ConnectionPaths.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.connection.v1.ConnectionPaths - * @static - * @param {ibc.core.connection.v1.IConnectionPaths} message ConnectionPaths message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConnectionPaths.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ConnectionPaths message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.connection.v1.ConnectionPaths - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.connection.v1.ConnectionPaths} ConnectionPaths - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConnectionPaths.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.ConnectionPaths(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.client_id = reader.string(); - break; - case 2: - if (!(message.paths && message.paths.length)) - message.paths = []; - message.paths.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ConnectionPaths message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.connection.v1.ConnectionPaths - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.connection.v1.ConnectionPaths} ConnectionPaths - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConnectionPaths.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ConnectionPaths message. - * @function verify - * @memberof ibc.core.connection.v1.ConnectionPaths - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ConnectionPaths.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.client_id != null && message.hasOwnProperty("client_id")) - if (!$util.isString(message.client_id)) - return "client_id: string expected"; - if (message.paths != null && message.hasOwnProperty("paths")) { - if (!Array.isArray(message.paths)) - return "paths: array expected"; - for (let i = 0; i < message.paths.length; ++i) - if (!$util.isString(message.paths[i])) - return "paths: string[] expected"; - } - return null; - }; - - /** - * Creates a ConnectionPaths message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.connection.v1.ConnectionPaths - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.connection.v1.ConnectionPaths} ConnectionPaths - */ - ConnectionPaths.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.connection.v1.ConnectionPaths) - return object; - let message = new $root.ibc.core.connection.v1.ConnectionPaths(); - if (object.client_id != null) - message.client_id = String(object.client_id); - if (object.paths) { - if (!Array.isArray(object.paths)) - throw TypeError(".ibc.core.connection.v1.ConnectionPaths.paths: array expected"); - message.paths = []; - for (let i = 0; i < object.paths.length; ++i) - message.paths[i] = String(object.paths[i]); - } - return message; - }; - - /** - * Creates a plain object from a ConnectionPaths message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.connection.v1.ConnectionPaths - * @static - * @param {ibc.core.connection.v1.ConnectionPaths} message ConnectionPaths - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ConnectionPaths.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.paths = []; - if (options.defaults) - object.client_id = ""; - if (message.client_id != null && message.hasOwnProperty("client_id")) - object.client_id = message.client_id; - if (message.paths && message.paths.length) { - object.paths = []; - for (let j = 0; j < message.paths.length; ++j) - object.paths[j] = message.paths[j]; - } - return object; - }; - - /** - * Converts this ConnectionPaths to JSON. - * @function toJSON - * @memberof ibc.core.connection.v1.ConnectionPaths - * @instance - * @returns {Object.} JSON object - */ - ConnectionPaths.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ConnectionPaths; - })(); - - v1.Version = (function() { - - /** - * Properties of a Version. - * @memberof ibc.core.connection.v1 - * @interface IVersion - * @property {string|null} [identifier] Version identifier - * @property {Array.|null} [features] Version features - */ - - /** - * Constructs a new Version. - * @memberof ibc.core.connection.v1 - * @classdesc Represents a Version. - * @implements IVersion - * @constructor - * @param {ibc.core.connection.v1.IVersion=} [properties] Properties to set - */ - function Version(properties) { - this.features = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Version identifier. - * @member {string} identifier - * @memberof ibc.core.connection.v1.Version - * @instance - */ - Version.prototype.identifier = ""; - - /** - * Version features. - * @member {Array.} features - * @memberof ibc.core.connection.v1.Version - * @instance - */ - Version.prototype.features = $util.emptyArray; - - /** - * Encodes the specified Version message. Does not implicitly {@link ibc.core.connection.v1.Version.verify|verify} messages. - * @function encode - * @memberof ibc.core.connection.v1.Version - * @static - * @param {ibc.core.connection.v1.IVersion} message Version message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Version.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.identifier != null && Object.hasOwnProperty.call(message, "identifier")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.identifier); - if (message.features != null && message.features.length) - for (let i = 0; i < message.features.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.features[i]); - return writer; - }; - - /** - * Encodes the specified Version message, length delimited. Does not implicitly {@link ibc.core.connection.v1.Version.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.connection.v1.Version - * @static - * @param {ibc.core.connection.v1.IVersion} message Version message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Version.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Version message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.connection.v1.Version - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.connection.v1.Version} Version - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Version.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.Version(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.identifier = reader.string(); - break; - case 2: - if (!(message.features && message.features.length)) - message.features = []; - message.features.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Version message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.connection.v1.Version - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.connection.v1.Version} Version - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Version.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Version message. - * @function verify - * @memberof ibc.core.connection.v1.Version - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Version.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.identifier != null && message.hasOwnProperty("identifier")) - if (!$util.isString(message.identifier)) - return "identifier: string expected"; - if (message.features != null && message.hasOwnProperty("features")) { - if (!Array.isArray(message.features)) - return "features: array expected"; - for (let i = 0; i < message.features.length; ++i) - if (!$util.isString(message.features[i])) - return "features: string[] expected"; - } - return null; - }; - - /** - * Creates a Version message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.connection.v1.Version - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.connection.v1.Version} Version - */ - Version.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.connection.v1.Version) - return object; - let message = new $root.ibc.core.connection.v1.Version(); - if (object.identifier != null) - message.identifier = String(object.identifier); - if (object.features) { - if (!Array.isArray(object.features)) - throw TypeError(".ibc.core.connection.v1.Version.features: array expected"); - message.features = []; - for (let i = 0; i < object.features.length; ++i) - message.features[i] = String(object.features[i]); - } - return message; - }; - - /** - * Creates a plain object from a Version message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.connection.v1.Version - * @static - * @param {ibc.core.connection.v1.Version} message Version - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Version.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.features = []; - if (options.defaults) - object.identifier = ""; - if (message.identifier != null && message.hasOwnProperty("identifier")) - object.identifier = message.identifier; - if (message.features && message.features.length) { - object.features = []; - for (let j = 0; j < message.features.length; ++j) - object.features[j] = message.features[j]; - } - return object; - }; - - /** - * Converts this Version to JSON. - * @function toJSON - * @memberof ibc.core.connection.v1.Version - * @instance - * @returns {Object.} JSON object - */ - Version.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Version; - })(); - - v1.GenesisState = (function() { - - /** - * Properties of a GenesisState. - * @memberof ibc.core.connection.v1 - * @interface IGenesisState - * @property {Array.|null} [connections] GenesisState connections - * @property {Array.|null} [client_connection_paths] GenesisState client_connection_paths - * @property {Long|null} [next_connection_sequence] GenesisState next_connection_sequence - */ - - /** - * Constructs a new GenesisState. - * @memberof ibc.core.connection.v1 - * @classdesc Represents a GenesisState. - * @implements IGenesisState - * @constructor - * @param {ibc.core.connection.v1.IGenesisState=} [properties] Properties to set - */ - function GenesisState(properties) { - this.connections = []; - this.client_connection_paths = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GenesisState connections. - * @member {Array.} connections - * @memberof ibc.core.connection.v1.GenesisState - * @instance - */ - GenesisState.prototype.connections = $util.emptyArray; - - /** - * GenesisState client_connection_paths. - * @member {Array.} client_connection_paths - * @memberof ibc.core.connection.v1.GenesisState - * @instance - */ - GenesisState.prototype.client_connection_paths = $util.emptyArray; - - /** - * GenesisState next_connection_sequence. - * @member {Long} next_connection_sequence - * @memberof ibc.core.connection.v1.GenesisState - * @instance - */ - GenesisState.prototype.next_connection_sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified GenesisState message. Does not implicitly {@link ibc.core.connection.v1.GenesisState.verify|verify} messages. - * @function encode - * @memberof ibc.core.connection.v1.GenesisState - * @static - * @param {ibc.core.connection.v1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.connections != null && message.connections.length) - for (let i = 0; i < message.connections.length; ++i) - $root.ibc.core.connection.v1.IdentifiedConnection.encode(message.connections[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.client_connection_paths != null && message.client_connection_paths.length) - for (let i = 0; i < message.client_connection_paths.length; ++i) - $root.ibc.core.connection.v1.ConnectionPaths.encode(message.client_connection_paths[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.next_connection_sequence != null && Object.hasOwnProperty.call(message, "next_connection_sequence")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.next_connection_sequence); - return writer; - }; - - /** - * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link ibc.core.connection.v1.GenesisState.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.connection.v1.GenesisState - * @static - * @param {ibc.core.connection.v1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.connection.v1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.connection.v1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.connection.v1.GenesisState(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.connections && message.connections.length)) - message.connections = []; - message.connections.push($root.ibc.core.connection.v1.IdentifiedConnection.decode(reader, reader.uint32())); - break; - case 2: - if (!(message.client_connection_paths && message.client_connection_paths.length)) - message.client_connection_paths = []; - message.client_connection_paths.push($root.ibc.core.connection.v1.ConnectionPaths.decode(reader, reader.uint32())); - break; - case 3: - message.next_connection_sequence = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.connection.v1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.connection.v1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GenesisState message. - * @function verify - * @memberof ibc.core.connection.v1.GenesisState - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GenesisState.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.connections != null && message.hasOwnProperty("connections")) { - if (!Array.isArray(message.connections)) - return "connections: array expected"; - for (let i = 0; i < message.connections.length; ++i) { - let error = $root.ibc.core.connection.v1.IdentifiedConnection.verify(message.connections[i]); - if (error) - return "connections." + error; - } - } - if (message.client_connection_paths != null && message.hasOwnProperty("client_connection_paths")) { - if (!Array.isArray(message.client_connection_paths)) - return "client_connection_paths: array expected"; - for (let i = 0; i < message.client_connection_paths.length; ++i) { - let error = $root.ibc.core.connection.v1.ConnectionPaths.verify(message.client_connection_paths[i]); - if (error) - return "client_connection_paths." + error; - } - } - if (message.next_connection_sequence != null && message.hasOwnProperty("next_connection_sequence")) - if (!$util.isInteger(message.next_connection_sequence) && !(message.next_connection_sequence && $util.isInteger(message.next_connection_sequence.low) && $util.isInteger(message.next_connection_sequence.high))) - return "next_connection_sequence: integer|Long expected"; - return null; - }; - - /** - * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.connection.v1.GenesisState - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.connection.v1.GenesisState} GenesisState - */ - GenesisState.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.connection.v1.GenesisState) - return object; - let message = new $root.ibc.core.connection.v1.GenesisState(); - if (object.connections) { - if (!Array.isArray(object.connections)) - throw TypeError(".ibc.core.connection.v1.GenesisState.connections: array expected"); - message.connections = []; - for (let i = 0; i < object.connections.length; ++i) { - if (typeof object.connections[i] !== "object") - throw TypeError(".ibc.core.connection.v1.GenesisState.connections: object expected"); - message.connections[i] = $root.ibc.core.connection.v1.IdentifiedConnection.fromObject(object.connections[i]); - } - } - if (object.client_connection_paths) { - if (!Array.isArray(object.client_connection_paths)) - throw TypeError(".ibc.core.connection.v1.GenesisState.client_connection_paths: array expected"); - message.client_connection_paths = []; - for (let i = 0; i < object.client_connection_paths.length; ++i) { - if (typeof object.client_connection_paths[i] !== "object") - throw TypeError(".ibc.core.connection.v1.GenesisState.client_connection_paths: object expected"); - message.client_connection_paths[i] = $root.ibc.core.connection.v1.ConnectionPaths.fromObject(object.client_connection_paths[i]); - } - } - if (object.next_connection_sequence != null) - if ($util.Long) - (message.next_connection_sequence = $util.Long.fromValue(object.next_connection_sequence)).unsigned = true; - else if (typeof object.next_connection_sequence === "string") - message.next_connection_sequence = parseInt(object.next_connection_sequence, 10); - else if (typeof object.next_connection_sequence === "number") - message.next_connection_sequence = object.next_connection_sequence; - else if (typeof object.next_connection_sequence === "object") - message.next_connection_sequence = new $util.LongBits(object.next_connection_sequence.low >>> 0, object.next_connection_sequence.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a GenesisState message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.connection.v1.GenesisState - * @static - * @param {ibc.core.connection.v1.GenesisState} message GenesisState - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GenesisState.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) { - object.connections = []; - object.client_connection_paths = []; - } - if (options.defaults) - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.next_connection_sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.next_connection_sequence = options.longs === String ? "0" : 0; - if (message.connections && message.connections.length) { - object.connections = []; - for (let j = 0; j < message.connections.length; ++j) - object.connections[j] = $root.ibc.core.connection.v1.IdentifiedConnection.toObject(message.connections[j], options); - } - if (message.client_connection_paths && message.client_connection_paths.length) { - object.client_connection_paths = []; - for (let j = 0; j < message.client_connection_paths.length; ++j) - object.client_connection_paths[j] = $root.ibc.core.connection.v1.ConnectionPaths.toObject(message.client_connection_paths[j], options); - } - if (message.next_connection_sequence != null && message.hasOwnProperty("next_connection_sequence")) - if (typeof message.next_connection_sequence === "number") - object.next_connection_sequence = options.longs === String ? String(message.next_connection_sequence) : message.next_connection_sequence; - else - object.next_connection_sequence = options.longs === String ? $util.Long.prototype.toString.call(message.next_connection_sequence) : options.longs === Number ? new $util.LongBits(message.next_connection_sequence.low >>> 0, message.next_connection_sequence.high >>> 0).toNumber(true) : message.next_connection_sequence; - return object; - }; - - /** - * Converts this GenesisState to JSON. - * @function toJSON - * @memberof ibc.core.connection.v1.GenesisState - * @instance - * @returns {Object.} JSON object - */ - GenesisState.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GenesisState; - })(); - - return v1; - })(); - - return connection; - })(); - - core.types = (function() { - - /** - * Namespace types. - * @memberof ibc.core - * @namespace - */ - const types = {}; - - types.v1 = (function() { - - /** - * Namespace v1. - * @memberof ibc.core.types - * @namespace - */ - const v1 = {}; - - v1.GenesisState = (function() { - - /** - * Properties of a GenesisState. - * @memberof ibc.core.types.v1 - * @interface IGenesisState - * @property {ibc.core.client.v1.IGenesisState|null} [client_genesis] GenesisState client_genesis - * @property {ibc.core.connection.v1.IGenesisState|null} [connection_genesis] GenesisState connection_genesis - * @property {ibc.core.channel.v1.IGenesisState|null} [channel_genesis] GenesisState channel_genesis - */ - - /** - * Constructs a new GenesisState. - * @memberof ibc.core.types.v1 - * @classdesc Represents a GenesisState. - * @implements IGenesisState - * @constructor - * @param {ibc.core.types.v1.IGenesisState=} [properties] Properties to set - */ - function GenesisState(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GenesisState client_genesis. - * @member {ibc.core.client.v1.IGenesisState|null|undefined} client_genesis - * @memberof ibc.core.types.v1.GenesisState - * @instance - */ - GenesisState.prototype.client_genesis = null; - - /** - * GenesisState connection_genesis. - * @member {ibc.core.connection.v1.IGenesisState|null|undefined} connection_genesis - * @memberof ibc.core.types.v1.GenesisState - * @instance - */ - GenesisState.prototype.connection_genesis = null; - - /** - * GenesisState channel_genesis. - * @member {ibc.core.channel.v1.IGenesisState|null|undefined} channel_genesis - * @memberof ibc.core.types.v1.GenesisState - * @instance - */ - GenesisState.prototype.channel_genesis = null; - - /** - * Encodes the specified GenesisState message. Does not implicitly {@link ibc.core.types.v1.GenesisState.verify|verify} messages. - * @function encode - * @memberof ibc.core.types.v1.GenesisState - * @static - * @param {ibc.core.types.v1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.client_genesis != null && Object.hasOwnProperty.call(message, "client_genesis")) - $root.ibc.core.client.v1.GenesisState.encode(message.client_genesis, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.connection_genesis != null && Object.hasOwnProperty.call(message, "connection_genesis")) - $root.ibc.core.connection.v1.GenesisState.encode(message.connection_genesis, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.channel_genesis != null && Object.hasOwnProperty.call(message, "channel_genesis")) - $root.ibc.core.channel.v1.GenesisState.encode(message.channel_genesis, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GenesisState message, length delimited. Does not implicitly {@link ibc.core.types.v1.GenesisState.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.core.types.v1.GenesisState - * @static - * @param {ibc.core.types.v1.IGenesisState} message GenesisState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenesisState.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer. - * @function decode - * @memberof ibc.core.types.v1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.core.types.v1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.core.types.v1.GenesisState(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.client_genesis = $root.ibc.core.client.v1.GenesisState.decode(reader, reader.uint32()); - break; - case 2: - message.connection_genesis = $root.ibc.core.connection.v1.GenesisState.decode(reader, reader.uint32()); - break; - case 3: - message.channel_genesis = $root.ibc.core.channel.v1.GenesisState.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GenesisState message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.core.types.v1.GenesisState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.core.types.v1.GenesisState} GenesisState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenesisState.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GenesisState message. - * @function verify - * @memberof ibc.core.types.v1.GenesisState - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GenesisState.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.client_genesis != null && message.hasOwnProperty("client_genesis")) { - let error = $root.ibc.core.client.v1.GenesisState.verify(message.client_genesis); - if (error) - return "client_genesis." + error; - } - if (message.connection_genesis != null && message.hasOwnProperty("connection_genesis")) { - let error = $root.ibc.core.connection.v1.GenesisState.verify(message.connection_genesis); - if (error) - return "connection_genesis." + error; - } - if (message.channel_genesis != null && message.hasOwnProperty("channel_genesis")) { - let error = $root.ibc.core.channel.v1.GenesisState.verify(message.channel_genesis); - if (error) - return "channel_genesis." + error; - } - return null; - }; - - /** - * Creates a GenesisState message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.core.types.v1.GenesisState - * @static - * @param {Object.} object Plain object - * @returns {ibc.core.types.v1.GenesisState} GenesisState - */ - GenesisState.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.core.types.v1.GenesisState) - return object; - let message = new $root.ibc.core.types.v1.GenesisState(); - if (object.client_genesis != null) { - if (typeof object.client_genesis !== "object") - throw TypeError(".ibc.core.types.v1.GenesisState.client_genesis: object expected"); - message.client_genesis = $root.ibc.core.client.v1.GenesisState.fromObject(object.client_genesis); - } - if (object.connection_genesis != null) { - if (typeof object.connection_genesis !== "object") - throw TypeError(".ibc.core.types.v1.GenesisState.connection_genesis: object expected"); - message.connection_genesis = $root.ibc.core.connection.v1.GenesisState.fromObject(object.connection_genesis); - } - if (object.channel_genesis != null) { - if (typeof object.channel_genesis !== "object") - throw TypeError(".ibc.core.types.v1.GenesisState.channel_genesis: object expected"); - message.channel_genesis = $root.ibc.core.channel.v1.GenesisState.fromObject(object.channel_genesis); - } - return message; - }; - - /** - * Creates a plain object from a GenesisState message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.core.types.v1.GenesisState - * @static - * @param {ibc.core.types.v1.GenesisState} message GenesisState - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GenesisState.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.client_genesis = null; - object.connection_genesis = null; - object.channel_genesis = null; - } - if (message.client_genesis != null && message.hasOwnProperty("client_genesis")) - object.client_genesis = $root.ibc.core.client.v1.GenesisState.toObject(message.client_genesis, options); - if (message.connection_genesis != null && message.hasOwnProperty("connection_genesis")) - object.connection_genesis = $root.ibc.core.connection.v1.GenesisState.toObject(message.connection_genesis, options); - if (message.channel_genesis != null && message.hasOwnProperty("channel_genesis")) - object.channel_genesis = $root.ibc.core.channel.v1.GenesisState.toObject(message.channel_genesis, options); - return object; - }; - - /** - * Converts this GenesisState to JSON. - * @function toJSON - * @memberof ibc.core.types.v1.GenesisState - * @instance - * @returns {Object.} JSON object - */ - GenesisState.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return GenesisState; - })(); - - return v1; - })(); - - return types; - })(); - - return core; - })(); - - ibc.lightclients = (function() { - - /** - * Namespace lightclients. - * @memberof ibc - * @namespace - */ - const lightclients = {}; - - lightclients.localhost = (function() { - - /** - * Namespace localhost. - * @memberof ibc.lightclients - * @namespace - */ - const localhost = {}; - - localhost.v1 = (function() { - - /** - * Namespace v1. - * @memberof ibc.lightclients.localhost - * @namespace - */ - const v1 = {}; - - v1.ClientState = (function() { - - /** - * Properties of a ClientState. - * @memberof ibc.lightclients.localhost.v1 - * @interface IClientState - * @property {string|null} [chain_id] ClientState chain_id - * @property {ibc.core.client.v1.IHeight|null} [height] ClientState height - */ - - /** - * Constructs a new ClientState. - * @memberof ibc.lightclients.localhost.v1 - * @classdesc Represents a ClientState. - * @implements IClientState - * @constructor - * @param {ibc.lightclients.localhost.v1.IClientState=} [properties] Properties to set - */ - function ClientState(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ClientState chain_id. - * @member {string} chain_id - * @memberof ibc.lightclients.localhost.v1.ClientState - * @instance - */ - ClientState.prototype.chain_id = ""; - - /** - * ClientState height. - * @member {ibc.core.client.v1.IHeight|null|undefined} height - * @memberof ibc.lightclients.localhost.v1.ClientState - * @instance - */ - ClientState.prototype.height = null; - - /** - * Encodes the specified ClientState message. Does not implicitly {@link ibc.lightclients.localhost.v1.ClientState.verify|verify} messages. - * @function encode - * @memberof ibc.lightclients.localhost.v1.ClientState - * @static - * @param {ibc.lightclients.localhost.v1.IClientState} message ClientState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ClientState.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.chain_id != null && Object.hasOwnProperty.call(message, "chain_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.chain_id); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - $root.ibc.core.client.v1.Height.encode(message.height, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ClientState message, length delimited. Does not implicitly {@link ibc.lightclients.localhost.v1.ClientState.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.lightclients.localhost.v1.ClientState - * @static - * @param {ibc.lightclients.localhost.v1.IClientState} message ClientState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ClientState.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ClientState message from the specified reader or buffer. - * @function decode - * @memberof ibc.lightclients.localhost.v1.ClientState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.lightclients.localhost.v1.ClientState} ClientState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ClientState.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.localhost.v1.ClientState(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.chain_id = reader.string(); - break; - case 2: - message.height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ClientState message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.lightclients.localhost.v1.ClientState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.lightclients.localhost.v1.ClientState} ClientState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ClientState.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ClientState message. - * @function verify - * @memberof ibc.lightclients.localhost.v1.ClientState - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ClientState.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.chain_id != null && message.hasOwnProperty("chain_id")) - if (!$util.isString(message.chain_id)) - return "chain_id: string expected"; - if (message.height != null && message.hasOwnProperty("height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.height); - if (error) - return "height." + error; - } - return null; - }; - - /** - * Creates a ClientState message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.lightclients.localhost.v1.ClientState - * @static - * @param {Object.} object Plain object - * @returns {ibc.lightclients.localhost.v1.ClientState} ClientState - */ - ClientState.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.lightclients.localhost.v1.ClientState) - return object; - let message = new $root.ibc.lightclients.localhost.v1.ClientState(); - if (object.chain_id != null) - message.chain_id = String(object.chain_id); - if (object.height != null) { - if (typeof object.height !== "object") - throw TypeError(".ibc.lightclients.localhost.v1.ClientState.height: object expected"); - message.height = $root.ibc.core.client.v1.Height.fromObject(object.height); - } - return message; - }; - - /** - * Creates a plain object from a ClientState message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.lightclients.localhost.v1.ClientState - * @static - * @param {ibc.lightclients.localhost.v1.ClientState} message ClientState - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ClientState.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.chain_id = ""; - object.height = null; - } - if (message.chain_id != null && message.hasOwnProperty("chain_id")) - object.chain_id = message.chain_id; - if (message.height != null && message.hasOwnProperty("height")) - object.height = $root.ibc.core.client.v1.Height.toObject(message.height, options); - return object; - }; - - /** - * Converts this ClientState to JSON. - * @function toJSON - * @memberof ibc.lightclients.localhost.v1.ClientState - * @instance - * @returns {Object.} JSON object - */ - ClientState.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ClientState; - })(); - - return v1; - })(); - - return localhost; - })(); - - lightclients.solomachine = (function() { - - /** - * Namespace solomachine. - * @memberof ibc.lightclients - * @namespace - */ - const solomachine = {}; - - solomachine.v1 = (function() { - - /** - * Namespace v1. - * @memberof ibc.lightclients.solomachine - * @namespace - */ - const v1 = {}; - - v1.ClientState = (function() { - - /** - * Properties of a ClientState. - * @memberof ibc.lightclients.solomachine.v1 - * @interface IClientState - * @property {Long|null} [sequence] ClientState sequence - * @property {Long|null} [frozen_sequence] ClientState frozen_sequence - * @property {ibc.lightclients.solomachine.v1.IConsensusState|null} [consensus_state] ClientState consensus_state - * @property {boolean|null} [allow_update_after_proposal] ClientState allow_update_after_proposal - */ - - /** - * Constructs a new ClientState. - * @memberof ibc.lightclients.solomachine.v1 - * @classdesc Represents a ClientState. - * @implements IClientState - * @constructor - * @param {ibc.lightclients.solomachine.v1.IClientState=} [properties] Properties to set - */ - function ClientState(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ClientState sequence. - * @member {Long} sequence - * @memberof ibc.lightclients.solomachine.v1.ClientState - * @instance - */ - ClientState.prototype.sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * ClientState frozen_sequence. - * @member {Long} frozen_sequence - * @memberof ibc.lightclients.solomachine.v1.ClientState - * @instance - */ - ClientState.prototype.frozen_sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * ClientState consensus_state. - * @member {ibc.lightclients.solomachine.v1.IConsensusState|null|undefined} consensus_state - * @memberof ibc.lightclients.solomachine.v1.ClientState - * @instance - */ - ClientState.prototype.consensus_state = null; - - /** - * ClientState allow_update_after_proposal. - * @member {boolean} allow_update_after_proposal - * @memberof ibc.lightclients.solomachine.v1.ClientState - * @instance - */ - ClientState.prototype.allow_update_after_proposal = false; - - /** - * Encodes the specified ClientState message. Does not implicitly {@link ibc.lightclients.solomachine.v1.ClientState.verify|verify} messages. - * @function encode - * @memberof ibc.lightclients.solomachine.v1.ClientState - * @static - * @param {ibc.lightclients.solomachine.v1.IClientState} message ClientState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ClientState.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.sequence != null && Object.hasOwnProperty.call(message, "sequence")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.sequence); - if (message.frozen_sequence != null && Object.hasOwnProperty.call(message, "frozen_sequence")) - writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.frozen_sequence); - if (message.consensus_state != null && Object.hasOwnProperty.call(message, "consensus_state")) - $root.ibc.lightclients.solomachine.v1.ConsensusState.encode(message.consensus_state, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.allow_update_after_proposal != null && Object.hasOwnProperty.call(message, "allow_update_after_proposal")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.allow_update_after_proposal); - return writer; - }; - - /** - * Encodes the specified ClientState message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.ClientState.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.lightclients.solomachine.v1.ClientState - * @static - * @param {ibc.lightclients.solomachine.v1.IClientState} message ClientState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ClientState.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ClientState message from the specified reader or buffer. - * @function decode - * @memberof ibc.lightclients.solomachine.v1.ClientState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.lightclients.solomachine.v1.ClientState} ClientState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ClientState.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.ClientState(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.sequence = reader.uint64(); - break; - case 2: - message.frozen_sequence = reader.uint64(); - break; - case 3: - message.consensus_state = $root.ibc.lightclients.solomachine.v1.ConsensusState.decode(reader, reader.uint32()); - break; - case 4: - message.allow_update_after_proposal = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ClientState message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.lightclients.solomachine.v1.ClientState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.lightclients.solomachine.v1.ClientState} ClientState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ClientState.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ClientState message. - * @function verify - * @memberof ibc.lightclients.solomachine.v1.ClientState - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ClientState.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.sequence != null && message.hasOwnProperty("sequence")) - if (!$util.isInteger(message.sequence) && !(message.sequence && $util.isInteger(message.sequence.low) && $util.isInteger(message.sequence.high))) - return "sequence: integer|Long expected"; - if (message.frozen_sequence != null && message.hasOwnProperty("frozen_sequence")) - if (!$util.isInteger(message.frozen_sequence) && !(message.frozen_sequence && $util.isInteger(message.frozen_sequence.low) && $util.isInteger(message.frozen_sequence.high))) - return "frozen_sequence: integer|Long expected"; - if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) { - let error = $root.ibc.lightclients.solomachine.v1.ConsensusState.verify(message.consensus_state); - if (error) - return "consensus_state." + error; - } - if (message.allow_update_after_proposal != null && message.hasOwnProperty("allow_update_after_proposal")) - if (typeof message.allow_update_after_proposal !== "boolean") - return "allow_update_after_proposal: boolean expected"; - return null; - }; - - /** - * Creates a ClientState message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.lightclients.solomachine.v1.ClientState - * @static - * @param {Object.} object Plain object - * @returns {ibc.lightclients.solomachine.v1.ClientState} ClientState - */ - ClientState.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.lightclients.solomachine.v1.ClientState) - return object; - let message = new $root.ibc.lightclients.solomachine.v1.ClientState(); - if (object.sequence != null) - if ($util.Long) - (message.sequence = $util.Long.fromValue(object.sequence)).unsigned = true; - else if (typeof object.sequence === "string") - message.sequence = parseInt(object.sequence, 10); - else if (typeof object.sequence === "number") - message.sequence = object.sequence; - else if (typeof object.sequence === "object") - message.sequence = new $util.LongBits(object.sequence.low >>> 0, object.sequence.high >>> 0).toNumber(true); - if (object.frozen_sequence != null) - if ($util.Long) - (message.frozen_sequence = $util.Long.fromValue(object.frozen_sequence)).unsigned = true; - else if (typeof object.frozen_sequence === "string") - message.frozen_sequence = parseInt(object.frozen_sequence, 10); - else if (typeof object.frozen_sequence === "number") - message.frozen_sequence = object.frozen_sequence; - else if (typeof object.frozen_sequence === "object") - message.frozen_sequence = new $util.LongBits(object.frozen_sequence.low >>> 0, object.frozen_sequence.high >>> 0).toNumber(true); - if (object.consensus_state != null) { - if (typeof object.consensus_state !== "object") - throw TypeError(".ibc.lightclients.solomachine.v1.ClientState.consensus_state: object expected"); - message.consensus_state = $root.ibc.lightclients.solomachine.v1.ConsensusState.fromObject(object.consensus_state); - } - if (object.allow_update_after_proposal != null) - message.allow_update_after_proposal = Boolean(object.allow_update_after_proposal); - return message; - }; - - /** - * Creates a plain object from a ClientState message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.lightclients.solomachine.v1.ClientState - * @static - * @param {ibc.lightclients.solomachine.v1.ClientState} message ClientState - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ClientState.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.sequence = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.frozen_sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.frozen_sequence = options.longs === String ? "0" : 0; - object.consensus_state = null; - object.allow_update_after_proposal = false; - } - if (message.sequence != null && message.hasOwnProperty("sequence")) - if (typeof message.sequence === "number") - object.sequence = options.longs === String ? String(message.sequence) : message.sequence; - else - object.sequence = options.longs === String ? $util.Long.prototype.toString.call(message.sequence) : options.longs === Number ? new $util.LongBits(message.sequence.low >>> 0, message.sequence.high >>> 0).toNumber(true) : message.sequence; - if (message.frozen_sequence != null && message.hasOwnProperty("frozen_sequence")) - if (typeof message.frozen_sequence === "number") - object.frozen_sequence = options.longs === String ? String(message.frozen_sequence) : message.frozen_sequence; - else - object.frozen_sequence = options.longs === String ? $util.Long.prototype.toString.call(message.frozen_sequence) : options.longs === Number ? new $util.LongBits(message.frozen_sequence.low >>> 0, message.frozen_sequence.high >>> 0).toNumber(true) : message.frozen_sequence; - if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) - object.consensus_state = $root.ibc.lightclients.solomachine.v1.ConsensusState.toObject(message.consensus_state, options); - if (message.allow_update_after_proposal != null && message.hasOwnProperty("allow_update_after_proposal")) - object.allow_update_after_proposal = message.allow_update_after_proposal; - return object; - }; - - /** - * Converts this ClientState to JSON. - * @function toJSON - * @memberof ibc.lightclients.solomachine.v1.ClientState - * @instance - * @returns {Object.} JSON object - */ - ClientState.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ClientState; - })(); - - v1.ConsensusState = (function() { - - /** - * Properties of a ConsensusState. - * @memberof ibc.lightclients.solomachine.v1 - * @interface IConsensusState - * @property {google.protobuf.IAny|null} [public_key] ConsensusState public_key - * @property {string|null} [diversifier] ConsensusState diversifier - * @property {Long|null} [timestamp] ConsensusState timestamp - */ - - /** - * Constructs a new ConsensusState. - * @memberof ibc.lightclients.solomachine.v1 - * @classdesc Represents a ConsensusState. - * @implements IConsensusState - * @constructor - * @param {ibc.lightclients.solomachine.v1.IConsensusState=} [properties] Properties to set - */ - function ConsensusState(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ConsensusState public_key. - * @member {google.protobuf.IAny|null|undefined} public_key - * @memberof ibc.lightclients.solomachine.v1.ConsensusState - * @instance - */ - ConsensusState.prototype.public_key = null; - - /** - * ConsensusState diversifier. - * @member {string} diversifier - * @memberof ibc.lightclients.solomachine.v1.ConsensusState - * @instance - */ - ConsensusState.prototype.diversifier = ""; - - /** - * ConsensusState timestamp. - * @member {Long} timestamp - * @memberof ibc.lightclients.solomachine.v1.ConsensusState - * @instance - */ - ConsensusState.prototype.timestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified ConsensusState message. Does not implicitly {@link ibc.lightclients.solomachine.v1.ConsensusState.verify|verify} messages. - * @function encode - * @memberof ibc.lightclients.solomachine.v1.ConsensusState - * @static - * @param {ibc.lightclients.solomachine.v1.IConsensusState} message ConsensusState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConsensusState.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.public_key != null && Object.hasOwnProperty.call(message, "public_key")) - $root.google.protobuf.Any.encode(message.public_key, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.diversifier != null && Object.hasOwnProperty.call(message, "diversifier")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.diversifier); - if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.timestamp); - return writer; - }; - - /** - * Encodes the specified ConsensusState message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.ConsensusState.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.lightclients.solomachine.v1.ConsensusState - * @static - * @param {ibc.lightclients.solomachine.v1.IConsensusState} message ConsensusState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConsensusState.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ConsensusState message from the specified reader or buffer. - * @function decode - * @memberof ibc.lightclients.solomachine.v1.ConsensusState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.lightclients.solomachine.v1.ConsensusState} ConsensusState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConsensusState.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.ConsensusState(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.public_key = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - case 2: - message.diversifier = reader.string(); - break; - case 3: - message.timestamp = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ConsensusState message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.lightclients.solomachine.v1.ConsensusState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.lightclients.solomachine.v1.ConsensusState} ConsensusState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConsensusState.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ConsensusState message. - * @function verify - * @memberof ibc.lightclients.solomachine.v1.ConsensusState - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ConsensusState.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.public_key != null && message.hasOwnProperty("public_key")) { - let error = $root.google.protobuf.Any.verify(message.public_key); - if (error) - return "public_key." + error; - } - if (message.diversifier != null && message.hasOwnProperty("diversifier")) - if (!$util.isString(message.diversifier)) - return "diversifier: string expected"; - if (message.timestamp != null && message.hasOwnProperty("timestamp")) - if (!$util.isInteger(message.timestamp) && !(message.timestamp && $util.isInteger(message.timestamp.low) && $util.isInteger(message.timestamp.high))) - return "timestamp: integer|Long expected"; - return null; - }; - - /** - * Creates a ConsensusState message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.lightclients.solomachine.v1.ConsensusState - * @static - * @param {Object.} object Plain object - * @returns {ibc.lightclients.solomachine.v1.ConsensusState} ConsensusState - */ - ConsensusState.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.lightclients.solomachine.v1.ConsensusState) - return object; - let message = new $root.ibc.lightclients.solomachine.v1.ConsensusState(); - if (object.public_key != null) { - if (typeof object.public_key !== "object") - throw TypeError(".ibc.lightclients.solomachine.v1.ConsensusState.public_key: object expected"); - message.public_key = $root.google.protobuf.Any.fromObject(object.public_key); - } - if (object.diversifier != null) - message.diversifier = String(object.diversifier); - if (object.timestamp != null) - if ($util.Long) - (message.timestamp = $util.Long.fromValue(object.timestamp)).unsigned = true; - else if (typeof object.timestamp === "string") - message.timestamp = parseInt(object.timestamp, 10); - else if (typeof object.timestamp === "number") - message.timestamp = object.timestamp; - else if (typeof object.timestamp === "object") - message.timestamp = new $util.LongBits(object.timestamp.low >>> 0, object.timestamp.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a ConsensusState message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.lightclients.solomachine.v1.ConsensusState - * @static - * @param {ibc.lightclients.solomachine.v1.ConsensusState} message ConsensusState - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ConsensusState.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.public_key = null; - object.diversifier = ""; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.timestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.timestamp = options.longs === String ? "0" : 0; - } - if (message.public_key != null && message.hasOwnProperty("public_key")) - object.public_key = $root.google.protobuf.Any.toObject(message.public_key, options); - if (message.diversifier != null && message.hasOwnProperty("diversifier")) - object.diversifier = message.diversifier; - if (message.timestamp != null && message.hasOwnProperty("timestamp")) - if (typeof message.timestamp === "number") - object.timestamp = options.longs === String ? String(message.timestamp) : message.timestamp; - else - object.timestamp = options.longs === String ? $util.Long.prototype.toString.call(message.timestamp) : options.longs === Number ? new $util.LongBits(message.timestamp.low >>> 0, message.timestamp.high >>> 0).toNumber(true) : message.timestamp; - return object; - }; - - /** - * Converts this ConsensusState to JSON. - * @function toJSON - * @memberof ibc.lightclients.solomachine.v1.ConsensusState - * @instance - * @returns {Object.} JSON object - */ - ConsensusState.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ConsensusState; - })(); - - v1.Header = (function() { - - /** - * Properties of a Header. - * @memberof ibc.lightclients.solomachine.v1 - * @interface IHeader - * @property {Long|null} [sequence] Header sequence - * @property {Long|null} [timestamp] Header timestamp - * @property {Uint8Array|null} [signature] Header signature - * @property {google.protobuf.IAny|null} [new_public_key] Header new_public_key - * @property {string|null} [new_diversifier] Header new_diversifier - */ - - /** - * Constructs a new Header. - * @memberof ibc.lightclients.solomachine.v1 - * @classdesc Represents a Header. - * @implements IHeader - * @constructor - * @param {ibc.lightclients.solomachine.v1.IHeader=} [properties] Properties to set - */ - function Header(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Header sequence. - * @member {Long} sequence - * @memberof ibc.lightclients.solomachine.v1.Header - * @instance - */ - Header.prototype.sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Header timestamp. - * @member {Long} timestamp - * @memberof ibc.lightclients.solomachine.v1.Header - * @instance - */ - Header.prototype.timestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Header signature. - * @member {Uint8Array} signature - * @memberof ibc.lightclients.solomachine.v1.Header - * @instance - */ - Header.prototype.signature = $util.newBuffer([]); - - /** - * Header new_public_key. - * @member {google.protobuf.IAny|null|undefined} new_public_key - * @memberof ibc.lightclients.solomachine.v1.Header - * @instance - */ - Header.prototype.new_public_key = null; - - /** - * Header new_diversifier. - * @member {string} new_diversifier - * @memberof ibc.lightclients.solomachine.v1.Header - * @instance - */ - Header.prototype.new_diversifier = ""; - - /** - * Encodes the specified Header message. Does not implicitly {@link ibc.lightclients.solomachine.v1.Header.verify|verify} messages. - * @function encode - * @memberof ibc.lightclients.solomachine.v1.Header - * @static - * @param {ibc.lightclients.solomachine.v1.IHeader} message Header message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Header.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.sequence != null && Object.hasOwnProperty.call(message, "sequence")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.sequence); - if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) - writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.timestamp); - if (message.signature != null && Object.hasOwnProperty.call(message, "signature")) - writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.signature); - if (message.new_public_key != null && Object.hasOwnProperty.call(message, "new_public_key")) - $root.google.protobuf.Any.encode(message.new_public_key, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.new_diversifier != null && Object.hasOwnProperty.call(message, "new_diversifier")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.new_diversifier); - return writer; - }; - - /** - * Encodes the specified Header message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.Header.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.lightclients.solomachine.v1.Header - * @static - * @param {ibc.lightclients.solomachine.v1.IHeader} message Header message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Header.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Header message from the specified reader or buffer. - * @function decode - * @memberof ibc.lightclients.solomachine.v1.Header - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.lightclients.solomachine.v1.Header} Header - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Header.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.Header(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.sequence = reader.uint64(); - break; - case 2: - message.timestamp = reader.uint64(); - break; - case 3: - message.signature = reader.bytes(); - break; - case 4: - message.new_public_key = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - case 5: - message.new_diversifier = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Header message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.lightclients.solomachine.v1.Header - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.lightclients.solomachine.v1.Header} Header - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Header.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Header message. - * @function verify - * @memberof ibc.lightclients.solomachine.v1.Header - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Header.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.sequence != null && message.hasOwnProperty("sequence")) - if (!$util.isInteger(message.sequence) && !(message.sequence && $util.isInteger(message.sequence.low) && $util.isInteger(message.sequence.high))) - return "sequence: integer|Long expected"; - if (message.timestamp != null && message.hasOwnProperty("timestamp")) - if (!$util.isInteger(message.timestamp) && !(message.timestamp && $util.isInteger(message.timestamp.low) && $util.isInteger(message.timestamp.high))) - return "timestamp: integer|Long expected"; - if (message.signature != null && message.hasOwnProperty("signature")) - if (!(message.signature && typeof message.signature.length === "number" || $util.isString(message.signature))) - return "signature: buffer expected"; - if (message.new_public_key != null && message.hasOwnProperty("new_public_key")) { - let error = $root.google.protobuf.Any.verify(message.new_public_key); - if (error) - return "new_public_key." + error; - } - if (message.new_diversifier != null && message.hasOwnProperty("new_diversifier")) - if (!$util.isString(message.new_diversifier)) - return "new_diversifier: string expected"; - return null; - }; - - /** - * Creates a Header message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.lightclients.solomachine.v1.Header - * @static - * @param {Object.} object Plain object - * @returns {ibc.lightclients.solomachine.v1.Header} Header - */ - Header.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.lightclients.solomachine.v1.Header) - return object; - let message = new $root.ibc.lightclients.solomachine.v1.Header(); - if (object.sequence != null) - if ($util.Long) - (message.sequence = $util.Long.fromValue(object.sequence)).unsigned = true; - else if (typeof object.sequence === "string") - message.sequence = parseInt(object.sequence, 10); - else if (typeof object.sequence === "number") - message.sequence = object.sequence; - else if (typeof object.sequence === "object") - message.sequence = new $util.LongBits(object.sequence.low >>> 0, object.sequence.high >>> 0).toNumber(true); - if (object.timestamp != null) - if ($util.Long) - (message.timestamp = $util.Long.fromValue(object.timestamp)).unsigned = true; - else if (typeof object.timestamp === "string") - message.timestamp = parseInt(object.timestamp, 10); - else if (typeof object.timestamp === "number") - message.timestamp = object.timestamp; - else if (typeof object.timestamp === "object") - message.timestamp = new $util.LongBits(object.timestamp.low >>> 0, object.timestamp.high >>> 0).toNumber(true); - if (object.signature != null) - if (typeof object.signature === "string") - $util.base64.decode(object.signature, message.signature = $util.newBuffer($util.base64.length(object.signature)), 0); - else if (object.signature.length) - message.signature = object.signature; - if (object.new_public_key != null) { - if (typeof object.new_public_key !== "object") - throw TypeError(".ibc.lightclients.solomachine.v1.Header.new_public_key: object expected"); - message.new_public_key = $root.google.protobuf.Any.fromObject(object.new_public_key); - } - if (object.new_diversifier != null) - message.new_diversifier = String(object.new_diversifier); - return message; - }; - - /** - * Creates a plain object from a Header message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.lightclients.solomachine.v1.Header - * @static - * @param {ibc.lightclients.solomachine.v1.Header} message Header - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Header.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.sequence = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.timestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.timestamp = options.longs === String ? "0" : 0; - if (options.bytes === String) - object.signature = ""; - else { - object.signature = []; - if (options.bytes !== Array) - object.signature = $util.newBuffer(object.signature); - } - object.new_public_key = null; - object.new_diversifier = ""; - } - if (message.sequence != null && message.hasOwnProperty("sequence")) - if (typeof message.sequence === "number") - object.sequence = options.longs === String ? String(message.sequence) : message.sequence; - else - object.sequence = options.longs === String ? $util.Long.prototype.toString.call(message.sequence) : options.longs === Number ? new $util.LongBits(message.sequence.low >>> 0, message.sequence.high >>> 0).toNumber(true) : message.sequence; - if (message.timestamp != null && message.hasOwnProperty("timestamp")) - if (typeof message.timestamp === "number") - object.timestamp = options.longs === String ? String(message.timestamp) : message.timestamp; - else - object.timestamp = options.longs === String ? $util.Long.prototype.toString.call(message.timestamp) : options.longs === Number ? new $util.LongBits(message.timestamp.low >>> 0, message.timestamp.high >>> 0).toNumber(true) : message.timestamp; - if (message.signature != null && message.hasOwnProperty("signature")) - object.signature = options.bytes === String ? $util.base64.encode(message.signature, 0, message.signature.length) : options.bytes === Array ? Array.prototype.slice.call(message.signature) : message.signature; - if (message.new_public_key != null && message.hasOwnProperty("new_public_key")) - object.new_public_key = $root.google.protobuf.Any.toObject(message.new_public_key, options); - if (message.new_diversifier != null && message.hasOwnProperty("new_diversifier")) - object.new_diversifier = message.new_diversifier; - return object; - }; - - /** - * Converts this Header to JSON. - * @function toJSON - * @memberof ibc.lightclients.solomachine.v1.Header - * @instance - * @returns {Object.} JSON object - */ - Header.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Header; - })(); - - v1.Misbehaviour = (function() { - - /** - * Properties of a Misbehaviour. - * @memberof ibc.lightclients.solomachine.v1 - * @interface IMisbehaviour - * @property {string|null} [client_id] Misbehaviour client_id - * @property {Long|null} [sequence] Misbehaviour sequence - * @property {ibc.lightclients.solomachine.v1.ISignatureAndData|null} [signature_one] Misbehaviour signature_one - * @property {ibc.lightclients.solomachine.v1.ISignatureAndData|null} [signature_two] Misbehaviour signature_two - */ - - /** - * Constructs a new Misbehaviour. - * @memberof ibc.lightclients.solomachine.v1 - * @classdesc Represents a Misbehaviour. - * @implements IMisbehaviour - * @constructor - * @param {ibc.lightclients.solomachine.v1.IMisbehaviour=} [properties] Properties to set - */ - function Misbehaviour(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Misbehaviour client_id. - * @member {string} client_id - * @memberof ibc.lightclients.solomachine.v1.Misbehaviour - * @instance - */ - Misbehaviour.prototype.client_id = ""; - - /** - * Misbehaviour sequence. - * @member {Long} sequence - * @memberof ibc.lightclients.solomachine.v1.Misbehaviour - * @instance - */ - Misbehaviour.prototype.sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Misbehaviour signature_one. - * @member {ibc.lightclients.solomachine.v1.ISignatureAndData|null|undefined} signature_one - * @memberof ibc.lightclients.solomachine.v1.Misbehaviour - * @instance - */ - Misbehaviour.prototype.signature_one = null; - - /** - * Misbehaviour signature_two. - * @member {ibc.lightclients.solomachine.v1.ISignatureAndData|null|undefined} signature_two - * @memberof ibc.lightclients.solomachine.v1.Misbehaviour - * @instance - */ - Misbehaviour.prototype.signature_two = null; - - /** - * Encodes the specified Misbehaviour message. Does not implicitly {@link ibc.lightclients.solomachine.v1.Misbehaviour.verify|verify} messages. - * @function encode - * @memberof ibc.lightclients.solomachine.v1.Misbehaviour - * @static - * @param {ibc.lightclients.solomachine.v1.IMisbehaviour} message Misbehaviour message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Misbehaviour.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); - if (message.sequence != null && Object.hasOwnProperty.call(message, "sequence")) - writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.sequence); - if (message.signature_one != null && Object.hasOwnProperty.call(message, "signature_one")) - $root.ibc.lightclients.solomachine.v1.SignatureAndData.encode(message.signature_one, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.signature_two != null && Object.hasOwnProperty.call(message, "signature_two")) - $root.ibc.lightclients.solomachine.v1.SignatureAndData.encode(message.signature_two, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Misbehaviour message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.Misbehaviour.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.lightclients.solomachine.v1.Misbehaviour - * @static - * @param {ibc.lightclients.solomachine.v1.IMisbehaviour} message Misbehaviour message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Misbehaviour.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Misbehaviour message from the specified reader or buffer. - * @function decode - * @memberof ibc.lightclients.solomachine.v1.Misbehaviour - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.lightclients.solomachine.v1.Misbehaviour} Misbehaviour - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Misbehaviour.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.Misbehaviour(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.client_id = reader.string(); - break; - case 2: - message.sequence = reader.uint64(); - break; - case 3: - message.signature_one = $root.ibc.lightclients.solomachine.v1.SignatureAndData.decode(reader, reader.uint32()); - break; - case 4: - message.signature_two = $root.ibc.lightclients.solomachine.v1.SignatureAndData.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Misbehaviour message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.lightclients.solomachine.v1.Misbehaviour - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.lightclients.solomachine.v1.Misbehaviour} Misbehaviour - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Misbehaviour.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Misbehaviour message. - * @function verify - * @memberof ibc.lightclients.solomachine.v1.Misbehaviour - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Misbehaviour.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.client_id != null && message.hasOwnProperty("client_id")) - if (!$util.isString(message.client_id)) - return "client_id: string expected"; - if (message.sequence != null && message.hasOwnProperty("sequence")) - if (!$util.isInteger(message.sequence) && !(message.sequence && $util.isInteger(message.sequence.low) && $util.isInteger(message.sequence.high))) - return "sequence: integer|Long expected"; - if (message.signature_one != null && message.hasOwnProperty("signature_one")) { - let error = $root.ibc.lightclients.solomachine.v1.SignatureAndData.verify(message.signature_one); - if (error) - return "signature_one." + error; - } - if (message.signature_two != null && message.hasOwnProperty("signature_two")) { - let error = $root.ibc.lightclients.solomachine.v1.SignatureAndData.verify(message.signature_two); - if (error) - return "signature_two." + error; - } - return null; - }; - - /** - * Creates a Misbehaviour message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.lightclients.solomachine.v1.Misbehaviour - * @static - * @param {Object.} object Plain object - * @returns {ibc.lightclients.solomachine.v1.Misbehaviour} Misbehaviour - */ - Misbehaviour.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.lightclients.solomachine.v1.Misbehaviour) - return object; - let message = new $root.ibc.lightclients.solomachine.v1.Misbehaviour(); - if (object.client_id != null) - message.client_id = String(object.client_id); - if (object.sequence != null) - if ($util.Long) - (message.sequence = $util.Long.fromValue(object.sequence)).unsigned = true; - else if (typeof object.sequence === "string") - message.sequence = parseInt(object.sequence, 10); - else if (typeof object.sequence === "number") - message.sequence = object.sequence; - else if (typeof object.sequence === "object") - message.sequence = new $util.LongBits(object.sequence.low >>> 0, object.sequence.high >>> 0).toNumber(true); - if (object.signature_one != null) { - if (typeof object.signature_one !== "object") - throw TypeError(".ibc.lightclients.solomachine.v1.Misbehaviour.signature_one: object expected"); - message.signature_one = $root.ibc.lightclients.solomachine.v1.SignatureAndData.fromObject(object.signature_one); - } - if (object.signature_two != null) { - if (typeof object.signature_two !== "object") - throw TypeError(".ibc.lightclients.solomachine.v1.Misbehaviour.signature_two: object expected"); - message.signature_two = $root.ibc.lightclients.solomachine.v1.SignatureAndData.fromObject(object.signature_two); - } - return message; - }; - - /** - * Creates a plain object from a Misbehaviour message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.lightclients.solomachine.v1.Misbehaviour - * @static - * @param {ibc.lightclients.solomachine.v1.Misbehaviour} message Misbehaviour - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Misbehaviour.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.client_id = ""; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.sequence = options.longs === String ? "0" : 0; - object.signature_one = null; - object.signature_two = null; - } - if (message.client_id != null && message.hasOwnProperty("client_id")) - object.client_id = message.client_id; - if (message.sequence != null && message.hasOwnProperty("sequence")) - if (typeof message.sequence === "number") - object.sequence = options.longs === String ? String(message.sequence) : message.sequence; - else - object.sequence = options.longs === String ? $util.Long.prototype.toString.call(message.sequence) : options.longs === Number ? new $util.LongBits(message.sequence.low >>> 0, message.sequence.high >>> 0).toNumber(true) : message.sequence; - if (message.signature_one != null && message.hasOwnProperty("signature_one")) - object.signature_one = $root.ibc.lightclients.solomachine.v1.SignatureAndData.toObject(message.signature_one, options); - if (message.signature_two != null && message.hasOwnProperty("signature_two")) - object.signature_two = $root.ibc.lightclients.solomachine.v1.SignatureAndData.toObject(message.signature_two, options); - return object; - }; - - /** - * Converts this Misbehaviour to JSON. - * @function toJSON - * @memberof ibc.lightclients.solomachine.v1.Misbehaviour - * @instance - * @returns {Object.} JSON object - */ - Misbehaviour.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Misbehaviour; - })(); - - v1.SignatureAndData = (function() { - - /** - * Properties of a SignatureAndData. - * @memberof ibc.lightclients.solomachine.v1 - * @interface ISignatureAndData - * @property {Uint8Array|null} [signature] SignatureAndData signature - * @property {ibc.lightclients.solomachine.v1.DataType|null} [data_type] SignatureAndData data_type - * @property {Uint8Array|null} [data] SignatureAndData data - * @property {Long|null} [timestamp] SignatureAndData timestamp - */ - - /** - * Constructs a new SignatureAndData. - * @memberof ibc.lightclients.solomachine.v1 - * @classdesc Represents a SignatureAndData. - * @implements ISignatureAndData - * @constructor - * @param {ibc.lightclients.solomachine.v1.ISignatureAndData=} [properties] Properties to set - */ - function SignatureAndData(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SignatureAndData signature. - * @member {Uint8Array} signature - * @memberof ibc.lightclients.solomachine.v1.SignatureAndData - * @instance - */ - SignatureAndData.prototype.signature = $util.newBuffer([]); - - /** - * SignatureAndData data_type. - * @member {ibc.lightclients.solomachine.v1.DataType} data_type - * @memberof ibc.lightclients.solomachine.v1.SignatureAndData - * @instance - */ - SignatureAndData.prototype.data_type = 0; - - /** - * SignatureAndData data. - * @member {Uint8Array} data - * @memberof ibc.lightclients.solomachine.v1.SignatureAndData - * @instance - */ - SignatureAndData.prototype.data = $util.newBuffer([]); - - /** - * SignatureAndData timestamp. - * @member {Long} timestamp - * @memberof ibc.lightclients.solomachine.v1.SignatureAndData - * @instance - */ - SignatureAndData.prototype.timestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified SignatureAndData message. Does not implicitly {@link ibc.lightclients.solomachine.v1.SignatureAndData.verify|verify} messages. - * @function encode - * @memberof ibc.lightclients.solomachine.v1.SignatureAndData - * @static - * @param {ibc.lightclients.solomachine.v1.ISignatureAndData} message SignatureAndData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SignatureAndData.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.signature != null && Object.hasOwnProperty.call(message, "signature")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.signature); - if (message.data_type != null && Object.hasOwnProperty.call(message, "data_type")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.data_type); - if (message.data != null && Object.hasOwnProperty.call(message, "data")) - writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.data); - if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) - writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.timestamp); - return writer; - }; - - /** - * Encodes the specified SignatureAndData message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.SignatureAndData.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.lightclients.solomachine.v1.SignatureAndData - * @static - * @param {ibc.lightclients.solomachine.v1.ISignatureAndData} message SignatureAndData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SignatureAndData.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SignatureAndData message from the specified reader or buffer. - * @function decode - * @memberof ibc.lightclients.solomachine.v1.SignatureAndData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.lightclients.solomachine.v1.SignatureAndData} SignatureAndData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SignatureAndData.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.SignatureAndData(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.signature = reader.bytes(); - break; - case 2: - message.data_type = reader.int32(); - break; - case 3: - message.data = reader.bytes(); - break; - case 4: - message.timestamp = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SignatureAndData message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.lightclients.solomachine.v1.SignatureAndData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.lightclients.solomachine.v1.SignatureAndData} SignatureAndData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SignatureAndData.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SignatureAndData message. - * @function verify - * @memberof ibc.lightclients.solomachine.v1.SignatureAndData - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SignatureAndData.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.signature != null && message.hasOwnProperty("signature")) - if (!(message.signature && typeof message.signature.length === "number" || $util.isString(message.signature))) - return "signature: buffer expected"; - if (message.data_type != null && message.hasOwnProperty("data_type")) - switch (message.data_type) { - default: - return "data_type: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - break; - } - if (message.data != null && message.hasOwnProperty("data")) - if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) - return "data: buffer expected"; - if (message.timestamp != null && message.hasOwnProperty("timestamp")) - if (!$util.isInteger(message.timestamp) && !(message.timestamp && $util.isInteger(message.timestamp.low) && $util.isInteger(message.timestamp.high))) - return "timestamp: integer|Long expected"; - return null; - }; - - /** - * Creates a SignatureAndData message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.lightclients.solomachine.v1.SignatureAndData - * @static - * @param {Object.} object Plain object - * @returns {ibc.lightclients.solomachine.v1.SignatureAndData} SignatureAndData - */ - SignatureAndData.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.lightclients.solomachine.v1.SignatureAndData) - return object; - let message = new $root.ibc.lightclients.solomachine.v1.SignatureAndData(); - if (object.signature != null) - if (typeof object.signature === "string") - $util.base64.decode(object.signature, message.signature = $util.newBuffer($util.base64.length(object.signature)), 0); - else if (object.signature.length) - message.signature = object.signature; - switch (object.data_type) { - case "DATA_TYPE_UNINITIALIZED_UNSPECIFIED": - case 0: - message.data_type = 0; - break; - case "DATA_TYPE_CLIENT_STATE": - case 1: - message.data_type = 1; - break; - case "DATA_TYPE_CONSENSUS_STATE": - case 2: - message.data_type = 2; - break; - case "DATA_TYPE_CONNECTION_STATE": - case 3: - message.data_type = 3; - break; - case "DATA_TYPE_CHANNEL_STATE": - case 4: - message.data_type = 4; - break; - case "DATA_TYPE_PACKET_COMMITMENT": - case 5: - message.data_type = 5; - break; - case "DATA_TYPE_PACKET_ACKNOWLEDGEMENT": - case 6: - message.data_type = 6; - break; - case "DATA_TYPE_PACKET_RECEIPT_ABSENCE": - case 7: - message.data_type = 7; - break; - case "DATA_TYPE_NEXT_SEQUENCE_RECV": - case 8: - message.data_type = 8; - break; - case "DATA_TYPE_HEADER": - case 9: - message.data_type = 9; - break; - } - if (object.data != null) - if (typeof object.data === "string") - $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); - else if (object.data.length) - message.data = object.data; - if (object.timestamp != null) - if ($util.Long) - (message.timestamp = $util.Long.fromValue(object.timestamp)).unsigned = true; - else if (typeof object.timestamp === "string") - message.timestamp = parseInt(object.timestamp, 10); - else if (typeof object.timestamp === "number") - message.timestamp = object.timestamp; - else if (typeof object.timestamp === "object") - message.timestamp = new $util.LongBits(object.timestamp.low >>> 0, object.timestamp.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a SignatureAndData message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.lightclients.solomachine.v1.SignatureAndData - * @static - * @param {ibc.lightclients.solomachine.v1.SignatureAndData} message SignatureAndData - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SignatureAndData.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if (options.bytes === String) - object.signature = ""; - else { - object.signature = []; - if (options.bytes !== Array) - object.signature = $util.newBuffer(object.signature); - } - object.data_type = options.enums === String ? "DATA_TYPE_UNINITIALIZED_UNSPECIFIED" : 0; - if (options.bytes === String) - object.data = ""; - else { - object.data = []; - if (options.bytes !== Array) - object.data = $util.newBuffer(object.data); - } - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.timestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.timestamp = options.longs === String ? "0" : 0; - } - if (message.signature != null && message.hasOwnProperty("signature")) - object.signature = options.bytes === String ? $util.base64.encode(message.signature, 0, message.signature.length) : options.bytes === Array ? Array.prototype.slice.call(message.signature) : message.signature; - if (message.data_type != null && message.hasOwnProperty("data_type")) - object.data_type = options.enums === String ? $root.ibc.lightclients.solomachine.v1.DataType[message.data_type] : message.data_type; - if (message.data != null && message.hasOwnProperty("data")) - object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; - if (message.timestamp != null && message.hasOwnProperty("timestamp")) - if (typeof message.timestamp === "number") - object.timestamp = options.longs === String ? String(message.timestamp) : message.timestamp; - else - object.timestamp = options.longs === String ? $util.Long.prototype.toString.call(message.timestamp) : options.longs === Number ? new $util.LongBits(message.timestamp.low >>> 0, message.timestamp.high >>> 0).toNumber(true) : message.timestamp; - return object; - }; - - /** - * Converts this SignatureAndData to JSON. - * @function toJSON - * @memberof ibc.lightclients.solomachine.v1.SignatureAndData - * @instance - * @returns {Object.} JSON object - */ - SignatureAndData.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return SignatureAndData; - })(); - - v1.TimestampedSignatureData = (function() { - - /** - * Properties of a TimestampedSignatureData. - * @memberof ibc.lightclients.solomachine.v1 - * @interface ITimestampedSignatureData - * @property {Uint8Array|null} [signature_data] TimestampedSignatureData signature_data - * @property {Long|null} [timestamp] TimestampedSignatureData timestamp - */ - - /** - * Constructs a new TimestampedSignatureData. - * @memberof ibc.lightclients.solomachine.v1 - * @classdesc Represents a TimestampedSignatureData. - * @implements ITimestampedSignatureData - * @constructor - * @param {ibc.lightclients.solomachine.v1.ITimestampedSignatureData=} [properties] Properties to set - */ - function TimestampedSignatureData(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * TimestampedSignatureData signature_data. - * @member {Uint8Array} signature_data - * @memberof ibc.lightclients.solomachine.v1.TimestampedSignatureData - * @instance - */ - TimestampedSignatureData.prototype.signature_data = $util.newBuffer([]); - - /** - * TimestampedSignatureData timestamp. - * @member {Long} timestamp - * @memberof ibc.lightclients.solomachine.v1.TimestampedSignatureData - * @instance - */ - TimestampedSignatureData.prototype.timestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified TimestampedSignatureData message. Does not implicitly {@link ibc.lightclients.solomachine.v1.TimestampedSignatureData.verify|verify} messages. - * @function encode - * @memberof ibc.lightclients.solomachine.v1.TimestampedSignatureData - * @static - * @param {ibc.lightclients.solomachine.v1.ITimestampedSignatureData} message TimestampedSignatureData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TimestampedSignatureData.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.signature_data != null && Object.hasOwnProperty.call(message, "signature_data")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.signature_data); - if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) - writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.timestamp); - return writer; - }; - - /** - * Encodes the specified TimestampedSignatureData message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.TimestampedSignatureData.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.lightclients.solomachine.v1.TimestampedSignatureData - * @static - * @param {ibc.lightclients.solomachine.v1.ITimestampedSignatureData} message TimestampedSignatureData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TimestampedSignatureData.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TimestampedSignatureData message from the specified reader or buffer. - * @function decode - * @memberof ibc.lightclients.solomachine.v1.TimestampedSignatureData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.lightclients.solomachine.v1.TimestampedSignatureData} TimestampedSignatureData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TimestampedSignatureData.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.TimestampedSignatureData(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.signature_data = reader.bytes(); - break; - case 2: - message.timestamp = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a TimestampedSignatureData message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.lightclients.solomachine.v1.TimestampedSignatureData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.lightclients.solomachine.v1.TimestampedSignatureData} TimestampedSignatureData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TimestampedSignatureData.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TimestampedSignatureData message. - * @function verify - * @memberof ibc.lightclients.solomachine.v1.TimestampedSignatureData - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TimestampedSignatureData.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.signature_data != null && message.hasOwnProperty("signature_data")) - if (!(message.signature_data && typeof message.signature_data.length === "number" || $util.isString(message.signature_data))) - return "signature_data: buffer expected"; - if (message.timestamp != null && message.hasOwnProperty("timestamp")) - if (!$util.isInteger(message.timestamp) && !(message.timestamp && $util.isInteger(message.timestamp.low) && $util.isInteger(message.timestamp.high))) - return "timestamp: integer|Long expected"; - return null; - }; - - /** - * Creates a TimestampedSignatureData message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.lightclients.solomachine.v1.TimestampedSignatureData - * @static - * @param {Object.} object Plain object - * @returns {ibc.lightclients.solomachine.v1.TimestampedSignatureData} TimestampedSignatureData - */ - TimestampedSignatureData.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.lightclients.solomachine.v1.TimestampedSignatureData) - return object; - let message = new $root.ibc.lightclients.solomachine.v1.TimestampedSignatureData(); - if (object.signature_data != null) - if (typeof object.signature_data === "string") - $util.base64.decode(object.signature_data, message.signature_data = $util.newBuffer($util.base64.length(object.signature_data)), 0); - else if (object.signature_data.length) - message.signature_data = object.signature_data; - if (object.timestamp != null) - if ($util.Long) - (message.timestamp = $util.Long.fromValue(object.timestamp)).unsigned = true; - else if (typeof object.timestamp === "string") - message.timestamp = parseInt(object.timestamp, 10); - else if (typeof object.timestamp === "number") - message.timestamp = object.timestamp; - else if (typeof object.timestamp === "object") - message.timestamp = new $util.LongBits(object.timestamp.low >>> 0, object.timestamp.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a TimestampedSignatureData message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.lightclients.solomachine.v1.TimestampedSignatureData - * @static - * @param {ibc.lightclients.solomachine.v1.TimestampedSignatureData} message TimestampedSignatureData - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TimestampedSignatureData.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if (options.bytes === String) - object.signature_data = ""; - else { - object.signature_data = []; - if (options.bytes !== Array) - object.signature_data = $util.newBuffer(object.signature_data); - } - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.timestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.timestamp = options.longs === String ? "0" : 0; - } - if (message.signature_data != null && message.hasOwnProperty("signature_data")) - object.signature_data = options.bytes === String ? $util.base64.encode(message.signature_data, 0, message.signature_data.length) : options.bytes === Array ? Array.prototype.slice.call(message.signature_data) : message.signature_data; - if (message.timestamp != null && message.hasOwnProperty("timestamp")) - if (typeof message.timestamp === "number") - object.timestamp = options.longs === String ? String(message.timestamp) : message.timestamp; - else - object.timestamp = options.longs === String ? $util.Long.prototype.toString.call(message.timestamp) : options.longs === Number ? new $util.LongBits(message.timestamp.low >>> 0, message.timestamp.high >>> 0).toNumber(true) : message.timestamp; - return object; - }; - - /** - * Converts this TimestampedSignatureData to JSON. - * @function toJSON - * @memberof ibc.lightclients.solomachine.v1.TimestampedSignatureData - * @instance - * @returns {Object.} JSON object - */ - TimestampedSignatureData.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return TimestampedSignatureData; - })(); - - v1.SignBytes = (function() { - - /** - * Properties of a SignBytes. - * @memberof ibc.lightclients.solomachine.v1 - * @interface ISignBytes - * @property {Long|null} [sequence] SignBytes sequence - * @property {Long|null} [timestamp] SignBytes timestamp - * @property {string|null} [diversifier] SignBytes diversifier - * @property {ibc.lightclients.solomachine.v1.DataType|null} [data_type] SignBytes data_type - * @property {Uint8Array|null} [data] SignBytes data - */ - - /** - * Constructs a new SignBytes. - * @memberof ibc.lightclients.solomachine.v1 - * @classdesc Represents a SignBytes. - * @implements ISignBytes - * @constructor - * @param {ibc.lightclients.solomachine.v1.ISignBytes=} [properties] Properties to set - */ - function SignBytes(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SignBytes sequence. - * @member {Long} sequence - * @memberof ibc.lightclients.solomachine.v1.SignBytes - * @instance - */ - SignBytes.prototype.sequence = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * SignBytes timestamp. - * @member {Long} timestamp - * @memberof ibc.lightclients.solomachine.v1.SignBytes - * @instance - */ - SignBytes.prototype.timestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * SignBytes diversifier. - * @member {string} diversifier - * @memberof ibc.lightclients.solomachine.v1.SignBytes - * @instance - */ - SignBytes.prototype.diversifier = ""; - - /** - * SignBytes data_type. - * @member {ibc.lightclients.solomachine.v1.DataType} data_type - * @memberof ibc.lightclients.solomachine.v1.SignBytes - * @instance - */ - SignBytes.prototype.data_type = 0; - - /** - * SignBytes data. - * @member {Uint8Array} data - * @memberof ibc.lightclients.solomachine.v1.SignBytes - * @instance - */ - SignBytes.prototype.data = $util.newBuffer([]); - - /** - * Encodes the specified SignBytes message. Does not implicitly {@link ibc.lightclients.solomachine.v1.SignBytes.verify|verify} messages. - * @function encode - * @memberof ibc.lightclients.solomachine.v1.SignBytes - * @static - * @param {ibc.lightclients.solomachine.v1.ISignBytes} message SignBytes message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SignBytes.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.sequence != null && Object.hasOwnProperty.call(message, "sequence")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.sequence); - if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) - writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.timestamp); - if (message.diversifier != null && Object.hasOwnProperty.call(message, "diversifier")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.diversifier); - if (message.data_type != null && Object.hasOwnProperty.call(message, "data_type")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.data_type); - if (message.data != null && Object.hasOwnProperty.call(message, "data")) - writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.data); - return writer; - }; - - /** - * Encodes the specified SignBytes message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.SignBytes.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.lightclients.solomachine.v1.SignBytes - * @static - * @param {ibc.lightclients.solomachine.v1.ISignBytes} message SignBytes message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SignBytes.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SignBytes message from the specified reader or buffer. - * @function decode - * @memberof ibc.lightclients.solomachine.v1.SignBytes - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.lightclients.solomachine.v1.SignBytes} SignBytes - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SignBytes.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.SignBytes(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.sequence = reader.uint64(); - break; - case 2: - message.timestamp = reader.uint64(); - break; - case 3: - message.diversifier = reader.string(); - break; - case 4: - message.data_type = reader.int32(); - break; - case 5: - message.data = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SignBytes message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.lightclients.solomachine.v1.SignBytes - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.lightclients.solomachine.v1.SignBytes} SignBytes - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SignBytes.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SignBytes message. - * @function verify - * @memberof ibc.lightclients.solomachine.v1.SignBytes - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SignBytes.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.sequence != null && message.hasOwnProperty("sequence")) - if (!$util.isInteger(message.sequence) && !(message.sequence && $util.isInteger(message.sequence.low) && $util.isInteger(message.sequence.high))) - return "sequence: integer|Long expected"; - if (message.timestamp != null && message.hasOwnProperty("timestamp")) - if (!$util.isInteger(message.timestamp) && !(message.timestamp && $util.isInteger(message.timestamp.low) && $util.isInteger(message.timestamp.high))) - return "timestamp: integer|Long expected"; - if (message.diversifier != null && message.hasOwnProperty("diversifier")) - if (!$util.isString(message.diversifier)) - return "diversifier: string expected"; - if (message.data_type != null && message.hasOwnProperty("data_type")) - switch (message.data_type) { - default: - return "data_type: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - break; - } - if (message.data != null && message.hasOwnProperty("data")) - if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) - return "data: buffer expected"; - return null; - }; - - /** - * Creates a SignBytes message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.lightclients.solomachine.v1.SignBytes - * @static - * @param {Object.} object Plain object - * @returns {ibc.lightclients.solomachine.v1.SignBytes} SignBytes - */ - SignBytes.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.lightclients.solomachine.v1.SignBytes) - return object; - let message = new $root.ibc.lightclients.solomachine.v1.SignBytes(); - if (object.sequence != null) - if ($util.Long) - (message.sequence = $util.Long.fromValue(object.sequence)).unsigned = true; - else if (typeof object.sequence === "string") - message.sequence = parseInt(object.sequence, 10); - else if (typeof object.sequence === "number") - message.sequence = object.sequence; - else if (typeof object.sequence === "object") - message.sequence = new $util.LongBits(object.sequence.low >>> 0, object.sequence.high >>> 0).toNumber(true); - if (object.timestamp != null) - if ($util.Long) - (message.timestamp = $util.Long.fromValue(object.timestamp)).unsigned = true; - else if (typeof object.timestamp === "string") - message.timestamp = parseInt(object.timestamp, 10); - else if (typeof object.timestamp === "number") - message.timestamp = object.timestamp; - else if (typeof object.timestamp === "object") - message.timestamp = new $util.LongBits(object.timestamp.low >>> 0, object.timestamp.high >>> 0).toNumber(true); - if (object.diversifier != null) - message.diversifier = String(object.diversifier); - switch (object.data_type) { - case "DATA_TYPE_UNINITIALIZED_UNSPECIFIED": - case 0: - message.data_type = 0; - break; - case "DATA_TYPE_CLIENT_STATE": - case 1: - message.data_type = 1; - break; - case "DATA_TYPE_CONSENSUS_STATE": - case 2: - message.data_type = 2; - break; - case "DATA_TYPE_CONNECTION_STATE": - case 3: - message.data_type = 3; - break; - case "DATA_TYPE_CHANNEL_STATE": - case 4: - message.data_type = 4; - break; - case "DATA_TYPE_PACKET_COMMITMENT": - case 5: - message.data_type = 5; - break; - case "DATA_TYPE_PACKET_ACKNOWLEDGEMENT": - case 6: - message.data_type = 6; - break; - case "DATA_TYPE_PACKET_RECEIPT_ABSENCE": - case 7: - message.data_type = 7; - break; - case "DATA_TYPE_NEXT_SEQUENCE_RECV": - case 8: - message.data_type = 8; - break; - case "DATA_TYPE_HEADER": - case 9: - message.data_type = 9; - break; - } - if (object.data != null) - if (typeof object.data === "string") - $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); - else if (object.data.length) - message.data = object.data; - return message; - }; - - /** - * Creates a plain object from a SignBytes message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.lightclients.solomachine.v1.SignBytes - * @static - * @param {ibc.lightclients.solomachine.v1.SignBytes} message SignBytes - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SignBytes.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.sequence = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.sequence = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.timestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.timestamp = options.longs === String ? "0" : 0; - object.diversifier = ""; - object.data_type = options.enums === String ? "DATA_TYPE_UNINITIALIZED_UNSPECIFIED" : 0; - if (options.bytes === String) - object.data = ""; - else { - object.data = []; - if (options.bytes !== Array) - object.data = $util.newBuffer(object.data); - } - } - if (message.sequence != null && message.hasOwnProperty("sequence")) - if (typeof message.sequence === "number") - object.sequence = options.longs === String ? String(message.sequence) : message.sequence; - else - object.sequence = options.longs === String ? $util.Long.prototype.toString.call(message.sequence) : options.longs === Number ? new $util.LongBits(message.sequence.low >>> 0, message.sequence.high >>> 0).toNumber(true) : message.sequence; - if (message.timestamp != null && message.hasOwnProperty("timestamp")) - if (typeof message.timestamp === "number") - object.timestamp = options.longs === String ? String(message.timestamp) : message.timestamp; - else - object.timestamp = options.longs === String ? $util.Long.prototype.toString.call(message.timestamp) : options.longs === Number ? new $util.LongBits(message.timestamp.low >>> 0, message.timestamp.high >>> 0).toNumber(true) : message.timestamp; - if (message.diversifier != null && message.hasOwnProperty("diversifier")) - object.diversifier = message.diversifier; - if (message.data_type != null && message.hasOwnProperty("data_type")) - object.data_type = options.enums === String ? $root.ibc.lightclients.solomachine.v1.DataType[message.data_type] : message.data_type; - if (message.data != null && message.hasOwnProperty("data")) - object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; - return object; - }; - - /** - * Converts this SignBytes to JSON. - * @function toJSON - * @memberof ibc.lightclients.solomachine.v1.SignBytes - * @instance - * @returns {Object.} JSON object - */ - SignBytes.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return SignBytes; - })(); - - /** - * DataType enum. - * @name ibc.lightclients.solomachine.v1.DataType - * @enum {number} - * @property {number} DATA_TYPE_UNINITIALIZED_UNSPECIFIED=0 DATA_TYPE_UNINITIALIZED_UNSPECIFIED value - * @property {number} DATA_TYPE_CLIENT_STATE=1 DATA_TYPE_CLIENT_STATE value - * @property {number} DATA_TYPE_CONSENSUS_STATE=2 DATA_TYPE_CONSENSUS_STATE value - * @property {number} DATA_TYPE_CONNECTION_STATE=3 DATA_TYPE_CONNECTION_STATE value - * @property {number} DATA_TYPE_CHANNEL_STATE=4 DATA_TYPE_CHANNEL_STATE value - * @property {number} DATA_TYPE_PACKET_COMMITMENT=5 DATA_TYPE_PACKET_COMMITMENT value - * @property {number} DATA_TYPE_PACKET_ACKNOWLEDGEMENT=6 DATA_TYPE_PACKET_ACKNOWLEDGEMENT value - * @property {number} DATA_TYPE_PACKET_RECEIPT_ABSENCE=7 DATA_TYPE_PACKET_RECEIPT_ABSENCE value - * @property {number} DATA_TYPE_NEXT_SEQUENCE_RECV=8 DATA_TYPE_NEXT_SEQUENCE_RECV value - * @property {number} DATA_TYPE_HEADER=9 DATA_TYPE_HEADER value - */ - v1.DataType = (function() { - const valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "DATA_TYPE_UNINITIALIZED_UNSPECIFIED"] = 0; - values[valuesById[1] = "DATA_TYPE_CLIENT_STATE"] = 1; - values[valuesById[2] = "DATA_TYPE_CONSENSUS_STATE"] = 2; - values[valuesById[3] = "DATA_TYPE_CONNECTION_STATE"] = 3; - values[valuesById[4] = "DATA_TYPE_CHANNEL_STATE"] = 4; - values[valuesById[5] = "DATA_TYPE_PACKET_COMMITMENT"] = 5; - values[valuesById[6] = "DATA_TYPE_PACKET_ACKNOWLEDGEMENT"] = 6; - values[valuesById[7] = "DATA_TYPE_PACKET_RECEIPT_ABSENCE"] = 7; - values[valuesById[8] = "DATA_TYPE_NEXT_SEQUENCE_RECV"] = 8; - values[valuesById[9] = "DATA_TYPE_HEADER"] = 9; - return values; - })(); - - v1.HeaderData = (function() { - - /** - * Properties of a HeaderData. - * @memberof ibc.lightclients.solomachine.v1 - * @interface IHeaderData - * @property {google.protobuf.IAny|null} [new_pub_key] HeaderData new_pub_key - * @property {string|null} [new_diversifier] HeaderData new_diversifier - */ - - /** - * Constructs a new HeaderData. - * @memberof ibc.lightclients.solomachine.v1 - * @classdesc Represents a HeaderData. - * @implements IHeaderData - * @constructor - * @param {ibc.lightclients.solomachine.v1.IHeaderData=} [properties] Properties to set - */ - function HeaderData(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * HeaderData new_pub_key. - * @member {google.protobuf.IAny|null|undefined} new_pub_key - * @memberof ibc.lightclients.solomachine.v1.HeaderData - * @instance - */ - HeaderData.prototype.new_pub_key = null; - - /** - * HeaderData new_diversifier. - * @member {string} new_diversifier - * @memberof ibc.lightclients.solomachine.v1.HeaderData - * @instance - */ - HeaderData.prototype.new_diversifier = ""; - - /** - * Encodes the specified HeaderData message. Does not implicitly {@link ibc.lightclients.solomachine.v1.HeaderData.verify|verify} messages. - * @function encode - * @memberof ibc.lightclients.solomachine.v1.HeaderData - * @static - * @param {ibc.lightclients.solomachine.v1.IHeaderData} message HeaderData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - HeaderData.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.new_pub_key != null && Object.hasOwnProperty.call(message, "new_pub_key")) - $root.google.protobuf.Any.encode(message.new_pub_key, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.new_diversifier != null && Object.hasOwnProperty.call(message, "new_diversifier")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.new_diversifier); - return writer; - }; - - /** - * Encodes the specified HeaderData message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.HeaderData.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.lightclients.solomachine.v1.HeaderData - * @static - * @param {ibc.lightclients.solomachine.v1.IHeaderData} message HeaderData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - HeaderData.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a HeaderData message from the specified reader or buffer. - * @function decode - * @memberof ibc.lightclients.solomachine.v1.HeaderData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.lightclients.solomachine.v1.HeaderData} HeaderData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - HeaderData.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.HeaderData(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.new_pub_key = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - case 2: - message.new_diversifier = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a HeaderData message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.lightclients.solomachine.v1.HeaderData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.lightclients.solomachine.v1.HeaderData} HeaderData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - HeaderData.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a HeaderData message. - * @function verify - * @memberof ibc.lightclients.solomachine.v1.HeaderData - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - HeaderData.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.new_pub_key != null && message.hasOwnProperty("new_pub_key")) { - let error = $root.google.protobuf.Any.verify(message.new_pub_key); - if (error) - return "new_pub_key." + error; - } - if (message.new_diversifier != null && message.hasOwnProperty("new_diversifier")) - if (!$util.isString(message.new_diversifier)) - return "new_diversifier: string expected"; - return null; - }; - - /** - * Creates a HeaderData message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.lightclients.solomachine.v1.HeaderData - * @static - * @param {Object.} object Plain object - * @returns {ibc.lightclients.solomachine.v1.HeaderData} HeaderData - */ - HeaderData.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.lightclients.solomachine.v1.HeaderData) - return object; - let message = new $root.ibc.lightclients.solomachine.v1.HeaderData(); - if (object.new_pub_key != null) { - if (typeof object.new_pub_key !== "object") - throw TypeError(".ibc.lightclients.solomachine.v1.HeaderData.new_pub_key: object expected"); - message.new_pub_key = $root.google.protobuf.Any.fromObject(object.new_pub_key); - } - if (object.new_diversifier != null) - message.new_diversifier = String(object.new_diversifier); - return message; - }; - - /** - * Creates a plain object from a HeaderData message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.lightclients.solomachine.v1.HeaderData - * @static - * @param {ibc.lightclients.solomachine.v1.HeaderData} message HeaderData - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - HeaderData.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.new_pub_key = null; - object.new_diversifier = ""; - } - if (message.new_pub_key != null && message.hasOwnProperty("new_pub_key")) - object.new_pub_key = $root.google.protobuf.Any.toObject(message.new_pub_key, options); - if (message.new_diversifier != null && message.hasOwnProperty("new_diversifier")) - object.new_diversifier = message.new_diversifier; - return object; - }; - - /** - * Converts this HeaderData to JSON. - * @function toJSON - * @memberof ibc.lightclients.solomachine.v1.HeaderData - * @instance - * @returns {Object.} JSON object - */ - HeaderData.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return HeaderData; - })(); - - v1.ClientStateData = (function() { - - /** - * Properties of a ClientStateData. - * @memberof ibc.lightclients.solomachine.v1 - * @interface IClientStateData - * @property {Uint8Array|null} [path] ClientStateData path - * @property {google.protobuf.IAny|null} [client_state] ClientStateData client_state - */ - - /** - * Constructs a new ClientStateData. - * @memberof ibc.lightclients.solomachine.v1 - * @classdesc Represents a ClientStateData. - * @implements IClientStateData - * @constructor - * @param {ibc.lightclients.solomachine.v1.IClientStateData=} [properties] Properties to set - */ - function ClientStateData(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ClientStateData path. - * @member {Uint8Array} path - * @memberof ibc.lightclients.solomachine.v1.ClientStateData - * @instance - */ - ClientStateData.prototype.path = $util.newBuffer([]); - - /** - * ClientStateData client_state. - * @member {google.protobuf.IAny|null|undefined} client_state - * @memberof ibc.lightclients.solomachine.v1.ClientStateData - * @instance - */ - ClientStateData.prototype.client_state = null; - - /** - * Encodes the specified ClientStateData message. Does not implicitly {@link ibc.lightclients.solomachine.v1.ClientStateData.verify|verify} messages. - * @function encode - * @memberof ibc.lightclients.solomachine.v1.ClientStateData - * @static - * @param {ibc.lightclients.solomachine.v1.IClientStateData} message ClientStateData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ClientStateData.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.path != null && Object.hasOwnProperty.call(message, "path")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.path); - if (message.client_state != null && Object.hasOwnProperty.call(message, "client_state")) - $root.google.protobuf.Any.encode(message.client_state, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ClientStateData message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.ClientStateData.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.lightclients.solomachine.v1.ClientStateData - * @static - * @param {ibc.lightclients.solomachine.v1.IClientStateData} message ClientStateData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ClientStateData.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ClientStateData message from the specified reader or buffer. - * @function decode - * @memberof ibc.lightclients.solomachine.v1.ClientStateData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.lightclients.solomachine.v1.ClientStateData} ClientStateData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ClientStateData.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.ClientStateData(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.path = reader.bytes(); - break; - case 2: - message.client_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ClientStateData message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.lightclients.solomachine.v1.ClientStateData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.lightclients.solomachine.v1.ClientStateData} ClientStateData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ClientStateData.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ClientStateData message. - * @function verify - * @memberof ibc.lightclients.solomachine.v1.ClientStateData - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ClientStateData.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.path != null && message.hasOwnProperty("path")) - if (!(message.path && typeof message.path.length === "number" || $util.isString(message.path))) - return "path: buffer expected"; - if (message.client_state != null && message.hasOwnProperty("client_state")) { - let error = $root.google.protobuf.Any.verify(message.client_state); - if (error) - return "client_state." + error; - } - return null; - }; - - /** - * Creates a ClientStateData message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.lightclients.solomachine.v1.ClientStateData - * @static - * @param {Object.} object Plain object - * @returns {ibc.lightclients.solomachine.v1.ClientStateData} ClientStateData - */ - ClientStateData.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.lightclients.solomachine.v1.ClientStateData) - return object; - let message = new $root.ibc.lightclients.solomachine.v1.ClientStateData(); - if (object.path != null) - if (typeof object.path === "string") - $util.base64.decode(object.path, message.path = $util.newBuffer($util.base64.length(object.path)), 0); - else if (object.path.length) - message.path = object.path; - if (object.client_state != null) { - if (typeof object.client_state !== "object") - throw TypeError(".ibc.lightclients.solomachine.v1.ClientStateData.client_state: object expected"); - message.client_state = $root.google.protobuf.Any.fromObject(object.client_state); - } - return message; - }; - - /** - * Creates a plain object from a ClientStateData message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.lightclients.solomachine.v1.ClientStateData - * @static - * @param {ibc.lightclients.solomachine.v1.ClientStateData} message ClientStateData - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ClientStateData.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if (options.bytes === String) - object.path = ""; - else { - object.path = []; - if (options.bytes !== Array) - object.path = $util.newBuffer(object.path); - } - object.client_state = null; - } - if (message.path != null && message.hasOwnProperty("path")) - object.path = options.bytes === String ? $util.base64.encode(message.path, 0, message.path.length) : options.bytes === Array ? Array.prototype.slice.call(message.path) : message.path; - if (message.client_state != null && message.hasOwnProperty("client_state")) - object.client_state = $root.google.protobuf.Any.toObject(message.client_state, options); - return object; - }; - - /** - * Converts this ClientStateData to JSON. - * @function toJSON - * @memberof ibc.lightclients.solomachine.v1.ClientStateData - * @instance - * @returns {Object.} JSON object - */ - ClientStateData.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ClientStateData; - })(); - - v1.ConsensusStateData = (function() { - - /** - * Properties of a ConsensusStateData. - * @memberof ibc.lightclients.solomachine.v1 - * @interface IConsensusStateData - * @property {Uint8Array|null} [path] ConsensusStateData path - * @property {google.protobuf.IAny|null} [consensus_state] ConsensusStateData consensus_state - */ - - /** - * Constructs a new ConsensusStateData. - * @memberof ibc.lightclients.solomachine.v1 - * @classdesc Represents a ConsensusStateData. - * @implements IConsensusStateData - * @constructor - * @param {ibc.lightclients.solomachine.v1.IConsensusStateData=} [properties] Properties to set - */ - function ConsensusStateData(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ConsensusStateData path. - * @member {Uint8Array} path - * @memberof ibc.lightclients.solomachine.v1.ConsensusStateData - * @instance - */ - ConsensusStateData.prototype.path = $util.newBuffer([]); - - /** - * ConsensusStateData consensus_state. - * @member {google.protobuf.IAny|null|undefined} consensus_state - * @memberof ibc.lightclients.solomachine.v1.ConsensusStateData - * @instance - */ - ConsensusStateData.prototype.consensus_state = null; - - /** - * Encodes the specified ConsensusStateData message. Does not implicitly {@link ibc.lightclients.solomachine.v1.ConsensusStateData.verify|verify} messages. - * @function encode - * @memberof ibc.lightclients.solomachine.v1.ConsensusStateData - * @static - * @param {ibc.lightclients.solomachine.v1.IConsensusStateData} message ConsensusStateData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConsensusStateData.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.path != null && Object.hasOwnProperty.call(message, "path")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.path); - if (message.consensus_state != null && Object.hasOwnProperty.call(message, "consensus_state")) - $root.google.protobuf.Any.encode(message.consensus_state, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ConsensusStateData message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.ConsensusStateData.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.lightclients.solomachine.v1.ConsensusStateData - * @static - * @param {ibc.lightclients.solomachine.v1.IConsensusStateData} message ConsensusStateData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConsensusStateData.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ConsensusStateData message from the specified reader or buffer. - * @function decode - * @memberof ibc.lightclients.solomachine.v1.ConsensusStateData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.lightclients.solomachine.v1.ConsensusStateData} ConsensusStateData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConsensusStateData.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.ConsensusStateData(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.path = reader.bytes(); - break; - case 2: - message.consensus_state = $root.google.protobuf.Any.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ConsensusStateData message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.lightclients.solomachine.v1.ConsensusStateData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.lightclients.solomachine.v1.ConsensusStateData} ConsensusStateData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConsensusStateData.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ConsensusStateData message. - * @function verify - * @memberof ibc.lightclients.solomachine.v1.ConsensusStateData - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ConsensusStateData.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.path != null && message.hasOwnProperty("path")) - if (!(message.path && typeof message.path.length === "number" || $util.isString(message.path))) - return "path: buffer expected"; - if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) { - let error = $root.google.protobuf.Any.verify(message.consensus_state); - if (error) - return "consensus_state." + error; - } - return null; - }; - - /** - * Creates a ConsensusStateData message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.lightclients.solomachine.v1.ConsensusStateData - * @static - * @param {Object.} object Plain object - * @returns {ibc.lightclients.solomachine.v1.ConsensusStateData} ConsensusStateData - */ - ConsensusStateData.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.lightclients.solomachine.v1.ConsensusStateData) - return object; - let message = new $root.ibc.lightclients.solomachine.v1.ConsensusStateData(); - if (object.path != null) - if (typeof object.path === "string") - $util.base64.decode(object.path, message.path = $util.newBuffer($util.base64.length(object.path)), 0); - else if (object.path.length) - message.path = object.path; - if (object.consensus_state != null) { - if (typeof object.consensus_state !== "object") - throw TypeError(".ibc.lightclients.solomachine.v1.ConsensusStateData.consensus_state: object expected"); - message.consensus_state = $root.google.protobuf.Any.fromObject(object.consensus_state); - } - return message; - }; - - /** - * Creates a plain object from a ConsensusStateData message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.lightclients.solomachine.v1.ConsensusStateData - * @static - * @param {ibc.lightclients.solomachine.v1.ConsensusStateData} message ConsensusStateData - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ConsensusStateData.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if (options.bytes === String) - object.path = ""; - else { - object.path = []; - if (options.bytes !== Array) - object.path = $util.newBuffer(object.path); - } - object.consensus_state = null; - } - if (message.path != null && message.hasOwnProperty("path")) - object.path = options.bytes === String ? $util.base64.encode(message.path, 0, message.path.length) : options.bytes === Array ? Array.prototype.slice.call(message.path) : message.path; - if (message.consensus_state != null && message.hasOwnProperty("consensus_state")) - object.consensus_state = $root.google.protobuf.Any.toObject(message.consensus_state, options); - return object; - }; - - /** - * Converts this ConsensusStateData to JSON. - * @function toJSON - * @memberof ibc.lightclients.solomachine.v1.ConsensusStateData - * @instance - * @returns {Object.} JSON object - */ - ConsensusStateData.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ConsensusStateData; - })(); - - v1.ConnectionStateData = (function() { - - /** - * Properties of a ConnectionStateData. - * @memberof ibc.lightclients.solomachine.v1 - * @interface IConnectionStateData - * @property {Uint8Array|null} [path] ConnectionStateData path - * @property {ibc.core.connection.v1.IConnectionEnd|null} [connection] ConnectionStateData connection - */ - - /** - * Constructs a new ConnectionStateData. - * @memberof ibc.lightclients.solomachine.v1 - * @classdesc Represents a ConnectionStateData. - * @implements IConnectionStateData - * @constructor - * @param {ibc.lightclients.solomachine.v1.IConnectionStateData=} [properties] Properties to set - */ - function ConnectionStateData(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ConnectionStateData path. - * @member {Uint8Array} path - * @memberof ibc.lightclients.solomachine.v1.ConnectionStateData - * @instance - */ - ConnectionStateData.prototype.path = $util.newBuffer([]); - - /** - * ConnectionStateData connection. - * @member {ibc.core.connection.v1.IConnectionEnd|null|undefined} connection - * @memberof ibc.lightclients.solomachine.v1.ConnectionStateData - * @instance - */ - ConnectionStateData.prototype.connection = null; - - /** - * Encodes the specified ConnectionStateData message. Does not implicitly {@link ibc.lightclients.solomachine.v1.ConnectionStateData.verify|verify} messages. - * @function encode - * @memberof ibc.lightclients.solomachine.v1.ConnectionStateData - * @static - * @param {ibc.lightclients.solomachine.v1.IConnectionStateData} message ConnectionStateData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConnectionStateData.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.path != null && Object.hasOwnProperty.call(message, "path")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.path); - if (message.connection != null && Object.hasOwnProperty.call(message, "connection")) - $root.ibc.core.connection.v1.ConnectionEnd.encode(message.connection, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ConnectionStateData message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.ConnectionStateData.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.lightclients.solomachine.v1.ConnectionStateData - * @static - * @param {ibc.lightclients.solomachine.v1.IConnectionStateData} message ConnectionStateData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConnectionStateData.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ConnectionStateData message from the specified reader or buffer. - * @function decode - * @memberof ibc.lightclients.solomachine.v1.ConnectionStateData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.lightclients.solomachine.v1.ConnectionStateData} ConnectionStateData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConnectionStateData.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.ConnectionStateData(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.path = reader.bytes(); - break; - case 2: - message.connection = $root.ibc.core.connection.v1.ConnectionEnd.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ConnectionStateData message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.lightclients.solomachine.v1.ConnectionStateData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.lightclients.solomachine.v1.ConnectionStateData} ConnectionStateData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConnectionStateData.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ConnectionStateData message. - * @function verify - * @memberof ibc.lightclients.solomachine.v1.ConnectionStateData - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ConnectionStateData.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.path != null && message.hasOwnProperty("path")) - if (!(message.path && typeof message.path.length === "number" || $util.isString(message.path))) - return "path: buffer expected"; - if (message.connection != null && message.hasOwnProperty("connection")) { - let error = $root.ibc.core.connection.v1.ConnectionEnd.verify(message.connection); - if (error) - return "connection." + error; - } - return null; - }; - - /** - * Creates a ConnectionStateData message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.lightclients.solomachine.v1.ConnectionStateData - * @static - * @param {Object.} object Plain object - * @returns {ibc.lightclients.solomachine.v1.ConnectionStateData} ConnectionStateData - */ - ConnectionStateData.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.lightclients.solomachine.v1.ConnectionStateData) - return object; - let message = new $root.ibc.lightclients.solomachine.v1.ConnectionStateData(); - if (object.path != null) - if (typeof object.path === "string") - $util.base64.decode(object.path, message.path = $util.newBuffer($util.base64.length(object.path)), 0); - else if (object.path.length) - message.path = object.path; - if (object.connection != null) { - if (typeof object.connection !== "object") - throw TypeError(".ibc.lightclients.solomachine.v1.ConnectionStateData.connection: object expected"); - message.connection = $root.ibc.core.connection.v1.ConnectionEnd.fromObject(object.connection); - } - return message; - }; - - /** - * Creates a plain object from a ConnectionStateData message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.lightclients.solomachine.v1.ConnectionStateData - * @static - * @param {ibc.lightclients.solomachine.v1.ConnectionStateData} message ConnectionStateData - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ConnectionStateData.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if (options.bytes === String) - object.path = ""; - else { - object.path = []; - if (options.bytes !== Array) - object.path = $util.newBuffer(object.path); - } - object.connection = null; - } - if (message.path != null && message.hasOwnProperty("path")) - object.path = options.bytes === String ? $util.base64.encode(message.path, 0, message.path.length) : options.bytes === Array ? Array.prototype.slice.call(message.path) : message.path; - if (message.connection != null && message.hasOwnProperty("connection")) - object.connection = $root.ibc.core.connection.v1.ConnectionEnd.toObject(message.connection, options); - return object; - }; - - /** - * Converts this ConnectionStateData to JSON. - * @function toJSON - * @memberof ibc.lightclients.solomachine.v1.ConnectionStateData - * @instance - * @returns {Object.} JSON object - */ - ConnectionStateData.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ConnectionStateData; - })(); - - v1.ChannelStateData = (function() { - - /** - * Properties of a ChannelStateData. - * @memberof ibc.lightclients.solomachine.v1 - * @interface IChannelStateData - * @property {Uint8Array|null} [path] ChannelStateData path - * @property {ibc.core.channel.v1.IChannel|null} [channel] ChannelStateData channel - */ - - /** - * Constructs a new ChannelStateData. - * @memberof ibc.lightclients.solomachine.v1 - * @classdesc Represents a ChannelStateData. - * @implements IChannelStateData - * @constructor - * @param {ibc.lightclients.solomachine.v1.IChannelStateData=} [properties] Properties to set - */ - function ChannelStateData(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ChannelStateData path. - * @member {Uint8Array} path - * @memberof ibc.lightclients.solomachine.v1.ChannelStateData - * @instance - */ - ChannelStateData.prototype.path = $util.newBuffer([]); - - /** - * ChannelStateData channel. - * @member {ibc.core.channel.v1.IChannel|null|undefined} channel - * @memberof ibc.lightclients.solomachine.v1.ChannelStateData - * @instance - */ - ChannelStateData.prototype.channel = null; - - /** - * Encodes the specified ChannelStateData message. Does not implicitly {@link ibc.lightclients.solomachine.v1.ChannelStateData.verify|verify} messages. - * @function encode - * @memberof ibc.lightclients.solomachine.v1.ChannelStateData - * @static - * @param {ibc.lightclients.solomachine.v1.IChannelStateData} message ChannelStateData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ChannelStateData.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.path != null && Object.hasOwnProperty.call(message, "path")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.path); - if (message.channel != null && Object.hasOwnProperty.call(message, "channel")) - $root.ibc.core.channel.v1.Channel.encode(message.channel, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ChannelStateData message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.ChannelStateData.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.lightclients.solomachine.v1.ChannelStateData - * @static - * @param {ibc.lightclients.solomachine.v1.IChannelStateData} message ChannelStateData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ChannelStateData.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ChannelStateData message from the specified reader or buffer. - * @function decode - * @memberof ibc.lightclients.solomachine.v1.ChannelStateData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.lightclients.solomachine.v1.ChannelStateData} ChannelStateData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ChannelStateData.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.ChannelStateData(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.path = reader.bytes(); - break; - case 2: - message.channel = $root.ibc.core.channel.v1.Channel.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ChannelStateData message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.lightclients.solomachine.v1.ChannelStateData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.lightclients.solomachine.v1.ChannelStateData} ChannelStateData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ChannelStateData.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ChannelStateData message. - * @function verify - * @memberof ibc.lightclients.solomachine.v1.ChannelStateData - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ChannelStateData.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.path != null && message.hasOwnProperty("path")) - if (!(message.path && typeof message.path.length === "number" || $util.isString(message.path))) - return "path: buffer expected"; - if (message.channel != null && message.hasOwnProperty("channel")) { - let error = $root.ibc.core.channel.v1.Channel.verify(message.channel); - if (error) - return "channel." + error; - } - return null; - }; - - /** - * Creates a ChannelStateData message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.lightclients.solomachine.v1.ChannelStateData - * @static - * @param {Object.} object Plain object - * @returns {ibc.lightclients.solomachine.v1.ChannelStateData} ChannelStateData - */ - ChannelStateData.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.lightclients.solomachine.v1.ChannelStateData) - return object; - let message = new $root.ibc.lightclients.solomachine.v1.ChannelStateData(); - if (object.path != null) - if (typeof object.path === "string") - $util.base64.decode(object.path, message.path = $util.newBuffer($util.base64.length(object.path)), 0); - else if (object.path.length) - message.path = object.path; - if (object.channel != null) { - if (typeof object.channel !== "object") - throw TypeError(".ibc.lightclients.solomachine.v1.ChannelStateData.channel: object expected"); - message.channel = $root.ibc.core.channel.v1.Channel.fromObject(object.channel); - } - return message; - }; - - /** - * Creates a plain object from a ChannelStateData message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.lightclients.solomachine.v1.ChannelStateData - * @static - * @param {ibc.lightclients.solomachine.v1.ChannelStateData} message ChannelStateData - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ChannelStateData.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if (options.bytes === String) - object.path = ""; - else { - object.path = []; - if (options.bytes !== Array) - object.path = $util.newBuffer(object.path); - } - object.channel = null; - } - if (message.path != null && message.hasOwnProperty("path")) - object.path = options.bytes === String ? $util.base64.encode(message.path, 0, message.path.length) : options.bytes === Array ? Array.prototype.slice.call(message.path) : message.path; - if (message.channel != null && message.hasOwnProperty("channel")) - object.channel = $root.ibc.core.channel.v1.Channel.toObject(message.channel, options); - return object; - }; - - /** - * Converts this ChannelStateData to JSON. - * @function toJSON - * @memberof ibc.lightclients.solomachine.v1.ChannelStateData - * @instance - * @returns {Object.} JSON object - */ - ChannelStateData.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ChannelStateData; - })(); - - v1.PacketCommitmentData = (function() { - - /** - * Properties of a PacketCommitmentData. - * @memberof ibc.lightclients.solomachine.v1 - * @interface IPacketCommitmentData - * @property {Uint8Array|null} [path] PacketCommitmentData path - * @property {Uint8Array|null} [commitment] PacketCommitmentData commitment - */ - - /** - * Constructs a new PacketCommitmentData. - * @memberof ibc.lightclients.solomachine.v1 - * @classdesc Represents a PacketCommitmentData. - * @implements IPacketCommitmentData - * @constructor - * @param {ibc.lightclients.solomachine.v1.IPacketCommitmentData=} [properties] Properties to set - */ - function PacketCommitmentData(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PacketCommitmentData path. - * @member {Uint8Array} path - * @memberof ibc.lightclients.solomachine.v1.PacketCommitmentData - * @instance - */ - PacketCommitmentData.prototype.path = $util.newBuffer([]); - - /** - * PacketCommitmentData commitment. - * @member {Uint8Array} commitment - * @memberof ibc.lightclients.solomachine.v1.PacketCommitmentData - * @instance - */ - PacketCommitmentData.prototype.commitment = $util.newBuffer([]); - - /** - * Encodes the specified PacketCommitmentData message. Does not implicitly {@link ibc.lightclients.solomachine.v1.PacketCommitmentData.verify|verify} messages. - * @function encode - * @memberof ibc.lightclients.solomachine.v1.PacketCommitmentData - * @static - * @param {ibc.lightclients.solomachine.v1.IPacketCommitmentData} message PacketCommitmentData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PacketCommitmentData.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.path != null && Object.hasOwnProperty.call(message, "path")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.path); - if (message.commitment != null && Object.hasOwnProperty.call(message, "commitment")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.commitment); - return writer; - }; - - /** - * Encodes the specified PacketCommitmentData message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.PacketCommitmentData.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.lightclients.solomachine.v1.PacketCommitmentData - * @static - * @param {ibc.lightclients.solomachine.v1.IPacketCommitmentData} message PacketCommitmentData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PacketCommitmentData.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PacketCommitmentData message from the specified reader or buffer. - * @function decode - * @memberof ibc.lightclients.solomachine.v1.PacketCommitmentData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.lightclients.solomachine.v1.PacketCommitmentData} PacketCommitmentData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PacketCommitmentData.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.PacketCommitmentData(); - while (reader.pos < end) { - let 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; - }; - - /** - * Decodes a PacketCommitmentData message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.lightclients.solomachine.v1.PacketCommitmentData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.lightclients.solomachine.v1.PacketCommitmentData} PacketCommitmentData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PacketCommitmentData.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PacketCommitmentData message. - * @function verify - * @memberof ibc.lightclients.solomachine.v1.PacketCommitmentData - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PacketCommitmentData.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.path != null && message.hasOwnProperty("path")) - if (!(message.path && typeof message.path.length === "number" || $util.isString(message.path))) - return "path: buffer expected"; - if (message.commitment != null && message.hasOwnProperty("commitment")) - if (!(message.commitment && typeof message.commitment.length === "number" || $util.isString(message.commitment))) - return "commitment: buffer expected"; - return null; - }; - - /** - * Creates a PacketCommitmentData message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.lightclients.solomachine.v1.PacketCommitmentData - * @static - * @param {Object.} object Plain object - * @returns {ibc.lightclients.solomachine.v1.PacketCommitmentData} PacketCommitmentData - */ - PacketCommitmentData.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.lightclients.solomachine.v1.PacketCommitmentData) - return object; - let message = new $root.ibc.lightclients.solomachine.v1.PacketCommitmentData(); - if (object.path != null) - if (typeof object.path === "string") - $util.base64.decode(object.path, message.path = $util.newBuffer($util.base64.length(object.path)), 0); - else if (object.path.length) - message.path = object.path; - if (object.commitment != null) - if (typeof object.commitment === "string") - $util.base64.decode(object.commitment, message.commitment = $util.newBuffer($util.base64.length(object.commitment)), 0); - else if (object.commitment.length) - message.commitment = object.commitment; - return message; - }; - - /** - * Creates a plain object from a PacketCommitmentData message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.lightclients.solomachine.v1.PacketCommitmentData - * @static - * @param {ibc.lightclients.solomachine.v1.PacketCommitmentData} message PacketCommitmentData - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PacketCommitmentData.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if (options.bytes === String) - object.path = ""; - else { - object.path = []; - if (options.bytes !== Array) - object.path = $util.newBuffer(object.path); - } - if (options.bytes === String) - object.commitment = ""; - else { - object.commitment = []; - if (options.bytes !== Array) - object.commitment = $util.newBuffer(object.commitment); - } - } - if (message.path != null && message.hasOwnProperty("path")) - object.path = options.bytes === String ? $util.base64.encode(message.path, 0, message.path.length) : options.bytes === Array ? Array.prototype.slice.call(message.path) : message.path; - if (message.commitment != null && message.hasOwnProperty("commitment")) - object.commitment = options.bytes === String ? $util.base64.encode(message.commitment, 0, message.commitment.length) : options.bytes === Array ? Array.prototype.slice.call(message.commitment) : message.commitment; - return object; - }; - - /** - * Converts this PacketCommitmentData to JSON. - * @function toJSON - * @memberof ibc.lightclients.solomachine.v1.PacketCommitmentData - * @instance - * @returns {Object.} JSON object - */ - PacketCommitmentData.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return PacketCommitmentData; - })(); - - v1.PacketAcknowledgementData = (function() { - - /** - * Properties of a PacketAcknowledgementData. - * @memberof ibc.lightclients.solomachine.v1 - * @interface IPacketAcknowledgementData - * @property {Uint8Array|null} [path] PacketAcknowledgementData path - * @property {Uint8Array|null} [acknowledgement] PacketAcknowledgementData acknowledgement - */ - - /** - * Constructs a new PacketAcknowledgementData. - * @memberof ibc.lightclients.solomachine.v1 - * @classdesc Represents a PacketAcknowledgementData. - * @implements IPacketAcknowledgementData - * @constructor - * @param {ibc.lightclients.solomachine.v1.IPacketAcknowledgementData=} [properties] Properties to set - */ - function PacketAcknowledgementData(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PacketAcknowledgementData path. - * @member {Uint8Array} path - * @memberof ibc.lightclients.solomachine.v1.PacketAcknowledgementData - * @instance - */ - PacketAcknowledgementData.prototype.path = $util.newBuffer([]); - - /** - * PacketAcknowledgementData acknowledgement. - * @member {Uint8Array} acknowledgement - * @memberof ibc.lightclients.solomachine.v1.PacketAcknowledgementData - * @instance - */ - PacketAcknowledgementData.prototype.acknowledgement = $util.newBuffer([]); - - /** - * Encodes the specified PacketAcknowledgementData message. Does not implicitly {@link ibc.lightclients.solomachine.v1.PacketAcknowledgementData.verify|verify} messages. - * @function encode - * @memberof ibc.lightclients.solomachine.v1.PacketAcknowledgementData - * @static - * @param {ibc.lightclients.solomachine.v1.IPacketAcknowledgementData} message PacketAcknowledgementData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PacketAcknowledgementData.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.path != null && Object.hasOwnProperty.call(message, "path")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.path); - if (message.acknowledgement != null && Object.hasOwnProperty.call(message, "acknowledgement")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.acknowledgement); - return writer; - }; - - /** - * Encodes the specified PacketAcknowledgementData message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.PacketAcknowledgementData.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.lightclients.solomachine.v1.PacketAcknowledgementData - * @static - * @param {ibc.lightclients.solomachine.v1.IPacketAcknowledgementData} message PacketAcknowledgementData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PacketAcknowledgementData.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PacketAcknowledgementData message from the specified reader or buffer. - * @function decode - * @memberof ibc.lightclients.solomachine.v1.PacketAcknowledgementData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.lightclients.solomachine.v1.PacketAcknowledgementData} PacketAcknowledgementData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PacketAcknowledgementData.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.PacketAcknowledgementData(); - while (reader.pos < end) { - let 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; - }; - - /** - * Decodes a PacketAcknowledgementData message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.lightclients.solomachine.v1.PacketAcknowledgementData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.lightclients.solomachine.v1.PacketAcknowledgementData} PacketAcknowledgementData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PacketAcknowledgementData.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PacketAcknowledgementData message. - * @function verify - * @memberof ibc.lightclients.solomachine.v1.PacketAcknowledgementData - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PacketAcknowledgementData.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.path != null && message.hasOwnProperty("path")) - if (!(message.path && typeof message.path.length === "number" || $util.isString(message.path))) - return "path: buffer expected"; - if (message.acknowledgement != null && message.hasOwnProperty("acknowledgement")) - if (!(message.acknowledgement && typeof message.acknowledgement.length === "number" || $util.isString(message.acknowledgement))) - return "acknowledgement: buffer expected"; - return null; - }; - - /** - * Creates a PacketAcknowledgementData message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.lightclients.solomachine.v1.PacketAcknowledgementData - * @static - * @param {Object.} object Plain object - * @returns {ibc.lightclients.solomachine.v1.PacketAcknowledgementData} PacketAcknowledgementData - */ - PacketAcknowledgementData.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.lightclients.solomachine.v1.PacketAcknowledgementData) - return object; - let message = new $root.ibc.lightclients.solomachine.v1.PacketAcknowledgementData(); - if (object.path != null) - if (typeof object.path === "string") - $util.base64.decode(object.path, message.path = $util.newBuffer($util.base64.length(object.path)), 0); - else if (object.path.length) - message.path = object.path; - if (object.acknowledgement != null) - if (typeof object.acknowledgement === "string") - $util.base64.decode(object.acknowledgement, message.acknowledgement = $util.newBuffer($util.base64.length(object.acknowledgement)), 0); - else if (object.acknowledgement.length) - message.acknowledgement = object.acknowledgement; - return message; - }; - - /** - * Creates a plain object from a PacketAcknowledgementData message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.lightclients.solomachine.v1.PacketAcknowledgementData - * @static - * @param {ibc.lightclients.solomachine.v1.PacketAcknowledgementData} message PacketAcknowledgementData - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PacketAcknowledgementData.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if (options.bytes === String) - object.path = ""; - else { - object.path = []; - if (options.bytes !== Array) - object.path = $util.newBuffer(object.path); - } - if (options.bytes === String) - object.acknowledgement = ""; - else { - object.acknowledgement = []; - if (options.bytes !== Array) - object.acknowledgement = $util.newBuffer(object.acknowledgement); - } - } - if (message.path != null && message.hasOwnProperty("path")) - object.path = options.bytes === String ? $util.base64.encode(message.path, 0, message.path.length) : options.bytes === Array ? Array.prototype.slice.call(message.path) : message.path; - if (message.acknowledgement != null && message.hasOwnProperty("acknowledgement")) - object.acknowledgement = options.bytes === String ? $util.base64.encode(message.acknowledgement, 0, message.acknowledgement.length) : options.bytes === Array ? Array.prototype.slice.call(message.acknowledgement) : message.acknowledgement; - return object; - }; - - /** - * Converts this PacketAcknowledgementData to JSON. - * @function toJSON - * @memberof ibc.lightclients.solomachine.v1.PacketAcknowledgementData - * @instance - * @returns {Object.} JSON object - */ - PacketAcknowledgementData.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return PacketAcknowledgementData; - })(); - - v1.PacketReceiptAbsenceData = (function() { - - /** - * Properties of a PacketReceiptAbsenceData. - * @memberof ibc.lightclients.solomachine.v1 - * @interface IPacketReceiptAbsenceData - * @property {Uint8Array|null} [path] PacketReceiptAbsenceData path - */ - - /** - * Constructs a new PacketReceiptAbsenceData. - * @memberof ibc.lightclients.solomachine.v1 - * @classdesc Represents a PacketReceiptAbsenceData. - * @implements IPacketReceiptAbsenceData - * @constructor - * @param {ibc.lightclients.solomachine.v1.IPacketReceiptAbsenceData=} [properties] Properties to set - */ - function PacketReceiptAbsenceData(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PacketReceiptAbsenceData path. - * @member {Uint8Array} path - * @memberof ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData - * @instance - */ - PacketReceiptAbsenceData.prototype.path = $util.newBuffer([]); - - /** - * Encodes the specified PacketReceiptAbsenceData message. Does not implicitly {@link ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData.verify|verify} messages. - * @function encode - * @memberof ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData - * @static - * @param {ibc.lightclients.solomachine.v1.IPacketReceiptAbsenceData} message PacketReceiptAbsenceData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PacketReceiptAbsenceData.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.path != null && Object.hasOwnProperty.call(message, "path")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.path); - return writer; - }; - - /** - * Encodes the specified PacketReceiptAbsenceData message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData - * @static - * @param {ibc.lightclients.solomachine.v1.IPacketReceiptAbsenceData} message PacketReceiptAbsenceData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PacketReceiptAbsenceData.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PacketReceiptAbsenceData message from the specified reader or buffer. - * @function decode - * @memberof ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData} PacketReceiptAbsenceData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PacketReceiptAbsenceData.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.path = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PacketReceiptAbsenceData message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData} PacketReceiptAbsenceData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PacketReceiptAbsenceData.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PacketReceiptAbsenceData message. - * @function verify - * @memberof ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PacketReceiptAbsenceData.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.path != null && message.hasOwnProperty("path")) - if (!(message.path && typeof message.path.length === "number" || $util.isString(message.path))) - return "path: buffer expected"; - return null; - }; - - /** - * Creates a PacketReceiptAbsenceData message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData - * @static - * @param {Object.} object Plain object - * @returns {ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData} PacketReceiptAbsenceData - */ - PacketReceiptAbsenceData.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData) - return object; - let message = new $root.ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData(); - if (object.path != null) - if (typeof object.path === "string") - $util.base64.decode(object.path, message.path = $util.newBuffer($util.base64.length(object.path)), 0); - else if (object.path.length) - message.path = object.path; - return message; - }; - - /** - * Creates a plain object from a PacketReceiptAbsenceData message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData - * @static - * @param {ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData} message PacketReceiptAbsenceData - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PacketReceiptAbsenceData.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - if (options.bytes === String) - object.path = ""; - else { - object.path = []; - if (options.bytes !== Array) - object.path = $util.newBuffer(object.path); - } - if (message.path != null && message.hasOwnProperty("path")) - object.path = options.bytes === String ? $util.base64.encode(message.path, 0, message.path.length) : options.bytes === Array ? Array.prototype.slice.call(message.path) : message.path; - return object; - }; - - /** - * Converts this PacketReceiptAbsenceData to JSON. - * @function toJSON - * @memberof ibc.lightclients.solomachine.v1.PacketReceiptAbsenceData - * @instance - * @returns {Object.} JSON object - */ - PacketReceiptAbsenceData.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return PacketReceiptAbsenceData; - })(); - - v1.NextSequenceRecvData = (function() { - - /** - * Properties of a NextSequenceRecvData. - * @memberof ibc.lightclients.solomachine.v1 - * @interface INextSequenceRecvData - * @property {Uint8Array|null} [path] NextSequenceRecvData path - * @property {Long|null} [next_seq_recv] NextSequenceRecvData next_seq_recv - */ - - /** - * Constructs a new NextSequenceRecvData. - * @memberof ibc.lightclients.solomachine.v1 - * @classdesc Represents a NextSequenceRecvData. - * @implements INextSequenceRecvData - * @constructor - * @param {ibc.lightclients.solomachine.v1.INextSequenceRecvData=} [properties] Properties to set - */ - function NextSequenceRecvData(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * NextSequenceRecvData path. - * @member {Uint8Array} path - * @memberof ibc.lightclients.solomachine.v1.NextSequenceRecvData - * @instance - */ - NextSequenceRecvData.prototype.path = $util.newBuffer([]); - - /** - * NextSequenceRecvData next_seq_recv. - * @member {Long} next_seq_recv - * @memberof ibc.lightclients.solomachine.v1.NextSequenceRecvData - * @instance - */ - NextSequenceRecvData.prototype.next_seq_recv = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified NextSequenceRecvData message. Does not implicitly {@link ibc.lightclients.solomachine.v1.NextSequenceRecvData.verify|verify} messages. - * @function encode - * @memberof ibc.lightclients.solomachine.v1.NextSequenceRecvData - * @static - * @param {ibc.lightclients.solomachine.v1.INextSequenceRecvData} message NextSequenceRecvData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - NextSequenceRecvData.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.path != null && Object.hasOwnProperty.call(message, "path")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.path); - if (message.next_seq_recv != null && Object.hasOwnProperty.call(message, "next_seq_recv")) - writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.next_seq_recv); - return writer; - }; - - /** - * Encodes the specified NextSequenceRecvData message, length delimited. Does not implicitly {@link ibc.lightclients.solomachine.v1.NextSequenceRecvData.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.lightclients.solomachine.v1.NextSequenceRecvData - * @static - * @param {ibc.lightclients.solomachine.v1.INextSequenceRecvData} message NextSequenceRecvData message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - NextSequenceRecvData.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a NextSequenceRecvData message from the specified reader or buffer. - * @function decode - * @memberof ibc.lightclients.solomachine.v1.NextSequenceRecvData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.lightclients.solomachine.v1.NextSequenceRecvData} NextSequenceRecvData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - NextSequenceRecvData.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.solomachine.v1.NextSequenceRecvData(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.path = reader.bytes(); - break; - case 2: - message.next_seq_recv = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a NextSequenceRecvData message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.lightclients.solomachine.v1.NextSequenceRecvData - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.lightclients.solomachine.v1.NextSequenceRecvData} NextSequenceRecvData - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - NextSequenceRecvData.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a NextSequenceRecvData message. - * @function verify - * @memberof ibc.lightclients.solomachine.v1.NextSequenceRecvData - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - NextSequenceRecvData.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.path != null && message.hasOwnProperty("path")) - if (!(message.path && typeof message.path.length === "number" || $util.isString(message.path))) - return "path: buffer expected"; - if (message.next_seq_recv != null && message.hasOwnProperty("next_seq_recv")) - if (!$util.isInteger(message.next_seq_recv) && !(message.next_seq_recv && $util.isInteger(message.next_seq_recv.low) && $util.isInteger(message.next_seq_recv.high))) - return "next_seq_recv: integer|Long expected"; - return null; - }; - - /** - * Creates a NextSequenceRecvData message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.lightclients.solomachine.v1.NextSequenceRecvData - * @static - * @param {Object.} object Plain object - * @returns {ibc.lightclients.solomachine.v1.NextSequenceRecvData} NextSequenceRecvData - */ - NextSequenceRecvData.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.lightclients.solomachine.v1.NextSequenceRecvData) - return object; - let message = new $root.ibc.lightclients.solomachine.v1.NextSequenceRecvData(); - if (object.path != null) - if (typeof object.path === "string") - $util.base64.decode(object.path, message.path = $util.newBuffer($util.base64.length(object.path)), 0); - else if (object.path.length) - message.path = object.path; - if (object.next_seq_recv != null) - if ($util.Long) - (message.next_seq_recv = $util.Long.fromValue(object.next_seq_recv)).unsigned = true; - else if (typeof object.next_seq_recv === "string") - message.next_seq_recv = parseInt(object.next_seq_recv, 10); - else if (typeof object.next_seq_recv === "number") - message.next_seq_recv = object.next_seq_recv; - else if (typeof object.next_seq_recv === "object") - message.next_seq_recv = new $util.LongBits(object.next_seq_recv.low >>> 0, object.next_seq_recv.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a NextSequenceRecvData message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.lightclients.solomachine.v1.NextSequenceRecvData - * @static - * @param {ibc.lightclients.solomachine.v1.NextSequenceRecvData} message NextSequenceRecvData - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - NextSequenceRecvData.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if (options.bytes === String) - object.path = ""; - else { - object.path = []; - if (options.bytes !== Array) - object.path = $util.newBuffer(object.path); - } - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.next_seq_recv = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.next_seq_recv = options.longs === String ? "0" : 0; - } - if (message.path != null && message.hasOwnProperty("path")) - object.path = options.bytes === String ? $util.base64.encode(message.path, 0, message.path.length) : options.bytes === Array ? Array.prototype.slice.call(message.path) : message.path; - if (message.next_seq_recv != null && message.hasOwnProperty("next_seq_recv")) - if (typeof message.next_seq_recv === "number") - object.next_seq_recv = options.longs === String ? String(message.next_seq_recv) : message.next_seq_recv; - else - object.next_seq_recv = options.longs === String ? $util.Long.prototype.toString.call(message.next_seq_recv) : options.longs === Number ? new $util.LongBits(message.next_seq_recv.low >>> 0, message.next_seq_recv.high >>> 0).toNumber(true) : message.next_seq_recv; - return object; - }; - - /** - * Converts this NextSequenceRecvData to JSON. - * @function toJSON - * @memberof ibc.lightclients.solomachine.v1.NextSequenceRecvData - * @instance - * @returns {Object.} JSON object - */ - NextSequenceRecvData.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return NextSequenceRecvData; - })(); - - return v1; - })(); - - return solomachine; - })(); - - lightclients.tendermint = (function() { - - /** - * Namespace tendermint. - * @memberof ibc.lightclients - * @namespace - */ - const tendermint = {}; - - tendermint.v1 = (function() { - - /** - * Namespace v1. - * @memberof ibc.lightclients.tendermint - * @namespace - */ - const v1 = {}; - - v1.ClientState = (function() { - - /** - * Properties of a ClientState. - * @memberof ibc.lightclients.tendermint.v1 - * @interface IClientState - * @property {string|null} [chain_id] ClientState chain_id - * @property {ibc.lightclients.tendermint.v1.IFraction|null} [trust_level] ClientState trust_level - * @property {google.protobuf.IDuration|null} [trusting_period] ClientState trusting_period - * @property {google.protobuf.IDuration|null} [unbonding_period] ClientState unbonding_period - * @property {google.protobuf.IDuration|null} [max_clock_drift] ClientState max_clock_drift - * @property {ibc.core.client.v1.IHeight|null} [frozen_height] ClientState frozen_height - * @property {ibc.core.client.v1.IHeight|null} [latest_height] ClientState latest_height - * @property {Array.|null} [proof_specs] ClientState proof_specs - * @property {Array.|null} [upgrade_path] ClientState upgrade_path - * @property {boolean|null} [allow_update_after_expiry] ClientState allow_update_after_expiry - * @property {boolean|null} [allow_update_after_misbehaviour] ClientState allow_update_after_misbehaviour - */ - - /** - * Constructs a new ClientState. - * @memberof ibc.lightclients.tendermint.v1 - * @classdesc Represents a ClientState. - * @implements IClientState - * @constructor - * @param {ibc.lightclients.tendermint.v1.IClientState=} [properties] Properties to set - */ - function ClientState(properties) { - this.proof_specs = []; - this.upgrade_path = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ClientState chain_id. - * @member {string} chain_id - * @memberof ibc.lightclients.tendermint.v1.ClientState - * @instance - */ - ClientState.prototype.chain_id = ""; - - /** - * ClientState trust_level. - * @member {ibc.lightclients.tendermint.v1.IFraction|null|undefined} trust_level - * @memberof ibc.lightclients.tendermint.v1.ClientState - * @instance - */ - ClientState.prototype.trust_level = null; - - /** - * ClientState trusting_period. - * @member {google.protobuf.IDuration|null|undefined} trusting_period - * @memberof ibc.lightclients.tendermint.v1.ClientState - * @instance - */ - ClientState.prototype.trusting_period = null; - - /** - * ClientState unbonding_period. - * @member {google.protobuf.IDuration|null|undefined} unbonding_period - * @memberof ibc.lightclients.tendermint.v1.ClientState - * @instance - */ - ClientState.prototype.unbonding_period = null; - - /** - * ClientState max_clock_drift. - * @member {google.protobuf.IDuration|null|undefined} max_clock_drift - * @memberof ibc.lightclients.tendermint.v1.ClientState - * @instance - */ - ClientState.prototype.max_clock_drift = null; - - /** - * ClientState frozen_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} frozen_height - * @memberof ibc.lightclients.tendermint.v1.ClientState - * @instance - */ - ClientState.prototype.frozen_height = null; - - /** - * ClientState latest_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} latest_height - * @memberof ibc.lightclients.tendermint.v1.ClientState - * @instance - */ - ClientState.prototype.latest_height = null; - - /** - * ClientState proof_specs. - * @member {Array.} proof_specs - * @memberof ibc.lightclients.tendermint.v1.ClientState - * @instance - */ - ClientState.prototype.proof_specs = $util.emptyArray; - - /** - * ClientState upgrade_path. - * @member {Array.} upgrade_path - * @memberof ibc.lightclients.tendermint.v1.ClientState - * @instance - */ - ClientState.prototype.upgrade_path = $util.emptyArray; - - /** - * ClientState allow_update_after_expiry. - * @member {boolean} allow_update_after_expiry - * @memberof ibc.lightclients.tendermint.v1.ClientState - * @instance - */ - ClientState.prototype.allow_update_after_expiry = false; - - /** - * ClientState allow_update_after_misbehaviour. - * @member {boolean} allow_update_after_misbehaviour - * @memberof ibc.lightclients.tendermint.v1.ClientState - * @instance - */ - ClientState.prototype.allow_update_after_misbehaviour = false; - - /** - * Encodes the specified ClientState message. Does not implicitly {@link ibc.lightclients.tendermint.v1.ClientState.verify|verify} messages. - * @function encode - * @memberof ibc.lightclients.tendermint.v1.ClientState - * @static - * @param {ibc.lightclients.tendermint.v1.IClientState} message ClientState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ClientState.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.chain_id != null && Object.hasOwnProperty.call(message, "chain_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.chain_id); - if (message.trust_level != null && Object.hasOwnProperty.call(message, "trust_level")) - $root.ibc.lightclients.tendermint.v1.Fraction.encode(message.trust_level, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.trusting_period != null && Object.hasOwnProperty.call(message, "trusting_period")) - $root.google.protobuf.Duration.encode(message.trusting_period, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.unbonding_period != null && Object.hasOwnProperty.call(message, "unbonding_period")) - $root.google.protobuf.Duration.encode(message.unbonding_period, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.max_clock_drift != null && Object.hasOwnProperty.call(message, "max_clock_drift")) - $root.google.protobuf.Duration.encode(message.max_clock_drift, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.frozen_height != null && Object.hasOwnProperty.call(message, "frozen_height")) - $root.ibc.core.client.v1.Height.encode(message.frozen_height, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.latest_height != null && Object.hasOwnProperty.call(message, "latest_height")) - $root.ibc.core.client.v1.Height.encode(message.latest_height, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.proof_specs != null && message.proof_specs.length) - for (let i = 0; i < message.proof_specs.length; ++i) - $root.ics23.ProofSpec.encode(message.proof_specs[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.upgrade_path != null && message.upgrade_path.length) - for (let i = 0; i < message.upgrade_path.length; ++i) - writer.uint32(/* id 9, wireType 2 =*/74).string(message.upgrade_path[i]); - if (message.allow_update_after_expiry != null && Object.hasOwnProperty.call(message, "allow_update_after_expiry")) - writer.uint32(/* id 10, wireType 0 =*/80).bool(message.allow_update_after_expiry); - if (message.allow_update_after_misbehaviour != null && Object.hasOwnProperty.call(message, "allow_update_after_misbehaviour")) - writer.uint32(/* id 11, wireType 0 =*/88).bool(message.allow_update_after_misbehaviour); - return writer; - }; - - /** - * Encodes the specified ClientState message, length delimited. Does not implicitly {@link ibc.lightclients.tendermint.v1.ClientState.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.lightclients.tendermint.v1.ClientState - * @static - * @param {ibc.lightclients.tendermint.v1.IClientState} message ClientState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ClientState.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ClientState message from the specified reader or buffer. - * @function decode - * @memberof ibc.lightclients.tendermint.v1.ClientState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.lightclients.tendermint.v1.ClientState} ClientState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ClientState.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.tendermint.v1.ClientState(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.chain_id = reader.string(); - break; - case 2: - message.trust_level = $root.ibc.lightclients.tendermint.v1.Fraction.decode(reader, reader.uint32()); - break; - case 3: - message.trusting_period = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - case 4: - message.unbonding_period = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - case 5: - message.max_clock_drift = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - case 6: - message.frozen_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - case 7: - message.latest_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - case 8: - if (!(message.proof_specs && message.proof_specs.length)) - message.proof_specs = []; - message.proof_specs.push($root.ics23.ProofSpec.decode(reader, reader.uint32())); - break; - case 9: - if (!(message.upgrade_path && message.upgrade_path.length)) - message.upgrade_path = []; - message.upgrade_path.push(reader.string()); - break; - case 10: - message.allow_update_after_expiry = reader.bool(); - break; - case 11: - message.allow_update_after_misbehaviour = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ClientState message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.lightclients.tendermint.v1.ClientState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.lightclients.tendermint.v1.ClientState} ClientState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ClientState.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ClientState message. - * @function verify - * @memberof ibc.lightclients.tendermint.v1.ClientState - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ClientState.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.chain_id != null && message.hasOwnProperty("chain_id")) - if (!$util.isString(message.chain_id)) - return "chain_id: string expected"; - if (message.trust_level != null && message.hasOwnProperty("trust_level")) { - let error = $root.ibc.lightclients.tendermint.v1.Fraction.verify(message.trust_level); - if (error) - return "trust_level." + error; - } - if (message.trusting_period != null && message.hasOwnProperty("trusting_period")) { - let error = $root.google.protobuf.Duration.verify(message.trusting_period); - if (error) - return "trusting_period." + error; - } - if (message.unbonding_period != null && message.hasOwnProperty("unbonding_period")) { - let error = $root.google.protobuf.Duration.verify(message.unbonding_period); - if (error) - return "unbonding_period." + error; - } - if (message.max_clock_drift != null && message.hasOwnProperty("max_clock_drift")) { - let error = $root.google.protobuf.Duration.verify(message.max_clock_drift); - if (error) - return "max_clock_drift." + error; - } - if (message.frozen_height != null && message.hasOwnProperty("frozen_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.frozen_height); - if (error) - return "frozen_height." + error; - } - if (message.latest_height != null && message.hasOwnProperty("latest_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.latest_height); - if (error) - return "latest_height." + error; - } - if (message.proof_specs != null && message.hasOwnProperty("proof_specs")) { - if (!Array.isArray(message.proof_specs)) - return "proof_specs: array expected"; - for (let i = 0; i < message.proof_specs.length; ++i) { - let error = $root.ics23.ProofSpec.verify(message.proof_specs[i]); - if (error) - return "proof_specs." + error; - } - } - if (message.upgrade_path != null && message.hasOwnProperty("upgrade_path")) { - if (!Array.isArray(message.upgrade_path)) - return "upgrade_path: array expected"; - for (let i = 0; i < message.upgrade_path.length; ++i) - if (!$util.isString(message.upgrade_path[i])) - return "upgrade_path: string[] expected"; - } - if (message.allow_update_after_expiry != null && message.hasOwnProperty("allow_update_after_expiry")) - if (typeof message.allow_update_after_expiry !== "boolean") - return "allow_update_after_expiry: boolean expected"; - if (message.allow_update_after_misbehaviour != null && message.hasOwnProperty("allow_update_after_misbehaviour")) - if (typeof message.allow_update_after_misbehaviour !== "boolean") - return "allow_update_after_misbehaviour: boolean expected"; - return null; - }; - - /** - * Creates a ClientState message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.lightclients.tendermint.v1.ClientState - * @static - * @param {Object.} object Plain object - * @returns {ibc.lightclients.tendermint.v1.ClientState} ClientState - */ - ClientState.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.lightclients.tendermint.v1.ClientState) - return object; - let message = new $root.ibc.lightclients.tendermint.v1.ClientState(); - if (object.chain_id != null) - message.chain_id = String(object.chain_id); - if (object.trust_level != null) { - if (typeof object.trust_level !== "object") - throw TypeError(".ibc.lightclients.tendermint.v1.ClientState.trust_level: object expected"); - message.trust_level = $root.ibc.lightclients.tendermint.v1.Fraction.fromObject(object.trust_level); - } - if (object.trusting_period != null) { - if (typeof object.trusting_period !== "object") - throw TypeError(".ibc.lightclients.tendermint.v1.ClientState.trusting_period: object expected"); - message.trusting_period = $root.google.protobuf.Duration.fromObject(object.trusting_period); - } - if (object.unbonding_period != null) { - if (typeof object.unbonding_period !== "object") - throw TypeError(".ibc.lightclients.tendermint.v1.ClientState.unbonding_period: object expected"); - message.unbonding_period = $root.google.protobuf.Duration.fromObject(object.unbonding_period); - } - if (object.max_clock_drift != null) { - if (typeof object.max_clock_drift !== "object") - throw TypeError(".ibc.lightclients.tendermint.v1.ClientState.max_clock_drift: object expected"); - message.max_clock_drift = $root.google.protobuf.Duration.fromObject(object.max_clock_drift); - } - if (object.frozen_height != null) { - if (typeof object.frozen_height !== "object") - throw TypeError(".ibc.lightclients.tendermint.v1.ClientState.frozen_height: object expected"); - message.frozen_height = $root.ibc.core.client.v1.Height.fromObject(object.frozen_height); - } - if (object.latest_height != null) { - if (typeof object.latest_height !== "object") - throw TypeError(".ibc.lightclients.tendermint.v1.ClientState.latest_height: object expected"); - message.latest_height = $root.ibc.core.client.v1.Height.fromObject(object.latest_height); - } - if (object.proof_specs) { - if (!Array.isArray(object.proof_specs)) - throw TypeError(".ibc.lightclients.tendermint.v1.ClientState.proof_specs: array expected"); - message.proof_specs = []; - for (let i = 0; i < object.proof_specs.length; ++i) { - if (typeof object.proof_specs[i] !== "object") - throw TypeError(".ibc.lightclients.tendermint.v1.ClientState.proof_specs: object expected"); - message.proof_specs[i] = $root.ics23.ProofSpec.fromObject(object.proof_specs[i]); - } - } - if (object.upgrade_path) { - if (!Array.isArray(object.upgrade_path)) - throw TypeError(".ibc.lightclients.tendermint.v1.ClientState.upgrade_path: array expected"); - message.upgrade_path = []; - for (let i = 0; i < object.upgrade_path.length; ++i) - message.upgrade_path[i] = String(object.upgrade_path[i]); - } - if (object.allow_update_after_expiry != null) - message.allow_update_after_expiry = Boolean(object.allow_update_after_expiry); - if (object.allow_update_after_misbehaviour != null) - message.allow_update_after_misbehaviour = Boolean(object.allow_update_after_misbehaviour); - return message; - }; - - /** - * Creates a plain object from a ClientState message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.lightclients.tendermint.v1.ClientState - * @static - * @param {ibc.lightclients.tendermint.v1.ClientState} message ClientState - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ClientState.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) { - object.proof_specs = []; - object.upgrade_path = []; - } - if (options.defaults) { - object.chain_id = ""; - object.trust_level = null; - object.trusting_period = null; - object.unbonding_period = null; - object.max_clock_drift = null; - object.frozen_height = null; - object.latest_height = null; - object.allow_update_after_expiry = false; - object.allow_update_after_misbehaviour = false; - } - if (message.chain_id != null && message.hasOwnProperty("chain_id")) - object.chain_id = message.chain_id; - if (message.trust_level != null && message.hasOwnProperty("trust_level")) - object.trust_level = $root.ibc.lightclients.tendermint.v1.Fraction.toObject(message.trust_level, options); - if (message.trusting_period != null && message.hasOwnProperty("trusting_period")) - object.trusting_period = $root.google.protobuf.Duration.toObject(message.trusting_period, options); - if (message.unbonding_period != null && message.hasOwnProperty("unbonding_period")) - object.unbonding_period = $root.google.protobuf.Duration.toObject(message.unbonding_period, options); - if (message.max_clock_drift != null && message.hasOwnProperty("max_clock_drift")) - object.max_clock_drift = $root.google.protobuf.Duration.toObject(message.max_clock_drift, options); - if (message.frozen_height != null && message.hasOwnProperty("frozen_height")) - object.frozen_height = $root.ibc.core.client.v1.Height.toObject(message.frozen_height, options); - if (message.latest_height != null && message.hasOwnProperty("latest_height")) - object.latest_height = $root.ibc.core.client.v1.Height.toObject(message.latest_height, options); - if (message.proof_specs && message.proof_specs.length) { - object.proof_specs = []; - for (let j = 0; j < message.proof_specs.length; ++j) - object.proof_specs[j] = $root.ics23.ProofSpec.toObject(message.proof_specs[j], options); - } - if (message.upgrade_path && message.upgrade_path.length) { - object.upgrade_path = []; - for (let j = 0; j < message.upgrade_path.length; ++j) - object.upgrade_path[j] = message.upgrade_path[j]; - } - if (message.allow_update_after_expiry != null && message.hasOwnProperty("allow_update_after_expiry")) - object.allow_update_after_expiry = message.allow_update_after_expiry; - if (message.allow_update_after_misbehaviour != null && message.hasOwnProperty("allow_update_after_misbehaviour")) - object.allow_update_after_misbehaviour = message.allow_update_after_misbehaviour; - return object; - }; - - /** - * Converts this ClientState to JSON. - * @function toJSON - * @memberof ibc.lightclients.tendermint.v1.ClientState - * @instance - * @returns {Object.} JSON object - */ - ClientState.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ClientState; - })(); - - v1.ConsensusState = (function() { - - /** - * Properties of a ConsensusState. - * @memberof ibc.lightclients.tendermint.v1 - * @interface IConsensusState - * @property {google.protobuf.ITimestamp|null} [timestamp] ConsensusState timestamp - * @property {ibc.core.commitment.v1.IMerkleRoot|null} [root] ConsensusState root - * @property {Uint8Array|null} [next_validators_hash] ConsensusState next_validators_hash - */ - - /** - * Constructs a new ConsensusState. - * @memberof ibc.lightclients.tendermint.v1 - * @classdesc Represents a ConsensusState. - * @implements IConsensusState - * @constructor - * @param {ibc.lightclients.tendermint.v1.IConsensusState=} [properties] Properties to set - */ - function ConsensusState(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ConsensusState timestamp. - * @member {google.protobuf.ITimestamp|null|undefined} timestamp - * @memberof ibc.lightclients.tendermint.v1.ConsensusState - * @instance - */ - ConsensusState.prototype.timestamp = null; - - /** - * ConsensusState root. - * @member {ibc.core.commitment.v1.IMerkleRoot|null|undefined} root - * @memberof ibc.lightclients.tendermint.v1.ConsensusState - * @instance - */ - ConsensusState.prototype.root = null; - - /** - * ConsensusState next_validators_hash. - * @member {Uint8Array} next_validators_hash - * @memberof ibc.lightclients.tendermint.v1.ConsensusState - * @instance - */ - ConsensusState.prototype.next_validators_hash = $util.newBuffer([]); - - /** - * Encodes the specified ConsensusState message. Does not implicitly {@link ibc.lightclients.tendermint.v1.ConsensusState.verify|verify} messages. - * @function encode - * @memberof ibc.lightclients.tendermint.v1.ConsensusState - * @static - * @param {ibc.lightclients.tendermint.v1.IConsensusState} message ConsensusState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConsensusState.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) - $root.google.protobuf.Timestamp.encode(message.timestamp, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.root != null && Object.hasOwnProperty.call(message, "root")) - $root.ibc.core.commitment.v1.MerkleRoot.encode(message.root, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.next_validators_hash != null && Object.hasOwnProperty.call(message, "next_validators_hash")) - writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.next_validators_hash); - return writer; - }; - - /** - * Encodes the specified ConsensusState message, length delimited. Does not implicitly {@link ibc.lightclients.tendermint.v1.ConsensusState.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.lightclients.tendermint.v1.ConsensusState - * @static - * @param {ibc.lightclients.tendermint.v1.IConsensusState} message ConsensusState message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConsensusState.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ConsensusState message from the specified reader or buffer. - * @function decode - * @memberof ibc.lightclients.tendermint.v1.ConsensusState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.lightclients.tendermint.v1.ConsensusState} ConsensusState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConsensusState.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.tendermint.v1.ConsensusState(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.timestamp = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 2: - message.root = $root.ibc.core.commitment.v1.MerkleRoot.decode(reader, reader.uint32()); - break; - case 3: - message.next_validators_hash = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ConsensusState message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.lightclients.tendermint.v1.ConsensusState - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.lightclients.tendermint.v1.ConsensusState} ConsensusState - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConsensusState.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ConsensusState message. - * @function verify - * @memberof ibc.lightclients.tendermint.v1.ConsensusState - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ConsensusState.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.timestamp != null && message.hasOwnProperty("timestamp")) { - let error = $root.google.protobuf.Timestamp.verify(message.timestamp); - if (error) - return "timestamp." + error; - } - if (message.root != null && message.hasOwnProperty("root")) { - let error = $root.ibc.core.commitment.v1.MerkleRoot.verify(message.root); - if (error) - return "root." + error; - } - if (message.next_validators_hash != null && message.hasOwnProperty("next_validators_hash")) - if (!(message.next_validators_hash && typeof message.next_validators_hash.length === "number" || $util.isString(message.next_validators_hash))) - return "next_validators_hash: buffer expected"; - return null; - }; - - /** - * Creates a ConsensusState message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.lightclients.tendermint.v1.ConsensusState - * @static - * @param {Object.} object Plain object - * @returns {ibc.lightclients.tendermint.v1.ConsensusState} ConsensusState - */ - ConsensusState.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.lightclients.tendermint.v1.ConsensusState) - return object; - let message = new $root.ibc.lightclients.tendermint.v1.ConsensusState(); - if (object.timestamp != null) { - if (typeof object.timestamp !== "object") - throw TypeError(".ibc.lightclients.tendermint.v1.ConsensusState.timestamp: object expected"); - message.timestamp = $root.google.protobuf.Timestamp.fromObject(object.timestamp); - } - if (object.root != null) { - if (typeof object.root !== "object") - throw TypeError(".ibc.lightclients.tendermint.v1.ConsensusState.root: object expected"); - message.root = $root.ibc.core.commitment.v1.MerkleRoot.fromObject(object.root); - } - if (object.next_validators_hash != null) - if (typeof object.next_validators_hash === "string") - $util.base64.decode(object.next_validators_hash, message.next_validators_hash = $util.newBuffer($util.base64.length(object.next_validators_hash)), 0); - else if (object.next_validators_hash.length) - message.next_validators_hash = object.next_validators_hash; - return message; - }; - - /** - * Creates a plain object from a ConsensusState message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.lightclients.tendermint.v1.ConsensusState - * @static - * @param {ibc.lightclients.tendermint.v1.ConsensusState} message ConsensusState - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ConsensusState.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.timestamp = null; - object.root = null; - if (options.bytes === String) - object.next_validators_hash = ""; - else { - object.next_validators_hash = []; - if (options.bytes !== Array) - object.next_validators_hash = $util.newBuffer(object.next_validators_hash); - } - } - if (message.timestamp != null && message.hasOwnProperty("timestamp")) - object.timestamp = $root.google.protobuf.Timestamp.toObject(message.timestamp, options); - if (message.root != null && message.hasOwnProperty("root")) - object.root = $root.ibc.core.commitment.v1.MerkleRoot.toObject(message.root, options); - if (message.next_validators_hash != null && message.hasOwnProperty("next_validators_hash")) - object.next_validators_hash = options.bytes === String ? $util.base64.encode(message.next_validators_hash, 0, message.next_validators_hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.next_validators_hash) : message.next_validators_hash; - return object; - }; - - /** - * Converts this ConsensusState to JSON. - * @function toJSON - * @memberof ibc.lightclients.tendermint.v1.ConsensusState - * @instance - * @returns {Object.} JSON object - */ - ConsensusState.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ConsensusState; - })(); - - v1.Misbehaviour = (function() { - - /** - * Properties of a Misbehaviour. - * @memberof ibc.lightclients.tendermint.v1 - * @interface IMisbehaviour - * @property {string|null} [client_id] Misbehaviour client_id - * @property {ibc.lightclients.tendermint.v1.IHeader|null} [header_1] Misbehaviour header_1 - * @property {ibc.lightclients.tendermint.v1.IHeader|null} [header_2] Misbehaviour header_2 - */ - - /** - * Constructs a new Misbehaviour. - * @memberof ibc.lightclients.tendermint.v1 - * @classdesc Represents a Misbehaviour. - * @implements IMisbehaviour - * @constructor - * @param {ibc.lightclients.tendermint.v1.IMisbehaviour=} [properties] Properties to set - */ - function Misbehaviour(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Misbehaviour client_id. - * @member {string} client_id - * @memberof ibc.lightclients.tendermint.v1.Misbehaviour - * @instance - */ - Misbehaviour.prototype.client_id = ""; - - /** - * Misbehaviour header_1. - * @member {ibc.lightclients.tendermint.v1.IHeader|null|undefined} header_1 - * @memberof ibc.lightclients.tendermint.v1.Misbehaviour - * @instance - */ - Misbehaviour.prototype.header_1 = null; - - /** - * Misbehaviour header_2. - * @member {ibc.lightclients.tendermint.v1.IHeader|null|undefined} header_2 - * @memberof ibc.lightclients.tendermint.v1.Misbehaviour - * @instance - */ - Misbehaviour.prototype.header_2 = null; - - /** - * Encodes the specified Misbehaviour message. Does not implicitly {@link ibc.lightclients.tendermint.v1.Misbehaviour.verify|verify} messages. - * @function encode - * @memberof ibc.lightclients.tendermint.v1.Misbehaviour - * @static - * @param {ibc.lightclients.tendermint.v1.IMisbehaviour} message Misbehaviour message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Misbehaviour.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.client_id != null && Object.hasOwnProperty.call(message, "client_id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.client_id); - if (message.header_1 != null && Object.hasOwnProperty.call(message, "header_1")) - $root.ibc.lightclients.tendermint.v1.Header.encode(message.header_1, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.header_2 != null && Object.hasOwnProperty.call(message, "header_2")) - $root.ibc.lightclients.tendermint.v1.Header.encode(message.header_2, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Misbehaviour message, length delimited. Does not implicitly {@link ibc.lightclients.tendermint.v1.Misbehaviour.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.lightclients.tendermint.v1.Misbehaviour - * @static - * @param {ibc.lightclients.tendermint.v1.IMisbehaviour} message Misbehaviour message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Misbehaviour.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Misbehaviour message from the specified reader or buffer. - * @function decode - * @memberof ibc.lightclients.tendermint.v1.Misbehaviour - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.lightclients.tendermint.v1.Misbehaviour} Misbehaviour - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Misbehaviour.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.tendermint.v1.Misbehaviour(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.client_id = reader.string(); - break; - case 2: - message.header_1 = $root.ibc.lightclients.tendermint.v1.Header.decode(reader, reader.uint32()); - break; - case 3: - message.header_2 = $root.ibc.lightclients.tendermint.v1.Header.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Misbehaviour message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.lightclients.tendermint.v1.Misbehaviour - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.lightclients.tendermint.v1.Misbehaviour} Misbehaviour - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Misbehaviour.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Misbehaviour message. - * @function verify - * @memberof ibc.lightclients.tendermint.v1.Misbehaviour - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Misbehaviour.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.client_id != null && message.hasOwnProperty("client_id")) - if (!$util.isString(message.client_id)) - return "client_id: string expected"; - if (message.header_1 != null && message.hasOwnProperty("header_1")) { - let error = $root.ibc.lightclients.tendermint.v1.Header.verify(message.header_1); - if (error) - return "header_1." + error; - } - if (message.header_2 != null && message.hasOwnProperty("header_2")) { - let error = $root.ibc.lightclients.tendermint.v1.Header.verify(message.header_2); - if (error) - return "header_2." + error; - } - return null; - }; - - /** - * Creates a Misbehaviour message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.lightclients.tendermint.v1.Misbehaviour - * @static - * @param {Object.} object Plain object - * @returns {ibc.lightclients.tendermint.v1.Misbehaviour} Misbehaviour - */ - Misbehaviour.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.lightclients.tendermint.v1.Misbehaviour) - return object; - let message = new $root.ibc.lightclients.tendermint.v1.Misbehaviour(); - if (object.client_id != null) - message.client_id = String(object.client_id); - if (object.header_1 != null) { - if (typeof object.header_1 !== "object") - throw TypeError(".ibc.lightclients.tendermint.v1.Misbehaviour.header_1: object expected"); - message.header_1 = $root.ibc.lightclients.tendermint.v1.Header.fromObject(object.header_1); - } - if (object.header_2 != null) { - if (typeof object.header_2 !== "object") - throw TypeError(".ibc.lightclients.tendermint.v1.Misbehaviour.header_2: object expected"); - message.header_2 = $root.ibc.lightclients.tendermint.v1.Header.fromObject(object.header_2); - } - return message; - }; - - /** - * Creates a plain object from a Misbehaviour message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.lightclients.tendermint.v1.Misbehaviour - * @static - * @param {ibc.lightclients.tendermint.v1.Misbehaviour} message Misbehaviour - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Misbehaviour.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.client_id = ""; - object.header_1 = null; - object.header_2 = null; - } - if (message.client_id != null && message.hasOwnProperty("client_id")) - object.client_id = message.client_id; - if (message.header_1 != null && message.hasOwnProperty("header_1")) - object.header_1 = $root.ibc.lightclients.tendermint.v1.Header.toObject(message.header_1, options); - if (message.header_2 != null && message.hasOwnProperty("header_2")) - object.header_2 = $root.ibc.lightclients.tendermint.v1.Header.toObject(message.header_2, options); - return object; - }; - - /** - * Converts this Misbehaviour to JSON. - * @function toJSON - * @memberof ibc.lightclients.tendermint.v1.Misbehaviour - * @instance - * @returns {Object.} JSON object - */ - Misbehaviour.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Misbehaviour; - })(); - - v1.Header = (function() { - - /** - * Properties of a Header. - * @memberof ibc.lightclients.tendermint.v1 - * @interface IHeader - * @property {tendermint.types.ISignedHeader|null} [signed_header] Header signed_header - * @property {tendermint.types.IValidatorSet|null} [validator_set] Header validator_set - * @property {ibc.core.client.v1.IHeight|null} [trusted_height] Header trusted_height - * @property {tendermint.types.IValidatorSet|null} [trusted_validators] Header trusted_validators - */ - - /** - * Constructs a new Header. - * @memberof ibc.lightclients.tendermint.v1 - * @classdesc Represents a Header. - * @implements IHeader - * @constructor - * @param {ibc.lightclients.tendermint.v1.IHeader=} [properties] Properties to set - */ - function Header(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Header signed_header. - * @member {tendermint.types.ISignedHeader|null|undefined} signed_header - * @memberof ibc.lightclients.tendermint.v1.Header - * @instance - */ - Header.prototype.signed_header = null; - - /** - * Header validator_set. - * @member {tendermint.types.IValidatorSet|null|undefined} validator_set - * @memberof ibc.lightclients.tendermint.v1.Header - * @instance - */ - Header.prototype.validator_set = null; - - /** - * Header trusted_height. - * @member {ibc.core.client.v1.IHeight|null|undefined} trusted_height - * @memberof ibc.lightclients.tendermint.v1.Header - * @instance - */ - Header.prototype.trusted_height = null; - - /** - * Header trusted_validators. - * @member {tendermint.types.IValidatorSet|null|undefined} trusted_validators - * @memberof ibc.lightclients.tendermint.v1.Header - * @instance - */ - Header.prototype.trusted_validators = null; - - /** - * Encodes the specified Header message. Does not implicitly {@link ibc.lightclients.tendermint.v1.Header.verify|verify} messages. - * @function encode - * @memberof ibc.lightclients.tendermint.v1.Header - * @static - * @param {ibc.lightclients.tendermint.v1.IHeader} message Header message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Header.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.signed_header != null && Object.hasOwnProperty.call(message, "signed_header")) - $root.tendermint.types.SignedHeader.encode(message.signed_header, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.validator_set != null && Object.hasOwnProperty.call(message, "validator_set")) - $root.tendermint.types.ValidatorSet.encode(message.validator_set, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.trusted_height != null && Object.hasOwnProperty.call(message, "trusted_height")) - $root.ibc.core.client.v1.Height.encode(message.trusted_height, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.trusted_validators != null && Object.hasOwnProperty.call(message, "trusted_validators")) - $root.tendermint.types.ValidatorSet.encode(message.trusted_validators, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Header message, length delimited. Does not implicitly {@link ibc.lightclients.tendermint.v1.Header.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.lightclients.tendermint.v1.Header - * @static - * @param {ibc.lightclients.tendermint.v1.IHeader} message Header message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Header.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Header message from the specified reader or buffer. - * @function decode - * @memberof ibc.lightclients.tendermint.v1.Header - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.lightclients.tendermint.v1.Header} Header - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Header.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.tendermint.v1.Header(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.signed_header = $root.tendermint.types.SignedHeader.decode(reader, reader.uint32()); - break; - case 2: - message.validator_set = $root.tendermint.types.ValidatorSet.decode(reader, reader.uint32()); - break; - case 3: - message.trusted_height = $root.ibc.core.client.v1.Height.decode(reader, reader.uint32()); - break; - case 4: - message.trusted_validators = $root.tendermint.types.ValidatorSet.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Header message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.lightclients.tendermint.v1.Header - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.lightclients.tendermint.v1.Header} Header - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Header.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Header message. - * @function verify - * @memberof ibc.lightclients.tendermint.v1.Header - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Header.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.signed_header != null && message.hasOwnProperty("signed_header")) { - let error = $root.tendermint.types.SignedHeader.verify(message.signed_header); - if (error) - return "signed_header." + error; - } - if (message.validator_set != null && message.hasOwnProperty("validator_set")) { - let error = $root.tendermint.types.ValidatorSet.verify(message.validator_set); - if (error) - return "validator_set." + error; - } - if (message.trusted_height != null && message.hasOwnProperty("trusted_height")) { - let error = $root.ibc.core.client.v1.Height.verify(message.trusted_height); - if (error) - return "trusted_height." + error; - } - if (message.trusted_validators != null && message.hasOwnProperty("trusted_validators")) { - let error = $root.tendermint.types.ValidatorSet.verify(message.trusted_validators); - if (error) - return "trusted_validators." + error; - } - return null; - }; - - /** - * Creates a Header message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.lightclients.tendermint.v1.Header - * @static - * @param {Object.} object Plain object - * @returns {ibc.lightclients.tendermint.v1.Header} Header - */ - Header.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.lightclients.tendermint.v1.Header) - return object; - let message = new $root.ibc.lightclients.tendermint.v1.Header(); - if (object.signed_header != null) { - if (typeof object.signed_header !== "object") - throw TypeError(".ibc.lightclients.tendermint.v1.Header.signed_header: object expected"); - message.signed_header = $root.tendermint.types.SignedHeader.fromObject(object.signed_header); - } - if (object.validator_set != null) { - if (typeof object.validator_set !== "object") - throw TypeError(".ibc.lightclients.tendermint.v1.Header.validator_set: object expected"); - message.validator_set = $root.tendermint.types.ValidatorSet.fromObject(object.validator_set); - } - if (object.trusted_height != null) { - if (typeof object.trusted_height !== "object") - throw TypeError(".ibc.lightclients.tendermint.v1.Header.trusted_height: object expected"); - message.trusted_height = $root.ibc.core.client.v1.Height.fromObject(object.trusted_height); - } - if (object.trusted_validators != null) { - if (typeof object.trusted_validators !== "object") - throw TypeError(".ibc.lightclients.tendermint.v1.Header.trusted_validators: object expected"); - message.trusted_validators = $root.tendermint.types.ValidatorSet.fromObject(object.trusted_validators); - } - return message; - }; - - /** - * Creates a plain object from a Header message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.lightclients.tendermint.v1.Header - * @static - * @param {ibc.lightclients.tendermint.v1.Header} message Header - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Header.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.signed_header = null; - object.validator_set = null; - object.trusted_height = null; - object.trusted_validators = null; - } - if (message.signed_header != null && message.hasOwnProperty("signed_header")) - object.signed_header = $root.tendermint.types.SignedHeader.toObject(message.signed_header, options); - if (message.validator_set != null && message.hasOwnProperty("validator_set")) - object.validator_set = $root.tendermint.types.ValidatorSet.toObject(message.validator_set, options); - if (message.trusted_height != null && message.hasOwnProperty("trusted_height")) - object.trusted_height = $root.ibc.core.client.v1.Height.toObject(message.trusted_height, options); - if (message.trusted_validators != null && message.hasOwnProperty("trusted_validators")) - object.trusted_validators = $root.tendermint.types.ValidatorSet.toObject(message.trusted_validators, options); - return object; - }; - - /** - * Converts this Header to JSON. - * @function toJSON - * @memberof ibc.lightclients.tendermint.v1.Header - * @instance - * @returns {Object.} JSON object - */ - Header.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Header; - })(); - - v1.Fraction = (function() { - - /** - * Properties of a Fraction. - * @memberof ibc.lightclients.tendermint.v1 - * @interface IFraction - * @property {Long|null} [numerator] Fraction numerator - * @property {Long|null} [denominator] Fraction denominator - */ - - /** - * Constructs a new Fraction. - * @memberof ibc.lightclients.tendermint.v1 - * @classdesc Represents a Fraction. - * @implements IFraction - * @constructor - * @param {ibc.lightclients.tendermint.v1.IFraction=} [properties] Properties to set - */ - function Fraction(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Fraction numerator. - * @member {Long} numerator - * @memberof ibc.lightclients.tendermint.v1.Fraction - * @instance - */ - Fraction.prototype.numerator = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Fraction denominator. - * @member {Long} denominator - * @memberof ibc.lightclients.tendermint.v1.Fraction - * @instance - */ - Fraction.prototype.denominator = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified Fraction message. Does not implicitly {@link ibc.lightclients.tendermint.v1.Fraction.verify|verify} messages. - * @function encode - * @memberof ibc.lightclients.tendermint.v1.Fraction - * @static - * @param {ibc.lightclients.tendermint.v1.IFraction} message Fraction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Fraction.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.numerator != null && Object.hasOwnProperty.call(message, "numerator")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.numerator); - if (message.denominator != null && Object.hasOwnProperty.call(message, "denominator")) - writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.denominator); - return writer; - }; - - /** - * Encodes the specified Fraction message, length delimited. Does not implicitly {@link ibc.lightclients.tendermint.v1.Fraction.verify|verify} messages. - * @function encodeDelimited - * @memberof ibc.lightclients.tendermint.v1.Fraction - * @static - * @param {ibc.lightclients.tendermint.v1.IFraction} message Fraction message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Fraction.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Fraction message from the specified reader or buffer. - * @function decode - * @memberof ibc.lightclients.tendermint.v1.Fraction - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {ibc.lightclients.tendermint.v1.Fraction} Fraction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Fraction.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ibc.lightclients.tendermint.v1.Fraction(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.numerator = reader.uint64(); - break; - case 2: - message.denominator = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Fraction message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof ibc.lightclients.tendermint.v1.Fraction - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {ibc.lightclients.tendermint.v1.Fraction} Fraction - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Fraction.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Fraction message. - * @function verify - * @memberof ibc.lightclients.tendermint.v1.Fraction - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Fraction.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.numerator != null && message.hasOwnProperty("numerator")) - if (!$util.isInteger(message.numerator) && !(message.numerator && $util.isInteger(message.numerator.low) && $util.isInteger(message.numerator.high))) - return "numerator: integer|Long expected"; - if (message.denominator != null && message.hasOwnProperty("denominator")) - if (!$util.isInteger(message.denominator) && !(message.denominator && $util.isInteger(message.denominator.low) && $util.isInteger(message.denominator.high))) - return "denominator: integer|Long expected"; - return null; - }; - - /** - * Creates a Fraction message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof ibc.lightclients.tendermint.v1.Fraction - * @static - * @param {Object.} object Plain object - * @returns {ibc.lightclients.tendermint.v1.Fraction} Fraction - */ - Fraction.fromObject = function fromObject(object) { - if (object instanceof $root.ibc.lightclients.tendermint.v1.Fraction) - return object; - let message = new $root.ibc.lightclients.tendermint.v1.Fraction(); - if (object.numerator != null) - if ($util.Long) - (message.numerator = $util.Long.fromValue(object.numerator)).unsigned = true; - else if (typeof object.numerator === "string") - message.numerator = parseInt(object.numerator, 10); - else if (typeof object.numerator === "number") - message.numerator = object.numerator; - else if (typeof object.numerator === "object") - message.numerator = new $util.LongBits(object.numerator.low >>> 0, object.numerator.high >>> 0).toNumber(true); - if (object.denominator != null) - if ($util.Long) - (message.denominator = $util.Long.fromValue(object.denominator)).unsigned = true; - else if (typeof object.denominator === "string") - message.denominator = parseInt(object.denominator, 10); - else if (typeof object.denominator === "number") - message.denominator = object.denominator; - else if (typeof object.denominator === "object") - message.denominator = new $util.LongBits(object.denominator.low >>> 0, object.denominator.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a Fraction message. Also converts values to other types if specified. - * @function toObject - * @memberof ibc.lightclients.tendermint.v1.Fraction - * @static - * @param {ibc.lightclients.tendermint.v1.Fraction} message Fraction - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Fraction.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.numerator = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.numerator = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.denominator = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.denominator = options.longs === String ? "0" : 0; - } - if (message.numerator != null && message.hasOwnProperty("numerator")) - if (typeof message.numerator === "number") - object.numerator = options.longs === String ? String(message.numerator) : message.numerator; - else - object.numerator = options.longs === String ? $util.Long.prototype.toString.call(message.numerator) : options.longs === Number ? new $util.LongBits(message.numerator.low >>> 0, message.numerator.high >>> 0).toNumber(true) : message.numerator; - if (message.denominator != null && message.hasOwnProperty("denominator")) - if (typeof message.denominator === "number") - object.denominator = options.longs === String ? String(message.denominator) : message.denominator; - else - object.denominator = options.longs === String ? $util.Long.prototype.toString.call(message.denominator) : options.longs === Number ? new $util.LongBits(message.denominator.low >>> 0, message.denominator.high >>> 0).toNumber(true) : message.denominator; - return object; - }; - - /** - * Converts this Fraction to JSON. - * @function toJSON - * @memberof ibc.lightclients.tendermint.v1.Fraction - * @instance - * @returns {Object.} JSON object - */ - Fraction.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Fraction; - })(); - - return v1; - })(); - - return tendermint; - })(); - - return lightclients; - })(); - - return ibc; -})(); - -export const tendermint = $root.tendermint = (() => { - - /** - * Namespace tendermint. - * @exports tendermint - * @namespace - */ - const tendermint = {}; - - tendermint.abci = (function() { - - /** - * Namespace abci. - * @memberof tendermint - * @namespace - */ - const abci = {}; - - abci.Request = (function() { - - /** - * Properties of a Request. - * @memberof tendermint.abci - * @interface IRequest - * @property {tendermint.abci.IRequestEcho|null} [echo] Request echo - * @property {tendermint.abci.IRequestFlush|null} [flush] Request flush - * @property {tendermint.abci.IRequestInfo|null} [info] Request info - * @property {tendermint.abci.IRequestSetOption|null} [set_option] Request set_option - * @property {tendermint.abci.IRequestInitChain|null} [init_chain] Request init_chain - * @property {tendermint.abci.IRequestQuery|null} [query] Request query - * @property {tendermint.abci.IRequestBeginBlock|null} [begin_block] Request begin_block - * @property {tendermint.abci.IRequestCheckTx|null} [check_tx] Request check_tx - * @property {tendermint.abci.IRequestDeliverTx|null} [deliver_tx] Request deliver_tx - * @property {tendermint.abci.IRequestEndBlock|null} [end_block] Request end_block - * @property {tendermint.abci.IRequestCommit|null} [commit] Request commit - * @property {tendermint.abci.IRequestListSnapshots|null} [list_snapshots] Request list_snapshots - * @property {tendermint.abci.IRequestOfferSnapshot|null} [offer_snapshot] Request offer_snapshot - * @property {tendermint.abci.IRequestLoadSnapshotChunk|null} [load_snapshot_chunk] Request load_snapshot_chunk - * @property {tendermint.abci.IRequestApplySnapshotChunk|null} [apply_snapshot_chunk] Request apply_snapshot_chunk - */ - - /** - * Constructs a new Request. - * @memberof tendermint.abci - * @classdesc Represents a Request. - * @implements IRequest - * @constructor - * @param {tendermint.abci.IRequest=} [properties] Properties to set - */ - function Request(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Request echo. - * @member {tendermint.abci.IRequestEcho|null|undefined} echo - * @memberof tendermint.abci.Request - * @instance - */ - Request.prototype.echo = null; - - /** - * Request flush. - * @member {tendermint.abci.IRequestFlush|null|undefined} flush - * @memberof tendermint.abci.Request - * @instance - */ - Request.prototype.flush = null; - - /** - * Request info. - * @member {tendermint.abci.IRequestInfo|null|undefined} info - * @memberof tendermint.abci.Request - * @instance - */ - Request.prototype.info = null; - - /** - * Request set_option. - * @member {tendermint.abci.IRequestSetOption|null|undefined} set_option - * @memberof tendermint.abci.Request - * @instance - */ - Request.prototype.set_option = null; - - /** - * Request init_chain. - * @member {tendermint.abci.IRequestInitChain|null|undefined} init_chain - * @memberof tendermint.abci.Request - * @instance - */ - Request.prototype.init_chain = null; - - /** - * Request query. - * @member {tendermint.abci.IRequestQuery|null|undefined} query - * @memberof tendermint.abci.Request - * @instance - */ - Request.prototype.query = null; - - /** - * Request begin_block. - * @member {tendermint.abci.IRequestBeginBlock|null|undefined} begin_block - * @memberof tendermint.abci.Request - * @instance - */ - Request.prototype.begin_block = null; - - /** - * Request check_tx. - * @member {tendermint.abci.IRequestCheckTx|null|undefined} check_tx - * @memberof tendermint.abci.Request - * @instance - */ - Request.prototype.check_tx = null; - - /** - * Request deliver_tx. - * @member {tendermint.abci.IRequestDeliverTx|null|undefined} deliver_tx - * @memberof tendermint.abci.Request - * @instance - */ - Request.prototype.deliver_tx = null; - - /** - * Request end_block. - * @member {tendermint.abci.IRequestEndBlock|null|undefined} end_block - * @memberof tendermint.abci.Request - * @instance - */ - Request.prototype.end_block = null; - - /** - * Request commit. - * @member {tendermint.abci.IRequestCommit|null|undefined} commit - * @memberof tendermint.abci.Request - * @instance - */ - Request.prototype.commit = null; - - /** - * Request list_snapshots. - * @member {tendermint.abci.IRequestListSnapshots|null|undefined} list_snapshots - * @memberof tendermint.abci.Request - * @instance - */ - Request.prototype.list_snapshots = null; - - /** - * Request offer_snapshot. - * @member {tendermint.abci.IRequestOfferSnapshot|null|undefined} offer_snapshot - * @memberof tendermint.abci.Request - * @instance - */ - Request.prototype.offer_snapshot = null; - - /** - * Request load_snapshot_chunk. - * @member {tendermint.abci.IRequestLoadSnapshotChunk|null|undefined} load_snapshot_chunk - * @memberof tendermint.abci.Request - * @instance - */ - Request.prototype.load_snapshot_chunk = null; - - /** - * Request apply_snapshot_chunk. - * @member {tendermint.abci.IRequestApplySnapshotChunk|null|undefined} apply_snapshot_chunk - * @memberof tendermint.abci.Request - * @instance - */ - Request.prototype.apply_snapshot_chunk = null; - - // OneOf field names bound to virtual getters and setters - let $oneOfFields; - - /** - * Request value. - * @member {"echo"|"flush"|"info"|"set_option"|"init_chain"|"query"|"begin_block"|"check_tx"|"deliver_tx"|"end_block"|"commit"|"list_snapshots"|"offer_snapshot"|"load_snapshot_chunk"|"apply_snapshot_chunk"|undefined} value - * @memberof tendermint.abci.Request - * @instance - */ - Object.defineProperty(Request.prototype, "value", { - get: $util.oneOfGetter($oneOfFields = ["echo", "flush", "info", "set_option", "init_chain", "query", "begin_block", "check_tx", "deliver_tx", "end_block", "commit", "list_snapshots", "offer_snapshot", "load_snapshot_chunk", "apply_snapshot_chunk"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Encodes the specified Request message. Does not implicitly {@link tendermint.abci.Request.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.Request - * @static - * @param {tendermint.abci.IRequest} message Request message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Request.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.echo != null && Object.hasOwnProperty.call(message, "echo")) - $root.tendermint.abci.RequestEcho.encode(message.echo, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.flush != null && Object.hasOwnProperty.call(message, "flush")) - $root.tendermint.abci.RequestFlush.encode(message.flush, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.info != null && Object.hasOwnProperty.call(message, "info")) - $root.tendermint.abci.RequestInfo.encode(message.info, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.set_option != null && Object.hasOwnProperty.call(message, "set_option")) - $root.tendermint.abci.RequestSetOption.encode(message.set_option, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.init_chain != null && Object.hasOwnProperty.call(message, "init_chain")) - $root.tendermint.abci.RequestInitChain.encode(message.init_chain, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.query != null && Object.hasOwnProperty.call(message, "query")) - $root.tendermint.abci.RequestQuery.encode(message.query, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.begin_block != null && Object.hasOwnProperty.call(message, "begin_block")) - $root.tendermint.abci.RequestBeginBlock.encode(message.begin_block, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.check_tx != null && Object.hasOwnProperty.call(message, "check_tx")) - $root.tendermint.abci.RequestCheckTx.encode(message.check_tx, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.deliver_tx != null && Object.hasOwnProperty.call(message, "deliver_tx")) - $root.tendermint.abci.RequestDeliverTx.encode(message.deliver_tx, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.end_block != null && Object.hasOwnProperty.call(message, "end_block")) - $root.tendermint.abci.RequestEndBlock.encode(message.end_block, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); - if (message.commit != null && Object.hasOwnProperty.call(message, "commit")) - $root.tendermint.abci.RequestCommit.encode(message.commit, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.list_snapshots != null && Object.hasOwnProperty.call(message, "list_snapshots")) - $root.tendermint.abci.RequestListSnapshots.encode(message.list_snapshots, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.offer_snapshot != null && Object.hasOwnProperty.call(message, "offer_snapshot")) - $root.tendermint.abci.RequestOfferSnapshot.encode(message.offer_snapshot, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); - if (message.load_snapshot_chunk != null && Object.hasOwnProperty.call(message, "load_snapshot_chunk")) - $root.tendermint.abci.RequestLoadSnapshotChunk.encode(message.load_snapshot_chunk, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); - if (message.apply_snapshot_chunk != null && Object.hasOwnProperty.call(message, "apply_snapshot_chunk")) - $root.tendermint.abci.RequestApplySnapshotChunk.encode(message.apply_snapshot_chunk, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Request message, length delimited. Does not implicitly {@link tendermint.abci.Request.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.Request - * @static - * @param {tendermint.abci.IRequest} message Request message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Request.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Request message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.Request - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.Request} Request - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Request.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.Request(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.echo = $root.tendermint.abci.RequestEcho.decode(reader, reader.uint32()); - break; - case 2: - message.flush = $root.tendermint.abci.RequestFlush.decode(reader, reader.uint32()); - break; - case 3: - message.info = $root.tendermint.abci.RequestInfo.decode(reader, reader.uint32()); - break; - case 4: - message.set_option = $root.tendermint.abci.RequestSetOption.decode(reader, reader.uint32()); - break; - case 5: - message.init_chain = $root.tendermint.abci.RequestInitChain.decode(reader, reader.uint32()); - break; - case 6: - message.query = $root.tendermint.abci.RequestQuery.decode(reader, reader.uint32()); - break; - case 7: - message.begin_block = $root.tendermint.abci.RequestBeginBlock.decode(reader, reader.uint32()); - break; - case 8: - message.check_tx = $root.tendermint.abci.RequestCheckTx.decode(reader, reader.uint32()); - break; - case 9: - message.deliver_tx = $root.tendermint.abci.RequestDeliverTx.decode(reader, reader.uint32()); - break; - case 10: - message.end_block = $root.tendermint.abci.RequestEndBlock.decode(reader, reader.uint32()); - break; - case 11: - message.commit = $root.tendermint.abci.RequestCommit.decode(reader, reader.uint32()); - break; - case 12: - message.list_snapshots = $root.tendermint.abci.RequestListSnapshots.decode(reader, reader.uint32()); - break; - case 13: - message.offer_snapshot = $root.tendermint.abci.RequestOfferSnapshot.decode(reader, reader.uint32()); - break; - case 14: - message.load_snapshot_chunk = $root.tendermint.abci.RequestLoadSnapshotChunk.decode(reader, reader.uint32()); - break; - case 15: - message.apply_snapshot_chunk = $root.tendermint.abci.RequestApplySnapshotChunk.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Request message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.Request - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.Request} Request - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Request.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Request message. - * @function verify - * @memberof tendermint.abci.Request - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Request.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - let properties = {}; - if (message.echo != null && message.hasOwnProperty("echo")) { - properties.value = 1; - { - let error = $root.tendermint.abci.RequestEcho.verify(message.echo); - if (error) - return "echo." + error; - } - } - if (message.flush != null && message.hasOwnProperty("flush")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - let error = $root.tendermint.abci.RequestFlush.verify(message.flush); - if (error) - return "flush." + error; - } - } - if (message.info != null && message.hasOwnProperty("info")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - let error = $root.tendermint.abci.RequestInfo.verify(message.info); - if (error) - return "info." + error; - } - } - if (message.set_option != null && message.hasOwnProperty("set_option")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - let error = $root.tendermint.abci.RequestSetOption.verify(message.set_option); - if (error) - return "set_option." + error; - } - } - if (message.init_chain != null && message.hasOwnProperty("init_chain")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - let error = $root.tendermint.abci.RequestInitChain.verify(message.init_chain); - if (error) - return "init_chain." + error; - } - } - if (message.query != null && message.hasOwnProperty("query")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - let error = $root.tendermint.abci.RequestQuery.verify(message.query); - if (error) - return "query." + error; - } - } - if (message.begin_block != null && message.hasOwnProperty("begin_block")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - let error = $root.tendermint.abci.RequestBeginBlock.verify(message.begin_block); - if (error) - return "begin_block." + error; - } - } - if (message.check_tx != null && message.hasOwnProperty("check_tx")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - let error = $root.tendermint.abci.RequestCheckTx.verify(message.check_tx); - if (error) - return "check_tx." + error; - } - } - if (message.deliver_tx != null && message.hasOwnProperty("deliver_tx")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - let error = $root.tendermint.abci.RequestDeliverTx.verify(message.deliver_tx); - if (error) - return "deliver_tx." + error; - } - } - if (message.end_block != null && message.hasOwnProperty("end_block")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - let error = $root.tendermint.abci.RequestEndBlock.verify(message.end_block); - if (error) - return "end_block." + error; - } - } - if (message.commit != null && message.hasOwnProperty("commit")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - let error = $root.tendermint.abci.RequestCommit.verify(message.commit); - if (error) - return "commit." + error; - } - } - if (message.list_snapshots != null && message.hasOwnProperty("list_snapshots")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - let error = $root.tendermint.abci.RequestListSnapshots.verify(message.list_snapshots); - if (error) - return "list_snapshots." + error; - } - } - if (message.offer_snapshot != null && message.hasOwnProperty("offer_snapshot")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - let error = $root.tendermint.abci.RequestOfferSnapshot.verify(message.offer_snapshot); - if (error) - return "offer_snapshot." + error; - } - } - if (message.load_snapshot_chunk != null && message.hasOwnProperty("load_snapshot_chunk")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - let error = $root.tendermint.abci.RequestLoadSnapshotChunk.verify(message.load_snapshot_chunk); - if (error) - return "load_snapshot_chunk." + error; - } - } - if (message.apply_snapshot_chunk != null && message.hasOwnProperty("apply_snapshot_chunk")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - let error = $root.tendermint.abci.RequestApplySnapshotChunk.verify(message.apply_snapshot_chunk); - if (error) - return "apply_snapshot_chunk." + error; - } - } - return null; - }; - - /** - * Creates a Request message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.Request - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.Request} Request - */ - Request.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.Request) - return object; - let message = new $root.tendermint.abci.Request(); - if (object.echo != null) { - if (typeof object.echo !== "object") - throw TypeError(".tendermint.abci.Request.echo: object expected"); - message.echo = $root.tendermint.abci.RequestEcho.fromObject(object.echo); - } - if (object.flush != null) { - if (typeof object.flush !== "object") - throw TypeError(".tendermint.abci.Request.flush: object expected"); - message.flush = $root.tendermint.abci.RequestFlush.fromObject(object.flush); - } - if (object.info != null) { - if (typeof object.info !== "object") - throw TypeError(".tendermint.abci.Request.info: object expected"); - message.info = $root.tendermint.abci.RequestInfo.fromObject(object.info); - } - if (object.set_option != null) { - if (typeof object.set_option !== "object") - throw TypeError(".tendermint.abci.Request.set_option: object expected"); - message.set_option = $root.tendermint.abci.RequestSetOption.fromObject(object.set_option); - } - if (object.init_chain != null) { - if (typeof object.init_chain !== "object") - throw TypeError(".tendermint.abci.Request.init_chain: object expected"); - message.init_chain = $root.tendermint.abci.RequestInitChain.fromObject(object.init_chain); - } - if (object.query != null) { - if (typeof object.query !== "object") - throw TypeError(".tendermint.abci.Request.query: object expected"); - message.query = $root.tendermint.abci.RequestQuery.fromObject(object.query); - } - if (object.begin_block != null) { - if (typeof object.begin_block !== "object") - throw TypeError(".tendermint.abci.Request.begin_block: object expected"); - message.begin_block = $root.tendermint.abci.RequestBeginBlock.fromObject(object.begin_block); - } - if (object.check_tx != null) { - if (typeof object.check_tx !== "object") - throw TypeError(".tendermint.abci.Request.check_tx: object expected"); - message.check_tx = $root.tendermint.abci.RequestCheckTx.fromObject(object.check_tx); - } - if (object.deliver_tx != null) { - if (typeof object.deliver_tx !== "object") - throw TypeError(".tendermint.abci.Request.deliver_tx: object expected"); - message.deliver_tx = $root.tendermint.abci.RequestDeliverTx.fromObject(object.deliver_tx); - } - if (object.end_block != null) { - if (typeof object.end_block !== "object") - throw TypeError(".tendermint.abci.Request.end_block: object expected"); - message.end_block = $root.tendermint.abci.RequestEndBlock.fromObject(object.end_block); - } - if (object.commit != null) { - if (typeof object.commit !== "object") - throw TypeError(".tendermint.abci.Request.commit: object expected"); - message.commit = $root.tendermint.abci.RequestCommit.fromObject(object.commit); - } - if (object.list_snapshots != null) { - if (typeof object.list_snapshots !== "object") - throw TypeError(".tendermint.abci.Request.list_snapshots: object expected"); - message.list_snapshots = $root.tendermint.abci.RequestListSnapshots.fromObject(object.list_snapshots); - } - if (object.offer_snapshot != null) { - if (typeof object.offer_snapshot !== "object") - throw TypeError(".tendermint.abci.Request.offer_snapshot: object expected"); - message.offer_snapshot = $root.tendermint.abci.RequestOfferSnapshot.fromObject(object.offer_snapshot); - } - if (object.load_snapshot_chunk != null) { - if (typeof object.load_snapshot_chunk !== "object") - throw TypeError(".tendermint.abci.Request.load_snapshot_chunk: object expected"); - message.load_snapshot_chunk = $root.tendermint.abci.RequestLoadSnapshotChunk.fromObject(object.load_snapshot_chunk); - } - if (object.apply_snapshot_chunk != null) { - if (typeof object.apply_snapshot_chunk !== "object") - throw TypeError(".tendermint.abci.Request.apply_snapshot_chunk: object expected"); - message.apply_snapshot_chunk = $root.tendermint.abci.RequestApplySnapshotChunk.fromObject(object.apply_snapshot_chunk); - } - return message; - }; - - /** - * Creates a plain object from a Request message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.Request - * @static - * @param {tendermint.abci.Request} message Request - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Request.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (message.echo != null && message.hasOwnProperty("echo")) { - object.echo = $root.tendermint.abci.RequestEcho.toObject(message.echo, options); - if (options.oneofs) - object.value = "echo"; - } - if (message.flush != null && message.hasOwnProperty("flush")) { - object.flush = $root.tendermint.abci.RequestFlush.toObject(message.flush, options); - if (options.oneofs) - object.value = "flush"; - } - if (message.info != null && message.hasOwnProperty("info")) { - object.info = $root.tendermint.abci.RequestInfo.toObject(message.info, options); - if (options.oneofs) - object.value = "info"; - } - if (message.set_option != null && message.hasOwnProperty("set_option")) { - object.set_option = $root.tendermint.abci.RequestSetOption.toObject(message.set_option, options); - if (options.oneofs) - object.value = "set_option"; - } - if (message.init_chain != null && message.hasOwnProperty("init_chain")) { - object.init_chain = $root.tendermint.abci.RequestInitChain.toObject(message.init_chain, options); - if (options.oneofs) - object.value = "init_chain"; - } - if (message.query != null && message.hasOwnProperty("query")) { - object.query = $root.tendermint.abci.RequestQuery.toObject(message.query, options); - if (options.oneofs) - object.value = "query"; - } - if (message.begin_block != null && message.hasOwnProperty("begin_block")) { - object.begin_block = $root.tendermint.abci.RequestBeginBlock.toObject(message.begin_block, options); - if (options.oneofs) - object.value = "begin_block"; - } - if (message.check_tx != null && message.hasOwnProperty("check_tx")) { - object.check_tx = $root.tendermint.abci.RequestCheckTx.toObject(message.check_tx, options); - if (options.oneofs) - object.value = "check_tx"; - } - if (message.deliver_tx != null && message.hasOwnProperty("deliver_tx")) { - object.deliver_tx = $root.tendermint.abci.RequestDeliverTx.toObject(message.deliver_tx, options); - if (options.oneofs) - object.value = "deliver_tx"; - } - if (message.end_block != null && message.hasOwnProperty("end_block")) { - object.end_block = $root.tendermint.abci.RequestEndBlock.toObject(message.end_block, options); - if (options.oneofs) - object.value = "end_block"; - } - if (message.commit != null && message.hasOwnProperty("commit")) { - object.commit = $root.tendermint.abci.RequestCommit.toObject(message.commit, options); - if (options.oneofs) - object.value = "commit"; - } - if (message.list_snapshots != null && message.hasOwnProperty("list_snapshots")) { - object.list_snapshots = $root.tendermint.abci.RequestListSnapshots.toObject(message.list_snapshots, options); - if (options.oneofs) - object.value = "list_snapshots"; - } - if (message.offer_snapshot != null && message.hasOwnProperty("offer_snapshot")) { - object.offer_snapshot = $root.tendermint.abci.RequestOfferSnapshot.toObject(message.offer_snapshot, options); - if (options.oneofs) - object.value = "offer_snapshot"; - } - if (message.load_snapshot_chunk != null && message.hasOwnProperty("load_snapshot_chunk")) { - object.load_snapshot_chunk = $root.tendermint.abci.RequestLoadSnapshotChunk.toObject(message.load_snapshot_chunk, options); - if (options.oneofs) - object.value = "load_snapshot_chunk"; - } - if (message.apply_snapshot_chunk != null && message.hasOwnProperty("apply_snapshot_chunk")) { - object.apply_snapshot_chunk = $root.tendermint.abci.RequestApplySnapshotChunk.toObject(message.apply_snapshot_chunk, options); - if (options.oneofs) - object.value = "apply_snapshot_chunk"; - } - return object; - }; - - /** - * Converts this Request to JSON. - * @function toJSON - * @memberof tendermint.abci.Request - * @instance - * @returns {Object.} JSON object - */ - Request.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Request; - })(); - - abci.RequestEcho = (function() { - - /** - * Properties of a RequestEcho. - * @memberof tendermint.abci - * @interface IRequestEcho - * @property {string|null} [message] RequestEcho message - */ - - /** - * Constructs a new RequestEcho. - * @memberof tendermint.abci - * @classdesc Represents a RequestEcho. - * @implements IRequestEcho - * @constructor - * @param {tendermint.abci.IRequestEcho=} [properties] Properties to set - */ - function RequestEcho(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * RequestEcho message. - * @member {string} message - * @memberof tendermint.abci.RequestEcho - * @instance - */ - RequestEcho.prototype.message = ""; - - /** - * Encodes the specified RequestEcho message. Does not implicitly {@link tendermint.abci.RequestEcho.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.RequestEcho - * @static - * @param {tendermint.abci.IRequestEcho} message RequestEcho message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RequestEcho.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.message != null && Object.hasOwnProperty.call(message, "message")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.message); - return writer; - }; - - /** - * Encodes the specified RequestEcho message, length delimited. Does not implicitly {@link tendermint.abci.RequestEcho.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.RequestEcho - * @static - * @param {tendermint.abci.IRequestEcho} message RequestEcho message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RequestEcho.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RequestEcho message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.RequestEcho - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.RequestEcho} RequestEcho - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RequestEcho.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.RequestEcho(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.message = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RequestEcho message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.RequestEcho - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.RequestEcho} RequestEcho - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RequestEcho.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RequestEcho message. - * @function verify - * @memberof tendermint.abci.RequestEcho - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RequestEcho.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.message != null && message.hasOwnProperty("message")) - if (!$util.isString(message.message)) - return "message: string expected"; - return null; - }; - - /** - * Creates a RequestEcho message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.RequestEcho - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.RequestEcho} RequestEcho - */ - RequestEcho.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.RequestEcho) - return object; - let message = new $root.tendermint.abci.RequestEcho(); - if (object.message != null) - message.message = String(object.message); - return message; - }; - - /** - * Creates a plain object from a RequestEcho message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.RequestEcho - * @static - * @param {tendermint.abci.RequestEcho} message RequestEcho - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RequestEcho.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.message = ""; - if (message.message != null && message.hasOwnProperty("message")) - object.message = message.message; - return object; - }; - - /** - * Converts this RequestEcho to JSON. - * @function toJSON - * @memberof tendermint.abci.RequestEcho - * @instance - * @returns {Object.} JSON object - */ - RequestEcho.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return RequestEcho; - })(); - - abci.RequestFlush = (function() { - - /** - * Properties of a RequestFlush. - * @memberof tendermint.abci - * @interface IRequestFlush - */ - - /** - * Constructs a new RequestFlush. - * @memberof tendermint.abci - * @classdesc Represents a RequestFlush. - * @implements IRequestFlush - * @constructor - * @param {tendermint.abci.IRequestFlush=} [properties] Properties to set - */ - function RequestFlush(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified RequestFlush message. Does not implicitly {@link tendermint.abci.RequestFlush.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.RequestFlush - * @static - * @param {tendermint.abci.IRequestFlush} message RequestFlush message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RequestFlush.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified RequestFlush message, length delimited. Does not implicitly {@link tendermint.abci.RequestFlush.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.RequestFlush - * @static - * @param {tendermint.abci.IRequestFlush} message RequestFlush message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RequestFlush.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RequestFlush message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.RequestFlush - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.RequestFlush} RequestFlush - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RequestFlush.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.RequestFlush(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RequestFlush message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.RequestFlush - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.RequestFlush} RequestFlush - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RequestFlush.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RequestFlush message. - * @function verify - * @memberof tendermint.abci.RequestFlush - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RequestFlush.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a RequestFlush message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.RequestFlush - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.RequestFlush} RequestFlush - */ - RequestFlush.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.RequestFlush) - return object; - return new $root.tendermint.abci.RequestFlush(); - }; - - /** - * Creates a plain object from a RequestFlush message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.RequestFlush - * @static - * @param {tendermint.abci.RequestFlush} message RequestFlush - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RequestFlush.toObject = function toObject() { - return {}; - }; - - /** - * Converts this RequestFlush to JSON. - * @function toJSON - * @memberof tendermint.abci.RequestFlush - * @instance - * @returns {Object.} JSON object - */ - RequestFlush.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return RequestFlush; - })(); - - abci.RequestInfo = (function() { - - /** - * Properties of a RequestInfo. - * @memberof tendermint.abci - * @interface IRequestInfo - * @property {string|null} [version] RequestInfo version - * @property {Long|null} [block_version] RequestInfo block_version - * @property {Long|null} [p2p_version] RequestInfo p2p_version - */ - - /** - * Constructs a new RequestInfo. - * @memberof tendermint.abci - * @classdesc Represents a RequestInfo. - * @implements IRequestInfo - * @constructor - * @param {tendermint.abci.IRequestInfo=} [properties] Properties to set - */ - function RequestInfo(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * RequestInfo version. - * @member {string} version - * @memberof tendermint.abci.RequestInfo - * @instance - */ - RequestInfo.prototype.version = ""; - - /** - * RequestInfo block_version. - * @member {Long} block_version - * @memberof tendermint.abci.RequestInfo - * @instance - */ - RequestInfo.prototype.block_version = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * RequestInfo p2p_version. - * @member {Long} p2p_version - * @memberof tendermint.abci.RequestInfo - * @instance - */ - RequestInfo.prototype.p2p_version = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified RequestInfo message. Does not implicitly {@link tendermint.abci.RequestInfo.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.RequestInfo - * @static - * @param {tendermint.abci.IRequestInfo} message RequestInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RequestInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.version != null && Object.hasOwnProperty.call(message, "version")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.version); - if (message.block_version != null && Object.hasOwnProperty.call(message, "block_version")) - writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.block_version); - if (message.p2p_version != null && Object.hasOwnProperty.call(message, "p2p_version")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.p2p_version); - return writer; - }; - - /** - * Encodes the specified RequestInfo message, length delimited. Does not implicitly {@link tendermint.abci.RequestInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.RequestInfo - * @static - * @param {tendermint.abci.IRequestInfo} message RequestInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RequestInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RequestInfo message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.RequestInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.RequestInfo} RequestInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RequestInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.RequestInfo(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.version = reader.string(); - break; - case 2: - message.block_version = reader.uint64(); - break; - case 3: - message.p2p_version = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RequestInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.RequestInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.RequestInfo} RequestInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RequestInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RequestInfo message. - * @function verify - * @memberof tendermint.abci.RequestInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RequestInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.version != null && message.hasOwnProperty("version")) - if (!$util.isString(message.version)) - return "version: string expected"; - if (message.block_version != null && message.hasOwnProperty("block_version")) - if (!$util.isInteger(message.block_version) && !(message.block_version && $util.isInteger(message.block_version.low) && $util.isInteger(message.block_version.high))) - return "block_version: integer|Long expected"; - if (message.p2p_version != null && message.hasOwnProperty("p2p_version")) - if (!$util.isInteger(message.p2p_version) && !(message.p2p_version && $util.isInteger(message.p2p_version.low) && $util.isInteger(message.p2p_version.high))) - return "p2p_version: integer|Long expected"; - return null; - }; - - /** - * Creates a RequestInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.RequestInfo - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.RequestInfo} RequestInfo - */ - RequestInfo.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.RequestInfo) - return object; - let message = new $root.tendermint.abci.RequestInfo(); - if (object.version != null) - message.version = String(object.version); - if (object.block_version != null) - if ($util.Long) - (message.block_version = $util.Long.fromValue(object.block_version)).unsigned = true; - else if (typeof object.block_version === "string") - message.block_version = parseInt(object.block_version, 10); - else if (typeof object.block_version === "number") - message.block_version = object.block_version; - else if (typeof object.block_version === "object") - message.block_version = new $util.LongBits(object.block_version.low >>> 0, object.block_version.high >>> 0).toNumber(true); - if (object.p2p_version != null) - if ($util.Long) - (message.p2p_version = $util.Long.fromValue(object.p2p_version)).unsigned = true; - else if (typeof object.p2p_version === "string") - message.p2p_version = parseInt(object.p2p_version, 10); - else if (typeof object.p2p_version === "number") - message.p2p_version = object.p2p_version; - else if (typeof object.p2p_version === "object") - message.p2p_version = new $util.LongBits(object.p2p_version.low >>> 0, object.p2p_version.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a RequestInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.RequestInfo - * @static - * @param {tendermint.abci.RequestInfo} message RequestInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RequestInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.version = ""; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.block_version = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.block_version = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.p2p_version = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.p2p_version = options.longs === String ? "0" : 0; - } - if (message.version != null && message.hasOwnProperty("version")) - object.version = message.version; - if (message.block_version != null && message.hasOwnProperty("block_version")) - if (typeof message.block_version === "number") - object.block_version = options.longs === String ? String(message.block_version) : message.block_version; - else - object.block_version = options.longs === String ? $util.Long.prototype.toString.call(message.block_version) : options.longs === Number ? new $util.LongBits(message.block_version.low >>> 0, message.block_version.high >>> 0).toNumber(true) : message.block_version; - if (message.p2p_version != null && message.hasOwnProperty("p2p_version")) - if (typeof message.p2p_version === "number") - object.p2p_version = options.longs === String ? String(message.p2p_version) : message.p2p_version; - else - object.p2p_version = options.longs === String ? $util.Long.prototype.toString.call(message.p2p_version) : options.longs === Number ? new $util.LongBits(message.p2p_version.low >>> 0, message.p2p_version.high >>> 0).toNumber(true) : message.p2p_version; - return object; - }; - - /** - * Converts this RequestInfo to JSON. - * @function toJSON - * @memberof tendermint.abci.RequestInfo - * @instance - * @returns {Object.} JSON object - */ - RequestInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return RequestInfo; - })(); - - abci.RequestSetOption = (function() { - - /** - * Properties of a RequestSetOption. - * @memberof tendermint.abci - * @interface IRequestSetOption - * @property {string|null} [key] RequestSetOption key - * @property {string|null} [value] RequestSetOption value - */ - - /** - * Constructs a new RequestSetOption. - * @memberof tendermint.abci - * @classdesc Represents a RequestSetOption. - * @implements IRequestSetOption - * @constructor - * @param {tendermint.abci.IRequestSetOption=} [properties] Properties to set - */ - function RequestSetOption(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * RequestSetOption key. - * @member {string} key - * @memberof tendermint.abci.RequestSetOption - * @instance - */ - RequestSetOption.prototype.key = ""; - - /** - * RequestSetOption value. - * @member {string} value - * @memberof tendermint.abci.RequestSetOption - * @instance - */ - RequestSetOption.prototype.value = ""; - - /** - * Encodes the specified RequestSetOption message. Does not implicitly {@link tendermint.abci.RequestSetOption.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.RequestSetOption - * @static - * @param {tendermint.abci.IRequestSetOption} message RequestSetOption message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RequestSetOption.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); - return writer; - }; - - /** - * Encodes the specified RequestSetOption message, length delimited. Does not implicitly {@link tendermint.abci.RequestSetOption.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.RequestSetOption - * @static - * @param {tendermint.abci.IRequestSetOption} message RequestSetOption message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RequestSetOption.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RequestSetOption message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.RequestSetOption - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.RequestSetOption} RequestSetOption - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RequestSetOption.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.RequestSetOption(); - while (reader.pos < end) { - let 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; - }; - - /** - * Decodes a RequestSetOption message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.RequestSetOption - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.RequestSetOption} RequestSetOption - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RequestSetOption.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RequestSetOption message. - * @function verify - * @memberof tendermint.abci.RequestSetOption - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RequestSetOption.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!$util.isString(message.key)) - return "key: string expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isString(message.value)) - return "value: string expected"; - return null; - }; - - /** - * Creates a RequestSetOption message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.RequestSetOption - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.RequestSetOption} RequestSetOption - */ - RequestSetOption.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.RequestSetOption) - return object; - let message = new $root.tendermint.abci.RequestSetOption(); - if (object.key != null) - message.key = String(object.key); - if (object.value != null) - message.value = String(object.value); - return message; - }; - - /** - * Creates a plain object from a RequestSetOption message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.RequestSetOption - * @static - * @param {tendermint.abci.RequestSetOption} message RequestSetOption - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RequestSetOption.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.key = ""; - object.value = ""; - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = message.key; - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - return object; - }; - - /** - * Converts this RequestSetOption to JSON. - * @function toJSON - * @memberof tendermint.abci.RequestSetOption - * @instance - * @returns {Object.} JSON object - */ - RequestSetOption.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return RequestSetOption; - })(); - - abci.RequestInitChain = (function() { - - /** - * Properties of a RequestInitChain. - * @memberof tendermint.abci - * @interface IRequestInitChain - * @property {google.protobuf.ITimestamp|null} [time] RequestInitChain time - * @property {string|null} [chain_id] RequestInitChain chain_id - * @property {tendermint.abci.IConsensusParams|null} [consensus_params] RequestInitChain consensus_params - * @property {Array.|null} [validators] RequestInitChain validators - * @property {Uint8Array|null} [app_state_bytes] RequestInitChain app_state_bytes - * @property {Long|null} [initial_height] RequestInitChain initial_height - */ - - /** - * Constructs a new RequestInitChain. - * @memberof tendermint.abci - * @classdesc Represents a RequestInitChain. - * @implements IRequestInitChain - * @constructor - * @param {tendermint.abci.IRequestInitChain=} [properties] Properties to set - */ - function RequestInitChain(properties) { - this.validators = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * RequestInitChain time. - * @member {google.protobuf.ITimestamp|null|undefined} time - * @memberof tendermint.abci.RequestInitChain - * @instance - */ - RequestInitChain.prototype.time = null; - - /** - * RequestInitChain chain_id. - * @member {string} chain_id - * @memberof tendermint.abci.RequestInitChain - * @instance - */ - RequestInitChain.prototype.chain_id = ""; - - /** - * RequestInitChain consensus_params. - * @member {tendermint.abci.IConsensusParams|null|undefined} consensus_params - * @memberof tendermint.abci.RequestInitChain - * @instance - */ - RequestInitChain.prototype.consensus_params = null; - - /** - * RequestInitChain validators. - * @member {Array.} validators - * @memberof tendermint.abci.RequestInitChain - * @instance - */ - RequestInitChain.prototype.validators = $util.emptyArray; - - /** - * RequestInitChain app_state_bytes. - * @member {Uint8Array} app_state_bytes - * @memberof tendermint.abci.RequestInitChain - * @instance - */ - RequestInitChain.prototype.app_state_bytes = $util.newBuffer([]); - - /** - * RequestInitChain initial_height. - * @member {Long} initial_height - * @memberof tendermint.abci.RequestInitChain - * @instance - */ - RequestInitChain.prototype.initial_height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Encodes the specified RequestInitChain message. Does not implicitly {@link tendermint.abci.RequestInitChain.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.RequestInitChain - * @static - * @param {tendermint.abci.IRequestInitChain} message RequestInitChain message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RequestInitChain.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.time != null && Object.hasOwnProperty.call(message, "time")) - $root.google.protobuf.Timestamp.encode(message.time, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.chain_id != null && Object.hasOwnProperty.call(message, "chain_id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.chain_id); - if (message.consensus_params != null && Object.hasOwnProperty.call(message, "consensus_params")) - $root.tendermint.abci.ConsensusParams.encode(message.consensus_params, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.validators != null && message.validators.length) - for (let i = 0; i < message.validators.length; ++i) - $root.tendermint.abci.ValidatorUpdate.encode(message.validators[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.app_state_bytes != null && Object.hasOwnProperty.call(message, "app_state_bytes")) - writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.app_state_bytes); - if (message.initial_height != null && Object.hasOwnProperty.call(message, "initial_height")) - writer.uint32(/* id 6, wireType 0 =*/48).int64(message.initial_height); - return writer; - }; - - /** - * Encodes the specified RequestInitChain message, length delimited. Does not implicitly {@link tendermint.abci.RequestInitChain.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.RequestInitChain - * @static - * @param {tendermint.abci.IRequestInitChain} message RequestInitChain message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RequestInitChain.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RequestInitChain message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.RequestInitChain - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.RequestInitChain} RequestInitChain - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RequestInitChain.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.RequestInitChain(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 2: - message.chain_id = reader.string(); - break; - case 3: - message.consensus_params = $root.tendermint.abci.ConsensusParams.decode(reader, reader.uint32()); - break; - case 4: - if (!(message.validators && message.validators.length)) - message.validators = []; - message.validators.push($root.tendermint.abci.ValidatorUpdate.decode(reader, reader.uint32())); - break; - case 5: - message.app_state_bytes = reader.bytes(); - break; - case 6: - message.initial_height = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RequestInitChain message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.RequestInitChain - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.RequestInitChain} RequestInitChain - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RequestInitChain.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RequestInitChain message. - * @function verify - * @memberof tendermint.abci.RequestInitChain - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RequestInitChain.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.time != null && message.hasOwnProperty("time")) { - let error = $root.google.protobuf.Timestamp.verify(message.time); - if (error) - return "time." + error; - } - if (message.chain_id != null && message.hasOwnProperty("chain_id")) - if (!$util.isString(message.chain_id)) - return "chain_id: string expected"; - if (message.consensus_params != null && message.hasOwnProperty("consensus_params")) { - let error = $root.tendermint.abci.ConsensusParams.verify(message.consensus_params); - if (error) - return "consensus_params." + error; - } - if (message.validators != null && message.hasOwnProperty("validators")) { - if (!Array.isArray(message.validators)) - return "validators: array expected"; - for (let i = 0; i < message.validators.length; ++i) { - let error = $root.tendermint.abci.ValidatorUpdate.verify(message.validators[i]); - if (error) - return "validators." + error; - } - } - if (message.app_state_bytes != null && message.hasOwnProperty("app_state_bytes")) - if (!(message.app_state_bytes && typeof message.app_state_bytes.length === "number" || $util.isString(message.app_state_bytes))) - return "app_state_bytes: buffer expected"; - if (message.initial_height != null && message.hasOwnProperty("initial_height")) - if (!$util.isInteger(message.initial_height) && !(message.initial_height && $util.isInteger(message.initial_height.low) && $util.isInteger(message.initial_height.high))) - return "initial_height: integer|Long expected"; - return null; - }; - - /** - * Creates a RequestInitChain message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.RequestInitChain - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.RequestInitChain} RequestInitChain - */ - RequestInitChain.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.RequestInitChain) - return object; - let message = new $root.tendermint.abci.RequestInitChain(); - if (object.time != null) { - if (typeof object.time !== "object") - throw TypeError(".tendermint.abci.RequestInitChain.time: object expected"); - message.time = $root.google.protobuf.Timestamp.fromObject(object.time); - } - if (object.chain_id != null) - message.chain_id = String(object.chain_id); - if (object.consensus_params != null) { - if (typeof object.consensus_params !== "object") - throw TypeError(".tendermint.abci.RequestInitChain.consensus_params: object expected"); - message.consensus_params = $root.tendermint.abci.ConsensusParams.fromObject(object.consensus_params); - } - if (object.validators) { - if (!Array.isArray(object.validators)) - throw TypeError(".tendermint.abci.RequestInitChain.validators: array expected"); - message.validators = []; - for (let i = 0; i < object.validators.length; ++i) { - if (typeof object.validators[i] !== "object") - throw TypeError(".tendermint.abci.RequestInitChain.validators: object expected"); - message.validators[i] = $root.tendermint.abci.ValidatorUpdate.fromObject(object.validators[i]); - } - } - if (object.app_state_bytes != null) - if (typeof object.app_state_bytes === "string") - $util.base64.decode(object.app_state_bytes, message.app_state_bytes = $util.newBuffer($util.base64.length(object.app_state_bytes)), 0); - else if (object.app_state_bytes.length) - message.app_state_bytes = object.app_state_bytes; - if (object.initial_height != null) - if ($util.Long) - (message.initial_height = $util.Long.fromValue(object.initial_height)).unsigned = false; - else if (typeof object.initial_height === "string") - message.initial_height = parseInt(object.initial_height, 10); - else if (typeof object.initial_height === "number") - message.initial_height = object.initial_height; - else if (typeof object.initial_height === "object") - message.initial_height = new $util.LongBits(object.initial_height.low >>> 0, object.initial_height.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a RequestInitChain message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.RequestInitChain - * @static - * @param {tendermint.abci.RequestInitChain} message RequestInitChain - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RequestInitChain.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.validators = []; - if (options.defaults) { - object.time = null; - object.chain_id = ""; - object.consensus_params = null; - if (options.bytes === String) - object.app_state_bytes = ""; - else { - object.app_state_bytes = []; - if (options.bytes !== Array) - object.app_state_bytes = $util.newBuffer(object.app_state_bytes); - } - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.initial_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.initial_height = options.longs === String ? "0" : 0; - } - if (message.time != null && message.hasOwnProperty("time")) - object.time = $root.google.protobuf.Timestamp.toObject(message.time, options); - if (message.chain_id != null && message.hasOwnProperty("chain_id")) - object.chain_id = message.chain_id; - if (message.consensus_params != null && message.hasOwnProperty("consensus_params")) - object.consensus_params = $root.tendermint.abci.ConsensusParams.toObject(message.consensus_params, options); - if (message.validators && message.validators.length) { - object.validators = []; - for (let j = 0; j < message.validators.length; ++j) - object.validators[j] = $root.tendermint.abci.ValidatorUpdate.toObject(message.validators[j], options); - } - if (message.app_state_bytes != null && message.hasOwnProperty("app_state_bytes")) - object.app_state_bytes = options.bytes === String ? $util.base64.encode(message.app_state_bytes, 0, message.app_state_bytes.length) : options.bytes === Array ? Array.prototype.slice.call(message.app_state_bytes) : message.app_state_bytes; - if (message.initial_height != null && message.hasOwnProperty("initial_height")) - if (typeof message.initial_height === "number") - object.initial_height = options.longs === String ? String(message.initial_height) : message.initial_height; - else - object.initial_height = options.longs === String ? $util.Long.prototype.toString.call(message.initial_height) : options.longs === Number ? new $util.LongBits(message.initial_height.low >>> 0, message.initial_height.high >>> 0).toNumber() : message.initial_height; - return object; - }; - - /** - * Converts this RequestInitChain to JSON. - * @function toJSON - * @memberof tendermint.abci.RequestInitChain - * @instance - * @returns {Object.} JSON object - */ - RequestInitChain.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return RequestInitChain; - })(); - - abci.RequestQuery = (function() { - - /** - * Properties of a RequestQuery. - * @memberof tendermint.abci - * @interface IRequestQuery - * @property {Uint8Array|null} [data] RequestQuery data - * @property {string|null} [path] RequestQuery path - * @property {Long|null} [height] RequestQuery height - * @property {boolean|null} [prove] RequestQuery prove - */ - - /** - * Constructs a new RequestQuery. - * @memberof tendermint.abci - * @classdesc Represents a RequestQuery. - * @implements IRequestQuery - * @constructor - * @param {tendermint.abci.IRequestQuery=} [properties] Properties to set - */ - function RequestQuery(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * RequestQuery data. - * @member {Uint8Array} data - * @memberof tendermint.abci.RequestQuery - * @instance - */ - RequestQuery.prototype.data = $util.newBuffer([]); - - /** - * RequestQuery path. - * @member {string} path - * @memberof tendermint.abci.RequestQuery - * @instance - */ - RequestQuery.prototype.path = ""; - - /** - * RequestQuery height. - * @member {Long} height - * @memberof tendermint.abci.RequestQuery - * @instance - */ - RequestQuery.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * RequestQuery prove. - * @member {boolean} prove - * @memberof tendermint.abci.RequestQuery - * @instance - */ - RequestQuery.prototype.prove = false; - - /** - * Encodes the specified RequestQuery message. Does not implicitly {@link tendermint.abci.RequestQuery.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.RequestQuery - * @static - * @param {tendermint.abci.IRequestQuery} message RequestQuery message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RequestQuery.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.data != null && Object.hasOwnProperty.call(message, "data")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.data); - if (message.path != null && Object.hasOwnProperty.call(message, "path")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.height); - if (message.prove != null && Object.hasOwnProperty.call(message, "prove")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.prove); - return writer; - }; - - /** - * Encodes the specified RequestQuery message, length delimited. Does not implicitly {@link tendermint.abci.RequestQuery.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.RequestQuery - * @static - * @param {tendermint.abci.IRequestQuery} message RequestQuery message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RequestQuery.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RequestQuery message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.RequestQuery - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.RequestQuery} RequestQuery - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RequestQuery.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.RequestQuery(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.data = reader.bytes(); - break; - case 2: - message.path = reader.string(); - break; - case 3: - message.height = reader.int64(); - break; - case 4: - message.prove = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RequestQuery message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.RequestQuery - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.RequestQuery} RequestQuery - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RequestQuery.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RequestQuery message. - * @function verify - * @memberof tendermint.abci.RequestQuery - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RequestQuery.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.data != null && message.hasOwnProperty("data")) - if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) - return "data: buffer expected"; - if (message.path != null && message.hasOwnProperty("path")) - if (!$util.isString(message.path)) - return "path: string expected"; - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) - return "height: integer|Long expected"; - if (message.prove != null && message.hasOwnProperty("prove")) - if (typeof message.prove !== "boolean") - return "prove: boolean expected"; - return null; - }; - - /** - * Creates a RequestQuery message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.RequestQuery - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.RequestQuery} RequestQuery - */ - RequestQuery.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.RequestQuery) - return object; - let message = new $root.tendermint.abci.RequestQuery(); - if (object.data != null) - if (typeof object.data === "string") - $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); - else if (object.data.length) - message.data = object.data; - if (object.path != null) - message.path = String(object.path); - if (object.height != null) - if ($util.Long) - (message.height = $util.Long.fromValue(object.height)).unsigned = false; - else if (typeof object.height === "string") - message.height = parseInt(object.height, 10); - else if (typeof object.height === "number") - message.height = object.height; - else if (typeof object.height === "object") - message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); - if (object.prove != null) - message.prove = Boolean(object.prove); - return message; - }; - - /** - * Creates a plain object from a RequestQuery message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.RequestQuery - * @static - * @param {tendermint.abci.RequestQuery} message RequestQuery - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RequestQuery.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if (options.bytes === String) - object.data = ""; - else { - object.data = []; - if (options.bytes !== Array) - object.data = $util.newBuffer(object.data); - } - object.path = ""; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.height = options.longs === String ? "0" : 0; - object.prove = false; - } - if (message.data != null && message.hasOwnProperty("data")) - object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; - if (message.path != null && message.hasOwnProperty("path")) - object.path = message.path; - if (message.height != null && message.hasOwnProperty("height")) - if (typeof message.height === "number") - object.height = options.longs === String ? String(message.height) : message.height; - else - object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; - if (message.prove != null && message.hasOwnProperty("prove")) - object.prove = message.prove; - return object; - }; - - /** - * Converts this RequestQuery to JSON. - * @function toJSON - * @memberof tendermint.abci.RequestQuery - * @instance - * @returns {Object.} JSON object - */ - RequestQuery.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return RequestQuery; - })(); - - abci.RequestBeginBlock = (function() { - - /** - * Properties of a RequestBeginBlock. - * @memberof tendermint.abci - * @interface IRequestBeginBlock - * @property {Uint8Array|null} [hash] RequestBeginBlock hash - * @property {tendermint.types.IHeader|null} [header] RequestBeginBlock header - * @property {tendermint.abci.ILastCommitInfo|null} [last_commit_info] RequestBeginBlock last_commit_info - * @property {Array.|null} [byzantine_validators] RequestBeginBlock byzantine_validators - */ - - /** - * Constructs a new RequestBeginBlock. - * @memberof tendermint.abci - * @classdesc Represents a RequestBeginBlock. - * @implements IRequestBeginBlock - * @constructor - * @param {tendermint.abci.IRequestBeginBlock=} [properties] Properties to set - */ - function RequestBeginBlock(properties) { - this.byzantine_validators = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * RequestBeginBlock hash. - * @member {Uint8Array} hash - * @memberof tendermint.abci.RequestBeginBlock - * @instance - */ - RequestBeginBlock.prototype.hash = $util.newBuffer([]); - - /** - * RequestBeginBlock header. - * @member {tendermint.types.IHeader|null|undefined} header - * @memberof tendermint.abci.RequestBeginBlock - * @instance - */ - RequestBeginBlock.prototype.header = null; - - /** - * RequestBeginBlock last_commit_info. - * @member {tendermint.abci.ILastCommitInfo|null|undefined} last_commit_info - * @memberof tendermint.abci.RequestBeginBlock - * @instance - */ - RequestBeginBlock.prototype.last_commit_info = null; - - /** - * RequestBeginBlock byzantine_validators. - * @member {Array.} byzantine_validators - * @memberof tendermint.abci.RequestBeginBlock - * @instance - */ - RequestBeginBlock.prototype.byzantine_validators = $util.emptyArray; - - /** - * Encodes the specified RequestBeginBlock message. Does not implicitly {@link tendermint.abci.RequestBeginBlock.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.RequestBeginBlock - * @static - * @param {tendermint.abci.IRequestBeginBlock} message RequestBeginBlock message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RequestBeginBlock.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.hash != null && Object.hasOwnProperty.call(message, "hash")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.hash); - if (message.header != null && Object.hasOwnProperty.call(message, "header")) - $root.tendermint.types.Header.encode(message.header, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.last_commit_info != null && Object.hasOwnProperty.call(message, "last_commit_info")) - $root.tendermint.abci.LastCommitInfo.encode(message.last_commit_info, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.byzantine_validators != null && message.byzantine_validators.length) - for (let i = 0; i < message.byzantine_validators.length; ++i) - $root.tendermint.abci.Evidence.encode(message.byzantine_validators[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified RequestBeginBlock message, length delimited. Does not implicitly {@link tendermint.abci.RequestBeginBlock.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.RequestBeginBlock - * @static - * @param {tendermint.abci.IRequestBeginBlock} message RequestBeginBlock message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RequestBeginBlock.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RequestBeginBlock message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.RequestBeginBlock - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.RequestBeginBlock} RequestBeginBlock - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RequestBeginBlock.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.RequestBeginBlock(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.hash = reader.bytes(); - break; - case 2: - message.header = $root.tendermint.types.Header.decode(reader, reader.uint32()); - break; - case 3: - message.last_commit_info = $root.tendermint.abci.LastCommitInfo.decode(reader, reader.uint32()); - break; - case 4: - if (!(message.byzantine_validators && message.byzantine_validators.length)) - message.byzantine_validators = []; - message.byzantine_validators.push($root.tendermint.abci.Evidence.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RequestBeginBlock message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.RequestBeginBlock - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.RequestBeginBlock} RequestBeginBlock - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RequestBeginBlock.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RequestBeginBlock message. - * @function verify - * @memberof tendermint.abci.RequestBeginBlock - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RequestBeginBlock.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.hash != null && message.hasOwnProperty("hash")) - if (!(message.hash && typeof message.hash.length === "number" || $util.isString(message.hash))) - return "hash: buffer expected"; - if (message.header != null && message.hasOwnProperty("header")) { - let error = $root.tendermint.types.Header.verify(message.header); - if (error) - return "header." + error; - } - if (message.last_commit_info != null && message.hasOwnProperty("last_commit_info")) { - let error = $root.tendermint.abci.LastCommitInfo.verify(message.last_commit_info); - if (error) - return "last_commit_info." + error; - } - if (message.byzantine_validators != null && message.hasOwnProperty("byzantine_validators")) { - if (!Array.isArray(message.byzantine_validators)) - return "byzantine_validators: array expected"; - for (let i = 0; i < message.byzantine_validators.length; ++i) { - let error = $root.tendermint.abci.Evidence.verify(message.byzantine_validators[i]); - if (error) - return "byzantine_validators." + error; - } - } - return null; - }; - - /** - * Creates a RequestBeginBlock message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.RequestBeginBlock - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.RequestBeginBlock} RequestBeginBlock - */ - RequestBeginBlock.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.RequestBeginBlock) - return object; - let message = new $root.tendermint.abci.RequestBeginBlock(); - if (object.hash != null) - if (typeof object.hash === "string") - $util.base64.decode(object.hash, message.hash = $util.newBuffer($util.base64.length(object.hash)), 0); - else if (object.hash.length) - message.hash = object.hash; - if (object.header != null) { - if (typeof object.header !== "object") - throw TypeError(".tendermint.abci.RequestBeginBlock.header: object expected"); - message.header = $root.tendermint.types.Header.fromObject(object.header); - } - if (object.last_commit_info != null) { - if (typeof object.last_commit_info !== "object") - throw TypeError(".tendermint.abci.RequestBeginBlock.last_commit_info: object expected"); - message.last_commit_info = $root.tendermint.abci.LastCommitInfo.fromObject(object.last_commit_info); - } - if (object.byzantine_validators) { - if (!Array.isArray(object.byzantine_validators)) - throw TypeError(".tendermint.abci.RequestBeginBlock.byzantine_validators: array expected"); - message.byzantine_validators = []; - for (let i = 0; i < object.byzantine_validators.length; ++i) { - if (typeof object.byzantine_validators[i] !== "object") - throw TypeError(".tendermint.abci.RequestBeginBlock.byzantine_validators: object expected"); - message.byzantine_validators[i] = $root.tendermint.abci.Evidence.fromObject(object.byzantine_validators[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a RequestBeginBlock message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.RequestBeginBlock - * @static - * @param {tendermint.abci.RequestBeginBlock} message RequestBeginBlock - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RequestBeginBlock.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.byzantine_validators = []; - if (options.defaults) { - if (options.bytes === String) - object.hash = ""; - else { - object.hash = []; - if (options.bytes !== Array) - object.hash = $util.newBuffer(object.hash); - } - object.header = null; - object.last_commit_info = null; - } - if (message.hash != null && message.hasOwnProperty("hash")) - object.hash = options.bytes === String ? $util.base64.encode(message.hash, 0, message.hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.hash) : message.hash; - if (message.header != null && message.hasOwnProperty("header")) - object.header = $root.tendermint.types.Header.toObject(message.header, options); - if (message.last_commit_info != null && message.hasOwnProperty("last_commit_info")) - object.last_commit_info = $root.tendermint.abci.LastCommitInfo.toObject(message.last_commit_info, options); - if (message.byzantine_validators && message.byzantine_validators.length) { - object.byzantine_validators = []; - for (let j = 0; j < message.byzantine_validators.length; ++j) - object.byzantine_validators[j] = $root.tendermint.abci.Evidence.toObject(message.byzantine_validators[j], options); - } - return object; - }; - - /** - * Converts this RequestBeginBlock to JSON. - * @function toJSON - * @memberof tendermint.abci.RequestBeginBlock - * @instance - * @returns {Object.} JSON object - */ - RequestBeginBlock.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return RequestBeginBlock; - })(); - - /** - * CheckTxType enum. - * @name tendermint.abci.CheckTxType - * @enum {number} - * @property {number} NEW=0 NEW value - * @property {number} RECHECK=1 RECHECK value - */ - abci.CheckTxType = (function() { - const valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "NEW"] = 0; - values[valuesById[1] = "RECHECK"] = 1; - return values; - })(); - - abci.RequestCheckTx = (function() { - - /** - * Properties of a RequestCheckTx. - * @memberof tendermint.abci - * @interface IRequestCheckTx - * @property {Uint8Array|null} [tx] RequestCheckTx tx - * @property {tendermint.abci.CheckTxType|null} [type] RequestCheckTx type - */ - - /** - * Constructs a new RequestCheckTx. - * @memberof tendermint.abci - * @classdesc Represents a RequestCheckTx. - * @implements IRequestCheckTx - * @constructor - * @param {tendermint.abci.IRequestCheckTx=} [properties] Properties to set - */ - function RequestCheckTx(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * RequestCheckTx tx. - * @member {Uint8Array} tx - * @memberof tendermint.abci.RequestCheckTx - * @instance - */ - RequestCheckTx.prototype.tx = $util.newBuffer([]); - - /** - * RequestCheckTx type. - * @member {tendermint.abci.CheckTxType} type - * @memberof tendermint.abci.RequestCheckTx - * @instance - */ - RequestCheckTx.prototype.type = 0; - - /** - * Encodes the specified RequestCheckTx message. Does not implicitly {@link tendermint.abci.RequestCheckTx.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.RequestCheckTx - * @static - * @param {tendermint.abci.IRequestCheckTx} message RequestCheckTx message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RequestCheckTx.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.tx != null && Object.hasOwnProperty.call(message, "tx")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.tx); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.type); - return writer; - }; - - /** - * Encodes the specified RequestCheckTx message, length delimited. Does not implicitly {@link tendermint.abci.RequestCheckTx.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.RequestCheckTx - * @static - * @param {tendermint.abci.IRequestCheckTx} message RequestCheckTx message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RequestCheckTx.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RequestCheckTx message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.RequestCheckTx - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.RequestCheckTx} RequestCheckTx - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RequestCheckTx.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.RequestCheckTx(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.tx = reader.bytes(); - break; - case 2: - message.type = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RequestCheckTx message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.RequestCheckTx - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.RequestCheckTx} RequestCheckTx - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RequestCheckTx.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RequestCheckTx message. - * @function verify - * @memberof tendermint.abci.RequestCheckTx - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RequestCheckTx.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.tx != null && message.hasOwnProperty("tx")) - if (!(message.tx && typeof message.tx.length === "number" || $util.isString(message.tx))) - return "tx: buffer expected"; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - break; - } - return null; - }; - - /** - * Creates a RequestCheckTx message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.RequestCheckTx - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.RequestCheckTx} RequestCheckTx - */ - RequestCheckTx.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.RequestCheckTx) - return object; - let message = new $root.tendermint.abci.RequestCheckTx(); - if (object.tx != null) - if (typeof object.tx === "string") - $util.base64.decode(object.tx, message.tx = $util.newBuffer($util.base64.length(object.tx)), 0); - else if (object.tx.length) - message.tx = object.tx; - switch (object.type) { - case "NEW": - case 0: - message.type = 0; - break; - case "RECHECK": - case 1: - message.type = 1; - break; - } - return message; - }; - - /** - * Creates a plain object from a RequestCheckTx message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.RequestCheckTx - * @static - * @param {tendermint.abci.RequestCheckTx} message RequestCheckTx - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RequestCheckTx.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if (options.bytes === String) - object.tx = ""; - else { - object.tx = []; - if (options.bytes !== Array) - object.tx = $util.newBuffer(object.tx); - } - object.type = options.enums === String ? "NEW" : 0; - } - if (message.tx != null && message.hasOwnProperty("tx")) - object.tx = options.bytes === String ? $util.base64.encode(message.tx, 0, message.tx.length) : options.bytes === Array ? Array.prototype.slice.call(message.tx) : message.tx; - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.tendermint.abci.CheckTxType[message.type] : message.type; - return object; - }; - - /** - * Converts this RequestCheckTx to JSON. - * @function toJSON - * @memberof tendermint.abci.RequestCheckTx - * @instance - * @returns {Object.} JSON object - */ - RequestCheckTx.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return RequestCheckTx; - })(); - - abci.RequestDeliverTx = (function() { - - /** - * Properties of a RequestDeliverTx. - * @memberof tendermint.abci - * @interface IRequestDeliverTx - * @property {Uint8Array|null} [tx] RequestDeliverTx tx - */ - - /** - * Constructs a new RequestDeliverTx. - * @memberof tendermint.abci - * @classdesc Represents a RequestDeliverTx. - * @implements IRequestDeliverTx - * @constructor - * @param {tendermint.abci.IRequestDeliverTx=} [properties] Properties to set - */ - function RequestDeliverTx(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * RequestDeliverTx tx. - * @member {Uint8Array} tx - * @memberof tendermint.abci.RequestDeliverTx - * @instance - */ - RequestDeliverTx.prototype.tx = $util.newBuffer([]); - - /** - * Encodes the specified RequestDeliverTx message. Does not implicitly {@link tendermint.abci.RequestDeliverTx.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.RequestDeliverTx - * @static - * @param {tendermint.abci.IRequestDeliverTx} message RequestDeliverTx message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RequestDeliverTx.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.tx != null && Object.hasOwnProperty.call(message, "tx")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.tx); - return writer; - }; - - /** - * Encodes the specified RequestDeliverTx message, length delimited. Does not implicitly {@link tendermint.abci.RequestDeliverTx.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.RequestDeliverTx - * @static - * @param {tendermint.abci.IRequestDeliverTx} message RequestDeliverTx message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RequestDeliverTx.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RequestDeliverTx message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.RequestDeliverTx - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.RequestDeliverTx} RequestDeliverTx - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RequestDeliverTx.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.RequestDeliverTx(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.tx = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RequestDeliverTx message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.RequestDeliverTx - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.RequestDeliverTx} RequestDeliverTx - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RequestDeliverTx.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RequestDeliverTx message. - * @function verify - * @memberof tendermint.abci.RequestDeliverTx - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RequestDeliverTx.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.tx != null && message.hasOwnProperty("tx")) - if (!(message.tx && typeof message.tx.length === "number" || $util.isString(message.tx))) - return "tx: buffer expected"; - return null; - }; - - /** - * Creates a RequestDeliverTx message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.RequestDeliverTx - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.RequestDeliverTx} RequestDeliverTx - */ - RequestDeliverTx.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.RequestDeliverTx) - return object; - let message = new $root.tendermint.abci.RequestDeliverTx(); - if (object.tx != null) - if (typeof object.tx === "string") - $util.base64.decode(object.tx, message.tx = $util.newBuffer($util.base64.length(object.tx)), 0); - else if (object.tx.length) - message.tx = object.tx; - return message; - }; - - /** - * Creates a plain object from a RequestDeliverTx message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.RequestDeliverTx - * @static - * @param {tendermint.abci.RequestDeliverTx} message RequestDeliverTx - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RequestDeliverTx.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - if (options.bytes === String) - object.tx = ""; - else { - object.tx = []; - if (options.bytes !== Array) - object.tx = $util.newBuffer(object.tx); - } - if (message.tx != null && message.hasOwnProperty("tx")) - object.tx = options.bytes === String ? $util.base64.encode(message.tx, 0, message.tx.length) : options.bytes === Array ? Array.prototype.slice.call(message.tx) : message.tx; - return object; - }; - - /** - * Converts this RequestDeliverTx to JSON. - * @function toJSON - * @memberof tendermint.abci.RequestDeliverTx - * @instance - * @returns {Object.} JSON object - */ - RequestDeliverTx.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return RequestDeliverTx; - })(); - - abci.RequestEndBlock = (function() { - - /** - * Properties of a RequestEndBlock. - * @memberof tendermint.abci - * @interface IRequestEndBlock - * @property {Long|null} [height] RequestEndBlock height - */ - - /** - * Constructs a new RequestEndBlock. - * @memberof tendermint.abci - * @classdesc Represents a RequestEndBlock. - * @implements IRequestEndBlock - * @constructor - * @param {tendermint.abci.IRequestEndBlock=} [properties] Properties to set - */ - function RequestEndBlock(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * RequestEndBlock height. - * @member {Long} height - * @memberof tendermint.abci.RequestEndBlock - * @instance - */ - RequestEndBlock.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Encodes the specified RequestEndBlock message. Does not implicitly {@link tendermint.abci.RequestEndBlock.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.RequestEndBlock - * @static - * @param {tendermint.abci.IRequestEndBlock} message RequestEndBlock message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RequestEndBlock.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.height); - return writer; - }; - - /** - * Encodes the specified RequestEndBlock message, length delimited. Does not implicitly {@link tendermint.abci.RequestEndBlock.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.RequestEndBlock - * @static - * @param {tendermint.abci.IRequestEndBlock} message RequestEndBlock message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RequestEndBlock.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RequestEndBlock message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.RequestEndBlock - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.RequestEndBlock} RequestEndBlock - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RequestEndBlock.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.RequestEndBlock(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.height = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RequestEndBlock message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.RequestEndBlock - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.RequestEndBlock} RequestEndBlock - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RequestEndBlock.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RequestEndBlock message. - * @function verify - * @memberof tendermint.abci.RequestEndBlock - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RequestEndBlock.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) - return "height: integer|Long expected"; - return null; - }; - - /** - * Creates a RequestEndBlock message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.RequestEndBlock - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.RequestEndBlock} RequestEndBlock - */ - RequestEndBlock.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.RequestEndBlock) - return object; - let message = new $root.tendermint.abci.RequestEndBlock(); - if (object.height != null) - if ($util.Long) - (message.height = $util.Long.fromValue(object.height)).unsigned = false; - else if (typeof object.height === "string") - message.height = parseInt(object.height, 10); - else if (typeof object.height === "number") - message.height = object.height; - else if (typeof object.height === "object") - message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a RequestEndBlock message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.RequestEndBlock - * @static - * @param {tendermint.abci.RequestEndBlock} message RequestEndBlock - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RequestEndBlock.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.height = options.longs === String ? "0" : 0; - if (message.height != null && message.hasOwnProperty("height")) - if (typeof message.height === "number") - object.height = options.longs === String ? String(message.height) : message.height; - else - object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; - return object; - }; - - /** - * Converts this RequestEndBlock to JSON. - * @function toJSON - * @memberof tendermint.abci.RequestEndBlock - * @instance - * @returns {Object.} JSON object - */ - RequestEndBlock.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return RequestEndBlock; - })(); - - abci.RequestCommit = (function() { - - /** - * Properties of a RequestCommit. - * @memberof tendermint.abci - * @interface IRequestCommit - */ - - /** - * Constructs a new RequestCommit. - * @memberof tendermint.abci - * @classdesc Represents a RequestCommit. - * @implements IRequestCommit - * @constructor - * @param {tendermint.abci.IRequestCommit=} [properties] Properties to set - */ - function RequestCommit(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified RequestCommit message. Does not implicitly {@link tendermint.abci.RequestCommit.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.RequestCommit - * @static - * @param {tendermint.abci.IRequestCommit} message RequestCommit message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RequestCommit.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified RequestCommit message, length delimited. Does not implicitly {@link tendermint.abci.RequestCommit.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.RequestCommit - * @static - * @param {tendermint.abci.IRequestCommit} message RequestCommit message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RequestCommit.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RequestCommit message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.RequestCommit - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.RequestCommit} RequestCommit - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RequestCommit.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.RequestCommit(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RequestCommit message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.RequestCommit - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.RequestCommit} RequestCommit - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RequestCommit.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RequestCommit message. - * @function verify - * @memberof tendermint.abci.RequestCommit - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RequestCommit.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a RequestCommit message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.RequestCommit - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.RequestCommit} RequestCommit - */ - RequestCommit.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.RequestCommit) - return object; - return new $root.tendermint.abci.RequestCommit(); - }; - - /** - * Creates a plain object from a RequestCommit message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.RequestCommit - * @static - * @param {tendermint.abci.RequestCommit} message RequestCommit - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RequestCommit.toObject = function toObject() { - return {}; - }; - - /** - * Converts this RequestCommit to JSON. - * @function toJSON - * @memberof tendermint.abci.RequestCommit - * @instance - * @returns {Object.} JSON object - */ - RequestCommit.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return RequestCommit; - })(); - - abci.RequestListSnapshots = (function() { - - /** - * Properties of a RequestListSnapshots. - * @memberof tendermint.abci - * @interface IRequestListSnapshots - */ - - /** - * Constructs a new RequestListSnapshots. - * @memberof tendermint.abci - * @classdesc Represents a RequestListSnapshots. - * @implements IRequestListSnapshots - * @constructor - * @param {tendermint.abci.IRequestListSnapshots=} [properties] Properties to set - */ - function RequestListSnapshots(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified RequestListSnapshots message. Does not implicitly {@link tendermint.abci.RequestListSnapshots.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.RequestListSnapshots - * @static - * @param {tendermint.abci.IRequestListSnapshots} message RequestListSnapshots message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RequestListSnapshots.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified RequestListSnapshots message, length delimited. Does not implicitly {@link tendermint.abci.RequestListSnapshots.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.RequestListSnapshots - * @static - * @param {tendermint.abci.IRequestListSnapshots} message RequestListSnapshots message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RequestListSnapshots.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RequestListSnapshots message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.RequestListSnapshots - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.RequestListSnapshots} RequestListSnapshots - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RequestListSnapshots.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.RequestListSnapshots(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RequestListSnapshots message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.RequestListSnapshots - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.RequestListSnapshots} RequestListSnapshots - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RequestListSnapshots.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RequestListSnapshots message. - * @function verify - * @memberof tendermint.abci.RequestListSnapshots - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RequestListSnapshots.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a RequestListSnapshots message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.RequestListSnapshots - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.RequestListSnapshots} RequestListSnapshots - */ - RequestListSnapshots.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.RequestListSnapshots) - return object; - return new $root.tendermint.abci.RequestListSnapshots(); - }; - - /** - * Creates a plain object from a RequestListSnapshots message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.RequestListSnapshots - * @static - * @param {tendermint.abci.RequestListSnapshots} message RequestListSnapshots - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RequestListSnapshots.toObject = function toObject() { - return {}; - }; - - /** - * Converts this RequestListSnapshots to JSON. - * @function toJSON - * @memberof tendermint.abci.RequestListSnapshots - * @instance - * @returns {Object.} JSON object - */ - RequestListSnapshots.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return RequestListSnapshots; - })(); - - abci.RequestOfferSnapshot = (function() { - - /** - * Properties of a RequestOfferSnapshot. - * @memberof tendermint.abci - * @interface IRequestOfferSnapshot - * @property {tendermint.abci.ISnapshot|null} [snapshot] RequestOfferSnapshot snapshot - * @property {Uint8Array|null} [app_hash] RequestOfferSnapshot app_hash - */ - - /** - * Constructs a new RequestOfferSnapshot. - * @memberof tendermint.abci - * @classdesc Represents a RequestOfferSnapshot. - * @implements IRequestOfferSnapshot - * @constructor - * @param {tendermint.abci.IRequestOfferSnapshot=} [properties] Properties to set - */ - function RequestOfferSnapshot(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * RequestOfferSnapshot snapshot. - * @member {tendermint.abci.ISnapshot|null|undefined} snapshot - * @memberof tendermint.abci.RequestOfferSnapshot - * @instance - */ - RequestOfferSnapshot.prototype.snapshot = null; - - /** - * RequestOfferSnapshot app_hash. - * @member {Uint8Array} app_hash - * @memberof tendermint.abci.RequestOfferSnapshot - * @instance - */ - RequestOfferSnapshot.prototype.app_hash = $util.newBuffer([]); - - /** - * Encodes the specified RequestOfferSnapshot message. Does not implicitly {@link tendermint.abci.RequestOfferSnapshot.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.RequestOfferSnapshot - * @static - * @param {tendermint.abci.IRequestOfferSnapshot} message RequestOfferSnapshot message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RequestOfferSnapshot.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.snapshot != null && Object.hasOwnProperty.call(message, "snapshot")) - $root.tendermint.abci.Snapshot.encode(message.snapshot, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.app_hash != null && Object.hasOwnProperty.call(message, "app_hash")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.app_hash); - return writer; - }; - - /** - * Encodes the specified RequestOfferSnapshot message, length delimited. Does not implicitly {@link tendermint.abci.RequestOfferSnapshot.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.RequestOfferSnapshot - * @static - * @param {tendermint.abci.IRequestOfferSnapshot} message RequestOfferSnapshot message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RequestOfferSnapshot.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RequestOfferSnapshot message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.RequestOfferSnapshot - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.RequestOfferSnapshot} RequestOfferSnapshot - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RequestOfferSnapshot.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.RequestOfferSnapshot(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.snapshot = $root.tendermint.abci.Snapshot.decode(reader, reader.uint32()); - break; - case 2: - message.app_hash = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RequestOfferSnapshot message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.RequestOfferSnapshot - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.RequestOfferSnapshot} RequestOfferSnapshot - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RequestOfferSnapshot.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RequestOfferSnapshot message. - * @function verify - * @memberof tendermint.abci.RequestOfferSnapshot - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RequestOfferSnapshot.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.snapshot != null && message.hasOwnProperty("snapshot")) { - let error = $root.tendermint.abci.Snapshot.verify(message.snapshot); - if (error) - return "snapshot." + error; - } - if (message.app_hash != null && message.hasOwnProperty("app_hash")) - if (!(message.app_hash && typeof message.app_hash.length === "number" || $util.isString(message.app_hash))) - return "app_hash: buffer expected"; - return null; - }; - - /** - * Creates a RequestOfferSnapshot message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.RequestOfferSnapshot - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.RequestOfferSnapshot} RequestOfferSnapshot - */ - RequestOfferSnapshot.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.RequestOfferSnapshot) - return object; - let message = new $root.tendermint.abci.RequestOfferSnapshot(); - if (object.snapshot != null) { - if (typeof object.snapshot !== "object") - throw TypeError(".tendermint.abci.RequestOfferSnapshot.snapshot: object expected"); - message.snapshot = $root.tendermint.abci.Snapshot.fromObject(object.snapshot); - } - if (object.app_hash != null) - if (typeof object.app_hash === "string") - $util.base64.decode(object.app_hash, message.app_hash = $util.newBuffer($util.base64.length(object.app_hash)), 0); - else if (object.app_hash.length) - message.app_hash = object.app_hash; - return message; - }; - - /** - * Creates a plain object from a RequestOfferSnapshot message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.RequestOfferSnapshot - * @static - * @param {tendermint.abci.RequestOfferSnapshot} message RequestOfferSnapshot - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RequestOfferSnapshot.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.snapshot = null; - if (options.bytes === String) - object.app_hash = ""; - else { - object.app_hash = []; - if (options.bytes !== Array) - object.app_hash = $util.newBuffer(object.app_hash); - } - } - if (message.snapshot != null && message.hasOwnProperty("snapshot")) - object.snapshot = $root.tendermint.abci.Snapshot.toObject(message.snapshot, options); - if (message.app_hash != null && message.hasOwnProperty("app_hash")) - object.app_hash = options.bytes === String ? $util.base64.encode(message.app_hash, 0, message.app_hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.app_hash) : message.app_hash; - return object; - }; - - /** - * Converts this RequestOfferSnapshot to JSON. - * @function toJSON - * @memberof tendermint.abci.RequestOfferSnapshot - * @instance - * @returns {Object.} JSON object - */ - RequestOfferSnapshot.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return RequestOfferSnapshot; - })(); - - abci.RequestLoadSnapshotChunk = (function() { - - /** - * Properties of a RequestLoadSnapshotChunk. - * @memberof tendermint.abci - * @interface IRequestLoadSnapshotChunk - * @property {Long|null} [height] RequestLoadSnapshotChunk height - * @property {number|null} [format] RequestLoadSnapshotChunk format - * @property {number|null} [chunk] RequestLoadSnapshotChunk chunk - */ - - /** - * Constructs a new RequestLoadSnapshotChunk. - * @memberof tendermint.abci - * @classdesc Represents a RequestLoadSnapshotChunk. - * @implements IRequestLoadSnapshotChunk - * @constructor - * @param {tendermint.abci.IRequestLoadSnapshotChunk=} [properties] Properties to set - */ - function RequestLoadSnapshotChunk(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * RequestLoadSnapshotChunk height. - * @member {Long} height - * @memberof tendermint.abci.RequestLoadSnapshotChunk - * @instance - */ - RequestLoadSnapshotChunk.prototype.height = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * RequestLoadSnapshotChunk format. - * @member {number} format - * @memberof tendermint.abci.RequestLoadSnapshotChunk - * @instance - */ - RequestLoadSnapshotChunk.prototype.format = 0; - - /** - * RequestLoadSnapshotChunk chunk. - * @member {number} chunk - * @memberof tendermint.abci.RequestLoadSnapshotChunk - * @instance - */ - RequestLoadSnapshotChunk.prototype.chunk = 0; - - /** - * Encodes the specified RequestLoadSnapshotChunk message. Does not implicitly {@link tendermint.abci.RequestLoadSnapshotChunk.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.RequestLoadSnapshotChunk - * @static - * @param {tendermint.abci.IRequestLoadSnapshotChunk} message RequestLoadSnapshotChunk message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RequestLoadSnapshotChunk.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.height); - if (message.format != null && Object.hasOwnProperty.call(message, "format")) - writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.format); - if (message.chunk != null && Object.hasOwnProperty.call(message, "chunk")) - writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.chunk); - return writer; - }; - - /** - * Encodes the specified RequestLoadSnapshotChunk message, length delimited. Does not implicitly {@link tendermint.abci.RequestLoadSnapshotChunk.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.RequestLoadSnapshotChunk - * @static - * @param {tendermint.abci.IRequestLoadSnapshotChunk} message RequestLoadSnapshotChunk message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RequestLoadSnapshotChunk.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RequestLoadSnapshotChunk message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.RequestLoadSnapshotChunk - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.RequestLoadSnapshotChunk} RequestLoadSnapshotChunk - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RequestLoadSnapshotChunk.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.RequestLoadSnapshotChunk(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.height = reader.uint64(); - break; - case 2: - message.format = reader.uint32(); - break; - case 3: - message.chunk = reader.uint32(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RequestLoadSnapshotChunk message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.RequestLoadSnapshotChunk - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.RequestLoadSnapshotChunk} RequestLoadSnapshotChunk - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RequestLoadSnapshotChunk.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RequestLoadSnapshotChunk message. - * @function verify - * @memberof tendermint.abci.RequestLoadSnapshotChunk - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RequestLoadSnapshotChunk.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) - return "height: integer|Long expected"; - if (message.format != null && message.hasOwnProperty("format")) - if (!$util.isInteger(message.format)) - return "format: integer expected"; - if (message.chunk != null && message.hasOwnProperty("chunk")) - if (!$util.isInteger(message.chunk)) - return "chunk: integer expected"; - return null; - }; - - /** - * Creates a RequestLoadSnapshotChunk message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.RequestLoadSnapshotChunk - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.RequestLoadSnapshotChunk} RequestLoadSnapshotChunk - */ - RequestLoadSnapshotChunk.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.RequestLoadSnapshotChunk) - return object; - let message = new $root.tendermint.abci.RequestLoadSnapshotChunk(); - if (object.height != null) - if ($util.Long) - (message.height = $util.Long.fromValue(object.height)).unsigned = true; - else if (typeof object.height === "string") - message.height = parseInt(object.height, 10); - else if (typeof object.height === "number") - message.height = object.height; - else if (typeof object.height === "object") - message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(true); - if (object.format != null) - message.format = object.format >>> 0; - if (object.chunk != null) - message.chunk = object.chunk >>> 0; - return message; - }; - - /** - * Creates a plain object from a RequestLoadSnapshotChunk message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.RequestLoadSnapshotChunk - * @static - * @param {tendermint.abci.RequestLoadSnapshotChunk} message RequestLoadSnapshotChunk - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RequestLoadSnapshotChunk.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.height = options.longs === String ? "0" : 0; - object.format = 0; - object.chunk = 0; - } - if (message.height != null && message.hasOwnProperty("height")) - if (typeof message.height === "number") - object.height = options.longs === String ? String(message.height) : message.height; - else - object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber(true) : message.height; - if (message.format != null && message.hasOwnProperty("format")) - object.format = message.format; - if (message.chunk != null && message.hasOwnProperty("chunk")) - object.chunk = message.chunk; - return object; - }; - - /** - * Converts this RequestLoadSnapshotChunk to JSON. - * @function toJSON - * @memberof tendermint.abci.RequestLoadSnapshotChunk - * @instance - * @returns {Object.} JSON object - */ - RequestLoadSnapshotChunk.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return RequestLoadSnapshotChunk; - })(); - - abci.RequestApplySnapshotChunk = (function() { - - /** - * Properties of a RequestApplySnapshotChunk. - * @memberof tendermint.abci - * @interface IRequestApplySnapshotChunk - * @property {number|null} [index] RequestApplySnapshotChunk index - * @property {Uint8Array|null} [chunk] RequestApplySnapshotChunk chunk - * @property {string|null} [sender] RequestApplySnapshotChunk sender - */ - - /** - * Constructs a new RequestApplySnapshotChunk. - * @memberof tendermint.abci - * @classdesc Represents a RequestApplySnapshotChunk. - * @implements IRequestApplySnapshotChunk - * @constructor - * @param {tendermint.abci.IRequestApplySnapshotChunk=} [properties] Properties to set - */ - function RequestApplySnapshotChunk(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * RequestApplySnapshotChunk index. - * @member {number} index - * @memberof tendermint.abci.RequestApplySnapshotChunk - * @instance - */ - RequestApplySnapshotChunk.prototype.index = 0; - - /** - * RequestApplySnapshotChunk chunk. - * @member {Uint8Array} chunk - * @memberof tendermint.abci.RequestApplySnapshotChunk - * @instance - */ - RequestApplySnapshotChunk.prototype.chunk = $util.newBuffer([]); - - /** - * RequestApplySnapshotChunk sender. - * @member {string} sender - * @memberof tendermint.abci.RequestApplySnapshotChunk - * @instance - */ - RequestApplySnapshotChunk.prototype.sender = ""; - - /** - * Encodes the specified RequestApplySnapshotChunk message. Does not implicitly {@link tendermint.abci.RequestApplySnapshotChunk.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.RequestApplySnapshotChunk - * @static - * @param {tendermint.abci.IRequestApplySnapshotChunk} message RequestApplySnapshotChunk message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RequestApplySnapshotChunk.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.index != null && Object.hasOwnProperty.call(message, "index")) - writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.index); - if (message.chunk != null && Object.hasOwnProperty.call(message, "chunk")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.chunk); - if (message.sender != null && Object.hasOwnProperty.call(message, "sender")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.sender); - return writer; - }; - - /** - * Encodes the specified RequestApplySnapshotChunk message, length delimited. Does not implicitly {@link tendermint.abci.RequestApplySnapshotChunk.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.RequestApplySnapshotChunk - * @static - * @param {tendermint.abci.IRequestApplySnapshotChunk} message RequestApplySnapshotChunk message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RequestApplySnapshotChunk.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RequestApplySnapshotChunk message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.RequestApplySnapshotChunk - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.RequestApplySnapshotChunk} RequestApplySnapshotChunk - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RequestApplySnapshotChunk.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.RequestApplySnapshotChunk(); - while (reader.pos < end) { - let 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; - }; - - /** - * Decodes a RequestApplySnapshotChunk message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.RequestApplySnapshotChunk - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.RequestApplySnapshotChunk} RequestApplySnapshotChunk - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RequestApplySnapshotChunk.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RequestApplySnapshotChunk message. - * @function verify - * @memberof tendermint.abci.RequestApplySnapshotChunk - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RequestApplySnapshotChunk.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.index != null && message.hasOwnProperty("index")) - if (!$util.isInteger(message.index)) - return "index: integer expected"; - if (message.chunk != null && message.hasOwnProperty("chunk")) - if (!(message.chunk && typeof message.chunk.length === "number" || $util.isString(message.chunk))) - return "chunk: buffer expected"; - if (message.sender != null && message.hasOwnProperty("sender")) - if (!$util.isString(message.sender)) - return "sender: string expected"; - return null; - }; - - /** - * Creates a RequestApplySnapshotChunk message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.RequestApplySnapshotChunk - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.RequestApplySnapshotChunk} RequestApplySnapshotChunk - */ - RequestApplySnapshotChunk.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.RequestApplySnapshotChunk) - return object; - let message = new $root.tendermint.abci.RequestApplySnapshotChunk(); - if (object.index != null) - message.index = object.index >>> 0; - if (object.chunk != null) - if (typeof object.chunk === "string") - $util.base64.decode(object.chunk, message.chunk = $util.newBuffer($util.base64.length(object.chunk)), 0); - else if (object.chunk.length) - message.chunk = object.chunk; - if (object.sender != null) - message.sender = String(object.sender); - return message; - }; - - /** - * Creates a plain object from a RequestApplySnapshotChunk message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.RequestApplySnapshotChunk - * @static - * @param {tendermint.abci.RequestApplySnapshotChunk} message RequestApplySnapshotChunk - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RequestApplySnapshotChunk.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.index = 0; - if (options.bytes === String) - object.chunk = ""; - else { - object.chunk = []; - if (options.bytes !== Array) - object.chunk = $util.newBuffer(object.chunk); - } - object.sender = ""; - } - if (message.index != null && message.hasOwnProperty("index")) - object.index = message.index; - if (message.chunk != null && message.hasOwnProperty("chunk")) - object.chunk = options.bytes === String ? $util.base64.encode(message.chunk, 0, message.chunk.length) : options.bytes === Array ? Array.prototype.slice.call(message.chunk) : message.chunk; - if (message.sender != null && message.hasOwnProperty("sender")) - object.sender = message.sender; - return object; - }; - - /** - * Converts this RequestApplySnapshotChunk to JSON. - * @function toJSON - * @memberof tendermint.abci.RequestApplySnapshotChunk - * @instance - * @returns {Object.} JSON object - */ - RequestApplySnapshotChunk.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return RequestApplySnapshotChunk; - })(); - - abci.Response = (function() { - - /** - * Properties of a Response. - * @memberof tendermint.abci - * @interface IResponse - * @property {tendermint.abci.IResponseException|null} [exception] Response exception - * @property {tendermint.abci.IResponseEcho|null} [echo] Response echo - * @property {tendermint.abci.IResponseFlush|null} [flush] Response flush - * @property {tendermint.abci.IResponseInfo|null} [info] Response info - * @property {tendermint.abci.IResponseSetOption|null} [set_option] Response set_option - * @property {tendermint.abci.IResponseInitChain|null} [init_chain] Response init_chain - * @property {tendermint.abci.IResponseQuery|null} [query] Response query - * @property {tendermint.abci.IResponseBeginBlock|null} [begin_block] Response begin_block - * @property {tendermint.abci.IResponseCheckTx|null} [check_tx] Response check_tx - * @property {tendermint.abci.IResponseDeliverTx|null} [deliver_tx] Response deliver_tx - * @property {tendermint.abci.IResponseEndBlock|null} [end_block] Response end_block - * @property {tendermint.abci.IResponseCommit|null} [commit] Response commit - * @property {tendermint.abci.IResponseListSnapshots|null} [list_snapshots] Response list_snapshots - * @property {tendermint.abci.IResponseOfferSnapshot|null} [offer_snapshot] Response offer_snapshot - * @property {tendermint.abci.IResponseLoadSnapshotChunk|null} [load_snapshot_chunk] Response load_snapshot_chunk - * @property {tendermint.abci.IResponseApplySnapshotChunk|null} [apply_snapshot_chunk] Response apply_snapshot_chunk - */ - - /** - * Constructs a new Response. - * @memberof tendermint.abci - * @classdesc Represents a Response. - * @implements IResponse - * @constructor - * @param {tendermint.abci.IResponse=} [properties] Properties to set - */ - function Response(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Response exception. - * @member {tendermint.abci.IResponseException|null|undefined} exception - * @memberof tendermint.abci.Response - * @instance - */ - Response.prototype.exception = null; - - /** - * Response echo. - * @member {tendermint.abci.IResponseEcho|null|undefined} echo - * @memberof tendermint.abci.Response - * @instance - */ - Response.prototype.echo = null; - - /** - * Response flush. - * @member {tendermint.abci.IResponseFlush|null|undefined} flush - * @memberof tendermint.abci.Response - * @instance - */ - Response.prototype.flush = null; - - /** - * Response info. - * @member {tendermint.abci.IResponseInfo|null|undefined} info - * @memberof tendermint.abci.Response - * @instance - */ - Response.prototype.info = null; - - /** - * Response set_option. - * @member {tendermint.abci.IResponseSetOption|null|undefined} set_option - * @memberof tendermint.abci.Response - * @instance - */ - Response.prototype.set_option = null; - - /** - * Response init_chain. - * @member {tendermint.abci.IResponseInitChain|null|undefined} init_chain - * @memberof tendermint.abci.Response - * @instance - */ - Response.prototype.init_chain = null; - - /** - * Response query. - * @member {tendermint.abci.IResponseQuery|null|undefined} query - * @memberof tendermint.abci.Response - * @instance - */ - Response.prototype.query = null; - - /** - * Response begin_block. - * @member {tendermint.abci.IResponseBeginBlock|null|undefined} begin_block - * @memberof tendermint.abci.Response - * @instance - */ - Response.prototype.begin_block = null; - - /** - * Response check_tx. - * @member {tendermint.abci.IResponseCheckTx|null|undefined} check_tx - * @memberof tendermint.abci.Response - * @instance - */ - Response.prototype.check_tx = null; - - /** - * Response deliver_tx. - * @member {tendermint.abci.IResponseDeliverTx|null|undefined} deliver_tx - * @memberof tendermint.abci.Response - * @instance - */ - Response.prototype.deliver_tx = null; - - /** - * Response end_block. - * @member {tendermint.abci.IResponseEndBlock|null|undefined} end_block - * @memberof tendermint.abci.Response - * @instance - */ - Response.prototype.end_block = null; - - /** - * Response commit. - * @member {tendermint.abci.IResponseCommit|null|undefined} commit - * @memberof tendermint.abci.Response - * @instance - */ - Response.prototype.commit = null; - - /** - * Response list_snapshots. - * @member {tendermint.abci.IResponseListSnapshots|null|undefined} list_snapshots - * @memberof tendermint.abci.Response - * @instance - */ - Response.prototype.list_snapshots = null; - - /** - * Response offer_snapshot. - * @member {tendermint.abci.IResponseOfferSnapshot|null|undefined} offer_snapshot - * @memberof tendermint.abci.Response - * @instance - */ - Response.prototype.offer_snapshot = null; - - /** - * Response load_snapshot_chunk. - * @member {tendermint.abci.IResponseLoadSnapshotChunk|null|undefined} load_snapshot_chunk - * @memberof tendermint.abci.Response - * @instance - */ - Response.prototype.load_snapshot_chunk = null; - - /** - * Response apply_snapshot_chunk. - * @member {tendermint.abci.IResponseApplySnapshotChunk|null|undefined} apply_snapshot_chunk - * @memberof tendermint.abci.Response - * @instance - */ - Response.prototype.apply_snapshot_chunk = null; - - // OneOf field names bound to virtual getters and setters - let $oneOfFields; - - /** - * Response value. - * @member {"exception"|"echo"|"flush"|"info"|"set_option"|"init_chain"|"query"|"begin_block"|"check_tx"|"deliver_tx"|"end_block"|"commit"|"list_snapshots"|"offer_snapshot"|"load_snapshot_chunk"|"apply_snapshot_chunk"|undefined} value - * @memberof tendermint.abci.Response - * @instance - */ - Object.defineProperty(Response.prototype, "value", { - get: $util.oneOfGetter($oneOfFields = ["exception", "echo", "flush", "info", "set_option", "init_chain", "query", "begin_block", "check_tx", "deliver_tx", "end_block", "commit", "list_snapshots", "offer_snapshot", "load_snapshot_chunk", "apply_snapshot_chunk"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Encodes the specified Response message. Does not implicitly {@link tendermint.abci.Response.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.Response - * @static - * @param {tendermint.abci.IResponse} message Response message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Response.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.exception != null && Object.hasOwnProperty.call(message, "exception")) - $root.tendermint.abci.ResponseException.encode(message.exception, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.echo != null && Object.hasOwnProperty.call(message, "echo")) - $root.tendermint.abci.ResponseEcho.encode(message.echo, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.flush != null && Object.hasOwnProperty.call(message, "flush")) - $root.tendermint.abci.ResponseFlush.encode(message.flush, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.info != null && Object.hasOwnProperty.call(message, "info")) - $root.tendermint.abci.ResponseInfo.encode(message.info, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.set_option != null && Object.hasOwnProperty.call(message, "set_option")) - $root.tendermint.abci.ResponseSetOption.encode(message.set_option, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.init_chain != null && Object.hasOwnProperty.call(message, "init_chain")) - $root.tendermint.abci.ResponseInitChain.encode(message.init_chain, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.query != null && Object.hasOwnProperty.call(message, "query")) - $root.tendermint.abci.ResponseQuery.encode(message.query, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.begin_block != null && Object.hasOwnProperty.call(message, "begin_block")) - $root.tendermint.abci.ResponseBeginBlock.encode(message.begin_block, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.check_tx != null && Object.hasOwnProperty.call(message, "check_tx")) - $root.tendermint.abci.ResponseCheckTx.encode(message.check_tx, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.deliver_tx != null && Object.hasOwnProperty.call(message, "deliver_tx")) - $root.tendermint.abci.ResponseDeliverTx.encode(message.deliver_tx, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); - if (message.end_block != null && Object.hasOwnProperty.call(message, "end_block")) - $root.tendermint.abci.ResponseEndBlock.encode(message.end_block, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.commit != null && Object.hasOwnProperty.call(message, "commit")) - $root.tendermint.abci.ResponseCommit.encode(message.commit, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.list_snapshots != null && Object.hasOwnProperty.call(message, "list_snapshots")) - $root.tendermint.abci.ResponseListSnapshots.encode(message.list_snapshots, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); - if (message.offer_snapshot != null && Object.hasOwnProperty.call(message, "offer_snapshot")) - $root.tendermint.abci.ResponseOfferSnapshot.encode(message.offer_snapshot, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); - if (message.load_snapshot_chunk != null && Object.hasOwnProperty.call(message, "load_snapshot_chunk")) - $root.tendermint.abci.ResponseLoadSnapshotChunk.encode(message.load_snapshot_chunk, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); - if (message.apply_snapshot_chunk != null && Object.hasOwnProperty.call(message, "apply_snapshot_chunk")) - $root.tendermint.abci.ResponseApplySnapshotChunk.encode(message.apply_snapshot_chunk, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Response message, length delimited. Does not implicitly {@link tendermint.abci.Response.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.Response - * @static - * @param {tendermint.abci.IResponse} message Response message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Response.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Response message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.Response - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.Response} Response - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Response.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.Response(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.exception = $root.tendermint.abci.ResponseException.decode(reader, reader.uint32()); - break; - case 2: - message.echo = $root.tendermint.abci.ResponseEcho.decode(reader, reader.uint32()); - break; - case 3: - message.flush = $root.tendermint.abci.ResponseFlush.decode(reader, reader.uint32()); - break; - case 4: - message.info = $root.tendermint.abci.ResponseInfo.decode(reader, reader.uint32()); - break; - case 5: - message.set_option = $root.tendermint.abci.ResponseSetOption.decode(reader, reader.uint32()); - break; - case 6: - message.init_chain = $root.tendermint.abci.ResponseInitChain.decode(reader, reader.uint32()); - break; - case 7: - message.query = $root.tendermint.abci.ResponseQuery.decode(reader, reader.uint32()); - break; - case 8: - message.begin_block = $root.tendermint.abci.ResponseBeginBlock.decode(reader, reader.uint32()); - break; - case 9: - message.check_tx = $root.tendermint.abci.ResponseCheckTx.decode(reader, reader.uint32()); - break; - case 10: - message.deliver_tx = $root.tendermint.abci.ResponseDeliverTx.decode(reader, reader.uint32()); - break; - case 11: - message.end_block = $root.tendermint.abci.ResponseEndBlock.decode(reader, reader.uint32()); - break; - case 12: - message.commit = $root.tendermint.abci.ResponseCommit.decode(reader, reader.uint32()); - break; - case 13: - message.list_snapshots = $root.tendermint.abci.ResponseListSnapshots.decode(reader, reader.uint32()); - break; - case 14: - message.offer_snapshot = $root.tendermint.abci.ResponseOfferSnapshot.decode(reader, reader.uint32()); - break; - case 15: - message.load_snapshot_chunk = $root.tendermint.abci.ResponseLoadSnapshotChunk.decode(reader, reader.uint32()); - break; - case 16: - message.apply_snapshot_chunk = $root.tendermint.abci.ResponseApplySnapshotChunk.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Response message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.Response - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.Response} Response - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Response.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Response message. - * @function verify - * @memberof tendermint.abci.Response - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Response.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - let properties = {}; - if (message.exception != null && message.hasOwnProperty("exception")) { - properties.value = 1; - { - let error = $root.tendermint.abci.ResponseException.verify(message.exception); - if (error) - return "exception." + error; - } - } - if (message.echo != null && message.hasOwnProperty("echo")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - let error = $root.tendermint.abci.ResponseEcho.verify(message.echo); - if (error) - return "echo." + error; - } - } - if (message.flush != null && message.hasOwnProperty("flush")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - let error = $root.tendermint.abci.ResponseFlush.verify(message.flush); - if (error) - return "flush." + error; - } - } - if (message.info != null && message.hasOwnProperty("info")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - let error = $root.tendermint.abci.ResponseInfo.verify(message.info); - if (error) - return "info." + error; - } - } - if (message.set_option != null && message.hasOwnProperty("set_option")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - let error = $root.tendermint.abci.ResponseSetOption.verify(message.set_option); - if (error) - return "set_option." + error; - } - } - if (message.init_chain != null && message.hasOwnProperty("init_chain")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - let error = $root.tendermint.abci.ResponseInitChain.verify(message.init_chain); - if (error) - return "init_chain." + error; - } - } - if (message.query != null && message.hasOwnProperty("query")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - let error = $root.tendermint.abci.ResponseQuery.verify(message.query); - if (error) - return "query." + error; - } - } - if (message.begin_block != null && message.hasOwnProperty("begin_block")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - let error = $root.tendermint.abci.ResponseBeginBlock.verify(message.begin_block); - if (error) - return "begin_block." + error; - } - } - if (message.check_tx != null && message.hasOwnProperty("check_tx")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - let error = $root.tendermint.abci.ResponseCheckTx.verify(message.check_tx); - if (error) - return "check_tx." + error; - } - } - if (message.deliver_tx != null && message.hasOwnProperty("deliver_tx")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - let error = $root.tendermint.abci.ResponseDeliverTx.verify(message.deliver_tx); - if (error) - return "deliver_tx." + error; - } - } - if (message.end_block != null && message.hasOwnProperty("end_block")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - let error = $root.tendermint.abci.ResponseEndBlock.verify(message.end_block); - if (error) - return "end_block." + error; - } - } - if (message.commit != null && message.hasOwnProperty("commit")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - let error = $root.tendermint.abci.ResponseCommit.verify(message.commit); - if (error) - return "commit." + error; - } - } - if (message.list_snapshots != null && message.hasOwnProperty("list_snapshots")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - let error = $root.tendermint.abci.ResponseListSnapshots.verify(message.list_snapshots); - if (error) - return "list_snapshots." + error; - } - } - if (message.offer_snapshot != null && message.hasOwnProperty("offer_snapshot")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - let error = $root.tendermint.abci.ResponseOfferSnapshot.verify(message.offer_snapshot); - if (error) - return "offer_snapshot." + error; - } - } - if (message.load_snapshot_chunk != null && message.hasOwnProperty("load_snapshot_chunk")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - let error = $root.tendermint.abci.ResponseLoadSnapshotChunk.verify(message.load_snapshot_chunk); - if (error) - return "load_snapshot_chunk." + error; - } - } - if (message.apply_snapshot_chunk != null && message.hasOwnProperty("apply_snapshot_chunk")) { - if (properties.value === 1) - return "value: multiple values"; - properties.value = 1; - { - let error = $root.tendermint.abci.ResponseApplySnapshotChunk.verify(message.apply_snapshot_chunk); - if (error) - return "apply_snapshot_chunk." + error; - } - } - return null; - }; - - /** - * Creates a Response message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.Response - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.Response} Response - */ - Response.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.Response) - return object; - let message = new $root.tendermint.abci.Response(); - if (object.exception != null) { - if (typeof object.exception !== "object") - throw TypeError(".tendermint.abci.Response.exception: object expected"); - message.exception = $root.tendermint.abci.ResponseException.fromObject(object.exception); - } - if (object.echo != null) { - if (typeof object.echo !== "object") - throw TypeError(".tendermint.abci.Response.echo: object expected"); - message.echo = $root.tendermint.abci.ResponseEcho.fromObject(object.echo); - } - if (object.flush != null) { - if (typeof object.flush !== "object") - throw TypeError(".tendermint.abci.Response.flush: object expected"); - message.flush = $root.tendermint.abci.ResponseFlush.fromObject(object.flush); - } - if (object.info != null) { - if (typeof object.info !== "object") - throw TypeError(".tendermint.abci.Response.info: object expected"); - message.info = $root.tendermint.abci.ResponseInfo.fromObject(object.info); - } - if (object.set_option != null) { - if (typeof object.set_option !== "object") - throw TypeError(".tendermint.abci.Response.set_option: object expected"); - message.set_option = $root.tendermint.abci.ResponseSetOption.fromObject(object.set_option); - } - if (object.init_chain != null) { - if (typeof object.init_chain !== "object") - throw TypeError(".tendermint.abci.Response.init_chain: object expected"); - message.init_chain = $root.tendermint.abci.ResponseInitChain.fromObject(object.init_chain); - } - if (object.query != null) { - if (typeof object.query !== "object") - throw TypeError(".tendermint.abci.Response.query: object expected"); - message.query = $root.tendermint.abci.ResponseQuery.fromObject(object.query); - } - if (object.begin_block != null) { - if (typeof object.begin_block !== "object") - throw TypeError(".tendermint.abci.Response.begin_block: object expected"); - message.begin_block = $root.tendermint.abci.ResponseBeginBlock.fromObject(object.begin_block); - } - if (object.check_tx != null) { - if (typeof object.check_tx !== "object") - throw TypeError(".tendermint.abci.Response.check_tx: object expected"); - message.check_tx = $root.tendermint.abci.ResponseCheckTx.fromObject(object.check_tx); - } - if (object.deliver_tx != null) { - if (typeof object.deliver_tx !== "object") - throw TypeError(".tendermint.abci.Response.deliver_tx: object expected"); - message.deliver_tx = $root.tendermint.abci.ResponseDeliverTx.fromObject(object.deliver_tx); - } - if (object.end_block != null) { - if (typeof object.end_block !== "object") - throw TypeError(".tendermint.abci.Response.end_block: object expected"); - message.end_block = $root.tendermint.abci.ResponseEndBlock.fromObject(object.end_block); - } - if (object.commit != null) { - if (typeof object.commit !== "object") - throw TypeError(".tendermint.abci.Response.commit: object expected"); - message.commit = $root.tendermint.abci.ResponseCommit.fromObject(object.commit); - } - if (object.list_snapshots != null) { - if (typeof object.list_snapshots !== "object") - throw TypeError(".tendermint.abci.Response.list_snapshots: object expected"); - message.list_snapshots = $root.tendermint.abci.ResponseListSnapshots.fromObject(object.list_snapshots); - } - if (object.offer_snapshot != null) { - if (typeof object.offer_snapshot !== "object") - throw TypeError(".tendermint.abci.Response.offer_snapshot: object expected"); - message.offer_snapshot = $root.tendermint.abci.ResponseOfferSnapshot.fromObject(object.offer_snapshot); - } - if (object.load_snapshot_chunk != null) { - if (typeof object.load_snapshot_chunk !== "object") - throw TypeError(".tendermint.abci.Response.load_snapshot_chunk: object expected"); - message.load_snapshot_chunk = $root.tendermint.abci.ResponseLoadSnapshotChunk.fromObject(object.load_snapshot_chunk); - } - if (object.apply_snapshot_chunk != null) { - if (typeof object.apply_snapshot_chunk !== "object") - throw TypeError(".tendermint.abci.Response.apply_snapshot_chunk: object expected"); - message.apply_snapshot_chunk = $root.tendermint.abci.ResponseApplySnapshotChunk.fromObject(object.apply_snapshot_chunk); - } - return message; - }; - - /** - * Creates a plain object from a Response message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.Response - * @static - * @param {tendermint.abci.Response} message Response - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Response.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (message.exception != null && message.hasOwnProperty("exception")) { - object.exception = $root.tendermint.abci.ResponseException.toObject(message.exception, options); - if (options.oneofs) - object.value = "exception"; - } - if (message.echo != null && message.hasOwnProperty("echo")) { - object.echo = $root.tendermint.abci.ResponseEcho.toObject(message.echo, options); - if (options.oneofs) - object.value = "echo"; - } - if (message.flush != null && message.hasOwnProperty("flush")) { - object.flush = $root.tendermint.abci.ResponseFlush.toObject(message.flush, options); - if (options.oneofs) - object.value = "flush"; - } - if (message.info != null && message.hasOwnProperty("info")) { - object.info = $root.tendermint.abci.ResponseInfo.toObject(message.info, options); - if (options.oneofs) - object.value = "info"; - } - if (message.set_option != null && message.hasOwnProperty("set_option")) { - object.set_option = $root.tendermint.abci.ResponseSetOption.toObject(message.set_option, options); - if (options.oneofs) - object.value = "set_option"; - } - if (message.init_chain != null && message.hasOwnProperty("init_chain")) { - object.init_chain = $root.tendermint.abci.ResponseInitChain.toObject(message.init_chain, options); - if (options.oneofs) - object.value = "init_chain"; - } - if (message.query != null && message.hasOwnProperty("query")) { - object.query = $root.tendermint.abci.ResponseQuery.toObject(message.query, options); - if (options.oneofs) - object.value = "query"; - } - if (message.begin_block != null && message.hasOwnProperty("begin_block")) { - object.begin_block = $root.tendermint.abci.ResponseBeginBlock.toObject(message.begin_block, options); - if (options.oneofs) - object.value = "begin_block"; - } - if (message.check_tx != null && message.hasOwnProperty("check_tx")) { - object.check_tx = $root.tendermint.abci.ResponseCheckTx.toObject(message.check_tx, options); - if (options.oneofs) - object.value = "check_tx"; - } - if (message.deliver_tx != null && message.hasOwnProperty("deliver_tx")) { - object.deliver_tx = $root.tendermint.abci.ResponseDeliverTx.toObject(message.deliver_tx, options); - if (options.oneofs) - object.value = "deliver_tx"; - } - if (message.end_block != null && message.hasOwnProperty("end_block")) { - object.end_block = $root.tendermint.abci.ResponseEndBlock.toObject(message.end_block, options); - if (options.oneofs) - object.value = "end_block"; - } - if (message.commit != null && message.hasOwnProperty("commit")) { - object.commit = $root.tendermint.abci.ResponseCommit.toObject(message.commit, options); - if (options.oneofs) - object.value = "commit"; - } - if (message.list_snapshots != null && message.hasOwnProperty("list_snapshots")) { - object.list_snapshots = $root.tendermint.abci.ResponseListSnapshots.toObject(message.list_snapshots, options); - if (options.oneofs) - object.value = "list_snapshots"; - } - if (message.offer_snapshot != null && message.hasOwnProperty("offer_snapshot")) { - object.offer_snapshot = $root.tendermint.abci.ResponseOfferSnapshot.toObject(message.offer_snapshot, options); - if (options.oneofs) - object.value = "offer_snapshot"; - } - if (message.load_snapshot_chunk != null && message.hasOwnProperty("load_snapshot_chunk")) { - object.load_snapshot_chunk = $root.tendermint.abci.ResponseLoadSnapshotChunk.toObject(message.load_snapshot_chunk, options); - if (options.oneofs) - object.value = "load_snapshot_chunk"; - } - if (message.apply_snapshot_chunk != null && message.hasOwnProperty("apply_snapshot_chunk")) { - object.apply_snapshot_chunk = $root.tendermint.abci.ResponseApplySnapshotChunk.toObject(message.apply_snapshot_chunk, options); - if (options.oneofs) - object.value = "apply_snapshot_chunk"; - } - return object; - }; - - /** - * Converts this Response to JSON. - * @function toJSON - * @memberof tendermint.abci.Response - * @instance - * @returns {Object.} JSON object - */ - Response.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Response; - })(); - - abci.ResponseException = (function() { - - /** - * Properties of a ResponseException. - * @memberof tendermint.abci - * @interface IResponseException - * @property {string|null} [error] ResponseException error - */ - - /** - * Constructs a new ResponseException. - * @memberof tendermint.abci - * @classdesc Represents a ResponseException. - * @implements IResponseException - * @constructor - * @param {tendermint.abci.IResponseException=} [properties] Properties to set - */ - function ResponseException(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ResponseException error. - * @member {string} error - * @memberof tendermint.abci.ResponseException - * @instance - */ - ResponseException.prototype.error = ""; - - /** - * Encodes the specified ResponseException message. Does not implicitly {@link tendermint.abci.ResponseException.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.ResponseException - * @static - * @param {tendermint.abci.IResponseException} message ResponseException message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseException.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.error != null && Object.hasOwnProperty.call(message, "error")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.error); - return writer; - }; - - /** - * Encodes the specified ResponseException message, length delimited. Does not implicitly {@link tendermint.abci.ResponseException.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.ResponseException - * @static - * @param {tendermint.abci.IResponseException} message ResponseException message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseException.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ResponseException message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.ResponseException - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.ResponseException} ResponseException - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseException.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseException(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.error = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ResponseException message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.ResponseException - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.ResponseException} ResponseException - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseException.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ResponseException message. - * @function verify - * @memberof tendermint.abci.ResponseException - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ResponseException.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.error != null && message.hasOwnProperty("error")) - if (!$util.isString(message.error)) - return "error: string expected"; - return null; - }; - - /** - * Creates a ResponseException message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.ResponseException - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.ResponseException} ResponseException - */ - ResponseException.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.ResponseException) - return object; - let message = new $root.tendermint.abci.ResponseException(); - if (object.error != null) - message.error = String(object.error); - return message; - }; - - /** - * Creates a plain object from a ResponseException message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.ResponseException - * @static - * @param {tendermint.abci.ResponseException} message ResponseException - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ResponseException.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.error = ""; - if (message.error != null && message.hasOwnProperty("error")) - object.error = message.error; - return object; - }; - - /** - * Converts this ResponseException to JSON. - * @function toJSON - * @memberof tendermint.abci.ResponseException - * @instance - * @returns {Object.} JSON object - */ - ResponseException.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ResponseException; - })(); - - abci.ResponseEcho = (function() { - - /** - * Properties of a ResponseEcho. - * @memberof tendermint.abci - * @interface IResponseEcho - * @property {string|null} [message] ResponseEcho message - */ - - /** - * Constructs a new ResponseEcho. - * @memberof tendermint.abci - * @classdesc Represents a ResponseEcho. - * @implements IResponseEcho - * @constructor - * @param {tendermint.abci.IResponseEcho=} [properties] Properties to set - */ - function ResponseEcho(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ResponseEcho message. - * @member {string} message - * @memberof tendermint.abci.ResponseEcho - * @instance - */ - ResponseEcho.prototype.message = ""; - - /** - * Encodes the specified ResponseEcho message. Does not implicitly {@link tendermint.abci.ResponseEcho.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.ResponseEcho - * @static - * @param {tendermint.abci.IResponseEcho} message ResponseEcho message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseEcho.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.message != null && Object.hasOwnProperty.call(message, "message")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.message); - return writer; - }; - - /** - * Encodes the specified ResponseEcho message, length delimited. Does not implicitly {@link tendermint.abci.ResponseEcho.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.ResponseEcho - * @static - * @param {tendermint.abci.IResponseEcho} message ResponseEcho message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseEcho.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ResponseEcho message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.ResponseEcho - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.ResponseEcho} ResponseEcho - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseEcho.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseEcho(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.message = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ResponseEcho message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.ResponseEcho - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.ResponseEcho} ResponseEcho - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseEcho.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ResponseEcho message. - * @function verify - * @memberof tendermint.abci.ResponseEcho - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ResponseEcho.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.message != null && message.hasOwnProperty("message")) - if (!$util.isString(message.message)) - return "message: string expected"; - return null; - }; - - /** - * Creates a ResponseEcho message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.ResponseEcho - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.ResponseEcho} ResponseEcho - */ - ResponseEcho.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.ResponseEcho) - return object; - let message = new $root.tendermint.abci.ResponseEcho(); - if (object.message != null) - message.message = String(object.message); - return message; - }; - - /** - * Creates a plain object from a ResponseEcho message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.ResponseEcho - * @static - * @param {tendermint.abci.ResponseEcho} message ResponseEcho - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ResponseEcho.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.message = ""; - if (message.message != null && message.hasOwnProperty("message")) - object.message = message.message; - return object; - }; - - /** - * Converts this ResponseEcho to JSON. - * @function toJSON - * @memberof tendermint.abci.ResponseEcho - * @instance - * @returns {Object.} JSON object - */ - ResponseEcho.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ResponseEcho; - })(); - - abci.ResponseFlush = (function() { - - /** - * Properties of a ResponseFlush. - * @memberof tendermint.abci - * @interface IResponseFlush - */ - - /** - * Constructs a new ResponseFlush. - * @memberof tendermint.abci - * @classdesc Represents a ResponseFlush. - * @implements IResponseFlush - * @constructor - * @param {tendermint.abci.IResponseFlush=} [properties] Properties to set - */ - function ResponseFlush(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Encodes the specified ResponseFlush message. Does not implicitly {@link tendermint.abci.ResponseFlush.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.ResponseFlush - * @static - * @param {tendermint.abci.IResponseFlush} message ResponseFlush message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseFlush.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified ResponseFlush message, length delimited. Does not implicitly {@link tendermint.abci.ResponseFlush.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.ResponseFlush - * @static - * @param {tendermint.abci.IResponseFlush} message ResponseFlush message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseFlush.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ResponseFlush message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.ResponseFlush - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.ResponseFlush} ResponseFlush - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseFlush.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseFlush(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ResponseFlush message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.ResponseFlush - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.ResponseFlush} ResponseFlush - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseFlush.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ResponseFlush message. - * @function verify - * @memberof tendermint.abci.ResponseFlush - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ResponseFlush.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a ResponseFlush message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.ResponseFlush - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.ResponseFlush} ResponseFlush - */ - ResponseFlush.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.ResponseFlush) - return object; - return new $root.tendermint.abci.ResponseFlush(); - }; - - /** - * Creates a plain object from a ResponseFlush message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.ResponseFlush - * @static - * @param {tendermint.abci.ResponseFlush} message ResponseFlush - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ResponseFlush.toObject = function toObject() { - return {}; - }; - - /** - * Converts this ResponseFlush to JSON. - * @function toJSON - * @memberof tendermint.abci.ResponseFlush - * @instance - * @returns {Object.} JSON object - */ - ResponseFlush.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ResponseFlush; - })(); - - abci.ResponseInfo = (function() { - - /** - * Properties of a ResponseInfo. - * @memberof tendermint.abci - * @interface IResponseInfo - * @property {string|null} [data] ResponseInfo data - * @property {string|null} [version] ResponseInfo version - * @property {Long|null} [app_version] ResponseInfo app_version - * @property {Long|null} [last_block_height] ResponseInfo last_block_height - * @property {Uint8Array|null} [last_block_app_hash] ResponseInfo last_block_app_hash - */ - - /** - * Constructs a new ResponseInfo. - * @memberof tendermint.abci - * @classdesc Represents a ResponseInfo. - * @implements IResponseInfo - * @constructor - * @param {tendermint.abci.IResponseInfo=} [properties] Properties to set - */ - function ResponseInfo(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ResponseInfo data. - * @member {string} data - * @memberof tendermint.abci.ResponseInfo - * @instance - */ - ResponseInfo.prototype.data = ""; - - /** - * ResponseInfo version. - * @member {string} version - * @memberof tendermint.abci.ResponseInfo - * @instance - */ - ResponseInfo.prototype.version = ""; - - /** - * ResponseInfo app_version. - * @member {Long} app_version - * @memberof tendermint.abci.ResponseInfo - * @instance - */ - ResponseInfo.prototype.app_version = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * ResponseInfo last_block_height. - * @member {Long} last_block_height - * @memberof tendermint.abci.ResponseInfo - * @instance - */ - ResponseInfo.prototype.last_block_height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * ResponseInfo last_block_app_hash. - * @member {Uint8Array} last_block_app_hash - * @memberof tendermint.abci.ResponseInfo - * @instance - */ - ResponseInfo.prototype.last_block_app_hash = $util.newBuffer([]); - - /** - * Encodes the specified ResponseInfo message. Does not implicitly {@link tendermint.abci.ResponseInfo.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.ResponseInfo - * @static - * @param {tendermint.abci.IResponseInfo} message ResponseInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.data != null && Object.hasOwnProperty.call(message, "data")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.data); - if (message.version != null && Object.hasOwnProperty.call(message, "version")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.version); - if (message.app_version != null && Object.hasOwnProperty.call(message, "app_version")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.app_version); - if (message.last_block_height != null && Object.hasOwnProperty.call(message, "last_block_height")) - writer.uint32(/* id 4, wireType 0 =*/32).int64(message.last_block_height); - if (message.last_block_app_hash != null && Object.hasOwnProperty.call(message, "last_block_app_hash")) - writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.last_block_app_hash); - return writer; - }; - - /** - * Encodes the specified ResponseInfo message, length delimited. Does not implicitly {@link tendermint.abci.ResponseInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.ResponseInfo - * @static - * @param {tendermint.abci.IResponseInfo} message ResponseInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ResponseInfo message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.ResponseInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.ResponseInfo} ResponseInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseInfo(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.data = reader.string(); - break; - case 2: - message.version = reader.string(); - break; - case 3: - message.app_version = reader.uint64(); - break; - case 4: - message.last_block_height = reader.int64(); - break; - case 5: - message.last_block_app_hash = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ResponseInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.ResponseInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.ResponseInfo} ResponseInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ResponseInfo message. - * @function verify - * @memberof tendermint.abci.ResponseInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ResponseInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.data != null && message.hasOwnProperty("data")) - if (!$util.isString(message.data)) - return "data: string expected"; - if (message.version != null && message.hasOwnProperty("version")) - if (!$util.isString(message.version)) - return "version: string expected"; - if (message.app_version != null && message.hasOwnProperty("app_version")) - if (!$util.isInteger(message.app_version) && !(message.app_version && $util.isInteger(message.app_version.low) && $util.isInteger(message.app_version.high))) - return "app_version: integer|Long expected"; - if (message.last_block_height != null && message.hasOwnProperty("last_block_height")) - if (!$util.isInteger(message.last_block_height) && !(message.last_block_height && $util.isInteger(message.last_block_height.low) && $util.isInteger(message.last_block_height.high))) - return "last_block_height: integer|Long expected"; - if (message.last_block_app_hash != null && message.hasOwnProperty("last_block_app_hash")) - if (!(message.last_block_app_hash && typeof message.last_block_app_hash.length === "number" || $util.isString(message.last_block_app_hash))) - return "last_block_app_hash: buffer expected"; - return null; - }; - - /** - * Creates a ResponseInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.ResponseInfo - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.ResponseInfo} ResponseInfo - */ - ResponseInfo.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.ResponseInfo) - return object; - let message = new $root.tendermint.abci.ResponseInfo(); - if (object.data != null) - message.data = String(object.data); - if (object.version != null) - message.version = String(object.version); - if (object.app_version != null) - if ($util.Long) - (message.app_version = $util.Long.fromValue(object.app_version)).unsigned = true; - else if (typeof object.app_version === "string") - message.app_version = parseInt(object.app_version, 10); - else if (typeof object.app_version === "number") - message.app_version = object.app_version; - else if (typeof object.app_version === "object") - message.app_version = new $util.LongBits(object.app_version.low >>> 0, object.app_version.high >>> 0).toNumber(true); - if (object.last_block_height != null) - if ($util.Long) - (message.last_block_height = $util.Long.fromValue(object.last_block_height)).unsigned = false; - else if (typeof object.last_block_height === "string") - message.last_block_height = parseInt(object.last_block_height, 10); - else if (typeof object.last_block_height === "number") - message.last_block_height = object.last_block_height; - else if (typeof object.last_block_height === "object") - message.last_block_height = new $util.LongBits(object.last_block_height.low >>> 0, object.last_block_height.high >>> 0).toNumber(); - if (object.last_block_app_hash != null) - if (typeof object.last_block_app_hash === "string") - $util.base64.decode(object.last_block_app_hash, message.last_block_app_hash = $util.newBuffer($util.base64.length(object.last_block_app_hash)), 0); - else if (object.last_block_app_hash.length) - message.last_block_app_hash = object.last_block_app_hash; - return message; - }; - - /** - * Creates a plain object from a ResponseInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.ResponseInfo - * @static - * @param {tendermint.abci.ResponseInfo} message ResponseInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ResponseInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.data = ""; - object.version = ""; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.app_version = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.app_version = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.last_block_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.last_block_height = options.longs === String ? "0" : 0; - if (options.bytes === String) - object.last_block_app_hash = ""; - else { - object.last_block_app_hash = []; - if (options.bytes !== Array) - object.last_block_app_hash = $util.newBuffer(object.last_block_app_hash); - } - } - if (message.data != null && message.hasOwnProperty("data")) - object.data = message.data; - if (message.version != null && message.hasOwnProperty("version")) - object.version = message.version; - if (message.app_version != null && message.hasOwnProperty("app_version")) - if (typeof message.app_version === "number") - object.app_version = options.longs === String ? String(message.app_version) : message.app_version; - else - object.app_version = options.longs === String ? $util.Long.prototype.toString.call(message.app_version) : options.longs === Number ? new $util.LongBits(message.app_version.low >>> 0, message.app_version.high >>> 0).toNumber(true) : message.app_version; - if (message.last_block_height != null && message.hasOwnProperty("last_block_height")) - if (typeof message.last_block_height === "number") - object.last_block_height = options.longs === String ? String(message.last_block_height) : message.last_block_height; - else - object.last_block_height = options.longs === String ? $util.Long.prototype.toString.call(message.last_block_height) : options.longs === Number ? new $util.LongBits(message.last_block_height.low >>> 0, message.last_block_height.high >>> 0).toNumber() : message.last_block_height; - if (message.last_block_app_hash != null && message.hasOwnProperty("last_block_app_hash")) - object.last_block_app_hash = options.bytes === String ? $util.base64.encode(message.last_block_app_hash, 0, message.last_block_app_hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.last_block_app_hash) : message.last_block_app_hash; - return object; - }; - - /** - * Converts this ResponseInfo to JSON. - * @function toJSON - * @memberof tendermint.abci.ResponseInfo - * @instance - * @returns {Object.} JSON object - */ - ResponseInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ResponseInfo; - })(); - - abci.ResponseSetOption = (function() { - - /** - * Properties of a ResponseSetOption. - * @memberof tendermint.abci - * @interface IResponseSetOption - * @property {number|null} [code] ResponseSetOption code - * @property {string|null} [log] ResponseSetOption log - * @property {string|null} [info] ResponseSetOption info - */ - - /** - * Constructs a new ResponseSetOption. - * @memberof tendermint.abci - * @classdesc Represents a ResponseSetOption. - * @implements IResponseSetOption - * @constructor - * @param {tendermint.abci.IResponseSetOption=} [properties] Properties to set - */ - function ResponseSetOption(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ResponseSetOption code. - * @member {number} code - * @memberof tendermint.abci.ResponseSetOption - * @instance - */ - ResponseSetOption.prototype.code = 0; - - /** - * ResponseSetOption log. - * @member {string} log - * @memberof tendermint.abci.ResponseSetOption - * @instance - */ - ResponseSetOption.prototype.log = ""; - - /** - * ResponseSetOption info. - * @member {string} info - * @memberof tendermint.abci.ResponseSetOption - * @instance - */ - ResponseSetOption.prototype.info = ""; - - /** - * Encodes the specified ResponseSetOption message. Does not implicitly {@link tendermint.abci.ResponseSetOption.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.ResponseSetOption - * @static - * @param {tendermint.abci.IResponseSetOption} message ResponseSetOption message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseSetOption.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.code != null && Object.hasOwnProperty.call(message, "code")) - writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.code); - if (message.log != null && Object.hasOwnProperty.call(message, "log")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.log); - if (message.info != null && Object.hasOwnProperty.call(message, "info")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.info); - return writer; - }; - - /** - * Encodes the specified ResponseSetOption message, length delimited. Does not implicitly {@link tendermint.abci.ResponseSetOption.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.ResponseSetOption - * @static - * @param {tendermint.abci.IResponseSetOption} message ResponseSetOption message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseSetOption.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ResponseSetOption message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.ResponseSetOption - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.ResponseSetOption} ResponseSetOption - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseSetOption.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseSetOption(); - while (reader.pos < end) { - let 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; - }; - - /** - * Decodes a ResponseSetOption message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.ResponseSetOption - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.ResponseSetOption} ResponseSetOption - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseSetOption.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ResponseSetOption message. - * @function verify - * @memberof tendermint.abci.ResponseSetOption - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ResponseSetOption.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.code != null && message.hasOwnProperty("code")) - if (!$util.isInteger(message.code)) - return "code: integer expected"; - if (message.log != null && message.hasOwnProperty("log")) - if (!$util.isString(message.log)) - return "log: string expected"; - if (message.info != null && message.hasOwnProperty("info")) - if (!$util.isString(message.info)) - return "info: string expected"; - return null; - }; - - /** - * Creates a ResponseSetOption message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.ResponseSetOption - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.ResponseSetOption} ResponseSetOption - */ - ResponseSetOption.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.ResponseSetOption) - return object; - let message = new $root.tendermint.abci.ResponseSetOption(); - if (object.code != null) - message.code = object.code >>> 0; - if (object.log != null) - message.log = String(object.log); - if (object.info != null) - message.info = String(object.info); - return message; - }; - - /** - * Creates a plain object from a ResponseSetOption message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.ResponseSetOption - * @static - * @param {tendermint.abci.ResponseSetOption} message ResponseSetOption - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ResponseSetOption.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.code = 0; - object.log = ""; - object.info = ""; - } - if (message.code != null && message.hasOwnProperty("code")) - object.code = message.code; - if (message.log != null && message.hasOwnProperty("log")) - object.log = message.log; - if (message.info != null && message.hasOwnProperty("info")) - object.info = message.info; - return object; - }; - - /** - * Converts this ResponseSetOption to JSON. - * @function toJSON - * @memberof tendermint.abci.ResponseSetOption - * @instance - * @returns {Object.} JSON object - */ - ResponseSetOption.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ResponseSetOption; - })(); - - abci.ResponseInitChain = (function() { - - /** - * Properties of a ResponseInitChain. - * @memberof tendermint.abci - * @interface IResponseInitChain - * @property {tendermint.abci.IConsensusParams|null} [consensus_params] ResponseInitChain consensus_params - * @property {Array.|null} [validators] ResponseInitChain validators - * @property {Uint8Array|null} [app_hash] ResponseInitChain app_hash - */ - - /** - * Constructs a new ResponseInitChain. - * @memberof tendermint.abci - * @classdesc Represents a ResponseInitChain. - * @implements IResponseInitChain - * @constructor - * @param {tendermint.abci.IResponseInitChain=} [properties] Properties to set - */ - function ResponseInitChain(properties) { - this.validators = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ResponseInitChain consensus_params. - * @member {tendermint.abci.IConsensusParams|null|undefined} consensus_params - * @memberof tendermint.abci.ResponseInitChain - * @instance - */ - ResponseInitChain.prototype.consensus_params = null; - - /** - * ResponseInitChain validators. - * @member {Array.} validators - * @memberof tendermint.abci.ResponseInitChain - * @instance - */ - ResponseInitChain.prototype.validators = $util.emptyArray; - - /** - * ResponseInitChain app_hash. - * @member {Uint8Array} app_hash - * @memberof tendermint.abci.ResponseInitChain - * @instance - */ - ResponseInitChain.prototype.app_hash = $util.newBuffer([]); - - /** - * Encodes the specified ResponseInitChain message. Does not implicitly {@link tendermint.abci.ResponseInitChain.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.ResponseInitChain - * @static - * @param {tendermint.abci.IResponseInitChain} message ResponseInitChain message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseInitChain.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.consensus_params != null && Object.hasOwnProperty.call(message, "consensus_params")) - $root.tendermint.abci.ConsensusParams.encode(message.consensus_params, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.validators != null && message.validators.length) - for (let i = 0; i < message.validators.length; ++i) - $root.tendermint.abci.ValidatorUpdate.encode(message.validators[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.app_hash != null && Object.hasOwnProperty.call(message, "app_hash")) - writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.app_hash); - return writer; - }; - - /** - * Encodes the specified ResponseInitChain message, length delimited. Does not implicitly {@link tendermint.abci.ResponseInitChain.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.ResponseInitChain - * @static - * @param {tendermint.abci.IResponseInitChain} message ResponseInitChain message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseInitChain.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ResponseInitChain message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.ResponseInitChain - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.ResponseInitChain} ResponseInitChain - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseInitChain.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseInitChain(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.consensus_params = $root.tendermint.abci.ConsensusParams.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.validators && message.validators.length)) - message.validators = []; - message.validators.push($root.tendermint.abci.ValidatorUpdate.decode(reader, reader.uint32())); - break; - case 3: - message.app_hash = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ResponseInitChain message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.ResponseInitChain - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.ResponseInitChain} ResponseInitChain - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseInitChain.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ResponseInitChain message. - * @function verify - * @memberof tendermint.abci.ResponseInitChain - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ResponseInitChain.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.consensus_params != null && message.hasOwnProperty("consensus_params")) { - let error = $root.tendermint.abci.ConsensusParams.verify(message.consensus_params); - if (error) - return "consensus_params." + error; - } - if (message.validators != null && message.hasOwnProperty("validators")) { - if (!Array.isArray(message.validators)) - return "validators: array expected"; - for (let i = 0; i < message.validators.length; ++i) { - let error = $root.tendermint.abci.ValidatorUpdate.verify(message.validators[i]); - if (error) - return "validators." + error; - } - } - if (message.app_hash != null && message.hasOwnProperty("app_hash")) - if (!(message.app_hash && typeof message.app_hash.length === "number" || $util.isString(message.app_hash))) - return "app_hash: buffer expected"; - return null; - }; - - /** - * Creates a ResponseInitChain message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.ResponseInitChain - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.ResponseInitChain} ResponseInitChain - */ - ResponseInitChain.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.ResponseInitChain) - return object; - let message = new $root.tendermint.abci.ResponseInitChain(); - if (object.consensus_params != null) { - if (typeof object.consensus_params !== "object") - throw TypeError(".tendermint.abci.ResponseInitChain.consensus_params: object expected"); - message.consensus_params = $root.tendermint.abci.ConsensusParams.fromObject(object.consensus_params); - } - if (object.validators) { - if (!Array.isArray(object.validators)) - throw TypeError(".tendermint.abci.ResponseInitChain.validators: array expected"); - message.validators = []; - for (let i = 0; i < object.validators.length; ++i) { - if (typeof object.validators[i] !== "object") - throw TypeError(".tendermint.abci.ResponseInitChain.validators: object expected"); - message.validators[i] = $root.tendermint.abci.ValidatorUpdate.fromObject(object.validators[i]); - } - } - if (object.app_hash != null) - if (typeof object.app_hash === "string") - $util.base64.decode(object.app_hash, message.app_hash = $util.newBuffer($util.base64.length(object.app_hash)), 0); - else if (object.app_hash.length) - message.app_hash = object.app_hash; - return message; - }; - - /** - * Creates a plain object from a ResponseInitChain message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.ResponseInitChain - * @static - * @param {tendermint.abci.ResponseInitChain} message ResponseInitChain - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ResponseInitChain.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.validators = []; - if (options.defaults) { - object.consensus_params = null; - if (options.bytes === String) - object.app_hash = ""; - else { - object.app_hash = []; - if (options.bytes !== Array) - object.app_hash = $util.newBuffer(object.app_hash); - } - } - if (message.consensus_params != null && message.hasOwnProperty("consensus_params")) - object.consensus_params = $root.tendermint.abci.ConsensusParams.toObject(message.consensus_params, options); - if (message.validators && message.validators.length) { - object.validators = []; - for (let j = 0; j < message.validators.length; ++j) - object.validators[j] = $root.tendermint.abci.ValidatorUpdate.toObject(message.validators[j], options); - } - if (message.app_hash != null && message.hasOwnProperty("app_hash")) - object.app_hash = options.bytes === String ? $util.base64.encode(message.app_hash, 0, message.app_hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.app_hash) : message.app_hash; - return object; - }; - - /** - * Converts this ResponseInitChain to JSON. - * @function toJSON - * @memberof tendermint.abci.ResponseInitChain - * @instance - * @returns {Object.} JSON object - */ - ResponseInitChain.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ResponseInitChain; - })(); - - abci.ResponseQuery = (function() { - - /** - * Properties of a ResponseQuery. - * @memberof tendermint.abci - * @interface IResponseQuery - * @property {number|null} [code] ResponseQuery code - * @property {string|null} [log] ResponseQuery log - * @property {string|null} [info] ResponseQuery info - * @property {Long|null} [index] ResponseQuery index - * @property {Uint8Array|null} [key] ResponseQuery key - * @property {Uint8Array|null} [value] ResponseQuery value - * @property {tendermint.crypto.IProofOps|null} [proof_ops] ResponseQuery proof_ops - * @property {Long|null} [height] ResponseQuery height - * @property {string|null} [codespace] ResponseQuery codespace - */ - - /** - * Constructs a new ResponseQuery. - * @memberof tendermint.abci - * @classdesc Represents a ResponseQuery. - * @implements IResponseQuery - * @constructor - * @param {tendermint.abci.IResponseQuery=} [properties] Properties to set - */ - function ResponseQuery(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ResponseQuery code. - * @member {number} code - * @memberof tendermint.abci.ResponseQuery - * @instance - */ - ResponseQuery.prototype.code = 0; - - /** - * ResponseQuery log. - * @member {string} log - * @memberof tendermint.abci.ResponseQuery - * @instance - */ - ResponseQuery.prototype.log = ""; - - /** - * ResponseQuery info. - * @member {string} info - * @memberof tendermint.abci.ResponseQuery - * @instance - */ - ResponseQuery.prototype.info = ""; - - /** - * ResponseQuery index. - * @member {Long} index - * @memberof tendermint.abci.ResponseQuery - * @instance - */ - ResponseQuery.prototype.index = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * ResponseQuery key. - * @member {Uint8Array} key - * @memberof tendermint.abci.ResponseQuery - * @instance - */ - ResponseQuery.prototype.key = $util.newBuffer([]); - - /** - * ResponseQuery value. - * @member {Uint8Array} value - * @memberof tendermint.abci.ResponseQuery - * @instance - */ - ResponseQuery.prototype.value = $util.newBuffer([]); - - /** - * ResponseQuery proof_ops. - * @member {tendermint.crypto.IProofOps|null|undefined} proof_ops - * @memberof tendermint.abci.ResponseQuery - * @instance - */ - ResponseQuery.prototype.proof_ops = null; - - /** - * ResponseQuery height. - * @member {Long} height - * @memberof tendermint.abci.ResponseQuery - * @instance - */ - ResponseQuery.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * ResponseQuery codespace. - * @member {string} codespace - * @memberof tendermint.abci.ResponseQuery - * @instance - */ - ResponseQuery.prototype.codespace = ""; - - /** - * Encodes the specified ResponseQuery message. Does not implicitly {@link tendermint.abci.ResponseQuery.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.ResponseQuery - * @static - * @param {tendermint.abci.IResponseQuery} message ResponseQuery message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseQuery.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.code != null && Object.hasOwnProperty.call(message, "code")) - writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.code); - if (message.log != null && Object.hasOwnProperty.call(message, "log")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.log); - if (message.info != null && Object.hasOwnProperty.call(message, "info")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.info); - if (message.index != null && Object.hasOwnProperty.call(message, "index")) - writer.uint32(/* id 5, wireType 0 =*/40).int64(message.index); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.key); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.value); - if (message.proof_ops != null && Object.hasOwnProperty.call(message, "proof_ops")) - $root.tendermint.crypto.ProofOps.encode(message.proof_ops, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 9, wireType 0 =*/72).int64(message.height); - if (message.codespace != null && Object.hasOwnProperty.call(message, "codespace")) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.codespace); - return writer; - }; - - /** - * Encodes the specified ResponseQuery message, length delimited. Does not implicitly {@link tendermint.abci.ResponseQuery.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.ResponseQuery - * @static - * @param {tendermint.abci.IResponseQuery} message ResponseQuery message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseQuery.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ResponseQuery message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.ResponseQuery - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.ResponseQuery} ResponseQuery - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseQuery.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseQuery(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.code = reader.uint32(); - break; - case 3: - message.log = reader.string(); - break; - case 4: - message.info = reader.string(); - break; - case 5: - message.index = reader.int64(); - break; - case 6: - message.key = reader.bytes(); - break; - case 7: - message.value = reader.bytes(); - break; - case 8: - message.proof_ops = $root.tendermint.crypto.ProofOps.decode(reader, reader.uint32()); - break; - case 9: - message.height = reader.int64(); - break; - case 10: - message.codespace = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ResponseQuery message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.ResponseQuery - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.ResponseQuery} ResponseQuery - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseQuery.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ResponseQuery message. - * @function verify - * @memberof tendermint.abci.ResponseQuery - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ResponseQuery.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.code != null && message.hasOwnProperty("code")) - if (!$util.isInteger(message.code)) - return "code: integer expected"; - if (message.log != null && message.hasOwnProperty("log")) - if (!$util.isString(message.log)) - return "log: string expected"; - if (message.info != null && message.hasOwnProperty("info")) - if (!$util.isString(message.info)) - return "info: string expected"; - if (message.index != null && message.hasOwnProperty("index")) - if (!$util.isInteger(message.index) && !(message.index && $util.isInteger(message.index.low) && $util.isInteger(message.index.high))) - return "index: integer|Long expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) - return "key: buffer expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) - return "value: buffer expected"; - if (message.proof_ops != null && message.hasOwnProperty("proof_ops")) { - let error = $root.tendermint.crypto.ProofOps.verify(message.proof_ops); - if (error) - return "proof_ops." + error; - } - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) - return "height: integer|Long expected"; - if (message.codespace != null && message.hasOwnProperty("codespace")) - if (!$util.isString(message.codespace)) - return "codespace: string expected"; - return null; - }; - - /** - * Creates a ResponseQuery message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.ResponseQuery - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.ResponseQuery} ResponseQuery - */ - ResponseQuery.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.ResponseQuery) - return object; - let message = new $root.tendermint.abci.ResponseQuery(); - if (object.code != null) - message.code = object.code >>> 0; - if (object.log != null) - message.log = String(object.log); - if (object.info != null) - message.info = String(object.info); - if (object.index != null) - if ($util.Long) - (message.index = $util.Long.fromValue(object.index)).unsigned = false; - else if (typeof object.index === "string") - message.index = parseInt(object.index, 10); - else if (typeof object.index === "number") - message.index = object.index; - else if (typeof object.index === "object") - message.index = new $util.LongBits(object.index.low >>> 0, object.index.high >>> 0).toNumber(); - if (object.key != null) - if (typeof object.key === "string") - $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); - else if (object.key.length) - message.key = object.key; - if (object.value != null) - if (typeof object.value === "string") - $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); - else if (object.value.length) - message.value = object.value; - if (object.proof_ops != null) { - if (typeof object.proof_ops !== "object") - throw TypeError(".tendermint.abci.ResponseQuery.proof_ops: object expected"); - message.proof_ops = $root.tendermint.crypto.ProofOps.fromObject(object.proof_ops); - } - if (object.height != null) - if ($util.Long) - (message.height = $util.Long.fromValue(object.height)).unsigned = false; - else if (typeof object.height === "string") - message.height = parseInt(object.height, 10); - else if (typeof object.height === "number") - message.height = object.height; - else if (typeof object.height === "object") - message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); - if (object.codespace != null) - message.codespace = String(object.codespace); - return message; - }; - - /** - * Creates a plain object from a ResponseQuery message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.ResponseQuery - * @static - * @param {tendermint.abci.ResponseQuery} message ResponseQuery - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ResponseQuery.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.code = 0; - object.log = ""; - object.info = ""; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.index = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.index = options.longs === String ? "0" : 0; - if (options.bytes === String) - object.key = ""; - else { - object.key = []; - if (options.bytes !== Array) - object.key = $util.newBuffer(object.key); - } - if (options.bytes === String) - object.value = ""; - else { - object.value = []; - if (options.bytes !== Array) - object.value = $util.newBuffer(object.value); - } - object.proof_ops = null; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.height = options.longs === String ? "0" : 0; - object.codespace = ""; - } - if (message.code != null && message.hasOwnProperty("code")) - object.code = message.code; - if (message.log != null && message.hasOwnProperty("log")) - object.log = message.log; - if (message.info != null && message.hasOwnProperty("info")) - object.info = message.info; - if (message.index != null && message.hasOwnProperty("index")) - if (typeof message.index === "number") - object.index = options.longs === String ? String(message.index) : message.index; - else - object.index = options.longs === String ? $util.Long.prototype.toString.call(message.index) : options.longs === Number ? new $util.LongBits(message.index.low >>> 0, message.index.high >>> 0).toNumber() : message.index; - if (message.key != null && message.hasOwnProperty("key")) - object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; - if (message.value != null && message.hasOwnProperty("value")) - object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; - if (message.proof_ops != null && message.hasOwnProperty("proof_ops")) - object.proof_ops = $root.tendermint.crypto.ProofOps.toObject(message.proof_ops, options); - if (message.height != null && message.hasOwnProperty("height")) - if (typeof message.height === "number") - object.height = options.longs === String ? String(message.height) : message.height; - else - object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; - if (message.codespace != null && message.hasOwnProperty("codespace")) - object.codespace = message.codespace; - return object; - }; - - /** - * Converts this ResponseQuery to JSON. - * @function toJSON - * @memberof tendermint.abci.ResponseQuery - * @instance - * @returns {Object.} JSON object - */ - ResponseQuery.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ResponseQuery; - })(); - - abci.ResponseBeginBlock = (function() { - - /** - * Properties of a ResponseBeginBlock. - * @memberof tendermint.abci - * @interface IResponseBeginBlock - * @property {Array.|null} [events] ResponseBeginBlock events - */ - - /** - * Constructs a new ResponseBeginBlock. - * @memberof tendermint.abci - * @classdesc Represents a ResponseBeginBlock. - * @implements IResponseBeginBlock - * @constructor - * @param {tendermint.abci.IResponseBeginBlock=} [properties] Properties to set - */ - function ResponseBeginBlock(properties) { - this.events = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ResponseBeginBlock events. - * @member {Array.} events - * @memberof tendermint.abci.ResponseBeginBlock - * @instance - */ - ResponseBeginBlock.prototype.events = $util.emptyArray; - - /** - * Encodes the specified ResponseBeginBlock message. Does not implicitly {@link tendermint.abci.ResponseBeginBlock.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.ResponseBeginBlock - * @static - * @param {tendermint.abci.IResponseBeginBlock} message ResponseBeginBlock message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseBeginBlock.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.events != null && message.events.length) - for (let i = 0; i < message.events.length; ++i) - $root.tendermint.abci.Event.encode(message.events[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ResponseBeginBlock message, length delimited. Does not implicitly {@link tendermint.abci.ResponseBeginBlock.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.ResponseBeginBlock - * @static - * @param {tendermint.abci.IResponseBeginBlock} message ResponseBeginBlock message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseBeginBlock.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ResponseBeginBlock message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.ResponseBeginBlock - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.ResponseBeginBlock} ResponseBeginBlock - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseBeginBlock.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseBeginBlock(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.events && message.events.length)) - message.events = []; - message.events.push($root.tendermint.abci.Event.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ResponseBeginBlock message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.ResponseBeginBlock - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.ResponseBeginBlock} ResponseBeginBlock - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseBeginBlock.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ResponseBeginBlock message. - * @function verify - * @memberof tendermint.abci.ResponseBeginBlock - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ResponseBeginBlock.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.events != null && message.hasOwnProperty("events")) { - if (!Array.isArray(message.events)) - return "events: array expected"; - for (let i = 0; i < message.events.length; ++i) { - let error = $root.tendermint.abci.Event.verify(message.events[i]); - if (error) - return "events." + error; - } - } - return null; - }; - - /** - * Creates a ResponseBeginBlock message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.ResponseBeginBlock - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.ResponseBeginBlock} ResponseBeginBlock - */ - ResponseBeginBlock.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.ResponseBeginBlock) - return object; - let message = new $root.tendermint.abci.ResponseBeginBlock(); - if (object.events) { - if (!Array.isArray(object.events)) - throw TypeError(".tendermint.abci.ResponseBeginBlock.events: array expected"); - message.events = []; - for (let i = 0; i < object.events.length; ++i) { - if (typeof object.events[i] !== "object") - throw TypeError(".tendermint.abci.ResponseBeginBlock.events: object expected"); - message.events[i] = $root.tendermint.abci.Event.fromObject(object.events[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a ResponseBeginBlock message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.ResponseBeginBlock - * @static - * @param {tendermint.abci.ResponseBeginBlock} message ResponseBeginBlock - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ResponseBeginBlock.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.events = []; - if (message.events && message.events.length) { - object.events = []; - for (let j = 0; j < message.events.length; ++j) - object.events[j] = $root.tendermint.abci.Event.toObject(message.events[j], options); - } - return object; - }; - - /** - * Converts this ResponseBeginBlock to JSON. - * @function toJSON - * @memberof tendermint.abci.ResponseBeginBlock - * @instance - * @returns {Object.} JSON object - */ - ResponseBeginBlock.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ResponseBeginBlock; - })(); - - abci.ResponseCheckTx = (function() { - - /** - * Properties of a ResponseCheckTx. - * @memberof tendermint.abci - * @interface IResponseCheckTx - * @property {number|null} [code] ResponseCheckTx code - * @property {Uint8Array|null} [data] ResponseCheckTx data - * @property {string|null} [log] ResponseCheckTx log - * @property {string|null} [info] ResponseCheckTx info - * @property {Long|null} [gas_wanted] ResponseCheckTx gas_wanted - * @property {Long|null} [gas_used] ResponseCheckTx gas_used - * @property {Array.|null} [events] ResponseCheckTx events - * @property {string|null} [codespace] ResponseCheckTx codespace - */ - - /** - * Constructs a new ResponseCheckTx. - * @memberof tendermint.abci - * @classdesc Represents a ResponseCheckTx. - * @implements IResponseCheckTx - * @constructor - * @param {tendermint.abci.IResponseCheckTx=} [properties] Properties to set - */ - function ResponseCheckTx(properties) { - this.events = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ResponseCheckTx code. - * @member {number} code - * @memberof tendermint.abci.ResponseCheckTx - * @instance - */ - ResponseCheckTx.prototype.code = 0; - - /** - * ResponseCheckTx data. - * @member {Uint8Array} data - * @memberof tendermint.abci.ResponseCheckTx - * @instance - */ - ResponseCheckTx.prototype.data = $util.newBuffer([]); - - /** - * ResponseCheckTx log. - * @member {string} log - * @memberof tendermint.abci.ResponseCheckTx - * @instance - */ - ResponseCheckTx.prototype.log = ""; - - /** - * ResponseCheckTx info. - * @member {string} info - * @memberof tendermint.abci.ResponseCheckTx - * @instance - */ - ResponseCheckTx.prototype.info = ""; - - /** - * ResponseCheckTx gas_wanted. - * @member {Long} gas_wanted - * @memberof tendermint.abci.ResponseCheckTx - * @instance - */ - ResponseCheckTx.prototype.gas_wanted = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * ResponseCheckTx gas_used. - * @member {Long} gas_used - * @memberof tendermint.abci.ResponseCheckTx - * @instance - */ - ResponseCheckTx.prototype.gas_used = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * ResponseCheckTx events. - * @member {Array.} events - * @memberof tendermint.abci.ResponseCheckTx - * @instance - */ - ResponseCheckTx.prototype.events = $util.emptyArray; - - /** - * ResponseCheckTx codespace. - * @member {string} codespace - * @memberof tendermint.abci.ResponseCheckTx - * @instance - */ - ResponseCheckTx.prototype.codespace = ""; - - /** - * Encodes the specified ResponseCheckTx message. Does not implicitly {@link tendermint.abci.ResponseCheckTx.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.ResponseCheckTx - * @static - * @param {tendermint.abci.IResponseCheckTx} message ResponseCheckTx message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseCheckTx.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.code != null && Object.hasOwnProperty.call(message, "code")) - writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.code); - if (message.data != null && Object.hasOwnProperty.call(message, "data")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.data); - if (message.log != null && Object.hasOwnProperty.call(message, "log")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.log); - if (message.info != null && Object.hasOwnProperty.call(message, "info")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.info); - if (message.gas_wanted != null && Object.hasOwnProperty.call(message, "gas_wanted")) - writer.uint32(/* id 5, wireType 0 =*/40).int64(message.gas_wanted); - if (message.gas_used != null && Object.hasOwnProperty.call(message, "gas_used")) - writer.uint32(/* id 6, wireType 0 =*/48).int64(message.gas_used); - if (message.events != null && message.events.length) - for (let i = 0; i < message.events.length; ++i) - $root.tendermint.abci.Event.encode(message.events[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.codespace != null && Object.hasOwnProperty.call(message, "codespace")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.codespace); - return writer; - }; - - /** - * Encodes the specified ResponseCheckTx message, length delimited. Does not implicitly {@link tendermint.abci.ResponseCheckTx.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.ResponseCheckTx - * @static - * @param {tendermint.abci.IResponseCheckTx} message ResponseCheckTx message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseCheckTx.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ResponseCheckTx message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.ResponseCheckTx - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.ResponseCheckTx} ResponseCheckTx - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseCheckTx.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseCheckTx(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.code = reader.uint32(); - break; - case 2: - message.data = reader.bytes(); - break; - case 3: - message.log = reader.string(); - break; - case 4: - message.info = reader.string(); - break; - case 5: - message.gas_wanted = reader.int64(); - break; - case 6: - message.gas_used = reader.int64(); - break; - case 7: - if (!(message.events && message.events.length)) - message.events = []; - message.events.push($root.tendermint.abci.Event.decode(reader, reader.uint32())); - break; - case 8: - message.codespace = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ResponseCheckTx message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.ResponseCheckTx - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.ResponseCheckTx} ResponseCheckTx - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseCheckTx.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ResponseCheckTx message. - * @function verify - * @memberof tendermint.abci.ResponseCheckTx - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ResponseCheckTx.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.code != null && message.hasOwnProperty("code")) - if (!$util.isInteger(message.code)) - return "code: integer expected"; - if (message.data != null && message.hasOwnProperty("data")) - if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) - return "data: buffer expected"; - if (message.log != null && message.hasOwnProperty("log")) - if (!$util.isString(message.log)) - return "log: string expected"; - if (message.info != null && message.hasOwnProperty("info")) - if (!$util.isString(message.info)) - return "info: string expected"; - if (message.gas_wanted != null && message.hasOwnProperty("gas_wanted")) - if (!$util.isInteger(message.gas_wanted) && !(message.gas_wanted && $util.isInteger(message.gas_wanted.low) && $util.isInteger(message.gas_wanted.high))) - return "gas_wanted: integer|Long expected"; - if (message.gas_used != null && message.hasOwnProperty("gas_used")) - if (!$util.isInteger(message.gas_used) && !(message.gas_used && $util.isInteger(message.gas_used.low) && $util.isInteger(message.gas_used.high))) - return "gas_used: integer|Long expected"; - if (message.events != null && message.hasOwnProperty("events")) { - if (!Array.isArray(message.events)) - return "events: array expected"; - for (let i = 0; i < message.events.length; ++i) { - let error = $root.tendermint.abci.Event.verify(message.events[i]); - if (error) - return "events." + error; - } - } - if (message.codespace != null && message.hasOwnProperty("codespace")) - if (!$util.isString(message.codespace)) - return "codespace: string expected"; - return null; - }; - - /** - * Creates a ResponseCheckTx message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.ResponseCheckTx - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.ResponseCheckTx} ResponseCheckTx - */ - ResponseCheckTx.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.ResponseCheckTx) - return object; - let message = new $root.tendermint.abci.ResponseCheckTx(); - if (object.code != null) - message.code = object.code >>> 0; - if (object.data != null) - if (typeof object.data === "string") - $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); - else if (object.data.length) - message.data = object.data; - if (object.log != null) - message.log = String(object.log); - if (object.info != null) - message.info = String(object.info); - if (object.gas_wanted != null) - if ($util.Long) - (message.gas_wanted = $util.Long.fromValue(object.gas_wanted)).unsigned = false; - else if (typeof object.gas_wanted === "string") - message.gas_wanted = parseInt(object.gas_wanted, 10); - else if (typeof object.gas_wanted === "number") - message.gas_wanted = object.gas_wanted; - else if (typeof object.gas_wanted === "object") - message.gas_wanted = new $util.LongBits(object.gas_wanted.low >>> 0, object.gas_wanted.high >>> 0).toNumber(); - if (object.gas_used != null) - if ($util.Long) - (message.gas_used = $util.Long.fromValue(object.gas_used)).unsigned = false; - else if (typeof object.gas_used === "string") - message.gas_used = parseInt(object.gas_used, 10); - else if (typeof object.gas_used === "number") - message.gas_used = object.gas_used; - else if (typeof object.gas_used === "object") - message.gas_used = new $util.LongBits(object.gas_used.low >>> 0, object.gas_used.high >>> 0).toNumber(); - if (object.events) { - if (!Array.isArray(object.events)) - throw TypeError(".tendermint.abci.ResponseCheckTx.events: array expected"); - message.events = []; - for (let i = 0; i < object.events.length; ++i) { - if (typeof object.events[i] !== "object") - throw TypeError(".tendermint.abci.ResponseCheckTx.events: object expected"); - message.events[i] = $root.tendermint.abci.Event.fromObject(object.events[i]); - } - } - if (object.codespace != null) - message.codespace = String(object.codespace); - return message; - }; - - /** - * Creates a plain object from a ResponseCheckTx message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.ResponseCheckTx - * @static - * @param {tendermint.abci.ResponseCheckTx} message ResponseCheckTx - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ResponseCheckTx.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.events = []; - if (options.defaults) { - object.code = 0; - if (options.bytes === String) - object.data = ""; - else { - object.data = []; - if (options.bytes !== Array) - object.data = $util.newBuffer(object.data); - } - object.log = ""; - object.info = ""; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.gas_wanted = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.gas_wanted = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.gas_used = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.gas_used = options.longs === String ? "0" : 0; - object.codespace = ""; - } - if (message.code != null && message.hasOwnProperty("code")) - object.code = message.code; - if (message.data != null && message.hasOwnProperty("data")) - object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; - if (message.log != null && message.hasOwnProperty("log")) - object.log = message.log; - if (message.info != null && message.hasOwnProperty("info")) - object.info = message.info; - if (message.gas_wanted != null && message.hasOwnProperty("gas_wanted")) - if (typeof message.gas_wanted === "number") - object.gas_wanted = options.longs === String ? String(message.gas_wanted) : message.gas_wanted; - else - object.gas_wanted = options.longs === String ? $util.Long.prototype.toString.call(message.gas_wanted) : options.longs === Number ? new $util.LongBits(message.gas_wanted.low >>> 0, message.gas_wanted.high >>> 0).toNumber() : message.gas_wanted; - if (message.gas_used != null && message.hasOwnProperty("gas_used")) - if (typeof message.gas_used === "number") - object.gas_used = options.longs === String ? String(message.gas_used) : message.gas_used; - else - object.gas_used = options.longs === String ? $util.Long.prototype.toString.call(message.gas_used) : options.longs === Number ? new $util.LongBits(message.gas_used.low >>> 0, message.gas_used.high >>> 0).toNumber() : message.gas_used; - if (message.events && message.events.length) { - object.events = []; - for (let j = 0; j < message.events.length; ++j) - object.events[j] = $root.tendermint.abci.Event.toObject(message.events[j], options); - } - if (message.codespace != null && message.hasOwnProperty("codespace")) - object.codespace = message.codespace; - return object; - }; - - /** - * Converts this ResponseCheckTx to JSON. - * @function toJSON - * @memberof tendermint.abci.ResponseCheckTx - * @instance - * @returns {Object.} JSON object - */ - ResponseCheckTx.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ResponseCheckTx; - })(); - - abci.ResponseDeliverTx = (function() { - - /** - * Properties of a ResponseDeliverTx. - * @memberof tendermint.abci - * @interface IResponseDeliverTx - * @property {number|null} [code] ResponseDeliverTx code - * @property {Uint8Array|null} [data] ResponseDeliverTx data - * @property {string|null} [log] ResponseDeliverTx log - * @property {string|null} [info] ResponseDeliverTx info - * @property {Long|null} [gas_wanted] ResponseDeliverTx gas_wanted - * @property {Long|null} [gas_used] ResponseDeliverTx gas_used - * @property {Array.|null} [events] ResponseDeliverTx events - * @property {string|null} [codespace] ResponseDeliverTx codespace - */ - - /** - * Constructs a new ResponseDeliverTx. - * @memberof tendermint.abci - * @classdesc Represents a ResponseDeliverTx. - * @implements IResponseDeliverTx - * @constructor - * @param {tendermint.abci.IResponseDeliverTx=} [properties] Properties to set - */ - function ResponseDeliverTx(properties) { - this.events = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ResponseDeliverTx code. - * @member {number} code - * @memberof tendermint.abci.ResponseDeliverTx - * @instance - */ - ResponseDeliverTx.prototype.code = 0; - - /** - * ResponseDeliverTx data. - * @member {Uint8Array} data - * @memberof tendermint.abci.ResponseDeliverTx - * @instance - */ - ResponseDeliverTx.prototype.data = $util.newBuffer([]); - - /** - * ResponseDeliverTx log. - * @member {string} log - * @memberof tendermint.abci.ResponseDeliverTx - * @instance - */ - ResponseDeliverTx.prototype.log = ""; - - /** - * ResponseDeliverTx info. - * @member {string} info - * @memberof tendermint.abci.ResponseDeliverTx - * @instance - */ - ResponseDeliverTx.prototype.info = ""; - - /** - * ResponseDeliverTx gas_wanted. - * @member {Long} gas_wanted - * @memberof tendermint.abci.ResponseDeliverTx - * @instance - */ - ResponseDeliverTx.prototype.gas_wanted = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * ResponseDeliverTx gas_used. - * @member {Long} gas_used - * @memberof tendermint.abci.ResponseDeliverTx - * @instance - */ - ResponseDeliverTx.prototype.gas_used = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * ResponseDeliverTx events. - * @member {Array.} events - * @memberof tendermint.abci.ResponseDeliverTx - * @instance - */ - ResponseDeliverTx.prototype.events = $util.emptyArray; - - /** - * ResponseDeliverTx codespace. - * @member {string} codespace - * @memberof tendermint.abci.ResponseDeliverTx - * @instance - */ - ResponseDeliverTx.prototype.codespace = ""; - - /** - * Encodes the specified ResponseDeliverTx message. Does not implicitly {@link tendermint.abci.ResponseDeliverTx.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.ResponseDeliverTx - * @static - * @param {tendermint.abci.IResponseDeliverTx} message ResponseDeliverTx message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseDeliverTx.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.code != null && Object.hasOwnProperty.call(message, "code")) - writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.code); - if (message.data != null && Object.hasOwnProperty.call(message, "data")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.data); - if (message.log != null && Object.hasOwnProperty.call(message, "log")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.log); - if (message.info != null && Object.hasOwnProperty.call(message, "info")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.info); - if (message.gas_wanted != null && Object.hasOwnProperty.call(message, "gas_wanted")) - writer.uint32(/* id 5, wireType 0 =*/40).int64(message.gas_wanted); - if (message.gas_used != null && Object.hasOwnProperty.call(message, "gas_used")) - writer.uint32(/* id 6, wireType 0 =*/48).int64(message.gas_used); - if (message.events != null && message.events.length) - for (let i = 0; i < message.events.length; ++i) - $root.tendermint.abci.Event.encode(message.events[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.codespace != null && Object.hasOwnProperty.call(message, "codespace")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.codespace); - return writer; - }; - - /** - * Encodes the specified ResponseDeliverTx message, length delimited. Does not implicitly {@link tendermint.abci.ResponseDeliverTx.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.ResponseDeliverTx - * @static - * @param {tendermint.abci.IResponseDeliverTx} message ResponseDeliverTx message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseDeliverTx.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ResponseDeliverTx message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.ResponseDeliverTx - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.ResponseDeliverTx} ResponseDeliverTx - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseDeliverTx.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseDeliverTx(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.code = reader.uint32(); - break; - case 2: - message.data = reader.bytes(); - break; - case 3: - message.log = reader.string(); - break; - case 4: - message.info = reader.string(); - break; - case 5: - message.gas_wanted = reader.int64(); - break; - case 6: - message.gas_used = reader.int64(); - break; - case 7: - if (!(message.events && message.events.length)) - message.events = []; - message.events.push($root.tendermint.abci.Event.decode(reader, reader.uint32())); - break; - case 8: - message.codespace = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ResponseDeliverTx message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.ResponseDeliverTx - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.ResponseDeliverTx} ResponseDeliverTx - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseDeliverTx.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ResponseDeliverTx message. - * @function verify - * @memberof tendermint.abci.ResponseDeliverTx - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ResponseDeliverTx.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.code != null && message.hasOwnProperty("code")) - if (!$util.isInteger(message.code)) - return "code: integer expected"; - if (message.data != null && message.hasOwnProperty("data")) - if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) - return "data: buffer expected"; - if (message.log != null && message.hasOwnProperty("log")) - if (!$util.isString(message.log)) - return "log: string expected"; - if (message.info != null && message.hasOwnProperty("info")) - if (!$util.isString(message.info)) - return "info: string expected"; - if (message.gas_wanted != null && message.hasOwnProperty("gas_wanted")) - if (!$util.isInteger(message.gas_wanted) && !(message.gas_wanted && $util.isInteger(message.gas_wanted.low) && $util.isInteger(message.gas_wanted.high))) - return "gas_wanted: integer|Long expected"; - if (message.gas_used != null && message.hasOwnProperty("gas_used")) - if (!$util.isInteger(message.gas_used) && !(message.gas_used && $util.isInteger(message.gas_used.low) && $util.isInteger(message.gas_used.high))) - return "gas_used: integer|Long expected"; - if (message.events != null && message.hasOwnProperty("events")) { - if (!Array.isArray(message.events)) - return "events: array expected"; - for (let i = 0; i < message.events.length; ++i) { - let error = $root.tendermint.abci.Event.verify(message.events[i]); - if (error) - return "events." + error; - } - } - if (message.codespace != null && message.hasOwnProperty("codespace")) - if (!$util.isString(message.codespace)) - return "codespace: string expected"; - return null; - }; - - /** - * Creates a ResponseDeliverTx message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.ResponseDeliverTx - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.ResponseDeliverTx} ResponseDeliverTx - */ - ResponseDeliverTx.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.ResponseDeliverTx) - return object; - let message = new $root.tendermint.abci.ResponseDeliverTx(); - if (object.code != null) - message.code = object.code >>> 0; - if (object.data != null) - if (typeof object.data === "string") - $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); - else if (object.data.length) - message.data = object.data; - if (object.log != null) - message.log = String(object.log); - if (object.info != null) - message.info = String(object.info); - if (object.gas_wanted != null) - if ($util.Long) - (message.gas_wanted = $util.Long.fromValue(object.gas_wanted)).unsigned = false; - else if (typeof object.gas_wanted === "string") - message.gas_wanted = parseInt(object.gas_wanted, 10); - else if (typeof object.gas_wanted === "number") - message.gas_wanted = object.gas_wanted; - else if (typeof object.gas_wanted === "object") - message.gas_wanted = new $util.LongBits(object.gas_wanted.low >>> 0, object.gas_wanted.high >>> 0).toNumber(); - if (object.gas_used != null) - if ($util.Long) - (message.gas_used = $util.Long.fromValue(object.gas_used)).unsigned = false; - else if (typeof object.gas_used === "string") - message.gas_used = parseInt(object.gas_used, 10); - else if (typeof object.gas_used === "number") - message.gas_used = object.gas_used; - else if (typeof object.gas_used === "object") - message.gas_used = new $util.LongBits(object.gas_used.low >>> 0, object.gas_used.high >>> 0).toNumber(); - if (object.events) { - if (!Array.isArray(object.events)) - throw TypeError(".tendermint.abci.ResponseDeliverTx.events: array expected"); - message.events = []; - for (let i = 0; i < object.events.length; ++i) { - if (typeof object.events[i] !== "object") - throw TypeError(".tendermint.abci.ResponseDeliverTx.events: object expected"); - message.events[i] = $root.tendermint.abci.Event.fromObject(object.events[i]); - } - } - if (object.codespace != null) - message.codespace = String(object.codespace); - return message; - }; - - /** - * Creates a plain object from a ResponseDeliverTx message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.ResponseDeliverTx - * @static - * @param {tendermint.abci.ResponseDeliverTx} message ResponseDeliverTx - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ResponseDeliverTx.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.events = []; - if (options.defaults) { - object.code = 0; - if (options.bytes === String) - object.data = ""; - else { - object.data = []; - if (options.bytes !== Array) - object.data = $util.newBuffer(object.data); - } - object.log = ""; - object.info = ""; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.gas_wanted = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.gas_wanted = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.gas_used = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.gas_used = options.longs === String ? "0" : 0; - object.codespace = ""; - } - if (message.code != null && message.hasOwnProperty("code")) - object.code = message.code; - if (message.data != null && message.hasOwnProperty("data")) - object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; - if (message.log != null && message.hasOwnProperty("log")) - object.log = message.log; - if (message.info != null && message.hasOwnProperty("info")) - object.info = message.info; - if (message.gas_wanted != null && message.hasOwnProperty("gas_wanted")) - if (typeof message.gas_wanted === "number") - object.gas_wanted = options.longs === String ? String(message.gas_wanted) : message.gas_wanted; - else - object.gas_wanted = options.longs === String ? $util.Long.prototype.toString.call(message.gas_wanted) : options.longs === Number ? new $util.LongBits(message.gas_wanted.low >>> 0, message.gas_wanted.high >>> 0).toNumber() : message.gas_wanted; - if (message.gas_used != null && message.hasOwnProperty("gas_used")) - if (typeof message.gas_used === "number") - object.gas_used = options.longs === String ? String(message.gas_used) : message.gas_used; - else - object.gas_used = options.longs === String ? $util.Long.prototype.toString.call(message.gas_used) : options.longs === Number ? new $util.LongBits(message.gas_used.low >>> 0, message.gas_used.high >>> 0).toNumber() : message.gas_used; - if (message.events && message.events.length) { - object.events = []; - for (let j = 0; j < message.events.length; ++j) - object.events[j] = $root.tendermint.abci.Event.toObject(message.events[j], options); - } - if (message.codespace != null && message.hasOwnProperty("codespace")) - object.codespace = message.codespace; - return object; - }; - - /** - * Converts this ResponseDeliverTx to JSON. - * @function toJSON - * @memberof tendermint.abci.ResponseDeliverTx - * @instance - * @returns {Object.} JSON object - */ - ResponseDeliverTx.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ResponseDeliverTx; - })(); - - abci.ResponseEndBlock = (function() { - - /** - * Properties of a ResponseEndBlock. - * @memberof tendermint.abci - * @interface IResponseEndBlock - * @property {Array.|null} [validator_updates] ResponseEndBlock validator_updates - * @property {tendermint.abci.IConsensusParams|null} [consensus_param_updates] ResponseEndBlock consensus_param_updates - * @property {Array.|null} [events] ResponseEndBlock events - */ - - /** - * Constructs a new ResponseEndBlock. - * @memberof tendermint.abci - * @classdesc Represents a ResponseEndBlock. - * @implements IResponseEndBlock - * @constructor - * @param {tendermint.abci.IResponseEndBlock=} [properties] Properties to set - */ - function ResponseEndBlock(properties) { - this.validator_updates = []; - this.events = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ResponseEndBlock validator_updates. - * @member {Array.} validator_updates - * @memberof tendermint.abci.ResponseEndBlock - * @instance - */ - ResponseEndBlock.prototype.validator_updates = $util.emptyArray; - - /** - * ResponseEndBlock consensus_param_updates. - * @member {tendermint.abci.IConsensusParams|null|undefined} consensus_param_updates - * @memberof tendermint.abci.ResponseEndBlock - * @instance - */ - ResponseEndBlock.prototype.consensus_param_updates = null; - - /** - * ResponseEndBlock events. - * @member {Array.} events - * @memberof tendermint.abci.ResponseEndBlock - * @instance - */ - ResponseEndBlock.prototype.events = $util.emptyArray; - - /** - * Encodes the specified ResponseEndBlock message. Does not implicitly {@link tendermint.abci.ResponseEndBlock.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.ResponseEndBlock - * @static - * @param {tendermint.abci.IResponseEndBlock} message ResponseEndBlock message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseEndBlock.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.validator_updates != null && message.validator_updates.length) - for (let i = 0; i < message.validator_updates.length; ++i) - $root.tendermint.abci.ValidatorUpdate.encode(message.validator_updates[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.consensus_param_updates != null && Object.hasOwnProperty.call(message, "consensus_param_updates")) - $root.tendermint.abci.ConsensusParams.encode(message.consensus_param_updates, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.events != null && message.events.length) - for (let i = 0; i < message.events.length; ++i) - $root.tendermint.abci.Event.encode(message.events[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ResponseEndBlock message, length delimited. Does not implicitly {@link tendermint.abci.ResponseEndBlock.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.ResponseEndBlock - * @static - * @param {tendermint.abci.IResponseEndBlock} message ResponseEndBlock message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseEndBlock.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ResponseEndBlock message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.ResponseEndBlock - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.ResponseEndBlock} ResponseEndBlock - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseEndBlock.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseEndBlock(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.validator_updates && message.validator_updates.length)) - message.validator_updates = []; - message.validator_updates.push($root.tendermint.abci.ValidatorUpdate.decode(reader, reader.uint32())); - break; - case 2: - message.consensus_param_updates = $root.tendermint.abci.ConsensusParams.decode(reader, reader.uint32()); - break; - case 3: - if (!(message.events && message.events.length)) - message.events = []; - message.events.push($root.tendermint.abci.Event.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ResponseEndBlock message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.ResponseEndBlock - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.ResponseEndBlock} ResponseEndBlock - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseEndBlock.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ResponseEndBlock message. - * @function verify - * @memberof tendermint.abci.ResponseEndBlock - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ResponseEndBlock.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.validator_updates != null && message.hasOwnProperty("validator_updates")) { - if (!Array.isArray(message.validator_updates)) - return "validator_updates: array expected"; - for (let i = 0; i < message.validator_updates.length; ++i) { - let error = $root.tendermint.abci.ValidatorUpdate.verify(message.validator_updates[i]); - if (error) - return "validator_updates." + error; - } - } - if (message.consensus_param_updates != null && message.hasOwnProperty("consensus_param_updates")) { - let error = $root.tendermint.abci.ConsensusParams.verify(message.consensus_param_updates); - if (error) - return "consensus_param_updates." + error; - } - if (message.events != null && message.hasOwnProperty("events")) { - if (!Array.isArray(message.events)) - return "events: array expected"; - for (let i = 0; i < message.events.length; ++i) { - let error = $root.tendermint.abci.Event.verify(message.events[i]); - if (error) - return "events." + error; - } - } - return null; - }; - - /** - * Creates a ResponseEndBlock message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.ResponseEndBlock - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.ResponseEndBlock} ResponseEndBlock - */ - ResponseEndBlock.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.ResponseEndBlock) - return object; - let message = new $root.tendermint.abci.ResponseEndBlock(); - if (object.validator_updates) { - if (!Array.isArray(object.validator_updates)) - throw TypeError(".tendermint.abci.ResponseEndBlock.validator_updates: array expected"); - message.validator_updates = []; - for (let i = 0; i < object.validator_updates.length; ++i) { - if (typeof object.validator_updates[i] !== "object") - throw TypeError(".tendermint.abci.ResponseEndBlock.validator_updates: object expected"); - message.validator_updates[i] = $root.tendermint.abci.ValidatorUpdate.fromObject(object.validator_updates[i]); - } - } - if (object.consensus_param_updates != null) { - if (typeof object.consensus_param_updates !== "object") - throw TypeError(".tendermint.abci.ResponseEndBlock.consensus_param_updates: object expected"); - message.consensus_param_updates = $root.tendermint.abci.ConsensusParams.fromObject(object.consensus_param_updates); - } - if (object.events) { - if (!Array.isArray(object.events)) - throw TypeError(".tendermint.abci.ResponseEndBlock.events: array expected"); - message.events = []; - for (let i = 0; i < object.events.length; ++i) { - if (typeof object.events[i] !== "object") - throw TypeError(".tendermint.abci.ResponseEndBlock.events: object expected"); - message.events[i] = $root.tendermint.abci.Event.fromObject(object.events[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a ResponseEndBlock message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.ResponseEndBlock - * @static - * @param {tendermint.abci.ResponseEndBlock} message ResponseEndBlock - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ResponseEndBlock.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) { - object.validator_updates = []; - object.events = []; - } - if (options.defaults) - object.consensus_param_updates = null; - if (message.validator_updates && message.validator_updates.length) { - object.validator_updates = []; - for (let j = 0; j < message.validator_updates.length; ++j) - object.validator_updates[j] = $root.tendermint.abci.ValidatorUpdate.toObject(message.validator_updates[j], options); - } - if (message.consensus_param_updates != null && message.hasOwnProperty("consensus_param_updates")) - object.consensus_param_updates = $root.tendermint.abci.ConsensusParams.toObject(message.consensus_param_updates, options); - if (message.events && message.events.length) { - object.events = []; - for (let j = 0; j < message.events.length; ++j) - object.events[j] = $root.tendermint.abci.Event.toObject(message.events[j], options); - } - return object; - }; - - /** - * Converts this ResponseEndBlock to JSON. - * @function toJSON - * @memberof tendermint.abci.ResponseEndBlock - * @instance - * @returns {Object.} JSON object - */ - ResponseEndBlock.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ResponseEndBlock; - })(); - - abci.ResponseCommit = (function() { - - /** - * Properties of a ResponseCommit. - * @memberof tendermint.abci - * @interface IResponseCommit - * @property {Uint8Array|null} [data] ResponseCommit data - * @property {Long|null} [retain_height] ResponseCommit retain_height - */ - - /** - * Constructs a new ResponseCommit. - * @memberof tendermint.abci - * @classdesc Represents a ResponseCommit. - * @implements IResponseCommit - * @constructor - * @param {tendermint.abci.IResponseCommit=} [properties] Properties to set - */ - function ResponseCommit(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ResponseCommit data. - * @member {Uint8Array} data - * @memberof tendermint.abci.ResponseCommit - * @instance - */ - ResponseCommit.prototype.data = $util.newBuffer([]); - - /** - * ResponseCommit retain_height. - * @member {Long} retain_height - * @memberof tendermint.abci.ResponseCommit - * @instance - */ - ResponseCommit.prototype.retain_height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Encodes the specified ResponseCommit message. Does not implicitly {@link tendermint.abci.ResponseCommit.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.ResponseCommit - * @static - * @param {tendermint.abci.IResponseCommit} message ResponseCommit message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseCommit.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.data != null && Object.hasOwnProperty.call(message, "data")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.data); - if (message.retain_height != null && Object.hasOwnProperty.call(message, "retain_height")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.retain_height); - return writer; - }; - - /** - * Encodes the specified ResponseCommit message, length delimited. Does not implicitly {@link tendermint.abci.ResponseCommit.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.ResponseCommit - * @static - * @param {tendermint.abci.IResponseCommit} message ResponseCommit message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseCommit.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ResponseCommit message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.ResponseCommit - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.ResponseCommit} ResponseCommit - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseCommit.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseCommit(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 2: - message.data = reader.bytes(); - break; - case 3: - message.retain_height = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ResponseCommit message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.ResponseCommit - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.ResponseCommit} ResponseCommit - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseCommit.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ResponseCommit message. - * @function verify - * @memberof tendermint.abci.ResponseCommit - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ResponseCommit.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.data != null && message.hasOwnProperty("data")) - if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) - return "data: buffer expected"; - if (message.retain_height != null && message.hasOwnProperty("retain_height")) - if (!$util.isInteger(message.retain_height) && !(message.retain_height && $util.isInteger(message.retain_height.low) && $util.isInteger(message.retain_height.high))) - return "retain_height: integer|Long expected"; - return null; - }; - - /** - * Creates a ResponseCommit message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.ResponseCommit - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.ResponseCommit} ResponseCommit - */ - ResponseCommit.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.ResponseCommit) - return object; - let message = new $root.tendermint.abci.ResponseCommit(); - if (object.data != null) - if (typeof object.data === "string") - $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); - else if (object.data.length) - message.data = object.data; - if (object.retain_height != null) - if ($util.Long) - (message.retain_height = $util.Long.fromValue(object.retain_height)).unsigned = false; - else if (typeof object.retain_height === "string") - message.retain_height = parseInt(object.retain_height, 10); - else if (typeof object.retain_height === "number") - message.retain_height = object.retain_height; - else if (typeof object.retain_height === "object") - message.retain_height = new $util.LongBits(object.retain_height.low >>> 0, object.retain_height.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a ResponseCommit message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.ResponseCommit - * @static - * @param {tendermint.abci.ResponseCommit} message ResponseCommit - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ResponseCommit.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if (options.bytes === String) - object.data = ""; - else { - object.data = []; - if (options.bytes !== Array) - object.data = $util.newBuffer(object.data); - } - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.retain_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.retain_height = options.longs === String ? "0" : 0; - } - if (message.data != null && message.hasOwnProperty("data")) - object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; - if (message.retain_height != null && message.hasOwnProperty("retain_height")) - if (typeof message.retain_height === "number") - object.retain_height = options.longs === String ? String(message.retain_height) : message.retain_height; - else - object.retain_height = options.longs === String ? $util.Long.prototype.toString.call(message.retain_height) : options.longs === Number ? new $util.LongBits(message.retain_height.low >>> 0, message.retain_height.high >>> 0).toNumber() : message.retain_height; - return object; - }; - - /** - * Converts this ResponseCommit to JSON. - * @function toJSON - * @memberof tendermint.abci.ResponseCommit - * @instance - * @returns {Object.} JSON object - */ - ResponseCommit.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ResponseCommit; - })(); - - abci.ResponseListSnapshots = (function() { - - /** - * Properties of a ResponseListSnapshots. - * @memberof tendermint.abci - * @interface IResponseListSnapshots - * @property {Array.|null} [snapshots] ResponseListSnapshots snapshots - */ - - /** - * Constructs a new ResponseListSnapshots. - * @memberof tendermint.abci - * @classdesc Represents a ResponseListSnapshots. - * @implements IResponseListSnapshots - * @constructor - * @param {tendermint.abci.IResponseListSnapshots=} [properties] Properties to set - */ - function ResponseListSnapshots(properties) { - this.snapshots = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ResponseListSnapshots snapshots. - * @member {Array.} snapshots - * @memberof tendermint.abci.ResponseListSnapshots - * @instance - */ - ResponseListSnapshots.prototype.snapshots = $util.emptyArray; - - /** - * Encodes the specified ResponseListSnapshots message. Does not implicitly {@link tendermint.abci.ResponseListSnapshots.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.ResponseListSnapshots - * @static - * @param {tendermint.abci.IResponseListSnapshots} message ResponseListSnapshots message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseListSnapshots.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.snapshots != null && message.snapshots.length) - for (let i = 0; i < message.snapshots.length; ++i) - $root.tendermint.abci.Snapshot.encode(message.snapshots[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ResponseListSnapshots message, length delimited. Does not implicitly {@link tendermint.abci.ResponseListSnapshots.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.ResponseListSnapshots - * @static - * @param {tendermint.abci.IResponseListSnapshots} message ResponseListSnapshots message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseListSnapshots.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ResponseListSnapshots message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.ResponseListSnapshots - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.ResponseListSnapshots} ResponseListSnapshots - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseListSnapshots.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseListSnapshots(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.snapshots && message.snapshots.length)) - message.snapshots = []; - message.snapshots.push($root.tendermint.abci.Snapshot.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ResponseListSnapshots message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.ResponseListSnapshots - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.ResponseListSnapshots} ResponseListSnapshots - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseListSnapshots.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ResponseListSnapshots message. - * @function verify - * @memberof tendermint.abci.ResponseListSnapshots - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ResponseListSnapshots.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.snapshots != null && message.hasOwnProperty("snapshots")) { - if (!Array.isArray(message.snapshots)) - return "snapshots: array expected"; - for (let i = 0; i < message.snapshots.length; ++i) { - let error = $root.tendermint.abci.Snapshot.verify(message.snapshots[i]); - if (error) - return "snapshots." + error; - } - } - return null; - }; - - /** - * Creates a ResponseListSnapshots message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.ResponseListSnapshots - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.ResponseListSnapshots} ResponseListSnapshots - */ - ResponseListSnapshots.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.ResponseListSnapshots) - return object; - let message = new $root.tendermint.abci.ResponseListSnapshots(); - if (object.snapshots) { - if (!Array.isArray(object.snapshots)) - throw TypeError(".tendermint.abci.ResponseListSnapshots.snapshots: array expected"); - message.snapshots = []; - for (let i = 0; i < object.snapshots.length; ++i) { - if (typeof object.snapshots[i] !== "object") - throw TypeError(".tendermint.abci.ResponseListSnapshots.snapshots: object expected"); - message.snapshots[i] = $root.tendermint.abci.Snapshot.fromObject(object.snapshots[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a ResponseListSnapshots message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.ResponseListSnapshots - * @static - * @param {tendermint.abci.ResponseListSnapshots} message ResponseListSnapshots - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ResponseListSnapshots.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.snapshots = []; - if (message.snapshots && message.snapshots.length) { - object.snapshots = []; - for (let j = 0; j < message.snapshots.length; ++j) - object.snapshots[j] = $root.tendermint.abci.Snapshot.toObject(message.snapshots[j], options); - } - return object; - }; - - /** - * Converts this ResponseListSnapshots to JSON. - * @function toJSON - * @memberof tendermint.abci.ResponseListSnapshots - * @instance - * @returns {Object.} JSON object - */ - ResponseListSnapshots.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ResponseListSnapshots; - })(); - - abci.ResponseOfferSnapshot = (function() { - - /** - * Properties of a ResponseOfferSnapshot. - * @memberof tendermint.abci - * @interface IResponseOfferSnapshot - * @property {tendermint.abci.ResponseOfferSnapshot.Result|null} [result] ResponseOfferSnapshot result - */ - - /** - * Constructs a new ResponseOfferSnapshot. - * @memberof tendermint.abci - * @classdesc Represents a ResponseOfferSnapshot. - * @implements IResponseOfferSnapshot - * @constructor - * @param {tendermint.abci.IResponseOfferSnapshot=} [properties] Properties to set - */ - function ResponseOfferSnapshot(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ResponseOfferSnapshot result. - * @member {tendermint.abci.ResponseOfferSnapshot.Result} result - * @memberof tendermint.abci.ResponseOfferSnapshot - * @instance - */ - ResponseOfferSnapshot.prototype.result = 0; - - /** - * Encodes the specified ResponseOfferSnapshot message. Does not implicitly {@link tendermint.abci.ResponseOfferSnapshot.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.ResponseOfferSnapshot - * @static - * @param {tendermint.abci.IResponseOfferSnapshot} message ResponseOfferSnapshot message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseOfferSnapshot.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.result != null && Object.hasOwnProperty.call(message, "result")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.result); - return writer; - }; - - /** - * Encodes the specified ResponseOfferSnapshot message, length delimited. Does not implicitly {@link tendermint.abci.ResponseOfferSnapshot.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.ResponseOfferSnapshot - * @static - * @param {tendermint.abci.IResponseOfferSnapshot} message ResponseOfferSnapshot message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseOfferSnapshot.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ResponseOfferSnapshot message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.ResponseOfferSnapshot - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.ResponseOfferSnapshot} ResponseOfferSnapshot - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseOfferSnapshot.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseOfferSnapshot(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.result = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ResponseOfferSnapshot message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.ResponseOfferSnapshot - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.ResponseOfferSnapshot} ResponseOfferSnapshot - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseOfferSnapshot.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ResponseOfferSnapshot message. - * @function verify - * @memberof tendermint.abci.ResponseOfferSnapshot - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ResponseOfferSnapshot.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.result != null && message.hasOwnProperty("result")) - switch (message.result) { - default: - return "result: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - return null; - }; - - /** - * Creates a ResponseOfferSnapshot message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.ResponseOfferSnapshot - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.ResponseOfferSnapshot} ResponseOfferSnapshot - */ - ResponseOfferSnapshot.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.ResponseOfferSnapshot) - return object; - let message = new $root.tendermint.abci.ResponseOfferSnapshot(); - switch (object.result) { - case "UNKNOWN": - case 0: - message.result = 0; - break; - case "ACCEPT": - case 1: - message.result = 1; - break; - case "ABORT": - case 2: - message.result = 2; - break; - case "REJECT": - case 3: - message.result = 3; - break; - case "REJECT_FORMAT": - case 4: - message.result = 4; - break; - case "REJECT_SENDER": - case 5: - message.result = 5; - break; - } - return message; - }; - - /** - * Creates a plain object from a ResponseOfferSnapshot message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.ResponseOfferSnapshot - * @static - * @param {tendermint.abci.ResponseOfferSnapshot} message ResponseOfferSnapshot - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ResponseOfferSnapshot.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - object.result = options.enums === String ? "UNKNOWN" : 0; - if (message.result != null && message.hasOwnProperty("result")) - object.result = options.enums === String ? $root.tendermint.abci.ResponseOfferSnapshot.Result[message.result] : message.result; - return object; - }; - - /** - * Converts this ResponseOfferSnapshot to JSON. - * @function toJSON - * @memberof tendermint.abci.ResponseOfferSnapshot - * @instance - * @returns {Object.} JSON object - */ - ResponseOfferSnapshot.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Result enum. - * @name tendermint.abci.ResponseOfferSnapshot.Result - * @enum {number} - * @property {number} UNKNOWN=0 UNKNOWN value - * @property {number} ACCEPT=1 ACCEPT value - * @property {number} ABORT=2 ABORT value - * @property {number} REJECT=3 REJECT value - * @property {number} REJECT_FORMAT=4 REJECT_FORMAT value - * @property {number} REJECT_SENDER=5 REJECT_SENDER value - */ - ResponseOfferSnapshot.Result = (function() { - const valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "UNKNOWN"] = 0; - values[valuesById[1] = "ACCEPT"] = 1; - values[valuesById[2] = "ABORT"] = 2; - values[valuesById[3] = "REJECT"] = 3; - values[valuesById[4] = "REJECT_FORMAT"] = 4; - values[valuesById[5] = "REJECT_SENDER"] = 5; - return values; - })(); - - return ResponseOfferSnapshot; - })(); - - abci.ResponseLoadSnapshotChunk = (function() { - - /** - * Properties of a ResponseLoadSnapshotChunk. - * @memberof tendermint.abci - * @interface IResponseLoadSnapshotChunk - * @property {Uint8Array|null} [chunk] ResponseLoadSnapshotChunk chunk - */ - - /** - * Constructs a new ResponseLoadSnapshotChunk. - * @memberof tendermint.abci - * @classdesc Represents a ResponseLoadSnapshotChunk. - * @implements IResponseLoadSnapshotChunk - * @constructor - * @param {tendermint.abci.IResponseLoadSnapshotChunk=} [properties] Properties to set - */ - function ResponseLoadSnapshotChunk(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ResponseLoadSnapshotChunk chunk. - * @member {Uint8Array} chunk - * @memberof tendermint.abci.ResponseLoadSnapshotChunk - * @instance - */ - ResponseLoadSnapshotChunk.prototype.chunk = $util.newBuffer([]); - - /** - * Encodes the specified ResponseLoadSnapshotChunk message. Does not implicitly {@link tendermint.abci.ResponseLoadSnapshotChunk.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.ResponseLoadSnapshotChunk - * @static - * @param {tendermint.abci.IResponseLoadSnapshotChunk} message ResponseLoadSnapshotChunk message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseLoadSnapshotChunk.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.chunk != null && Object.hasOwnProperty.call(message, "chunk")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.chunk); - return writer; - }; - - /** - * Encodes the specified ResponseLoadSnapshotChunk message, length delimited. Does not implicitly {@link tendermint.abci.ResponseLoadSnapshotChunk.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.ResponseLoadSnapshotChunk - * @static - * @param {tendermint.abci.IResponseLoadSnapshotChunk} message ResponseLoadSnapshotChunk message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseLoadSnapshotChunk.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ResponseLoadSnapshotChunk message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.ResponseLoadSnapshotChunk - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.ResponseLoadSnapshotChunk} ResponseLoadSnapshotChunk - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseLoadSnapshotChunk.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseLoadSnapshotChunk(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.chunk = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ResponseLoadSnapshotChunk message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.ResponseLoadSnapshotChunk - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.ResponseLoadSnapshotChunk} ResponseLoadSnapshotChunk - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseLoadSnapshotChunk.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ResponseLoadSnapshotChunk message. - * @function verify - * @memberof tendermint.abci.ResponseLoadSnapshotChunk - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ResponseLoadSnapshotChunk.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.chunk != null && message.hasOwnProperty("chunk")) - if (!(message.chunk && typeof message.chunk.length === "number" || $util.isString(message.chunk))) - return "chunk: buffer expected"; - return null; - }; - - /** - * Creates a ResponseLoadSnapshotChunk message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.ResponseLoadSnapshotChunk - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.ResponseLoadSnapshotChunk} ResponseLoadSnapshotChunk - */ - ResponseLoadSnapshotChunk.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.ResponseLoadSnapshotChunk) - return object; - let message = new $root.tendermint.abci.ResponseLoadSnapshotChunk(); - if (object.chunk != null) - if (typeof object.chunk === "string") - $util.base64.decode(object.chunk, message.chunk = $util.newBuffer($util.base64.length(object.chunk)), 0); - else if (object.chunk.length) - message.chunk = object.chunk; - return message; - }; - - /** - * Creates a plain object from a ResponseLoadSnapshotChunk message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.ResponseLoadSnapshotChunk - * @static - * @param {tendermint.abci.ResponseLoadSnapshotChunk} message ResponseLoadSnapshotChunk - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ResponseLoadSnapshotChunk.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - if (options.bytes === String) - object.chunk = ""; - else { - object.chunk = []; - if (options.bytes !== Array) - object.chunk = $util.newBuffer(object.chunk); - } - if (message.chunk != null && message.hasOwnProperty("chunk")) - object.chunk = options.bytes === String ? $util.base64.encode(message.chunk, 0, message.chunk.length) : options.bytes === Array ? Array.prototype.slice.call(message.chunk) : message.chunk; - return object; - }; - - /** - * Converts this ResponseLoadSnapshotChunk to JSON. - * @function toJSON - * @memberof tendermint.abci.ResponseLoadSnapshotChunk - * @instance - * @returns {Object.} JSON object - */ - ResponseLoadSnapshotChunk.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ResponseLoadSnapshotChunk; - })(); - - abci.ResponseApplySnapshotChunk = (function() { - - /** - * Properties of a ResponseApplySnapshotChunk. - * @memberof tendermint.abci - * @interface IResponseApplySnapshotChunk - * @property {tendermint.abci.ResponseApplySnapshotChunk.Result|null} [result] ResponseApplySnapshotChunk result - * @property {Array.|null} [refetch_chunks] ResponseApplySnapshotChunk refetch_chunks - * @property {Array.|null} [reject_senders] ResponseApplySnapshotChunk reject_senders - */ - - /** - * Constructs a new ResponseApplySnapshotChunk. - * @memberof tendermint.abci - * @classdesc Represents a ResponseApplySnapshotChunk. - * @implements IResponseApplySnapshotChunk - * @constructor - * @param {tendermint.abci.IResponseApplySnapshotChunk=} [properties] Properties to set - */ - function ResponseApplySnapshotChunk(properties) { - this.refetch_chunks = []; - this.reject_senders = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ResponseApplySnapshotChunk result. - * @member {tendermint.abci.ResponseApplySnapshotChunk.Result} result - * @memberof tendermint.abci.ResponseApplySnapshotChunk - * @instance - */ - ResponseApplySnapshotChunk.prototype.result = 0; - - /** - * ResponseApplySnapshotChunk refetch_chunks. - * @member {Array.} refetch_chunks - * @memberof tendermint.abci.ResponseApplySnapshotChunk - * @instance - */ - ResponseApplySnapshotChunk.prototype.refetch_chunks = $util.emptyArray; - - /** - * ResponseApplySnapshotChunk reject_senders. - * @member {Array.} reject_senders - * @memberof tendermint.abci.ResponseApplySnapshotChunk - * @instance - */ - ResponseApplySnapshotChunk.prototype.reject_senders = $util.emptyArray; - - /** - * Encodes the specified ResponseApplySnapshotChunk message. Does not implicitly {@link tendermint.abci.ResponseApplySnapshotChunk.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.ResponseApplySnapshotChunk - * @static - * @param {tendermint.abci.IResponseApplySnapshotChunk} message ResponseApplySnapshotChunk message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseApplySnapshotChunk.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.result != null && Object.hasOwnProperty.call(message, "result")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.result); - if (message.refetch_chunks != null && message.refetch_chunks.length) { - writer.uint32(/* id 2, wireType 2 =*/18).fork(); - for (let i = 0; i < message.refetch_chunks.length; ++i) - writer.uint32(message.refetch_chunks[i]); - writer.ldelim(); - } - if (message.reject_senders != null && message.reject_senders.length) - for (let i = 0; i < message.reject_senders.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.reject_senders[i]); - return writer; - }; - - /** - * Encodes the specified ResponseApplySnapshotChunk message, length delimited. Does not implicitly {@link tendermint.abci.ResponseApplySnapshotChunk.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.ResponseApplySnapshotChunk - * @static - * @param {tendermint.abci.IResponseApplySnapshotChunk} message ResponseApplySnapshotChunk message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResponseApplySnapshotChunk.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ResponseApplySnapshotChunk message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.ResponseApplySnapshotChunk - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.ResponseApplySnapshotChunk} ResponseApplySnapshotChunk - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseApplySnapshotChunk.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ResponseApplySnapshotChunk(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.result = reader.int32(); - break; - case 2: - if (!(message.refetch_chunks && message.refetch_chunks.length)) - message.refetch_chunks = []; - if ((tag & 7) === 2) { - let end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.refetch_chunks.push(reader.uint32()); - } else - message.refetch_chunks.push(reader.uint32()); - break; - case 3: - if (!(message.reject_senders && message.reject_senders.length)) - message.reject_senders = []; - message.reject_senders.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ResponseApplySnapshotChunk message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.ResponseApplySnapshotChunk - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.ResponseApplySnapshotChunk} ResponseApplySnapshotChunk - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResponseApplySnapshotChunk.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ResponseApplySnapshotChunk message. - * @function verify - * @memberof tendermint.abci.ResponseApplySnapshotChunk - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ResponseApplySnapshotChunk.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.result != null && message.hasOwnProperty("result")) - switch (message.result) { - default: - return "result: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.refetch_chunks != null && message.hasOwnProperty("refetch_chunks")) { - if (!Array.isArray(message.refetch_chunks)) - return "refetch_chunks: array expected"; - for (let i = 0; i < message.refetch_chunks.length; ++i) - if (!$util.isInteger(message.refetch_chunks[i])) - return "refetch_chunks: integer[] expected"; - } - if (message.reject_senders != null && message.hasOwnProperty("reject_senders")) { - if (!Array.isArray(message.reject_senders)) - return "reject_senders: array expected"; - for (let i = 0; i < message.reject_senders.length; ++i) - if (!$util.isString(message.reject_senders[i])) - return "reject_senders: string[] expected"; - } - return null; - }; - - /** - * Creates a ResponseApplySnapshotChunk message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.ResponseApplySnapshotChunk - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.ResponseApplySnapshotChunk} ResponseApplySnapshotChunk - */ - ResponseApplySnapshotChunk.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.ResponseApplySnapshotChunk) - return object; - let message = new $root.tendermint.abci.ResponseApplySnapshotChunk(); - switch (object.result) { - case "UNKNOWN": - case 0: - message.result = 0; - break; - case "ACCEPT": - case 1: - message.result = 1; - break; - case "ABORT": - case 2: - message.result = 2; - break; - case "RETRY": - case 3: - message.result = 3; - break; - case "RETRY_SNAPSHOT": - case 4: - message.result = 4; - break; - case "REJECT_SNAPSHOT": - case 5: - message.result = 5; - break; - } - if (object.refetch_chunks) { - if (!Array.isArray(object.refetch_chunks)) - throw TypeError(".tendermint.abci.ResponseApplySnapshotChunk.refetch_chunks: array expected"); - message.refetch_chunks = []; - for (let i = 0; i < object.refetch_chunks.length; ++i) - message.refetch_chunks[i] = object.refetch_chunks[i] >>> 0; - } - if (object.reject_senders) { - if (!Array.isArray(object.reject_senders)) - throw TypeError(".tendermint.abci.ResponseApplySnapshotChunk.reject_senders: array expected"); - message.reject_senders = []; - for (let i = 0; i < object.reject_senders.length; ++i) - message.reject_senders[i] = String(object.reject_senders[i]); - } - return message; - }; - - /** - * Creates a plain object from a ResponseApplySnapshotChunk message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.ResponseApplySnapshotChunk - * @static - * @param {tendermint.abci.ResponseApplySnapshotChunk} message ResponseApplySnapshotChunk - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ResponseApplySnapshotChunk.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) { - object.refetch_chunks = []; - object.reject_senders = []; - } - if (options.defaults) - object.result = options.enums === String ? "UNKNOWN" : 0; - if (message.result != null && message.hasOwnProperty("result")) - object.result = options.enums === String ? $root.tendermint.abci.ResponseApplySnapshotChunk.Result[message.result] : message.result; - if (message.refetch_chunks && message.refetch_chunks.length) { - object.refetch_chunks = []; - for (let j = 0; j < message.refetch_chunks.length; ++j) - object.refetch_chunks[j] = message.refetch_chunks[j]; - } - if (message.reject_senders && message.reject_senders.length) { - object.reject_senders = []; - for (let j = 0; j < message.reject_senders.length; ++j) - object.reject_senders[j] = message.reject_senders[j]; - } - return object; - }; - - /** - * Converts this ResponseApplySnapshotChunk to JSON. - * @function toJSON - * @memberof tendermint.abci.ResponseApplySnapshotChunk - * @instance - * @returns {Object.} JSON object - */ - ResponseApplySnapshotChunk.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Result enum. - * @name tendermint.abci.ResponseApplySnapshotChunk.Result - * @enum {number} - * @property {number} UNKNOWN=0 UNKNOWN value - * @property {number} ACCEPT=1 ACCEPT value - * @property {number} ABORT=2 ABORT value - * @property {number} RETRY=3 RETRY value - * @property {number} RETRY_SNAPSHOT=4 RETRY_SNAPSHOT value - * @property {number} REJECT_SNAPSHOT=5 REJECT_SNAPSHOT value - */ - ResponseApplySnapshotChunk.Result = (function() { - const valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "UNKNOWN"] = 0; - values[valuesById[1] = "ACCEPT"] = 1; - values[valuesById[2] = "ABORT"] = 2; - values[valuesById[3] = "RETRY"] = 3; - values[valuesById[4] = "RETRY_SNAPSHOT"] = 4; - values[valuesById[5] = "REJECT_SNAPSHOT"] = 5; - return values; - })(); - - return ResponseApplySnapshotChunk; - })(); - - abci.ConsensusParams = (function() { - - /** - * Properties of a ConsensusParams. - * @memberof tendermint.abci - * @interface IConsensusParams - * @property {tendermint.abci.IBlockParams|null} [block] ConsensusParams block - * @property {tendermint.types.IEvidenceParams|null} [evidence] ConsensusParams evidence - * @property {tendermint.types.IValidatorParams|null} [validator] ConsensusParams validator - * @property {tendermint.types.IVersionParams|null} [version] ConsensusParams version - */ - - /** - * Constructs a new ConsensusParams. - * @memberof tendermint.abci - * @classdesc Represents a ConsensusParams. - * @implements IConsensusParams - * @constructor - * @param {tendermint.abci.IConsensusParams=} [properties] Properties to set - */ - function ConsensusParams(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ConsensusParams block. - * @member {tendermint.abci.IBlockParams|null|undefined} block - * @memberof tendermint.abci.ConsensusParams - * @instance - */ - ConsensusParams.prototype.block = null; - - /** - * ConsensusParams evidence. - * @member {tendermint.types.IEvidenceParams|null|undefined} evidence - * @memberof tendermint.abci.ConsensusParams - * @instance - */ - ConsensusParams.prototype.evidence = null; - - /** - * ConsensusParams validator. - * @member {tendermint.types.IValidatorParams|null|undefined} validator - * @memberof tendermint.abci.ConsensusParams - * @instance - */ - ConsensusParams.prototype.validator = null; - - /** - * ConsensusParams version. - * @member {tendermint.types.IVersionParams|null|undefined} version - * @memberof tendermint.abci.ConsensusParams - * @instance - */ - ConsensusParams.prototype.version = null; - - /** - * Encodes the specified ConsensusParams message. Does not implicitly {@link tendermint.abci.ConsensusParams.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.ConsensusParams - * @static - * @param {tendermint.abci.IConsensusParams} message ConsensusParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConsensusParams.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.block != null && Object.hasOwnProperty.call(message, "block")) - $root.tendermint.abci.BlockParams.encode(message.block, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.evidence != null && Object.hasOwnProperty.call(message, "evidence")) - $root.tendermint.types.EvidenceParams.encode(message.evidence, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.validator != null && Object.hasOwnProperty.call(message, "validator")) - $root.tendermint.types.ValidatorParams.encode(message.validator, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.version != null && Object.hasOwnProperty.call(message, "version")) - $root.tendermint.types.VersionParams.encode(message.version, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ConsensusParams message, length delimited. Does not implicitly {@link tendermint.abci.ConsensusParams.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.ConsensusParams - * @static - * @param {tendermint.abci.IConsensusParams} message ConsensusParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConsensusParams.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ConsensusParams message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.ConsensusParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.ConsensusParams} ConsensusParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConsensusParams.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ConsensusParams(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.block = $root.tendermint.abci.BlockParams.decode(reader, reader.uint32()); - break; - case 2: - message.evidence = $root.tendermint.types.EvidenceParams.decode(reader, reader.uint32()); - break; - case 3: - message.validator = $root.tendermint.types.ValidatorParams.decode(reader, reader.uint32()); - break; - case 4: - message.version = $root.tendermint.types.VersionParams.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ConsensusParams message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.ConsensusParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.ConsensusParams} ConsensusParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConsensusParams.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ConsensusParams message. - * @function verify - * @memberof tendermint.abci.ConsensusParams - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ConsensusParams.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.block != null && message.hasOwnProperty("block")) { - let error = $root.tendermint.abci.BlockParams.verify(message.block); - if (error) - return "block." + error; - } - if (message.evidence != null && message.hasOwnProperty("evidence")) { - let error = $root.tendermint.types.EvidenceParams.verify(message.evidence); - if (error) - return "evidence." + error; - } - if (message.validator != null && message.hasOwnProperty("validator")) { - let error = $root.tendermint.types.ValidatorParams.verify(message.validator); - if (error) - return "validator." + error; - } - if (message.version != null && message.hasOwnProperty("version")) { - let error = $root.tendermint.types.VersionParams.verify(message.version); - if (error) - return "version." + error; - } - return null; - }; - - /** - * Creates a ConsensusParams message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.ConsensusParams - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.ConsensusParams} ConsensusParams - */ - ConsensusParams.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.ConsensusParams) - return object; - let message = new $root.tendermint.abci.ConsensusParams(); - if (object.block != null) { - if (typeof object.block !== "object") - throw TypeError(".tendermint.abci.ConsensusParams.block: object expected"); - message.block = $root.tendermint.abci.BlockParams.fromObject(object.block); - } - if (object.evidence != null) { - if (typeof object.evidence !== "object") - throw TypeError(".tendermint.abci.ConsensusParams.evidence: object expected"); - message.evidence = $root.tendermint.types.EvidenceParams.fromObject(object.evidence); - } - if (object.validator != null) { - if (typeof object.validator !== "object") - throw TypeError(".tendermint.abci.ConsensusParams.validator: object expected"); - message.validator = $root.tendermint.types.ValidatorParams.fromObject(object.validator); - } - if (object.version != null) { - if (typeof object.version !== "object") - throw TypeError(".tendermint.abci.ConsensusParams.version: object expected"); - message.version = $root.tendermint.types.VersionParams.fromObject(object.version); - } - return message; - }; - - /** - * Creates a plain object from a ConsensusParams message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.ConsensusParams - * @static - * @param {tendermint.abci.ConsensusParams} message ConsensusParams - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ConsensusParams.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.block = null; - object.evidence = null; - object.validator = null; - object.version = null; - } - if (message.block != null && message.hasOwnProperty("block")) - object.block = $root.tendermint.abci.BlockParams.toObject(message.block, options); - if (message.evidence != null && message.hasOwnProperty("evidence")) - object.evidence = $root.tendermint.types.EvidenceParams.toObject(message.evidence, options); - if (message.validator != null && message.hasOwnProperty("validator")) - object.validator = $root.tendermint.types.ValidatorParams.toObject(message.validator, options); - if (message.version != null && message.hasOwnProperty("version")) - object.version = $root.tendermint.types.VersionParams.toObject(message.version, options); - return object; - }; - - /** - * Converts this ConsensusParams to JSON. - * @function toJSON - * @memberof tendermint.abci.ConsensusParams - * @instance - * @returns {Object.} JSON object - */ - ConsensusParams.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ConsensusParams; - })(); - - abci.BlockParams = (function() { - - /** - * Properties of a BlockParams. - * @memberof tendermint.abci - * @interface IBlockParams - * @property {Long|null} [max_bytes] BlockParams max_bytes - * @property {Long|null} [max_gas] BlockParams max_gas - */ - - /** - * Constructs a new BlockParams. - * @memberof tendermint.abci - * @classdesc Represents a BlockParams. - * @implements IBlockParams - * @constructor - * @param {tendermint.abci.IBlockParams=} [properties] Properties to set - */ - function BlockParams(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * BlockParams max_bytes. - * @member {Long} max_bytes - * @memberof tendermint.abci.BlockParams - * @instance - */ - BlockParams.prototype.max_bytes = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * BlockParams max_gas. - * @member {Long} max_gas - * @memberof tendermint.abci.BlockParams - * @instance - */ - BlockParams.prototype.max_gas = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Encodes the specified BlockParams message. Does not implicitly {@link tendermint.abci.BlockParams.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.BlockParams - * @static - * @param {tendermint.abci.IBlockParams} message BlockParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BlockParams.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.max_bytes != null && Object.hasOwnProperty.call(message, "max_bytes")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.max_bytes); - if (message.max_gas != null && Object.hasOwnProperty.call(message, "max_gas")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.max_gas); - return writer; - }; - - /** - * Encodes the specified BlockParams message, length delimited. Does not implicitly {@link tendermint.abci.BlockParams.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.BlockParams - * @static - * @param {tendermint.abci.IBlockParams} message BlockParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BlockParams.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BlockParams message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.BlockParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.BlockParams} BlockParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BlockParams.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.BlockParams(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.max_bytes = reader.int64(); - break; - case 2: - message.max_gas = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BlockParams message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.BlockParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.BlockParams} BlockParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BlockParams.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BlockParams message. - * @function verify - * @memberof tendermint.abci.BlockParams - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BlockParams.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.max_bytes != null && message.hasOwnProperty("max_bytes")) - if (!$util.isInteger(message.max_bytes) && !(message.max_bytes && $util.isInteger(message.max_bytes.low) && $util.isInteger(message.max_bytes.high))) - return "max_bytes: integer|Long expected"; - if (message.max_gas != null && message.hasOwnProperty("max_gas")) - if (!$util.isInteger(message.max_gas) && !(message.max_gas && $util.isInteger(message.max_gas.low) && $util.isInteger(message.max_gas.high))) - return "max_gas: integer|Long expected"; - return null; - }; - - /** - * Creates a BlockParams message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.BlockParams - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.BlockParams} BlockParams - */ - BlockParams.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.BlockParams) - return object; - let message = new $root.tendermint.abci.BlockParams(); - if (object.max_bytes != null) - if ($util.Long) - (message.max_bytes = $util.Long.fromValue(object.max_bytes)).unsigned = false; - else if (typeof object.max_bytes === "string") - message.max_bytes = parseInt(object.max_bytes, 10); - else if (typeof object.max_bytes === "number") - message.max_bytes = object.max_bytes; - else if (typeof object.max_bytes === "object") - message.max_bytes = new $util.LongBits(object.max_bytes.low >>> 0, object.max_bytes.high >>> 0).toNumber(); - if (object.max_gas != null) - if ($util.Long) - (message.max_gas = $util.Long.fromValue(object.max_gas)).unsigned = false; - else if (typeof object.max_gas === "string") - message.max_gas = parseInt(object.max_gas, 10); - else if (typeof object.max_gas === "number") - message.max_gas = object.max_gas; - else if (typeof object.max_gas === "object") - message.max_gas = new $util.LongBits(object.max_gas.low >>> 0, object.max_gas.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a BlockParams message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.BlockParams - * @static - * @param {tendermint.abci.BlockParams} message BlockParams - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BlockParams.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.max_bytes = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.max_bytes = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.max_gas = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.max_gas = options.longs === String ? "0" : 0; - } - if (message.max_bytes != null && message.hasOwnProperty("max_bytes")) - if (typeof message.max_bytes === "number") - object.max_bytes = options.longs === String ? String(message.max_bytes) : message.max_bytes; - else - object.max_bytes = options.longs === String ? $util.Long.prototype.toString.call(message.max_bytes) : options.longs === Number ? new $util.LongBits(message.max_bytes.low >>> 0, message.max_bytes.high >>> 0).toNumber() : message.max_bytes; - if (message.max_gas != null && message.hasOwnProperty("max_gas")) - if (typeof message.max_gas === "number") - object.max_gas = options.longs === String ? String(message.max_gas) : message.max_gas; - else - object.max_gas = options.longs === String ? $util.Long.prototype.toString.call(message.max_gas) : options.longs === Number ? new $util.LongBits(message.max_gas.low >>> 0, message.max_gas.high >>> 0).toNumber() : message.max_gas; - return object; - }; - - /** - * Converts this BlockParams to JSON. - * @function toJSON - * @memberof tendermint.abci.BlockParams - * @instance - * @returns {Object.} JSON object - */ - BlockParams.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return BlockParams; - })(); - - abci.LastCommitInfo = (function() { - - /** - * Properties of a LastCommitInfo. - * @memberof tendermint.abci - * @interface ILastCommitInfo - * @property {number|null} [round] LastCommitInfo round - * @property {Array.|null} [votes] LastCommitInfo votes - */ - - /** - * Constructs a new LastCommitInfo. - * @memberof tendermint.abci - * @classdesc Represents a LastCommitInfo. - * @implements ILastCommitInfo - * @constructor - * @param {tendermint.abci.ILastCommitInfo=} [properties] Properties to set - */ - function LastCommitInfo(properties) { - this.votes = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * LastCommitInfo round. - * @member {number} round - * @memberof tendermint.abci.LastCommitInfo - * @instance - */ - LastCommitInfo.prototype.round = 0; - - /** - * LastCommitInfo votes. - * @member {Array.} votes - * @memberof tendermint.abci.LastCommitInfo - * @instance - */ - LastCommitInfo.prototype.votes = $util.emptyArray; - - /** - * Encodes the specified LastCommitInfo message. Does not implicitly {@link tendermint.abci.LastCommitInfo.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.LastCommitInfo - * @static - * @param {tendermint.abci.ILastCommitInfo} message LastCommitInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LastCommitInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.round != null && Object.hasOwnProperty.call(message, "round")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.round); - if (message.votes != null && message.votes.length) - for (let i = 0; i < message.votes.length; ++i) - $root.tendermint.abci.VoteInfo.encode(message.votes[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified LastCommitInfo message, length delimited. Does not implicitly {@link tendermint.abci.LastCommitInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.LastCommitInfo - * @static - * @param {tendermint.abci.ILastCommitInfo} message LastCommitInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LastCommitInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a LastCommitInfo message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.LastCommitInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.LastCommitInfo} LastCommitInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LastCommitInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.LastCommitInfo(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.round = reader.int32(); - break; - case 2: - if (!(message.votes && message.votes.length)) - message.votes = []; - message.votes.push($root.tendermint.abci.VoteInfo.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a LastCommitInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.LastCommitInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.LastCommitInfo} LastCommitInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LastCommitInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a LastCommitInfo message. - * @function verify - * @memberof tendermint.abci.LastCommitInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - LastCommitInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.round != null && message.hasOwnProperty("round")) - if (!$util.isInteger(message.round)) - return "round: integer expected"; - if (message.votes != null && message.hasOwnProperty("votes")) { - if (!Array.isArray(message.votes)) - return "votes: array expected"; - for (let i = 0; i < message.votes.length; ++i) { - let error = $root.tendermint.abci.VoteInfo.verify(message.votes[i]); - if (error) - return "votes." + error; - } - } - return null; - }; - - /** - * Creates a LastCommitInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.LastCommitInfo - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.LastCommitInfo} LastCommitInfo - */ - LastCommitInfo.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.LastCommitInfo) - return object; - let message = new $root.tendermint.abci.LastCommitInfo(); - if (object.round != null) - message.round = object.round | 0; - if (object.votes) { - if (!Array.isArray(object.votes)) - throw TypeError(".tendermint.abci.LastCommitInfo.votes: array expected"); - message.votes = []; - for (let i = 0; i < object.votes.length; ++i) { - if (typeof object.votes[i] !== "object") - throw TypeError(".tendermint.abci.LastCommitInfo.votes: object expected"); - message.votes[i] = $root.tendermint.abci.VoteInfo.fromObject(object.votes[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a LastCommitInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.LastCommitInfo - * @static - * @param {tendermint.abci.LastCommitInfo} message LastCommitInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - LastCommitInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.votes = []; - if (options.defaults) - object.round = 0; - if (message.round != null && message.hasOwnProperty("round")) - object.round = message.round; - if (message.votes && message.votes.length) { - object.votes = []; - for (let j = 0; j < message.votes.length; ++j) - object.votes[j] = $root.tendermint.abci.VoteInfo.toObject(message.votes[j], options); - } - return object; - }; - - /** - * Converts this LastCommitInfo to JSON. - * @function toJSON - * @memberof tendermint.abci.LastCommitInfo - * @instance - * @returns {Object.} JSON object - */ - LastCommitInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return LastCommitInfo; - })(); - - abci.Event = (function() { - - /** - * Properties of an Event. - * @memberof tendermint.abci - * @interface IEvent - * @property {string|null} [type] Event type - * @property {Array.|null} [attributes] Event attributes - */ - - /** - * Constructs a new Event. - * @memberof tendermint.abci - * @classdesc Represents an Event. - * @implements IEvent - * @constructor - * @param {tendermint.abci.IEvent=} [properties] Properties to set - */ - function Event(properties) { - this.attributes = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Event type. - * @member {string} type - * @memberof tendermint.abci.Event - * @instance - */ - Event.prototype.type = ""; - - /** - * Event attributes. - * @member {Array.} attributes - * @memberof tendermint.abci.Event - * @instance - */ - Event.prototype.attributes = $util.emptyArray; - - /** - * Encodes the specified Event message. Does not implicitly {@link tendermint.abci.Event.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.Event - * @static - * @param {tendermint.abci.IEvent} message Event message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Event.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); - if (message.attributes != null && message.attributes.length) - for (let i = 0; i < message.attributes.length; ++i) - $root.tendermint.abci.EventAttribute.encode(message.attributes[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Event message, length delimited. Does not implicitly {@link tendermint.abci.Event.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.Event - * @static - * @param {tendermint.abci.IEvent} message Event message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Event.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Event message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.Event - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.Event} Event - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Event.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.Event(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.type = reader.string(); - break; - case 2: - if (!(message.attributes && message.attributes.length)) - message.attributes = []; - message.attributes.push($root.tendermint.abci.EventAttribute.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Event message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.Event - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.Event} Event - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Event.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Event message. - * @function verify - * @memberof tendermint.abci.Event - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Event.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - if (message.attributes != null && message.hasOwnProperty("attributes")) { - if (!Array.isArray(message.attributes)) - return "attributes: array expected"; - for (let i = 0; i < message.attributes.length; ++i) { - let error = $root.tendermint.abci.EventAttribute.verify(message.attributes[i]); - if (error) - return "attributes." + error; - } - } - return null; - }; - - /** - * Creates an Event message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.Event - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.Event} Event - */ - Event.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.Event) - return object; - let message = new $root.tendermint.abci.Event(); - if (object.type != null) - message.type = String(object.type); - if (object.attributes) { - if (!Array.isArray(object.attributes)) - throw TypeError(".tendermint.abci.Event.attributes: array expected"); - message.attributes = []; - for (let i = 0; i < object.attributes.length; ++i) { - if (typeof object.attributes[i] !== "object") - throw TypeError(".tendermint.abci.Event.attributes: object expected"); - message.attributes[i] = $root.tendermint.abci.EventAttribute.fromObject(object.attributes[i]); - } - } - return message; - }; - - /** - * Creates a plain object from an Event message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.Event - * @static - * @param {tendermint.abci.Event} message Event - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Event.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.attributes = []; - if (options.defaults) - object.type = ""; - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; - if (message.attributes && message.attributes.length) { - object.attributes = []; - for (let j = 0; j < message.attributes.length; ++j) - object.attributes[j] = $root.tendermint.abci.EventAttribute.toObject(message.attributes[j], options); - } - return object; - }; - - /** - * Converts this Event to JSON. - * @function toJSON - * @memberof tendermint.abci.Event - * @instance - * @returns {Object.} JSON object - */ - Event.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Event; - })(); - - abci.EventAttribute = (function() { - - /** - * Properties of an EventAttribute. - * @memberof tendermint.abci - * @interface IEventAttribute - * @property {Uint8Array|null} [key] EventAttribute key - * @property {Uint8Array|null} [value] EventAttribute value - * @property {boolean|null} [index] EventAttribute index - */ - - /** - * Constructs a new EventAttribute. - * @memberof tendermint.abci - * @classdesc Represents an EventAttribute. - * @implements IEventAttribute - * @constructor - * @param {tendermint.abci.IEventAttribute=} [properties] Properties to set - */ - function EventAttribute(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * EventAttribute key. - * @member {Uint8Array} key - * @memberof tendermint.abci.EventAttribute - * @instance - */ - EventAttribute.prototype.key = $util.newBuffer([]); - - /** - * EventAttribute value. - * @member {Uint8Array} value - * @memberof tendermint.abci.EventAttribute - * @instance - */ - EventAttribute.prototype.value = $util.newBuffer([]); - - /** - * EventAttribute index. - * @member {boolean} index - * @memberof tendermint.abci.EventAttribute - * @instance - */ - EventAttribute.prototype.index = false; - - /** - * Encodes the specified EventAttribute message. Does not implicitly {@link tendermint.abci.EventAttribute.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.EventAttribute - * @static - * @param {tendermint.abci.IEventAttribute} message EventAttribute message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EventAttribute.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value); - if (message.index != null && Object.hasOwnProperty.call(message, "index")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.index); - return writer; - }; - - /** - * Encodes the specified EventAttribute message, length delimited. Does not implicitly {@link tendermint.abci.EventAttribute.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.EventAttribute - * @static - * @param {tendermint.abci.IEventAttribute} message EventAttribute message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EventAttribute.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an EventAttribute message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.EventAttribute - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.EventAttribute} EventAttribute - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EventAttribute.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.EventAttribute(); - while (reader.pos < end) { - let 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; - }; - - /** - * Decodes an EventAttribute message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.EventAttribute - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.EventAttribute} EventAttribute - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EventAttribute.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an EventAttribute message. - * @function verify - * @memberof tendermint.abci.EventAttribute - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - EventAttribute.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) - return "key: buffer expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) - return "value: buffer expected"; - if (message.index != null && message.hasOwnProperty("index")) - if (typeof message.index !== "boolean") - return "index: boolean expected"; - return null; - }; - - /** - * Creates an EventAttribute message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.EventAttribute - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.EventAttribute} EventAttribute - */ - EventAttribute.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.EventAttribute) - return object; - let message = new $root.tendermint.abci.EventAttribute(); - if (object.key != null) - if (typeof object.key === "string") - $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); - else if (object.key.length) - message.key = object.key; - if (object.value != null) - if (typeof object.value === "string") - $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); - else if (object.value.length) - message.value = object.value; - if (object.index != null) - message.index = Boolean(object.index); - return message; - }; - - /** - * Creates a plain object from an EventAttribute message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.EventAttribute - * @static - * @param {tendermint.abci.EventAttribute} message EventAttribute - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - EventAttribute.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if (options.bytes === String) - object.key = ""; - else { - object.key = []; - if (options.bytes !== Array) - object.key = $util.newBuffer(object.key); - } - if (options.bytes === String) - object.value = ""; - else { - object.value = []; - if (options.bytes !== Array) - object.value = $util.newBuffer(object.value); - } - object.index = false; - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; - if (message.value != null && message.hasOwnProperty("value")) - object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; - if (message.index != null && message.hasOwnProperty("index")) - object.index = message.index; - return object; - }; - - /** - * Converts this EventAttribute to JSON. - * @function toJSON - * @memberof tendermint.abci.EventAttribute - * @instance - * @returns {Object.} JSON object - */ - EventAttribute.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return EventAttribute; - })(); - - abci.TxResult = (function() { - - /** - * Properties of a TxResult. - * @memberof tendermint.abci - * @interface ITxResult - * @property {Long|null} [height] TxResult height - * @property {number|null} [index] TxResult index - * @property {Uint8Array|null} [tx] TxResult tx - * @property {tendermint.abci.IResponseDeliverTx|null} [result] TxResult result - */ - - /** - * Constructs a new TxResult. - * @memberof tendermint.abci - * @classdesc Represents a TxResult. - * @implements ITxResult - * @constructor - * @param {tendermint.abci.ITxResult=} [properties] Properties to set - */ - function TxResult(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * TxResult height. - * @member {Long} height - * @memberof tendermint.abci.TxResult - * @instance - */ - TxResult.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * TxResult index. - * @member {number} index - * @memberof tendermint.abci.TxResult - * @instance - */ - TxResult.prototype.index = 0; - - /** - * TxResult tx. - * @member {Uint8Array} tx - * @memberof tendermint.abci.TxResult - * @instance - */ - TxResult.prototype.tx = $util.newBuffer([]); - - /** - * TxResult result. - * @member {tendermint.abci.IResponseDeliverTx|null|undefined} result - * @memberof tendermint.abci.TxResult - * @instance - */ - TxResult.prototype.result = null; - - /** - * Encodes the specified TxResult message. Does not implicitly {@link tendermint.abci.TxResult.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.TxResult - * @static - * @param {tendermint.abci.ITxResult} message TxResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TxResult.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.height); - if (message.index != null && Object.hasOwnProperty.call(message, "index")) - writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.index); - if (message.tx != null && Object.hasOwnProperty.call(message, "tx")) - writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.tx); - if (message.result != null && Object.hasOwnProperty.call(message, "result")) - $root.tendermint.abci.ResponseDeliverTx.encode(message.result, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified TxResult message, length delimited. Does not implicitly {@link tendermint.abci.TxResult.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.TxResult - * @static - * @param {tendermint.abci.ITxResult} message TxResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TxResult.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TxResult message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.TxResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.TxResult} TxResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TxResult.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.TxResult(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.height = reader.int64(); - break; - case 2: - message.index = reader.uint32(); - break; - case 3: - message.tx = reader.bytes(); - break; - case 4: - message.result = $root.tendermint.abci.ResponseDeliverTx.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a TxResult message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.TxResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.TxResult} TxResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TxResult.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TxResult message. - * @function verify - * @memberof tendermint.abci.TxResult - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TxResult.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) - return "height: integer|Long expected"; - if (message.index != null && message.hasOwnProperty("index")) - if (!$util.isInteger(message.index)) - return "index: integer expected"; - if (message.tx != null && message.hasOwnProperty("tx")) - if (!(message.tx && typeof message.tx.length === "number" || $util.isString(message.tx))) - return "tx: buffer expected"; - if (message.result != null && message.hasOwnProperty("result")) { - let error = $root.tendermint.abci.ResponseDeliverTx.verify(message.result); - if (error) - return "result." + error; - } - return null; - }; - - /** - * Creates a TxResult message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.TxResult - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.TxResult} TxResult - */ - TxResult.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.TxResult) - return object; - let message = new $root.tendermint.abci.TxResult(); - if (object.height != null) - if ($util.Long) - (message.height = $util.Long.fromValue(object.height)).unsigned = false; - else if (typeof object.height === "string") - message.height = parseInt(object.height, 10); - else if (typeof object.height === "number") - message.height = object.height; - else if (typeof object.height === "object") - message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); - if (object.index != null) - message.index = object.index >>> 0; - if (object.tx != null) - if (typeof object.tx === "string") - $util.base64.decode(object.tx, message.tx = $util.newBuffer($util.base64.length(object.tx)), 0); - else if (object.tx.length) - message.tx = object.tx; - if (object.result != null) { - if (typeof object.result !== "object") - throw TypeError(".tendermint.abci.TxResult.result: object expected"); - message.result = $root.tendermint.abci.ResponseDeliverTx.fromObject(object.result); - } - return message; - }; - - /** - * Creates a plain object from a TxResult message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.TxResult - * @static - * @param {tendermint.abci.TxResult} message TxResult - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TxResult.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.height = options.longs === String ? "0" : 0; - object.index = 0; - if (options.bytes === String) - object.tx = ""; - else { - object.tx = []; - if (options.bytes !== Array) - object.tx = $util.newBuffer(object.tx); - } - object.result = null; - } - if (message.height != null && message.hasOwnProperty("height")) - if (typeof message.height === "number") - object.height = options.longs === String ? String(message.height) : message.height; - else - object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; - if (message.index != null && message.hasOwnProperty("index")) - object.index = message.index; - if (message.tx != null && message.hasOwnProperty("tx")) - object.tx = options.bytes === String ? $util.base64.encode(message.tx, 0, message.tx.length) : options.bytes === Array ? Array.prototype.slice.call(message.tx) : message.tx; - if (message.result != null && message.hasOwnProperty("result")) - object.result = $root.tendermint.abci.ResponseDeliverTx.toObject(message.result, options); - return object; - }; - - /** - * Converts this TxResult to JSON. - * @function toJSON - * @memberof tendermint.abci.TxResult - * @instance - * @returns {Object.} JSON object - */ - TxResult.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return TxResult; - })(); - - abci.Validator = (function() { - - /** - * Properties of a Validator. - * @memberof tendermint.abci - * @interface IValidator - * @property {Uint8Array|null} [address] Validator address - * @property {Long|null} [power] Validator power - */ - - /** - * Constructs a new Validator. - * @memberof tendermint.abci - * @classdesc Represents a Validator. - * @implements IValidator - * @constructor - * @param {tendermint.abci.IValidator=} [properties] Properties to set - */ - function Validator(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Validator address. - * @member {Uint8Array} address - * @memberof tendermint.abci.Validator - * @instance - */ - Validator.prototype.address = $util.newBuffer([]); - - /** - * Validator power. - * @member {Long} power - * @memberof tendermint.abci.Validator - * @instance - */ - Validator.prototype.power = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Encodes the specified Validator message. Does not implicitly {@link tendermint.abci.Validator.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.Validator - * @static - * @param {tendermint.abci.IValidator} message Validator message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Validator.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.address != null && Object.hasOwnProperty.call(message, "address")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.address); - if (message.power != null && Object.hasOwnProperty.call(message, "power")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.power); - return writer; - }; - - /** - * Encodes the specified Validator message, length delimited. Does not implicitly {@link tendermint.abci.Validator.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.Validator - * @static - * @param {tendermint.abci.IValidator} message Validator message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Validator.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Validator message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.Validator - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.Validator} Validator - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Validator.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.Validator(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.address = reader.bytes(); - break; - case 3: - message.power = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Validator message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.Validator - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.Validator} Validator - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Validator.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Validator message. - * @function verify - * @memberof tendermint.abci.Validator - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Validator.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.address != null && message.hasOwnProperty("address")) - if (!(message.address && typeof message.address.length === "number" || $util.isString(message.address))) - return "address: buffer expected"; - if (message.power != null && message.hasOwnProperty("power")) - if (!$util.isInteger(message.power) && !(message.power && $util.isInteger(message.power.low) && $util.isInteger(message.power.high))) - return "power: integer|Long expected"; - return null; - }; - - /** - * Creates a Validator message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.Validator - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.Validator} Validator - */ - Validator.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.Validator) - return object; - let message = new $root.tendermint.abci.Validator(); - if (object.address != null) - if (typeof object.address === "string") - $util.base64.decode(object.address, message.address = $util.newBuffer($util.base64.length(object.address)), 0); - else if (object.address.length) - message.address = object.address; - if (object.power != null) - if ($util.Long) - (message.power = $util.Long.fromValue(object.power)).unsigned = false; - else if (typeof object.power === "string") - message.power = parseInt(object.power, 10); - else if (typeof object.power === "number") - message.power = object.power; - else if (typeof object.power === "object") - message.power = new $util.LongBits(object.power.low >>> 0, object.power.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a Validator message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.Validator - * @static - * @param {tendermint.abci.Validator} message Validator - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Validator.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if (options.bytes === String) - object.address = ""; - else { - object.address = []; - if (options.bytes !== Array) - object.address = $util.newBuffer(object.address); - } - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.power = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.power = options.longs === String ? "0" : 0; - } - if (message.address != null && message.hasOwnProperty("address")) - object.address = options.bytes === String ? $util.base64.encode(message.address, 0, message.address.length) : options.bytes === Array ? Array.prototype.slice.call(message.address) : message.address; - if (message.power != null && message.hasOwnProperty("power")) - if (typeof message.power === "number") - object.power = options.longs === String ? String(message.power) : message.power; - else - object.power = options.longs === String ? $util.Long.prototype.toString.call(message.power) : options.longs === Number ? new $util.LongBits(message.power.low >>> 0, message.power.high >>> 0).toNumber() : message.power; - return object; - }; - - /** - * Converts this Validator to JSON. - * @function toJSON - * @memberof tendermint.abci.Validator - * @instance - * @returns {Object.} JSON object - */ - Validator.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Validator; - })(); - - abci.ValidatorUpdate = (function() { - - /** - * Properties of a ValidatorUpdate. - * @memberof tendermint.abci - * @interface IValidatorUpdate - * @property {tendermint.crypto.IPublicKey|null} [pub_key] ValidatorUpdate pub_key - * @property {Long|null} [power] ValidatorUpdate power - */ - - /** - * Constructs a new ValidatorUpdate. - * @memberof tendermint.abci - * @classdesc Represents a ValidatorUpdate. - * @implements IValidatorUpdate - * @constructor - * @param {tendermint.abci.IValidatorUpdate=} [properties] Properties to set - */ - function ValidatorUpdate(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ValidatorUpdate pub_key. - * @member {tendermint.crypto.IPublicKey|null|undefined} pub_key - * @memberof tendermint.abci.ValidatorUpdate - * @instance - */ - ValidatorUpdate.prototype.pub_key = null; - - /** - * ValidatorUpdate power. - * @member {Long} power - * @memberof tendermint.abci.ValidatorUpdate - * @instance - */ - ValidatorUpdate.prototype.power = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Encodes the specified ValidatorUpdate message. Does not implicitly {@link tendermint.abci.ValidatorUpdate.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.ValidatorUpdate - * @static - * @param {tendermint.abci.IValidatorUpdate} message ValidatorUpdate message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorUpdate.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.pub_key != null && Object.hasOwnProperty.call(message, "pub_key")) - $root.tendermint.crypto.PublicKey.encode(message.pub_key, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.power != null && Object.hasOwnProperty.call(message, "power")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.power); - return writer; - }; - - /** - * Encodes the specified ValidatorUpdate message, length delimited. Does not implicitly {@link tendermint.abci.ValidatorUpdate.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.ValidatorUpdate - * @static - * @param {tendermint.abci.IValidatorUpdate} message ValidatorUpdate message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorUpdate.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ValidatorUpdate message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.ValidatorUpdate - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.ValidatorUpdate} ValidatorUpdate - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorUpdate.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.ValidatorUpdate(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.pub_key = $root.tendermint.crypto.PublicKey.decode(reader, reader.uint32()); - break; - case 2: - message.power = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ValidatorUpdate message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.ValidatorUpdate - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.ValidatorUpdate} ValidatorUpdate - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorUpdate.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ValidatorUpdate message. - * @function verify - * @memberof tendermint.abci.ValidatorUpdate - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ValidatorUpdate.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.pub_key != null && message.hasOwnProperty("pub_key")) { - let error = $root.tendermint.crypto.PublicKey.verify(message.pub_key); - if (error) - return "pub_key." + error; - } - if (message.power != null && message.hasOwnProperty("power")) - if (!$util.isInteger(message.power) && !(message.power && $util.isInteger(message.power.low) && $util.isInteger(message.power.high))) - return "power: integer|Long expected"; - return null; - }; - - /** - * Creates a ValidatorUpdate message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.ValidatorUpdate - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.ValidatorUpdate} ValidatorUpdate - */ - ValidatorUpdate.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.ValidatorUpdate) - return object; - let message = new $root.tendermint.abci.ValidatorUpdate(); - if (object.pub_key != null) { - if (typeof object.pub_key !== "object") - throw TypeError(".tendermint.abci.ValidatorUpdate.pub_key: object expected"); - message.pub_key = $root.tendermint.crypto.PublicKey.fromObject(object.pub_key); - } - if (object.power != null) - if ($util.Long) - (message.power = $util.Long.fromValue(object.power)).unsigned = false; - else if (typeof object.power === "string") - message.power = parseInt(object.power, 10); - else if (typeof object.power === "number") - message.power = object.power; - else if (typeof object.power === "object") - message.power = new $util.LongBits(object.power.low >>> 0, object.power.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a ValidatorUpdate message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.ValidatorUpdate - * @static - * @param {tendermint.abci.ValidatorUpdate} message ValidatorUpdate - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ValidatorUpdate.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.pub_key = null; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.power = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.power = options.longs === String ? "0" : 0; - } - if (message.pub_key != null && message.hasOwnProperty("pub_key")) - object.pub_key = $root.tendermint.crypto.PublicKey.toObject(message.pub_key, options); - if (message.power != null && message.hasOwnProperty("power")) - if (typeof message.power === "number") - object.power = options.longs === String ? String(message.power) : message.power; - else - object.power = options.longs === String ? $util.Long.prototype.toString.call(message.power) : options.longs === Number ? new $util.LongBits(message.power.low >>> 0, message.power.high >>> 0).toNumber() : message.power; - return object; - }; - - /** - * Converts this ValidatorUpdate to JSON. - * @function toJSON - * @memberof tendermint.abci.ValidatorUpdate - * @instance - * @returns {Object.} JSON object - */ - ValidatorUpdate.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ValidatorUpdate; - })(); - - abci.VoteInfo = (function() { - - /** - * Properties of a VoteInfo. - * @memberof tendermint.abci - * @interface IVoteInfo - * @property {tendermint.abci.IValidator|null} [validator] VoteInfo validator - * @property {boolean|null} [signed_last_block] VoteInfo signed_last_block - */ - - /** - * Constructs a new VoteInfo. - * @memberof tendermint.abci - * @classdesc Represents a VoteInfo. - * @implements IVoteInfo - * @constructor - * @param {tendermint.abci.IVoteInfo=} [properties] Properties to set - */ - function VoteInfo(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * VoteInfo validator. - * @member {tendermint.abci.IValidator|null|undefined} validator - * @memberof tendermint.abci.VoteInfo - * @instance - */ - VoteInfo.prototype.validator = null; - - /** - * VoteInfo signed_last_block. - * @member {boolean} signed_last_block - * @memberof tendermint.abci.VoteInfo - * @instance - */ - VoteInfo.prototype.signed_last_block = false; - - /** - * Encodes the specified VoteInfo message. Does not implicitly {@link tendermint.abci.VoteInfo.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.VoteInfo - * @static - * @param {tendermint.abci.IVoteInfo} message VoteInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - VoteInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.validator != null && Object.hasOwnProperty.call(message, "validator")) - $root.tendermint.abci.Validator.encode(message.validator, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.signed_last_block != null && Object.hasOwnProperty.call(message, "signed_last_block")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.signed_last_block); - return writer; - }; - - /** - * Encodes the specified VoteInfo message, length delimited. Does not implicitly {@link tendermint.abci.VoteInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.VoteInfo - * @static - * @param {tendermint.abci.IVoteInfo} message VoteInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - VoteInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a VoteInfo message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.VoteInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.VoteInfo} VoteInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - VoteInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.VoteInfo(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.validator = $root.tendermint.abci.Validator.decode(reader, reader.uint32()); - break; - case 2: - message.signed_last_block = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a VoteInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.VoteInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.VoteInfo} VoteInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - VoteInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a VoteInfo message. - * @function verify - * @memberof tendermint.abci.VoteInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - VoteInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.validator != null && message.hasOwnProperty("validator")) { - let error = $root.tendermint.abci.Validator.verify(message.validator); - if (error) - return "validator." + error; - } - if (message.signed_last_block != null && message.hasOwnProperty("signed_last_block")) - if (typeof message.signed_last_block !== "boolean") - return "signed_last_block: boolean expected"; - return null; - }; - - /** - * Creates a VoteInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.VoteInfo - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.VoteInfo} VoteInfo - */ - VoteInfo.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.VoteInfo) - return object; - let message = new $root.tendermint.abci.VoteInfo(); - if (object.validator != null) { - if (typeof object.validator !== "object") - throw TypeError(".tendermint.abci.VoteInfo.validator: object expected"); - message.validator = $root.tendermint.abci.Validator.fromObject(object.validator); - } - if (object.signed_last_block != null) - message.signed_last_block = Boolean(object.signed_last_block); - return message; - }; - - /** - * Creates a plain object from a VoteInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.VoteInfo - * @static - * @param {tendermint.abci.VoteInfo} message VoteInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - VoteInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.validator = null; - object.signed_last_block = false; - } - if (message.validator != null && message.hasOwnProperty("validator")) - object.validator = $root.tendermint.abci.Validator.toObject(message.validator, options); - if (message.signed_last_block != null && message.hasOwnProperty("signed_last_block")) - object.signed_last_block = message.signed_last_block; - return object; - }; - - /** - * Converts this VoteInfo to JSON. - * @function toJSON - * @memberof tendermint.abci.VoteInfo - * @instance - * @returns {Object.} JSON object - */ - VoteInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return VoteInfo; - })(); - - /** - * EvidenceType enum. - * @name tendermint.abci.EvidenceType - * @enum {number} - * @property {number} UNKNOWN=0 UNKNOWN value - * @property {number} DUPLICATE_VOTE=1 DUPLICATE_VOTE value - * @property {number} LIGHT_CLIENT_ATTACK=2 LIGHT_CLIENT_ATTACK value - */ - abci.EvidenceType = (function() { - const valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "UNKNOWN"] = 0; - values[valuesById[1] = "DUPLICATE_VOTE"] = 1; - values[valuesById[2] = "LIGHT_CLIENT_ATTACK"] = 2; - return values; - })(); - - abci.Evidence = (function() { - - /** - * Properties of an Evidence. - * @memberof tendermint.abci - * @interface IEvidence - * @property {tendermint.abci.EvidenceType|null} [type] Evidence type - * @property {tendermint.abci.IValidator|null} [validator] Evidence validator - * @property {Long|null} [height] Evidence height - * @property {google.protobuf.ITimestamp|null} [time] Evidence time - * @property {Long|null} [total_voting_power] Evidence total_voting_power - */ - - /** - * Constructs a new Evidence. - * @memberof tendermint.abci - * @classdesc Represents an Evidence. - * @implements IEvidence - * @constructor - * @param {tendermint.abci.IEvidence=} [properties] Properties to set - */ - function Evidence(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Evidence type. - * @member {tendermint.abci.EvidenceType} type - * @memberof tendermint.abci.Evidence - * @instance - */ - Evidence.prototype.type = 0; - - /** - * Evidence validator. - * @member {tendermint.abci.IValidator|null|undefined} validator - * @memberof tendermint.abci.Evidence - * @instance - */ - Evidence.prototype.validator = null; - - /** - * Evidence height. - * @member {Long} height - * @memberof tendermint.abci.Evidence - * @instance - */ - Evidence.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Evidence time. - * @member {google.protobuf.ITimestamp|null|undefined} time - * @memberof tendermint.abci.Evidence - * @instance - */ - Evidence.prototype.time = null; - - /** - * Evidence total_voting_power. - * @member {Long} total_voting_power - * @memberof tendermint.abci.Evidence - * @instance - */ - Evidence.prototype.total_voting_power = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Encodes the specified Evidence message. Does not implicitly {@link tendermint.abci.Evidence.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.Evidence - * @static - * @param {tendermint.abci.IEvidence} message Evidence message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Evidence.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); - if (message.validator != null && Object.hasOwnProperty.call(message, "validator")) - $root.tendermint.abci.Validator.encode(message.validator, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.height); - if (message.time != null && Object.hasOwnProperty.call(message, "time")) - $root.google.protobuf.Timestamp.encode(message.time, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.total_voting_power != null && Object.hasOwnProperty.call(message, "total_voting_power")) - writer.uint32(/* id 5, wireType 0 =*/40).int64(message.total_voting_power); - return writer; - }; - - /** - * Encodes the specified Evidence message, length delimited. Does not implicitly {@link tendermint.abci.Evidence.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.Evidence - * @static - * @param {tendermint.abci.IEvidence} message Evidence message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Evidence.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Evidence message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.Evidence - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.Evidence} Evidence - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Evidence.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.Evidence(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.type = reader.int32(); - break; - case 2: - message.validator = $root.tendermint.abci.Validator.decode(reader, reader.uint32()); - break; - case 3: - message.height = reader.int64(); - break; - case 4: - message.time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 5: - message.total_voting_power = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Evidence message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.Evidence - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.Evidence} Evidence - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Evidence.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Evidence message. - * @function verify - * @memberof tendermint.abci.Evidence - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Evidence.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.validator != null && message.hasOwnProperty("validator")) { - let error = $root.tendermint.abci.Validator.verify(message.validator); - if (error) - return "validator." + error; - } - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) - return "height: integer|Long expected"; - if (message.time != null && message.hasOwnProperty("time")) { - let error = $root.google.protobuf.Timestamp.verify(message.time); - if (error) - return "time." + error; - } - if (message.total_voting_power != null && message.hasOwnProperty("total_voting_power")) - if (!$util.isInteger(message.total_voting_power) && !(message.total_voting_power && $util.isInteger(message.total_voting_power.low) && $util.isInteger(message.total_voting_power.high))) - return "total_voting_power: integer|Long expected"; - return null; - }; - - /** - * Creates an Evidence message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.Evidence - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.Evidence} Evidence - */ - Evidence.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.Evidence) - return object; - let message = new $root.tendermint.abci.Evidence(); - switch (object.type) { - case "UNKNOWN": - case 0: - message.type = 0; - break; - case "DUPLICATE_VOTE": - case 1: - message.type = 1; - break; - case "LIGHT_CLIENT_ATTACK": - case 2: - message.type = 2; - break; - } - if (object.validator != null) { - if (typeof object.validator !== "object") - throw TypeError(".tendermint.abci.Evidence.validator: object expected"); - message.validator = $root.tendermint.abci.Validator.fromObject(object.validator); - } - if (object.height != null) - if ($util.Long) - (message.height = $util.Long.fromValue(object.height)).unsigned = false; - else if (typeof object.height === "string") - message.height = parseInt(object.height, 10); - else if (typeof object.height === "number") - message.height = object.height; - else if (typeof object.height === "object") - message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); - if (object.time != null) { - if (typeof object.time !== "object") - throw TypeError(".tendermint.abci.Evidence.time: object expected"); - message.time = $root.google.protobuf.Timestamp.fromObject(object.time); - } - if (object.total_voting_power != null) - if ($util.Long) - (message.total_voting_power = $util.Long.fromValue(object.total_voting_power)).unsigned = false; - else if (typeof object.total_voting_power === "string") - message.total_voting_power = parseInt(object.total_voting_power, 10); - else if (typeof object.total_voting_power === "number") - message.total_voting_power = object.total_voting_power; - else if (typeof object.total_voting_power === "object") - message.total_voting_power = new $util.LongBits(object.total_voting_power.low >>> 0, object.total_voting_power.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from an Evidence message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.Evidence - * @static - * @param {tendermint.abci.Evidence} message Evidence - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Evidence.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.type = options.enums === String ? "UNKNOWN" : 0; - object.validator = null; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.height = options.longs === String ? "0" : 0; - object.time = null; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.total_voting_power = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.total_voting_power = options.longs === String ? "0" : 0; - } - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.tendermint.abci.EvidenceType[message.type] : message.type; - if (message.validator != null && message.hasOwnProperty("validator")) - object.validator = $root.tendermint.abci.Validator.toObject(message.validator, options); - if (message.height != null && message.hasOwnProperty("height")) - if (typeof message.height === "number") - object.height = options.longs === String ? String(message.height) : message.height; - else - object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; - if (message.time != null && message.hasOwnProperty("time")) - object.time = $root.google.protobuf.Timestamp.toObject(message.time, options); - if (message.total_voting_power != null && message.hasOwnProperty("total_voting_power")) - if (typeof message.total_voting_power === "number") - object.total_voting_power = options.longs === String ? String(message.total_voting_power) : message.total_voting_power; - else - object.total_voting_power = options.longs === String ? $util.Long.prototype.toString.call(message.total_voting_power) : options.longs === Number ? new $util.LongBits(message.total_voting_power.low >>> 0, message.total_voting_power.high >>> 0).toNumber() : message.total_voting_power; - return object; - }; - - /** - * Converts this Evidence to JSON. - * @function toJSON - * @memberof tendermint.abci.Evidence - * @instance - * @returns {Object.} JSON object - */ - Evidence.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Evidence; - })(); - - abci.Snapshot = (function() { - - /** - * Properties of a Snapshot. - * @memberof tendermint.abci - * @interface ISnapshot - * @property {Long|null} [height] Snapshot height - * @property {number|null} [format] Snapshot format - * @property {number|null} [chunks] Snapshot chunks - * @property {Uint8Array|null} [hash] Snapshot hash - * @property {Uint8Array|null} [metadata] Snapshot metadata - */ - - /** - * Constructs a new Snapshot. - * @memberof tendermint.abci - * @classdesc Represents a Snapshot. - * @implements ISnapshot - * @constructor - * @param {tendermint.abci.ISnapshot=} [properties] Properties to set - */ - function Snapshot(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Snapshot height. - * @member {Long} height - * @memberof tendermint.abci.Snapshot - * @instance - */ - Snapshot.prototype.height = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Snapshot format. - * @member {number} format - * @memberof tendermint.abci.Snapshot - * @instance - */ - Snapshot.prototype.format = 0; - - /** - * Snapshot chunks. - * @member {number} chunks - * @memberof tendermint.abci.Snapshot - * @instance - */ - Snapshot.prototype.chunks = 0; - - /** - * Snapshot hash. - * @member {Uint8Array} hash - * @memberof tendermint.abci.Snapshot - * @instance - */ - Snapshot.prototype.hash = $util.newBuffer([]); - - /** - * Snapshot metadata. - * @member {Uint8Array} metadata - * @memberof tendermint.abci.Snapshot - * @instance - */ - Snapshot.prototype.metadata = $util.newBuffer([]); - - /** - * Encodes the specified Snapshot message. Does not implicitly {@link tendermint.abci.Snapshot.verify|verify} messages. - * @function encode - * @memberof tendermint.abci.Snapshot - * @static - * @param {tendermint.abci.ISnapshot} message Snapshot message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Snapshot.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.height); - if (message.format != null && Object.hasOwnProperty.call(message, "format")) - writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.format); - if (message.chunks != null && Object.hasOwnProperty.call(message, "chunks")) - writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.chunks); - if (message.hash != null && Object.hasOwnProperty.call(message, "hash")) - writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.hash); - if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.metadata); - return writer; - }; - - /** - * Encodes the specified Snapshot message, length delimited. Does not implicitly {@link tendermint.abci.Snapshot.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.abci.Snapshot - * @static - * @param {tendermint.abci.ISnapshot} message Snapshot message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Snapshot.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Snapshot message from the specified reader or buffer. - * @function decode - * @memberof tendermint.abci.Snapshot - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.abci.Snapshot} Snapshot - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Snapshot.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.abci.Snapshot(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.height = reader.uint64(); - break; - case 2: - message.format = reader.uint32(); - break; - case 3: - message.chunks = reader.uint32(); - break; - case 4: - message.hash = reader.bytes(); - break; - case 5: - message.metadata = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Snapshot message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.abci.Snapshot - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.abci.Snapshot} Snapshot - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Snapshot.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Snapshot message. - * @function verify - * @memberof tendermint.abci.Snapshot - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Snapshot.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) - return "height: integer|Long expected"; - if (message.format != null && message.hasOwnProperty("format")) - if (!$util.isInteger(message.format)) - return "format: integer expected"; - if (message.chunks != null && message.hasOwnProperty("chunks")) - if (!$util.isInteger(message.chunks)) - return "chunks: integer expected"; - if (message.hash != null && message.hasOwnProperty("hash")) - if (!(message.hash && typeof message.hash.length === "number" || $util.isString(message.hash))) - return "hash: buffer expected"; - if (message.metadata != null && message.hasOwnProperty("metadata")) - if (!(message.metadata && typeof message.metadata.length === "number" || $util.isString(message.metadata))) - return "metadata: buffer expected"; - return null; - }; - - /** - * Creates a Snapshot message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.abci.Snapshot - * @static - * @param {Object.} object Plain object - * @returns {tendermint.abci.Snapshot} Snapshot - */ - Snapshot.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.abci.Snapshot) - return object; - let message = new $root.tendermint.abci.Snapshot(); - if (object.height != null) - if ($util.Long) - (message.height = $util.Long.fromValue(object.height)).unsigned = true; - else if (typeof object.height === "string") - message.height = parseInt(object.height, 10); - else if (typeof object.height === "number") - message.height = object.height; - else if (typeof object.height === "object") - message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(true); - if (object.format != null) - message.format = object.format >>> 0; - if (object.chunks != null) - message.chunks = object.chunks >>> 0; - if (object.hash != null) - if (typeof object.hash === "string") - $util.base64.decode(object.hash, message.hash = $util.newBuffer($util.base64.length(object.hash)), 0); - else if (object.hash.length) - message.hash = object.hash; - if (object.metadata != null) - if (typeof object.metadata === "string") - $util.base64.decode(object.metadata, message.metadata = $util.newBuffer($util.base64.length(object.metadata)), 0); - else if (object.metadata.length) - message.metadata = object.metadata; - return message; - }; - - /** - * Creates a plain object from a Snapshot message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.abci.Snapshot - * @static - * @param {tendermint.abci.Snapshot} message Snapshot - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Snapshot.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.height = options.longs === String ? "0" : 0; - object.format = 0; - object.chunks = 0; - if (options.bytes === String) - object.hash = ""; - else { - object.hash = []; - if (options.bytes !== Array) - object.hash = $util.newBuffer(object.hash); - } - if (options.bytes === String) - object.metadata = ""; - else { - object.metadata = []; - if (options.bytes !== Array) - object.metadata = $util.newBuffer(object.metadata); - } - } - if (message.height != null && message.hasOwnProperty("height")) - if (typeof message.height === "number") - object.height = options.longs === String ? String(message.height) : message.height; - else - object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber(true) : message.height; - if (message.format != null && message.hasOwnProperty("format")) - object.format = message.format; - if (message.chunks != null && message.hasOwnProperty("chunks")) - object.chunks = message.chunks; - if (message.hash != null && message.hasOwnProperty("hash")) - object.hash = options.bytes === String ? $util.base64.encode(message.hash, 0, message.hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.hash) : message.hash; - if (message.metadata != null && message.hasOwnProperty("metadata")) - object.metadata = options.bytes === String ? $util.base64.encode(message.metadata, 0, message.metadata.length) : options.bytes === Array ? Array.prototype.slice.call(message.metadata) : message.metadata; - return object; - }; - - /** - * Converts this Snapshot to JSON. - * @function toJSON - * @memberof tendermint.abci.Snapshot - * @instance - * @returns {Object.} JSON object - */ - Snapshot.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Snapshot; - })(); - - abci.ABCIApplication = (function() { - - /** - * Constructs a new ABCIApplication service. - * @memberof tendermint.abci - * @classdesc Represents a ABCIApplication - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function ABCIApplication(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (ABCIApplication.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ABCIApplication; - - /** - * Callback as used by {@link tendermint.abci.ABCIApplication#echo}. - * @memberof tendermint.abci.ABCIApplication - * @typedef EchoCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {tendermint.abci.ResponseEcho} [response] ResponseEcho - */ - - /** - * Calls Echo. - * @function echo - * @memberof tendermint.abci.ABCIApplication - * @instance - * @param {tendermint.abci.IRequestEcho} request RequestEcho message or plain object - * @param {tendermint.abci.ABCIApplication.EchoCallback} callback Node-style callback called with the error, if any, and ResponseEcho - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ABCIApplication.prototype.echo = function echo(request, callback) { - return this.rpcCall(echo, $root.tendermint.abci.RequestEcho, $root.tendermint.abci.ResponseEcho, request, callback); - }, "name", { value: "Echo" }); - - /** - * Calls Echo. - * @function echo - * @memberof tendermint.abci.ABCIApplication - * @instance - * @param {tendermint.abci.IRequestEcho} request RequestEcho message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link tendermint.abci.ABCIApplication#flush}. - * @memberof tendermint.abci.ABCIApplication - * @typedef FlushCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {tendermint.abci.ResponseFlush} [response] ResponseFlush - */ - - /** - * Calls Flush. - * @function flush - * @memberof tendermint.abci.ABCIApplication - * @instance - * @param {tendermint.abci.IRequestFlush} request RequestFlush message or plain object - * @param {tendermint.abci.ABCIApplication.FlushCallback} callback Node-style callback called with the error, if any, and ResponseFlush - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ABCIApplication.prototype.flush = function flush(request, callback) { - return this.rpcCall(flush, $root.tendermint.abci.RequestFlush, $root.tendermint.abci.ResponseFlush, request, callback); - }, "name", { value: "Flush" }); - - /** - * Calls Flush. - * @function flush - * @memberof tendermint.abci.ABCIApplication - * @instance - * @param {tendermint.abci.IRequestFlush} request RequestFlush message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link tendermint.abci.ABCIApplication#info}. - * @memberof tendermint.abci.ABCIApplication - * @typedef InfoCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {tendermint.abci.ResponseInfo} [response] ResponseInfo - */ - - /** - * Calls Info. - * @function info - * @memberof tendermint.abci.ABCIApplication - * @instance - * @param {tendermint.abci.IRequestInfo} request RequestInfo message or plain object - * @param {tendermint.abci.ABCIApplication.InfoCallback} callback Node-style callback called with the error, if any, and ResponseInfo - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ABCIApplication.prototype.info = function info(request, callback) { - return this.rpcCall(info, $root.tendermint.abci.RequestInfo, $root.tendermint.abci.ResponseInfo, request, callback); - }, "name", { value: "Info" }); - - /** - * Calls Info. - * @function info - * @memberof tendermint.abci.ABCIApplication - * @instance - * @param {tendermint.abci.IRequestInfo} request RequestInfo message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link tendermint.abci.ABCIApplication#setOption}. - * @memberof tendermint.abci.ABCIApplication - * @typedef SetOptionCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {tendermint.abci.ResponseSetOption} [response] ResponseSetOption - */ - - /** - * Calls SetOption. - * @function setOption - * @memberof tendermint.abci.ABCIApplication - * @instance - * @param {tendermint.abci.IRequestSetOption} request RequestSetOption message or plain object - * @param {tendermint.abci.ABCIApplication.SetOptionCallback} callback Node-style callback called with the error, if any, and ResponseSetOption - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ABCIApplication.prototype.setOption = function setOption(request, callback) { - return this.rpcCall(setOption, $root.tendermint.abci.RequestSetOption, $root.tendermint.abci.ResponseSetOption, request, callback); - }, "name", { value: "SetOption" }); - - /** - * Calls SetOption. - * @function setOption - * @memberof tendermint.abci.ABCIApplication - * @instance - * @param {tendermint.abci.IRequestSetOption} request RequestSetOption message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link tendermint.abci.ABCIApplication#deliverTx}. - * @memberof tendermint.abci.ABCIApplication - * @typedef DeliverTxCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {tendermint.abci.ResponseDeliverTx} [response] ResponseDeliverTx - */ - - /** - * Calls DeliverTx. - * @function deliverTx - * @memberof tendermint.abci.ABCIApplication - * @instance - * @param {tendermint.abci.IRequestDeliverTx} request RequestDeliverTx message or plain object - * @param {tendermint.abci.ABCIApplication.DeliverTxCallback} callback Node-style callback called with the error, if any, and ResponseDeliverTx - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ABCIApplication.prototype.deliverTx = function deliverTx(request, callback) { - return this.rpcCall(deliverTx, $root.tendermint.abci.RequestDeliverTx, $root.tendermint.abci.ResponseDeliverTx, request, callback); - }, "name", { value: "DeliverTx" }); - - /** - * Calls DeliverTx. - * @function deliverTx - * @memberof tendermint.abci.ABCIApplication - * @instance - * @param {tendermint.abci.IRequestDeliverTx} request RequestDeliverTx message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link tendermint.abci.ABCIApplication#checkTx}. - * @memberof tendermint.abci.ABCIApplication - * @typedef CheckTxCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {tendermint.abci.ResponseCheckTx} [response] ResponseCheckTx - */ - - /** - * Calls CheckTx. - * @function checkTx - * @memberof tendermint.abci.ABCIApplication - * @instance - * @param {tendermint.abci.IRequestCheckTx} request RequestCheckTx message or plain object - * @param {tendermint.abci.ABCIApplication.CheckTxCallback} callback Node-style callback called with the error, if any, and ResponseCheckTx - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ABCIApplication.prototype.checkTx = function checkTx(request, callback) { - return this.rpcCall(checkTx, $root.tendermint.abci.RequestCheckTx, $root.tendermint.abci.ResponseCheckTx, request, callback); - }, "name", { value: "CheckTx" }); - - /** - * Calls CheckTx. - * @function checkTx - * @memberof tendermint.abci.ABCIApplication - * @instance - * @param {tendermint.abci.IRequestCheckTx} request RequestCheckTx message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link tendermint.abci.ABCIApplication#query}. - * @memberof tendermint.abci.ABCIApplication - * @typedef QueryCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {tendermint.abci.ResponseQuery} [response] ResponseQuery - */ - - /** - * Calls Query. - * @function query - * @memberof tendermint.abci.ABCIApplication - * @instance - * @param {tendermint.abci.IRequestQuery} request RequestQuery message or plain object - * @param {tendermint.abci.ABCIApplication.QueryCallback} callback Node-style callback called with the error, if any, and ResponseQuery - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ABCIApplication.prototype.query = function query(request, callback) { - return this.rpcCall(query, $root.tendermint.abci.RequestQuery, $root.tendermint.abci.ResponseQuery, request, callback); - }, "name", { value: "Query" }); - - /** - * Calls Query. - * @function query - * @memberof tendermint.abci.ABCIApplication - * @instance - * @param {tendermint.abci.IRequestQuery} request RequestQuery message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link tendermint.abci.ABCIApplication#commit}. - * @memberof tendermint.abci.ABCIApplication - * @typedef CommitCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {tendermint.abci.ResponseCommit} [response] ResponseCommit - */ - - /** - * Calls Commit. - * @function commit - * @memberof tendermint.abci.ABCIApplication - * @instance - * @param {tendermint.abci.IRequestCommit} request RequestCommit message or plain object - * @param {tendermint.abci.ABCIApplication.CommitCallback} callback Node-style callback called with the error, if any, and ResponseCommit - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ABCIApplication.prototype.commit = function commit(request, callback) { - return this.rpcCall(commit, $root.tendermint.abci.RequestCommit, $root.tendermint.abci.ResponseCommit, request, callback); - }, "name", { value: "Commit" }); - - /** - * Calls Commit. - * @function commit - * @memberof tendermint.abci.ABCIApplication - * @instance - * @param {tendermint.abci.IRequestCommit} request RequestCommit message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link tendermint.abci.ABCIApplication#initChain}. - * @memberof tendermint.abci.ABCIApplication - * @typedef InitChainCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {tendermint.abci.ResponseInitChain} [response] ResponseInitChain - */ - - /** - * Calls InitChain. - * @function initChain - * @memberof tendermint.abci.ABCIApplication - * @instance - * @param {tendermint.abci.IRequestInitChain} request RequestInitChain message or plain object - * @param {tendermint.abci.ABCIApplication.InitChainCallback} callback Node-style callback called with the error, if any, and ResponseInitChain - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ABCIApplication.prototype.initChain = function initChain(request, callback) { - return this.rpcCall(initChain, $root.tendermint.abci.RequestInitChain, $root.tendermint.abci.ResponseInitChain, request, callback); - }, "name", { value: "InitChain" }); - - /** - * Calls InitChain. - * @function initChain - * @memberof tendermint.abci.ABCIApplication - * @instance - * @param {tendermint.abci.IRequestInitChain} request RequestInitChain message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link tendermint.abci.ABCIApplication#beginBlock}. - * @memberof tendermint.abci.ABCIApplication - * @typedef BeginBlockCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {tendermint.abci.ResponseBeginBlock} [response] ResponseBeginBlock - */ - - /** - * Calls BeginBlock. - * @function beginBlock - * @memberof tendermint.abci.ABCIApplication - * @instance - * @param {tendermint.abci.IRequestBeginBlock} request RequestBeginBlock message or plain object - * @param {tendermint.abci.ABCIApplication.BeginBlockCallback} callback Node-style callback called with the error, if any, and ResponseBeginBlock - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ABCIApplication.prototype.beginBlock = function beginBlock(request, callback) { - return this.rpcCall(beginBlock, $root.tendermint.abci.RequestBeginBlock, $root.tendermint.abci.ResponseBeginBlock, request, callback); - }, "name", { value: "BeginBlock" }); - - /** - * Calls BeginBlock. - * @function beginBlock - * @memberof tendermint.abci.ABCIApplication - * @instance - * @param {tendermint.abci.IRequestBeginBlock} request RequestBeginBlock message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link tendermint.abci.ABCIApplication#endBlock}. - * @memberof tendermint.abci.ABCIApplication - * @typedef EndBlockCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {tendermint.abci.ResponseEndBlock} [response] ResponseEndBlock - */ - - /** - * Calls EndBlock. - * @function endBlock - * @memberof tendermint.abci.ABCIApplication - * @instance - * @param {tendermint.abci.IRequestEndBlock} request RequestEndBlock message or plain object - * @param {tendermint.abci.ABCIApplication.EndBlockCallback} callback Node-style callback called with the error, if any, and ResponseEndBlock - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ABCIApplication.prototype.endBlock = function endBlock(request, callback) { - return this.rpcCall(endBlock, $root.tendermint.abci.RequestEndBlock, $root.tendermint.abci.ResponseEndBlock, request, callback); - }, "name", { value: "EndBlock" }); - - /** - * Calls EndBlock. - * @function endBlock - * @memberof tendermint.abci.ABCIApplication - * @instance - * @param {tendermint.abci.IRequestEndBlock} request RequestEndBlock message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link tendermint.abci.ABCIApplication#listSnapshots}. - * @memberof tendermint.abci.ABCIApplication - * @typedef ListSnapshotsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {tendermint.abci.ResponseListSnapshots} [response] ResponseListSnapshots - */ - - /** - * Calls ListSnapshots. - * @function listSnapshots - * @memberof tendermint.abci.ABCIApplication - * @instance - * @param {tendermint.abci.IRequestListSnapshots} request RequestListSnapshots message or plain object - * @param {tendermint.abci.ABCIApplication.ListSnapshotsCallback} callback Node-style callback called with the error, if any, and ResponseListSnapshots - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ABCIApplication.prototype.listSnapshots = function listSnapshots(request, callback) { - return this.rpcCall(listSnapshots, $root.tendermint.abci.RequestListSnapshots, $root.tendermint.abci.ResponseListSnapshots, request, callback); - }, "name", { value: "ListSnapshots" }); - - /** - * Calls ListSnapshots. - * @function listSnapshots - * @memberof tendermint.abci.ABCIApplication - * @instance - * @param {tendermint.abci.IRequestListSnapshots} request RequestListSnapshots message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link tendermint.abci.ABCIApplication#offerSnapshot}. - * @memberof tendermint.abci.ABCIApplication - * @typedef OfferSnapshotCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {tendermint.abci.ResponseOfferSnapshot} [response] ResponseOfferSnapshot - */ - - /** - * Calls OfferSnapshot. - * @function offerSnapshot - * @memberof tendermint.abci.ABCIApplication - * @instance - * @param {tendermint.abci.IRequestOfferSnapshot} request RequestOfferSnapshot message or plain object - * @param {tendermint.abci.ABCIApplication.OfferSnapshotCallback} callback Node-style callback called with the error, if any, and ResponseOfferSnapshot - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ABCIApplication.prototype.offerSnapshot = function offerSnapshot(request, callback) { - return this.rpcCall(offerSnapshot, $root.tendermint.abci.RequestOfferSnapshot, $root.tendermint.abci.ResponseOfferSnapshot, request, callback); - }, "name", { value: "OfferSnapshot" }); - - /** - * Calls OfferSnapshot. - * @function offerSnapshot - * @memberof tendermint.abci.ABCIApplication - * @instance - * @param {tendermint.abci.IRequestOfferSnapshot} request RequestOfferSnapshot message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link tendermint.abci.ABCIApplication#loadSnapshotChunk}. - * @memberof tendermint.abci.ABCIApplication - * @typedef LoadSnapshotChunkCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {tendermint.abci.ResponseLoadSnapshotChunk} [response] ResponseLoadSnapshotChunk - */ - - /** - * Calls LoadSnapshotChunk. - * @function loadSnapshotChunk - * @memberof tendermint.abci.ABCIApplication - * @instance - * @param {tendermint.abci.IRequestLoadSnapshotChunk} request RequestLoadSnapshotChunk message or plain object - * @param {tendermint.abci.ABCIApplication.LoadSnapshotChunkCallback} callback Node-style callback called with the error, if any, and ResponseLoadSnapshotChunk - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ABCIApplication.prototype.loadSnapshotChunk = function loadSnapshotChunk(request, callback) { - return this.rpcCall(loadSnapshotChunk, $root.tendermint.abci.RequestLoadSnapshotChunk, $root.tendermint.abci.ResponseLoadSnapshotChunk, request, callback); - }, "name", { value: "LoadSnapshotChunk" }); - - /** - * Calls LoadSnapshotChunk. - * @function loadSnapshotChunk - * @memberof tendermint.abci.ABCIApplication - * @instance - * @param {tendermint.abci.IRequestLoadSnapshotChunk} request RequestLoadSnapshotChunk message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link tendermint.abci.ABCIApplication#applySnapshotChunk}. - * @memberof tendermint.abci.ABCIApplication - * @typedef ApplySnapshotChunkCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {tendermint.abci.ResponseApplySnapshotChunk} [response] ResponseApplySnapshotChunk - */ - - /** - * Calls ApplySnapshotChunk. - * @function applySnapshotChunk - * @memberof tendermint.abci.ABCIApplication - * @instance - * @param {tendermint.abci.IRequestApplySnapshotChunk} request RequestApplySnapshotChunk message or plain object - * @param {tendermint.abci.ABCIApplication.ApplySnapshotChunkCallback} callback Node-style callback called with the error, if any, and ResponseApplySnapshotChunk - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ABCIApplication.prototype.applySnapshotChunk = function applySnapshotChunk(request, callback) { - return this.rpcCall(applySnapshotChunk, $root.tendermint.abci.RequestApplySnapshotChunk, $root.tendermint.abci.ResponseApplySnapshotChunk, request, callback); - }, "name", { value: "ApplySnapshotChunk" }); - - /** - * Calls ApplySnapshotChunk. - * @function applySnapshotChunk - * @memberof tendermint.abci.ABCIApplication - * @instance - * @param {tendermint.abci.IRequestApplySnapshotChunk} request RequestApplySnapshotChunk message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return ABCIApplication; - })(); - - return abci; - })(); - - tendermint.crypto = (function() { - - /** - * Namespace crypto. - * @memberof tendermint - * @namespace - */ - const crypto = {}; - - crypto.Proof = (function() { - - /** - * Properties of a Proof. - * @memberof tendermint.crypto - * @interface IProof - * @property {Long|null} [total] Proof total - * @property {Long|null} [index] Proof index - * @property {Uint8Array|null} [leaf_hash] Proof leaf_hash - * @property {Array.|null} [aunts] Proof aunts - */ - - /** - * Constructs a new Proof. - * @memberof tendermint.crypto - * @classdesc Represents a Proof. - * @implements IProof - * @constructor - * @param {tendermint.crypto.IProof=} [properties] Properties to set - */ - function Proof(properties) { - this.aunts = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Proof total. - * @member {Long} total - * @memberof tendermint.crypto.Proof - * @instance - */ - Proof.prototype.total = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Proof index. - * @member {Long} index - * @memberof tendermint.crypto.Proof - * @instance - */ - Proof.prototype.index = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Proof leaf_hash. - * @member {Uint8Array} leaf_hash - * @memberof tendermint.crypto.Proof - * @instance - */ - Proof.prototype.leaf_hash = $util.newBuffer([]); - - /** - * Proof aunts. - * @member {Array.} aunts - * @memberof tendermint.crypto.Proof - * @instance - */ - Proof.prototype.aunts = $util.emptyArray; - - /** - * Encodes the specified Proof message. Does not implicitly {@link tendermint.crypto.Proof.verify|verify} messages. - * @function encode - * @memberof tendermint.crypto.Proof - * @static - * @param {tendermint.crypto.IProof} message Proof message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Proof.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.total != null && Object.hasOwnProperty.call(message, "total")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.total); - if (message.index != null && Object.hasOwnProperty.call(message, "index")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.index); - if (message.leaf_hash != null && Object.hasOwnProperty.call(message, "leaf_hash")) - writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.leaf_hash); - if (message.aunts != null && message.aunts.length) - for (let i = 0; i < message.aunts.length; ++i) - writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.aunts[i]); - return writer; - }; - - /** - * Encodes the specified Proof message, length delimited. Does not implicitly {@link tendermint.crypto.Proof.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.crypto.Proof - * @static - * @param {tendermint.crypto.IProof} message Proof message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Proof.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Proof message from the specified reader or buffer. - * @function decode - * @memberof tendermint.crypto.Proof - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.crypto.Proof} Proof - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Proof.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.crypto.Proof(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.total = reader.int64(); - break; - case 2: - message.index = reader.int64(); - break; - case 3: - message.leaf_hash = reader.bytes(); - break; - case 4: - if (!(message.aunts && message.aunts.length)) - message.aunts = []; - message.aunts.push(reader.bytes()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Proof message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.crypto.Proof - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.crypto.Proof} Proof - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Proof.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Proof message. - * @function verify - * @memberof tendermint.crypto.Proof - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Proof.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.total != null && message.hasOwnProperty("total")) - if (!$util.isInteger(message.total) && !(message.total && $util.isInteger(message.total.low) && $util.isInteger(message.total.high))) - return "total: integer|Long expected"; - if (message.index != null && message.hasOwnProperty("index")) - if (!$util.isInteger(message.index) && !(message.index && $util.isInteger(message.index.low) && $util.isInteger(message.index.high))) - return "index: integer|Long expected"; - if (message.leaf_hash != null && message.hasOwnProperty("leaf_hash")) - if (!(message.leaf_hash && typeof message.leaf_hash.length === "number" || $util.isString(message.leaf_hash))) - return "leaf_hash: buffer expected"; - if (message.aunts != null && message.hasOwnProperty("aunts")) { - if (!Array.isArray(message.aunts)) - return "aunts: array expected"; - for (let i = 0; i < message.aunts.length; ++i) - if (!(message.aunts[i] && typeof message.aunts[i].length === "number" || $util.isString(message.aunts[i]))) - return "aunts: buffer[] expected"; - } - return null; - }; - - /** - * Creates a Proof message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.crypto.Proof - * @static - * @param {Object.} object Plain object - * @returns {tendermint.crypto.Proof} Proof - */ - Proof.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.crypto.Proof) - return object; - let message = new $root.tendermint.crypto.Proof(); - if (object.total != null) - if ($util.Long) - (message.total = $util.Long.fromValue(object.total)).unsigned = false; - else if (typeof object.total === "string") - message.total = parseInt(object.total, 10); - else if (typeof object.total === "number") - message.total = object.total; - else if (typeof object.total === "object") - message.total = new $util.LongBits(object.total.low >>> 0, object.total.high >>> 0).toNumber(); - if (object.index != null) - if ($util.Long) - (message.index = $util.Long.fromValue(object.index)).unsigned = false; - else if (typeof object.index === "string") - message.index = parseInt(object.index, 10); - else if (typeof object.index === "number") - message.index = object.index; - else if (typeof object.index === "object") - message.index = new $util.LongBits(object.index.low >>> 0, object.index.high >>> 0).toNumber(); - if (object.leaf_hash != null) - if (typeof object.leaf_hash === "string") - $util.base64.decode(object.leaf_hash, message.leaf_hash = $util.newBuffer($util.base64.length(object.leaf_hash)), 0); - else if (object.leaf_hash.length) - message.leaf_hash = object.leaf_hash; - if (object.aunts) { - if (!Array.isArray(object.aunts)) - throw TypeError(".tendermint.crypto.Proof.aunts: array expected"); - message.aunts = []; - for (let i = 0; i < object.aunts.length; ++i) - if (typeof object.aunts[i] === "string") - $util.base64.decode(object.aunts[i], message.aunts[i] = $util.newBuffer($util.base64.length(object.aunts[i])), 0); - else if (object.aunts[i].length) - message.aunts[i] = object.aunts[i]; - } - return message; - }; - - /** - * Creates a plain object from a Proof message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.crypto.Proof - * @static - * @param {tendermint.crypto.Proof} message Proof - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Proof.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.aunts = []; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.total = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.total = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.index = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.index = options.longs === String ? "0" : 0; - if (options.bytes === String) - object.leaf_hash = ""; - else { - object.leaf_hash = []; - if (options.bytes !== Array) - object.leaf_hash = $util.newBuffer(object.leaf_hash); - } - } - if (message.total != null && message.hasOwnProperty("total")) - if (typeof message.total === "number") - object.total = options.longs === String ? String(message.total) : message.total; - else - object.total = options.longs === String ? $util.Long.prototype.toString.call(message.total) : options.longs === Number ? new $util.LongBits(message.total.low >>> 0, message.total.high >>> 0).toNumber() : message.total; - if (message.index != null && message.hasOwnProperty("index")) - if (typeof message.index === "number") - object.index = options.longs === String ? String(message.index) : message.index; - else - object.index = options.longs === String ? $util.Long.prototype.toString.call(message.index) : options.longs === Number ? new $util.LongBits(message.index.low >>> 0, message.index.high >>> 0).toNumber() : message.index; - if (message.leaf_hash != null && message.hasOwnProperty("leaf_hash")) - object.leaf_hash = options.bytes === String ? $util.base64.encode(message.leaf_hash, 0, message.leaf_hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.leaf_hash) : message.leaf_hash; - if (message.aunts && message.aunts.length) { - object.aunts = []; - for (let j = 0; j < message.aunts.length; ++j) - object.aunts[j] = options.bytes === String ? $util.base64.encode(message.aunts[j], 0, message.aunts[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.aunts[j]) : message.aunts[j]; - } - return object; - }; - - /** - * Converts this Proof to JSON. - * @function toJSON - * @memberof tendermint.crypto.Proof - * @instance - * @returns {Object.} JSON object - */ - Proof.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Proof; - })(); - - crypto.ValueOp = (function() { - - /** - * Properties of a ValueOp. - * @memberof tendermint.crypto - * @interface IValueOp - * @property {Uint8Array|null} [key] ValueOp key - * @property {tendermint.crypto.IProof|null} [proof] ValueOp proof - */ - - /** - * Constructs a new ValueOp. - * @memberof tendermint.crypto - * @classdesc Represents a ValueOp. - * @implements IValueOp - * @constructor - * @param {tendermint.crypto.IValueOp=} [properties] Properties to set - */ - function ValueOp(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ValueOp key. - * @member {Uint8Array} key - * @memberof tendermint.crypto.ValueOp - * @instance - */ - ValueOp.prototype.key = $util.newBuffer([]); - - /** - * ValueOp proof. - * @member {tendermint.crypto.IProof|null|undefined} proof - * @memberof tendermint.crypto.ValueOp - * @instance - */ - ValueOp.prototype.proof = null; - - /** - * Encodes the specified ValueOp message. Does not implicitly {@link tendermint.crypto.ValueOp.verify|verify} messages. - * @function encode - * @memberof tendermint.crypto.ValueOp - * @static - * @param {tendermint.crypto.IValueOp} message ValueOp message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValueOp.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.key); - if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) - $root.tendermint.crypto.Proof.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ValueOp message, length delimited. Does not implicitly {@link tendermint.crypto.ValueOp.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.crypto.ValueOp - * @static - * @param {tendermint.crypto.IValueOp} message ValueOp message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValueOp.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ValueOp message from the specified reader or buffer. - * @function decode - * @memberof tendermint.crypto.ValueOp - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.crypto.ValueOp} ValueOp - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValueOp.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.crypto.ValueOp(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.bytes(); - break; - case 2: - message.proof = $root.tendermint.crypto.Proof.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ValueOp message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.crypto.ValueOp - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.crypto.ValueOp} ValueOp - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValueOp.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ValueOp message. - * @function verify - * @memberof tendermint.crypto.ValueOp - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ValueOp.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) - return "key: buffer expected"; - if (message.proof != null && message.hasOwnProperty("proof")) { - let error = $root.tendermint.crypto.Proof.verify(message.proof); - if (error) - return "proof." + error; - } - return null; - }; - - /** - * Creates a ValueOp message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.crypto.ValueOp - * @static - * @param {Object.} object Plain object - * @returns {tendermint.crypto.ValueOp} ValueOp - */ - ValueOp.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.crypto.ValueOp) - return object; - let message = new $root.tendermint.crypto.ValueOp(); - if (object.key != null) - if (typeof object.key === "string") - $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); - else if (object.key.length) - message.key = object.key; - if (object.proof != null) { - if (typeof object.proof !== "object") - throw TypeError(".tendermint.crypto.ValueOp.proof: object expected"); - message.proof = $root.tendermint.crypto.Proof.fromObject(object.proof); - } - return message; - }; - - /** - * Creates a plain object from a ValueOp message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.crypto.ValueOp - * @static - * @param {tendermint.crypto.ValueOp} message ValueOp - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ValueOp.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if (options.bytes === String) - object.key = ""; - else { - object.key = []; - if (options.bytes !== Array) - object.key = $util.newBuffer(object.key); - } - object.proof = null; - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; - if (message.proof != null && message.hasOwnProperty("proof")) - object.proof = $root.tendermint.crypto.Proof.toObject(message.proof, options); - return object; - }; - - /** - * Converts this ValueOp to JSON. - * @function toJSON - * @memberof tendermint.crypto.ValueOp - * @instance - * @returns {Object.} JSON object - */ - ValueOp.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ValueOp; - })(); - - crypto.DominoOp = (function() { - - /** - * Properties of a DominoOp. - * @memberof tendermint.crypto - * @interface IDominoOp - * @property {string|null} [key] DominoOp key - * @property {string|null} [input] DominoOp input - * @property {string|null} [output] DominoOp output - */ - - /** - * Constructs a new DominoOp. - * @memberof tendermint.crypto - * @classdesc Represents a DominoOp. - * @implements IDominoOp - * @constructor - * @param {tendermint.crypto.IDominoOp=} [properties] Properties to set - */ - function DominoOp(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DominoOp key. - * @member {string} key - * @memberof tendermint.crypto.DominoOp - * @instance - */ - DominoOp.prototype.key = ""; - - /** - * DominoOp input. - * @member {string} input - * @memberof tendermint.crypto.DominoOp - * @instance - */ - DominoOp.prototype.input = ""; - - /** - * DominoOp output. - * @member {string} output - * @memberof tendermint.crypto.DominoOp - * @instance - */ - DominoOp.prototype.output = ""; - - /** - * Encodes the specified DominoOp message. Does not implicitly {@link tendermint.crypto.DominoOp.verify|verify} messages. - * @function encode - * @memberof tendermint.crypto.DominoOp - * @static - * @param {tendermint.crypto.IDominoOp} message DominoOp message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DominoOp.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); - if (message.input != null && Object.hasOwnProperty.call(message, "input")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.input); - if (message.output != null && Object.hasOwnProperty.call(message, "output")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.output); - return writer; - }; - - /** - * Encodes the specified DominoOp message, length delimited. Does not implicitly {@link tendermint.crypto.DominoOp.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.crypto.DominoOp - * @static - * @param {tendermint.crypto.IDominoOp} message DominoOp message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DominoOp.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DominoOp message from the specified reader or buffer. - * @function decode - * @memberof tendermint.crypto.DominoOp - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.crypto.DominoOp} DominoOp - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DominoOp.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.crypto.DominoOp(); - while (reader.pos < end) { - let 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; - }; - - /** - * Decodes a DominoOp message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.crypto.DominoOp - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.crypto.DominoOp} DominoOp - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DominoOp.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DominoOp message. - * @function verify - * @memberof tendermint.crypto.DominoOp - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DominoOp.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!$util.isString(message.key)) - return "key: string expected"; - if (message.input != null && message.hasOwnProperty("input")) - if (!$util.isString(message.input)) - return "input: string expected"; - if (message.output != null && message.hasOwnProperty("output")) - if (!$util.isString(message.output)) - return "output: string expected"; - return null; - }; - - /** - * Creates a DominoOp message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.crypto.DominoOp - * @static - * @param {Object.} object Plain object - * @returns {tendermint.crypto.DominoOp} DominoOp - */ - DominoOp.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.crypto.DominoOp) - return object; - let message = new $root.tendermint.crypto.DominoOp(); - if (object.key != null) - message.key = String(object.key); - if (object.input != null) - message.input = String(object.input); - if (object.output != null) - message.output = String(object.output); - return message; - }; - - /** - * Creates a plain object from a DominoOp message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.crypto.DominoOp - * @static - * @param {tendermint.crypto.DominoOp} message DominoOp - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DominoOp.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.key = ""; - object.input = ""; - object.output = ""; - } - if (message.key != null && message.hasOwnProperty("key")) - object.key = message.key; - if (message.input != null && message.hasOwnProperty("input")) - object.input = message.input; - if (message.output != null && message.hasOwnProperty("output")) - object.output = message.output; - return object; - }; - - /** - * Converts this DominoOp to JSON. - * @function toJSON - * @memberof tendermint.crypto.DominoOp - * @instance - * @returns {Object.} JSON object - */ - DominoOp.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return DominoOp; - })(); - - crypto.ProofOp = (function() { - - /** - * Properties of a ProofOp. - * @memberof tendermint.crypto - * @interface IProofOp - * @property {string|null} [type] ProofOp type - * @property {Uint8Array|null} [key] ProofOp key - * @property {Uint8Array|null} [data] ProofOp data - */ - - /** - * Constructs a new ProofOp. - * @memberof tendermint.crypto - * @classdesc Represents a ProofOp. - * @implements IProofOp - * @constructor - * @param {tendermint.crypto.IProofOp=} [properties] Properties to set - */ - function ProofOp(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ProofOp type. - * @member {string} type - * @memberof tendermint.crypto.ProofOp - * @instance - */ - ProofOp.prototype.type = ""; - - /** - * ProofOp key. - * @member {Uint8Array} key - * @memberof tendermint.crypto.ProofOp - * @instance - */ - ProofOp.prototype.key = $util.newBuffer([]); - - /** - * ProofOp data. - * @member {Uint8Array} data - * @memberof tendermint.crypto.ProofOp - * @instance - */ - ProofOp.prototype.data = $util.newBuffer([]); - - /** - * Encodes the specified ProofOp message. Does not implicitly {@link tendermint.crypto.ProofOp.verify|verify} messages. - * @function encode - * @memberof tendermint.crypto.ProofOp - * @static - * @param {tendermint.crypto.IProofOp} message ProofOp message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProofOp.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); - if (message.key != null && Object.hasOwnProperty.call(message, "key")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.key); - if (message.data != null && Object.hasOwnProperty.call(message, "data")) - writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.data); - return writer; - }; - - /** - * Encodes the specified ProofOp message, length delimited. Does not implicitly {@link tendermint.crypto.ProofOp.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.crypto.ProofOp - * @static - * @param {tendermint.crypto.IProofOp} message ProofOp message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProofOp.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ProofOp message from the specified reader or buffer. - * @function decode - * @memberof tendermint.crypto.ProofOp - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.crypto.ProofOp} ProofOp - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProofOp.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.crypto.ProofOp(); - while (reader.pos < end) { - let 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; - }; - - /** - * Decodes a ProofOp message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.crypto.ProofOp - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.crypto.ProofOp} ProofOp - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProofOp.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ProofOp message. - * @function verify - * @memberof tendermint.crypto.ProofOp - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ProofOp.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - if (message.key != null && message.hasOwnProperty("key")) - if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) - return "key: buffer expected"; - if (message.data != null && message.hasOwnProperty("data")) - if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) - return "data: buffer expected"; - return null; - }; - - /** - * Creates a ProofOp message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.crypto.ProofOp - * @static - * @param {Object.} object Plain object - * @returns {tendermint.crypto.ProofOp} ProofOp - */ - ProofOp.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.crypto.ProofOp) - return object; - let message = new $root.tendermint.crypto.ProofOp(); - if (object.type != null) - message.type = String(object.type); - if (object.key != null) - if (typeof object.key === "string") - $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); - else if (object.key.length) - message.key = object.key; - if (object.data != null) - if (typeof object.data === "string") - $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); - else if (object.data.length) - message.data = object.data; - return message; - }; - - /** - * Creates a plain object from a ProofOp message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.crypto.ProofOp - * @static - * @param {tendermint.crypto.ProofOp} message ProofOp - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ProofOp.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.type = ""; - if (options.bytes === String) - object.key = ""; - else { - object.key = []; - if (options.bytes !== Array) - object.key = $util.newBuffer(object.key); - } - if (options.bytes === String) - object.data = ""; - else { - object.data = []; - if (options.bytes !== Array) - object.data = $util.newBuffer(object.data); - } - } - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; - if (message.key != null && message.hasOwnProperty("key")) - object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; - if (message.data != null && message.hasOwnProperty("data")) - object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; - return object; - }; - - /** - * Converts this ProofOp to JSON. - * @function toJSON - * @memberof tendermint.crypto.ProofOp - * @instance - * @returns {Object.} JSON object - */ - ProofOp.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ProofOp; - })(); - - crypto.ProofOps = (function() { - - /** - * Properties of a ProofOps. - * @memberof tendermint.crypto - * @interface IProofOps - * @property {Array.|null} [ops] ProofOps ops - */ - - /** - * Constructs a new ProofOps. - * @memberof tendermint.crypto - * @classdesc Represents a ProofOps. - * @implements IProofOps - * @constructor - * @param {tendermint.crypto.IProofOps=} [properties] Properties to set - */ - function ProofOps(properties) { - this.ops = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ProofOps ops. - * @member {Array.} ops - * @memberof tendermint.crypto.ProofOps - * @instance - */ - ProofOps.prototype.ops = $util.emptyArray; - - /** - * Encodes the specified ProofOps message. Does not implicitly {@link tendermint.crypto.ProofOps.verify|verify} messages. - * @function encode - * @memberof tendermint.crypto.ProofOps - * @static - * @param {tendermint.crypto.IProofOps} message ProofOps message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProofOps.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.ops != null && message.ops.length) - for (let i = 0; i < message.ops.length; ++i) - $root.tendermint.crypto.ProofOp.encode(message.ops[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ProofOps message, length delimited. Does not implicitly {@link tendermint.crypto.ProofOps.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.crypto.ProofOps - * @static - * @param {tendermint.crypto.IProofOps} message ProofOps message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProofOps.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ProofOps message from the specified reader or buffer. - * @function decode - * @memberof tendermint.crypto.ProofOps - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.crypto.ProofOps} ProofOps - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProofOps.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.crypto.ProofOps(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.ops && message.ops.length)) - message.ops = []; - message.ops.push($root.tendermint.crypto.ProofOp.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ProofOps message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.crypto.ProofOps - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.crypto.ProofOps} ProofOps - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProofOps.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ProofOps message. - * @function verify - * @memberof tendermint.crypto.ProofOps - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ProofOps.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.ops != null && message.hasOwnProperty("ops")) { - if (!Array.isArray(message.ops)) - return "ops: array expected"; - for (let i = 0; i < message.ops.length; ++i) { - let error = $root.tendermint.crypto.ProofOp.verify(message.ops[i]); - if (error) - return "ops." + error; - } - } - return null; - }; - - /** - * Creates a ProofOps message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.crypto.ProofOps - * @static - * @param {Object.} object Plain object - * @returns {tendermint.crypto.ProofOps} ProofOps - */ - ProofOps.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.crypto.ProofOps) - return object; - let message = new $root.tendermint.crypto.ProofOps(); - if (object.ops) { - if (!Array.isArray(object.ops)) - throw TypeError(".tendermint.crypto.ProofOps.ops: array expected"); - message.ops = []; - for (let i = 0; i < object.ops.length; ++i) { - if (typeof object.ops[i] !== "object") - throw TypeError(".tendermint.crypto.ProofOps.ops: object expected"); - message.ops[i] = $root.tendermint.crypto.ProofOp.fromObject(object.ops[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a ProofOps message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.crypto.ProofOps - * @static - * @param {tendermint.crypto.ProofOps} message ProofOps - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ProofOps.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.ops = []; - if (message.ops && message.ops.length) { - object.ops = []; - for (let j = 0; j < message.ops.length; ++j) - object.ops[j] = $root.tendermint.crypto.ProofOp.toObject(message.ops[j], options); - } - return object; - }; - - /** - * Converts this ProofOps to JSON. - * @function toJSON - * @memberof tendermint.crypto.ProofOps - * @instance - * @returns {Object.} JSON object - */ - ProofOps.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ProofOps; - })(); - - crypto.PublicKey = (function() { - - /** - * Properties of a PublicKey. - * @memberof tendermint.crypto - * @interface IPublicKey - * @property {Uint8Array|null} [ed25519] PublicKey ed25519 - * @property {Uint8Array|null} [secp256k1] PublicKey secp256k1 - */ - - /** - * Constructs a new PublicKey. - * @memberof tendermint.crypto - * @classdesc Represents a PublicKey. - * @implements IPublicKey - * @constructor - * @param {tendermint.crypto.IPublicKey=} [properties] Properties to set - */ - function PublicKey(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PublicKey ed25519. - * @member {Uint8Array} ed25519 - * @memberof tendermint.crypto.PublicKey - * @instance - */ - PublicKey.prototype.ed25519 = $util.newBuffer([]); - - /** - * PublicKey secp256k1. - * @member {Uint8Array} secp256k1 - * @memberof tendermint.crypto.PublicKey - * @instance - */ - PublicKey.prototype.secp256k1 = $util.newBuffer([]); - - // OneOf field names bound to virtual getters and setters - let $oneOfFields; - - /** - * PublicKey sum. - * @member {"ed25519"|"secp256k1"|undefined} sum - * @memberof tendermint.crypto.PublicKey - * @instance - */ - Object.defineProperty(PublicKey.prototype, "sum", { - get: $util.oneOfGetter($oneOfFields = ["ed25519", "secp256k1"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Encodes the specified PublicKey message. Does not implicitly {@link tendermint.crypto.PublicKey.verify|verify} messages. - * @function encode - * @memberof tendermint.crypto.PublicKey - * @static - * @param {tendermint.crypto.IPublicKey} message PublicKey message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PublicKey.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.ed25519 != null && Object.hasOwnProperty.call(message, "ed25519")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.ed25519); - if (message.secp256k1 != null && Object.hasOwnProperty.call(message, "secp256k1")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.secp256k1); - return writer; - }; - - /** - * Encodes the specified PublicKey message, length delimited. Does not implicitly {@link tendermint.crypto.PublicKey.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.crypto.PublicKey - * @static - * @param {tendermint.crypto.IPublicKey} message PublicKey message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PublicKey.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PublicKey message from the specified reader or buffer. - * @function decode - * @memberof tendermint.crypto.PublicKey - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.crypto.PublicKey} PublicKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PublicKey.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.crypto.PublicKey(); - while (reader.pos < end) { - let 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; - }; - - /** - * Decodes a PublicKey message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.crypto.PublicKey - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.crypto.PublicKey} PublicKey - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PublicKey.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PublicKey message. - * @function verify - * @memberof tendermint.crypto.PublicKey - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PublicKey.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - let properties = {}; - if (message.ed25519 != null && message.hasOwnProperty("ed25519")) { - properties.sum = 1; - if (!(message.ed25519 && typeof message.ed25519.length === "number" || $util.isString(message.ed25519))) - return "ed25519: buffer expected"; - } - if (message.secp256k1 != null && message.hasOwnProperty("secp256k1")) { - if (properties.sum === 1) - return "sum: multiple values"; - properties.sum = 1; - if (!(message.secp256k1 && typeof message.secp256k1.length === "number" || $util.isString(message.secp256k1))) - return "secp256k1: buffer expected"; - } - return null; - }; - - /** - * Creates a PublicKey message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.crypto.PublicKey - * @static - * @param {Object.} object Plain object - * @returns {tendermint.crypto.PublicKey} PublicKey - */ - PublicKey.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.crypto.PublicKey) - return object; - let message = new $root.tendermint.crypto.PublicKey(); - if (object.ed25519 != null) - if (typeof object.ed25519 === "string") - $util.base64.decode(object.ed25519, message.ed25519 = $util.newBuffer($util.base64.length(object.ed25519)), 0); - else if (object.ed25519.length) - message.ed25519 = object.ed25519; - if (object.secp256k1 != null) - if (typeof object.secp256k1 === "string") - $util.base64.decode(object.secp256k1, message.secp256k1 = $util.newBuffer($util.base64.length(object.secp256k1)), 0); - else if (object.secp256k1.length) - message.secp256k1 = object.secp256k1; - return message; - }; - - /** - * Creates a plain object from a PublicKey message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.crypto.PublicKey - * @static - * @param {tendermint.crypto.PublicKey} message PublicKey - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PublicKey.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (message.ed25519 != null && message.hasOwnProperty("ed25519")) { - object.ed25519 = options.bytes === String ? $util.base64.encode(message.ed25519, 0, message.ed25519.length) : options.bytes === Array ? Array.prototype.slice.call(message.ed25519) : message.ed25519; - if (options.oneofs) - object.sum = "ed25519"; - } - if (message.secp256k1 != null && message.hasOwnProperty("secp256k1")) { - object.secp256k1 = options.bytes === String ? $util.base64.encode(message.secp256k1, 0, message.secp256k1.length) : options.bytes === Array ? Array.prototype.slice.call(message.secp256k1) : message.secp256k1; - if (options.oneofs) - object.sum = "secp256k1"; - } - return object; - }; - - /** - * Converts this PublicKey to JSON. - * @function toJSON - * @memberof tendermint.crypto.PublicKey - * @instance - * @returns {Object.} JSON object - */ - PublicKey.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return PublicKey; - })(); - - return crypto; - })(); - - tendermint.libs = (function() { - - /** - * Namespace libs. - * @memberof tendermint - * @namespace - */ - const libs = {}; - - libs.bits = (function() { - - /** - * Namespace bits. - * @memberof tendermint.libs - * @namespace - */ - const bits = {}; - - bits.BitArray = (function() { - - /** - * Properties of a BitArray. - * @memberof tendermint.libs.bits - * @interface IBitArray - * @property {Long|null} [bits] BitArray bits - * @property {Array.|null} [elems] BitArray elems - */ - - /** - * Constructs a new BitArray. - * @memberof tendermint.libs.bits - * @classdesc Represents a BitArray. - * @implements IBitArray - * @constructor - * @param {tendermint.libs.bits.IBitArray=} [properties] Properties to set - */ - function BitArray(properties) { - this.elems = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * BitArray bits. - * @member {Long} bits - * @memberof tendermint.libs.bits.BitArray - * @instance - */ - BitArray.prototype.bits = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * BitArray elems. - * @member {Array.} elems - * @memberof tendermint.libs.bits.BitArray - * @instance - */ - BitArray.prototype.elems = $util.emptyArray; - - /** - * Encodes the specified BitArray message. Does not implicitly {@link tendermint.libs.bits.BitArray.verify|verify} messages. - * @function encode - * @memberof tendermint.libs.bits.BitArray - * @static - * @param {tendermint.libs.bits.IBitArray} message BitArray message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BitArray.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.bits != null && Object.hasOwnProperty.call(message, "bits")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.bits); - if (message.elems != null && message.elems.length) { - writer.uint32(/* id 2, wireType 2 =*/18).fork(); - for (let i = 0; i < message.elems.length; ++i) - writer.uint64(message.elems[i]); - writer.ldelim(); - } - return writer; - }; - - /** - * Encodes the specified BitArray message, length delimited. Does not implicitly {@link tendermint.libs.bits.BitArray.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.libs.bits.BitArray - * @static - * @param {tendermint.libs.bits.IBitArray} message BitArray message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BitArray.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BitArray message from the specified reader or buffer. - * @function decode - * @memberof tendermint.libs.bits.BitArray - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.libs.bits.BitArray} BitArray - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BitArray.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.libs.bits.BitArray(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.bits = reader.int64(); - break; - case 2: - if (!(message.elems && message.elems.length)) - message.elems = []; - if ((tag & 7) === 2) { - let end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.elems.push(reader.uint64()); - } else - message.elems.push(reader.uint64()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BitArray message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.libs.bits.BitArray - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.libs.bits.BitArray} BitArray - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BitArray.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BitArray message. - * @function verify - * @memberof tendermint.libs.bits.BitArray - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BitArray.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.bits != null && message.hasOwnProperty("bits")) - if (!$util.isInteger(message.bits) && !(message.bits && $util.isInteger(message.bits.low) && $util.isInteger(message.bits.high))) - return "bits: integer|Long expected"; - if (message.elems != null && message.hasOwnProperty("elems")) { - if (!Array.isArray(message.elems)) - return "elems: array expected"; - for (let i = 0; i < message.elems.length; ++i) - if (!$util.isInteger(message.elems[i]) && !(message.elems[i] && $util.isInteger(message.elems[i].low) && $util.isInteger(message.elems[i].high))) - return "elems: integer|Long[] expected"; - } - return null; - }; - - /** - * Creates a BitArray message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.libs.bits.BitArray - * @static - * @param {Object.} object Plain object - * @returns {tendermint.libs.bits.BitArray} BitArray - */ - BitArray.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.libs.bits.BitArray) - return object; - let message = new $root.tendermint.libs.bits.BitArray(); - if (object.bits != null) - if ($util.Long) - (message.bits = $util.Long.fromValue(object.bits)).unsigned = false; - else if (typeof object.bits === "string") - message.bits = parseInt(object.bits, 10); - else if (typeof object.bits === "number") - message.bits = object.bits; - else if (typeof object.bits === "object") - message.bits = new $util.LongBits(object.bits.low >>> 0, object.bits.high >>> 0).toNumber(); - if (object.elems) { - if (!Array.isArray(object.elems)) - throw TypeError(".tendermint.libs.bits.BitArray.elems: array expected"); - message.elems = []; - for (let i = 0; i < object.elems.length; ++i) - if ($util.Long) - (message.elems[i] = $util.Long.fromValue(object.elems[i])).unsigned = true; - else if (typeof object.elems[i] === "string") - message.elems[i] = parseInt(object.elems[i], 10); - else if (typeof object.elems[i] === "number") - message.elems[i] = object.elems[i]; - else if (typeof object.elems[i] === "object") - message.elems[i] = new $util.LongBits(object.elems[i].low >>> 0, object.elems[i].high >>> 0).toNumber(true); - } - return message; - }; - - /** - * Creates a plain object from a BitArray message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.libs.bits.BitArray - * @static - * @param {tendermint.libs.bits.BitArray} message BitArray - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BitArray.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.elems = []; - if (options.defaults) - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.bits = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.bits = options.longs === String ? "0" : 0; - if (message.bits != null && message.hasOwnProperty("bits")) - if (typeof message.bits === "number") - object.bits = options.longs === String ? String(message.bits) : message.bits; - else - object.bits = options.longs === String ? $util.Long.prototype.toString.call(message.bits) : options.longs === Number ? new $util.LongBits(message.bits.low >>> 0, message.bits.high >>> 0).toNumber() : message.bits; - if (message.elems && message.elems.length) { - object.elems = []; - for (let j = 0; j < message.elems.length; ++j) - if (typeof message.elems[j] === "number") - object.elems[j] = options.longs === String ? String(message.elems[j]) : message.elems[j]; - else - object.elems[j] = options.longs === String ? $util.Long.prototype.toString.call(message.elems[j]) : options.longs === Number ? new $util.LongBits(message.elems[j].low >>> 0, message.elems[j].high >>> 0).toNumber(true) : message.elems[j]; - } - return object; - }; - - /** - * Converts this BitArray to JSON. - * @function toJSON - * @memberof tendermint.libs.bits.BitArray - * @instance - * @returns {Object.} JSON object - */ - BitArray.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return BitArray; - })(); - - return bits; - })(); - - return libs; - })(); - - tendermint.p2p = (function() { - - /** - * Namespace p2p. - * @memberof tendermint - * @namespace - */ - const p2p = {}; - - p2p.NetAddress = (function() { - - /** - * Properties of a NetAddress. - * @memberof tendermint.p2p - * @interface INetAddress - * @property {string|null} [id] NetAddress id - * @property {string|null} [ip] NetAddress ip - * @property {number|null} [port] NetAddress port - */ - - /** - * Constructs a new NetAddress. - * @memberof tendermint.p2p - * @classdesc Represents a NetAddress. - * @implements INetAddress - * @constructor - * @param {tendermint.p2p.INetAddress=} [properties] Properties to set - */ - function NetAddress(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * NetAddress id. - * @member {string} id - * @memberof tendermint.p2p.NetAddress - * @instance - */ - NetAddress.prototype.id = ""; - - /** - * NetAddress ip. - * @member {string} ip - * @memberof tendermint.p2p.NetAddress - * @instance - */ - NetAddress.prototype.ip = ""; - - /** - * NetAddress port. - * @member {number} port - * @memberof tendermint.p2p.NetAddress - * @instance - */ - NetAddress.prototype.port = 0; - - /** - * Encodes the specified NetAddress message. Does not implicitly {@link tendermint.p2p.NetAddress.verify|verify} messages. - * @function encode - * @memberof tendermint.p2p.NetAddress - * @static - * @param {tendermint.p2p.INetAddress} message NetAddress message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - NetAddress.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); - if (message.ip != null && Object.hasOwnProperty.call(message, "ip")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.ip); - if (message.port != null && Object.hasOwnProperty.call(message, "port")) - writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.port); - return writer; - }; - - /** - * Encodes the specified NetAddress message, length delimited. Does not implicitly {@link tendermint.p2p.NetAddress.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.p2p.NetAddress - * @static - * @param {tendermint.p2p.INetAddress} message NetAddress message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - NetAddress.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a NetAddress message from the specified reader or buffer. - * @function decode - * @memberof tendermint.p2p.NetAddress - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.p2p.NetAddress} NetAddress - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - NetAddress.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.p2p.NetAddress(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.id = reader.string(); - break; - case 2: - message.ip = reader.string(); - break; - case 3: - message.port = reader.uint32(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a NetAddress message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.p2p.NetAddress - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.p2p.NetAddress} NetAddress - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - NetAddress.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a NetAddress message. - * @function verify - * @memberof tendermint.p2p.NetAddress - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - NetAddress.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isString(message.id)) - return "id: string expected"; - if (message.ip != null && message.hasOwnProperty("ip")) - if (!$util.isString(message.ip)) - return "ip: string expected"; - if (message.port != null && message.hasOwnProperty("port")) - if (!$util.isInteger(message.port)) - return "port: integer expected"; - return null; - }; - - /** - * Creates a NetAddress message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.p2p.NetAddress - * @static - * @param {Object.} object Plain object - * @returns {tendermint.p2p.NetAddress} NetAddress - */ - NetAddress.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.p2p.NetAddress) - return object; - let message = new $root.tendermint.p2p.NetAddress(); - if (object.id != null) - message.id = String(object.id); - if (object.ip != null) - message.ip = String(object.ip); - if (object.port != null) - message.port = object.port >>> 0; - return message; - }; - - /** - * Creates a plain object from a NetAddress message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.p2p.NetAddress - * @static - * @param {tendermint.p2p.NetAddress} message NetAddress - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - NetAddress.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.id = ""; - object.ip = ""; - object.port = 0; - } - if (message.id != null && message.hasOwnProperty("id")) - object.id = message.id; - if (message.ip != null && message.hasOwnProperty("ip")) - object.ip = message.ip; - if (message.port != null && message.hasOwnProperty("port")) - object.port = message.port; - return object; - }; - - /** - * Converts this NetAddress to JSON. - * @function toJSON - * @memberof tendermint.p2p.NetAddress - * @instance - * @returns {Object.} JSON object - */ - NetAddress.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return NetAddress; - })(); - - p2p.ProtocolVersion = (function() { - - /** - * Properties of a ProtocolVersion. - * @memberof tendermint.p2p - * @interface IProtocolVersion - * @property {Long|null} [p2p] ProtocolVersion p2p - * @property {Long|null} [block] ProtocolVersion block - * @property {Long|null} [app] ProtocolVersion app - */ - - /** - * Constructs a new ProtocolVersion. - * @memberof tendermint.p2p - * @classdesc Represents a ProtocolVersion. - * @implements IProtocolVersion - * @constructor - * @param {tendermint.p2p.IProtocolVersion=} [properties] Properties to set - */ - function ProtocolVersion(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ProtocolVersion p2p. - * @member {Long} p2p - * @memberof tendermint.p2p.ProtocolVersion - * @instance - */ - ProtocolVersion.prototype.p2p = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * ProtocolVersion block. - * @member {Long} block - * @memberof tendermint.p2p.ProtocolVersion - * @instance - */ - ProtocolVersion.prototype.block = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * ProtocolVersion app. - * @member {Long} app - * @memberof tendermint.p2p.ProtocolVersion - * @instance - */ - ProtocolVersion.prototype.app = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified ProtocolVersion message. Does not implicitly {@link tendermint.p2p.ProtocolVersion.verify|verify} messages. - * @function encode - * @memberof tendermint.p2p.ProtocolVersion - * @static - * @param {tendermint.p2p.IProtocolVersion} message ProtocolVersion message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProtocolVersion.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.p2p != null && Object.hasOwnProperty.call(message, "p2p")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.p2p); - if (message.block != null && Object.hasOwnProperty.call(message, "block")) - writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.block); - if (message.app != null && Object.hasOwnProperty.call(message, "app")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.app); - return writer; - }; - - /** - * Encodes the specified ProtocolVersion message, length delimited. Does not implicitly {@link tendermint.p2p.ProtocolVersion.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.p2p.ProtocolVersion - * @static - * @param {tendermint.p2p.IProtocolVersion} message ProtocolVersion message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ProtocolVersion.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ProtocolVersion message from the specified reader or buffer. - * @function decode - * @memberof tendermint.p2p.ProtocolVersion - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.p2p.ProtocolVersion} ProtocolVersion - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProtocolVersion.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.p2p.ProtocolVersion(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.p2p = reader.uint64(); - break; - case 2: - message.block = reader.uint64(); - break; - case 3: - message.app = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ProtocolVersion message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.p2p.ProtocolVersion - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.p2p.ProtocolVersion} ProtocolVersion - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ProtocolVersion.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ProtocolVersion message. - * @function verify - * @memberof tendermint.p2p.ProtocolVersion - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ProtocolVersion.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.p2p != null && message.hasOwnProperty("p2p")) - if (!$util.isInteger(message.p2p) && !(message.p2p && $util.isInteger(message.p2p.low) && $util.isInteger(message.p2p.high))) - return "p2p: integer|Long expected"; - if (message.block != null && message.hasOwnProperty("block")) - if (!$util.isInteger(message.block) && !(message.block && $util.isInteger(message.block.low) && $util.isInteger(message.block.high))) - return "block: integer|Long expected"; - if (message.app != null && message.hasOwnProperty("app")) - if (!$util.isInteger(message.app) && !(message.app && $util.isInteger(message.app.low) && $util.isInteger(message.app.high))) - return "app: integer|Long expected"; - return null; - }; - - /** - * Creates a ProtocolVersion message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.p2p.ProtocolVersion - * @static - * @param {Object.} object Plain object - * @returns {tendermint.p2p.ProtocolVersion} ProtocolVersion - */ - ProtocolVersion.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.p2p.ProtocolVersion) - return object; - let message = new $root.tendermint.p2p.ProtocolVersion(); - if (object.p2p != null) - if ($util.Long) - (message.p2p = $util.Long.fromValue(object.p2p)).unsigned = true; - else if (typeof object.p2p === "string") - message.p2p = parseInt(object.p2p, 10); - else if (typeof object.p2p === "number") - message.p2p = object.p2p; - else if (typeof object.p2p === "object") - message.p2p = new $util.LongBits(object.p2p.low >>> 0, object.p2p.high >>> 0).toNumber(true); - if (object.block != null) - if ($util.Long) - (message.block = $util.Long.fromValue(object.block)).unsigned = true; - else if (typeof object.block === "string") - message.block = parseInt(object.block, 10); - else if (typeof object.block === "number") - message.block = object.block; - else if (typeof object.block === "object") - message.block = new $util.LongBits(object.block.low >>> 0, object.block.high >>> 0).toNumber(true); - if (object.app != null) - if ($util.Long) - (message.app = $util.Long.fromValue(object.app)).unsigned = true; - else if (typeof object.app === "string") - message.app = parseInt(object.app, 10); - else if (typeof object.app === "number") - message.app = object.app; - else if (typeof object.app === "object") - message.app = new $util.LongBits(object.app.low >>> 0, object.app.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a ProtocolVersion message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.p2p.ProtocolVersion - * @static - * @param {tendermint.p2p.ProtocolVersion} message ProtocolVersion - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ProtocolVersion.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.p2p = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.p2p = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.block = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.block = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.app = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.app = options.longs === String ? "0" : 0; - } - if (message.p2p != null && message.hasOwnProperty("p2p")) - if (typeof message.p2p === "number") - object.p2p = options.longs === String ? String(message.p2p) : message.p2p; - else - object.p2p = options.longs === String ? $util.Long.prototype.toString.call(message.p2p) : options.longs === Number ? new $util.LongBits(message.p2p.low >>> 0, message.p2p.high >>> 0).toNumber(true) : message.p2p; - if (message.block != null && message.hasOwnProperty("block")) - if (typeof message.block === "number") - object.block = options.longs === String ? String(message.block) : message.block; - else - object.block = options.longs === String ? $util.Long.prototype.toString.call(message.block) : options.longs === Number ? new $util.LongBits(message.block.low >>> 0, message.block.high >>> 0).toNumber(true) : message.block; - if (message.app != null && message.hasOwnProperty("app")) - if (typeof message.app === "number") - object.app = options.longs === String ? String(message.app) : message.app; - else - object.app = options.longs === String ? $util.Long.prototype.toString.call(message.app) : options.longs === Number ? new $util.LongBits(message.app.low >>> 0, message.app.high >>> 0).toNumber(true) : message.app; - return object; - }; - - /** - * Converts this ProtocolVersion to JSON. - * @function toJSON - * @memberof tendermint.p2p.ProtocolVersion - * @instance - * @returns {Object.} JSON object - */ - ProtocolVersion.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ProtocolVersion; - })(); - - p2p.DefaultNodeInfo = (function() { - - /** - * Properties of a DefaultNodeInfo. - * @memberof tendermint.p2p - * @interface IDefaultNodeInfo - * @property {tendermint.p2p.IProtocolVersion|null} [protocol_version] DefaultNodeInfo protocol_version - * @property {string|null} [default_node_id] DefaultNodeInfo default_node_id - * @property {string|null} [listen_addr] DefaultNodeInfo listen_addr - * @property {string|null} [network] DefaultNodeInfo network - * @property {string|null} [version] DefaultNodeInfo version - * @property {Uint8Array|null} [channels] DefaultNodeInfo channels - * @property {string|null} [moniker] DefaultNodeInfo moniker - * @property {tendermint.p2p.IDefaultNodeInfoOther|null} [other] DefaultNodeInfo other - */ - - /** - * Constructs a new DefaultNodeInfo. - * @memberof tendermint.p2p - * @classdesc Represents a DefaultNodeInfo. - * @implements IDefaultNodeInfo - * @constructor - * @param {tendermint.p2p.IDefaultNodeInfo=} [properties] Properties to set - */ - function DefaultNodeInfo(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DefaultNodeInfo protocol_version. - * @member {tendermint.p2p.IProtocolVersion|null|undefined} protocol_version - * @memberof tendermint.p2p.DefaultNodeInfo - * @instance - */ - DefaultNodeInfo.prototype.protocol_version = null; - - /** - * DefaultNodeInfo default_node_id. - * @member {string} default_node_id - * @memberof tendermint.p2p.DefaultNodeInfo - * @instance - */ - DefaultNodeInfo.prototype.default_node_id = ""; - - /** - * DefaultNodeInfo listen_addr. - * @member {string} listen_addr - * @memberof tendermint.p2p.DefaultNodeInfo - * @instance - */ - DefaultNodeInfo.prototype.listen_addr = ""; - - /** - * DefaultNodeInfo network. - * @member {string} network - * @memberof tendermint.p2p.DefaultNodeInfo - * @instance - */ - DefaultNodeInfo.prototype.network = ""; - - /** - * DefaultNodeInfo version. - * @member {string} version - * @memberof tendermint.p2p.DefaultNodeInfo - * @instance - */ - DefaultNodeInfo.prototype.version = ""; - - /** - * DefaultNodeInfo channels. - * @member {Uint8Array} channels - * @memberof tendermint.p2p.DefaultNodeInfo - * @instance - */ - DefaultNodeInfo.prototype.channels = $util.newBuffer([]); - - /** - * DefaultNodeInfo moniker. - * @member {string} moniker - * @memberof tendermint.p2p.DefaultNodeInfo - * @instance - */ - DefaultNodeInfo.prototype.moniker = ""; - - /** - * DefaultNodeInfo other. - * @member {tendermint.p2p.IDefaultNodeInfoOther|null|undefined} other - * @memberof tendermint.p2p.DefaultNodeInfo - * @instance - */ - DefaultNodeInfo.prototype.other = null; - - /** - * Encodes the specified DefaultNodeInfo message. Does not implicitly {@link tendermint.p2p.DefaultNodeInfo.verify|verify} messages. - * @function encode - * @memberof tendermint.p2p.DefaultNodeInfo - * @static - * @param {tendermint.p2p.IDefaultNodeInfo} message DefaultNodeInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DefaultNodeInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.protocol_version != null && Object.hasOwnProperty.call(message, "protocol_version")) - $root.tendermint.p2p.ProtocolVersion.encode(message.protocol_version, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.default_node_id != null && Object.hasOwnProperty.call(message, "default_node_id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.default_node_id); - if (message.listen_addr != null && Object.hasOwnProperty.call(message, "listen_addr")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.listen_addr); - if (message.network != null && Object.hasOwnProperty.call(message, "network")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.network); - if (message.version != null && Object.hasOwnProperty.call(message, "version")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.version); - if (message.channels != null && Object.hasOwnProperty.call(message, "channels")) - writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.channels); - if (message.moniker != null && Object.hasOwnProperty.call(message, "moniker")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.moniker); - if (message.other != null && Object.hasOwnProperty.call(message, "other")) - $root.tendermint.p2p.DefaultNodeInfoOther.encode(message.other, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified DefaultNodeInfo message, length delimited. Does not implicitly {@link tendermint.p2p.DefaultNodeInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.p2p.DefaultNodeInfo - * @static - * @param {tendermint.p2p.IDefaultNodeInfo} message DefaultNodeInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DefaultNodeInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DefaultNodeInfo message from the specified reader or buffer. - * @function decode - * @memberof tendermint.p2p.DefaultNodeInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.p2p.DefaultNodeInfo} DefaultNodeInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DefaultNodeInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.p2p.DefaultNodeInfo(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.protocol_version = $root.tendermint.p2p.ProtocolVersion.decode(reader, reader.uint32()); - break; - case 2: - message.default_node_id = reader.string(); - break; - case 3: - message.listen_addr = reader.string(); - break; - case 4: - message.network = reader.string(); - break; - case 5: - message.version = reader.string(); - break; - case 6: - message.channels = reader.bytes(); - break; - case 7: - message.moniker = reader.string(); - break; - case 8: - message.other = $root.tendermint.p2p.DefaultNodeInfoOther.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DefaultNodeInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.p2p.DefaultNodeInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.p2p.DefaultNodeInfo} DefaultNodeInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DefaultNodeInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DefaultNodeInfo message. - * @function verify - * @memberof tendermint.p2p.DefaultNodeInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DefaultNodeInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.protocol_version != null && message.hasOwnProperty("protocol_version")) { - let error = $root.tendermint.p2p.ProtocolVersion.verify(message.protocol_version); - if (error) - return "protocol_version." + error; - } - if (message.default_node_id != null && message.hasOwnProperty("default_node_id")) - if (!$util.isString(message.default_node_id)) - return "default_node_id: string expected"; - if (message.listen_addr != null && message.hasOwnProperty("listen_addr")) - if (!$util.isString(message.listen_addr)) - return "listen_addr: string expected"; - if (message.network != null && message.hasOwnProperty("network")) - if (!$util.isString(message.network)) - return "network: string expected"; - if (message.version != null && message.hasOwnProperty("version")) - if (!$util.isString(message.version)) - return "version: string expected"; - if (message.channels != null && message.hasOwnProperty("channels")) - if (!(message.channels && typeof message.channels.length === "number" || $util.isString(message.channels))) - return "channels: buffer expected"; - if (message.moniker != null && message.hasOwnProperty("moniker")) - if (!$util.isString(message.moniker)) - return "moniker: string expected"; - if (message.other != null && message.hasOwnProperty("other")) { - let error = $root.tendermint.p2p.DefaultNodeInfoOther.verify(message.other); - if (error) - return "other." + error; - } - return null; - }; - - /** - * Creates a DefaultNodeInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.p2p.DefaultNodeInfo - * @static - * @param {Object.} object Plain object - * @returns {tendermint.p2p.DefaultNodeInfo} DefaultNodeInfo - */ - DefaultNodeInfo.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.p2p.DefaultNodeInfo) - return object; - let message = new $root.tendermint.p2p.DefaultNodeInfo(); - if (object.protocol_version != null) { - if (typeof object.protocol_version !== "object") - throw TypeError(".tendermint.p2p.DefaultNodeInfo.protocol_version: object expected"); - message.protocol_version = $root.tendermint.p2p.ProtocolVersion.fromObject(object.protocol_version); - } - if (object.default_node_id != null) - message.default_node_id = String(object.default_node_id); - if (object.listen_addr != null) - message.listen_addr = String(object.listen_addr); - if (object.network != null) - message.network = String(object.network); - if (object.version != null) - message.version = String(object.version); - if (object.channels != null) - if (typeof object.channels === "string") - $util.base64.decode(object.channels, message.channels = $util.newBuffer($util.base64.length(object.channels)), 0); - else if (object.channels.length) - message.channels = object.channels; - if (object.moniker != null) - message.moniker = String(object.moniker); - if (object.other != null) { - if (typeof object.other !== "object") - throw TypeError(".tendermint.p2p.DefaultNodeInfo.other: object expected"); - message.other = $root.tendermint.p2p.DefaultNodeInfoOther.fromObject(object.other); - } - return message; - }; - - /** - * Creates a plain object from a DefaultNodeInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.p2p.DefaultNodeInfo - * @static - * @param {tendermint.p2p.DefaultNodeInfo} message DefaultNodeInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DefaultNodeInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.protocol_version = null; - object.default_node_id = ""; - object.listen_addr = ""; - object.network = ""; - object.version = ""; - if (options.bytes === String) - object.channels = ""; - else { - object.channels = []; - if (options.bytes !== Array) - object.channels = $util.newBuffer(object.channels); - } - object.moniker = ""; - object.other = null; - } - if (message.protocol_version != null && message.hasOwnProperty("protocol_version")) - object.protocol_version = $root.tendermint.p2p.ProtocolVersion.toObject(message.protocol_version, options); - if (message.default_node_id != null && message.hasOwnProperty("default_node_id")) - object.default_node_id = message.default_node_id; - if (message.listen_addr != null && message.hasOwnProperty("listen_addr")) - object.listen_addr = message.listen_addr; - if (message.network != null && message.hasOwnProperty("network")) - object.network = message.network; - if (message.version != null && message.hasOwnProperty("version")) - object.version = message.version; - if (message.channels != null && message.hasOwnProperty("channels")) - object.channels = options.bytes === String ? $util.base64.encode(message.channels, 0, message.channels.length) : options.bytes === Array ? Array.prototype.slice.call(message.channels) : message.channels; - if (message.moniker != null && message.hasOwnProperty("moniker")) - object.moniker = message.moniker; - if (message.other != null && message.hasOwnProperty("other")) - object.other = $root.tendermint.p2p.DefaultNodeInfoOther.toObject(message.other, options); - return object; - }; - - /** - * Converts this DefaultNodeInfo to JSON. - * @function toJSON - * @memberof tendermint.p2p.DefaultNodeInfo - * @instance - * @returns {Object.} JSON object - */ - DefaultNodeInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return DefaultNodeInfo; - })(); - - p2p.DefaultNodeInfoOther = (function() { - - /** - * Properties of a DefaultNodeInfoOther. - * @memberof tendermint.p2p - * @interface IDefaultNodeInfoOther - * @property {string|null} [tx_index] DefaultNodeInfoOther tx_index - * @property {string|null} [rpc_address] DefaultNodeInfoOther rpc_address - */ - - /** - * Constructs a new DefaultNodeInfoOther. - * @memberof tendermint.p2p - * @classdesc Represents a DefaultNodeInfoOther. - * @implements IDefaultNodeInfoOther - * @constructor - * @param {tendermint.p2p.IDefaultNodeInfoOther=} [properties] Properties to set - */ - function DefaultNodeInfoOther(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DefaultNodeInfoOther tx_index. - * @member {string} tx_index - * @memberof tendermint.p2p.DefaultNodeInfoOther - * @instance - */ - DefaultNodeInfoOther.prototype.tx_index = ""; - - /** - * DefaultNodeInfoOther rpc_address. - * @member {string} rpc_address - * @memberof tendermint.p2p.DefaultNodeInfoOther - * @instance - */ - DefaultNodeInfoOther.prototype.rpc_address = ""; - - /** - * Encodes the specified DefaultNodeInfoOther message. Does not implicitly {@link tendermint.p2p.DefaultNodeInfoOther.verify|verify} messages. - * @function encode - * @memberof tendermint.p2p.DefaultNodeInfoOther - * @static - * @param {tendermint.p2p.IDefaultNodeInfoOther} message DefaultNodeInfoOther message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DefaultNodeInfoOther.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.tx_index != null && Object.hasOwnProperty.call(message, "tx_index")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.tx_index); - if (message.rpc_address != null && Object.hasOwnProperty.call(message, "rpc_address")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.rpc_address); - return writer; - }; - - /** - * Encodes the specified DefaultNodeInfoOther message, length delimited. Does not implicitly {@link tendermint.p2p.DefaultNodeInfoOther.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.p2p.DefaultNodeInfoOther - * @static - * @param {tendermint.p2p.IDefaultNodeInfoOther} message DefaultNodeInfoOther message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DefaultNodeInfoOther.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DefaultNodeInfoOther message from the specified reader or buffer. - * @function decode - * @memberof tendermint.p2p.DefaultNodeInfoOther - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.p2p.DefaultNodeInfoOther} DefaultNodeInfoOther - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DefaultNodeInfoOther.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.p2p.DefaultNodeInfoOther(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.tx_index = reader.string(); - break; - case 2: - message.rpc_address = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DefaultNodeInfoOther message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.p2p.DefaultNodeInfoOther - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.p2p.DefaultNodeInfoOther} DefaultNodeInfoOther - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DefaultNodeInfoOther.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DefaultNodeInfoOther message. - * @function verify - * @memberof tendermint.p2p.DefaultNodeInfoOther - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DefaultNodeInfoOther.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.tx_index != null && message.hasOwnProperty("tx_index")) - if (!$util.isString(message.tx_index)) - return "tx_index: string expected"; - if (message.rpc_address != null && message.hasOwnProperty("rpc_address")) - if (!$util.isString(message.rpc_address)) - return "rpc_address: string expected"; - return null; - }; - - /** - * Creates a DefaultNodeInfoOther message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.p2p.DefaultNodeInfoOther - * @static - * @param {Object.} object Plain object - * @returns {tendermint.p2p.DefaultNodeInfoOther} DefaultNodeInfoOther - */ - DefaultNodeInfoOther.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.p2p.DefaultNodeInfoOther) - return object; - let message = new $root.tendermint.p2p.DefaultNodeInfoOther(); - if (object.tx_index != null) - message.tx_index = String(object.tx_index); - if (object.rpc_address != null) - message.rpc_address = String(object.rpc_address); - return message; - }; - - /** - * Creates a plain object from a DefaultNodeInfoOther message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.p2p.DefaultNodeInfoOther - * @static - * @param {tendermint.p2p.DefaultNodeInfoOther} message DefaultNodeInfoOther - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DefaultNodeInfoOther.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.tx_index = ""; - object.rpc_address = ""; - } - if (message.tx_index != null && message.hasOwnProperty("tx_index")) - object.tx_index = message.tx_index; - if (message.rpc_address != null && message.hasOwnProperty("rpc_address")) - object.rpc_address = message.rpc_address; - return object; - }; - - /** - * Converts this DefaultNodeInfoOther to JSON. - * @function toJSON - * @memberof tendermint.p2p.DefaultNodeInfoOther - * @instance - * @returns {Object.} JSON object - */ - DefaultNodeInfoOther.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return DefaultNodeInfoOther; - })(); - - return p2p; - })(); - - tendermint.types = (function() { - - /** - * Namespace types. - * @memberof tendermint - * @namespace - */ - const types = {}; - - types.Evidence = (function() { - - /** - * Properties of an Evidence. - * @memberof tendermint.types - * @interface IEvidence - * @property {tendermint.types.IDuplicateVoteEvidence|null} [duplicate_vote_evidence] Evidence duplicate_vote_evidence - * @property {tendermint.types.ILightClientAttackEvidence|null} [light_client_attack_evidence] Evidence light_client_attack_evidence - */ - - /** - * Constructs a new Evidence. - * @memberof tendermint.types - * @classdesc Represents an Evidence. - * @implements IEvidence - * @constructor - * @param {tendermint.types.IEvidence=} [properties] Properties to set - */ - function Evidence(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Evidence duplicate_vote_evidence. - * @member {tendermint.types.IDuplicateVoteEvidence|null|undefined} duplicate_vote_evidence - * @memberof tendermint.types.Evidence - * @instance - */ - Evidence.prototype.duplicate_vote_evidence = null; - - /** - * Evidence light_client_attack_evidence. - * @member {tendermint.types.ILightClientAttackEvidence|null|undefined} light_client_attack_evidence - * @memberof tendermint.types.Evidence - * @instance - */ - Evidence.prototype.light_client_attack_evidence = null; - - // OneOf field names bound to virtual getters and setters - let $oneOfFields; - - /** - * Evidence sum. - * @member {"duplicate_vote_evidence"|"light_client_attack_evidence"|undefined} sum - * @memberof tendermint.types.Evidence - * @instance - */ - Object.defineProperty(Evidence.prototype, "sum", { - get: $util.oneOfGetter($oneOfFields = ["duplicate_vote_evidence", "light_client_attack_evidence"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Encodes the specified Evidence message. Does not implicitly {@link tendermint.types.Evidence.verify|verify} messages. - * @function encode - * @memberof tendermint.types.Evidence - * @static - * @param {tendermint.types.IEvidence} message Evidence message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Evidence.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.duplicate_vote_evidence != null && Object.hasOwnProperty.call(message, "duplicate_vote_evidence")) - $root.tendermint.types.DuplicateVoteEvidence.encode(message.duplicate_vote_evidence, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.light_client_attack_evidence != null && Object.hasOwnProperty.call(message, "light_client_attack_evidence")) - $root.tendermint.types.LightClientAttackEvidence.encode(message.light_client_attack_evidence, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Evidence message, length delimited. Does not implicitly {@link tendermint.types.Evidence.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.types.Evidence - * @static - * @param {tendermint.types.IEvidence} message Evidence message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Evidence.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Evidence message from the specified reader or buffer. - * @function decode - * @memberof tendermint.types.Evidence - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.types.Evidence} Evidence - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Evidence.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.Evidence(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.duplicate_vote_evidence = $root.tendermint.types.DuplicateVoteEvidence.decode(reader, reader.uint32()); - break; - case 2: - message.light_client_attack_evidence = $root.tendermint.types.LightClientAttackEvidence.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Evidence message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.types.Evidence - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.types.Evidence} Evidence - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Evidence.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Evidence message. - * @function verify - * @memberof tendermint.types.Evidence - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Evidence.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - let properties = {}; - if (message.duplicate_vote_evidence != null && message.hasOwnProperty("duplicate_vote_evidence")) { - properties.sum = 1; - { - let error = $root.tendermint.types.DuplicateVoteEvidence.verify(message.duplicate_vote_evidence); - if (error) - return "duplicate_vote_evidence." + error; - } - } - if (message.light_client_attack_evidence != null && message.hasOwnProperty("light_client_attack_evidence")) { - if (properties.sum === 1) - return "sum: multiple values"; - properties.sum = 1; - { - let error = $root.tendermint.types.LightClientAttackEvidence.verify(message.light_client_attack_evidence); - if (error) - return "light_client_attack_evidence." + error; - } - } - return null; - }; - - /** - * Creates an Evidence message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.types.Evidence - * @static - * @param {Object.} object Plain object - * @returns {tendermint.types.Evidence} Evidence - */ - Evidence.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.types.Evidence) - return object; - let message = new $root.tendermint.types.Evidence(); - if (object.duplicate_vote_evidence != null) { - if (typeof object.duplicate_vote_evidence !== "object") - throw TypeError(".tendermint.types.Evidence.duplicate_vote_evidence: object expected"); - message.duplicate_vote_evidence = $root.tendermint.types.DuplicateVoteEvidence.fromObject(object.duplicate_vote_evidence); - } - if (object.light_client_attack_evidence != null) { - if (typeof object.light_client_attack_evidence !== "object") - throw TypeError(".tendermint.types.Evidence.light_client_attack_evidence: object expected"); - message.light_client_attack_evidence = $root.tendermint.types.LightClientAttackEvidence.fromObject(object.light_client_attack_evidence); - } - return message; - }; - - /** - * Creates a plain object from an Evidence message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.types.Evidence - * @static - * @param {tendermint.types.Evidence} message Evidence - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Evidence.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (message.duplicate_vote_evidence != null && message.hasOwnProperty("duplicate_vote_evidence")) { - object.duplicate_vote_evidence = $root.tendermint.types.DuplicateVoteEvidence.toObject(message.duplicate_vote_evidence, options); - if (options.oneofs) - object.sum = "duplicate_vote_evidence"; - } - if (message.light_client_attack_evidence != null && message.hasOwnProperty("light_client_attack_evidence")) { - object.light_client_attack_evidence = $root.tendermint.types.LightClientAttackEvidence.toObject(message.light_client_attack_evidence, options); - if (options.oneofs) - object.sum = "light_client_attack_evidence"; - } - return object; - }; - - /** - * Converts this Evidence to JSON. - * @function toJSON - * @memberof tendermint.types.Evidence - * @instance - * @returns {Object.} JSON object - */ - Evidence.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Evidence; - })(); - - types.DuplicateVoteEvidence = (function() { - - /** - * Properties of a DuplicateVoteEvidence. - * @memberof tendermint.types - * @interface IDuplicateVoteEvidence - * @property {tendermint.types.IVote|null} [vote_a] DuplicateVoteEvidence vote_a - * @property {tendermint.types.IVote|null} [vote_b] DuplicateVoteEvidence vote_b - * @property {Long|null} [total_voting_power] DuplicateVoteEvidence total_voting_power - * @property {Long|null} [validator_power] DuplicateVoteEvidence validator_power - * @property {google.protobuf.ITimestamp|null} [timestamp] DuplicateVoteEvidence timestamp - */ - - /** - * Constructs a new DuplicateVoteEvidence. - * @memberof tendermint.types - * @classdesc Represents a DuplicateVoteEvidence. - * @implements IDuplicateVoteEvidence - * @constructor - * @param {tendermint.types.IDuplicateVoteEvidence=} [properties] Properties to set - */ - function DuplicateVoteEvidence(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DuplicateVoteEvidence vote_a. - * @member {tendermint.types.IVote|null|undefined} vote_a - * @memberof tendermint.types.DuplicateVoteEvidence - * @instance - */ - DuplicateVoteEvidence.prototype.vote_a = null; - - /** - * DuplicateVoteEvidence vote_b. - * @member {tendermint.types.IVote|null|undefined} vote_b - * @memberof tendermint.types.DuplicateVoteEvidence - * @instance - */ - DuplicateVoteEvidence.prototype.vote_b = null; - - /** - * DuplicateVoteEvidence total_voting_power. - * @member {Long} total_voting_power - * @memberof tendermint.types.DuplicateVoteEvidence - * @instance - */ - DuplicateVoteEvidence.prototype.total_voting_power = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * DuplicateVoteEvidence validator_power. - * @member {Long} validator_power - * @memberof tendermint.types.DuplicateVoteEvidence - * @instance - */ - DuplicateVoteEvidence.prototype.validator_power = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * DuplicateVoteEvidence timestamp. - * @member {google.protobuf.ITimestamp|null|undefined} timestamp - * @memberof tendermint.types.DuplicateVoteEvidence - * @instance - */ - DuplicateVoteEvidence.prototype.timestamp = null; - - /** - * Encodes the specified DuplicateVoteEvidence message. Does not implicitly {@link tendermint.types.DuplicateVoteEvidence.verify|verify} messages. - * @function encode - * @memberof tendermint.types.DuplicateVoteEvidence - * @static - * @param {tendermint.types.IDuplicateVoteEvidence} message DuplicateVoteEvidence message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DuplicateVoteEvidence.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.vote_a != null && Object.hasOwnProperty.call(message, "vote_a")) - $root.tendermint.types.Vote.encode(message.vote_a, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.vote_b != null && Object.hasOwnProperty.call(message, "vote_b")) - $root.tendermint.types.Vote.encode(message.vote_b, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.total_voting_power != null && Object.hasOwnProperty.call(message, "total_voting_power")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.total_voting_power); - if (message.validator_power != null && Object.hasOwnProperty.call(message, "validator_power")) - writer.uint32(/* id 4, wireType 0 =*/32).int64(message.validator_power); - if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) - $root.google.protobuf.Timestamp.encode(message.timestamp, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified DuplicateVoteEvidence message, length delimited. Does not implicitly {@link tendermint.types.DuplicateVoteEvidence.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.types.DuplicateVoteEvidence - * @static - * @param {tendermint.types.IDuplicateVoteEvidence} message DuplicateVoteEvidence message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DuplicateVoteEvidence.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DuplicateVoteEvidence message from the specified reader or buffer. - * @function decode - * @memberof tendermint.types.DuplicateVoteEvidence - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.types.DuplicateVoteEvidence} DuplicateVoteEvidence - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DuplicateVoteEvidence.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.DuplicateVoteEvidence(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.vote_a = $root.tendermint.types.Vote.decode(reader, reader.uint32()); - break; - case 2: - message.vote_b = $root.tendermint.types.Vote.decode(reader, reader.uint32()); - break; - case 3: - message.total_voting_power = reader.int64(); - break; - case 4: - message.validator_power = reader.int64(); - break; - case 5: - message.timestamp = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DuplicateVoteEvidence message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.types.DuplicateVoteEvidence - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.types.DuplicateVoteEvidence} DuplicateVoteEvidence - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DuplicateVoteEvidence.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DuplicateVoteEvidence message. - * @function verify - * @memberof tendermint.types.DuplicateVoteEvidence - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DuplicateVoteEvidence.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.vote_a != null && message.hasOwnProperty("vote_a")) { - let error = $root.tendermint.types.Vote.verify(message.vote_a); - if (error) - return "vote_a." + error; - } - if (message.vote_b != null && message.hasOwnProperty("vote_b")) { - let error = $root.tendermint.types.Vote.verify(message.vote_b); - if (error) - return "vote_b." + error; - } - if (message.total_voting_power != null && message.hasOwnProperty("total_voting_power")) - if (!$util.isInteger(message.total_voting_power) && !(message.total_voting_power && $util.isInteger(message.total_voting_power.low) && $util.isInteger(message.total_voting_power.high))) - return "total_voting_power: integer|Long expected"; - if (message.validator_power != null && message.hasOwnProperty("validator_power")) - if (!$util.isInteger(message.validator_power) && !(message.validator_power && $util.isInteger(message.validator_power.low) && $util.isInteger(message.validator_power.high))) - return "validator_power: integer|Long expected"; - if (message.timestamp != null && message.hasOwnProperty("timestamp")) { - let error = $root.google.protobuf.Timestamp.verify(message.timestamp); - if (error) - return "timestamp." + error; - } - return null; - }; - - /** - * Creates a DuplicateVoteEvidence message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.types.DuplicateVoteEvidence - * @static - * @param {Object.} object Plain object - * @returns {tendermint.types.DuplicateVoteEvidence} DuplicateVoteEvidence - */ - DuplicateVoteEvidence.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.types.DuplicateVoteEvidence) - return object; - let message = new $root.tendermint.types.DuplicateVoteEvidence(); - if (object.vote_a != null) { - if (typeof object.vote_a !== "object") - throw TypeError(".tendermint.types.DuplicateVoteEvidence.vote_a: object expected"); - message.vote_a = $root.tendermint.types.Vote.fromObject(object.vote_a); - } - if (object.vote_b != null) { - if (typeof object.vote_b !== "object") - throw TypeError(".tendermint.types.DuplicateVoteEvidence.vote_b: object expected"); - message.vote_b = $root.tendermint.types.Vote.fromObject(object.vote_b); - } - if (object.total_voting_power != null) - if ($util.Long) - (message.total_voting_power = $util.Long.fromValue(object.total_voting_power)).unsigned = false; - else if (typeof object.total_voting_power === "string") - message.total_voting_power = parseInt(object.total_voting_power, 10); - else if (typeof object.total_voting_power === "number") - message.total_voting_power = object.total_voting_power; - else if (typeof object.total_voting_power === "object") - message.total_voting_power = new $util.LongBits(object.total_voting_power.low >>> 0, object.total_voting_power.high >>> 0).toNumber(); - if (object.validator_power != null) - if ($util.Long) - (message.validator_power = $util.Long.fromValue(object.validator_power)).unsigned = false; - else if (typeof object.validator_power === "string") - message.validator_power = parseInt(object.validator_power, 10); - else if (typeof object.validator_power === "number") - message.validator_power = object.validator_power; - else if (typeof object.validator_power === "object") - message.validator_power = new $util.LongBits(object.validator_power.low >>> 0, object.validator_power.high >>> 0).toNumber(); - if (object.timestamp != null) { - if (typeof object.timestamp !== "object") - throw TypeError(".tendermint.types.DuplicateVoteEvidence.timestamp: object expected"); - message.timestamp = $root.google.protobuf.Timestamp.fromObject(object.timestamp); - } - return message; - }; - - /** - * Creates a plain object from a DuplicateVoteEvidence message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.types.DuplicateVoteEvidence - * @static - * @param {tendermint.types.DuplicateVoteEvidence} message DuplicateVoteEvidence - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DuplicateVoteEvidence.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.vote_a = null; - object.vote_b = null; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.total_voting_power = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.total_voting_power = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.validator_power = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.validator_power = options.longs === String ? "0" : 0; - object.timestamp = null; - } - if (message.vote_a != null && message.hasOwnProperty("vote_a")) - object.vote_a = $root.tendermint.types.Vote.toObject(message.vote_a, options); - if (message.vote_b != null && message.hasOwnProperty("vote_b")) - object.vote_b = $root.tendermint.types.Vote.toObject(message.vote_b, options); - if (message.total_voting_power != null && message.hasOwnProperty("total_voting_power")) - if (typeof message.total_voting_power === "number") - object.total_voting_power = options.longs === String ? String(message.total_voting_power) : message.total_voting_power; - else - object.total_voting_power = options.longs === String ? $util.Long.prototype.toString.call(message.total_voting_power) : options.longs === Number ? new $util.LongBits(message.total_voting_power.low >>> 0, message.total_voting_power.high >>> 0).toNumber() : message.total_voting_power; - if (message.validator_power != null && message.hasOwnProperty("validator_power")) - if (typeof message.validator_power === "number") - object.validator_power = options.longs === String ? String(message.validator_power) : message.validator_power; - else - object.validator_power = options.longs === String ? $util.Long.prototype.toString.call(message.validator_power) : options.longs === Number ? new $util.LongBits(message.validator_power.low >>> 0, message.validator_power.high >>> 0).toNumber() : message.validator_power; - if (message.timestamp != null && message.hasOwnProperty("timestamp")) - object.timestamp = $root.google.protobuf.Timestamp.toObject(message.timestamp, options); - return object; - }; - - /** - * Converts this DuplicateVoteEvidence to JSON. - * @function toJSON - * @memberof tendermint.types.DuplicateVoteEvidence - * @instance - * @returns {Object.} JSON object - */ - DuplicateVoteEvidence.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return DuplicateVoteEvidence; - })(); - - types.LightClientAttackEvidence = (function() { - - /** - * Properties of a LightClientAttackEvidence. - * @memberof tendermint.types - * @interface ILightClientAttackEvidence - * @property {tendermint.types.ILightBlock|null} [conflicting_block] LightClientAttackEvidence conflicting_block - * @property {Long|null} [common_height] LightClientAttackEvidence common_height - * @property {Array.|null} [byzantine_validators] LightClientAttackEvidence byzantine_validators - * @property {Long|null} [total_voting_power] LightClientAttackEvidence total_voting_power - * @property {google.protobuf.ITimestamp|null} [timestamp] LightClientAttackEvidence timestamp - */ - - /** - * Constructs a new LightClientAttackEvidence. - * @memberof tendermint.types - * @classdesc Represents a LightClientAttackEvidence. - * @implements ILightClientAttackEvidence - * @constructor - * @param {tendermint.types.ILightClientAttackEvidence=} [properties] Properties to set - */ - function LightClientAttackEvidence(properties) { - this.byzantine_validators = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * LightClientAttackEvidence conflicting_block. - * @member {tendermint.types.ILightBlock|null|undefined} conflicting_block - * @memberof tendermint.types.LightClientAttackEvidence - * @instance - */ - LightClientAttackEvidence.prototype.conflicting_block = null; - - /** - * LightClientAttackEvidence common_height. - * @member {Long} common_height - * @memberof tendermint.types.LightClientAttackEvidence - * @instance - */ - LightClientAttackEvidence.prototype.common_height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * LightClientAttackEvidence byzantine_validators. - * @member {Array.} byzantine_validators - * @memberof tendermint.types.LightClientAttackEvidence - * @instance - */ - LightClientAttackEvidence.prototype.byzantine_validators = $util.emptyArray; - - /** - * LightClientAttackEvidence total_voting_power. - * @member {Long} total_voting_power - * @memberof tendermint.types.LightClientAttackEvidence - * @instance - */ - LightClientAttackEvidence.prototype.total_voting_power = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * LightClientAttackEvidence timestamp. - * @member {google.protobuf.ITimestamp|null|undefined} timestamp - * @memberof tendermint.types.LightClientAttackEvidence - * @instance - */ - LightClientAttackEvidence.prototype.timestamp = null; - - /** - * Encodes the specified LightClientAttackEvidence message. Does not implicitly {@link tendermint.types.LightClientAttackEvidence.verify|verify} messages. - * @function encode - * @memberof tendermint.types.LightClientAttackEvidence - * @static - * @param {tendermint.types.ILightClientAttackEvidence} message LightClientAttackEvidence message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LightClientAttackEvidence.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.conflicting_block != null && Object.hasOwnProperty.call(message, "conflicting_block")) - $root.tendermint.types.LightBlock.encode(message.conflicting_block, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.common_height != null && Object.hasOwnProperty.call(message, "common_height")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.common_height); - if (message.byzantine_validators != null && message.byzantine_validators.length) - for (let i = 0; i < message.byzantine_validators.length; ++i) - $root.tendermint.types.Validator.encode(message.byzantine_validators[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.total_voting_power != null && Object.hasOwnProperty.call(message, "total_voting_power")) - writer.uint32(/* id 4, wireType 0 =*/32).int64(message.total_voting_power); - if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) - $root.google.protobuf.Timestamp.encode(message.timestamp, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified LightClientAttackEvidence message, length delimited. Does not implicitly {@link tendermint.types.LightClientAttackEvidence.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.types.LightClientAttackEvidence - * @static - * @param {tendermint.types.ILightClientAttackEvidence} message LightClientAttackEvidence message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LightClientAttackEvidence.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a LightClientAttackEvidence message from the specified reader or buffer. - * @function decode - * @memberof tendermint.types.LightClientAttackEvidence - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.types.LightClientAttackEvidence} LightClientAttackEvidence - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LightClientAttackEvidence.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.LightClientAttackEvidence(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.conflicting_block = $root.tendermint.types.LightBlock.decode(reader, reader.uint32()); - break; - case 2: - message.common_height = reader.int64(); - break; - case 3: - if (!(message.byzantine_validators && message.byzantine_validators.length)) - message.byzantine_validators = []; - message.byzantine_validators.push($root.tendermint.types.Validator.decode(reader, reader.uint32())); - break; - case 4: - message.total_voting_power = reader.int64(); - break; - case 5: - message.timestamp = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a LightClientAttackEvidence message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.types.LightClientAttackEvidence - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.types.LightClientAttackEvidence} LightClientAttackEvidence - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LightClientAttackEvidence.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a LightClientAttackEvidence message. - * @function verify - * @memberof tendermint.types.LightClientAttackEvidence - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - LightClientAttackEvidence.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.conflicting_block != null && message.hasOwnProperty("conflicting_block")) { - let error = $root.tendermint.types.LightBlock.verify(message.conflicting_block); - if (error) - return "conflicting_block." + error; - } - if (message.common_height != null && message.hasOwnProperty("common_height")) - if (!$util.isInteger(message.common_height) && !(message.common_height && $util.isInteger(message.common_height.low) && $util.isInteger(message.common_height.high))) - return "common_height: integer|Long expected"; - if (message.byzantine_validators != null && message.hasOwnProperty("byzantine_validators")) { - if (!Array.isArray(message.byzantine_validators)) - return "byzantine_validators: array expected"; - for (let i = 0; i < message.byzantine_validators.length; ++i) { - let error = $root.tendermint.types.Validator.verify(message.byzantine_validators[i]); - if (error) - return "byzantine_validators." + error; - } - } - if (message.total_voting_power != null && message.hasOwnProperty("total_voting_power")) - if (!$util.isInteger(message.total_voting_power) && !(message.total_voting_power && $util.isInteger(message.total_voting_power.low) && $util.isInteger(message.total_voting_power.high))) - return "total_voting_power: integer|Long expected"; - if (message.timestamp != null && message.hasOwnProperty("timestamp")) { - let error = $root.google.protobuf.Timestamp.verify(message.timestamp); - if (error) - return "timestamp." + error; - } - return null; - }; - - /** - * Creates a LightClientAttackEvidence message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.types.LightClientAttackEvidence - * @static - * @param {Object.} object Plain object - * @returns {tendermint.types.LightClientAttackEvidence} LightClientAttackEvidence - */ - LightClientAttackEvidence.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.types.LightClientAttackEvidence) - return object; - let message = new $root.tendermint.types.LightClientAttackEvidence(); - if (object.conflicting_block != null) { - if (typeof object.conflicting_block !== "object") - throw TypeError(".tendermint.types.LightClientAttackEvidence.conflicting_block: object expected"); - message.conflicting_block = $root.tendermint.types.LightBlock.fromObject(object.conflicting_block); - } - if (object.common_height != null) - if ($util.Long) - (message.common_height = $util.Long.fromValue(object.common_height)).unsigned = false; - else if (typeof object.common_height === "string") - message.common_height = parseInt(object.common_height, 10); - else if (typeof object.common_height === "number") - message.common_height = object.common_height; - else if (typeof object.common_height === "object") - message.common_height = new $util.LongBits(object.common_height.low >>> 0, object.common_height.high >>> 0).toNumber(); - if (object.byzantine_validators) { - if (!Array.isArray(object.byzantine_validators)) - throw TypeError(".tendermint.types.LightClientAttackEvidence.byzantine_validators: array expected"); - message.byzantine_validators = []; - for (let i = 0; i < object.byzantine_validators.length; ++i) { - if (typeof object.byzantine_validators[i] !== "object") - throw TypeError(".tendermint.types.LightClientAttackEvidence.byzantine_validators: object expected"); - message.byzantine_validators[i] = $root.tendermint.types.Validator.fromObject(object.byzantine_validators[i]); - } - } - if (object.total_voting_power != null) - if ($util.Long) - (message.total_voting_power = $util.Long.fromValue(object.total_voting_power)).unsigned = false; - else if (typeof object.total_voting_power === "string") - message.total_voting_power = parseInt(object.total_voting_power, 10); - else if (typeof object.total_voting_power === "number") - message.total_voting_power = object.total_voting_power; - else if (typeof object.total_voting_power === "object") - message.total_voting_power = new $util.LongBits(object.total_voting_power.low >>> 0, object.total_voting_power.high >>> 0).toNumber(); - if (object.timestamp != null) { - if (typeof object.timestamp !== "object") - throw TypeError(".tendermint.types.LightClientAttackEvidence.timestamp: object expected"); - message.timestamp = $root.google.protobuf.Timestamp.fromObject(object.timestamp); - } - return message; - }; - - /** - * Creates a plain object from a LightClientAttackEvidence message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.types.LightClientAttackEvidence - * @static - * @param {tendermint.types.LightClientAttackEvidence} message LightClientAttackEvidence - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - LightClientAttackEvidence.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.byzantine_validators = []; - if (options.defaults) { - object.conflicting_block = null; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.common_height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.common_height = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.total_voting_power = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.total_voting_power = options.longs === String ? "0" : 0; - object.timestamp = null; - } - if (message.conflicting_block != null && message.hasOwnProperty("conflicting_block")) - object.conflicting_block = $root.tendermint.types.LightBlock.toObject(message.conflicting_block, options); - if (message.common_height != null && message.hasOwnProperty("common_height")) - if (typeof message.common_height === "number") - object.common_height = options.longs === String ? String(message.common_height) : message.common_height; - else - object.common_height = options.longs === String ? $util.Long.prototype.toString.call(message.common_height) : options.longs === Number ? new $util.LongBits(message.common_height.low >>> 0, message.common_height.high >>> 0).toNumber() : message.common_height; - if (message.byzantine_validators && message.byzantine_validators.length) { - object.byzantine_validators = []; - for (let j = 0; j < message.byzantine_validators.length; ++j) - object.byzantine_validators[j] = $root.tendermint.types.Validator.toObject(message.byzantine_validators[j], options); - } - if (message.total_voting_power != null && message.hasOwnProperty("total_voting_power")) - if (typeof message.total_voting_power === "number") - object.total_voting_power = options.longs === String ? String(message.total_voting_power) : message.total_voting_power; - else - object.total_voting_power = options.longs === String ? $util.Long.prototype.toString.call(message.total_voting_power) : options.longs === Number ? new $util.LongBits(message.total_voting_power.low >>> 0, message.total_voting_power.high >>> 0).toNumber() : message.total_voting_power; - if (message.timestamp != null && message.hasOwnProperty("timestamp")) - object.timestamp = $root.google.protobuf.Timestamp.toObject(message.timestamp, options); - return object; - }; - - /** - * Converts this LightClientAttackEvidence to JSON. - * @function toJSON - * @memberof tendermint.types.LightClientAttackEvidence - * @instance - * @returns {Object.} JSON object - */ - LightClientAttackEvidence.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return LightClientAttackEvidence; - })(); - - types.EvidenceList = (function() { - - /** - * Properties of an EvidenceList. - * @memberof tendermint.types - * @interface IEvidenceList - * @property {Array.|null} [evidence] EvidenceList evidence - */ - - /** - * Constructs a new EvidenceList. - * @memberof tendermint.types - * @classdesc Represents an EvidenceList. - * @implements IEvidenceList - * @constructor - * @param {tendermint.types.IEvidenceList=} [properties] Properties to set - */ - function EvidenceList(properties) { - this.evidence = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * EvidenceList evidence. - * @member {Array.} evidence - * @memberof tendermint.types.EvidenceList - * @instance - */ - EvidenceList.prototype.evidence = $util.emptyArray; - - /** - * Encodes the specified EvidenceList message. Does not implicitly {@link tendermint.types.EvidenceList.verify|verify} messages. - * @function encode - * @memberof tendermint.types.EvidenceList - * @static - * @param {tendermint.types.IEvidenceList} message EvidenceList message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EvidenceList.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.evidence != null && message.evidence.length) - for (let i = 0; i < message.evidence.length; ++i) - $root.tendermint.types.Evidence.encode(message.evidence[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified EvidenceList message, length delimited. Does not implicitly {@link tendermint.types.EvidenceList.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.types.EvidenceList - * @static - * @param {tendermint.types.IEvidenceList} message EvidenceList message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EvidenceList.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an EvidenceList message from the specified reader or buffer. - * @function decode - * @memberof tendermint.types.EvidenceList - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.types.EvidenceList} EvidenceList - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EvidenceList.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.EvidenceList(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.evidence && message.evidence.length)) - message.evidence = []; - message.evidence.push($root.tendermint.types.Evidence.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an EvidenceList message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.types.EvidenceList - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.types.EvidenceList} EvidenceList - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EvidenceList.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an EvidenceList message. - * @function verify - * @memberof tendermint.types.EvidenceList - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - EvidenceList.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.evidence != null && message.hasOwnProperty("evidence")) { - if (!Array.isArray(message.evidence)) - return "evidence: array expected"; - for (let i = 0; i < message.evidence.length; ++i) { - let error = $root.tendermint.types.Evidence.verify(message.evidence[i]); - if (error) - return "evidence." + error; - } - } - return null; - }; - - /** - * Creates an EvidenceList message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.types.EvidenceList - * @static - * @param {Object.} object Plain object - * @returns {tendermint.types.EvidenceList} EvidenceList - */ - EvidenceList.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.types.EvidenceList) - return object; - let message = new $root.tendermint.types.EvidenceList(); - if (object.evidence) { - if (!Array.isArray(object.evidence)) - throw TypeError(".tendermint.types.EvidenceList.evidence: array expected"); - message.evidence = []; - for (let i = 0; i < object.evidence.length; ++i) { - if (typeof object.evidence[i] !== "object") - throw TypeError(".tendermint.types.EvidenceList.evidence: object expected"); - message.evidence[i] = $root.tendermint.types.Evidence.fromObject(object.evidence[i]); - } - } - return message; - }; - - /** - * Creates a plain object from an EvidenceList message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.types.EvidenceList - * @static - * @param {tendermint.types.EvidenceList} message EvidenceList - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - EvidenceList.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.evidence = []; - if (message.evidence && message.evidence.length) { - object.evidence = []; - for (let j = 0; j < message.evidence.length; ++j) - object.evidence[j] = $root.tendermint.types.Evidence.toObject(message.evidence[j], options); - } - return object; - }; - - /** - * Converts this EvidenceList to JSON. - * @function toJSON - * @memberof tendermint.types.EvidenceList - * @instance - * @returns {Object.} JSON object - */ - EvidenceList.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return EvidenceList; - })(); - - /** - * BlockIDFlag enum. - * @name tendermint.types.BlockIDFlag - * @enum {number} - * @property {number} BLOCK_ID_FLAG_UNKNOWN=0 BLOCK_ID_FLAG_UNKNOWN value - * @property {number} BLOCK_ID_FLAG_ABSENT=1 BLOCK_ID_FLAG_ABSENT value - * @property {number} BLOCK_ID_FLAG_COMMIT=2 BLOCK_ID_FLAG_COMMIT value - * @property {number} BLOCK_ID_FLAG_NIL=3 BLOCK_ID_FLAG_NIL value - */ - types.BlockIDFlag = (function() { - const valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "BLOCK_ID_FLAG_UNKNOWN"] = 0; - values[valuesById[1] = "BLOCK_ID_FLAG_ABSENT"] = 1; - values[valuesById[2] = "BLOCK_ID_FLAG_COMMIT"] = 2; - values[valuesById[3] = "BLOCK_ID_FLAG_NIL"] = 3; - return values; - })(); - - /** - * SignedMsgType enum. - * @name tendermint.types.SignedMsgType - * @enum {number} - * @property {number} SIGNED_MSG_TYPE_UNKNOWN=0 SIGNED_MSG_TYPE_UNKNOWN value - * @property {number} SIGNED_MSG_TYPE_PREVOTE=1 SIGNED_MSG_TYPE_PREVOTE value - * @property {number} SIGNED_MSG_TYPE_PRECOMMIT=2 SIGNED_MSG_TYPE_PRECOMMIT value - * @property {number} SIGNED_MSG_TYPE_PROPOSAL=32 SIGNED_MSG_TYPE_PROPOSAL value - */ - types.SignedMsgType = (function() { - const valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SIGNED_MSG_TYPE_UNKNOWN"] = 0; - values[valuesById[1] = "SIGNED_MSG_TYPE_PREVOTE"] = 1; - values[valuesById[2] = "SIGNED_MSG_TYPE_PRECOMMIT"] = 2; - values[valuesById[32] = "SIGNED_MSG_TYPE_PROPOSAL"] = 32; - return values; - })(); - - types.PartSetHeader = (function() { - - /** - * Properties of a PartSetHeader. - * @memberof tendermint.types - * @interface IPartSetHeader - * @property {number|null} [total] PartSetHeader total - * @property {Uint8Array|null} [hash] PartSetHeader hash - */ - - /** - * Constructs a new PartSetHeader. - * @memberof tendermint.types - * @classdesc Represents a PartSetHeader. - * @implements IPartSetHeader - * @constructor - * @param {tendermint.types.IPartSetHeader=} [properties] Properties to set - */ - function PartSetHeader(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PartSetHeader total. - * @member {number} total - * @memberof tendermint.types.PartSetHeader - * @instance - */ - PartSetHeader.prototype.total = 0; - - /** - * PartSetHeader hash. - * @member {Uint8Array} hash - * @memberof tendermint.types.PartSetHeader - * @instance - */ - PartSetHeader.prototype.hash = $util.newBuffer([]); - - /** - * Encodes the specified PartSetHeader message. Does not implicitly {@link tendermint.types.PartSetHeader.verify|verify} messages. - * @function encode - * @memberof tendermint.types.PartSetHeader - * @static - * @param {tendermint.types.IPartSetHeader} message PartSetHeader message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PartSetHeader.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.total != null && Object.hasOwnProperty.call(message, "total")) - writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.total); - if (message.hash != null && Object.hasOwnProperty.call(message, "hash")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.hash); - return writer; - }; - - /** - * Encodes the specified PartSetHeader message, length delimited. Does not implicitly {@link tendermint.types.PartSetHeader.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.types.PartSetHeader - * @static - * @param {tendermint.types.IPartSetHeader} message PartSetHeader message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PartSetHeader.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PartSetHeader message from the specified reader or buffer. - * @function decode - * @memberof tendermint.types.PartSetHeader - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.types.PartSetHeader} PartSetHeader - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PartSetHeader.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.PartSetHeader(); - while (reader.pos < end) { - let 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; - }; - - /** - * Decodes a PartSetHeader message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.types.PartSetHeader - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.types.PartSetHeader} PartSetHeader - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PartSetHeader.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PartSetHeader message. - * @function verify - * @memberof tendermint.types.PartSetHeader - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PartSetHeader.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.total != null && message.hasOwnProperty("total")) - if (!$util.isInteger(message.total)) - return "total: integer expected"; - if (message.hash != null && message.hasOwnProperty("hash")) - if (!(message.hash && typeof message.hash.length === "number" || $util.isString(message.hash))) - return "hash: buffer expected"; - return null; - }; - - /** - * Creates a PartSetHeader message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.types.PartSetHeader - * @static - * @param {Object.} object Plain object - * @returns {tendermint.types.PartSetHeader} PartSetHeader - */ - PartSetHeader.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.types.PartSetHeader) - return object; - let message = new $root.tendermint.types.PartSetHeader(); - if (object.total != null) - message.total = object.total >>> 0; - if (object.hash != null) - if (typeof object.hash === "string") - $util.base64.decode(object.hash, message.hash = $util.newBuffer($util.base64.length(object.hash)), 0); - else if (object.hash.length) - message.hash = object.hash; - return message; - }; - - /** - * Creates a plain object from a PartSetHeader message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.types.PartSetHeader - * @static - * @param {tendermint.types.PartSetHeader} message PartSetHeader - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PartSetHeader.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.total = 0; - if (options.bytes === String) - object.hash = ""; - else { - object.hash = []; - if (options.bytes !== Array) - object.hash = $util.newBuffer(object.hash); - } - } - if (message.total != null && message.hasOwnProperty("total")) - object.total = message.total; - if (message.hash != null && message.hasOwnProperty("hash")) - object.hash = options.bytes === String ? $util.base64.encode(message.hash, 0, message.hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.hash) : message.hash; - return object; - }; - - /** - * Converts this PartSetHeader to JSON. - * @function toJSON - * @memberof tendermint.types.PartSetHeader - * @instance - * @returns {Object.} JSON object - */ - PartSetHeader.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return PartSetHeader; - })(); - - types.Part = (function() { - - /** - * Properties of a Part. - * @memberof tendermint.types - * @interface IPart - * @property {number|null} [index] Part index - * @property {Uint8Array|null} [bytes] Part bytes - * @property {tendermint.crypto.IProof|null} [proof] Part proof - */ - - /** - * Constructs a new Part. - * @memberof tendermint.types - * @classdesc Represents a Part. - * @implements IPart - * @constructor - * @param {tendermint.types.IPart=} [properties] Properties to set - */ - function Part(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Part index. - * @member {number} index - * @memberof tendermint.types.Part - * @instance - */ - Part.prototype.index = 0; - - /** - * Part bytes. - * @member {Uint8Array} bytes - * @memberof tendermint.types.Part - * @instance - */ - Part.prototype.bytes = $util.newBuffer([]); - - /** - * Part proof. - * @member {tendermint.crypto.IProof|null|undefined} proof - * @memberof tendermint.types.Part - * @instance - */ - Part.prototype.proof = null; - - /** - * Encodes the specified Part message. Does not implicitly {@link tendermint.types.Part.verify|verify} messages. - * @function encode - * @memberof tendermint.types.Part - * @static - * @param {tendermint.types.IPart} message Part message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Part.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.index != null && Object.hasOwnProperty.call(message, "index")) - writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.index); - if (message.bytes != null && Object.hasOwnProperty.call(message, "bytes")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.bytes); - if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) - $root.tendermint.crypto.Proof.encode(message.proof, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Part message, length delimited. Does not implicitly {@link tendermint.types.Part.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.types.Part - * @static - * @param {tendermint.types.IPart} message Part message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Part.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Part message from the specified reader or buffer. - * @function decode - * @memberof tendermint.types.Part - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.types.Part} Part - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Part.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.Part(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.index = reader.uint32(); - break; - case 2: - message.bytes = reader.bytes(); - break; - case 3: - message.proof = $root.tendermint.crypto.Proof.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Part message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.types.Part - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.types.Part} Part - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Part.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Part message. - * @function verify - * @memberof tendermint.types.Part - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Part.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.index != null && message.hasOwnProperty("index")) - if (!$util.isInteger(message.index)) - return "index: integer expected"; - if (message.bytes != null && message.hasOwnProperty("bytes")) - if (!(message.bytes && typeof message.bytes.length === "number" || $util.isString(message.bytes))) - return "bytes: buffer expected"; - if (message.proof != null && message.hasOwnProperty("proof")) { - let error = $root.tendermint.crypto.Proof.verify(message.proof); - if (error) - return "proof." + error; - } - return null; - }; - - /** - * Creates a Part message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.types.Part - * @static - * @param {Object.} object Plain object - * @returns {tendermint.types.Part} Part - */ - Part.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.types.Part) - return object; - let message = new $root.tendermint.types.Part(); - if (object.index != null) - message.index = object.index >>> 0; - if (object.bytes != null) - if (typeof object.bytes === "string") - $util.base64.decode(object.bytes, message.bytes = $util.newBuffer($util.base64.length(object.bytes)), 0); - else if (object.bytes.length) - message.bytes = object.bytes; - if (object.proof != null) { - if (typeof object.proof !== "object") - throw TypeError(".tendermint.types.Part.proof: object expected"); - message.proof = $root.tendermint.crypto.Proof.fromObject(object.proof); - } - return message; - }; - - /** - * Creates a plain object from a Part message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.types.Part - * @static - * @param {tendermint.types.Part} message Part - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Part.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.index = 0; - if (options.bytes === String) - object.bytes = ""; - else { - object.bytes = []; - if (options.bytes !== Array) - object.bytes = $util.newBuffer(object.bytes); - } - object.proof = null; - } - if (message.index != null && message.hasOwnProperty("index")) - object.index = message.index; - if (message.bytes != null && message.hasOwnProperty("bytes")) - object.bytes = options.bytes === String ? $util.base64.encode(message.bytes, 0, message.bytes.length) : options.bytes === Array ? Array.prototype.slice.call(message.bytes) : message.bytes; - if (message.proof != null && message.hasOwnProperty("proof")) - object.proof = $root.tendermint.crypto.Proof.toObject(message.proof, options); - return object; - }; - - /** - * Converts this Part to JSON. - * @function toJSON - * @memberof tendermint.types.Part - * @instance - * @returns {Object.} JSON object - */ - Part.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Part; - })(); - - types.BlockID = (function() { - - /** - * Properties of a BlockID. - * @memberof tendermint.types - * @interface IBlockID - * @property {Uint8Array|null} [hash] BlockID hash - * @property {tendermint.types.IPartSetHeader|null} [part_set_header] BlockID part_set_header - */ - - /** - * Constructs a new BlockID. - * @memberof tendermint.types - * @classdesc Represents a BlockID. - * @implements IBlockID - * @constructor - * @param {tendermint.types.IBlockID=} [properties] Properties to set - */ - function BlockID(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * BlockID hash. - * @member {Uint8Array} hash - * @memberof tendermint.types.BlockID - * @instance - */ - BlockID.prototype.hash = $util.newBuffer([]); - - /** - * BlockID part_set_header. - * @member {tendermint.types.IPartSetHeader|null|undefined} part_set_header - * @memberof tendermint.types.BlockID - * @instance - */ - BlockID.prototype.part_set_header = null; - - /** - * Encodes the specified BlockID message. Does not implicitly {@link tendermint.types.BlockID.verify|verify} messages. - * @function encode - * @memberof tendermint.types.BlockID - * @static - * @param {tendermint.types.IBlockID} message BlockID message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BlockID.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.hash != null && Object.hasOwnProperty.call(message, "hash")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.hash); - if (message.part_set_header != null && Object.hasOwnProperty.call(message, "part_set_header")) - $root.tendermint.types.PartSetHeader.encode(message.part_set_header, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified BlockID message, length delimited. Does not implicitly {@link tendermint.types.BlockID.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.types.BlockID - * @static - * @param {tendermint.types.IBlockID} message BlockID message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BlockID.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BlockID message from the specified reader or buffer. - * @function decode - * @memberof tendermint.types.BlockID - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.types.BlockID} BlockID - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BlockID.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.BlockID(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.hash = reader.bytes(); - break; - case 2: - message.part_set_header = $root.tendermint.types.PartSetHeader.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BlockID message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.types.BlockID - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.types.BlockID} BlockID - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BlockID.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BlockID message. - * @function verify - * @memberof tendermint.types.BlockID - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BlockID.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.hash != null && message.hasOwnProperty("hash")) - if (!(message.hash && typeof message.hash.length === "number" || $util.isString(message.hash))) - return "hash: buffer expected"; - if (message.part_set_header != null && message.hasOwnProperty("part_set_header")) { - let error = $root.tendermint.types.PartSetHeader.verify(message.part_set_header); - if (error) - return "part_set_header." + error; - } - return null; - }; - - /** - * Creates a BlockID message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.types.BlockID - * @static - * @param {Object.} object Plain object - * @returns {tendermint.types.BlockID} BlockID - */ - BlockID.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.types.BlockID) - return object; - let message = new $root.tendermint.types.BlockID(); - if (object.hash != null) - if (typeof object.hash === "string") - $util.base64.decode(object.hash, message.hash = $util.newBuffer($util.base64.length(object.hash)), 0); - else if (object.hash.length) - message.hash = object.hash; - if (object.part_set_header != null) { - if (typeof object.part_set_header !== "object") - throw TypeError(".tendermint.types.BlockID.part_set_header: object expected"); - message.part_set_header = $root.tendermint.types.PartSetHeader.fromObject(object.part_set_header); - } - return message; - }; - - /** - * Creates a plain object from a BlockID message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.types.BlockID - * @static - * @param {tendermint.types.BlockID} message BlockID - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BlockID.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if (options.bytes === String) - object.hash = ""; - else { - object.hash = []; - if (options.bytes !== Array) - object.hash = $util.newBuffer(object.hash); - } - object.part_set_header = null; - } - if (message.hash != null && message.hasOwnProperty("hash")) - object.hash = options.bytes === String ? $util.base64.encode(message.hash, 0, message.hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.hash) : message.hash; - if (message.part_set_header != null && message.hasOwnProperty("part_set_header")) - object.part_set_header = $root.tendermint.types.PartSetHeader.toObject(message.part_set_header, options); - return object; - }; - - /** - * Converts this BlockID to JSON. - * @function toJSON - * @memberof tendermint.types.BlockID - * @instance - * @returns {Object.} JSON object - */ - BlockID.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return BlockID; - })(); - - types.Header = (function() { - - /** - * Properties of a Header. - * @memberof tendermint.types - * @interface IHeader - * @property {tendermint.version.IConsensus|null} [version] Header version - * @property {string|null} [chain_id] Header chain_id - * @property {Long|null} [height] Header height - * @property {google.protobuf.ITimestamp|null} [time] Header time - * @property {tendermint.types.IBlockID|null} [last_block_id] Header last_block_id - * @property {Uint8Array|null} [last_commit_hash] Header last_commit_hash - * @property {Uint8Array|null} [data_hash] Header data_hash - * @property {Uint8Array|null} [validators_hash] Header validators_hash - * @property {Uint8Array|null} [next_validators_hash] Header next_validators_hash - * @property {Uint8Array|null} [consensus_hash] Header consensus_hash - * @property {Uint8Array|null} [app_hash] Header app_hash - * @property {Uint8Array|null} [last_results_hash] Header last_results_hash - * @property {Uint8Array|null} [evidence_hash] Header evidence_hash - * @property {Uint8Array|null} [proposer_address] Header proposer_address - */ - - /** - * Constructs a new Header. - * @memberof tendermint.types - * @classdesc Represents a Header. - * @implements IHeader - * @constructor - * @param {tendermint.types.IHeader=} [properties] Properties to set - */ - function Header(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Header version. - * @member {tendermint.version.IConsensus|null|undefined} version - * @memberof tendermint.types.Header - * @instance - */ - Header.prototype.version = null; - - /** - * Header chain_id. - * @member {string} chain_id - * @memberof tendermint.types.Header - * @instance - */ - Header.prototype.chain_id = ""; - - /** - * Header height. - * @member {Long} height - * @memberof tendermint.types.Header - * @instance - */ - Header.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Header time. - * @member {google.protobuf.ITimestamp|null|undefined} time - * @memberof tendermint.types.Header - * @instance - */ - Header.prototype.time = null; - - /** - * Header last_block_id. - * @member {tendermint.types.IBlockID|null|undefined} last_block_id - * @memberof tendermint.types.Header - * @instance - */ - Header.prototype.last_block_id = null; - - /** - * Header last_commit_hash. - * @member {Uint8Array} last_commit_hash - * @memberof tendermint.types.Header - * @instance - */ - Header.prototype.last_commit_hash = $util.newBuffer([]); - - /** - * Header data_hash. - * @member {Uint8Array} data_hash - * @memberof tendermint.types.Header - * @instance - */ - Header.prototype.data_hash = $util.newBuffer([]); - - /** - * Header validators_hash. - * @member {Uint8Array} validators_hash - * @memberof tendermint.types.Header - * @instance - */ - Header.prototype.validators_hash = $util.newBuffer([]); - - /** - * Header next_validators_hash. - * @member {Uint8Array} next_validators_hash - * @memberof tendermint.types.Header - * @instance - */ - Header.prototype.next_validators_hash = $util.newBuffer([]); - - /** - * Header consensus_hash. - * @member {Uint8Array} consensus_hash - * @memberof tendermint.types.Header - * @instance - */ - Header.prototype.consensus_hash = $util.newBuffer([]); - - /** - * Header app_hash. - * @member {Uint8Array} app_hash - * @memberof tendermint.types.Header - * @instance - */ - Header.prototype.app_hash = $util.newBuffer([]); - - /** - * Header last_results_hash. - * @member {Uint8Array} last_results_hash - * @memberof tendermint.types.Header - * @instance - */ - Header.prototype.last_results_hash = $util.newBuffer([]); - - /** - * Header evidence_hash. - * @member {Uint8Array} evidence_hash - * @memberof tendermint.types.Header - * @instance - */ - Header.prototype.evidence_hash = $util.newBuffer([]); - - /** - * Header proposer_address. - * @member {Uint8Array} proposer_address - * @memberof tendermint.types.Header - * @instance - */ - Header.prototype.proposer_address = $util.newBuffer([]); - - /** - * Encodes the specified Header message. Does not implicitly {@link tendermint.types.Header.verify|verify} messages. - * @function encode - * @memberof tendermint.types.Header - * @static - * @param {tendermint.types.IHeader} message Header message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Header.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.version != null && Object.hasOwnProperty.call(message, "version")) - $root.tendermint.version.Consensus.encode(message.version, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.chain_id != null && Object.hasOwnProperty.call(message, "chain_id")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.chain_id); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.height); - if (message.time != null && Object.hasOwnProperty.call(message, "time")) - $root.google.protobuf.Timestamp.encode(message.time, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.last_block_id != null && Object.hasOwnProperty.call(message, "last_block_id")) - $root.tendermint.types.BlockID.encode(message.last_block_id, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.last_commit_hash != null && Object.hasOwnProperty.call(message, "last_commit_hash")) - writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.last_commit_hash); - if (message.data_hash != null && Object.hasOwnProperty.call(message, "data_hash")) - writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.data_hash); - if (message.validators_hash != null && Object.hasOwnProperty.call(message, "validators_hash")) - writer.uint32(/* id 8, wireType 2 =*/66).bytes(message.validators_hash); - if (message.next_validators_hash != null && Object.hasOwnProperty.call(message, "next_validators_hash")) - writer.uint32(/* id 9, wireType 2 =*/74).bytes(message.next_validators_hash); - if (message.consensus_hash != null && Object.hasOwnProperty.call(message, "consensus_hash")) - writer.uint32(/* id 10, wireType 2 =*/82).bytes(message.consensus_hash); - if (message.app_hash != null && Object.hasOwnProperty.call(message, "app_hash")) - writer.uint32(/* id 11, wireType 2 =*/90).bytes(message.app_hash); - if (message.last_results_hash != null && Object.hasOwnProperty.call(message, "last_results_hash")) - writer.uint32(/* id 12, wireType 2 =*/98).bytes(message.last_results_hash); - if (message.evidence_hash != null && Object.hasOwnProperty.call(message, "evidence_hash")) - writer.uint32(/* id 13, wireType 2 =*/106).bytes(message.evidence_hash); - if (message.proposer_address != null && Object.hasOwnProperty.call(message, "proposer_address")) - writer.uint32(/* id 14, wireType 2 =*/114).bytes(message.proposer_address); - return writer; - }; - - /** - * Encodes the specified Header message, length delimited. Does not implicitly {@link tendermint.types.Header.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.types.Header - * @static - * @param {tendermint.types.IHeader} message Header message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Header.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Header message from the specified reader or buffer. - * @function decode - * @memberof tendermint.types.Header - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.types.Header} Header - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Header.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.Header(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.version = $root.tendermint.version.Consensus.decode(reader, reader.uint32()); - break; - case 2: - message.chain_id = reader.string(); - break; - case 3: - message.height = reader.int64(); - break; - case 4: - message.time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 5: - message.last_block_id = $root.tendermint.types.BlockID.decode(reader, reader.uint32()); - break; - case 6: - message.last_commit_hash = reader.bytes(); - break; - case 7: - message.data_hash = reader.bytes(); - break; - case 8: - message.validators_hash = reader.bytes(); - break; - case 9: - message.next_validators_hash = reader.bytes(); - break; - case 10: - message.consensus_hash = reader.bytes(); - break; - case 11: - message.app_hash = reader.bytes(); - break; - case 12: - message.last_results_hash = reader.bytes(); - break; - case 13: - message.evidence_hash = reader.bytes(); - break; - case 14: - message.proposer_address = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Header message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.types.Header - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.types.Header} Header - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Header.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Header message. - * @function verify - * @memberof tendermint.types.Header - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Header.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.version != null && message.hasOwnProperty("version")) { - let error = $root.tendermint.version.Consensus.verify(message.version); - if (error) - return "version." + error; - } - if (message.chain_id != null && message.hasOwnProperty("chain_id")) - if (!$util.isString(message.chain_id)) - return "chain_id: string expected"; - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) - return "height: integer|Long expected"; - if (message.time != null && message.hasOwnProperty("time")) { - let error = $root.google.protobuf.Timestamp.verify(message.time); - if (error) - return "time." + error; - } - if (message.last_block_id != null && message.hasOwnProperty("last_block_id")) { - let error = $root.tendermint.types.BlockID.verify(message.last_block_id); - if (error) - return "last_block_id." + error; - } - if (message.last_commit_hash != null && message.hasOwnProperty("last_commit_hash")) - if (!(message.last_commit_hash && typeof message.last_commit_hash.length === "number" || $util.isString(message.last_commit_hash))) - return "last_commit_hash: buffer expected"; - if (message.data_hash != null && message.hasOwnProperty("data_hash")) - if (!(message.data_hash && typeof message.data_hash.length === "number" || $util.isString(message.data_hash))) - return "data_hash: buffer expected"; - if (message.validators_hash != null && message.hasOwnProperty("validators_hash")) - if (!(message.validators_hash && typeof message.validators_hash.length === "number" || $util.isString(message.validators_hash))) - return "validators_hash: buffer expected"; - if (message.next_validators_hash != null && message.hasOwnProperty("next_validators_hash")) - if (!(message.next_validators_hash && typeof message.next_validators_hash.length === "number" || $util.isString(message.next_validators_hash))) - return "next_validators_hash: buffer expected"; - if (message.consensus_hash != null && message.hasOwnProperty("consensus_hash")) - if (!(message.consensus_hash && typeof message.consensus_hash.length === "number" || $util.isString(message.consensus_hash))) - return "consensus_hash: buffer expected"; - if (message.app_hash != null && message.hasOwnProperty("app_hash")) - if (!(message.app_hash && typeof message.app_hash.length === "number" || $util.isString(message.app_hash))) - return "app_hash: buffer expected"; - if (message.last_results_hash != null && message.hasOwnProperty("last_results_hash")) - if (!(message.last_results_hash && typeof message.last_results_hash.length === "number" || $util.isString(message.last_results_hash))) - return "last_results_hash: buffer expected"; - if (message.evidence_hash != null && message.hasOwnProperty("evidence_hash")) - if (!(message.evidence_hash && typeof message.evidence_hash.length === "number" || $util.isString(message.evidence_hash))) - return "evidence_hash: buffer expected"; - if (message.proposer_address != null && message.hasOwnProperty("proposer_address")) - if (!(message.proposer_address && typeof message.proposer_address.length === "number" || $util.isString(message.proposer_address))) - return "proposer_address: buffer expected"; - return null; - }; - - /** - * Creates a Header message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.types.Header - * @static - * @param {Object.} object Plain object - * @returns {tendermint.types.Header} Header - */ - Header.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.types.Header) - return object; - let message = new $root.tendermint.types.Header(); - if (object.version != null) { - if (typeof object.version !== "object") - throw TypeError(".tendermint.types.Header.version: object expected"); - message.version = $root.tendermint.version.Consensus.fromObject(object.version); - } - if (object.chain_id != null) - message.chain_id = String(object.chain_id); - if (object.height != null) - if ($util.Long) - (message.height = $util.Long.fromValue(object.height)).unsigned = false; - else if (typeof object.height === "string") - message.height = parseInt(object.height, 10); - else if (typeof object.height === "number") - message.height = object.height; - else if (typeof object.height === "object") - message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); - if (object.time != null) { - if (typeof object.time !== "object") - throw TypeError(".tendermint.types.Header.time: object expected"); - message.time = $root.google.protobuf.Timestamp.fromObject(object.time); - } - if (object.last_block_id != null) { - if (typeof object.last_block_id !== "object") - throw TypeError(".tendermint.types.Header.last_block_id: object expected"); - message.last_block_id = $root.tendermint.types.BlockID.fromObject(object.last_block_id); - } - if (object.last_commit_hash != null) - if (typeof object.last_commit_hash === "string") - $util.base64.decode(object.last_commit_hash, message.last_commit_hash = $util.newBuffer($util.base64.length(object.last_commit_hash)), 0); - else if (object.last_commit_hash.length) - message.last_commit_hash = object.last_commit_hash; - if (object.data_hash != null) - if (typeof object.data_hash === "string") - $util.base64.decode(object.data_hash, message.data_hash = $util.newBuffer($util.base64.length(object.data_hash)), 0); - else if (object.data_hash.length) - message.data_hash = object.data_hash; - if (object.validators_hash != null) - if (typeof object.validators_hash === "string") - $util.base64.decode(object.validators_hash, message.validators_hash = $util.newBuffer($util.base64.length(object.validators_hash)), 0); - else if (object.validators_hash.length) - message.validators_hash = object.validators_hash; - if (object.next_validators_hash != null) - if (typeof object.next_validators_hash === "string") - $util.base64.decode(object.next_validators_hash, message.next_validators_hash = $util.newBuffer($util.base64.length(object.next_validators_hash)), 0); - else if (object.next_validators_hash.length) - message.next_validators_hash = object.next_validators_hash; - if (object.consensus_hash != null) - if (typeof object.consensus_hash === "string") - $util.base64.decode(object.consensus_hash, message.consensus_hash = $util.newBuffer($util.base64.length(object.consensus_hash)), 0); - else if (object.consensus_hash.length) - message.consensus_hash = object.consensus_hash; - if (object.app_hash != null) - if (typeof object.app_hash === "string") - $util.base64.decode(object.app_hash, message.app_hash = $util.newBuffer($util.base64.length(object.app_hash)), 0); - else if (object.app_hash.length) - message.app_hash = object.app_hash; - if (object.last_results_hash != null) - if (typeof object.last_results_hash === "string") - $util.base64.decode(object.last_results_hash, message.last_results_hash = $util.newBuffer($util.base64.length(object.last_results_hash)), 0); - else if (object.last_results_hash.length) - message.last_results_hash = object.last_results_hash; - if (object.evidence_hash != null) - if (typeof object.evidence_hash === "string") - $util.base64.decode(object.evidence_hash, message.evidence_hash = $util.newBuffer($util.base64.length(object.evidence_hash)), 0); - else if (object.evidence_hash.length) - message.evidence_hash = object.evidence_hash; - if (object.proposer_address != null) - if (typeof object.proposer_address === "string") - $util.base64.decode(object.proposer_address, message.proposer_address = $util.newBuffer($util.base64.length(object.proposer_address)), 0); - else if (object.proposer_address.length) - message.proposer_address = object.proposer_address; - return message; - }; - - /** - * Creates a plain object from a Header message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.types.Header - * @static - * @param {tendermint.types.Header} message Header - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Header.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.version = null; - object.chain_id = ""; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.height = options.longs === String ? "0" : 0; - object.time = null; - object.last_block_id = null; - if (options.bytes === String) - object.last_commit_hash = ""; - else { - object.last_commit_hash = []; - if (options.bytes !== Array) - object.last_commit_hash = $util.newBuffer(object.last_commit_hash); - } - if (options.bytes === String) - object.data_hash = ""; - else { - object.data_hash = []; - if (options.bytes !== Array) - object.data_hash = $util.newBuffer(object.data_hash); - } - if (options.bytes === String) - object.validators_hash = ""; - else { - object.validators_hash = []; - if (options.bytes !== Array) - object.validators_hash = $util.newBuffer(object.validators_hash); - } - if (options.bytes === String) - object.next_validators_hash = ""; - else { - object.next_validators_hash = []; - if (options.bytes !== Array) - object.next_validators_hash = $util.newBuffer(object.next_validators_hash); - } - if (options.bytes === String) - object.consensus_hash = ""; - else { - object.consensus_hash = []; - if (options.bytes !== Array) - object.consensus_hash = $util.newBuffer(object.consensus_hash); - } - if (options.bytes === String) - object.app_hash = ""; - else { - object.app_hash = []; - if (options.bytes !== Array) - object.app_hash = $util.newBuffer(object.app_hash); - } - if (options.bytes === String) - object.last_results_hash = ""; - else { - object.last_results_hash = []; - if (options.bytes !== Array) - object.last_results_hash = $util.newBuffer(object.last_results_hash); - } - if (options.bytes === String) - object.evidence_hash = ""; - else { - object.evidence_hash = []; - if (options.bytes !== Array) - object.evidence_hash = $util.newBuffer(object.evidence_hash); - } - if (options.bytes === String) - object.proposer_address = ""; - else { - object.proposer_address = []; - if (options.bytes !== Array) - object.proposer_address = $util.newBuffer(object.proposer_address); - } - } - if (message.version != null && message.hasOwnProperty("version")) - object.version = $root.tendermint.version.Consensus.toObject(message.version, options); - if (message.chain_id != null && message.hasOwnProperty("chain_id")) - object.chain_id = message.chain_id; - if (message.height != null && message.hasOwnProperty("height")) - if (typeof message.height === "number") - object.height = options.longs === String ? String(message.height) : message.height; - else - object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; - if (message.time != null && message.hasOwnProperty("time")) - object.time = $root.google.protobuf.Timestamp.toObject(message.time, options); - if (message.last_block_id != null && message.hasOwnProperty("last_block_id")) - object.last_block_id = $root.tendermint.types.BlockID.toObject(message.last_block_id, options); - if (message.last_commit_hash != null && message.hasOwnProperty("last_commit_hash")) - object.last_commit_hash = options.bytes === String ? $util.base64.encode(message.last_commit_hash, 0, message.last_commit_hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.last_commit_hash) : message.last_commit_hash; - if (message.data_hash != null && message.hasOwnProperty("data_hash")) - object.data_hash = options.bytes === String ? $util.base64.encode(message.data_hash, 0, message.data_hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.data_hash) : message.data_hash; - if (message.validators_hash != null && message.hasOwnProperty("validators_hash")) - object.validators_hash = options.bytes === String ? $util.base64.encode(message.validators_hash, 0, message.validators_hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.validators_hash) : message.validators_hash; - if (message.next_validators_hash != null && message.hasOwnProperty("next_validators_hash")) - object.next_validators_hash = options.bytes === String ? $util.base64.encode(message.next_validators_hash, 0, message.next_validators_hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.next_validators_hash) : message.next_validators_hash; - if (message.consensus_hash != null && message.hasOwnProperty("consensus_hash")) - object.consensus_hash = options.bytes === String ? $util.base64.encode(message.consensus_hash, 0, message.consensus_hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.consensus_hash) : message.consensus_hash; - if (message.app_hash != null && message.hasOwnProperty("app_hash")) - object.app_hash = options.bytes === String ? $util.base64.encode(message.app_hash, 0, message.app_hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.app_hash) : message.app_hash; - if (message.last_results_hash != null && message.hasOwnProperty("last_results_hash")) - object.last_results_hash = options.bytes === String ? $util.base64.encode(message.last_results_hash, 0, message.last_results_hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.last_results_hash) : message.last_results_hash; - if (message.evidence_hash != null && message.hasOwnProperty("evidence_hash")) - object.evidence_hash = options.bytes === String ? $util.base64.encode(message.evidence_hash, 0, message.evidence_hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.evidence_hash) : message.evidence_hash; - if (message.proposer_address != null && message.hasOwnProperty("proposer_address")) - object.proposer_address = options.bytes === String ? $util.base64.encode(message.proposer_address, 0, message.proposer_address.length) : options.bytes === Array ? Array.prototype.slice.call(message.proposer_address) : message.proposer_address; - return object; - }; - - /** - * Converts this Header to JSON. - * @function toJSON - * @memberof tendermint.types.Header - * @instance - * @returns {Object.} JSON object - */ - Header.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Header; - })(); - - types.Data = (function() { - - /** - * Properties of a Data. - * @memberof tendermint.types - * @interface IData - * @property {Array.|null} [txs] Data txs - */ - - /** - * Constructs a new Data. - * @memberof tendermint.types - * @classdesc Represents a Data. - * @implements IData - * @constructor - * @param {tendermint.types.IData=} [properties] Properties to set - */ - function Data(properties) { - this.txs = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Data txs. - * @member {Array.} txs - * @memberof tendermint.types.Data - * @instance - */ - Data.prototype.txs = $util.emptyArray; - - /** - * Encodes the specified Data message. Does not implicitly {@link tendermint.types.Data.verify|verify} messages. - * @function encode - * @memberof tendermint.types.Data - * @static - * @param {tendermint.types.IData} message Data message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Data.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.txs != null && message.txs.length) - for (let i = 0; i < message.txs.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.txs[i]); - return writer; - }; - - /** - * Encodes the specified Data message, length delimited. Does not implicitly {@link tendermint.types.Data.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.types.Data - * @static - * @param {tendermint.types.IData} message Data message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Data.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Data message from the specified reader or buffer. - * @function decode - * @memberof tendermint.types.Data - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.types.Data} Data - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Data.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.Data(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.txs && message.txs.length)) - message.txs = []; - message.txs.push(reader.bytes()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Data message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.types.Data - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.types.Data} Data - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Data.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Data message. - * @function verify - * @memberof tendermint.types.Data - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Data.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.txs != null && message.hasOwnProperty("txs")) { - if (!Array.isArray(message.txs)) - return "txs: array expected"; - for (let i = 0; i < message.txs.length; ++i) - if (!(message.txs[i] && typeof message.txs[i].length === "number" || $util.isString(message.txs[i]))) - return "txs: buffer[] expected"; - } - return null; - }; - - /** - * Creates a Data message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.types.Data - * @static - * @param {Object.} object Plain object - * @returns {tendermint.types.Data} Data - */ - Data.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.types.Data) - return object; - let message = new $root.tendermint.types.Data(); - if (object.txs) { - if (!Array.isArray(object.txs)) - throw TypeError(".tendermint.types.Data.txs: array expected"); - message.txs = []; - for (let i = 0; i < object.txs.length; ++i) - if (typeof object.txs[i] === "string") - $util.base64.decode(object.txs[i], message.txs[i] = $util.newBuffer($util.base64.length(object.txs[i])), 0); - else if (object.txs[i].length) - message.txs[i] = object.txs[i]; - } - return message; - }; - - /** - * Creates a plain object from a Data message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.types.Data - * @static - * @param {tendermint.types.Data} message Data - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Data.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.txs = []; - if (message.txs && message.txs.length) { - object.txs = []; - for (let j = 0; j < message.txs.length; ++j) - object.txs[j] = options.bytes === String ? $util.base64.encode(message.txs[j], 0, message.txs[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.txs[j]) : message.txs[j]; - } - return object; - }; - - /** - * Converts this Data to JSON. - * @function toJSON - * @memberof tendermint.types.Data - * @instance - * @returns {Object.} JSON object - */ - Data.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Data; - })(); - - types.Vote = (function() { - - /** - * Properties of a Vote. - * @memberof tendermint.types - * @interface IVote - * @property {tendermint.types.SignedMsgType|null} [type] Vote type - * @property {Long|null} [height] Vote height - * @property {number|null} [round] Vote round - * @property {tendermint.types.IBlockID|null} [block_id] Vote block_id - * @property {google.protobuf.ITimestamp|null} [timestamp] Vote timestamp - * @property {Uint8Array|null} [validator_address] Vote validator_address - * @property {number|null} [validator_index] Vote validator_index - * @property {Uint8Array|null} [signature] Vote signature - */ - - /** - * Constructs a new Vote. - * @memberof tendermint.types - * @classdesc Represents a Vote. - * @implements IVote - * @constructor - * @param {tendermint.types.IVote=} [properties] Properties to set - */ - function Vote(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Vote type. - * @member {tendermint.types.SignedMsgType} type - * @memberof tendermint.types.Vote - * @instance - */ - Vote.prototype.type = 0; - - /** - * Vote height. - * @member {Long} height - * @memberof tendermint.types.Vote - * @instance - */ - Vote.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Vote round. - * @member {number} round - * @memberof tendermint.types.Vote - * @instance - */ - Vote.prototype.round = 0; - - /** - * Vote block_id. - * @member {tendermint.types.IBlockID|null|undefined} block_id - * @memberof tendermint.types.Vote - * @instance - */ - Vote.prototype.block_id = null; - - /** - * Vote timestamp. - * @member {google.protobuf.ITimestamp|null|undefined} timestamp - * @memberof tendermint.types.Vote - * @instance - */ - Vote.prototype.timestamp = null; - - /** - * Vote validator_address. - * @member {Uint8Array} validator_address - * @memberof tendermint.types.Vote - * @instance - */ - Vote.prototype.validator_address = $util.newBuffer([]); - - /** - * Vote validator_index. - * @member {number} validator_index - * @memberof tendermint.types.Vote - * @instance - */ - Vote.prototype.validator_index = 0; - - /** - * Vote signature. - * @member {Uint8Array} signature - * @memberof tendermint.types.Vote - * @instance - */ - Vote.prototype.signature = $util.newBuffer([]); - - /** - * Encodes the specified Vote message. Does not implicitly {@link tendermint.types.Vote.verify|verify} messages. - * @function encode - * @memberof tendermint.types.Vote - * @static - * @param {tendermint.types.IVote} message Vote message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Vote.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.height); - if (message.round != null && Object.hasOwnProperty.call(message, "round")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.round); - if (message.block_id != null && Object.hasOwnProperty.call(message, "block_id")) - $root.tendermint.types.BlockID.encode(message.block_id, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) - $root.google.protobuf.Timestamp.encode(message.timestamp, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) - writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.validator_address); - if (message.validator_index != null && Object.hasOwnProperty.call(message, "validator_index")) - writer.uint32(/* id 7, wireType 0 =*/56).int32(message.validator_index); - if (message.signature != null && Object.hasOwnProperty.call(message, "signature")) - writer.uint32(/* id 8, wireType 2 =*/66).bytes(message.signature); - return writer; - }; - - /** - * Encodes the specified Vote message, length delimited. Does not implicitly {@link tendermint.types.Vote.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.types.Vote - * @static - * @param {tendermint.types.IVote} message Vote message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Vote.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Vote message from the specified reader or buffer. - * @function decode - * @memberof tendermint.types.Vote - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.types.Vote} Vote - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Vote.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.Vote(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.type = reader.int32(); - break; - case 2: - message.height = reader.int64(); - break; - case 3: - message.round = reader.int32(); - break; - case 4: - message.block_id = $root.tendermint.types.BlockID.decode(reader, reader.uint32()); - break; - case 5: - message.timestamp = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 6: - message.validator_address = reader.bytes(); - break; - case 7: - message.validator_index = reader.int32(); - break; - case 8: - message.signature = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Vote message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.types.Vote - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.types.Vote} Vote - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Vote.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Vote message. - * @function verify - * @memberof tendermint.types.Vote - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Vote.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - case 32: - break; - } - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) - return "height: integer|Long expected"; - if (message.round != null && message.hasOwnProperty("round")) - if (!$util.isInteger(message.round)) - return "round: integer expected"; - if (message.block_id != null && message.hasOwnProperty("block_id")) { - let error = $root.tendermint.types.BlockID.verify(message.block_id); - if (error) - return "block_id." + error; - } - if (message.timestamp != null && message.hasOwnProperty("timestamp")) { - let error = $root.google.protobuf.Timestamp.verify(message.timestamp); - if (error) - return "timestamp." + error; - } - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - if (!(message.validator_address && typeof message.validator_address.length === "number" || $util.isString(message.validator_address))) - return "validator_address: buffer expected"; - if (message.validator_index != null && message.hasOwnProperty("validator_index")) - if (!$util.isInteger(message.validator_index)) - return "validator_index: integer expected"; - if (message.signature != null && message.hasOwnProperty("signature")) - if (!(message.signature && typeof message.signature.length === "number" || $util.isString(message.signature))) - return "signature: buffer expected"; - return null; - }; - - /** - * Creates a Vote message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.types.Vote - * @static - * @param {Object.} object Plain object - * @returns {tendermint.types.Vote} Vote - */ - Vote.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.types.Vote) - return object; - let message = new $root.tendermint.types.Vote(); - switch (object.type) { - case "SIGNED_MSG_TYPE_UNKNOWN": - case 0: - message.type = 0; - break; - case "SIGNED_MSG_TYPE_PREVOTE": - case 1: - message.type = 1; - break; - case "SIGNED_MSG_TYPE_PRECOMMIT": - case 2: - message.type = 2; - break; - case "SIGNED_MSG_TYPE_PROPOSAL": - case 32: - message.type = 32; - break; - } - if (object.height != null) - if ($util.Long) - (message.height = $util.Long.fromValue(object.height)).unsigned = false; - else if (typeof object.height === "string") - message.height = parseInt(object.height, 10); - else if (typeof object.height === "number") - message.height = object.height; - else if (typeof object.height === "object") - message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); - if (object.round != null) - message.round = object.round | 0; - if (object.block_id != null) { - if (typeof object.block_id !== "object") - throw TypeError(".tendermint.types.Vote.block_id: object expected"); - message.block_id = $root.tendermint.types.BlockID.fromObject(object.block_id); - } - if (object.timestamp != null) { - if (typeof object.timestamp !== "object") - throw TypeError(".tendermint.types.Vote.timestamp: object expected"); - message.timestamp = $root.google.protobuf.Timestamp.fromObject(object.timestamp); - } - if (object.validator_address != null) - if (typeof object.validator_address === "string") - $util.base64.decode(object.validator_address, message.validator_address = $util.newBuffer($util.base64.length(object.validator_address)), 0); - else if (object.validator_address.length) - message.validator_address = object.validator_address; - if (object.validator_index != null) - message.validator_index = object.validator_index | 0; - if (object.signature != null) - if (typeof object.signature === "string") - $util.base64.decode(object.signature, message.signature = $util.newBuffer($util.base64.length(object.signature)), 0); - else if (object.signature.length) - message.signature = object.signature; - return message; - }; - - /** - * Creates a plain object from a Vote message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.types.Vote - * @static - * @param {tendermint.types.Vote} message Vote - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Vote.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.type = options.enums === String ? "SIGNED_MSG_TYPE_UNKNOWN" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.height = options.longs === String ? "0" : 0; - object.round = 0; - object.block_id = null; - object.timestamp = null; - if (options.bytes === String) - object.validator_address = ""; - else { - object.validator_address = []; - if (options.bytes !== Array) - object.validator_address = $util.newBuffer(object.validator_address); - } - object.validator_index = 0; - if (options.bytes === String) - object.signature = ""; - else { - object.signature = []; - if (options.bytes !== Array) - object.signature = $util.newBuffer(object.signature); - } - } - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.tendermint.types.SignedMsgType[message.type] : message.type; - if (message.height != null && message.hasOwnProperty("height")) - if (typeof message.height === "number") - object.height = options.longs === String ? String(message.height) : message.height; - else - object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; - if (message.round != null && message.hasOwnProperty("round")) - object.round = message.round; - if (message.block_id != null && message.hasOwnProperty("block_id")) - object.block_id = $root.tendermint.types.BlockID.toObject(message.block_id, options); - if (message.timestamp != null && message.hasOwnProperty("timestamp")) - object.timestamp = $root.google.protobuf.Timestamp.toObject(message.timestamp, options); - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - object.validator_address = options.bytes === String ? $util.base64.encode(message.validator_address, 0, message.validator_address.length) : options.bytes === Array ? Array.prototype.slice.call(message.validator_address) : message.validator_address; - if (message.validator_index != null && message.hasOwnProperty("validator_index")) - object.validator_index = message.validator_index; - if (message.signature != null && message.hasOwnProperty("signature")) - object.signature = options.bytes === String ? $util.base64.encode(message.signature, 0, message.signature.length) : options.bytes === Array ? Array.prototype.slice.call(message.signature) : message.signature; - return object; - }; - - /** - * Converts this Vote to JSON. - * @function toJSON - * @memberof tendermint.types.Vote - * @instance - * @returns {Object.} JSON object - */ - Vote.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Vote; - })(); - - types.Commit = (function() { - - /** - * Properties of a Commit. - * @memberof tendermint.types - * @interface ICommit - * @property {Long|null} [height] Commit height - * @property {number|null} [round] Commit round - * @property {tendermint.types.IBlockID|null} [block_id] Commit block_id - * @property {Array.|null} [signatures] Commit signatures - */ - - /** - * Constructs a new Commit. - * @memberof tendermint.types - * @classdesc Represents a Commit. - * @implements ICommit - * @constructor - * @param {tendermint.types.ICommit=} [properties] Properties to set - */ - function Commit(properties) { - this.signatures = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Commit height. - * @member {Long} height - * @memberof tendermint.types.Commit - * @instance - */ - Commit.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Commit round. - * @member {number} round - * @memberof tendermint.types.Commit - * @instance - */ - Commit.prototype.round = 0; - - /** - * Commit block_id. - * @member {tendermint.types.IBlockID|null|undefined} block_id - * @memberof tendermint.types.Commit - * @instance - */ - Commit.prototype.block_id = null; - - /** - * Commit signatures. - * @member {Array.} signatures - * @memberof tendermint.types.Commit - * @instance - */ - Commit.prototype.signatures = $util.emptyArray; - - /** - * Encodes the specified Commit message. Does not implicitly {@link tendermint.types.Commit.verify|verify} messages. - * @function encode - * @memberof tendermint.types.Commit - * @static - * @param {tendermint.types.ICommit} message Commit message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Commit.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.height); - if (message.round != null && Object.hasOwnProperty.call(message, "round")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.round); - if (message.block_id != null && Object.hasOwnProperty.call(message, "block_id")) - $root.tendermint.types.BlockID.encode(message.block_id, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.signatures != null && message.signatures.length) - for (let i = 0; i < message.signatures.length; ++i) - $root.tendermint.types.CommitSig.encode(message.signatures[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Commit message, length delimited. Does not implicitly {@link tendermint.types.Commit.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.types.Commit - * @static - * @param {tendermint.types.ICommit} message Commit message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Commit.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Commit message from the specified reader or buffer. - * @function decode - * @memberof tendermint.types.Commit - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.types.Commit} Commit - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Commit.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.Commit(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.height = reader.int64(); - break; - case 2: - message.round = reader.int32(); - break; - case 3: - message.block_id = $root.tendermint.types.BlockID.decode(reader, reader.uint32()); - break; - case 4: - if (!(message.signatures && message.signatures.length)) - message.signatures = []; - message.signatures.push($root.tendermint.types.CommitSig.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Commit message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.types.Commit - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.types.Commit} Commit - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Commit.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Commit message. - * @function verify - * @memberof tendermint.types.Commit - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Commit.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) - return "height: integer|Long expected"; - if (message.round != null && message.hasOwnProperty("round")) - if (!$util.isInteger(message.round)) - return "round: integer expected"; - if (message.block_id != null && message.hasOwnProperty("block_id")) { - let error = $root.tendermint.types.BlockID.verify(message.block_id); - if (error) - return "block_id." + error; - } - if (message.signatures != null && message.hasOwnProperty("signatures")) { - if (!Array.isArray(message.signatures)) - return "signatures: array expected"; - for (let i = 0; i < message.signatures.length; ++i) { - let error = $root.tendermint.types.CommitSig.verify(message.signatures[i]); - if (error) - return "signatures." + error; - } - } - return null; - }; - - /** - * Creates a Commit message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.types.Commit - * @static - * @param {Object.} object Plain object - * @returns {tendermint.types.Commit} Commit - */ - Commit.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.types.Commit) - return object; - let message = new $root.tendermint.types.Commit(); - if (object.height != null) - if ($util.Long) - (message.height = $util.Long.fromValue(object.height)).unsigned = false; - else if (typeof object.height === "string") - message.height = parseInt(object.height, 10); - else if (typeof object.height === "number") - message.height = object.height; - else if (typeof object.height === "object") - message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); - if (object.round != null) - message.round = object.round | 0; - if (object.block_id != null) { - if (typeof object.block_id !== "object") - throw TypeError(".tendermint.types.Commit.block_id: object expected"); - message.block_id = $root.tendermint.types.BlockID.fromObject(object.block_id); - } - if (object.signatures) { - if (!Array.isArray(object.signatures)) - throw TypeError(".tendermint.types.Commit.signatures: array expected"); - message.signatures = []; - for (let i = 0; i < object.signatures.length; ++i) { - if (typeof object.signatures[i] !== "object") - throw TypeError(".tendermint.types.Commit.signatures: object expected"); - message.signatures[i] = $root.tendermint.types.CommitSig.fromObject(object.signatures[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a Commit message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.types.Commit - * @static - * @param {tendermint.types.Commit} message Commit - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Commit.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.signatures = []; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.height = options.longs === String ? "0" : 0; - object.round = 0; - object.block_id = null; - } - if (message.height != null && message.hasOwnProperty("height")) - if (typeof message.height === "number") - object.height = options.longs === String ? String(message.height) : message.height; - else - object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; - if (message.round != null && message.hasOwnProperty("round")) - object.round = message.round; - if (message.block_id != null && message.hasOwnProperty("block_id")) - object.block_id = $root.tendermint.types.BlockID.toObject(message.block_id, options); - if (message.signatures && message.signatures.length) { - object.signatures = []; - for (let j = 0; j < message.signatures.length; ++j) - object.signatures[j] = $root.tendermint.types.CommitSig.toObject(message.signatures[j], options); - } - return object; - }; - - /** - * Converts this Commit to JSON. - * @function toJSON - * @memberof tendermint.types.Commit - * @instance - * @returns {Object.} JSON object - */ - Commit.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Commit; - })(); - - types.CommitSig = (function() { - - /** - * Properties of a CommitSig. - * @memberof tendermint.types - * @interface ICommitSig - * @property {tendermint.types.BlockIDFlag|null} [block_id_flag] CommitSig block_id_flag - * @property {Uint8Array|null} [validator_address] CommitSig validator_address - * @property {google.protobuf.ITimestamp|null} [timestamp] CommitSig timestamp - * @property {Uint8Array|null} [signature] CommitSig signature - */ - - /** - * Constructs a new CommitSig. - * @memberof tendermint.types - * @classdesc Represents a CommitSig. - * @implements ICommitSig - * @constructor - * @param {tendermint.types.ICommitSig=} [properties] Properties to set - */ - function CommitSig(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * CommitSig block_id_flag. - * @member {tendermint.types.BlockIDFlag} block_id_flag - * @memberof tendermint.types.CommitSig - * @instance - */ - CommitSig.prototype.block_id_flag = 0; - - /** - * CommitSig validator_address. - * @member {Uint8Array} validator_address - * @memberof tendermint.types.CommitSig - * @instance - */ - CommitSig.prototype.validator_address = $util.newBuffer([]); - - /** - * CommitSig timestamp. - * @member {google.protobuf.ITimestamp|null|undefined} timestamp - * @memberof tendermint.types.CommitSig - * @instance - */ - CommitSig.prototype.timestamp = null; - - /** - * CommitSig signature. - * @member {Uint8Array} signature - * @memberof tendermint.types.CommitSig - * @instance - */ - CommitSig.prototype.signature = $util.newBuffer([]); - - /** - * Encodes the specified CommitSig message. Does not implicitly {@link tendermint.types.CommitSig.verify|verify} messages. - * @function encode - * @memberof tendermint.types.CommitSig - * @static - * @param {tendermint.types.ICommitSig} message CommitSig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CommitSig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.block_id_flag != null && Object.hasOwnProperty.call(message, "block_id_flag")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.block_id_flag); - if (message.validator_address != null && Object.hasOwnProperty.call(message, "validator_address")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.validator_address); - if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) - $root.google.protobuf.Timestamp.encode(message.timestamp, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.signature != null && Object.hasOwnProperty.call(message, "signature")) - writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.signature); - return writer; - }; - - /** - * Encodes the specified CommitSig message, length delimited. Does not implicitly {@link tendermint.types.CommitSig.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.types.CommitSig - * @static - * @param {tendermint.types.ICommitSig} message CommitSig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CommitSig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CommitSig message from the specified reader or buffer. - * @function decode - * @memberof tendermint.types.CommitSig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.types.CommitSig} CommitSig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CommitSig.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.CommitSig(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.block_id_flag = reader.int32(); - break; - case 2: - message.validator_address = reader.bytes(); - break; - case 3: - message.timestamp = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 4: - message.signature = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CommitSig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.types.CommitSig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.types.CommitSig} CommitSig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CommitSig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CommitSig message. - * @function verify - * @memberof tendermint.types.CommitSig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CommitSig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.block_id_flag != null && message.hasOwnProperty("block_id_flag")) - switch (message.block_id_flag) { - default: - return "block_id_flag: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - if (!(message.validator_address && typeof message.validator_address.length === "number" || $util.isString(message.validator_address))) - return "validator_address: buffer expected"; - if (message.timestamp != null && message.hasOwnProperty("timestamp")) { - let error = $root.google.protobuf.Timestamp.verify(message.timestamp); - if (error) - return "timestamp." + error; - } - if (message.signature != null && message.hasOwnProperty("signature")) - if (!(message.signature && typeof message.signature.length === "number" || $util.isString(message.signature))) - return "signature: buffer expected"; - return null; - }; - - /** - * Creates a CommitSig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.types.CommitSig - * @static - * @param {Object.} object Plain object - * @returns {tendermint.types.CommitSig} CommitSig - */ - CommitSig.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.types.CommitSig) - return object; - let message = new $root.tendermint.types.CommitSig(); - switch (object.block_id_flag) { - case "BLOCK_ID_FLAG_UNKNOWN": - case 0: - message.block_id_flag = 0; - break; - case "BLOCK_ID_FLAG_ABSENT": - case 1: - message.block_id_flag = 1; - break; - case "BLOCK_ID_FLAG_COMMIT": - case 2: - message.block_id_flag = 2; - break; - case "BLOCK_ID_FLAG_NIL": - case 3: - message.block_id_flag = 3; - break; - } - if (object.validator_address != null) - if (typeof object.validator_address === "string") - $util.base64.decode(object.validator_address, message.validator_address = $util.newBuffer($util.base64.length(object.validator_address)), 0); - else if (object.validator_address.length) - message.validator_address = object.validator_address; - if (object.timestamp != null) { - if (typeof object.timestamp !== "object") - throw TypeError(".tendermint.types.CommitSig.timestamp: object expected"); - message.timestamp = $root.google.protobuf.Timestamp.fromObject(object.timestamp); - } - if (object.signature != null) - if (typeof object.signature === "string") - $util.base64.decode(object.signature, message.signature = $util.newBuffer($util.base64.length(object.signature)), 0); - else if (object.signature.length) - message.signature = object.signature; - return message; - }; - - /** - * Creates a plain object from a CommitSig message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.types.CommitSig - * @static - * @param {tendermint.types.CommitSig} message CommitSig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CommitSig.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.block_id_flag = options.enums === String ? "BLOCK_ID_FLAG_UNKNOWN" : 0; - if (options.bytes === String) - object.validator_address = ""; - else { - object.validator_address = []; - if (options.bytes !== Array) - object.validator_address = $util.newBuffer(object.validator_address); - } - object.timestamp = null; - if (options.bytes === String) - object.signature = ""; - else { - object.signature = []; - if (options.bytes !== Array) - object.signature = $util.newBuffer(object.signature); - } - } - if (message.block_id_flag != null && message.hasOwnProperty("block_id_flag")) - object.block_id_flag = options.enums === String ? $root.tendermint.types.BlockIDFlag[message.block_id_flag] : message.block_id_flag; - if (message.validator_address != null && message.hasOwnProperty("validator_address")) - object.validator_address = options.bytes === String ? $util.base64.encode(message.validator_address, 0, message.validator_address.length) : options.bytes === Array ? Array.prototype.slice.call(message.validator_address) : message.validator_address; - if (message.timestamp != null && message.hasOwnProperty("timestamp")) - object.timestamp = $root.google.protobuf.Timestamp.toObject(message.timestamp, options); - if (message.signature != null && message.hasOwnProperty("signature")) - object.signature = options.bytes === String ? $util.base64.encode(message.signature, 0, message.signature.length) : options.bytes === Array ? Array.prototype.slice.call(message.signature) : message.signature; - return object; - }; - - /** - * Converts this CommitSig to JSON. - * @function toJSON - * @memberof tendermint.types.CommitSig - * @instance - * @returns {Object.} JSON object - */ - CommitSig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return CommitSig; - })(); - - types.Proposal = (function() { - - /** - * Properties of a Proposal. - * @memberof tendermint.types - * @interface IProposal - * @property {tendermint.types.SignedMsgType|null} [type] Proposal type - * @property {Long|null} [height] Proposal height - * @property {number|null} [round] Proposal round - * @property {number|null} [pol_round] Proposal pol_round - * @property {tendermint.types.IBlockID|null} [block_id] Proposal block_id - * @property {google.protobuf.ITimestamp|null} [timestamp] Proposal timestamp - * @property {Uint8Array|null} [signature] Proposal signature - */ - - /** - * Constructs a new Proposal. - * @memberof tendermint.types - * @classdesc Represents a Proposal. - * @implements IProposal - * @constructor - * @param {tendermint.types.IProposal=} [properties] Properties to set - */ - function Proposal(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Proposal type. - * @member {tendermint.types.SignedMsgType} type - * @memberof tendermint.types.Proposal - * @instance - */ - Proposal.prototype.type = 0; - - /** - * Proposal height. - * @member {Long} height - * @memberof tendermint.types.Proposal - * @instance - */ - Proposal.prototype.height = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Proposal round. - * @member {number} round - * @memberof tendermint.types.Proposal - * @instance - */ - Proposal.prototype.round = 0; - - /** - * Proposal pol_round. - * @member {number} pol_round - * @memberof tendermint.types.Proposal - * @instance - */ - Proposal.prototype.pol_round = 0; - - /** - * Proposal block_id. - * @member {tendermint.types.IBlockID|null|undefined} block_id - * @memberof tendermint.types.Proposal - * @instance - */ - Proposal.prototype.block_id = null; - - /** - * Proposal timestamp. - * @member {google.protobuf.ITimestamp|null|undefined} timestamp - * @memberof tendermint.types.Proposal - * @instance - */ - Proposal.prototype.timestamp = null; - - /** - * Proposal signature. - * @member {Uint8Array} signature - * @memberof tendermint.types.Proposal - * @instance - */ - Proposal.prototype.signature = $util.newBuffer([]); - - /** - * Encodes the specified Proposal message. Does not implicitly {@link tendermint.types.Proposal.verify|verify} messages. - * @function encode - * @memberof tendermint.types.Proposal - * @static - * @param {tendermint.types.IProposal} message Proposal message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Proposal.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); - if (message.height != null && Object.hasOwnProperty.call(message, "height")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.height); - if (message.round != null && Object.hasOwnProperty.call(message, "round")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.round); - if (message.pol_round != null && Object.hasOwnProperty.call(message, "pol_round")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.pol_round); - if (message.block_id != null && Object.hasOwnProperty.call(message, "block_id")) - $root.tendermint.types.BlockID.encode(message.block_id, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) - $root.google.protobuf.Timestamp.encode(message.timestamp, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.signature != null && Object.hasOwnProperty.call(message, "signature")) - writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.signature); - return writer; - }; - - /** - * Encodes the specified Proposal message, length delimited. Does not implicitly {@link tendermint.types.Proposal.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.types.Proposal - * @static - * @param {tendermint.types.IProposal} message Proposal message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Proposal.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Proposal message from the specified reader or buffer. - * @function decode - * @memberof tendermint.types.Proposal - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.types.Proposal} Proposal - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Proposal.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.Proposal(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.type = reader.int32(); - break; - case 2: - message.height = reader.int64(); - break; - case 3: - message.round = reader.int32(); - break; - case 4: - message.pol_round = reader.int32(); - break; - case 5: - message.block_id = $root.tendermint.types.BlockID.decode(reader, reader.uint32()); - break; - case 6: - message.timestamp = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 7: - message.signature = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Proposal message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.types.Proposal - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.types.Proposal} Proposal - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Proposal.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Proposal message. - * @function verify - * @memberof tendermint.types.Proposal - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Proposal.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - case 32: - break; - } - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height) && !(message.height && $util.isInteger(message.height.low) && $util.isInteger(message.height.high))) - return "height: integer|Long expected"; - if (message.round != null && message.hasOwnProperty("round")) - if (!$util.isInteger(message.round)) - return "round: integer expected"; - if (message.pol_round != null && message.hasOwnProperty("pol_round")) - if (!$util.isInteger(message.pol_round)) - return "pol_round: integer expected"; - if (message.block_id != null && message.hasOwnProperty("block_id")) { - let error = $root.tendermint.types.BlockID.verify(message.block_id); - if (error) - return "block_id." + error; - } - if (message.timestamp != null && message.hasOwnProperty("timestamp")) { - let error = $root.google.protobuf.Timestamp.verify(message.timestamp); - if (error) - return "timestamp." + error; - } - if (message.signature != null && message.hasOwnProperty("signature")) - if (!(message.signature && typeof message.signature.length === "number" || $util.isString(message.signature))) - return "signature: buffer expected"; - return null; - }; - - /** - * Creates a Proposal message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.types.Proposal - * @static - * @param {Object.} object Plain object - * @returns {tendermint.types.Proposal} Proposal - */ - Proposal.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.types.Proposal) - return object; - let message = new $root.tendermint.types.Proposal(); - switch (object.type) { - case "SIGNED_MSG_TYPE_UNKNOWN": - case 0: - message.type = 0; - break; - case "SIGNED_MSG_TYPE_PREVOTE": - case 1: - message.type = 1; - break; - case "SIGNED_MSG_TYPE_PRECOMMIT": - case 2: - message.type = 2; - break; - case "SIGNED_MSG_TYPE_PROPOSAL": - case 32: - message.type = 32; - break; - } - if (object.height != null) - if ($util.Long) - (message.height = $util.Long.fromValue(object.height)).unsigned = false; - else if (typeof object.height === "string") - message.height = parseInt(object.height, 10); - else if (typeof object.height === "number") - message.height = object.height; - else if (typeof object.height === "object") - message.height = new $util.LongBits(object.height.low >>> 0, object.height.high >>> 0).toNumber(); - if (object.round != null) - message.round = object.round | 0; - if (object.pol_round != null) - message.pol_round = object.pol_round | 0; - if (object.block_id != null) { - if (typeof object.block_id !== "object") - throw TypeError(".tendermint.types.Proposal.block_id: object expected"); - message.block_id = $root.tendermint.types.BlockID.fromObject(object.block_id); - } - if (object.timestamp != null) { - if (typeof object.timestamp !== "object") - throw TypeError(".tendermint.types.Proposal.timestamp: object expected"); - message.timestamp = $root.google.protobuf.Timestamp.fromObject(object.timestamp); - } - if (object.signature != null) - if (typeof object.signature === "string") - $util.base64.decode(object.signature, message.signature = $util.newBuffer($util.base64.length(object.signature)), 0); - else if (object.signature.length) - message.signature = object.signature; - return message; - }; - - /** - * Creates a plain object from a Proposal message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.types.Proposal - * @static - * @param {tendermint.types.Proposal} message Proposal - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Proposal.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.type = options.enums === String ? "SIGNED_MSG_TYPE_UNKNOWN" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.height = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.height = options.longs === String ? "0" : 0; - object.round = 0; - object.pol_round = 0; - object.block_id = null; - object.timestamp = null; - if (options.bytes === String) - object.signature = ""; - else { - object.signature = []; - if (options.bytes !== Array) - object.signature = $util.newBuffer(object.signature); - } - } - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.tendermint.types.SignedMsgType[message.type] : message.type; - if (message.height != null && message.hasOwnProperty("height")) - if (typeof message.height === "number") - object.height = options.longs === String ? String(message.height) : message.height; - else - object.height = options.longs === String ? $util.Long.prototype.toString.call(message.height) : options.longs === Number ? new $util.LongBits(message.height.low >>> 0, message.height.high >>> 0).toNumber() : message.height; - if (message.round != null && message.hasOwnProperty("round")) - object.round = message.round; - if (message.pol_round != null && message.hasOwnProperty("pol_round")) - object.pol_round = message.pol_round; - if (message.block_id != null && message.hasOwnProperty("block_id")) - object.block_id = $root.tendermint.types.BlockID.toObject(message.block_id, options); - if (message.timestamp != null && message.hasOwnProperty("timestamp")) - object.timestamp = $root.google.protobuf.Timestamp.toObject(message.timestamp, options); - if (message.signature != null && message.hasOwnProperty("signature")) - object.signature = options.bytes === String ? $util.base64.encode(message.signature, 0, message.signature.length) : options.bytes === Array ? Array.prototype.slice.call(message.signature) : message.signature; - return object; - }; - - /** - * Converts this Proposal to JSON. - * @function toJSON - * @memberof tendermint.types.Proposal - * @instance - * @returns {Object.} JSON object - */ - Proposal.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Proposal; - })(); - - types.SignedHeader = (function() { - - /** - * Properties of a SignedHeader. - * @memberof tendermint.types - * @interface ISignedHeader - * @property {tendermint.types.IHeader|null} [header] SignedHeader header - * @property {tendermint.types.ICommit|null} [commit] SignedHeader commit - */ - - /** - * Constructs a new SignedHeader. - * @memberof tendermint.types - * @classdesc Represents a SignedHeader. - * @implements ISignedHeader - * @constructor - * @param {tendermint.types.ISignedHeader=} [properties] Properties to set - */ - function SignedHeader(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SignedHeader header. - * @member {tendermint.types.IHeader|null|undefined} header - * @memberof tendermint.types.SignedHeader - * @instance - */ - SignedHeader.prototype.header = null; - - /** - * SignedHeader commit. - * @member {tendermint.types.ICommit|null|undefined} commit - * @memberof tendermint.types.SignedHeader - * @instance - */ - SignedHeader.prototype.commit = null; - - /** - * Encodes the specified SignedHeader message. Does not implicitly {@link tendermint.types.SignedHeader.verify|verify} messages. - * @function encode - * @memberof tendermint.types.SignedHeader - * @static - * @param {tendermint.types.ISignedHeader} message SignedHeader message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SignedHeader.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.header != null && Object.hasOwnProperty.call(message, "header")) - $root.tendermint.types.Header.encode(message.header, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.commit != null && Object.hasOwnProperty.call(message, "commit")) - $root.tendermint.types.Commit.encode(message.commit, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SignedHeader message, length delimited. Does not implicitly {@link tendermint.types.SignedHeader.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.types.SignedHeader - * @static - * @param {tendermint.types.ISignedHeader} message SignedHeader message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SignedHeader.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SignedHeader message from the specified reader or buffer. - * @function decode - * @memberof tendermint.types.SignedHeader - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.types.SignedHeader} SignedHeader - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SignedHeader.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.SignedHeader(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.header = $root.tendermint.types.Header.decode(reader, reader.uint32()); - break; - case 2: - message.commit = $root.tendermint.types.Commit.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SignedHeader message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.types.SignedHeader - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.types.SignedHeader} SignedHeader - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SignedHeader.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SignedHeader message. - * @function verify - * @memberof tendermint.types.SignedHeader - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SignedHeader.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.header != null && message.hasOwnProperty("header")) { - let error = $root.tendermint.types.Header.verify(message.header); - if (error) - return "header." + error; - } - if (message.commit != null && message.hasOwnProperty("commit")) { - let error = $root.tendermint.types.Commit.verify(message.commit); - if (error) - return "commit." + error; - } - return null; - }; - - /** - * Creates a SignedHeader message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.types.SignedHeader - * @static - * @param {Object.} object Plain object - * @returns {tendermint.types.SignedHeader} SignedHeader - */ - SignedHeader.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.types.SignedHeader) - return object; - let message = new $root.tendermint.types.SignedHeader(); - if (object.header != null) { - if (typeof object.header !== "object") - throw TypeError(".tendermint.types.SignedHeader.header: object expected"); - message.header = $root.tendermint.types.Header.fromObject(object.header); - } - if (object.commit != null) { - if (typeof object.commit !== "object") - throw TypeError(".tendermint.types.SignedHeader.commit: object expected"); - message.commit = $root.tendermint.types.Commit.fromObject(object.commit); - } - return message; - }; - - /** - * Creates a plain object from a SignedHeader message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.types.SignedHeader - * @static - * @param {tendermint.types.SignedHeader} message SignedHeader - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SignedHeader.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.header = null; - object.commit = null; - } - if (message.header != null && message.hasOwnProperty("header")) - object.header = $root.tendermint.types.Header.toObject(message.header, options); - if (message.commit != null && message.hasOwnProperty("commit")) - object.commit = $root.tendermint.types.Commit.toObject(message.commit, options); - return object; - }; - - /** - * Converts this SignedHeader to JSON. - * @function toJSON - * @memberof tendermint.types.SignedHeader - * @instance - * @returns {Object.} JSON object - */ - SignedHeader.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return SignedHeader; - })(); - - types.LightBlock = (function() { - - /** - * Properties of a LightBlock. - * @memberof tendermint.types - * @interface ILightBlock - * @property {tendermint.types.ISignedHeader|null} [signed_header] LightBlock signed_header - * @property {tendermint.types.IValidatorSet|null} [validator_set] LightBlock validator_set - */ - - /** - * Constructs a new LightBlock. - * @memberof tendermint.types - * @classdesc Represents a LightBlock. - * @implements ILightBlock - * @constructor - * @param {tendermint.types.ILightBlock=} [properties] Properties to set - */ - function LightBlock(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * LightBlock signed_header. - * @member {tendermint.types.ISignedHeader|null|undefined} signed_header - * @memberof tendermint.types.LightBlock - * @instance - */ - LightBlock.prototype.signed_header = null; - - /** - * LightBlock validator_set. - * @member {tendermint.types.IValidatorSet|null|undefined} validator_set - * @memberof tendermint.types.LightBlock - * @instance - */ - LightBlock.prototype.validator_set = null; - - /** - * Encodes the specified LightBlock message. Does not implicitly {@link tendermint.types.LightBlock.verify|verify} messages. - * @function encode - * @memberof tendermint.types.LightBlock - * @static - * @param {tendermint.types.ILightBlock} message LightBlock message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LightBlock.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.signed_header != null && Object.hasOwnProperty.call(message, "signed_header")) - $root.tendermint.types.SignedHeader.encode(message.signed_header, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.validator_set != null && Object.hasOwnProperty.call(message, "validator_set")) - $root.tendermint.types.ValidatorSet.encode(message.validator_set, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified LightBlock message, length delimited. Does not implicitly {@link tendermint.types.LightBlock.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.types.LightBlock - * @static - * @param {tendermint.types.ILightBlock} message LightBlock message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LightBlock.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a LightBlock message from the specified reader or buffer. - * @function decode - * @memberof tendermint.types.LightBlock - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.types.LightBlock} LightBlock - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LightBlock.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.LightBlock(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.signed_header = $root.tendermint.types.SignedHeader.decode(reader, reader.uint32()); - break; - case 2: - message.validator_set = $root.tendermint.types.ValidatorSet.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a LightBlock message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.types.LightBlock - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.types.LightBlock} LightBlock - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LightBlock.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a LightBlock message. - * @function verify - * @memberof tendermint.types.LightBlock - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - LightBlock.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.signed_header != null && message.hasOwnProperty("signed_header")) { - let error = $root.tendermint.types.SignedHeader.verify(message.signed_header); - if (error) - return "signed_header." + error; - } - if (message.validator_set != null && message.hasOwnProperty("validator_set")) { - let error = $root.tendermint.types.ValidatorSet.verify(message.validator_set); - if (error) - return "validator_set." + error; - } - return null; - }; - - /** - * Creates a LightBlock message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.types.LightBlock - * @static - * @param {Object.} object Plain object - * @returns {tendermint.types.LightBlock} LightBlock - */ - LightBlock.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.types.LightBlock) - return object; - let message = new $root.tendermint.types.LightBlock(); - if (object.signed_header != null) { - if (typeof object.signed_header !== "object") - throw TypeError(".tendermint.types.LightBlock.signed_header: object expected"); - message.signed_header = $root.tendermint.types.SignedHeader.fromObject(object.signed_header); - } - if (object.validator_set != null) { - if (typeof object.validator_set !== "object") - throw TypeError(".tendermint.types.LightBlock.validator_set: object expected"); - message.validator_set = $root.tendermint.types.ValidatorSet.fromObject(object.validator_set); - } - return message; - }; - - /** - * Creates a plain object from a LightBlock message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.types.LightBlock - * @static - * @param {tendermint.types.LightBlock} message LightBlock - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - LightBlock.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.signed_header = null; - object.validator_set = null; - } - if (message.signed_header != null && message.hasOwnProperty("signed_header")) - object.signed_header = $root.tendermint.types.SignedHeader.toObject(message.signed_header, options); - if (message.validator_set != null && message.hasOwnProperty("validator_set")) - object.validator_set = $root.tendermint.types.ValidatorSet.toObject(message.validator_set, options); - return object; - }; - - /** - * Converts this LightBlock to JSON. - * @function toJSON - * @memberof tendermint.types.LightBlock - * @instance - * @returns {Object.} JSON object - */ - LightBlock.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return LightBlock; - })(); - - types.BlockMeta = (function() { - - /** - * Properties of a BlockMeta. - * @memberof tendermint.types - * @interface IBlockMeta - * @property {tendermint.types.IBlockID|null} [block_id] BlockMeta block_id - * @property {Long|null} [block_size] BlockMeta block_size - * @property {tendermint.types.IHeader|null} [header] BlockMeta header - * @property {Long|null} [num_txs] BlockMeta num_txs - */ - - /** - * Constructs a new BlockMeta. - * @memberof tendermint.types - * @classdesc Represents a BlockMeta. - * @implements IBlockMeta - * @constructor - * @param {tendermint.types.IBlockMeta=} [properties] Properties to set - */ - function BlockMeta(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * BlockMeta block_id. - * @member {tendermint.types.IBlockID|null|undefined} block_id - * @memberof tendermint.types.BlockMeta - * @instance - */ - BlockMeta.prototype.block_id = null; - - /** - * BlockMeta block_size. - * @member {Long} block_size - * @memberof tendermint.types.BlockMeta - * @instance - */ - BlockMeta.prototype.block_size = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * BlockMeta header. - * @member {tendermint.types.IHeader|null|undefined} header - * @memberof tendermint.types.BlockMeta - * @instance - */ - BlockMeta.prototype.header = null; - - /** - * BlockMeta num_txs. - * @member {Long} num_txs - * @memberof tendermint.types.BlockMeta - * @instance - */ - BlockMeta.prototype.num_txs = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Encodes the specified BlockMeta message. Does not implicitly {@link tendermint.types.BlockMeta.verify|verify} messages. - * @function encode - * @memberof tendermint.types.BlockMeta - * @static - * @param {tendermint.types.IBlockMeta} message BlockMeta message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BlockMeta.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.block_id != null && Object.hasOwnProperty.call(message, "block_id")) - $root.tendermint.types.BlockID.encode(message.block_id, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.block_size != null && Object.hasOwnProperty.call(message, "block_size")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.block_size); - if (message.header != null && Object.hasOwnProperty.call(message, "header")) - $root.tendermint.types.Header.encode(message.header, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.num_txs != null && Object.hasOwnProperty.call(message, "num_txs")) - writer.uint32(/* id 4, wireType 0 =*/32).int64(message.num_txs); - return writer; - }; - - /** - * Encodes the specified BlockMeta message, length delimited. Does not implicitly {@link tendermint.types.BlockMeta.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.types.BlockMeta - * @static - * @param {tendermint.types.IBlockMeta} message BlockMeta message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BlockMeta.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BlockMeta message from the specified reader or buffer. - * @function decode - * @memberof tendermint.types.BlockMeta - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.types.BlockMeta} BlockMeta - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BlockMeta.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.BlockMeta(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.block_id = $root.tendermint.types.BlockID.decode(reader, reader.uint32()); - break; - case 2: - message.block_size = reader.int64(); - break; - case 3: - message.header = $root.tendermint.types.Header.decode(reader, reader.uint32()); - break; - case 4: - message.num_txs = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BlockMeta message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.types.BlockMeta - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.types.BlockMeta} BlockMeta - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BlockMeta.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BlockMeta message. - * @function verify - * @memberof tendermint.types.BlockMeta - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BlockMeta.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.block_id != null && message.hasOwnProperty("block_id")) { - let error = $root.tendermint.types.BlockID.verify(message.block_id); - if (error) - return "block_id." + error; - } - if (message.block_size != null && message.hasOwnProperty("block_size")) - if (!$util.isInteger(message.block_size) && !(message.block_size && $util.isInteger(message.block_size.low) && $util.isInteger(message.block_size.high))) - return "block_size: integer|Long expected"; - if (message.header != null && message.hasOwnProperty("header")) { - let error = $root.tendermint.types.Header.verify(message.header); - if (error) - return "header." + error; - } - if (message.num_txs != null && message.hasOwnProperty("num_txs")) - if (!$util.isInteger(message.num_txs) && !(message.num_txs && $util.isInteger(message.num_txs.low) && $util.isInteger(message.num_txs.high))) - return "num_txs: integer|Long expected"; - return null; - }; - - /** - * Creates a BlockMeta message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.types.BlockMeta - * @static - * @param {Object.} object Plain object - * @returns {tendermint.types.BlockMeta} BlockMeta - */ - BlockMeta.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.types.BlockMeta) - return object; - let message = new $root.tendermint.types.BlockMeta(); - if (object.block_id != null) { - if (typeof object.block_id !== "object") - throw TypeError(".tendermint.types.BlockMeta.block_id: object expected"); - message.block_id = $root.tendermint.types.BlockID.fromObject(object.block_id); - } - if (object.block_size != null) - if ($util.Long) - (message.block_size = $util.Long.fromValue(object.block_size)).unsigned = false; - else if (typeof object.block_size === "string") - message.block_size = parseInt(object.block_size, 10); - else if (typeof object.block_size === "number") - message.block_size = object.block_size; - else if (typeof object.block_size === "object") - message.block_size = new $util.LongBits(object.block_size.low >>> 0, object.block_size.high >>> 0).toNumber(); - if (object.header != null) { - if (typeof object.header !== "object") - throw TypeError(".tendermint.types.BlockMeta.header: object expected"); - message.header = $root.tendermint.types.Header.fromObject(object.header); - } - if (object.num_txs != null) - if ($util.Long) - (message.num_txs = $util.Long.fromValue(object.num_txs)).unsigned = false; - else if (typeof object.num_txs === "string") - message.num_txs = parseInt(object.num_txs, 10); - else if (typeof object.num_txs === "number") - message.num_txs = object.num_txs; - else if (typeof object.num_txs === "object") - message.num_txs = new $util.LongBits(object.num_txs.low >>> 0, object.num_txs.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a BlockMeta message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.types.BlockMeta - * @static - * @param {tendermint.types.BlockMeta} message BlockMeta - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BlockMeta.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.block_id = null; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.block_size = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.block_size = options.longs === String ? "0" : 0; - object.header = null; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.num_txs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.num_txs = options.longs === String ? "0" : 0; - } - if (message.block_id != null && message.hasOwnProperty("block_id")) - object.block_id = $root.tendermint.types.BlockID.toObject(message.block_id, options); - if (message.block_size != null && message.hasOwnProperty("block_size")) - if (typeof message.block_size === "number") - object.block_size = options.longs === String ? String(message.block_size) : message.block_size; - else - object.block_size = options.longs === String ? $util.Long.prototype.toString.call(message.block_size) : options.longs === Number ? new $util.LongBits(message.block_size.low >>> 0, message.block_size.high >>> 0).toNumber() : message.block_size; - if (message.header != null && message.hasOwnProperty("header")) - object.header = $root.tendermint.types.Header.toObject(message.header, options); - if (message.num_txs != null && message.hasOwnProperty("num_txs")) - if (typeof message.num_txs === "number") - object.num_txs = options.longs === String ? String(message.num_txs) : message.num_txs; - else - object.num_txs = options.longs === String ? $util.Long.prototype.toString.call(message.num_txs) : options.longs === Number ? new $util.LongBits(message.num_txs.low >>> 0, message.num_txs.high >>> 0).toNumber() : message.num_txs; - return object; - }; - - /** - * Converts this BlockMeta to JSON. - * @function toJSON - * @memberof tendermint.types.BlockMeta - * @instance - * @returns {Object.} JSON object - */ - BlockMeta.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return BlockMeta; - })(); - - types.TxProof = (function() { - - /** - * Properties of a TxProof. - * @memberof tendermint.types - * @interface ITxProof - * @property {Uint8Array|null} [root_hash] TxProof root_hash - * @property {Uint8Array|null} [data] TxProof data - * @property {tendermint.crypto.IProof|null} [proof] TxProof proof - */ - - /** - * Constructs a new TxProof. - * @memberof tendermint.types - * @classdesc Represents a TxProof. - * @implements ITxProof - * @constructor - * @param {tendermint.types.ITxProof=} [properties] Properties to set - */ - function TxProof(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * TxProof root_hash. - * @member {Uint8Array} root_hash - * @memberof tendermint.types.TxProof - * @instance - */ - TxProof.prototype.root_hash = $util.newBuffer([]); - - /** - * TxProof data. - * @member {Uint8Array} data - * @memberof tendermint.types.TxProof - * @instance - */ - TxProof.prototype.data = $util.newBuffer([]); - - /** - * TxProof proof. - * @member {tendermint.crypto.IProof|null|undefined} proof - * @memberof tendermint.types.TxProof - * @instance - */ - TxProof.prototype.proof = null; - - /** - * Encodes the specified TxProof message. Does not implicitly {@link tendermint.types.TxProof.verify|verify} messages. - * @function encode - * @memberof tendermint.types.TxProof - * @static - * @param {tendermint.types.ITxProof} message TxProof message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TxProof.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.root_hash != null && Object.hasOwnProperty.call(message, "root_hash")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.root_hash); - if (message.data != null && Object.hasOwnProperty.call(message, "data")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.data); - if (message.proof != null && Object.hasOwnProperty.call(message, "proof")) - $root.tendermint.crypto.Proof.encode(message.proof, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified TxProof message, length delimited. Does not implicitly {@link tendermint.types.TxProof.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.types.TxProof - * @static - * @param {tendermint.types.ITxProof} message TxProof message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TxProof.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TxProof message from the specified reader or buffer. - * @function decode - * @memberof tendermint.types.TxProof - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.types.TxProof} TxProof - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TxProof.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.TxProof(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.root_hash = reader.bytes(); - break; - case 2: - message.data = reader.bytes(); - break; - case 3: - message.proof = $root.tendermint.crypto.Proof.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a TxProof message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.types.TxProof - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.types.TxProof} TxProof - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TxProof.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TxProof message. - * @function verify - * @memberof tendermint.types.TxProof - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TxProof.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.root_hash != null && message.hasOwnProperty("root_hash")) - if (!(message.root_hash && typeof message.root_hash.length === "number" || $util.isString(message.root_hash))) - return "root_hash: buffer expected"; - if (message.data != null && message.hasOwnProperty("data")) - if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) - return "data: buffer expected"; - if (message.proof != null && message.hasOwnProperty("proof")) { - let error = $root.tendermint.crypto.Proof.verify(message.proof); - if (error) - return "proof." + error; - } - return null; - }; - - /** - * Creates a TxProof message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.types.TxProof - * @static - * @param {Object.} object Plain object - * @returns {tendermint.types.TxProof} TxProof - */ - TxProof.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.types.TxProof) - return object; - let message = new $root.tendermint.types.TxProof(); - if (object.root_hash != null) - if (typeof object.root_hash === "string") - $util.base64.decode(object.root_hash, message.root_hash = $util.newBuffer($util.base64.length(object.root_hash)), 0); - else if (object.root_hash.length) - message.root_hash = object.root_hash; - if (object.data != null) - if (typeof object.data === "string") - $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); - else if (object.data.length) - message.data = object.data; - if (object.proof != null) { - if (typeof object.proof !== "object") - throw TypeError(".tendermint.types.TxProof.proof: object expected"); - message.proof = $root.tendermint.crypto.Proof.fromObject(object.proof); - } - return message; - }; - - /** - * Creates a plain object from a TxProof message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.types.TxProof - * @static - * @param {tendermint.types.TxProof} message TxProof - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TxProof.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if (options.bytes === String) - object.root_hash = ""; - else { - object.root_hash = []; - if (options.bytes !== Array) - object.root_hash = $util.newBuffer(object.root_hash); - } - if (options.bytes === String) - object.data = ""; - else { - object.data = []; - if (options.bytes !== Array) - object.data = $util.newBuffer(object.data); - } - object.proof = null; - } - if (message.root_hash != null && message.hasOwnProperty("root_hash")) - object.root_hash = options.bytes === String ? $util.base64.encode(message.root_hash, 0, message.root_hash.length) : options.bytes === Array ? Array.prototype.slice.call(message.root_hash) : message.root_hash; - if (message.data != null && message.hasOwnProperty("data")) - object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; - if (message.proof != null && message.hasOwnProperty("proof")) - object.proof = $root.tendermint.crypto.Proof.toObject(message.proof, options); - return object; - }; - - /** - * Converts this TxProof to JSON. - * @function toJSON - * @memberof tendermint.types.TxProof - * @instance - * @returns {Object.} JSON object - */ - TxProof.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return TxProof; - })(); - - types.ValidatorSet = (function() { - - /** - * Properties of a ValidatorSet. - * @memberof tendermint.types - * @interface IValidatorSet - * @property {Array.|null} [validators] ValidatorSet validators - * @property {tendermint.types.IValidator|null} [proposer] ValidatorSet proposer - * @property {Long|null} [total_voting_power] ValidatorSet total_voting_power - */ - - /** - * Constructs a new ValidatorSet. - * @memberof tendermint.types - * @classdesc Represents a ValidatorSet. - * @implements IValidatorSet - * @constructor - * @param {tendermint.types.IValidatorSet=} [properties] Properties to set - */ - function ValidatorSet(properties) { - this.validators = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ValidatorSet validators. - * @member {Array.} validators - * @memberof tendermint.types.ValidatorSet - * @instance - */ - ValidatorSet.prototype.validators = $util.emptyArray; - - /** - * ValidatorSet proposer. - * @member {tendermint.types.IValidator|null|undefined} proposer - * @memberof tendermint.types.ValidatorSet - * @instance - */ - ValidatorSet.prototype.proposer = null; - - /** - * ValidatorSet total_voting_power. - * @member {Long} total_voting_power - * @memberof tendermint.types.ValidatorSet - * @instance - */ - ValidatorSet.prototype.total_voting_power = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Encodes the specified ValidatorSet message. Does not implicitly {@link tendermint.types.ValidatorSet.verify|verify} messages. - * @function encode - * @memberof tendermint.types.ValidatorSet - * @static - * @param {tendermint.types.IValidatorSet} message ValidatorSet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorSet.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.validators != null && message.validators.length) - for (let i = 0; i < message.validators.length; ++i) - $root.tendermint.types.Validator.encode(message.validators[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.proposer != null && Object.hasOwnProperty.call(message, "proposer")) - $root.tendermint.types.Validator.encode(message.proposer, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.total_voting_power != null && Object.hasOwnProperty.call(message, "total_voting_power")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.total_voting_power); - return writer; - }; - - /** - * Encodes the specified ValidatorSet message, length delimited. Does not implicitly {@link tendermint.types.ValidatorSet.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.types.ValidatorSet - * @static - * @param {tendermint.types.IValidatorSet} message ValidatorSet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorSet.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ValidatorSet message from the specified reader or buffer. - * @function decode - * @memberof tendermint.types.ValidatorSet - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.types.ValidatorSet} ValidatorSet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorSet.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.ValidatorSet(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.validators && message.validators.length)) - message.validators = []; - message.validators.push($root.tendermint.types.Validator.decode(reader, reader.uint32())); - break; - case 2: - message.proposer = $root.tendermint.types.Validator.decode(reader, reader.uint32()); - break; - case 3: - message.total_voting_power = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ValidatorSet message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.types.ValidatorSet - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.types.ValidatorSet} ValidatorSet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorSet.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ValidatorSet message. - * @function verify - * @memberof tendermint.types.ValidatorSet - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ValidatorSet.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.validators != null && message.hasOwnProperty("validators")) { - if (!Array.isArray(message.validators)) - return "validators: array expected"; - for (let i = 0; i < message.validators.length; ++i) { - let error = $root.tendermint.types.Validator.verify(message.validators[i]); - if (error) - return "validators." + error; - } - } - if (message.proposer != null && message.hasOwnProperty("proposer")) { - let error = $root.tendermint.types.Validator.verify(message.proposer); - if (error) - return "proposer." + error; - } - if (message.total_voting_power != null && message.hasOwnProperty("total_voting_power")) - if (!$util.isInteger(message.total_voting_power) && !(message.total_voting_power && $util.isInteger(message.total_voting_power.low) && $util.isInteger(message.total_voting_power.high))) - return "total_voting_power: integer|Long expected"; - return null; - }; - - /** - * Creates a ValidatorSet message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.types.ValidatorSet - * @static - * @param {Object.} object Plain object - * @returns {tendermint.types.ValidatorSet} ValidatorSet - */ - ValidatorSet.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.types.ValidatorSet) - return object; - let message = new $root.tendermint.types.ValidatorSet(); - if (object.validators) { - if (!Array.isArray(object.validators)) - throw TypeError(".tendermint.types.ValidatorSet.validators: array expected"); - message.validators = []; - for (let i = 0; i < object.validators.length; ++i) { - if (typeof object.validators[i] !== "object") - throw TypeError(".tendermint.types.ValidatorSet.validators: object expected"); - message.validators[i] = $root.tendermint.types.Validator.fromObject(object.validators[i]); - } - } - if (object.proposer != null) { - if (typeof object.proposer !== "object") - throw TypeError(".tendermint.types.ValidatorSet.proposer: object expected"); - message.proposer = $root.tendermint.types.Validator.fromObject(object.proposer); - } - if (object.total_voting_power != null) - if ($util.Long) - (message.total_voting_power = $util.Long.fromValue(object.total_voting_power)).unsigned = false; - else if (typeof object.total_voting_power === "string") - message.total_voting_power = parseInt(object.total_voting_power, 10); - else if (typeof object.total_voting_power === "number") - message.total_voting_power = object.total_voting_power; - else if (typeof object.total_voting_power === "object") - message.total_voting_power = new $util.LongBits(object.total_voting_power.low >>> 0, object.total_voting_power.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a ValidatorSet message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.types.ValidatorSet - * @static - * @param {tendermint.types.ValidatorSet} message ValidatorSet - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ValidatorSet.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.validators = []; - if (options.defaults) { - object.proposer = null; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.total_voting_power = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.total_voting_power = options.longs === String ? "0" : 0; - } - if (message.validators && message.validators.length) { - object.validators = []; - for (let j = 0; j < message.validators.length; ++j) - object.validators[j] = $root.tendermint.types.Validator.toObject(message.validators[j], options); - } - if (message.proposer != null && message.hasOwnProperty("proposer")) - object.proposer = $root.tendermint.types.Validator.toObject(message.proposer, options); - if (message.total_voting_power != null && message.hasOwnProperty("total_voting_power")) - if (typeof message.total_voting_power === "number") - object.total_voting_power = options.longs === String ? String(message.total_voting_power) : message.total_voting_power; - else - object.total_voting_power = options.longs === String ? $util.Long.prototype.toString.call(message.total_voting_power) : options.longs === Number ? new $util.LongBits(message.total_voting_power.low >>> 0, message.total_voting_power.high >>> 0).toNumber() : message.total_voting_power; - return object; - }; - - /** - * Converts this ValidatorSet to JSON. - * @function toJSON - * @memberof tendermint.types.ValidatorSet - * @instance - * @returns {Object.} JSON object - */ - ValidatorSet.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ValidatorSet; - })(); - - types.Validator = (function() { - - /** - * Properties of a Validator. - * @memberof tendermint.types - * @interface IValidator - * @property {Uint8Array|null} [address] Validator address - * @property {tendermint.crypto.IPublicKey|null} [pub_key] Validator pub_key - * @property {Long|null} [voting_power] Validator voting_power - * @property {Long|null} [proposer_priority] Validator proposer_priority - */ - - /** - * Constructs a new Validator. - * @memberof tendermint.types - * @classdesc Represents a Validator. - * @implements IValidator - * @constructor - * @param {tendermint.types.IValidator=} [properties] Properties to set - */ - function Validator(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Validator address. - * @member {Uint8Array} address - * @memberof tendermint.types.Validator - * @instance - */ - Validator.prototype.address = $util.newBuffer([]); - - /** - * Validator pub_key. - * @member {tendermint.crypto.IPublicKey|null|undefined} pub_key - * @memberof tendermint.types.Validator - * @instance - */ - Validator.prototype.pub_key = null; - - /** - * Validator voting_power. - * @member {Long} voting_power - * @memberof tendermint.types.Validator - * @instance - */ - Validator.prototype.voting_power = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Validator proposer_priority. - * @member {Long} proposer_priority - * @memberof tendermint.types.Validator - * @instance - */ - Validator.prototype.proposer_priority = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Encodes the specified Validator message. Does not implicitly {@link tendermint.types.Validator.verify|verify} messages. - * @function encode - * @memberof tendermint.types.Validator - * @static - * @param {tendermint.types.IValidator} message Validator message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Validator.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.address != null && Object.hasOwnProperty.call(message, "address")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.address); - if (message.pub_key != null && Object.hasOwnProperty.call(message, "pub_key")) - $root.tendermint.crypto.PublicKey.encode(message.pub_key, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.voting_power != null && Object.hasOwnProperty.call(message, "voting_power")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.voting_power); - if (message.proposer_priority != null && Object.hasOwnProperty.call(message, "proposer_priority")) - writer.uint32(/* id 4, wireType 0 =*/32).int64(message.proposer_priority); - return writer; - }; - - /** - * Encodes the specified Validator message, length delimited. Does not implicitly {@link tendermint.types.Validator.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.types.Validator - * @static - * @param {tendermint.types.IValidator} message Validator message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Validator.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Validator message from the specified reader or buffer. - * @function decode - * @memberof tendermint.types.Validator - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.types.Validator} Validator - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Validator.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.Validator(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.address = reader.bytes(); - break; - case 2: - message.pub_key = $root.tendermint.crypto.PublicKey.decode(reader, reader.uint32()); - break; - case 3: - message.voting_power = reader.int64(); - break; - case 4: - message.proposer_priority = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Validator message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.types.Validator - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.types.Validator} Validator - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Validator.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Validator message. - * @function verify - * @memberof tendermint.types.Validator - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Validator.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.address != null && message.hasOwnProperty("address")) - if (!(message.address && typeof message.address.length === "number" || $util.isString(message.address))) - return "address: buffer expected"; - if (message.pub_key != null && message.hasOwnProperty("pub_key")) { - let error = $root.tendermint.crypto.PublicKey.verify(message.pub_key); - if (error) - return "pub_key." + error; - } - if (message.voting_power != null && message.hasOwnProperty("voting_power")) - if (!$util.isInteger(message.voting_power) && !(message.voting_power && $util.isInteger(message.voting_power.low) && $util.isInteger(message.voting_power.high))) - return "voting_power: integer|Long expected"; - if (message.proposer_priority != null && message.hasOwnProperty("proposer_priority")) - if (!$util.isInteger(message.proposer_priority) && !(message.proposer_priority && $util.isInteger(message.proposer_priority.low) && $util.isInteger(message.proposer_priority.high))) - return "proposer_priority: integer|Long expected"; - return null; - }; - - /** - * Creates a Validator message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.types.Validator - * @static - * @param {Object.} object Plain object - * @returns {tendermint.types.Validator} Validator - */ - Validator.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.types.Validator) - return object; - let message = new $root.tendermint.types.Validator(); - if (object.address != null) - if (typeof object.address === "string") - $util.base64.decode(object.address, message.address = $util.newBuffer($util.base64.length(object.address)), 0); - else if (object.address.length) - message.address = object.address; - if (object.pub_key != null) { - if (typeof object.pub_key !== "object") - throw TypeError(".tendermint.types.Validator.pub_key: object expected"); - message.pub_key = $root.tendermint.crypto.PublicKey.fromObject(object.pub_key); - } - if (object.voting_power != null) - if ($util.Long) - (message.voting_power = $util.Long.fromValue(object.voting_power)).unsigned = false; - else if (typeof object.voting_power === "string") - message.voting_power = parseInt(object.voting_power, 10); - else if (typeof object.voting_power === "number") - message.voting_power = object.voting_power; - else if (typeof object.voting_power === "object") - message.voting_power = new $util.LongBits(object.voting_power.low >>> 0, object.voting_power.high >>> 0).toNumber(); - if (object.proposer_priority != null) - if ($util.Long) - (message.proposer_priority = $util.Long.fromValue(object.proposer_priority)).unsigned = false; - else if (typeof object.proposer_priority === "string") - message.proposer_priority = parseInt(object.proposer_priority, 10); - else if (typeof object.proposer_priority === "number") - message.proposer_priority = object.proposer_priority; - else if (typeof object.proposer_priority === "object") - message.proposer_priority = new $util.LongBits(object.proposer_priority.low >>> 0, object.proposer_priority.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a Validator message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.types.Validator - * @static - * @param {tendermint.types.Validator} message Validator - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Validator.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if (options.bytes === String) - object.address = ""; - else { - object.address = []; - if (options.bytes !== Array) - object.address = $util.newBuffer(object.address); - } - object.pub_key = null; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.voting_power = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.voting_power = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.proposer_priority = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.proposer_priority = options.longs === String ? "0" : 0; - } - if (message.address != null && message.hasOwnProperty("address")) - object.address = options.bytes === String ? $util.base64.encode(message.address, 0, message.address.length) : options.bytes === Array ? Array.prototype.slice.call(message.address) : message.address; - if (message.pub_key != null && message.hasOwnProperty("pub_key")) - object.pub_key = $root.tendermint.crypto.PublicKey.toObject(message.pub_key, options); - if (message.voting_power != null && message.hasOwnProperty("voting_power")) - if (typeof message.voting_power === "number") - object.voting_power = options.longs === String ? String(message.voting_power) : message.voting_power; - else - object.voting_power = options.longs === String ? $util.Long.prototype.toString.call(message.voting_power) : options.longs === Number ? new $util.LongBits(message.voting_power.low >>> 0, message.voting_power.high >>> 0).toNumber() : message.voting_power; - if (message.proposer_priority != null && message.hasOwnProperty("proposer_priority")) - if (typeof message.proposer_priority === "number") - object.proposer_priority = options.longs === String ? String(message.proposer_priority) : message.proposer_priority; - else - object.proposer_priority = options.longs === String ? $util.Long.prototype.toString.call(message.proposer_priority) : options.longs === Number ? new $util.LongBits(message.proposer_priority.low >>> 0, message.proposer_priority.high >>> 0).toNumber() : message.proposer_priority; - return object; - }; - - /** - * Converts this Validator to JSON. - * @function toJSON - * @memberof tendermint.types.Validator - * @instance - * @returns {Object.} JSON object - */ - Validator.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Validator; - })(); - - types.SimpleValidator = (function() { - - /** - * Properties of a SimpleValidator. - * @memberof tendermint.types - * @interface ISimpleValidator - * @property {tendermint.crypto.IPublicKey|null} [pub_key] SimpleValidator pub_key - * @property {Long|null} [voting_power] SimpleValidator voting_power - */ - - /** - * Constructs a new SimpleValidator. - * @memberof tendermint.types - * @classdesc Represents a SimpleValidator. - * @implements ISimpleValidator - * @constructor - * @param {tendermint.types.ISimpleValidator=} [properties] Properties to set - */ - function SimpleValidator(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SimpleValidator pub_key. - * @member {tendermint.crypto.IPublicKey|null|undefined} pub_key - * @memberof tendermint.types.SimpleValidator - * @instance - */ - SimpleValidator.prototype.pub_key = null; - - /** - * SimpleValidator voting_power. - * @member {Long} voting_power - * @memberof tendermint.types.SimpleValidator - * @instance - */ - SimpleValidator.prototype.voting_power = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Encodes the specified SimpleValidator message. Does not implicitly {@link tendermint.types.SimpleValidator.verify|verify} messages. - * @function encode - * @memberof tendermint.types.SimpleValidator - * @static - * @param {tendermint.types.ISimpleValidator} message SimpleValidator message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SimpleValidator.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.pub_key != null && Object.hasOwnProperty.call(message, "pub_key")) - $root.tendermint.crypto.PublicKey.encode(message.pub_key, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.voting_power != null && Object.hasOwnProperty.call(message, "voting_power")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.voting_power); - return writer; - }; - - /** - * Encodes the specified SimpleValidator message, length delimited. Does not implicitly {@link tendermint.types.SimpleValidator.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.types.SimpleValidator - * @static - * @param {tendermint.types.ISimpleValidator} message SimpleValidator message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SimpleValidator.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SimpleValidator message from the specified reader or buffer. - * @function decode - * @memberof tendermint.types.SimpleValidator - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.types.SimpleValidator} SimpleValidator - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SimpleValidator.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.SimpleValidator(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.pub_key = $root.tendermint.crypto.PublicKey.decode(reader, reader.uint32()); - break; - case 2: - message.voting_power = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SimpleValidator message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.types.SimpleValidator - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.types.SimpleValidator} SimpleValidator - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SimpleValidator.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SimpleValidator message. - * @function verify - * @memberof tendermint.types.SimpleValidator - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SimpleValidator.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.pub_key != null && message.hasOwnProperty("pub_key")) { - let error = $root.tendermint.crypto.PublicKey.verify(message.pub_key); - if (error) - return "pub_key." + error; - } - if (message.voting_power != null && message.hasOwnProperty("voting_power")) - if (!$util.isInteger(message.voting_power) && !(message.voting_power && $util.isInteger(message.voting_power.low) && $util.isInteger(message.voting_power.high))) - return "voting_power: integer|Long expected"; - return null; - }; - - /** - * Creates a SimpleValidator message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.types.SimpleValidator - * @static - * @param {Object.} object Plain object - * @returns {tendermint.types.SimpleValidator} SimpleValidator - */ - SimpleValidator.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.types.SimpleValidator) - return object; - let message = new $root.tendermint.types.SimpleValidator(); - if (object.pub_key != null) { - if (typeof object.pub_key !== "object") - throw TypeError(".tendermint.types.SimpleValidator.pub_key: object expected"); - message.pub_key = $root.tendermint.crypto.PublicKey.fromObject(object.pub_key); - } - if (object.voting_power != null) - if ($util.Long) - (message.voting_power = $util.Long.fromValue(object.voting_power)).unsigned = false; - else if (typeof object.voting_power === "string") - message.voting_power = parseInt(object.voting_power, 10); - else if (typeof object.voting_power === "number") - message.voting_power = object.voting_power; - else if (typeof object.voting_power === "object") - message.voting_power = new $util.LongBits(object.voting_power.low >>> 0, object.voting_power.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a SimpleValidator message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.types.SimpleValidator - * @static - * @param {tendermint.types.SimpleValidator} message SimpleValidator - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SimpleValidator.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.pub_key = null; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.voting_power = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.voting_power = options.longs === String ? "0" : 0; - } - if (message.pub_key != null && message.hasOwnProperty("pub_key")) - object.pub_key = $root.tendermint.crypto.PublicKey.toObject(message.pub_key, options); - if (message.voting_power != null && message.hasOwnProperty("voting_power")) - if (typeof message.voting_power === "number") - object.voting_power = options.longs === String ? String(message.voting_power) : message.voting_power; - else - object.voting_power = options.longs === String ? $util.Long.prototype.toString.call(message.voting_power) : options.longs === Number ? new $util.LongBits(message.voting_power.low >>> 0, message.voting_power.high >>> 0).toNumber() : message.voting_power; - return object; - }; - - /** - * Converts this SimpleValidator to JSON. - * @function toJSON - * @memberof tendermint.types.SimpleValidator - * @instance - * @returns {Object.} JSON object - */ - SimpleValidator.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return SimpleValidator; - })(); - - types.Block = (function() { - - /** - * Properties of a Block. - * @memberof tendermint.types - * @interface IBlock - * @property {tendermint.types.IHeader|null} [header] Block header - * @property {tendermint.types.IData|null} [data] Block data - * @property {tendermint.types.IEvidenceList|null} [evidence] Block evidence - * @property {tendermint.types.ICommit|null} [last_commit] Block last_commit - */ - - /** - * Constructs a new Block. - * @memberof tendermint.types - * @classdesc Represents a Block. - * @implements IBlock - * @constructor - * @param {tendermint.types.IBlock=} [properties] Properties to set - */ - function Block(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Block header. - * @member {tendermint.types.IHeader|null|undefined} header - * @memberof tendermint.types.Block - * @instance - */ - Block.prototype.header = null; - - /** - * Block data. - * @member {tendermint.types.IData|null|undefined} data - * @memberof tendermint.types.Block - * @instance - */ - Block.prototype.data = null; - - /** - * Block evidence. - * @member {tendermint.types.IEvidenceList|null|undefined} evidence - * @memberof tendermint.types.Block - * @instance - */ - Block.prototype.evidence = null; - - /** - * Block last_commit. - * @member {tendermint.types.ICommit|null|undefined} last_commit - * @memberof tendermint.types.Block - * @instance - */ - Block.prototype.last_commit = null; - - /** - * Encodes the specified Block message. Does not implicitly {@link tendermint.types.Block.verify|verify} messages. - * @function encode - * @memberof tendermint.types.Block - * @static - * @param {tendermint.types.IBlock} message Block message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Block.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.header != null && Object.hasOwnProperty.call(message, "header")) - $root.tendermint.types.Header.encode(message.header, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.data != null && Object.hasOwnProperty.call(message, "data")) - $root.tendermint.types.Data.encode(message.data, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.evidence != null && Object.hasOwnProperty.call(message, "evidence")) - $root.tendermint.types.EvidenceList.encode(message.evidence, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.last_commit != null && Object.hasOwnProperty.call(message, "last_commit")) - $root.tendermint.types.Commit.encode(message.last_commit, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Block message, length delimited. Does not implicitly {@link tendermint.types.Block.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.types.Block - * @static - * @param {tendermint.types.IBlock} message Block message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Block.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Block message from the specified reader or buffer. - * @function decode - * @memberof tendermint.types.Block - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.types.Block} Block - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Block.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.Block(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.header = $root.tendermint.types.Header.decode(reader, reader.uint32()); - break; - case 2: - message.data = $root.tendermint.types.Data.decode(reader, reader.uint32()); - break; - case 3: - message.evidence = $root.tendermint.types.EvidenceList.decode(reader, reader.uint32()); - break; - case 4: - message.last_commit = $root.tendermint.types.Commit.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Block message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.types.Block - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.types.Block} Block - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Block.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Block message. - * @function verify - * @memberof tendermint.types.Block - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Block.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.header != null && message.hasOwnProperty("header")) { - let error = $root.tendermint.types.Header.verify(message.header); - if (error) - return "header." + error; - } - if (message.data != null && message.hasOwnProperty("data")) { - let error = $root.tendermint.types.Data.verify(message.data); - if (error) - return "data." + error; - } - if (message.evidence != null && message.hasOwnProperty("evidence")) { - let error = $root.tendermint.types.EvidenceList.verify(message.evidence); - if (error) - return "evidence." + error; - } - if (message.last_commit != null && message.hasOwnProperty("last_commit")) { - let error = $root.tendermint.types.Commit.verify(message.last_commit); - if (error) - return "last_commit." + error; - } - return null; - }; - - /** - * Creates a Block message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.types.Block - * @static - * @param {Object.} object Plain object - * @returns {tendermint.types.Block} Block - */ - Block.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.types.Block) - return object; - let message = new $root.tendermint.types.Block(); - if (object.header != null) { - if (typeof object.header !== "object") - throw TypeError(".tendermint.types.Block.header: object expected"); - message.header = $root.tendermint.types.Header.fromObject(object.header); - } - if (object.data != null) { - if (typeof object.data !== "object") - throw TypeError(".tendermint.types.Block.data: object expected"); - message.data = $root.tendermint.types.Data.fromObject(object.data); - } - if (object.evidence != null) { - if (typeof object.evidence !== "object") - throw TypeError(".tendermint.types.Block.evidence: object expected"); - message.evidence = $root.tendermint.types.EvidenceList.fromObject(object.evidence); - } - if (object.last_commit != null) { - if (typeof object.last_commit !== "object") - throw TypeError(".tendermint.types.Block.last_commit: object expected"); - message.last_commit = $root.tendermint.types.Commit.fromObject(object.last_commit); - } - return message; - }; - - /** - * Creates a plain object from a Block message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.types.Block - * @static - * @param {tendermint.types.Block} message Block - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Block.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.header = null; - object.data = null; - object.evidence = null; - object.last_commit = null; - } - if (message.header != null && message.hasOwnProperty("header")) - object.header = $root.tendermint.types.Header.toObject(message.header, options); - if (message.data != null && message.hasOwnProperty("data")) - object.data = $root.tendermint.types.Data.toObject(message.data, options); - if (message.evidence != null && message.hasOwnProperty("evidence")) - object.evidence = $root.tendermint.types.EvidenceList.toObject(message.evidence, options); - if (message.last_commit != null && message.hasOwnProperty("last_commit")) - object.last_commit = $root.tendermint.types.Commit.toObject(message.last_commit, options); - return object; - }; - - /** - * Converts this Block to JSON. - * @function toJSON - * @memberof tendermint.types.Block - * @instance - * @returns {Object.} JSON object - */ - Block.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Block; - })(); - - types.ConsensusParams = (function() { - - /** - * Properties of a ConsensusParams. - * @memberof tendermint.types - * @interface IConsensusParams - * @property {tendermint.types.IBlockParams|null} [block] ConsensusParams block - * @property {tendermint.types.IEvidenceParams|null} [evidence] ConsensusParams evidence - * @property {tendermint.types.IValidatorParams|null} [validator] ConsensusParams validator - * @property {tendermint.types.IVersionParams|null} [version] ConsensusParams version - */ - - /** - * Constructs a new ConsensusParams. - * @memberof tendermint.types - * @classdesc Represents a ConsensusParams. - * @implements IConsensusParams - * @constructor - * @param {tendermint.types.IConsensusParams=} [properties] Properties to set - */ - function ConsensusParams(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ConsensusParams block. - * @member {tendermint.types.IBlockParams|null|undefined} block - * @memberof tendermint.types.ConsensusParams - * @instance - */ - ConsensusParams.prototype.block = null; - - /** - * ConsensusParams evidence. - * @member {tendermint.types.IEvidenceParams|null|undefined} evidence - * @memberof tendermint.types.ConsensusParams - * @instance - */ - ConsensusParams.prototype.evidence = null; - - /** - * ConsensusParams validator. - * @member {tendermint.types.IValidatorParams|null|undefined} validator - * @memberof tendermint.types.ConsensusParams - * @instance - */ - ConsensusParams.prototype.validator = null; - - /** - * ConsensusParams version. - * @member {tendermint.types.IVersionParams|null|undefined} version - * @memberof tendermint.types.ConsensusParams - * @instance - */ - ConsensusParams.prototype.version = null; - - /** - * Encodes the specified ConsensusParams message. Does not implicitly {@link tendermint.types.ConsensusParams.verify|verify} messages. - * @function encode - * @memberof tendermint.types.ConsensusParams - * @static - * @param {tendermint.types.IConsensusParams} message ConsensusParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConsensusParams.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.block != null && Object.hasOwnProperty.call(message, "block")) - $root.tendermint.types.BlockParams.encode(message.block, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.evidence != null && Object.hasOwnProperty.call(message, "evidence")) - $root.tendermint.types.EvidenceParams.encode(message.evidence, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.validator != null && Object.hasOwnProperty.call(message, "validator")) - $root.tendermint.types.ValidatorParams.encode(message.validator, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.version != null && Object.hasOwnProperty.call(message, "version")) - $root.tendermint.types.VersionParams.encode(message.version, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ConsensusParams message, length delimited. Does not implicitly {@link tendermint.types.ConsensusParams.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.types.ConsensusParams - * @static - * @param {tendermint.types.IConsensusParams} message ConsensusParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConsensusParams.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ConsensusParams message from the specified reader or buffer. - * @function decode - * @memberof tendermint.types.ConsensusParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.types.ConsensusParams} ConsensusParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConsensusParams.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.ConsensusParams(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.block = $root.tendermint.types.BlockParams.decode(reader, reader.uint32()); - break; - case 2: - message.evidence = $root.tendermint.types.EvidenceParams.decode(reader, reader.uint32()); - break; - case 3: - message.validator = $root.tendermint.types.ValidatorParams.decode(reader, reader.uint32()); - break; - case 4: - message.version = $root.tendermint.types.VersionParams.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ConsensusParams message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.types.ConsensusParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.types.ConsensusParams} ConsensusParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConsensusParams.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ConsensusParams message. - * @function verify - * @memberof tendermint.types.ConsensusParams - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ConsensusParams.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.block != null && message.hasOwnProperty("block")) { - let error = $root.tendermint.types.BlockParams.verify(message.block); - if (error) - return "block." + error; - } - if (message.evidence != null && message.hasOwnProperty("evidence")) { - let error = $root.tendermint.types.EvidenceParams.verify(message.evidence); - if (error) - return "evidence." + error; - } - if (message.validator != null && message.hasOwnProperty("validator")) { - let error = $root.tendermint.types.ValidatorParams.verify(message.validator); - if (error) - return "validator." + error; - } - if (message.version != null && message.hasOwnProperty("version")) { - let error = $root.tendermint.types.VersionParams.verify(message.version); - if (error) - return "version." + error; - } - return null; - }; - - /** - * Creates a ConsensusParams message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.types.ConsensusParams - * @static - * @param {Object.} object Plain object - * @returns {tendermint.types.ConsensusParams} ConsensusParams - */ - ConsensusParams.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.types.ConsensusParams) - return object; - let message = new $root.tendermint.types.ConsensusParams(); - if (object.block != null) { - if (typeof object.block !== "object") - throw TypeError(".tendermint.types.ConsensusParams.block: object expected"); - message.block = $root.tendermint.types.BlockParams.fromObject(object.block); - } - if (object.evidence != null) { - if (typeof object.evidence !== "object") - throw TypeError(".tendermint.types.ConsensusParams.evidence: object expected"); - message.evidence = $root.tendermint.types.EvidenceParams.fromObject(object.evidence); - } - if (object.validator != null) { - if (typeof object.validator !== "object") - throw TypeError(".tendermint.types.ConsensusParams.validator: object expected"); - message.validator = $root.tendermint.types.ValidatorParams.fromObject(object.validator); - } - if (object.version != null) { - if (typeof object.version !== "object") - throw TypeError(".tendermint.types.ConsensusParams.version: object expected"); - message.version = $root.tendermint.types.VersionParams.fromObject(object.version); - } - return message; - }; - - /** - * Creates a plain object from a ConsensusParams message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.types.ConsensusParams - * @static - * @param {tendermint.types.ConsensusParams} message ConsensusParams - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ConsensusParams.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - object.block = null; - object.evidence = null; - object.validator = null; - object.version = null; - } - if (message.block != null && message.hasOwnProperty("block")) - object.block = $root.tendermint.types.BlockParams.toObject(message.block, options); - if (message.evidence != null && message.hasOwnProperty("evidence")) - object.evidence = $root.tendermint.types.EvidenceParams.toObject(message.evidence, options); - if (message.validator != null && message.hasOwnProperty("validator")) - object.validator = $root.tendermint.types.ValidatorParams.toObject(message.validator, options); - if (message.version != null && message.hasOwnProperty("version")) - object.version = $root.tendermint.types.VersionParams.toObject(message.version, options); - return object; - }; - - /** - * Converts this ConsensusParams to JSON. - * @function toJSON - * @memberof tendermint.types.ConsensusParams - * @instance - * @returns {Object.} JSON object - */ - ConsensusParams.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ConsensusParams; - })(); - - types.BlockParams = (function() { - - /** - * Properties of a BlockParams. - * @memberof tendermint.types - * @interface IBlockParams - * @property {Long|null} [max_bytes] BlockParams max_bytes - * @property {Long|null} [max_gas] BlockParams max_gas - * @property {Long|null} [time_iota_ms] BlockParams time_iota_ms - */ - - /** - * Constructs a new BlockParams. - * @memberof tendermint.types - * @classdesc Represents a BlockParams. - * @implements IBlockParams - * @constructor - * @param {tendermint.types.IBlockParams=} [properties] Properties to set - */ - function BlockParams(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * BlockParams max_bytes. - * @member {Long} max_bytes - * @memberof tendermint.types.BlockParams - * @instance - */ - BlockParams.prototype.max_bytes = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * BlockParams max_gas. - * @member {Long} max_gas - * @memberof tendermint.types.BlockParams - * @instance - */ - BlockParams.prototype.max_gas = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * BlockParams time_iota_ms. - * @member {Long} time_iota_ms - * @memberof tendermint.types.BlockParams - * @instance - */ - BlockParams.prototype.time_iota_ms = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Encodes the specified BlockParams message. Does not implicitly {@link tendermint.types.BlockParams.verify|verify} messages. - * @function encode - * @memberof tendermint.types.BlockParams - * @static - * @param {tendermint.types.IBlockParams} message BlockParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BlockParams.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.max_bytes != null && Object.hasOwnProperty.call(message, "max_bytes")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.max_bytes); - if (message.max_gas != null && Object.hasOwnProperty.call(message, "max_gas")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.max_gas); - if (message.time_iota_ms != null && Object.hasOwnProperty.call(message, "time_iota_ms")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.time_iota_ms); - return writer; - }; - - /** - * Encodes the specified BlockParams message, length delimited. Does not implicitly {@link tendermint.types.BlockParams.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.types.BlockParams - * @static - * @param {tendermint.types.IBlockParams} message BlockParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BlockParams.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BlockParams message from the specified reader or buffer. - * @function decode - * @memberof tendermint.types.BlockParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.types.BlockParams} BlockParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BlockParams.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.BlockParams(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.max_bytes = reader.int64(); - break; - case 2: - message.max_gas = reader.int64(); - break; - case 3: - message.time_iota_ms = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BlockParams message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.types.BlockParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.types.BlockParams} BlockParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BlockParams.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BlockParams message. - * @function verify - * @memberof tendermint.types.BlockParams - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BlockParams.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.max_bytes != null && message.hasOwnProperty("max_bytes")) - if (!$util.isInteger(message.max_bytes) && !(message.max_bytes && $util.isInteger(message.max_bytes.low) && $util.isInteger(message.max_bytes.high))) - return "max_bytes: integer|Long expected"; - if (message.max_gas != null && message.hasOwnProperty("max_gas")) - if (!$util.isInteger(message.max_gas) && !(message.max_gas && $util.isInteger(message.max_gas.low) && $util.isInteger(message.max_gas.high))) - return "max_gas: integer|Long expected"; - if (message.time_iota_ms != null && message.hasOwnProperty("time_iota_ms")) - if (!$util.isInteger(message.time_iota_ms) && !(message.time_iota_ms && $util.isInteger(message.time_iota_ms.low) && $util.isInteger(message.time_iota_ms.high))) - return "time_iota_ms: integer|Long expected"; - return null; - }; - - /** - * Creates a BlockParams message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.types.BlockParams - * @static - * @param {Object.} object Plain object - * @returns {tendermint.types.BlockParams} BlockParams - */ - BlockParams.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.types.BlockParams) - return object; - let message = new $root.tendermint.types.BlockParams(); - if (object.max_bytes != null) - if ($util.Long) - (message.max_bytes = $util.Long.fromValue(object.max_bytes)).unsigned = false; - else if (typeof object.max_bytes === "string") - message.max_bytes = parseInt(object.max_bytes, 10); - else if (typeof object.max_bytes === "number") - message.max_bytes = object.max_bytes; - else if (typeof object.max_bytes === "object") - message.max_bytes = new $util.LongBits(object.max_bytes.low >>> 0, object.max_bytes.high >>> 0).toNumber(); - if (object.max_gas != null) - if ($util.Long) - (message.max_gas = $util.Long.fromValue(object.max_gas)).unsigned = false; - else if (typeof object.max_gas === "string") - message.max_gas = parseInt(object.max_gas, 10); - else if (typeof object.max_gas === "number") - message.max_gas = object.max_gas; - else if (typeof object.max_gas === "object") - message.max_gas = new $util.LongBits(object.max_gas.low >>> 0, object.max_gas.high >>> 0).toNumber(); - if (object.time_iota_ms != null) - if ($util.Long) - (message.time_iota_ms = $util.Long.fromValue(object.time_iota_ms)).unsigned = false; - else if (typeof object.time_iota_ms === "string") - message.time_iota_ms = parseInt(object.time_iota_ms, 10); - else if (typeof object.time_iota_ms === "number") - message.time_iota_ms = object.time_iota_ms; - else if (typeof object.time_iota_ms === "object") - message.time_iota_ms = new $util.LongBits(object.time_iota_ms.low >>> 0, object.time_iota_ms.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a BlockParams message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.types.BlockParams - * @static - * @param {tendermint.types.BlockParams} message BlockParams - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BlockParams.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.max_bytes = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.max_bytes = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.max_gas = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.max_gas = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.time_iota_ms = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.time_iota_ms = options.longs === String ? "0" : 0; - } - if (message.max_bytes != null && message.hasOwnProperty("max_bytes")) - if (typeof message.max_bytes === "number") - object.max_bytes = options.longs === String ? String(message.max_bytes) : message.max_bytes; - else - object.max_bytes = options.longs === String ? $util.Long.prototype.toString.call(message.max_bytes) : options.longs === Number ? new $util.LongBits(message.max_bytes.low >>> 0, message.max_bytes.high >>> 0).toNumber() : message.max_bytes; - if (message.max_gas != null && message.hasOwnProperty("max_gas")) - if (typeof message.max_gas === "number") - object.max_gas = options.longs === String ? String(message.max_gas) : message.max_gas; - else - object.max_gas = options.longs === String ? $util.Long.prototype.toString.call(message.max_gas) : options.longs === Number ? new $util.LongBits(message.max_gas.low >>> 0, message.max_gas.high >>> 0).toNumber() : message.max_gas; - if (message.time_iota_ms != null && message.hasOwnProperty("time_iota_ms")) - if (typeof message.time_iota_ms === "number") - object.time_iota_ms = options.longs === String ? String(message.time_iota_ms) : message.time_iota_ms; - else - object.time_iota_ms = options.longs === String ? $util.Long.prototype.toString.call(message.time_iota_ms) : options.longs === Number ? new $util.LongBits(message.time_iota_ms.low >>> 0, message.time_iota_ms.high >>> 0).toNumber() : message.time_iota_ms; - return object; - }; - - /** - * Converts this BlockParams to JSON. - * @function toJSON - * @memberof tendermint.types.BlockParams - * @instance - * @returns {Object.} JSON object - */ - BlockParams.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return BlockParams; - })(); - - types.EvidenceParams = (function() { - - /** - * Properties of an EvidenceParams. - * @memberof tendermint.types - * @interface IEvidenceParams - * @property {Long|null} [max_age_num_blocks] EvidenceParams max_age_num_blocks - * @property {google.protobuf.IDuration|null} [max_age_duration] EvidenceParams max_age_duration - * @property {Long|null} [max_bytes] EvidenceParams max_bytes - */ - - /** - * Constructs a new EvidenceParams. - * @memberof tendermint.types - * @classdesc Represents an EvidenceParams. - * @implements IEvidenceParams - * @constructor - * @param {tendermint.types.IEvidenceParams=} [properties] Properties to set - */ - function EvidenceParams(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * EvidenceParams max_age_num_blocks. - * @member {Long} max_age_num_blocks - * @memberof tendermint.types.EvidenceParams - * @instance - */ - EvidenceParams.prototype.max_age_num_blocks = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * EvidenceParams max_age_duration. - * @member {google.protobuf.IDuration|null|undefined} max_age_duration - * @memberof tendermint.types.EvidenceParams - * @instance - */ - EvidenceParams.prototype.max_age_duration = null; - - /** - * EvidenceParams max_bytes. - * @member {Long} max_bytes - * @memberof tendermint.types.EvidenceParams - * @instance - */ - EvidenceParams.prototype.max_bytes = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Encodes the specified EvidenceParams message. Does not implicitly {@link tendermint.types.EvidenceParams.verify|verify} messages. - * @function encode - * @memberof tendermint.types.EvidenceParams - * @static - * @param {tendermint.types.IEvidenceParams} message EvidenceParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EvidenceParams.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.max_age_num_blocks != null && Object.hasOwnProperty.call(message, "max_age_num_blocks")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.max_age_num_blocks); - if (message.max_age_duration != null && Object.hasOwnProperty.call(message, "max_age_duration")) - $root.google.protobuf.Duration.encode(message.max_age_duration, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.max_bytes != null && Object.hasOwnProperty.call(message, "max_bytes")) - writer.uint32(/* id 3, wireType 0 =*/24).int64(message.max_bytes); - return writer; - }; - - /** - * Encodes the specified EvidenceParams message, length delimited. Does not implicitly {@link tendermint.types.EvidenceParams.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.types.EvidenceParams - * @static - * @param {tendermint.types.IEvidenceParams} message EvidenceParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EvidenceParams.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an EvidenceParams message from the specified reader or buffer. - * @function decode - * @memberof tendermint.types.EvidenceParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.types.EvidenceParams} EvidenceParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EvidenceParams.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.EvidenceParams(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.max_age_num_blocks = reader.int64(); - break; - case 2: - message.max_age_duration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - case 3: - message.max_bytes = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an EvidenceParams message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.types.EvidenceParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.types.EvidenceParams} EvidenceParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EvidenceParams.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an EvidenceParams message. - * @function verify - * @memberof tendermint.types.EvidenceParams - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - EvidenceParams.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.max_age_num_blocks != null && message.hasOwnProperty("max_age_num_blocks")) - if (!$util.isInteger(message.max_age_num_blocks) && !(message.max_age_num_blocks && $util.isInteger(message.max_age_num_blocks.low) && $util.isInteger(message.max_age_num_blocks.high))) - return "max_age_num_blocks: integer|Long expected"; - if (message.max_age_duration != null && message.hasOwnProperty("max_age_duration")) { - let error = $root.google.protobuf.Duration.verify(message.max_age_duration); - if (error) - return "max_age_duration." + error; - } - if (message.max_bytes != null && message.hasOwnProperty("max_bytes")) - if (!$util.isInteger(message.max_bytes) && !(message.max_bytes && $util.isInteger(message.max_bytes.low) && $util.isInteger(message.max_bytes.high))) - return "max_bytes: integer|Long expected"; - return null; - }; - - /** - * Creates an EvidenceParams message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.types.EvidenceParams - * @static - * @param {Object.} object Plain object - * @returns {tendermint.types.EvidenceParams} EvidenceParams - */ - EvidenceParams.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.types.EvidenceParams) - return object; - let message = new $root.tendermint.types.EvidenceParams(); - if (object.max_age_num_blocks != null) - if ($util.Long) - (message.max_age_num_blocks = $util.Long.fromValue(object.max_age_num_blocks)).unsigned = false; - else if (typeof object.max_age_num_blocks === "string") - message.max_age_num_blocks = parseInt(object.max_age_num_blocks, 10); - else if (typeof object.max_age_num_blocks === "number") - message.max_age_num_blocks = object.max_age_num_blocks; - else if (typeof object.max_age_num_blocks === "object") - message.max_age_num_blocks = new $util.LongBits(object.max_age_num_blocks.low >>> 0, object.max_age_num_blocks.high >>> 0).toNumber(); - if (object.max_age_duration != null) { - if (typeof object.max_age_duration !== "object") - throw TypeError(".tendermint.types.EvidenceParams.max_age_duration: object expected"); - message.max_age_duration = $root.google.protobuf.Duration.fromObject(object.max_age_duration); - } - if (object.max_bytes != null) - if ($util.Long) - (message.max_bytes = $util.Long.fromValue(object.max_bytes)).unsigned = false; - else if (typeof object.max_bytes === "string") - message.max_bytes = parseInt(object.max_bytes, 10); - else if (typeof object.max_bytes === "number") - message.max_bytes = object.max_bytes; - else if (typeof object.max_bytes === "object") - message.max_bytes = new $util.LongBits(object.max_bytes.low >>> 0, object.max_bytes.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from an EvidenceParams message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.types.EvidenceParams - * @static - * @param {tendermint.types.EvidenceParams} message EvidenceParams - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - EvidenceParams.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.max_age_num_blocks = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.max_age_num_blocks = options.longs === String ? "0" : 0; - object.max_age_duration = null; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.max_bytes = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.max_bytes = options.longs === String ? "0" : 0; - } - if (message.max_age_num_blocks != null && message.hasOwnProperty("max_age_num_blocks")) - if (typeof message.max_age_num_blocks === "number") - object.max_age_num_blocks = options.longs === String ? String(message.max_age_num_blocks) : message.max_age_num_blocks; - else - object.max_age_num_blocks = options.longs === String ? $util.Long.prototype.toString.call(message.max_age_num_blocks) : options.longs === Number ? new $util.LongBits(message.max_age_num_blocks.low >>> 0, message.max_age_num_blocks.high >>> 0).toNumber() : message.max_age_num_blocks; - if (message.max_age_duration != null && message.hasOwnProperty("max_age_duration")) - object.max_age_duration = $root.google.protobuf.Duration.toObject(message.max_age_duration, options); - if (message.max_bytes != null && message.hasOwnProperty("max_bytes")) - if (typeof message.max_bytes === "number") - object.max_bytes = options.longs === String ? String(message.max_bytes) : message.max_bytes; - else - object.max_bytes = options.longs === String ? $util.Long.prototype.toString.call(message.max_bytes) : options.longs === Number ? new $util.LongBits(message.max_bytes.low >>> 0, message.max_bytes.high >>> 0).toNumber() : message.max_bytes; - return object; - }; - - /** - * Converts this EvidenceParams to JSON. - * @function toJSON - * @memberof tendermint.types.EvidenceParams - * @instance - * @returns {Object.} JSON object - */ - EvidenceParams.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return EvidenceParams; - })(); - - types.ValidatorParams = (function() { - - /** - * Properties of a ValidatorParams. - * @memberof tendermint.types - * @interface IValidatorParams - * @property {Array.|null} [pub_key_types] ValidatorParams pub_key_types - */ - - /** - * Constructs a new ValidatorParams. - * @memberof tendermint.types - * @classdesc Represents a ValidatorParams. - * @implements IValidatorParams - * @constructor - * @param {tendermint.types.IValidatorParams=} [properties] Properties to set - */ - function ValidatorParams(properties) { - this.pub_key_types = []; - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ValidatorParams pub_key_types. - * @member {Array.} pub_key_types - * @memberof tendermint.types.ValidatorParams - * @instance - */ - ValidatorParams.prototype.pub_key_types = $util.emptyArray; - - /** - * Encodes the specified ValidatorParams message. Does not implicitly {@link tendermint.types.ValidatorParams.verify|verify} messages. - * @function encode - * @memberof tendermint.types.ValidatorParams - * @static - * @param {tendermint.types.IValidatorParams} message ValidatorParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorParams.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.pub_key_types != null && message.pub_key_types.length) - for (let i = 0; i < message.pub_key_types.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.pub_key_types[i]); - return writer; - }; - - /** - * Encodes the specified ValidatorParams message, length delimited. Does not implicitly {@link tendermint.types.ValidatorParams.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.types.ValidatorParams - * @static - * @param {tendermint.types.IValidatorParams} message ValidatorParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ValidatorParams.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ValidatorParams message from the specified reader or buffer. - * @function decode - * @memberof tendermint.types.ValidatorParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.types.ValidatorParams} ValidatorParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorParams.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.ValidatorParams(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.pub_key_types && message.pub_key_types.length)) - message.pub_key_types = []; - message.pub_key_types.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ValidatorParams message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.types.ValidatorParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.types.ValidatorParams} ValidatorParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ValidatorParams.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ValidatorParams message. - * @function verify - * @memberof tendermint.types.ValidatorParams - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ValidatorParams.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.pub_key_types != null && message.hasOwnProperty("pub_key_types")) { - if (!Array.isArray(message.pub_key_types)) - return "pub_key_types: array expected"; - for (let i = 0; i < message.pub_key_types.length; ++i) - if (!$util.isString(message.pub_key_types[i])) - return "pub_key_types: string[] expected"; - } - return null; - }; - - /** - * Creates a ValidatorParams message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.types.ValidatorParams - * @static - * @param {Object.} object Plain object - * @returns {tendermint.types.ValidatorParams} ValidatorParams - */ - ValidatorParams.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.types.ValidatorParams) - return object; - let message = new $root.tendermint.types.ValidatorParams(); - if (object.pub_key_types) { - if (!Array.isArray(object.pub_key_types)) - throw TypeError(".tendermint.types.ValidatorParams.pub_key_types: array expected"); - message.pub_key_types = []; - for (let i = 0; i < object.pub_key_types.length; ++i) - message.pub_key_types[i] = String(object.pub_key_types[i]); - } - return message; - }; - - /** - * Creates a plain object from a ValidatorParams message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.types.ValidatorParams - * @static - * @param {tendermint.types.ValidatorParams} message ValidatorParams - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ValidatorParams.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.arrays || options.defaults) - object.pub_key_types = []; - if (message.pub_key_types && message.pub_key_types.length) { - object.pub_key_types = []; - for (let j = 0; j < message.pub_key_types.length; ++j) - object.pub_key_types[j] = message.pub_key_types[j]; - } - return object; - }; - - /** - * Converts this ValidatorParams to JSON. - * @function toJSON - * @memberof tendermint.types.ValidatorParams - * @instance - * @returns {Object.} JSON object - */ - ValidatorParams.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return ValidatorParams; - })(); - - types.VersionParams = (function() { - - /** - * Properties of a VersionParams. - * @memberof tendermint.types - * @interface IVersionParams - * @property {Long|null} [app_version] VersionParams app_version - */ - - /** - * Constructs a new VersionParams. - * @memberof tendermint.types - * @classdesc Represents a VersionParams. - * @implements IVersionParams - * @constructor - * @param {tendermint.types.IVersionParams=} [properties] Properties to set - */ - function VersionParams(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * VersionParams app_version. - * @member {Long} app_version - * @memberof tendermint.types.VersionParams - * @instance - */ - VersionParams.prototype.app_version = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified VersionParams message. Does not implicitly {@link tendermint.types.VersionParams.verify|verify} messages. - * @function encode - * @memberof tendermint.types.VersionParams - * @static - * @param {tendermint.types.IVersionParams} message VersionParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - VersionParams.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.app_version != null && Object.hasOwnProperty.call(message, "app_version")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.app_version); - return writer; - }; - - /** - * Encodes the specified VersionParams message, length delimited. Does not implicitly {@link tendermint.types.VersionParams.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.types.VersionParams - * @static - * @param {tendermint.types.IVersionParams} message VersionParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - VersionParams.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a VersionParams message from the specified reader or buffer. - * @function decode - * @memberof tendermint.types.VersionParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.types.VersionParams} VersionParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - VersionParams.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.VersionParams(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.app_version = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a VersionParams message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.types.VersionParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.types.VersionParams} VersionParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - VersionParams.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a VersionParams message. - * @function verify - * @memberof tendermint.types.VersionParams - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - VersionParams.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.app_version != null && message.hasOwnProperty("app_version")) - if (!$util.isInteger(message.app_version) && !(message.app_version && $util.isInteger(message.app_version.low) && $util.isInteger(message.app_version.high))) - return "app_version: integer|Long expected"; - return null; - }; - - /** - * Creates a VersionParams message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.types.VersionParams - * @static - * @param {Object.} object Plain object - * @returns {tendermint.types.VersionParams} VersionParams - */ - VersionParams.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.types.VersionParams) - return object; - let message = new $root.tendermint.types.VersionParams(); - if (object.app_version != null) - if ($util.Long) - (message.app_version = $util.Long.fromValue(object.app_version)).unsigned = true; - else if (typeof object.app_version === "string") - message.app_version = parseInt(object.app_version, 10); - else if (typeof object.app_version === "number") - message.app_version = object.app_version; - else if (typeof object.app_version === "object") - message.app_version = new $util.LongBits(object.app_version.low >>> 0, object.app_version.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a VersionParams message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.types.VersionParams - * @static - * @param {tendermint.types.VersionParams} message VersionParams - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - VersionParams.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.app_version = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.app_version = options.longs === String ? "0" : 0; - if (message.app_version != null && message.hasOwnProperty("app_version")) - if (typeof message.app_version === "number") - object.app_version = options.longs === String ? String(message.app_version) : message.app_version; - else - object.app_version = options.longs === String ? $util.Long.prototype.toString.call(message.app_version) : options.longs === Number ? new $util.LongBits(message.app_version.low >>> 0, message.app_version.high >>> 0).toNumber(true) : message.app_version; - return object; - }; - - /** - * Converts this VersionParams to JSON. - * @function toJSON - * @memberof tendermint.types.VersionParams - * @instance - * @returns {Object.} JSON object - */ - VersionParams.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return VersionParams; - })(); - - types.HashedParams = (function() { - - /** - * Properties of a HashedParams. - * @memberof tendermint.types - * @interface IHashedParams - * @property {Long|null} [block_max_bytes] HashedParams block_max_bytes - * @property {Long|null} [block_max_gas] HashedParams block_max_gas - */ - - /** - * Constructs a new HashedParams. - * @memberof tendermint.types - * @classdesc Represents a HashedParams. - * @implements IHashedParams - * @constructor - * @param {tendermint.types.IHashedParams=} [properties] Properties to set - */ - function HashedParams(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * HashedParams block_max_bytes. - * @member {Long} block_max_bytes - * @memberof tendermint.types.HashedParams - * @instance - */ - HashedParams.prototype.block_max_bytes = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * HashedParams block_max_gas. - * @member {Long} block_max_gas - * @memberof tendermint.types.HashedParams - * @instance - */ - HashedParams.prototype.block_max_gas = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Encodes the specified HashedParams message. Does not implicitly {@link tendermint.types.HashedParams.verify|verify} messages. - * @function encode - * @memberof tendermint.types.HashedParams - * @static - * @param {tendermint.types.IHashedParams} message HashedParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - HashedParams.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.block_max_bytes != null && Object.hasOwnProperty.call(message, "block_max_bytes")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.block_max_bytes); - if (message.block_max_gas != null && Object.hasOwnProperty.call(message, "block_max_gas")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.block_max_gas); - return writer; - }; - - /** - * Encodes the specified HashedParams message, length delimited. Does not implicitly {@link tendermint.types.HashedParams.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.types.HashedParams - * @static - * @param {tendermint.types.IHashedParams} message HashedParams message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - HashedParams.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a HashedParams message from the specified reader or buffer. - * @function decode - * @memberof tendermint.types.HashedParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.types.HashedParams} HashedParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - HashedParams.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.types.HashedParams(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.block_max_bytes = reader.int64(); - break; - case 2: - message.block_max_gas = reader.int64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a HashedParams message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.types.HashedParams - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.types.HashedParams} HashedParams - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - HashedParams.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a HashedParams message. - * @function verify - * @memberof tendermint.types.HashedParams - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - HashedParams.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.block_max_bytes != null && message.hasOwnProperty("block_max_bytes")) - if (!$util.isInteger(message.block_max_bytes) && !(message.block_max_bytes && $util.isInteger(message.block_max_bytes.low) && $util.isInteger(message.block_max_bytes.high))) - return "block_max_bytes: integer|Long expected"; - if (message.block_max_gas != null && message.hasOwnProperty("block_max_gas")) - if (!$util.isInteger(message.block_max_gas) && !(message.block_max_gas && $util.isInteger(message.block_max_gas.low) && $util.isInteger(message.block_max_gas.high))) - return "block_max_gas: integer|Long expected"; - return null; - }; - - /** - * Creates a HashedParams message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.types.HashedParams - * @static - * @param {Object.} object Plain object - * @returns {tendermint.types.HashedParams} HashedParams - */ - HashedParams.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.types.HashedParams) - return object; - let message = new $root.tendermint.types.HashedParams(); - if (object.block_max_bytes != null) - if ($util.Long) - (message.block_max_bytes = $util.Long.fromValue(object.block_max_bytes)).unsigned = false; - else if (typeof object.block_max_bytes === "string") - message.block_max_bytes = parseInt(object.block_max_bytes, 10); - else if (typeof object.block_max_bytes === "number") - message.block_max_bytes = object.block_max_bytes; - else if (typeof object.block_max_bytes === "object") - message.block_max_bytes = new $util.LongBits(object.block_max_bytes.low >>> 0, object.block_max_bytes.high >>> 0).toNumber(); - if (object.block_max_gas != null) - if ($util.Long) - (message.block_max_gas = $util.Long.fromValue(object.block_max_gas)).unsigned = false; - else if (typeof object.block_max_gas === "string") - message.block_max_gas = parseInt(object.block_max_gas, 10); - else if (typeof object.block_max_gas === "number") - message.block_max_gas = object.block_max_gas; - else if (typeof object.block_max_gas === "object") - message.block_max_gas = new $util.LongBits(object.block_max_gas.low >>> 0, object.block_max_gas.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a HashedParams message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.types.HashedParams - * @static - * @param {tendermint.types.HashedParams} message HashedParams - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - HashedParams.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.block_max_bytes = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.block_max_bytes = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, false); - object.block_max_gas = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.block_max_gas = options.longs === String ? "0" : 0; - } - if (message.block_max_bytes != null && message.hasOwnProperty("block_max_bytes")) - if (typeof message.block_max_bytes === "number") - object.block_max_bytes = options.longs === String ? String(message.block_max_bytes) : message.block_max_bytes; - else - object.block_max_bytes = options.longs === String ? $util.Long.prototype.toString.call(message.block_max_bytes) : options.longs === Number ? new $util.LongBits(message.block_max_bytes.low >>> 0, message.block_max_bytes.high >>> 0).toNumber() : message.block_max_bytes; - if (message.block_max_gas != null && message.hasOwnProperty("block_max_gas")) - if (typeof message.block_max_gas === "number") - object.block_max_gas = options.longs === String ? String(message.block_max_gas) : message.block_max_gas; - else - object.block_max_gas = options.longs === String ? $util.Long.prototype.toString.call(message.block_max_gas) : options.longs === Number ? new $util.LongBits(message.block_max_gas.low >>> 0, message.block_max_gas.high >>> 0).toNumber() : message.block_max_gas; - return object; - }; - - /** - * Converts this HashedParams to JSON. - * @function toJSON - * @memberof tendermint.types.HashedParams - * @instance - * @returns {Object.} JSON object - */ - HashedParams.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return HashedParams; - })(); - - return types; - })(); - - tendermint.version = (function() { - - /** - * Namespace version. - * @memberof tendermint - * @namespace - */ - const version = {}; - - version.App = (function() { - - /** - * Properties of an App. - * @memberof tendermint.version - * @interface IApp - * @property {Long|null} [protocol] App protocol - * @property {string|null} [software] App software - */ - - /** - * Constructs a new App. - * @memberof tendermint.version - * @classdesc Represents an App. - * @implements IApp - * @constructor - * @param {tendermint.version.IApp=} [properties] Properties to set - */ - function App(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * App protocol. - * @member {Long} protocol - * @memberof tendermint.version.App - * @instance - */ - App.prototype.protocol = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * App software. - * @member {string} software - * @memberof tendermint.version.App - * @instance - */ - App.prototype.software = ""; - - /** - * Encodes the specified App message. Does not implicitly {@link tendermint.version.App.verify|verify} messages. - * @function encode - * @memberof tendermint.version.App - * @static - * @param {tendermint.version.IApp} message App message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - App.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.protocol != null && Object.hasOwnProperty.call(message, "protocol")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.protocol); - if (message.software != null && Object.hasOwnProperty.call(message, "software")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.software); - return writer; - }; - - /** - * Encodes the specified App message, length delimited. Does not implicitly {@link tendermint.version.App.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.version.App - * @static - * @param {tendermint.version.IApp} message App message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - App.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an App message from the specified reader or buffer. - * @function decode - * @memberof tendermint.version.App - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.version.App} App - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - App.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.version.App(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.protocol = reader.uint64(); - break; - case 2: - message.software = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an App message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.version.App - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.version.App} App - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - App.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an App message. - * @function verify - * @memberof tendermint.version.App - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - App.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.protocol != null && message.hasOwnProperty("protocol")) - if (!$util.isInteger(message.protocol) && !(message.protocol && $util.isInteger(message.protocol.low) && $util.isInteger(message.protocol.high))) - return "protocol: integer|Long expected"; - if (message.software != null && message.hasOwnProperty("software")) - if (!$util.isString(message.software)) - return "software: string expected"; - return null; - }; - - /** - * Creates an App message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.version.App - * @static - * @param {Object.} object Plain object - * @returns {tendermint.version.App} App - */ - App.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.version.App) - return object; - let message = new $root.tendermint.version.App(); - if (object.protocol != null) - if ($util.Long) - (message.protocol = $util.Long.fromValue(object.protocol)).unsigned = true; - else if (typeof object.protocol === "string") - message.protocol = parseInt(object.protocol, 10); - else if (typeof object.protocol === "number") - message.protocol = object.protocol; - else if (typeof object.protocol === "object") - message.protocol = new $util.LongBits(object.protocol.low >>> 0, object.protocol.high >>> 0).toNumber(true); - if (object.software != null) - message.software = String(object.software); - return message; - }; - - /** - * Creates a plain object from an App message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.version.App - * @static - * @param {tendermint.version.App} message App - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - App.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.protocol = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.protocol = options.longs === String ? "0" : 0; - object.software = ""; - } - if (message.protocol != null && message.hasOwnProperty("protocol")) - if (typeof message.protocol === "number") - object.protocol = options.longs === String ? String(message.protocol) : message.protocol; - else - object.protocol = options.longs === String ? $util.Long.prototype.toString.call(message.protocol) : options.longs === Number ? new $util.LongBits(message.protocol.low >>> 0, message.protocol.high >>> 0).toNumber(true) : message.protocol; - if (message.software != null && message.hasOwnProperty("software")) - object.software = message.software; - return object; - }; - - /** - * Converts this App to JSON. - * @function toJSON - * @memberof tendermint.version.App - * @instance - * @returns {Object.} JSON object - */ - App.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return App; - })(); - - version.Consensus = (function() { - - /** - * Properties of a Consensus. - * @memberof tendermint.version - * @interface IConsensus - * @property {Long|null} [block] Consensus block - * @property {Long|null} [app] Consensus app - */ - - /** - * Constructs a new Consensus. - * @memberof tendermint.version - * @classdesc Represents a Consensus. - * @implements IConsensus - * @constructor - * @param {tendermint.version.IConsensus=} [properties] Properties to set - */ - function Consensus(properties) { - if (properties) - for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Consensus block. - * @member {Long} block - * @memberof tendermint.version.Consensus - * @instance - */ - Consensus.prototype.block = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Consensus app. - * @member {Long} app - * @memberof tendermint.version.Consensus - * @instance - */ - Consensus.prototype.app = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Encodes the specified Consensus message. Does not implicitly {@link tendermint.version.Consensus.verify|verify} messages. - * @function encode - * @memberof tendermint.version.Consensus - * @static - * @param {tendermint.version.IConsensus} message Consensus message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Consensus.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.block != null && Object.hasOwnProperty.call(message, "block")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.block); - if (message.app != null && Object.hasOwnProperty.call(message, "app")) - writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.app); - return writer; - }; - - /** - * Encodes the specified Consensus message, length delimited. Does not implicitly {@link tendermint.version.Consensus.verify|verify} messages. - * @function encodeDelimited - * @memberof tendermint.version.Consensus - * @static - * @param {tendermint.version.IConsensus} message Consensus message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Consensus.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Consensus message from the specified reader or buffer. - * @function decode - * @memberof tendermint.version.Consensus - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {tendermint.version.Consensus} Consensus - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Consensus.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - let end = length === undefined ? reader.len : reader.pos + length, message = new $root.tendermint.version.Consensus(); - while (reader.pos < end) { - let tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.block = reader.uint64(); - break; - case 2: - message.app = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Consensus message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof tendermint.version.Consensus - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {tendermint.version.Consensus} Consensus - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Consensus.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Consensus message. - * @function verify - * @memberof tendermint.version.Consensus - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Consensus.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.block != null && message.hasOwnProperty("block")) - if (!$util.isInteger(message.block) && !(message.block && $util.isInteger(message.block.low) && $util.isInteger(message.block.high))) - return "block: integer|Long expected"; - if (message.app != null && message.hasOwnProperty("app")) - if (!$util.isInteger(message.app) && !(message.app && $util.isInteger(message.app.low) && $util.isInteger(message.app.high))) - return "app: integer|Long expected"; - return null; - }; - - /** - * Creates a Consensus message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof tendermint.version.Consensus - * @static - * @param {Object.} object Plain object - * @returns {tendermint.version.Consensus} Consensus - */ - Consensus.fromObject = function fromObject(object) { - if (object instanceof $root.tendermint.version.Consensus) - return object; - let message = new $root.tendermint.version.Consensus(); - if (object.block != null) - if ($util.Long) - (message.block = $util.Long.fromValue(object.block)).unsigned = true; - else if (typeof object.block === "string") - message.block = parseInt(object.block, 10); - else if (typeof object.block === "number") - message.block = object.block; - else if (typeof object.block === "object") - message.block = new $util.LongBits(object.block.low >>> 0, object.block.high >>> 0).toNumber(true); - if (object.app != null) - if ($util.Long) - (message.app = $util.Long.fromValue(object.app)).unsigned = true; - else if (typeof object.app === "string") - message.app = parseInt(object.app, 10); - else if (typeof object.app === "number") - message.app = object.app; - else if (typeof object.app === "object") - message.app = new $util.LongBits(object.app.low >>> 0, object.app.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a Consensus message. Also converts values to other types if specified. - * @function toObject - * @memberof tendermint.version.Consensus - * @static - * @param {tendermint.version.Consensus} message Consensus - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Consensus.toObject = function toObject(message, options) { - if (!options) - options = {}; - let object = {}; - if (options.defaults) { - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.block = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.block = options.longs === String ? "0" : 0; - if ($util.Long) { - let long = new $util.Long(0, 0, true); - object.app = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.app = options.longs === String ? "0" : 0; - } - if (message.block != null && message.hasOwnProperty("block")) - if (typeof message.block === "number") - object.block = options.longs === String ? String(message.block) : message.block; - else - object.block = options.longs === String ? $util.Long.prototype.toString.call(message.block) : options.longs === Number ? new $util.LongBits(message.block.low >>> 0, message.block.high >>> 0).toNumber(true) : message.block; - if (message.app != null && message.hasOwnProperty("app")) - if (typeof message.app === "number") - object.app = options.longs === String ? String(message.app) : message.app; - else - object.app = options.longs === String ? $util.Long.prototype.toString.call(message.app) : options.longs === Number ? new $util.LongBits(message.app.low >>> 0, message.app.high >>> 0).toNumber(true) : message.app; - return object; - }; - - /** - * Converts this Consensus to JSON. - * @function toJSON - * @memberof tendermint.version.Consensus - * @instance - * @returns {Object.} JSON object - */ - Consensus.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return Consensus; - })(); - - return version; - })(); - - return tendermint; -})(); - -export { $root as default }; From 330fc7fe0d5faefad3761980ce42487d37b98910 Mon Sep 17 00:00:00 2001 From: Magic Cat Date: Fri, 16 Jul 2021 15:27:51 +0800 Subject: [PATCH 14/17] Rm space --- imports/ui/ledger/ledger.js | 1 - 1 file changed, 1 deletion(-) diff --git a/imports/ui/ledger/ledger.js b/imports/ui/ledger/ledger.js index 27ca21dd6..330103c63 100644 --- a/imports/ui/ledger/ledger.js +++ b/imports/ui/ledger/ledger.js @@ -12,7 +12,6 @@ import sha256 from "crypto-js/sha256" import ripemd160 from "crypto-js/ripemd160" import CryptoJS from "crypto-js" - // TODO: discuss TIMEOUT value const INTERACTION_TIMEOUT = 10000 const REQUIRED_COSMOS_APP_VERSION = Meteor.settings.public.ledger.ledgerAppVersion || "2.16.0"; From 46750035cf0c171689ef0628d4d38468d2600fba Mon Sep 17 00:00:00 2001 From: Magic Cat Date: Fri, 16 Jul 2021 15:29:36 +0800 Subject: [PATCH 15/17] Rm unused packages --- package-lock.json | 468 +--------------------------------------------- package.json | 6 - 2 files changed, 7 insertions(+), 467 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7aaea6a0c..d1cae69c5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -231,27 +231,6 @@ "xstream": "^11.14.0" } }, - "@cosmjs/launchpad": { - "version": "0.25.5", - "resolved": "https://registry.npmjs.org/@cosmjs/launchpad/-/launchpad-0.25.5.tgz", - "integrity": "sha512-7zsFWQHLAiOUBXV/QWvffI/5Ssma67lEO3V01DZ8CtfnWiO4bCSbnU2sslSAH11RkrPdNfRBM7WOBczMMigIzw==", - "requires": { - "@cosmjs/amino": "^0.25.5", - "@cosmjs/crypto": "^0.25.5", - "@cosmjs/encoding": "^0.25.5", - "@cosmjs/math": "^0.25.5", - "@cosmjs/utils": "^0.25.5", - "axios": "^0.21.1", - "fast-deep-equal": "^3.1.3" - }, - "dependencies": { - "fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" - } - } - }, "@cosmjs/math": { "version": "0.25.5", "resolved": "https://registry.npmjs.org/@cosmjs/math/-/math-0.25.5.tgz", @@ -334,46 +313,6 @@ "resolved": "https://registry.npmjs.org/@cosmjs/utils/-/utils-0.25.5.tgz", "integrity": "sha512-U4YdgJadFgXWblthgyXqP28Yw5rsw2IX/cOES0pa6fiB81hoYl2LXqXiuKp2yVPoAgk8JpkFh3i5KchcD9muJg==" }, - "@cosmostation/cosmosjs": { - "version": "0.9.5", - "resolved": "https://registry.npmjs.org/@cosmostation/cosmosjs/-/cosmosjs-0.9.5.tgz", - "integrity": "sha512-KPMUbbRLBnBIn+4LHNhgo5RSkP7rX6lpfH33ZSGFZ97814YrnShrHQYd20QbYkr7ymlyI65BflaI+Al90GgSzQ==", - "requires": { - "bech32": "^1.1.3", - "bip32": "^1.0.2", - "bip39": "^2.5.0", - "bitcoinjs-lib": "^4.0.2", - "node-fetch": "^2.6.0", - "secp256k1": "^3.6.2" - }, - "dependencies": { - "bip32": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/bip32/-/bip32-1.0.4.tgz", - "integrity": "sha512-8T21eLWylZETolyqCPgia+MNp+kY37zFr7PTFDTPObHeNi9JlfG4qGIh8WzerIJidtwoK+NsWq2I5i66YfHoIw==", - "requires": { - "bs58check": "^2.1.1", - "create-hash": "^1.2.0", - "create-hmac": "^1.1.7", - "tiny-secp256k1": "^1.0.0", - "typeforce": "^1.11.5", - "wif": "^2.0.6" - } - }, - "bip39": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/bip39/-/bip39-2.6.0.tgz", - "integrity": "sha512-RrnQRG2EgEoqO24ea+Q/fftuPUZLmrEM3qNhhGsA3PbaXaCW791LTzPuVyx/VprXQcTbPJ3K3UeTna8ZnVl2sg==", - "requires": { - "create-hash": "^1.1.0", - "pbkdf2": "^3.0.9", - "randombytes": "^2.0.1", - "safe-buffer": "^5.0.1", - "unorm": "^1.3.3" - } - } - } - }, "@emotion/is-prop-valid": { "version": "0.7.3", "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-0.7.3.tgz", @@ -465,40 +404,6 @@ "resolved": "https://registry.npmjs.org/@ledgerhq/logs/-/logs-5.50.0.tgz", "integrity": "sha512-swKHYCOZUGyVt4ge0u8a7AwNcA//h4nx5wIi0sruGye1IJ5Cva0GyK9L2/WdX+kWVTKp92ZiEo1df31lrWGPgA==" }, - "@lunie/cosmos-js": { - "version": "0.0.22", - "resolved": "https://registry.npmjs.org/@lunie/cosmos-js/-/cosmos-js-0.0.22.tgz", - "integrity": "sha512-u4ma8cnHGE60B4afmAnQnHDcjtqpPkEygOp21oO0eZBN0gn+KNDXtcTJzeZ307/3gfe0t4ZEKPh7mV6DDCafxg==", - "requires": { - "axios": "^0.19.0" - }, - "dependencies": { - "axios": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz", - "integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==", - "requires": { - "follow-redirects": "1.5.10" - } - }, - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "requires": { - "ms": "2.0.0" - } - }, - "follow-redirects": { - "version": "1.5.10", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", - "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", - "requires": { - "debug": "=3.1.0" - } - } - } - }, "@lunie/cosmos-keys": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/@lunie/cosmos-keys/-/cosmos-keys-0.3.2.tgz", @@ -1384,19 +1289,6 @@ "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=" }, - "asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", - "requires": { - "safer-buffer": "~2.1.0" - } - }, - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" - }, "assertion-error": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", @@ -1420,21 +1312,6 @@ "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" - }, - "aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" - }, - "aws4": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", - "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==" - }, "axe-core": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.1.0.tgz", @@ -1687,14 +1564,6 @@ "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" }, - "bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", - "requires": { - "tweetnacl": "^0.14.3" - } - }, "bcrypto": { "version": "5.4.0", "resolved": "https://registry.npmjs.org/bcrypto/-/bcrypto-5.4.0.tgz", @@ -1769,48 +1638,6 @@ "safe-buffer": "^5.0.1" } }, - "bitcoin-ops": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/bitcoin-ops/-/bitcoin-ops-1.4.1.tgz", - "integrity": "sha512-pef6gxZFztEhaE9RY9HmWVmiIHqCb2OyS4HPKkpc6CIiiOa3Qmuoylxc5P2EkU3w+5eTSifI9SEZC88idAIGow==" - }, - "bitcoinjs-lib": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/bitcoinjs-lib/-/bitcoinjs-lib-4.0.5.tgz", - "integrity": "sha512-gYs7K2hiY4Xb96J8AIF+Rx+hqbwjVlp5Zt6L6AnHOdzfe/2tODdmDxsEytnaxVCdhOUg0JnsGpl+KowBpGLxtA==", - "requires": { - "bech32": "^1.1.2", - "bip32": "^1.0.4", - "bip66": "^1.1.0", - "bitcoin-ops": "^1.4.0", - "bs58check": "^2.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.3", - "merkle-lib": "^2.0.10", - "pushdata-bitcoin": "^1.0.1", - "randombytes": "^2.0.1", - "safe-buffer": "^5.1.1", - "tiny-secp256k1": "^1.0.0", - "typeforce": "^1.11.3", - "varuint-bitcoin": "^1.0.4", - "wif": "^2.0.1" - }, - "dependencies": { - "bip32": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/bip32/-/bip32-1.0.4.tgz", - "integrity": "sha512-8T21eLWylZETolyqCPgia+MNp+kY37zFr7PTFDTPObHeNi9JlfG4qGIh8WzerIJidtwoK+NsWq2I5i66YfHoIw==", - "requires": { - "bs58check": "^2.1.1", - "create-hash": "^1.2.0", - "create-hmac": "^1.1.7", - "tiny-secp256k1": "^1.0.0", - "typeforce": "^1.11.5", - "wif": "^2.0.6" - } - } - } - }, "bn.js": { "version": "4.11.8", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", @@ -1912,11 +1739,6 @@ "resolved": "https://registry.npmjs.org/camelize/-/camelize-1.0.0.tgz", "integrity": "sha1-FkpUg+Yw+kMh5a8HAg5TGDGyYJs=" }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" - }, "chai": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.4.tgz", @@ -2177,14 +1999,6 @@ "color-name": "^1.0.0" } }, - "combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "requires": { - "delayed-stream": "~1.0.0" - } - }, "commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", @@ -2633,14 +2447,6 @@ "integrity": "sha512-JVrozIeElnj3QzfUIt8tB8YMluBJom4Vw9qTPpjGYQ9fYlB3D/rb6OordUxf3xeFB35LKWs0xqcO5U6ySvBtug==", "dev": true }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "requires": { - "assert-plus": "^1.0.0" - } - }, "debug": { "version": "3.2.7", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", @@ -2697,11 +2503,6 @@ "object-keys": "^1.0.12" } }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" - }, "detect-libc": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", @@ -2800,15 +2601,6 @@ } } }, - "ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", - "requires": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, "elliptic": { "version": "6.5.4", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", @@ -3597,11 +3389,6 @@ "safe-buffer": "^5.1.1" } }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" - }, "external-editor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", @@ -3613,11 +3400,6 @@ "tmp": "^0.0.33" } }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" - }, "fast-deep-equal": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", @@ -3627,7 +3409,8 @@ "fast-json-stable-stringify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", + "dev": true }, "fast-levenshtein": { "version": "2.0.6", @@ -3796,21 +3579,6 @@ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.1.tgz", "integrity": "sha512-HWqDgT7ZEkqRzBvc2s64vSZ/hfOceEol3ac/7tKwzuvEyWx3/4UegXh5oBOIotkGsObyk3xznnSRVADBgWSQVg==" }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" - }, - "form-data": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - } - }, "framesync": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/framesync/-/framesync-4.0.4.tgz", @@ -3888,14 +3656,6 @@ } } }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "requires": { - "assert-plus": "^1.0.0" - } - }, "glob": { "version": "7.1.4", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", @@ -3923,11 +3683,6 @@ "define-properties": "^1.1.3" } }, - "google-protobuf": { - "version": "3.17.3", - "resolved": "https://registry.npmjs.org/google-protobuf/-/google-protobuf-3.17.3.tgz", - "integrity": "sha512-OVPzcSWIAJ+d5yiHyeaLrdufQtrvaBrF4JQg+z8ynTkbO3uFcujqXszTumqg1cGsAsjkWnI+M5B1xZ19yR4Wyg==" - }, "graceful-fs": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", @@ -3938,38 +3693,6 @@ "resolved": "https://registry.npmjs.org/gud/-/gud-1.0.0.tgz", "integrity": "sha512-zGEOVKFM5sVPPrYs7J5/hYEw2Pof8KCyOwyhG8sAF26mCAeUFAcYPu1mwB7hhpIP29zOIBaDqwuHdLp0jvZXjw==" }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" - }, - "har-validator": { - "version": "5.1.5", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", - "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", - "requires": { - "ajv": "^6.12.3", - "har-schema": "^2.0.0" - }, - "dependencies": { - "ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "requires": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" - } - } - }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -4065,16 +3788,6 @@ "readable-stream": "^3.1.1" } }, - "http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", - "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -4339,11 +4052,6 @@ "has-symbols": "^1.0.0" } }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" - }, "is-what": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/is-what/-/is-what-3.5.0.tgz", @@ -4370,11 +4078,6 @@ "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz", "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==" }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" - }, "jquery": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz", @@ -4410,11 +4113,6 @@ "esprima": "^4.0.0" } }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" - }, "jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -4426,15 +4124,11 @@ "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", "dev": true }, - "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" - }, "json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true }, "json-stable-stringify": { "version": "1.0.1", @@ -4477,17 +4171,6 @@ "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=" }, - "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - } - }, "jsx-ast-utils": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.1.0.tgz", @@ -4718,11 +4401,6 @@ "is-what": "^3.3.1" } }, - "merkle-lib": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/merkle-lib/-/merkle-lib-2.0.10.tgz", - "integrity": "sha1-grjbrnXieneFOItz+ddyXQ9vMyY=" - }, "mersenne-twister": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/mersenne-twister/-/mersenne-twister-1.1.0.tgz", @@ -5313,19 +4991,6 @@ } } }, - "mime-db": { - "version": "1.48.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.48.0.tgz", - "integrity": "sha512-FM3QwxV+TnZYQ2aRqhlKBMHxk10lTbMt3bBkMAp54ddrNeVSfcQYOOKuGuy3Ddrm38I04If834fOUSq1yzslJQ==" - }, - "mime-types": { - "version": "2.1.31", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.31.tgz", - "integrity": "sha512-XGZnNzm3QvgKxa8dpzyhFTHmpP3l5YNusmne07VUOXxou9CqUqYa/HBy124RqtVh/O2pECas/MOcsDgpilPOPg==", - "requires": { - "mime-db": "1.48.0" - } - }, "mimic-fn": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", @@ -5450,11 +5115,6 @@ "bignumber.js": "^8.1.1" } }, - "oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" - }, "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -5973,11 +5633,6 @@ "sha.js": "^2.4.8" } }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" - }, "pify": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", @@ -6402,11 +6057,6 @@ } } }, - "psl": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", - "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==" - }, "pump": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", @@ -6429,26 +6079,14 @@ "punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true }, "pure-color": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/pure-color/-/pure-color-1.3.0.tgz", "integrity": "sha1-H+Bk+wrIUfDeYTIKi/eWg2Qi8z4=" }, - "pushdata-bitcoin": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/pushdata-bitcoin/-/pushdata-bitcoin-1.0.1.tgz", - "integrity": "sha1-FZMdPNlnreUiBvUjqnMxrvfUOvc=", - "requires": { - "bitcoin-ops": "^1.3.0" - } - }, - "qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" - }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -6770,33 +6408,6 @@ "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", "dev": true }, - "request": { - "version": "2.88.2", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", - "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.3", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - } - }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -7126,22 +6737,6 @@ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, - "sshpk": { - "version": "1.16.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", - "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - } - }, "stream-shift": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.1.tgz", @@ -7765,15 +7360,6 @@ "popper.js": "^1.0.2" } }, - "tough-cookie": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", - "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", - "requires": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - } - }, "trim-right": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", @@ -7801,19 +7387,6 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.8.1.tgz", "integrity": "sha1-aUavLR1lGnsYY7Ux1uWvpBqkTqw=" }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" - }, "type-check": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", @@ -7884,15 +7457,11 @@ "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" }, - "unorm": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/unorm/-/unorm-1.6.0.tgz", - "integrity": "sha512-b2/KCUlYZUeA7JFUuRJZPUtr4gZvBh7tavtv4fvk4+KV9pfGiR6CQAQAWl49ZpR3ts2dk4FYkP7EIgDJoiOLDA==" - }, "uri-js": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "dev": true, "requires": { "punycode": "^2.1.0" } @@ -7930,11 +7499,6 @@ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, - "uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" - }, "validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", @@ -7959,24 +7523,6 @@ "safe-buffer": "^5.1.1" } }, - "varuint-bitcoin": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/varuint-bitcoin/-/varuint-bitcoin-1.1.2.tgz", - "integrity": "sha512-4EVb+w4rx+YfVM32HQX42AbbT7/1f5zwAYhIujKXKk8NQK+JfRVl3pqT3hjNn/L+RstigmGGKVwHA/P0wgITZw==", - "requires": { - "safe-buffer": "^5.1.1" - } - }, - "verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "requires": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, "voca": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/voca/-/voca-1.4.0.tgz", diff --git a/package.json b/package.json index 021b21fae..a9e5ad3d4 100644 --- a/package.json +++ b/package.json @@ -11,14 +11,10 @@ }, "dependencies": { "@babel/runtime": "^7.13.17", - "@cosmjs/amino": "^0.25.5", - "@cosmjs/launchpad": "^0.25.5", "@cosmjs/proto-signing": "^0.25.5", "@cosmjs/stargate": "^0.25.5", - "@cosmostation/cosmosjs": "^0.9.5", "@ledgerhq/hw-transport-web-ble": "^5.50.0", "@ledgerhq/hw-transport-webusb": "^5.53.0", - "@lunie/cosmos-js": "0.0.22", "@lunie/cosmos-keys": "^0.3.2", "@types/meteor-universe-i18n": "^1.14.5", "axios": "^0.21.1", @@ -31,7 +27,6 @@ "crypto-js": "^3.3.0", "d3": "^5.16.0", "fibers": "^4.0.3", - "google-protobuf": "^3.17.3", "jquery": "^3.6.0", "js-sha256": "^0.9.0", "ledger-cosmos-js": "^2.1.8", @@ -56,7 +51,6 @@ "react-sidebar": "^3.0.2", "react-toastify": "^4.5.2", "reactstrap": "^8.9.0", - "request": "^2.88.2", "rollup": "^2.49.0", "secp256k1": "^3.8.0", "styled-components": "^4.4.1", From 4605f5ab4d11614d8396484305dbbf1f09136934 Mon Sep 17 00:00:00 2001 From: Magic Cat Date: Fri, 16 Jul 2021 15:36:13 +0800 Subject: [PATCH 16/17] Updated ChainStatus --- imports/ui/home/ChainStatus.jsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/imports/ui/home/ChainStatus.jsx b/imports/ui/home/ChainStatus.jsx index e9d40a8c6..a43b6e8bf 100644 --- a/imports/ui/home/ChainStatus.jsx +++ b/imports/ui/home/ChainStatus.jsx @@ -156,11 +156,8 @@ export default class ChainStatus extends React.Component { - chainStatus.latestHeight - - {this.state.blockHeight} - {this.state.blockTime} - + chainStatus.totalAccounts + {this.state.totalNumberOfCosmosAccounts?.total ?? 0}{this.state.totalNumberOfCosmosAccounts?.lastUpdated ?? new Date().toUTCString()} @@ -190,8 +187,11 @@ export default class ChainStatus extends React.Component { - chainStatus.totalAccounts - {this.state.totalNumberOfCosmosAccounts?.total}{this.state.totalNumberOfCosmosAccounts?.updatedAt} + chainStatus.latestHeight + + {this.state.blockHeight} + {this.state.blockTime} + From 511236f5d5135a675b62d022fc6461b4e33b818a Mon Sep 17 00:00:00 2001 From: Magic Cat Date: Fri, 16 Jul 2021 15:37:59 +0800 Subject: [PATCH 17/17] Updated label --- both/i18n/en-us.i18n.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/both/i18n/en-us.i18n.yml b/both/i18n/en-us.i18n.yml index 74a2490fe..ebefe2919 100644 --- a/both/i18n/en-us.i18n.yml +++ b/both/i18n/en-us.i18n.yml @@ -77,7 +77,7 @@ chainStatus: outOfValidators: 'out of {$totalValidators} validators' onlineVotingPower: 'Online Voting Power' fromTotalStakes: '{$percent} from {$totalStakes} {$denomPlural}' - totalAccounts: 'Total Number Of Cosmos Accounts' + totalAccounts: 'Cosmos Accounts (Total)' analytics: blockTimeHistory: 'Block Time History' averageBlockTime: 'Average Block Time'